./0000755000175000017500000000000011767656607010210 5ustar brianbrian./build.xml0000664000175000017500000000157411767656530012035 0ustar brianbrian ./.git/0000775000175000017500000000000011767656530011046 5ustar brianbrian./.git/description0000664000175000017500000000011111767656522013306 0ustar brianbrianUnnamed repository; edit this file 'description' to name the repository. ./.git/packed-refs0000664000175000017500000000013611767656530013155 0ustar brianbrian# pack-refs with: peeled 9b0887e14fb7ad7f61910432f5549bf1414a0ceb refs/remotes/origin/master ./.git/objects/0000775000175000017500000000000011767656522012500 5ustar brianbrian./.git/objects/info/0000775000175000017500000000000011767656522013433 5ustar brianbrian./.git/objects/pack/0000775000175000017500000000000011767656530013415 5ustar brianbrian./.git/objects/pack/pack-e354d41fc745469b2e0bad4a85699e8766a67df7.pack0000444000175000017500001172046211767656530022620 0ustar brianbrianPACK xA 0y~@$&=v5`Z U|Tald-lc$R(f'Akɓdl#Lc`a$߶U^piV8i\iGEZz׿Cs]K/|uA xK 0@9\@f+ؕx$ԁ޾'p{1C e@>Ͷcd5y F2 '_7 &%._ޖe=^a }F8GT[w;TM~u-4 x340031Qtv vep~cylgzb 7$U/7A~mz2{Srp2v8PBRifN^q,G춃QSðktv5W5\ֆ$ŴĘBqQ252>_nMXq)ZEx]ͪ1 F}lmե? n\RV[uosy DJT0@pK)ʐIP)e֘ Ys(#vEblz"KsV4|SOZ!bzcM7&oRQ Ý4Nwgv6]LxTn0 +x܆T]V` Ha)JeeGYNAl{$_fj\m# Pv&( F8m9q\kLh89'IONhYӁ6) WR:A|aZP$=NOX]aB,2)f0t̷}X$M!L 'q{'VBbyl snb!EB.Z)ԋhb"ʓY~jLnIM|/@'GryOaC*Y˪qXzw{NyUZNk}:Qv)(z|E/;=a *2=~Һ<{t{Y>4hr.KZXꍕ(7ec6(]j&-l^:nM6CXmG{miq=d)D+#am aET$;60:tvF7AÉ{-/wq(N0 J:;!=*[?:xun0 Dw}tHKA $cZVl)Hϯmp<5-Ic5xiv"c9b`(%: QKͷLiBlRA-kߓ+kug H O*Ԏ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''D;  B%^ (x )< ' yF$ ,V7 _3#SH'R%! )$=',D  >K$>\%' AK7 |F v#8-%!?@ 9a 4"Vl;B%+$v"Dz!]# 2' z/ ا c@7GX &k" g#ĒQ^$R$`BA$#U${%U* %r! $ w'} l^ }$nh ^a%͆ @A L = Dj$O 5kHeD" "9#+88&j%bb"tpr s"8I  x  kk > gU&"J 2/"\!pp!# t"S  v Jv* u 4  !ʊ$".$ d. r Y޴HR#?L5-'Z jټ05eW&X(3ADz سq! gPHӒ$%G #{J"BN#" !5W4E=~M|Zt!~i5mi* 2g r"C&7!%$sLEBV_$o!,'82 vhMt#ZK"!gj?WP#BWhnS[ +&_#QV':<)#X\ ^vZ"$%v+ 7"d ;x5tg$#w6;>%aj/!sʱ B F RN$$o)1'U#;C"Z%akl &ː$hק} o&8  AR #?%Cd_k$*dL8!` #T+%a% 2~8 f&qTbuild.shO]X۩O]X۩!|4P ;|(DTbn\\ build.xmlO]X۩O]X۩!v+M`)qs[$src/javax/ws/rs/ApplicationPath.javaO]X۩O]X۩!G/ݻs+@fsrc/javax/ws/rs/Consumes.javaO]X۩O]X۩!ڐ F-?*J` src/javax/ws/rs/CookieParam.javaO]X۩O]X۩!t;Nu(u;k~src/javax/ws/rs/DELETE.javaO]X۩O]X۩!U,g}CY@7!src/javax/ws/rs/DefaultValue.javaO]X۩O]X۩!\Xկ9~ 2src/javax/ws/rs/Encoded.javaO]X۩O]X۩! !8=/src/javax/ws/rs/FormParam.javaO]X۩O]X۩!hۏ ">zc{"src/javax/ws/rs/GET.javaO]X۩O]X۩!l־AnPKkJ/src/javax/ws/rs/HEAD.javaO]X۩O]X۩! wgťS"+& OO src/javax/ws/rs/HeaderParam.javaO]X۩O]X۩!R T#>3_msrc/javax/ws/rs/HttpMethod.javaO]X۩O]X۩! ˇ'_߾=@+< src/javax/ws/rs/MatrixParam.javaO]X۩O]X۩!m2^;src/javax/ws/rs/OPTIONS.javaO]X۩O]X۩!lA6P#N<;lsrc/javax/ws/rs/POST.javaO]X۩O]X۩!hC}5-)|:~src/javax/ws/rs/PUT.javaO]X۩O]X۩!بFkf |]@src/javax/ws/rs/Path.javaO]X۩O]X۩! T;ĕv3(?:src/javax/ws/rs/PathParam.javaO]X۩O]X۩!?wGSAG='src/javax/ws/rs/Produces.javaO]X۩O]X۩! 㬒X($vMLEsrc/javax/ws/rs/QueryParam.javaO]X۩O]X۩!ijFl!3Ɍ-",src/javax/ws/rs/WebApplicationException.javaO]X۩O]X۩! 4¦!-$=wI%src/javax/ws/rs/core/Application.javaO]X۩O]X۩!6O^ag3kW%_5B&src/javax/ws/rs/core/CacheControl.javaO]X۩O]X۩!L8#ɘ>:hgAٲ!src/javax/ws/rs/core/Context.javaO]X۩O]X۩!KB]MA4(j src/javax/ws/rs/core/Cookie.javaO]X۩O]X۩!\Nzc(8{VR#src/javax/ws/rs/core/EntityTag.javaO]X۩O]X۩!@ ZZV_Ǡ2KݘP['src/javax/ws/rs/core/GenericEntity.javaO]X۩O]X۩! v1줛wJ;Ydq{%src/javax/ws/rs/core/HttpHeaders.javaO]X۩O]X۩!&%^F!l)"O #src/javax/ws/rs/core/MediaType.javaO]X۩O]X۩!vwˆ`_.:!usAzg(src/javax/ws/rs/core/MultivaluedMap.javaO]X۩O]X۩! ,w_t0C]l_2#src/javax/ws/rs/core/NewCookie.javaO]X۩O]X۩!RE G~cruw%src/javax/ws/rs/core/PathSegment.javaO]X۩O]X۩!Vr,!9tR`!src/javax/ws/rs/core/Request.javaO]X۩O]X۩!mݥwoK'I"src/javax/ws/rs/core/Response.javaO]X۩O]X۩! *k)i!1A]$g")src/javax/ws/rs/core/SecurityContext.javaO]X۩O]X۩!UDh]Mn' v')src/javax/ws/rs/core/StreamingOutput.javaO]X۩O]X۩!RPf k igâ: X5$src/javax/ws/rs/core/UriBuilder.javaO]X۩O]X۩! m|qoʁtO^maF-src/javax/ws/rs/core/UriBuilderException.javaO]X۩O]X۩!+~29?dĠrml+bn'F!src/javax/ws/rs/core/UriInfo.javaO]X۩O]X۩!i +g0O% gu(!src/javax/ws/rs/core/Variant.javaO]X۩O]X۩!v5jLX&src/javax/ws/rs/core/package-info.javaO]X۩O]X۩!Y~]h~`/%6$(src/javax/ws/rs/ext/ContextResolver.javaO]X۩O]X۩!lP{tP[HD,(src/javax/ws/rs/ext/ExceptionMapper.javaO]X۩O]X۩!˒bM #A@uʐ#&src/javax/ws/rs/ext/FactoryFinder.javaO]X۩O]X۩!_"󄡺 v_>A J)c*src/javax/ws/rs/ext/MessageBodyWriter.javaO]X۩O]X۩!,ceݞ ^ k_!src/javax/ws/rs/ext/Provider.javaO]X۩O]X۩! -nBhU^"src/javax/ws/rs/ext/Providers.javaO]X۩O]X۩!!c=,lM(src/javax/ws/rs/ext/RuntimeDelegate.javaO]X۩O]X۩!j݅sՐw08m%src/javax/ws/rs/ext/package-info.javaO]X۩O]X۩!&#ˣYpڎ>Și!src/javax/ws/rs/package-info.javaO]X۩O]X۩!&n.p\h=p"D>HzuleU.?src/org/apache/axiom/attachments/impl/PartOnMemoryEnhanced.javaO]XZO]XZ!3Nf>y?>src/org/apache/axiom/attachments/lifecycle/DataHandlerExt.javaO]XZO]XZ!  ;ﴲ?)K#:we@src/org/apache/axiom/attachments/lifecycle/LifecycleManager.javaO]XZO]XZ! 8AS..[.Gsrc/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.javaO]XZO]XZ!  [YPm96xqmyAsrc/org/apache/axiom/attachments/lifecycle/impl/FileAccessor.javaO]XZO]XZ! $ )M>N(VNsrc/org/apache/axiom/attachments/lifecycle/impl/LifecycleEventDefinitions.javaO]XZO]XZ!}mf$? }p(%Jsrc/org/apache/axiom/attachments/lifecycle/impl/LifecycleEventHandler.javaO]XZO]XZ!,~7ƞuA$T([hIsrc/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.javaO]XZO]XZ! R:%&;9As `LHCsrc/org/apache/axiom/attachments/lifecycle/impl/VMShutdownHook.javaO]XZO]XZ!@g~^2I:src/org/apache/axiom/attachments/utils/BAAInputStream.javaO]XZO]XZ! @ ^"svQy;src/org/apache/axiom/attachments/utils/BAAOutputStream.javaO]XZO]XZ!b-#AJ䐲X[r6src/org/apache/axiom/attachments/utils/ByteSearch.javaO]XZO]XZ!{.| ;4l(ùcj"pJo:]IdVt[uD&src/org/apache/axiom/om/OMDocType.javaO]XZO]XZ!? wjjMǷ`Ѕ~c'src/org/apache/axiom/om/OMDocument.javaO]XZO]XZ!@QԆAݣZjBJ]&src/org/apache/axiom/om/OMElement.javaO]XZO]XZ!AyTe0pͽ(src/org/apache/axiom/om/OMException.javaO]XZO]XZ!B&n D4íO R&src/org/apache/axiom/om/OMFactory.javaO]XZO]XZ!C bX3~K/(Ey/1src/org/apache/axiom/om/OMHierarchyException.javaO]XZO]XZ!D!vͼa3*src/org/apache/axiom/om/OMMetaFactory.javaO]XZO]XZ!E lX]-(src/org/apache/axiom/om/OMNamespace.javaO]XZO]XZ!F!K#^v8@-ajKk#src/org/apache/axiom/om/OMNode.javaO]XZO]XZ!GCc+_A ^sqo+src/org/apache/axiom/om/OMOutputFormat.javaO]XZO]XZ!HtѕJ!Ht&"4src/org/apache/axiom/om/OMProcessingInstruction.javaO]XO]X!I "(Vcw!.:+src/org/apache/axiom/om/OMSerializable.javaO]XO]X!J@Q}(EIa/src/org/apache/axiom/om/OMXMLParserWrapper.javaO]XO]X!Ou,f7n4L`\.6.src/org/apache/axiom/om/OMXMLStreamReader.javaO]XO]X!Q AD_%v(src/org/apache/axiom/om/ds/Behavior.javaO]XO]X!R6p}© .&&%Ay93src/org/apache/axiom/om/ds/ByteArrayDataSource.javaO]XO]X!S aJN ٦\@e63src/org/apache/axiom/om/ds/CharArrayDataSource.javaO]XO]X!TճU#V6{)تh5src/org/apache/axiom/om/ds/InputStreamDataSource.javaO]XO]X!UBt Hc 3src/org/apache/axiom/om/ds/OMDataSourceExtBase.javaO]XO]X!V?SӏIA=uJȆ;src/org/apache/axiom/om/ds/ParserInputStreamDataSource.javaO]XO]X!W!TIyUgH}o{Isrc/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.javaO]XO]X!X "] wo[7QEsrc/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.javaO]XO]X!Z㕜 ialn ]<Dsrc/org/apache/axiom/om/ds/custombuilder/ByteArrayCustomBuilder.javaO]XO]X![řtO.1=HyreH ?'src/org/apache/axiom/om/ds/package.htmlO]XO]X!]Z_/_ @y]z7src/org/apache/axiom/om/impl/AbstractOMMetaFactory.javaO]XO]X!^$G̋8ja1src/org/apache/axiom/om/impl/EmptyOMLocation.javaO]XO]X!_A'p?W_݉ f 1src/org/apache/axiom/om/impl/MIMEOutputUtils.javaO]XO]X!`D 1sWrC+o)/src/org/apache/axiom/om/impl/MTOMConstants.javaO]XO]X!aP˪]ftl{5src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.javaO]XO]X!bd$D m>Tm2x/src/org/apache/axiom/om/impl/OMContainerEx.javaO]XO]X!c B Ԓa 1vAF7D4src/org/apache/axiom/om/impl/OMDocumentImplUtil.javaO]XO]X!d7ǐ+W6Q13src/org/apache/axiom/om/impl/OMMultipartWriter.javaO]XO]X!e OJѝW p"\M 1src/org/apache/axiom/om/impl/OMNamespaceImpl.javaO]XO]X!f~p9Ý/Mk4l-src/org/apache/axiom/om/impl/OMNavigator.javaO]XO]X!g F1%) ۍI f.*src/org/apache/axiom/om/impl/OMNodeEx.javaO]XO]X!hԵjs6OY`t/src/org/apache/axiom/om/impl/OMStAXWrapper.javaO]XO]X!i Ok]hO]z1zĊ8src/org/apache/axiom/om/impl/OptimizationPolicyImpl.javaO]XO]X!j̗f ΙBaZGg7˛mv2src/org/apache/axiom/om/impl/SwitchingWrapper.javaO]XO]X!lGmU ϭ426src/org/apache/axiom/om/impl/dom/CDATASectionImpl.javaO]XO]X!z2Vda]HBD3src/org/apache/axiom/om/impl/dom/CharacterImpl.javaO]XO]X!{$IJK|t̞w/src/org/apache/axiom/om/impl/dom/ChildNode.javaO]XO]X!|+=I<nĪ1src/org/apache/axiom/om/impl/dom/CommentImpl.javaO]XO]X!} U_I|ﺛnb;src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.javaO]XO]X!~0WZ*fDZȘy챋9src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.javaO]XO]X!M4xC g2src/org/apache/axiom/om/impl/dom/DOMNavigator.javaO]XO]X!ElM(%VaxUך4src/org/apache/axiom/om/impl/dom/DOMStAXWrapper.javaO]XO]X! CYi閄B>Bt-src/org/apache/axiom/om/impl/dom/DOMUtil.javaO]XO]X!{񛰂"7q W0~BH9src/org/apache/axiom/om/impl/dom/DOOMAbstractFactory.javaO]XO]X! =fǼ0 M~z&:src/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.javaO]XO]X!Ih0Aq~ߎCYE#e2src/org/apache/axiom/om/impl/dom/DocumentImpl.javaO]XO]X! HWH4C}VHФZ6src/org/apache/axiom/om/impl/dom/DocumentTypeImpl.javaO]XO]X!54F{Qpfc1src/org/apache/axiom/om/impl/dom/ElementImpl.javaO]XO]X!src/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.javaO]XO]X!(f&TTEڮp{IS>src/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.javaO]XO]X!bd4Ge4 T|Esrc/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.javaO]XO]X!cEy/2C~P1PEsrc/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.javaO]XO]X!NA"yJ˹Nj}IT Wq>src/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.javaO]XO]X!R cY_yN2Q>src/org/apache/axiom/om/impl/exception/OMBuilderException.javaO]XO]X!"弱X/j+Ot\@src/org/apache/axiom/om/impl/exception/OMStreamingException.javaO]XO]X! jRC?n]{!wFBsrc/org/apache/axiom/om/impl/exception/XMLComparisonException.javaO]XO]X!lu3ct71?\4src/org/apache/axiom/om/impl/llom/OMElementImpl.javaO]XO]X!AEu}vHEb̆m6src/org/apache/axiom/om/impl/llom/OMNamespaceImpl.javaO]XO]X!vYn:52jlK.2src/org/apache/axiom/om/impl/llom/OMNavigator.javaO]XO]X!/:W<5M!gXC91src/org/apache/axiom/om/impl/llom/OMNodeImpl.javaO]XO]X! 6Vڽ27x#jգiZBsrc/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.javaO]XO]X!pɆǣPhT0",`9src/org/apache/axiom/om/impl/llom/OMSerializableImpl.javaO]XO]X!#X1wy9)ĸjk;;src/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.javaO]XO]X!_beZO%W4src/org/apache/axiom/om/impl/llom/OMStAXWrapper.javaO]XO]X!75~%=1:7]1src/org/apache/axiom/om/impl/llom/OMTextImpl.javaO]XO]X!([R2VʙKNBFsrc/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.javaO]XO]X!=<|}@2e$AFsrc/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.javaO]XO]X! `Uv>8x*BBsrc/org/apache/axiom/om/impl/llom/factory/OMXMLBuilderFactory.javaO]XO]X!幦 Sm& r5src/org/apache/axiom/om/impl/llom/util/AXIOMUtil.javaO]XO]X!z c ]gI@src/org/apache/axiom/om/impl/llom/util/NamespaceContextImpl.javaO]XO]X!!hy${I'! Âj9src/org/apache/axiom/om/impl/llom/util/XMLComparator.javaO]XO]X!*񵍹lȌ/˚[E e7src/org/apache/axiom/om/impl/serialize/OMXMLReader.javaO]XO]X!̞ %:tQfw'JQsrc/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.javaO]XO]X!gt@w34ʸH@ 4Asrc/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.javaO]XO]X! c'JӄVS1!=src/org/apache/axiom/om/impl/traverse/OMAbstractIterator.javaO]XO]X!6d^`&8Asrc/org/apache/axiom/om/impl/traverse/OMChildElementIterator.javaO]XO]X!ݛ*F[1skn=src/org/apache/axiom/om/impl/traverse/OMChildrenIterator.javaO]XO]X!ӛi4Xי)0Hsrc/org/apache/axiom/om/impl/traverse/OMChildrenLegacyQNameIterator.javaO]XO]X!Ρo6K!wlnFsrc/org/apache/axiom/om/impl/traverse/OMChildrenLocalNameIterator.javaO]XO]X!%%M~;nFsrc/org/apache/axiom/om/impl/traverse/OMChildrenNamespaceIterator.javaO]XO]X! =|7ЁxdAճ3ρBsrc/org/apache/axiom/om/impl/traverse/OMChildrenQNameIterator.javaO]XO]X! #ZŁ\PMRsrc/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIterator.javaO]XO]X!HW $q%q@src/org/apache/axiom/om/impl/traverse/OMDescendantsIterator.javaO]XO]X! % '1|}sǐz;src/org/apache/axiom/om/impl/traverse/OMFilterIterator.javaO]XO]X!W Ux{\?zgJGXc@src/org/apache/axiom/om/impl/traverse/OMQNameFilterIterator.javaO]XO]X!hjS"2HcHsrc/org/apache/axiom/om/impl/traverse/OMQualifiedNameFilterIterator.javaO]XO]X!y@26;B 04src/org/apache/axiom/om/impl/util/EmptyIterator.javaO]XO]X!z'TiS\C7src/org/apache/axiom/om/impl/util/OMSerializerUtil.javaO]XO]X!7 HtΗ-m $src/org/apache/axiom/om/package.htmlO]XO]X!\O:}e\+src/org/apache/axiom/om/util/AXIOMUtil.javaO]XO]X!9n_fi[i?1src/org/apache/axiom/om/util/AttributeHelper.javaO]XO]X!sҝ//ǞF)V(src/org/apache/axiom/om/util/Base64.javaO]XO]X!G2mڴE-src/org/apache/axiom/om/util/CommonUtils.javaO]XO]X!WNkwi=kV+src/org/apache/axiom/om/util/CopyUtils.javaO]XO]X!7Sk[bgfB+07src/org/apache/axiom/om/util/DetachableInputStream.javaO]XO]X!3Y H׺ZT7<^1src/org/apache/axiom/om/util/DigestGenerator.javaO]XO]X!,9$I!nO?:#z,,/src/org/apache/axiom/om/util/ElementHelper.javaO]XO]X! s '"sKߘ1src/org/apache/axiom/om/util/LogOutputStream.javaO]XO]X! @Djh.Vxۉׅ10LGH0src/org/apache/axiom/om/util/XPathEvaluator.javaO]XO]X!/;vju[Nf-src/org/apache/axiom/om/xpath/AXIOMXPath.javaO]XO]X!qX+W4src/org/apache/axiom/om/xpath/DocumentNavigator.javaO]XO]X! 2Pw^`fG 8src/org/apache/axiom/osgi/FactoryInjectionComponent.javaO]XO]X! z )src/org/apache/axiom/soap/RolePlayer.javaO]XO]X! ̠nq:ЈS*.src/org/apache/axiom/soap/SOAP11Constants.javaO]XO]X!&|Δ9`/Dw.^Qt,src/org/apache/axiom/soap/SOAP11Version.javaO]XO]X!fH`j ˜TK.src/org/apache/axiom/soap/SOAP12Constants.javaO]XO]X!$#x:c_Imˉp,src/org/apache/axiom/soap/SOAP12Version.javaO]XO]X! !hԣ2D׹*P܇'src/org/apache/axiom/soap/SOAPBody.javaO]XO]X! '>g7Y7J lY,src/org/apache/axiom/soap/SOAPConstants.javaO]XO]X! BOnVqu;[D~#6+src/org/apache/axiom/soap/SOAPEnvelope.javaO]XO]X!,rDKǗ~afm./[(*src/org/apache/axiom/soap/SOAPFactory.javaO]XO]X! t6͢`4/ʫ(src/org/apache/axiom/soap/SOAPFault.javaO]XO]X!=`zdk>2src/org/apache/axiom/soap/SOAPFaultClassifier.javaO]XO]X!ߩ<.-J-,src/org/apache/axiom/soap/SOAPFaultCode.javaO]XO]X!Sh??2p~.src/org/apache/axiom/soap/SOAPFaultDetail.javaO]XO]X!."z%M]X`,src/org/apache/axiom/soap/SOAPFaultNode.javaO]XO]X!?GeN9K.src/org/apache/axiom/soap/SOAPFaultReason.javaO]XO]X!ނ~P˙n-_ dNT,src/org/apache/axiom/soap/SOAPFaultRole.javaO]XO]X!@p|px nG;tVo/src/org/apache/axiom/soap/SOAPFaultSubCode.javaO]XO]X!JJ N(ga@Hn,src/org/apache/axiom/soap/SOAPFaultText.javaO]XO]X!=!k=-src/org/apache/axiom/soap/SOAPFaultValue.javaO]XO]X!1>ɓgIQkxh5)src/org/apache/axiom/soap/SOAPHeader.javaO]XO]X!2BЌۂG~E.src/org/apache/axiom/soap/SOAPHeaderBlock.javaO]XO]X!5\K/Z)c*src/org/apache/axiom/soap/SOAPMessage.javaO]XOO]XO!El*NػJ/src/org/apache/axiom/soap/SOAPModelBuilder.javaO]XOO]XO! \`1_lKڕx_tj66src/org/apache/axiom/soap/SOAPProcessingException.javaO]XOO]XO! jj,-^qy0*src/org/apache/axiom/soap/SOAPVersion.javaO]XOO]XO! !xXir!{6Dsrc/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.javaO]XOO]XO!,S(+;c ?src/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.javaO]XOO]XO!8ǣS1p$:$Bq?src/org/apache/axiom/soap/impl/builder/SOAP12BuilderHelper.javaO]XOO]XO!%src/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.javaO]XOO]XO!m};,O/MCY=src/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.javaO]XOO]XO!&렷,C;Oc'src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.javaO]XOO]XO! R , _zQ Dsrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.javaO]XOO]XO!  GS"1IOAyBsrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.javaO]XOO]XO!! K -dEsrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.javaO]XOO]XO!"x%| Cu}Bsrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.javaO]XOO]XO!#VA)ciu @r^Csrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.javaO]XOO]XO!$ 8_uͷ֩}Dsrc/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.javaO]XOO]XO!% c-@$ij#<Ƈ<?src/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.javaO]XOO]XO!'bAQ!IOh eV(J@=src/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.javaO]XOO]XO!(%kܮ:nEmKH^K㼸M?q1~>src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.javaO]XOO]XO!,Z`Ѕ?#A3l*Bsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.javaO]XOO]XO!- gmd$<2ZsDsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.javaO]XOO]XO!.8WܨzN+Bsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.javaO]XOO]XO!/ne?*yI3aV]eEsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.javaO]XOO]XO!0f__9 VyΣ/Bsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.javaO]XOO]XO!1UbBa[2}z ,(Csrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.javaO]XOO]XO!2ҬQ6y*{}Dsrc/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.javaO]XOO]XO!3 R?jx,ji?src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.javaO]XOO]XO!51_VGa<5src/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.javaO]XOO]XO!69&Vx:!BPH:4src/org/apache/axiom/soap/impl/llom/SOAPElement.javaO]XOO]XO!7:ʾ{lSjգw P9src/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.javaO]XOO]XO!8 T0'; c=:src/org/apache/axiom/soap/impl/llom/SOAPFaultCodeImpl.javaO]XOO]XO!9 ,SQ-*MBJH) ;r~*!ovHJ[=src/org/apache/axiom/soap/impl/llom/SOAPFaultSubCodeImpl.javaO]XOO]XO!?}ў:wJ&:src/org/apache/axiom/soap/impl/llom/SOAPFaultTextImpl.javaO]XOO]XO!@ kOЄ4;src/org/apache/axiom/soap/impl/llom/SOAPFaultValueImpl.javaO]XOO]XO!AcJm~1S+ >2src/org/apache/axiom/soap/impl/llom/soap11/SOAP11BodyImpl.javaO]XOO]XO!G1A9ß0QG=src/org/apache/axiom/soap/impl/llom/soap11/SOAP11Factory.javaO]XOO]XO!H؍k~rl0hR}ЊWCsrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.javaO]XOO]XO!I~IK֋EuU!Esrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.javaO]XOO]XO!Jm O7_LP7G8CWjs?src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.javaO]XOO]XO!K H}1ϊQP9䙹6Esrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.javaO]XOO]XO!L 1E&XLOf*)dCsrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.javaO]XOO]XO!M^m܁6M6)Fsrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.javaO]XOO]XO!N?e.D&`+OCsrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultTextImpl.javaO]XOO]XO!O ϻuI$GVDsrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultValueImpl.javaO]XOO]XO!P!.AHHup" >?Esrc/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.javaO]XOO]XO!Q M_mw?^^kً @src/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.javaO]XOO]XO!S ZU)nA'G@4>src/org/apache/axiom/soap/impl/llom/soap12/SOAP12BodyImpl.javaO]XO]X!T0k:)-Pk6ldq=src/org/apache/axiom/soap/impl/llom/soap12/SOAP12Factory.javaO]XO]X!U ! 1=T@2"Csrc/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.javaO]XO]X!V8B/-#p 28Esrc/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultDetailImpl.javaO]XO]X!WԞ33%|;{?src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultImpl.javaO]XO]X!X aM0dԚpCsrc/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultNodeImpl.javaO]XO]X!Y Pg~r\Esrc/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultReasonImpl.javaO]XO]X!ZHѳT l|Csrc/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultRoleImpl.javaO]XO]X![MV^V 6zs!Φ@src/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.javaO]XO]X!a#8 }7#(]5~+src/org/apache/axiom/util/UIDGenerator.javaO]XO]X!c 4Ešoy9vcS&6h8%(src/org/apache/axiom/util/blob/Blob.javaO]XO]X!s桕ʟ uK/<ح2src/org/apache/axiom/util/blob/BlobDataSource.javaO]XO]X!t + xq_,NL4src/org/apache/axiom/util/blob/BlobOutputStream.javaO]XO]X!u) {ݝ 2ֆ.src/org/apache/axiom/util/blob/MemoryBlob.javaO]XO]X!v=> x0Su)Վ&0src/org/apache/axiom/util/blob/OverflowBlob.javaO]XO]X!w1eB]+50src/org/apache/axiom/util/blob/WritableBlob.javaO]XO]X!x[>@|vBhoGݲ+src/org/apache/axiom/util/blob/package.htmlO]XO]X!zߋo`P}VAsrc/org/apache/axiom/util/namespace/AbstractNamespaceContext.javaO]XO]X!{ Ag9ݧ ginNAsrc/org/apache/axiom/util/namespace/MapBasedNamespaceContext.javaO]XO]X!|QOʼuY]҈P?src/org/apache/axiom/util/namespace/ScopedNamespaceContext.javaO]XO]X!}!zd,z 0Q00src/org/apache/axiom/util/namespace/package.htmlO]XO]X!~=EydMN&src/org/apache/axiom/util/package.htmlO]XO]X!tj()o&'*"ޕ 4src/org/apache/axiom/util/sax/AbstractXMLReader.javaO]XO]X!e(MMt Ժ7;src/org/apache/axiom/util/stax/AbstractXMLStreamReader.javaO]XO]X!%ܮ;il8Is嗱U;src/org/apache/axiom/util/stax/AbstractXMLStreamWriter.javaO]XO]X!JJYCWk%%?&H1src/org/apache/axiom/util/stax/DummyLocation.javaO]XO]X!YT_,[ř{E{:9src/org/apache/axiom/util/stax/TextFromElementReader.javaO]XO]X!5#1,AE5-DVp*E?src/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.javaO]XO]X! 5. w)yl91src/org/apache/axiom/util/stax/XMLEventUtils.javaO]XO]X!:UJ.d$8;src/org/apache/axiom/util/stax/XMLFragmentStreamReader.javaO]XO]X!FVˎrj Z68src/org/apache/axiom/util/stax/XMLStreamIOException.javaO]XO]X!=q;]v5ahY0+{i8src/org/apache/axiom/util/stax/XMLStreamReaderUtils.javaO]XO]X!+2k3nNG#P 8src/org/apache/axiom/util/stax/XMLStreamWriterUtils.javaO]XO]X! 5έIX@;/BٚwX9src/org/apache/axiom/util/stax/XMLStreamWriterWriter.javaO]XO]X! ,D Hwɻ%@src/org/apache/axiom/util/stax/debug/UnclosedReaderDetector.javaO]XO]X!:5rr!Luʧ#Bsrc/org/apache/axiom/util/stax/debug/XMLStreamReaderValidator.javaO]XO]X!E`c ǫ1src/org/apache/axiom/util/stax/debug/package.htmlO]XO]X!o݇WtϜ_T']?src/org/apache/axiom/util/stax/dialect/AbstractStAXDialect.javaO]XO]X! T E_]6src/org/apache/axiom/util/stax/dialect/BEADialect.javaO]XO]X! kMoO ,^a]~3Bsrc/org/apache/axiom/util/stax/dialect/BEAInputFactoryWrapper.javaO]XO]X!%T`qQR=GõBsrc/org/apache/axiom/util/stax/dialect/BEAStreamReaderWrapper.javaO]XO]X!({A~>kGRsrc/org/apache/axiom/util/stax/dialect/DisallowDoctypeDeclInputFactoryWrapper.javaO]XO]X!0L@KD52Rsrc/org/apache/axiom/util/stax/dialect/DisallowDoctypeDeclStreamReaderWrapper.javaO]XO]X! q(A_)#;#K Csrc/org/apache/axiom/util/stax/dialect/EncodingDetectionHelper.javaO]XO]X!cQ,L\7!h؞I Ksrc/org/apache/axiom/util/stax/dialect/ImplicitNamespaceContextWrapper.javaO]XO]X! 6~?y1d0 eC=\src/org/apache/axiom/util/stax/dialect/NamespaceContextCorrectingXMLStreamReaderWrapper.javaO]XO]X!Z¾ۄd냂%\src/org/apache/axiom/util/stax/dialect/NamespaceContextCorrectingXMLStreamWriterWrapper.javaO]XO]X!_ ? 2^},v=dYsrc/org/apache/axiom/util/stax/dialect/NamespaceURICorrectingNamespaceContextWrapper.javaO]XO]X!ryi5as]'Msrc/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.javaO]XO]X!|# +Y秱b2^:Nsrc/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.javaO]XO]X!W֍baPjGvsU'8src/org/apache/axiom/util/stax/dialect/SJSXPDialect.javaO]XO]X!W&z^-#naHsrc/org/apache/axiom/util/stax/dialect/SJSXPNamespaceContextWrapper.javaO]XO]X!OJDl!eEsrc/org/apache/axiom/util/stax/dialect/SJSXPOutputFactoryWrapper.javaO]XO]X!Ь*p$)Dsrc/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.javaO]XO]X!3^eۡfbiACDsrc/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.javaO]XO]X!i)R簎>}GmC_=src/org/apache/axiom/util/stax/dialect/SecureXMLResolver.javaO]XO]X!9D,6$޴g`Pvsrc/org/apache/axiom/util/stax/dialect/UnknownStAXDialect.javaO]XO]X! }|Tb̲| ;src/org/apache/axiom/util/stax/dialect/WoodstoxDialect.javaO]XO]X!U 3$j,UYEL4Hsrc/org/apache/axiom/util/stax/dialect/WoodstoxOutputFactoryWrapper.javaO]XO]X!"Fڠ,iܬGsrc/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.javaO]XO]X!@J-EMڵB`&Jď>V^"Gsrc/org/apache/axiom/util/stax/dialect/WoodstoxStreamWriterWrapper.javaO]XO]X! Jigk@zu8src/org/apache/axiom/util/stax/dialect/XLXP1Dialect.javaO]XO]X!(R2aCsrc/org/apache/axiom/util/stax/dialect/XLXPInputFactoryWrapper.javaO]XO]X!8|COlL%0,Csrc/org/apache/axiom/util/stax/dialect/XLXPStreamReaderWrapper.javaO]XO]X!25}WިCsrc/org/apache/axiom/util/stax/dialect/XLXPStreamWriterWrapper.javaO]XO]X!lPYrW؈O&(1^ԁ3src/org/apache/axiom/util/stax/dialect/package.htmlO]XO]X!{҇S/RjCmٔ+src/org/apache/axiom/util/stax/package.htmlO]XO]X!#BWIM{v.Dsrc/org/apache/axiom/util/stax/wrapper/ImmutableXMLInputFactory.javaO]XO]X!:ePq}Esrc/org/apache/axiom/util/stax/wrapper/ImmutableXMLOutputFactory.javaO]XO]X!=KVld x/"[Csrc/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.javaO]XO]X!Ҳ 2Y6ȚDsrc/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.javaO]XO]X!̀X0@&lBsrc/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.javaO]XO]X! t'?gs(QPCsrc/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.javaO]XO]X!wYW*#2aZ Bsrc/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.javaO]XO]X!5`hzw1Bsrc/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.javaO]XO]X!sy9&toWVR3src/org/apache/axiom/util/stax/wrapper/package.htmlO]XO]X!R @u0=Ox΂)1:src/org/apache/axiom/util/stax/xop/ContentIDGenerator.javaO]XO]X! BK=܆~1^(&S8src/org/apache/axiom/util/stax/xop/MimePartProvider.javaO]XO]X!֣ 26EwXr:src/org/apache/axiom/util/stax/xop/OptimizationPolicy.javaO]XO]X!?~Y:4src/org/apache/axiom/util/stax/xop/XOPConstants.javaO]XO]X!B& rB; b1P?j?src/org/apache/axiom/util/stax/xop/XOPDecodingStreamReader.javaO]XO]X!)Yܾ+&klӭ8src/org/apache/axiom/util/stax/xop/XOPEncodedStream.javaO]XO]X!J4;/Z 0J?src/org/apache/axiom/util/stax/xop/XOPEncodingStreamReader.javaO]XO]X!O|>%Z6*Dgo@src/org/apache/axiom/util/stax/xop/XOPEncodingStreamWrapper.javaO]XO]X!!HxIZ}y< ?src/org/apache/axiom/util/stax/xop/XOPEncodingStreamWriter.javaO]XO]X!!u(eOgz&5h0src/org/apache/axiom/util/stax/xop/XOPUtils.javaO]XO]X!}f2p kyBk2/src/org/apache/axiom/util/stax/xop/package.htmlO]XO]X!SݚɩqjF?#src/org/apache/axis2/AxisFault.javaO]XO]X!?Nw} Q]zwc#src/org/apache/axis2/Constants.javaO]XO]X!!I@i% }шY=/src/org/apache/axis2/ServiceObjectSupplier.javaO]XO]X!?U˵Q-E;I4iV!src/org/apache/axis2/Version.javaO]XO]X!2)G?gB.&=8src/org/apache/axis2/addressing/AddressingConstants.javaO]XO]X!-PiKFR55]5src/org/apache/axis2/addressing/AddressingHelper.javaO]XO]X!psnOv\rEK(6src/org/apache/axis2/addressing/EndpointReference.javaO]XO]X!`RB'ʒj[T5LCXb]7%~7src/org/apache/axis2/builder/ApplicationXMLBuilder.javaO]XO]X!OC/RPqUS9E)src/org/apache/axis2/builder/Builder.javaO]XO]X!{دPT7=ѥ-src/org/apache/axis2/builder/BuilderUtil.javaO]XO]X!?'@H 4src/org/apache/axis2/builder/DiskFileDataSource.javaO]XO]X! ق$ Bvģ-Csv,Z~-src/org/apache/axis2/builder/MIMEBuilder.javaO]XO]X! Aח*I"K<]vOL[Q-src/org/apache/axis2/builder/MTOMBuilder.javaO]XO]X!7vrU:U7 :src/org/apache/axis2/builder/MultipartFormDataBuilder.javaO]XO]X! E'J{Ff`&''\-src/org/apache/axis2/builder/SOAPBuilder.javaO]XO]X!@ȩ׷ G0K7 Cbn8src/org/apache/axis2/builder/XFormURLEncodedBuilder.javaO]XO]X!J´@f_[:src/org/apache/axis2/classloader/JarFileUrlConnection.javaO]XO]X! c5P+o}=src/org/apache/axis2/classloader/JarFileUrlStreamHandler.javaO]XO]X!(l; <=src/org/apache/axis2/classloader/JarStreamHandlerFactory.javaO]XO]X!:XK{ 3^wT"gsD.{(src/org/apache/axis2/client/Options.javaO]X#O]X#!zt"s=-X.src/org/apache/axis2/client/ServiceClient.javaO]X#O]X#!"y~-HY0bG%src/org/apache/axis2/client/Stub.javaO]X#O]X#!}\ điߺM ϩ29src/org/apache/axis2/client/WSDLBasedPolicyProcessor.javaO]X#O]X#!mrƅYfe Ç_?t<2src/org/apache/axis2/client/async/AsyncResult.javaO]X#O]X#!Nd]CߪJ,  3src/org/apache/axis2/client/async/AxisCallback.javaO]X#O]X#! I }߫R@JRcXSxj/src/org/apache/axis2/client/async/Callback.javaO]X#O]X#!aVJ|frʛzDB33src/org/apache/axis2/clustering/ClusterManager.javaO]X#O]X#!,^֔[@%-X"e6src/org/apache/axis2/clustering/ClusteringCommand.javaO]X#O]X#!CyBWڲ8R*B 8src/org/apache/axis2/clustering/ClusteringConstants.javaO]X#O]X#!oLռVB)44src/org/apache/axis2/clustering/ClusteringFault.javaO]X#O]X#!pHL Jz+:e2src/org/apache/axis2/clustering/MessageSender.javaO]X#O]X#!w w#U6n|*;src/org/apache/axis2/clustering/RequestBlockingHandler.javaO]X#O]X#! 8™)؜%4Qsrc/org/apache/axis2/clustering/configuration/ConfigurationClusteringCommand.javaO]X#O]X#! ];W hW{3G\Gsrc/org/apache/axis2/clustering/configuration/ConfigurationManager.javaO]X#O]X#!Dg $;͟[UJcҀOsrc/org/apache/axis2/clustering/configuration/ConfigurationManagerListener.javaO]X#O]X#!($z{嵼R朐J b(Esrc/org/apache/axis2/clustering/context/ContextClusteringCommand.javaO]X#O]X#!t?_P#~G;src/org/apache/axis2/clustering/context/ContextManager.javaO]X#O]X#!`i< ^a HCsrc/org/apache/axis2/clustering/context/ContextManagerListener.javaO]X#O]X#!HZuj߸}i =>&7src/org/apache/axis2/clustering/context/Replicator.javaO]X#O]X#!6+h@EG$fX Ӡ $Bߜ1src/org/apache/axis2/context/AbstractContext.javaO]X#O]X#! ^dTjHl6src/org/apache/axis2/context/ConfigurationContext.javaO]X#O]X#! 51 K?=src/org/apache/axis2/context/ConfigurationContextFactory.javaO]X#O]X#! P]`oƔq沆-8p1src/org/apache/axis2/context/ContextListener.javaO]X#O]X#! 7z Il啓71^qY0src/org/apache/axis2/context/MessageContext.javaO]X#O]X#! zka}ISs6m P!9src/org/apache/axis2/context/MessageContextConstants.javaO]X#O]X#! S$Jsrc/org/apache/axis2/context/externalize/DebugObjectInput.javaO]X#O]X#!;|χ(ZMmt!=VEsrc/org/apache/axis2/context/externalize/DebugObjectOutputStream.javaO]X#O]X#!,t=CL.wLBsrc/org/apache/axis2/context/externalize/ExternalizeConstants.javaO]XC,O]XC,!@8tveq?ܩJ]#yEsrc/org/apache/axis2/context/externalize/MessageExternalizeUtils.javaO]XC,O]XC,!&HPG|l&VlEsrc/org/apache/axis2/context/externalize/ObjectInputStreamWithCL.javaO]XC,O]XC,!2@ҭ8t]"QO+Ti1Csrc/org/apache/axis2/context/externalize/SafeObjectInputStream.javaO]XC,O]XC,!_R]bSⷦ)XDsrc/org/apache/axis2/context/externalize/SafeObjectOutputStream.javaO]XC,O]XC,!6E*ݣ CQWK>src/org/apache/axis2/context/externalize/SafeSerializable.javaO]XC,O]XC,! 41k !DҜ P -src/org/apache/axis2/databinding/ADBBean.javaO]XC,O]XC,!!yT^񺿶?13src/org/apache/axis2/databinding/ADBDataSource.javaO]XC,O]XC,!"T50{j=% MP2src/org/apache/axis2/databinding/ADBException.javaO]XC,O]XC,!#8*J~Խ?pH>!wy9src/org/apache/axis2/databinding/ADBHelperDataSource.javaO]XC,O]XC,!$SgC-OQ$V 9src/org/apache/axis2/databinding/ADBSOAPModelBuilder.javaO]XC,O]XC,!%*"IDX"6)RCXM7src/org/apache/axis2/databinding/DataBindException.javaO]XC,O]XC,!'|n=k.Ԟ%g6src/org/apache/axis2/databinding/i18n/ADBMessages.javaO]XC,O]XC,!(>] ʇj9src/org/apache/axis2/databinding/i18n/resource.propertiesO]XC,O]XC,!*-*;ax# t[uH&Bsrc/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.javaO]XC,O]XC,!,pYΤY'TI,xx[ /src/org/apache/axis2/databinding/types/Day.javaO]XC,O]XC,!-8 /1^gk߿4src/org/apache/axis2/databinding/types/Duration.javaO]XC,O]XC,!.os#C}s} 4src/org/apache/axis2/databinding/types/Entities.javaO]XC,O]XC,!/b;{Emhh:R\ p/:"2src/org/apache/axis2/databinding/types/Entity.javaO]XC,O]XC,!0LnT7Hlro-zofN5src/org/apache/axis2/databinding/types/HexBinary.javaO]XC,O]XC,!1[EŶ= 8-8$_/1src/org/apache/axis2/databinding/types/IDRef.javaO]XC,O]XC,!2 .R*G*߮D3)2src/org/apache/axis2/databinding/types/IDRefs.javaO]XC,O]XC,!3 WR>!$l;%"H.src/org/apache/axis2/databinding/types/Id.javaO]XC,O]XC,!4 )HL0h*rj4src/org/apache/axis2/databinding/types/Language.javaO]XC,O]XC,!5#ԋ{J`1src/org/apache/axis2/databinding/types/Month.javaO]XC,O]XC,!6-{]7196F4src/org/apache/axis2/databinding/types/MonthDay.javaO]XC,O]XC,!7 UjŹ^DN26lhG2src/org/apache/axis2/databinding/types/NCName.javaO]XC,O]XC,!8 i+orߣ Fs3src/org/apache/axis2/databinding/types/NMToken.javaO]XC,O]XC,!9 Ȑ En ?r4src/org/apache/axis2/databinding/types/NMTokens.javaO]XC,O]XC,!: o2ƒD 30src/org/apache/axis2/databinding/types/Name.javaO]XC,O]XC,!; ?mgTeЅH:X;src/org/apache/axis2/databinding/types/NegativeInteger.javaO]XC,O]XC,!< ?\yZcVR$Ep>src/org/apache/axis2/databinding/types/NonNegativeInteger.javaO]XC,O]XC,!= ]joұX:>src/org/apache/axis2/databinding/types/NonPositiveInteger.javaO]XC,O]XC,!> y͞2׻3\/i&vU5src/org/apache/axis2/databinding/types/YearMonth.javaO]XC,O]XC,!KRRCJ;U3src/org/apache/axis2/databinding/types/package.htmlO]XC,O]XC,!MJ }NI?]I6W?C@src/org/apache/axis2/databinding/types/soapencoding/AnyType.javaO]XC,O]XC,!NTf02!`qL%!?src/org/apache/axis2/databinding/types/soapencoding/AnyURI.javaO]XC,O]XC,!OiZl؅FB>src/org/apache/axis2/databinding/types/soapencoding/Array.javaO]XC,O]XC,!PN2H0'ҭ4)rHsrc/org/apache/axis2/databinding/types/soapencoding/ArrayCoordinate.javaO]X5O]X5!Q=Dͅ4VZ[?src/org/apache/axis2/databinding/types/soapencoding/ArrayE.javaO]X5O]X5!RN4^ מEo5gO?src/org/apache/axis2/databinding/types/soapencoding/Base64.javaO]X5O]X5!SXr+3nQPyI>Esrc/org/apache/axis2/databinding/types/soapencoding/Base64Binary.javaO]X5O]X5!TS~ON^?$5vl=src/org/apache/axis2/databinding/types/soapencoding/Date.javaO]X5O]X5!UT^vnˮ&x}- F< Asrc/org/apache/axis2/databinding/types/soapencoding/DateTime.javaO]X5O]X5!VTB.+ rV@src/org/apache/axis2/databinding/types/soapencoding/Decimal.javaO]X5O]X5!WT¥Ce͎[H7~,\ܑAsrc/org/apache/axis2/databinding/types/soapencoding/Duration.javaO]X5O]X5!XT܄Pu).Asrc/org/apache/axis2/databinding/types/soapencoding/ENTITIES.javaO]X5O]X5!YTrq{@[yE>l*G7?src/org/apache/axis2/databinding/types/soapencoding/ENTITY.javaO]X5O]X5!ZGr T\j~@T iXHsrc/org/apache/axis2/databinding/types/soapencoding/ExtensionMapper.javaO]X5O]X5![T1XJ`jr8|۟C=src/org/apache/axis2/databinding/types/soapencoding/GDay.javaO]X5O]X5!\Tn0ćr}?src/org/apache/axis2/databinding/types/soapencoding/GMonth.javaO]X5O]X5!]TG !XKHOkԁzBsrc/org/apache/axis2/databinding/types/soapencoding/GMonthDay.javaO]X5O]X5!^TF=̙A%͈4kk6;>src/org/apache/axis2/databinding/types/soapencoding/GYear.javaO]X5O]X5!_UՒRX Di6Csrc/org/apache/axis2/databinding/types/soapencoding/GYearMonth.javaO]X5O]X5!`Tli9Qj)hjJdBsrc/org/apache/axis2/databinding/types/soapencoding/HexBinary.javaO]X5O]X5!aS"D̺{q{>ƚ ;src/org/apache/axis2/databinding/types/soapencoding/ID.javaO]X5O]X5!bTJW[RuJJV3OӦ>src/org/apache/axis2/databinding/types/soapencoding/IDREF.javaO]X5O]X5!cTrXkq[pF<Lsb?src/org/apache/axis2/databinding/types/soapencoding/IDREFS.javaO]X5O]X5!dTBMFe'*KU=l@src/org/apache/axis2/databinding/types/soapencoding/Integer.javaO]X5O]X5!eT<$p+P^5eAsrc/org/apache/axis2/databinding/types/soapencoding/Language.javaO]X5O]X5!fTr )(}m?src/org/apache/axis2/databinding/types/soapencoding/NCName.javaO]X5O]X5!gT#A?#@Nׯ#w{@src/org/apache/axis2/databinding/types/soapencoding/NMTOKEN.javaO]X5O]X5!hT^zvH!lz/_O^Asrc/org/apache/axis2/databinding/types/soapencoding/NMTOKENS.javaO]X5O]X5!iUZk6(E r8NAsrc/org/apache/axis2/databinding/types/soapencoding/NOTATION.javaO]X5O]X5!jT"@{sfY~p"2=src/org/apache/axis2/databinding/types/soapencoding/Name.javaO]X5O]X5!kUڙm)yn Y~AOHsrc/org/apache/axis2/databinding/types/soapencoding/NegativeInteger.javaO]X5O]X5!lVRMg=c&:-r_rKsrc/org/apache/axis2/databinding/types/soapencoding/NonNegativeInteger.javaO]X5O]X5!mVRV; /V+ J''Ksrc/org/apache/axis2/databinding/types/soapencoding/NonPositiveInteger.javaO]X5O]X5!nVp$o8Tc.FtwIsrc/org/apache/axis2/databinding/types/soapencoding/NormalizedString.javaO]X5O]X5!oUڼvժg,p?2VHsrc/org/apache/axis2/databinding/types/soapencoding/PositiveInteger.javaO]X5O]X5!pUNl=4{i% cӻ>src/org/apache/axis2/databinding/types/soapencoding/QName.javaO]X5O]X5!qSU&e CI#^^)?src/org/apache/axis2/databinding/types/soapencoding/String.javaO]X5O]X5!ry>f}4##Ieuf\?src/org/apache/axis2/databinding/types/soapencoding/Struct.javaO]X5O]X5!sT"͹1(6CB=src/org/apache/axis2/databinding/types/soapencoding/Time.javaO]X5O]X5!tTJ&fL%M+kut5>src/org/apache/axis2/databinding/types/soapencoding/Token.javaO]X5O]X5!uUbplv-~ ((ˇJEsrc/org/apache/axis2/databinding/types/soapencoding/UnsignedByte.javaO]X5O]X5!vU:.no퇬TDsrc/org/apache/axis2/databinding/types/soapencoding/UnsignedInt.javaO]X5O]X5!wUb m`Iخ9Esrc/org/apache/axis2/databinding/types/soapencoding/UnsignedLong.javaO]X5O]X5!xU9em)1\{Fsrc/org/apache/axis2/databinding/types/soapencoding/UnsignedShort.javaO]X5O]X5!yR@VIXCujU$zAsrc/org/apache/axis2/databinding/types/soapencoding/_boolean.javaO]X>O]X>!zR2{(- @mPX>src/org/apache/axis2/databinding/types/soapencoding/_byte.javaO]X>O]X>!{R|$\zAx}D2Xm[*@src/org/apache/axis2/databinding/types/soapencoding/_double.javaO]X>O]X>!|RU|!q 'EUNѽ4t?src/org/apache/axis2/databinding/types/soapencoding/_float.javaO]X>O]X>!}CȲWaxD.Z=src/org/apache/axis2/databinding/types/soapencoding/_int.javaO]X>O]X>!~R2ksrc/org/apache/axis2/databinding/types/soapencoding/_long.javaO]X>O]X>!RY.,11[µޢBW?src/org/apache/axis2/databinding/types/soapencoding/_short.javaO]X>O]X>!T4]CLWk D%_6src/org/apache/axis2/databinding/types/xsd/AnyURI.javaO]X>O]X>!N5a*|x ̔6src/org/apache/axis2/databinding/types/xsd/Base64.javaO]X>O]X>!XS+z5gzD%O]X>!S{H 1vu4src/org/apache/axis2/databinding/types/xsd/Date.javaO]X>O]X>!T,T{ `J 8src/org/apache/axis2/databinding/types/xsd/DateTime.javaO]X>O]X>!Tmi:cIvL?b}·[7src/org/apache/axis2/databinding/types/xsd/Decimal.javaO]X>O]X>!T,me̓skD\8src/org/apache/axis2/databinding/types/xsd/Duration.javaO]X>O]X>!T HHv,O]X>!T@224Y;@Wј6src/org/apache/axis2/databinding/types/xsd/ENTITY.javaO]X>O]X>!1`¿:x.U&?src/org/apache/axis2/databinding/types/xsd/ExtensionMapper.javaO]X>O]X>!S$[9uXed04src/org/apache/axis2/databinding/types/xsd/GDay.javaO]X>O]X>!T<*|hi4ϡh6src/org/apache/axis2/databinding/types/xsd/GMonth.javaO]X>O]X>!Tvu1  /Fgs9src/org/apache/axis2/databinding/types/xsd/GMonthDay.javaO]X>O]X>!T[-zv S#%Fc\E5src/org/apache/axis2/databinding/types/xsd/GYear.javaO]X>O]X>!T= sN]<:src/org/apache/axis2/databinding/types/xsd/GYearMonth.javaO]X>O]X>!TD am4M9src/org/apache/axis2/databinding/types/xsd/HexBinary.javaO]X>O]X>!S)v5D;f/A2src/org/apache/axis2/databinding/types/xsd/ID.javaO]X>O]X>!T:#V)^v*5src/org/apache/axis2/databinding/types/xsd/IDREF.javaO]X>O]X>!T@.ֆo:\;6src/org/apache/axis2/databinding/types/xsd/IDREFS.javaO]X>O]X>!Tx/>cmpx4~AKݻ7src/org/apache/axis2/databinding/types/xsd/Integer.javaO]X>O]X>!TË3/ t7su4|E88src/org/apache/axis2/databinding/types/xsd/Language.javaO]X>O]X>!T@)0%#ݯ'sd6src/org/apache/axis2/databinding/types/xsd/NCName.javaO]X>O]X>!Th䥉C~+&*WtY7src/org/apache/axis2/databinding/types/xsd/NMTOKEN.javaO]X>O]X>!T.s=P }jޏ8src/org/apache/axis2/databinding/types/xsd/NMTOKENS.javaO]X>O]X>!U=5jYm,;IJV:8src/org/apache/axis2/databinding/types/xsd/NOTATION.javaO]X>O]X>!S;:.?}ea ܜt4src/org/apache/axis2/databinding/types/xsd/Name.javaO]X>O]X>!UfӡOv=ĉR]K>?src/org/apache/axis2/databinding/types/xsd/NegativeInteger.javaO]X>O]X>!V ZƷKEBsrc/org/apache/axis2/databinding/types/xsd/NonNegativeInteger.javaO]X>O]X>!V 6l\a(_FATϧQBsrc/org/apache/axis2/databinding/types/xsd/NonPositiveInteger.javaO]X>O]X>!UM7O,EXJ>@src/org/apache/axis2/databinding/types/xsd/NormalizedString.javaO]X>O]X>!Ua/DSfISN?src/org/apache/axis2/databinding/types/xsd/PositiveInteger.javaO]X>O]X>!U ĨPK ="5src/org/apache/axis2/databinding/types/xsd/QName.javaO]X>O]X>!S뼭<oH˭ `n6src/org/apache/axis2/databinding/types/xsd/String.javaO]X>O]X>!S[ uy84src/org/apache/axis2/databinding/types/xsd/Time.javaO]X>O]X>!TŻaQhq5src/org/apache/axis2/databinding/types/xsd/Token.javaO]X>O]X>!U0q.8x_#g+0eO]X>!UF ]BM]5,AX&;src/org/apache/axis2/databinding/types/xsd/UnsignedInt.javaO]X>O]X>!U0o ,V)m? >~O]X>!UXlI՛KM2!9>=src/org/apache/axis2/databinding/types/xsd/UnsignedShort.javaO]X>O]X>!D0*oxdQp.h]E"8src/org/apache/axis2/databinding/types/xsd/_boolean.javaO]XGO]XG!ReZжyIEl&5src/org/apache/axis2/databinding/types/xsd/_byte.javaO]XGO]XG!RJek?`k+@𣇴Xk7src/org/apache/axis2/databinding/types/xsd/_double.javaO]XGO]XG!R#(]xl]5)e ]hU6src/org/apache/axis2/databinding/types/xsd/_float.javaO]XGO]XG!QB1=YŮ vbZsm4src/org/apache/axis2/databinding/types/xsd/_int.javaO]XGO]XG!R˚4!UBi5src/org/apache/axis2/databinding/types/xsd/_long.javaO]XGO]XG!R' QijT}U`(6src/org/apache/axis2/databinding/types/xsd/_short.javaO]XGO]XG!!=_9؀V!$=4src/org/apache/axis2/databinding/utils/BeanUtil.javaO]XGO]XG!+0/Hk*XJRȴyJ[5src/org/apache/axis2/databinding/utils/Constants.javaO]XGO]XG!{l>1)+S+5src/org/apache/axis2/databinding/utils/Converter.javaO]XGO]XG!4Y~#Wσde)%])Cn9src/org/apache/axis2/databinding/utils/ConverterUtil.javaO]XGO]XG!/FT^z$*Vt:src/org/apache/axis2/databinding/utils/MultirefHelper.javaO]XGO]XG!/[[cO! >t>src/org/apache/axis2/databinding/utils/NamedStaxOMBuilder.javaO]XGO]XG!dPωH~Rsrc/org/apache/axis2/databinding/utils/reader/OMAttribKey.javaO]XGO]XG!g4У\ YY5?src/org/apache/axis2/databinding/utils/reader/OMElementKey.javaO]XGO]XG!P]y​n]6!g=9vJsrc/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.javaO]XGO]XG!$JC&1E}{&0\zEsrc/org/apache/axis2/databinding/utils/writer/MTOMAwareOMBuilder.javaO]XGO]XG!(g djIsrc/org/apache/axis2/databinding/utils/writer/MTOMAwareXMLSerializer.javaO]XGO]XG!m ]Q04$TTKsrc/org/apache/axis2/databinding/utils/writer/MTOMAwareXMLStreamWriter.javaO]XGO]XG!#}P oBXq+;KHsrc/org/apache/axis2/databinding/utils/writer/OMElementStreamWriter.javaO]XGO]XG!kNH vqbKsrc/org/apache/axis2/databinding/utils/writer/OMStreamNamespaceContext.javaO]XGO]XG!r|A=jhv7src/org/apache/axis2/dataretrieval/AxisDataLocator.javaO]XGO]XG!Ų3=}(Mi (=4;src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.javaO]XGO]XG!srq;src/org/apache/axis2/dataretrieval/BaseAxisDataLocator.javaO]XGO]XG! އTNW߹Up>IR3src/org/apache/axis2/dataretrieval/DRConstants.javaO]XGO]XG!N`Z@;TL!U,src/org/apache/axis2/dataretrieval/Data.javaO]XGO]XG! m{A?wћgSy:src/org/apache/axis2/dataretrieval/DataLocatorFactory.javaO]XGO]XG!3*f6yĺf,r؋>src/org/apache/axis2/dataretrieval/DataRetrievalException.javaO]XGO]XG! L3E{x̗ACPÈQp2src/org/apache/axis2/deployment/ModuleBuilder.javaO]X7PO]X7P!u0y+NtJ3src/org/apache/axis2/deployment/ModuleDeployer.javaO]X7PO]X7P!3zLc6]N&47src/org/apache/axis2/deployment/RepositoryListener.javaO]X7PO]X7P!~cxjl0aple3src/org/apache/axis2/deployment/ServiceBuilder.javaO]X7PO]X7P!e$@,T4src/org/apache/axis2/deployment/ServiceDeployer.javaO]X7PO]X7P!9J8tTB8src/org/apache/axis2/deployment/scheduler/Scheduler.javaO]X7PO]X7P! 3ZϊZ;-Hq*@ !j1src/org/apache/axis2/description/AxisMessage.javaO]X7PO]X7P! ilJ\a0src/org/apache/axis2/description/AxisModule.javaO]X7PO]X7P!N u"#z? TRE3src/org/apache/axis2/description/AxisOperation.javaO]X7PO]X7P!I"riB7\D?%l :src/org/apache/axis2/description/AxisOperationFactory.javaO]X7PO]X7P!vuZn-9:}@BG1src/org/apache/axis2/description/AxisService.javaO]XtYO]XtY!]V;Dp;8src/org/apache/axis2/description/AxisService2WSDL11.javaO]XtYO]XtY!nν%ўY&pLE8src/org/apache/axis2/description/AxisService2WSDL20.javaO]XtYO]XtY!ʎQ~smC(!6src/org/apache/axis2/description/AxisServiceGroup.javaO]XtYO]XtY!j}^bke K1src/org/apache/axis2/description/ClientUtils.javaO]XtYO]XtY! r<tBh:src/org/apache/axis2/description/DescriptionConstants.javaO]XtYO]XtY!tTE;k)͛'C&*src/org/apache/axis2/description/Flow.javaO]XtYO]XtY!I+ig<"J4 1src/org/apache/axis2/description/FlowInclude.javaO]XtYO]XtY!B=B\u&l 3Q6src/org/apache/axis2/description/ParameterInclude.javaO]XtYO]XtY!!+F.lt3.\:src/org/apache/axis2/description/ParameterIncludeImpl.javaO]XtYO]XtY!"}'z"-,[#j\C U7src/org/apache/axis2/description/ParameterObserver.javaO]XtYO]XtY!#ޒUXNhºØ%/src/org/apache/axis2/description/PhaseRule.javaO]XtYO]XtY!$5kq~uԭ$"ȸC3src/org/apache/axis2/description/PolicyInclude.javaO]XtYO]XtY!%pΏ=gqQk3src/org/apache/axis2/description/PolicySubject.javaO]XtYO]XtY!&lu2Vu;aIKr8^L@src/org/apache/axis2/description/RobustOutOnlyAxisOperation.javaO]XtYO]XtY!'q%@}MSlF=src/org/apache/axis2/description/TransportOutDescription.javaO]XtYO]XtY!)!x''=src/org/apache/axis2/description/TwoChannelAxisOperation.javaO]XtYO]XtY!*E}%z/~'88g@Dsrc/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.javaO]XtYO]XtY!+7MYuO\@src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.javaO]XtYO]XtY!, AÓB;*P>src/org/apache/axis2/description/WSDL20DefaultValueHolder.javaO]XtYO]XtY!-i(kyj6e?־h?$Dsrc/org/apache/axis2/description/WSDL20ToAllAxisServicesBuilder.javaO]XtYO]XtY!.0Qn&ZR`tk@src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.javaO]XtYO]XtY!/0͕mN8꣖4src/org/apache/axis2/description/WSDL2Constants.javaO]XtYO]XtY!0%+Wlxv[ەH>src/org/apache/axis2/description/WSDLToAxisServiceBuilder.javaO]XtYO]XtY!2әD~]kog ܯCsrc/org/apache/axis2/description/java2wsdl/AnnotationConstants.javaO]XtYO]XtY!3 hǰ ͮ !n,84Isrc/org/apache/axis2/description/java2wsdl/DefaultNamespaceGenerator.javaO]XtYO]XtY!4:L gU~4g bFsrc/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.javaO]XtYO]XtY!5a@0(آm1y=Isrc/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.javaO]XtYO]XtY!6eUXRv]baTgݏBsrc/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.javaO]XtYO]XtY!7 tC$0W(A3>src/org/apache/axis2/description/java2wsdl/Java2WSDLUtils.javaO]XtYO]XtY!8s9<6UIӄ>+Bsrc/org/apache/axis2/description/java2wsdl/NamespaceGenerator.javaO]XtYO]XtY!9z~@DŬFSU$r?src/org/apache/axis2/description/java2wsdl/SchemaGenerator.javaO]XtYO]XtY!:"2I!IR}9src/org/apache/axis2/description/java2wsdl/TypeTable.javaO]XtYO]XtY!<ʌOL`2/eN_AQZCbKsrc/org/apache/axis2/description/java2wsdl/bytecode/ChainedParamReader.javaO]XbO]Xb!=7~9nފ,=)ѭDsrc/org/apache/axis2/description/java2wsdl/bytecode/ClassReader.javaO]XbO]Xb!>7z2yɰS~2Dsrc/org/apache/axis2/description/java2wsdl/bytecode/MethodTable.javaO]XbO]Xb!? Pr̛T1( :GKsrc/org/apache/axis2/description/java2wsdl/bytecode/ParamNameExtractor.javaO]XbO]Xb!@1Vf3aaJ/*Hsrc/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.javaO]XbO]Xb!KRxAw*!X :EFsrc/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.javaO]XbO]Xb!L Q\` 6E%ٸBCsrc/org/apache/axis2/dispatchers/RequestURIOperationDispatcher.javaO]XbO]Xb!M n1c.&"6\[==o?src/org/apache/axis2/dispatchers/SOAPActionBasedDispatcher.javaO]XbO]Xb!N񆥍$6桸FODsrc/org/apache/axis2/dispatchers/SOAPMessageBodyBasedDispatcher.javaO]XbO]Xb!O Q6i+o?j}]u< Msrc/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.javaO]XbO]Xb!P wpK4S- +ũa=]Ksrc/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.javaO]XbO]Xb!R@B3.zF g3src/org/apache/axis2/engine/AbstractDispatcher.javaO]XbO]Xb!S6w|L:Ԡ:src/org/apache/axis2/engine/AddressingBasedDispatcher.javaO]XbO]Xb!T v?r-Lع#w52src/org/apache/axis2/engine/AxisConfiguration.javaO]XbO]Xb!Uژ6p{ "1src/org/apache/axis2/engine/AxisConfigurator.javaO]XbO]Xb!VqL]R8 g19yƲoy+src/org/apache/axis2/engine/AxisEngine.javaO]XbO]Xb!W g'!߸>j_*src/org/apache/axis2/engine/AxisError.javaO]XbO]Xb!XQ$f|iW*src/org/apache/axis2/engine/AxisEvent.javaO]XbO]Xb!Yq%dj}}Zcp-src/org/apache/axis2/engine/AxisObserver.javaO]XbO]Xb!Z D`ݎnl+src/org/apache/axis2/engine/AxisServer.javaO]XbO]Xb![w1U[޽+:ek6src/org/apache/axis2/engine/DefaultObjectSupplier.javaO]XbO]Xb!\ᖒ 0}דl[.2src/org/apache/axis2/engine/DependencyManager.javaO]XbO]Xb!] ?k7h*4dX_+src/org/apache/axis2/engine/Deployable.javaO]XbO]Xb!^(~71 XwM Y0src/org/apache/axis2/engine/DeployableChain.javaO]XbO]Xb!_9-ǒכc71 .src/org/apache/axis2/engine/DispatchPhase.javaO]XbO]Xb!`^Odl ڮ'[g(j0src/org/apache/axis2/engine/ListenerManager.javaO]XbO]Xb!d2E o؉g#O!!0src/org/apache/axis2/engine/MessageReceiver.javaO]XbO]Xb!efsr 2Y&JۄI/src/org/apache/axis2/engine/ObjectSupplier.javaO]XbO]Xb!f;OĞp dcsrc/org/apache/axis2/engine/RequestURIOperationDispatcher.javaO]XbO]Xb!j,FJ1^N4yH:src/org/apache/axis2/engine/SOAPActionBasedDispatcher.javaO]XbO]Xb!k`ș_Φ0_?src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.javaO]XbO]Xb!l׵sXÔ7`a 1src/org/apache/axis2/engine/ServiceLifeCycle.javaO]XbO]Xb!n ݃Tb*gmEX2src/org/apache/axis2/handlers/AbstractHandler.javaO]XbO]Xb!pK5 <x;--,src/org/apache/axis2/i18n/MessageBundle.javaO]XbO]Xb!q1J<o\(uhV=src/org/apache/axis2/receivers/AbstractInMessageReceiver.javaO]XbO]Xb!,UI-+u?8bA=H`Esrc/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.javaO]XbO]Xb!l}Nl~N>t1@(@src/org/apache/axis2/receivers/AbstractInOutMessageReceiver.javaO]XbO]Xb!-oO#2!]I!Dsrc/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.javaO]XbO]Xb!7@Jl1sx;src/org/apache/axis2/receivers/AbstractMessageReceiver.javaO]XbO]Xb!9|zx'W}¬fp\lCsrc/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.javaO]XbO]Xb!Tv&6$F]$,?src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.javaO]XbO]Xb!CovGy/ϱ7uCsrc/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.javaO]XkO]Xk!V5*|G{=0 >src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.javaO]XkO]Xk!GqM[#Am8  2src/org/apache/axis2/receivers/ServerCallback.javaO]XkO]Xk!=,src/org/apache/axis2/rpc/receivers/ejb/EJBMessageReceiver.javaO]XkO]Xk!43F"=^Լ3src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.javaO]XkO]Xk!]ʌɯ&nG9src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.javaO]XkO]Xk!7͊g[ To_;0src/org/apache/axis2/schema/CompilerOptions.javaO]XkO]Xk!sb=}ZҬ!1src/org/apache/axis2/schema/ExtensionUtility.javaO]XkO]Xk!Y7Qi:W^ZT\1♇;src/org/apache/axis2/schema/SchemaCompilationException.javaO]XkO]Xk!  0ʫqEFHG /src/org/apache/axis2/schema/SchemaCompiler.javaO]XkO]Xk!1͉~[ҋOͽXH> 0src/org/apache/axis2/schema/SchemaConstants.javaO]XkO]Xk!Od38F:%)src/org/apache/axis2/schema/XSD2Java.javaO]XkO]Xk!lemfU!0LӦܧk7src/org/apache/axis2/schema/c-schema-compile.propertiesO]XkO]Xk!J*9nLh=Jk eM$!B4src/org/apache/axis2/schema/i18n/resource.propertiesO]XkO]Xk!q-% ԴJP55src/org/apache/axis2/schema/schema-compile.propertiesO]XkO]Xk!AAaΨnsEڴ_8src/org/apache/axis2/schema/template/ADBBeanTemplate.xslO]X+tO]X+t!rhf$אnC8Q'?src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xslO]X+tO]X+t!Qq<}@ϛ#?src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xslO]X+tO]X+t!a#<1nק_dUӍx?src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xslO]X+tO]X+t!2Pܩz57src/org/apache/axis2/transport/http/CustomListener.javaO]Xh}O]Xh}!96O$,XCT6src/org/apache/axis2/transport/http/HTTPConstants.javaO]Xh}O]Xh}!.nB+٠5X4d83src/org/apache/axis2/transport/http/HTTPSender.javaO]Xh}O]Xh}!WƖaW>src/org/apache/axis2/transport/http/HTTPTransportReceiver.javaO]Xh}O]Xh}!DZ~Px:Ă;`iC[K^T;src/org/apache/axis2/transport/http/HTTPTransportUtils.javaO]Xh}O]Xh}!DiڑlX^,xҚg3src/org/apache/axis2/transport/http/HTTPWorker.javaO]Xh}O]Xh}!lQh,0e5sM1,)c:src/org/apache/axis2/transport/http/HTTPWorkerFactory.javaO]Xh}O]Xh}!%ŋΛa]c2*c@src/org/apache/axis2/transport/http/HttpTransportProperties.javaO]Xh}O]Xh}!Im9ܐ.175src/org/apache/axis2/transport/http/ListingAgent.javaO]Xh}O]Xh}!QOA8'h@3\HCsrc/org/apache/axis2/transport/http/MultipartFormDataFormatter.javaO]Xh}O]Xh}!FW /oo)L# ;src/org/apache/axis2/transport/http/ProxyConfiguration.javaO]Xh}O]Xh}!XR}igWBUkb:src/org/apache/axis2/transport/http/RESTRequestEntity.javaO]Xh}O]Xh}!`X`R xB%M;src/org/apache/axis2/transport/http/RESTRequestEntity2.javaO]Xh}O]Xh}!&iހ]p=Pd=src/org/apache/axis2/transport/http/SOAPMessageFormatter.javaO]Xh}O]Xh}!둕50;{sEsrc/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.javaO]Xh}O]Xh}!4xT\ovϙn;9src/org/apache/axis2/transport/http/SimpleHTTPServer.javaO]Xh}O]Xh}!X_ vN1peE"c9src/org/apache/axis2/transport/http/TransportHeaders.javaO]Xh}O]Xh}!=LښvmAsrc/org/apache/axis2/transport/http/XFormURLEncodedFormatter.javaO]Xh}O]Xh}!#6m1Cz9}\B37|>Bsrc/org/apache/axis2/transport/http/server/AxisHttpConnection.javaO]Xh}O]Xh}!$q$zyLf\reFsrc/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.javaO]Xh}O]Xh}!W)V9R4D3UŸL?src/org/apache/axis2/transport/http/server/AxisHttpRequest.javaO]Xh}O]Xh}!xcOf6󰃐5بCsrc/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.javaO]Xh}O]Xh}!; de"4?_V@src/org/apache/axis2/transport/http/server/AxisHttpResponse.javaO]Xh}O]Xh}! cX5|xp]WODsrc/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.javaO]Xh}O]Xh}!nr¤d롃Isrc/org/apache/axis2/transport/http/server/DefaultConnectionListener.javaO]Xh}O]Xh}!b;"() ߣu)H7 Wsrc/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.javaO]Xh}O]Xh}!V2lt ƹ:Lsrc/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.javaO]Xh}O]Xh}!  ^eYU[.).s5Dsrc/org/apache/axis2/transport/http/server/DefaultThreadFactory.javaO]Xh}O]Xh}!Ƹ"By nrOsf.HȕdEsrc/org/apache/axis2/transport/http/server/HttpConnectionManager.javaO]Xh}O]Xh}!C*ԣĥu>)e V;src/org/apache/axis2/transport/http/server/HttpFactory.javaO]Xh}O]Xh}!`ʫeş|.>9?6sVDsrc/org/apache/axis2/transport/http/server/HttpServiceProcessor.javaO]Xh}O]Xh}!-Lnf";\[#(9src/org/apache/axis2/transport/http/server/HttpUtils.javaO]Xh}O]Xh}!va˜?y?>iLޥ;src/org/apache/axis2/transport/http/server/IOProcessor.javaO]Xh}O]Xh}!Ї58\i-aCsrc/org/apache/axis2/transport/http/server/IOProcessorCallback.javaO]Xh}O]Xh}! ,k(֝2z_rjjDsrc/org/apache/axis2/transport/http/server/RequestSessionCookie.javaO]Xh}O]Xh}! D-1jYGD}Esrc/org/apache/axis2/transport/http/server/ResponseSessionCookie.javaO]Xh}O]Xh}! 5zʪej>src/org/apache/axis2/transport/http/server/SessionManager.javaO]Xh}O]Xh}!&̺i< @src/org/apache/axis2/transport/http/server/SimpleHttpServer.javaO]Xh}O]Xh}!uG܃ۮ(/)16src/org/apache/axis2/transport/http/server/Worker.javaO]Xh}O]Xh}!Kl3Jٖz"=src/org/apache/axis2/transport/http/server/WorkerFactory.javaO]Xh}O]Xh}!fOĸ*(-x9src/org/apache/axis2/transport/http/util/ComplexPart.javaO]Xh}O]Xh}!xY x]p6src/org/apache/axis2/transport/http/util/RESTUtil.javaO]Xh}O]Xh}!SL">?4wf 6src/org/apache/axis2/transport/http/util/SOAPUtil.javaO]Xh}O]Xh}!Lxlv8ay?src/org/apache/axis2/transport/http/util/URIEncoderDecoder.javaO]Xh}O]Xh}!'y]U 7u[9g-?src/org/apache/axis2/transport/http/util/URLTemplatingUtil.javaO]Xh}O]Xh}!0{e&ÿF. O#6_4גPڡ$-Z1src/org/apache/axis2/transport/jms/JMSSender.javaO]XO]X! Ge.3 ٟEE$!X]88src/org/apache/axis2/transport/local/LocalResponder.javaO]XO]X! ab"8^j2}%Nsrc/org/apache/axis2/transport/local/LocalResponseTransportOutDescription.javaO]XO]X!S)L'uuJgUV<=@src/org/apache/axis2/transport/local/LocalTransportReceiver.javaO]XO]X! Յ@%>src/org/apache/axis2/transport/local/LocalTransportSender.javaO]XO]X!j@,jGz[+22src/org/apache/axis2/transport/mail/Constants.javaO]XO]X!-D#k|84src/org/apache/axis2/transport/mail/EMailSender.javaO]XO]X! Pu55 }Lҕ޲6src/org/apache/axis2/transport/mail/EmailReceiver.javaO]XO]X! zk;X?ooQivBsrc/org/apache/axis2/transport/mail/MailBasedOutTransportInfo.javaO]XO]X!v9ra5w5>T3src/org/apache/axis2/transport/mail/MailClient.javaO]XO]X! B:m.N-aW_3src/org/apache/axis2/transport/mail/MailToInfo.javaO]XO]X!)vJ"~<L[?ދQR#؁ą7src/org/apache/axis2/transport/nhttp/ClientHandler.javaO]XO]X!* ;rв5f<6src/org/apache/axis2/transport/nhttp/ClientWorker.javaO]XO]X!+H2|tmbf8src/org/apache/axis2/transport/nhttp/ConnectionPool.javaO]XO]X!,X"IR 1%qs0:src/org/apache/axis2/transport/nhttp/HostnameVerifier.javaO]XO]X!-&w*C*&CHL!=src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.javaO]XO]X!..sR@U1ӿtwt@src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.javaO]XO]X!/ 8h*$(O}:>src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.javaO]XO]X!0L90 v6UrP3>I靮o;src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.javaO]XO]X!1  ݾ"&~餧fI Jsrc/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.javaO]XO]X!2#ܐ Fdgap>:src/org/apache/axis2/transport/nhttp/LoggingIOSession.javaO]XO]X!3 !1?Ɓf2 Fsrc/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.javaO]XO]X!4F\6#I7۾:GeCsrc/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.javaO]XO]X!5 x_?4 @5=*3gFsrc/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.javaO]XO]X!6q9[Ҷu-0CDsrc/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.javaO]XO]X!7~xRR|?cEqh]N =k!kzYujB6src/org/apache/axis2/transport/nhttp/ServerWorker.javaO]XO]X!?&3?Kpm4>:.src/org/apache/axis2/transport/nhttp/Util.javaO]XO]X!A VȉI>z8[lv7Asrc/org/apache/axis2/transport/nhttp/util/BackportWorkerPool.javaO]XO]X!B S m*DmR7src/org/apache/axis2/transport/nhttp/util/PipeImpl.javaO]XO]X!C(0FjpZ-'_#-f9src/org/apache/axis2/transport/nhttp/util/WorkerPool.javaO]XO]X!D⍡ȇ(l}TV:@src/org/apache/axis2/transport/nhttp/util/WorkerPoolFactory.javaO]XO]X!F5N|6N]ZR1src/org/apache/axis2/transport/tcp/TCPServer.javaO]XO]X!GEEA̟r O:src/org/apache/axis2/transport/tcp/TCPTransportSender.javaO]X⏫O]X⏫!H5SQ7;)3o1src/org/apache/axis2/transport/tcp/TCPWorker.javaO]X⏫O]X⏫!J$C>nfs@S9V)src/org/apache/axis2/util/ArrayStack.javaO]X⏫O]X⏫!K|=9O, Y.=0src/org/apache/axis2/util/AxisPolicyLocator.javaO]X⏫O]X⏫!LM#*4h!L(%src/org/apache/axis2/util/Base64.javaO]X⏫O]X⏫!MObb *\pˊm/src/org/apache/axis2/util/CallbackReceiver.javaO]X⏫O]X⏫!N ~/Pۅ6A|9:ѱQ0src/org/apache/axis2/util/CommandLineOption.javaO]X⏫O]X⏫!OS3K8 R9src/org/apache/axis2/util/CommandLineOptionConstants.javaO]X⏫O]X⏫!PEڕ5,vbd*9'"6src/org/apache/axis2/util/CommandLineOptionParser.javaO]X⏫O]X⏫!QP '-^1`=&;&src/org/apache/axis2/util/Counter.javaO]X⏫O]X⏫!R[&c>)%4src/org/apache/axis2/util/DefaultEntityResolver.javaO]X⏫O]X⏫!S(ۇ}:g7src/org/apache/axis2/util/ExternalPolicySerializer.javaO]X⏫O]X⏫!T >9j{qE˫O r)src/org/apache/axis2/util/FileWriter.javaO]X⏫O]X⏫!U-s= R0src/org/apache/axis2/util/HostConfiguration.javaO]X⏫O]X⏫!VL^ʨ"FGD7#Mc(src/org/apache/axis2/util/JavaUtils.javaO]X⏫O]X⏫!W$X'mÂ(Qẳ'%src/org/apache/axis2/util/Loader.javaO]X⏫O]X⏫!X^g7U4lZ-src/org/apache/axis2/util/LoggingControl.javaO]X⏫O]X⏫!Yy# 'Yu}'|i4src/org/apache/axis2/util/MessageContextBuilder.javaO]X⏫O]X⏫!Z!gW9=!,o2x-U7&,src/org/apache/axis2/util/MetaDataEntry.javaO]X⏫O]X⏫![&x6m {rD %݌3src/org/apache/axis2/util/MultipleEntryHashMap.javaO]X⏫O]X⏫!\;df=~9'ӥr:hp/src/org/apache/axis2/util/ObjectStateUtils.javaO]X⏫O]X⏫!]c xOc٣J [,src/org/apache/axis2/util/OptionsParser.javaO]X⏫O]X⏫!^;pl;HXdž" /src/org/apache/axis2/util/OptionsValidator.javaO]X⏫O]X⏫!_ id0s'aUҍwq,src/org/apache/axis2/util/PolicyLocator.javaO]X⏫O]X⏫!`%"?a'mZ[>4se)src/org/apache/axis2/util/PolicyUtil.javaO]X⏫O]X⏫!a2DD&0]U+}TQL>,src/org/apache/axis2/util/PrettyPrinter.javaO]X⏫O]X⏫!b +m 8zJ_+su*&)src/org/apache/axis2/util/SchemaUtil.javaO]X⏫O]X⏫!c $~kn4l4src/org/apache/axis2/util/SelfManagedDataHolder.javaO]X⏫O]X⏫!d $"ECGJ>+src/org/apache/axis2/util/SessionUtils.javaO]X⏫O]X⏫!e,Ľ'вҿ*K,src/org/apache/axis2/util/StreamWrapper.javaO]X⏫O]X⏫!fW~[#ګy.tM-src/org/apache/axis2/util/TargetResolver.javaO]X⏫O]X⏫!g;>bɱ 4src/org/apache/axis2/util/ThreadContextMigrator.javaO]X⏫O]X⏫!hOK˜΍j-dIZ8src/org/apache/axis2/util/ThreadContextMigratorUtil.javaO]X⏫O]X⏫!iKNZo b~OУ$"src/org/apache/axis2/util/URL.javaO]X⏫O]X⏫!jQ( к ̔+src/org/apache/axis2/util/URLProcessor.javaO]X⏫O]X⏫!k9ߚ%kTu,src/org/apache/axis2/util/UUIDGenerator.javaO]X⏫O]X⏫!l`> !T2 y$src/org/apache/axis2/util/Utils.javaO]X⏫O]X⏫!mI*uR ZI%)src/org/apache/axis2/util/WSDL20Util.javaO]X⏫O]X⏫!nlLltm#4src/org/apache/axis2/util/WSDLSerializationUtil.javaO]X⏫O]X⏫!oZ0 |P8'٪_g&src/org/apache/axis2/util/XMLChar.javaO]X⏫O]X⏫!p_975xR/src/org/apache/axis2/util/XMLPrettyPrinter.javaO]X⏫O]X⏫!qXAoh´QKx'src/org/apache/axis2/util/XMLUtils.javaO]X⏫O]X⏫!rvKuEո4src/org/apache/axis2/util/XSLTTemplateProcessor.javaO]X⏫O]X⏫!s ,~;o?G?芕؊h<(src/org/apache/axis2/util/XSLTUtils.javaO]X⏫O]X⏫!u_àn´q\`N>src/org/apache/axis2/util/threadpool/DefaultThreadFactory.javaO]X⏫O]X⏫!vswZxXyЀ7src/org/apache/axis2/util/threadpool/ThreadFactory.javaO]X⏫O]X⏫!wPuUjMQ[,4src/org/apache/axis2/util/threadpool/ThreadPool.javaO]X⏫O]X⏫!yG4>a"kFsrc/org/apache/axis2/wsdl/codegen/CodeGenerationException.javaO]XO]X!=r̄l h_x}D:src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.javaO]XO]X!0 g+鍪;src/org/apache/axis2/wsdl/codegen/codegen-config.propertiesO]XO]X!=vx&,D $<Ssrc/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.javaO]XO]X!ORPcQhw&kd1l7src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.javaO]XO]X!{hUs@"v=" 6src/org/apache/axis2/wsdl/codegen/emitter/Emitter.javaO]XO]X!Tf4ot|ǻ]:src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.javaO]XO]X!)G:$3AMsrc/org/apache/axis2/wsdl/codegen/emitter/jaxws/AnnotationElementBuilder.javaO]XO]X!$0RFR1C55*Csrc/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWS20Emitter.javaO]XO]X!-Eg"#& 0tAsrc/org/apache/axis2/wsdl/codegen/emitter/jaxws/JAXWSEmitter.javaO]XO]X!?%ê :`]GeH4HPsrc/org/apache/axis2/wsdl/codegen/extension/AbstractCodeGenerationExtension.javaO]XO]X!4> 7M4&NЮ Nsrc/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.javaO]XO]X!eu|±6q3 DOsrc/org/apache/axis2/wsdl/codegen/extension/AbstractPrettyPrinterExtension.javaO]XO]X!SZc gR13^F=(6Asrc/org/apache/axis2/wsdl/codegen/extension/CodeGenExtension.javaO]XO]X! Q7'8h@5qLsrc/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.javaO]XO]X! Q텋m#YiSA""F7Q.Hsrc/org/apache/axis2/wsdl/codegen/extension/ExcludePackageExtension.javaO]XO]X!ϱC;Y~6`PQ^@src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.javaO]XO]X!>qsJɦ -[8|MoEsrc/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtension.javaO]XO]X!CzDKC1_v,Ksrc/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.javaO]XO]X!`?t6h cB/lҧ>src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.javaO]XO]X!ǩtBOʁÏX>Fsrc/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.javaO]XO]X! 0T!y*%YJm3vj>src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.javaO]XO]X!#J֛A۱뀝[+uc@src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.javaO]XO]X!\̿n'ҩ @src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.javaO]XO]X!NldIa͉֡I% bc2Isrc/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.javaO]XO]X!d;һpuE|LBsrc/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.javaO]XO]X!S7)?Svmu.Dsrc/org/apache/axis2/wsdl/codegen/extension/TypeMapperExtension.javaO]XO]X!u۬irvE T,@Ksrc/org/apache/axis2/wsdl/codegen/extension/WSDLPrettyPrinterExtension.javaO]XO]X! 1 ?Os?cl|nSGsrc/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.javaO]XO]X!#Fzo*'EJ C6lKPY:Bsrc/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.javaO]XO]X!/P$3.$Jsrc/org/apache/axis2/wsdl/codegen/extension/XMLPrettyPrinterExtension.javaO]XO]X!+zZچ Ì EOVdRsrc/org/apache/axis2/wsdl/codegen/schema/AxisServiceTopElementSchemaGenerator.javaO]XO]X!zz 5u!~[-=src/org/apache/axis2/wsdl/codegen/schema/NamespacePrefix.javaO]XO]X!bk7 '=JI8;$8src/org/apache/axis2/wsdl/codegen/schema/TopElement.javaO]XO]X!b7j| '"m Ysrc/org/apache/axis2/wsdl/codegen/writer/PolicyFileWriter.javaO]XO]X! zavdg.M=RQ*X:src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.javaO]XO]X!'H/"9)ebBί>src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.javaO]XO]X!۶Z緃_z ˾EEsrc/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.javaO]XO]X!8{|H(;(8m$eC2G=src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.javaO]X\O]X\!+'ʪH{/U|zI=qAsrc/org/apache/axis2/wsdl/databinding/UnmatchedTypeException.javaO]X\O]X\!CTb 28suQgѐ3src/org/apache/axis2/wsdl/i18n/CodegenMessages.javaO]X\O]X\!)lqK :Z>P~B2src/org/apache/axis2/wsdl/i18n/resource.propertiesO]X\O]X\!a{ Ғ{D?f/V(Ksrc/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xslO]X\O]X\!5C#!{t<[Q=src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xslO]X\O]X\!HGzg<8p]|Bsrc/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xslO]X\O]X\!Q xѼ :ֺEsrc/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xslO]X\O]X\!Sx'󎂪v%^>jua`BUsrc/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceImplTemplate.xslO]X\O]X\!#WL@+ b@Qsrc/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xslO]X\O]X\! 5{]Ы+e+\lV XCsrc/org/apache/axis2/wsdl/template/java/JaxwsServiceXMLTemplate.xslO]X\O]X\!UN7kSbCsrc/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xslO]X\O]X\!( JpWԙ(' Csrc/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xslO]X\O]X\!{uIz?4dG:rTCsrc/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xslO]X\O]X\!%C5&!p70>@ArDEsrc/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xslO]X\O]X\!(`NbhicN=9YII4src/org/apache/axis2/wsdl/template/java/package.htmlO]X\O]X\!>ꥰP]ПaEin?uh%mQ{%src/org/apache/neethi/ExactlyOne.javaO]XO]X!G熘2FYfK{6.m,1src/org/apache/neethi/IntersectableAssertion.javaO]XO]X!* W0F6`~^/&,!src/org/apache/neethi/Policy.javaO]XO]X!!FtxB]x& M^B~(src/org/apache/neethi/PolicyBuilder.javaO]XO]X!RW8ǧ/N2*src/org/apache/neethi/PolicyComponent.javaO]XO]X!@Բ-l'04src/org/apache/neethi/PolicyContainingAssertion.javaO]XO]X!U(!5{ *U 'src/org/apache/neethi/PolicyEngine.javaO]XO]X!`src/org/apache/neethi/builders/converters/OMToOMConverter.javaO]XO]X!(LD]}+E<5SeTJ@src/org/apache/neethi/builders/converters/OMToStaxConverter.javaO]XO]X!)<2J`Cc Asrc/org/apache/neethi/builders/converters/StaxToDOMConverter.javaO]XO]X!*]y+e,VdW3 I@src/org/apache/neethi/builders/converters/StaxToOMConverter.javaO]XO]X!+[AWe0c ;Yj UBsrc/org/apache/neethi/builders/converters/StaxToStaxConverter.javaO]XO]X!-0qcE`X_2̪Dsrc/org/apache/neethi/builders/xml/XMLPrimitiveAssertionBuilder.javaO]XO]X!.mCBv.D8(=src/org/apache/neethi/builders/xml/XmlPrimitiveAssertion.javaO]XO]X!0w0(nV9F݃?{!~ߞt0src/org/apache/neethi/util/PolicyComparator.javaO]XֳO]Xֳ!1"3rglw1src/org/apache/neethi/util/PolicyIntersector.javaO]XֳO]Xֳ!2OIWw<ءO%'src/org/apache/neethi/util/Service.javaO]XֳO]Xֳ!4t'&^&Ek_Y+4U&src/org/apache/woden/ErrorHandler.javaO]XֳO]Xֳ!5LmGۂB U#src/org/apache/woden/ErrorInfo.javaO]XֳO]Xֳ!6~ـ@=9&src/org/apache/woden/ErrorLocator.javaO]XֳO]Xֳ!7. <~Dbh_'src/org/apache/woden/ErrorReporter.javaO]XֳO]Xֳ!8 )?"TQ"f2uru-Z'src/org/apache/woden/WSDLException.javaO]XֳO]Xֳ!9ζ9yQY/<%src/org/apache/woden/WSDLFactory.javaO]XֳO]Xֳ!:*َ2< V& +e$src/org/apache/woden/WSDLReader.javaO]XֳO]Xֳ!; "~p-]Jν$src/org/apache/woden/WSDLSource.javaO]XֳO]Xֳ!< 3[1jJ$src/org/apache/woden/WSDLWriter.javaO]XֳO]Xֳ!=b|B1*"[o$src/org/apache/woden/XMLElement.javaO]XֳO]Xֳ!?6^ B;nO9W'src/org/apache/woden/about-this-packageO]XֳO]Xֳ!A 淳 Y! ^uO 2src/org/apache/woden/internal/BaseWSDLFactory.javaO]XֳO]Xֳ!BIW)^̖t;f1src/org/apache/woden/internal/BaseWSDLReader.javaO]XֳO]Xֳ!CN*{Xxsg7L1src/org/apache/woden/internal/BaseWSDLSource.javaO]XO]X!DequHZ=_ݐ`t1/1src/org/apache/woden/internal/BaseWSDLWriter.javaO]XO]X!E|P}䢴v1src/org/apache/woden/internal/BaseXMLElement.javaO]XO]X!FVnM\hS-ј1src/org/apache/woden/internal/DOMWSDLFactory.javaO]XO]X!G}1яhN&(i0src/org/apache/woden/internal/DOMWSDLReader.javaO]XO]X!H {lEb li᚝00src/org/apache/woden/internal/DOMWSDLSource.javaO]XO]X!I2tUY0src/org/apache/woden/internal/DOMWSDLWriter.javaO]XO]X!J3(dP̑`w}0src/org/apache/woden/internal/DOMXMLElement.javaO]XO]X!K"e; ;~]E"M\do3src/org/apache/woden/internal/ErrorHandlerImpl.javaO]XO]X!L aUݱQ 0src/org/apache/woden/internal/ErrorInfoImpl.javaO]XO]X!M @E!u5Lz1Xz3src/org/apache/woden/internal/ErrorLocatorImpl.javaO]XO]X!N/\`)SPa14src/org/apache/woden/internal/ErrorReporterImpl.javaO]XO]X!O l#@OؾFMT|Ggı3src/org/apache/woden/internal/MessageFormatter.javaO]XO]X!P 1Tb]YRN1src/org/apache/woden/internal/ReaderFeatures.javaO]XO]X!Q TpE$ؘa].src/org/apache/woden/internal/WSDLContext.javaO]XO]X!R n88*s{ uys~+1src/org/apache/woden/internal/WriterFeatures.javaO]XO]X!T[cB`Rtcv7hDsrc/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.javaO]XO]X!U(E:W5iSjAsrc/org/apache/woden/internal/resolver/EntityResolverAdapter.javaO]XO]X!Vn뵤Jb_/<;Asrc/org/apache/woden/internal/resolver/SchemaResolverAdapter.javaO]XO]X!W/ƍ#NFS2 Dr=src/org/apache/woden/internal/resolver/SimpleURIResolver.javaO]XO]X!Yi^B ptVx({ƈ/3src/org/apache/woden/internal/wsdl20/TypesImpl.javaO]XO]X!~ s6W|ZN=fo4;src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.javaO]XO]X!!J6m [K 9src/org/apache/woden/internal/wsdl20/WSDLElementImpl.javaO]XO]X!7b*͡[m6z;src/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.javaO]XPŬO]XPŬ! ^l}py /:Rq~fDsrc/org/apache/woden/internal/wsdl20/assertions/Description1001.javaO]XPŬO]XPŬ!(1 $w#C6Dsrc/org/apache/woden/internal/wsdl20/assertions/Description1002.javaO]XPŬO]XPŬ!SLe"X763a~Dsrc/org/apache/woden/internal/wsdl20/assertions/Description1003.javaO]XPŬO]XPŬ! [i ^>Y;1md[Bsrc/org/apache/woden/internal/wsdl20/assertions/Interface1009.javaO]XPŬO]XPŬ! ?P{RQ 3 Bsrc/org/apache/woden/internal/wsdl20/assertions/Interface1010.javaO]XPŬO]XPŬ!Qy1,)sA@vLsrc/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.javaO]XPŬO]XPŬ!eo5N&(GJsrc/org/apache/woden/internal/wsdl20/extensions/ElementExtensibleImpl.javaO]XPŬO]XPŬ!MzbPbB0Isrc/org/apache/woden/internal/wsdl20/extensions/ExtensionElementImpl.javaO]XPŬO]XPŬ!h'[KY0Usrc/org/apache/woden/internal/wsdl20/extensions/InterfaceOperationExtensionsImpl.javaO]XPŬO]XPŬ!@ziQ0ˣL(Osrc/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.javaO]XPŬO]XPŬ!pR@ZSJb.pSsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingExtensionsImpl.javaO]XPŬO]XPŬ!GTU%~d˩Xsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.javaO]XPŬO]XPŬ!YF~&شY2Gcsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.javaO]XPŬO]XPŬ!77ֈ1nvd3WԮ\src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.javaO]XPŬO]XPŬ!yL1`!uI(NhTsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPEndpointExtensionsImpl.javaO]XPŬO]XPŬ!LTw$t8o YzPsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPHeaderDeserializer.javaO]XPŬO]XPŬ!,ȥzSX,fHsrc/org/apache/woden/internal/wsdl20/extensions/http/HTTPHeaderImpl.javaO]XPŬO]XPŬ!Ex:_+)AݯB \src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCInterfaceOperationExtensionsImpl.javaO]XPŬO]XPŬ!! _/7@ަkRSsrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.javaO]XPŬO]XPŬ!)81FJ93,?v0lXsrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingFaultExtensionsImpl.javaO]XPŬO]XPŬ!?2S1?ntXasrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingFaultReferenceExtensionsImpl.javaO]XPŬO]XPŬ!&5q*X gں[8csrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsImpl.javaO]XPŬO]XPŬ!"8.ZOǚaU"E\src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.javaO]XPŬO]XPŬ!O}MqUw`Tsrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPEndpointExtensionsImpl.javaO]XPŬO]XPŬ!M6^P>}/"~qUsrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPHeaderBlockDeserializer.javaO]XPŬO]XPŬ!.&(SPLv}?Msrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPHeaderBlockImpl.javaO]XPŬO]XPŬ!E Uz -~#_Psrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPModuleDeserializer.javaO]XPŬO]XPŬ! ؀- -^Hsrc/org/apache/woden/internal/wsdl20/extensions/soap/SOAPModuleImpl.javaO]XPŬO]XPŬ!#+Y:0YB4˖.Ksrc/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.javaO]XPŬO]XPŬ!Jk c(Y2)Jsrc/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.javaO]XPŬO]XPŬ!f<7bާ<>J!Bsrc/org/apache/woden/internal/wsdl20/validation/WSDLValidator.javaO]XPŬO]XPŬ!渚Ț15Esrc/org/apache/woden/internal/wsdl20/validation/WodenContextImpl.javaO]XPŬO]XPŬ!@LY!En˰3כ%ц$7Y^Y藰 N>src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.javaO]XPŬO]XPŬ! !1DL9U)!8zR|5src/org/apache/woden/internal/xml/StringAttrImpl.javaO]XPŬO]XPŬ! 4{#|D7ץ`J4src/org/apache/woden/internal/xml/TokenAttrImpl.javaO]XPŬO]XPŬ! Q[Oszqܸ2src/org/apache/woden/internal/xml/URIAttrImpl.javaO]XPŬO]XPŬ! )/nyz'Z&c@'2src/org/apache/woden/internal/xml/XMLAttrImpl.javaO]XPŬO]XPŬ! s~ :?Bsrc/org/apache/woden/internal/xpointer/DOMXMLElementEvaluator.javaO]XPŬO]XPŬ!#KPfʒ ax.src/org/apache/woden/resolver/URIResolver.javaO]XPŬO]XPŬ!œʎGC )/怟/src/org/apache/woden/schema/ImportedSchema.javaO]XPŬO]XPŬ!q;DU3{)??.src/org/apache/woden/schema/InlinedSchema.javaO]XPŬO]XPŬ!EsMuZ9~t'src/org/apache/woden/schema/Schema.javaO]XPŬO]XPŬ! $Yp{^~{2 {G&src/org/apache/woden/types/NCName.javaO]XPŬO]XPŬ!okfbڣBzx4src/org/apache/woden/types/NamespaceDeclaration.javaO]XPŬO]XPŬ! T\L-1^к!-/src/org/apache/woden/types/QNameTokenUnion.javaO]XPŬO]XPŬ!Y7r[wQ s92?gE'src/org/apache/woden/types/XMLChar.javaO]XPŬO]XPŬ! pأraA 0B]ZM(src/org/apache/woden/wsdl20/Binding.javaO]XPŬO]XPŬ! _SWn^55y Q-src/org/apache/woden/wsdl20/BindingFault.javaO]XPŬO]XPŬ!@2[y_H؁wnA6src/org/apache/woden/wsdl20/BindingFaultReference.javaO]XPŬO]XPŬ!^9益kI P"co8src/org/apache/woden/wsdl20/BindingMessageReference.javaO]XPŬO]XPŬ! n'X#Ay'S1src/org/apache/woden/wsdl20/BindingOperation.javaO]XPŬO]XPŬ!mogl26"#;,src/org/apache/woden/wsdl20/Description.javaO]XPŬO]XPŬ!}-7tݹ~6QNN>3src/org/apache/woden/wsdl20/ElementDeclaration.javaO]XPŬO]XPŬ!RhDu*mFd)src/org/apache/woden/wsdl20/Endpoint.javaO]XPŬO]XPŬ!.Ox"asK-| л*src/org/apache/woden/wsdl20/Interface.javaO]XPŬO]XPŬ! ěrbmOvZp6#/src/org/apache/woden/wsdl20/InterfaceFault.javaO]XPŬO]XPŬ! F֙j7G4뵳MJ8src/org/apache/woden/wsdl20/InterfaceFaultReference.javaO]XPŬO]XPŬ! e%<@wfAv\:src/org/apache/woden/wsdl20/InterfaceMessageReference.javaO]XPŬO]XPŬ! =q$j 3src/org/apache/woden/wsdl20/InterfaceOperation.javaO]XPŬO]XPŬ!ǭdFS٬f0src/org/apache/woden/wsdl20/NestedComponent.javaO]XPŬO]XPŬ! 1զ[ҔΣ_xd<_!R(src/org/apache/woden/wsdl20/Service.javaO]XPŬO]XPŬ!M u+jP"Z[x}ƥj/src/org/apache/woden/wsdl20/TypeDefinition.javaO]XPŬO]XPŬ!c19=os:*.src/org/apache/woden/wsdl20/WSDLComponent.javaO]XPŬO]XPŬ!*]yA裶ҭҮ[_6src/org/apache/woden/wsdl20/enumeration/Direction.javaO]XPŬO]XPŬ!뉋&ŁH8W5@9src/org/apache/woden/wsdl20/enumeration/MessageLabel.javaO]XPŬO]XPŬ!t$yMfj꓆?src/org/apache/woden/wsdl20/extensions/AttributeExtensible.javaO]XΫO]XΫ!!}BukIEU`OIsrc/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.javaO]XΫO]XΫ! \/J#UAEsrc/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.javaO]XΫO]XΫ!+ [o Jl=src/org/apache/woden/wsdl20/extensions/ElementExtensible.javaO]XΫO]XΫ! +ܾ~󨃪u7}V9;_yAsrc/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.javaO]XΫO]XΫ!Y # ¼+EQӤsrc/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.javaO]XΫO]XΫ!w-la.u~2-lj=src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.javaO]XΫO]XΫ! b&Mn2k?}DA>?src/org/apache/woden/wsdl20/extensions/ExtensionSerializer.javaO]XΫO]XΫ! }@/o#2v܆Eh fDsrc/org/apache/woden/wsdl20/extensions/GenericExtensionProperty.javaO]XΫO]XΫ!<؀vaG"6$aْJHsrc/org/apache/woden/wsdl20/extensions/InterfaceOperationExtensions.javaO]XΫO]XΫ! Y{kxHֈ0p^>src/org/apache/woden/wsdl20/extensions/PropertyExtensible.javaO]XΫO]XΫ! K.z|NqARʕoeHsrc/org/apache/woden/wsdl20/extensions/UnknownExtensionDeserializer.javaO]XΫO]XΫ! Tcյ)r>{#6\nCsrc/org/apache/woden/wsdl20/extensions/UnknownExtensionElement.javaO]XΫO]XΫ!3r+ߓ*GI Fsrc/org/apache/woden/wsdl20/extensions/UnknownExtensionSerializer.javaO]XΫO]XΫ!y˼1 m3Bsrc/org/apache/woden/wsdl20/extensions/WSDLExtensionConstants.javaO]XΫO]XΫ!q+tT]a D49src/org/apache/woden/wsdl20/extensions/about-this-packageO]XΫO]XΫ!.L(1YogIsrc/org/apache/woden/wsdl20/extensions/http/HTTPAuthenticationScheme.javaO]XΫO]XΫ! gBرwZ%}aVFsrc/org/apache/woden/wsdl20/extensions/http/HTTPBindingExtensions.javaO]XΫO]XΫ!H6qvّKsrc/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensions.javaO]XΫO]XΫ! Btκ)4Gs|lVsrc/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensions.javaO]XΫO]XΫ!-~#b-RԇFKOsrc/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensions.javaO]XΫO]XΫ!>kqƝ3uR7>src/org/apache/woden/wsdl20/extensions/http/HTTPConstants.javaO]XΫO]XΫ!-8otQP@4Y[xyhGsrc/org/apache/woden/wsdl20/extensions/http/HTTPEndpointExtensions.javaO]XΫO]XΫ!Pьf,e[K㠯Dsrc/org/apache/woden/wsdl20/extensions/http/HTTPErrorStatusCode.javaO]XΫO]XΫ! >b#@t-W@;src/org/apache/woden/wsdl20/extensions/http/HTTPHeader.javaO]XΫO]XΫ!|0~:ċxә`/*Bsrc/org/apache/woden/wsdl20/extensions/http/HTTPHeaderElement.javaO]XΫO]XΫ!oOv9M'9x3=src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.javaO]XΫO]XΫ!kpr/r a k5ӒkA*uKsrc/org/apache/woden/wsdl20/extensions/soap/SOAPBindingFaultExtensions.javaO]XΫO]XΫ!~V-JZg̦}CTsrc/org/apache/woden/wsdl20/extensions/soap/SOAPBindingFaultReferenceExtensions.javaO]XΫO]XΫ!  [nO+Պ#GgVsrc/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensions.javaO]XΫO]XΫ! XcA%NP/Osrc/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.javaO]XΫO]XΫ! gGiWZV>src/org/apache/woden/wsdl20/extensions/soap/SOAPConstants.javaO]XΫO]XΫ!  pk/ߕkwGsrc/org/apache/woden/wsdl20/extensions/soap/SOAPEndpointExtensions.javaO]XΫO]XΫ! Y3}ߗ`i_=H>src/org/apache/woden/wsdl20/extensions/soap/SOAPFaultCode.javaO]XΫO]XΫ! P8>4,1 ǧ]Bsrc/org/apache/woden/wsdl20/extensions/soap/SOAPFaultSubcodes.javaO]XΫO]XΫ! ț<$g-Ě^ 0Cfx~@src/org/apache/woden/wsdl20/extensions/soap/SOAPHeaderBlock.javaO]XΫO]XΫ!  ]촣9; ?.QHcGsrc/org/apache/woden/wsdl20/extensions/soap/SOAPHeaderBlockElement.javaO]XΫO]XΫ! m/~$yf @#5;src/org/apache/woden/wsdl20/extensions/soap/SOAPModule.javaO]XΫO]XΫ! { QI;Zaq?jBsrc/org/apache/woden/wsdl20/extensions/soap/SOAPModuleElement.javaO]XΫO]XΫ!  ^U!>q 6DqG"9src/org/apache/woden/wsdl20/fragids/BindingFaultPart.javaO]XΫO]XΫ! ֯]Y#),cBsrc/org/apache/woden/wsdl20/fragids/BindingFaultReferencePart.javaO]XΫO]XΫ!  KkDVw=o Dsrc/org/apache/woden/wsdl20/fragids/BindingMessageReferencePart.javaO]XΫO]XΫ!  ;7%T?L*$0=src/org/apache/woden/wsdl20/fragids/BindingOperationPart.javaO]XΫO]XΫ!  j* ܓk!ӰD*z4src/org/apache/woden/wsdl20/fragids/BindingPart.javaO]XΫO]XΫ! mAN)r;Jh6src/org/apache/woden/wsdl20/fragids/ComponentPart.javaO]XΫO]XΫ! X[@v kod8src/org/apache/woden/wsdl20/fragids/DescriptionPart.javaO]XΫO]XΫ! HwI;~ec?src/org/apache/woden/wsdl20/fragids/ElementDeclarationPart.javaO]XΫO]XΫ!  <';5src/org/apache/woden/wsdl20/fragids/EndpointPart.javaO]XΫO]XΫ!  /=`{3Zw;src/org/apache/woden/wsdl20/fragids/InterfaceFaultPart.javaO]XΫO]XΫ!  UK3wm!Dsrc/org/apache/woden/wsdl20/fragids/InterfaceFaultReferencePart.javaO]XΫO]XΫ!  $V 6.A^Fsrc/org/apache/woden/wsdl20/fragids/InterfaceMessageReferencePart.javaO]XΫO]XΫ!  ?src/org/apache/woden/wsdl20/fragids/InterfaceOperationPart.javaO]XΫO]XΫ! ==̿*Ƭf,AG޴6src/org/apache/woden/wsdl20/fragids/InterfacePart.javaO]XΫO]XΫ! wFt|a(>!*74src/org/apache/woden/wsdl20/fragids/ServicePart.javaO]XΫO]XΫ! At'ҽI]CHvtK};src/org/apache/woden/wsdl20/fragids/TypeDefinitionPart.javaO]XΫO]XΫ! %("#3!H6z<25src/org/apache/woden/wsdl20/validation/Assertion.javaO]XΫO]XΫ! +Q Q Tf9src/org/apache/woden/wsdl20/validation/AssertionInfo.javaO]XΫO]XΫ! nfyW*9Al8src/org/apache/woden/wsdl20/validation/WodenContext.javaO]XΫO]XΫ! "zAϢ>s |ydWЗ03src/org/apache/woden/wsdl20/xml/BindingElement.javaO]XΫO]XΫ! #"ԪzYWvOLɩ8src/org/apache/woden/wsdl20/xml/BindingFaultElement.javaO]XΫO]XΫ! $ # ^:U)7Asrc/org/apache/woden/wsdl20/xml/BindingFaultReferenceElement.javaO]XΫO]XΫ! % cC4YDt'\gCsrc/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.javaO]XΫO]XΫ! &ױyDEg cF3src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.javaO]XΫO]XΫ! 2*C]%t@OX2src/org/apache/woden/wsdl20/xml/NestedElement.javaO]X׫O]X׫! 3 ggB{QP.6Amɀ3src/org/apache/woden/wsdl20/xml/ServiceElement.javaO]X׫O]X׫! 4 Wo 4MoYa1src/org/apache/woden/wsdl20/xml/TypesElement.javaO]X׫O]X׫! 5ъg( UdQ&A0src/org/apache/woden/wsdl20/xml/WSDLElement.javaO]X׫O]X׫! 7L 6.gx7 /src/org/apache/woden/xml/ArgumentArrayAttr.javaO]X׫O]X׫! 8ANCVZ؆ss{)src/org/apache/woden/xml/BooleanAttr.javaO]X׫O]X׫! 9.bFָ@E'T:src/org/apache/woden/xml/HTTPAuthenticationSchemeAttr.javaO]X׫O]X׫! :wNn/%OE,src/org/apache/woden/xml/IntOrTokenAttr.javaO]X׫O]X׫! ;޵bX\L#Ph!(7"'src/org/apache/woden/xml/QNameAttr.javaO]X׫O]X׫! < Tn>oL,+src/org/apache/woden/xml/QNameListAttr.javaO]X׫O]X׫! =\ */bVb^e2src/org/apache/woden/xml/QNameListOrTokenAttr.javaO]X׫O]X׫! >8Mo`E?k{.src/org/apache/woden/xml/QNameOrTokenAttr.javaO]X׫O]X׫! ?\,@>=r;D N(src/org/apache/woden/xml/StringAttr.javaO]X׫O]X׫! @NM .܋d'<#B'src/org/apache/woden/xml/TokenAttr.javaO]X׫O]X׫! AESvϟ==lɟc%src/org/apache/woden/xml/URIAttr.javaO]X׫O]X׫! B yK-2mR߃#P)src/org/apache/woden/xml/UnknownAttr.javaO]X׫O]X׫! Cj)$dq/src/org/apache/ws/commons/schema/XmlSchema.javaO]X׫O]X׫! SkI|ƆSl&˷JZ2src/org/apache/ws/commons/schema/XmlSchemaAll.javaO]X׫O]X׫! T#I1kAUbw8src/org/apache/ws/commons/schema/XmlSchemaAnnotated.javaO]X׫O]X׫! U $m } *39src/org/apache/ws/commons/schema/XmlSchemaAnnotation.javaO]X׫O]X׫! V} s;HkfJR2src/org/apache/ws/commons/schema/XmlSchemaAny.javaO]X׫O]X׫! WcD(\ Nk~9M;src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.javaO]X׫O]X׫! XF K{IK=[6src/org/apache/ws/commons/schema/XmlSchemaAppInfo.javaO]X׫O]X׫! YΚqO1vӘ8src/org/apache/ws/commons/schema/XmlSchemaAttribute.javaO]X׫O]X׫! Z<*y=src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.javaO]X׫O]X׫! [Y>'< )^ޢ*TW@src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.javaO]X׫O]X׫! \1OIǔ-sX$楺]5src/org/apache/ws/commons/schema/XmlSchemaChoice.javaO]X׫O]X׫! ]NiC!!Ȳ 8z8㼧9src/org/apache/ws/commons/schema/XmlSchemaCollection.javaO]X׫O]X׫! ^pi?H; ^o@(}aCsrc/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.javaO]X׫O]X׫! _ eWjyYXj+(=src/org/apache/ws/commons/schema/XmlSchemaComplexContent.javaO]X׫O]X׫! ` Ru5g!=DAwFFsrc/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.javaO]X׫O]X׫! a |\vaVl!,\Hsrc/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.javaO]X׫O]X׫! brgMj:I&a&l~:src/org/apache/ws/commons/schema/XmlSchemaComplexType.javaO]X׫O]X׫! cG]op O^3Em|6src/org/apache/ws/commons/schema/XmlSchemaContent.javaO]X׫O]X׫! d+T G͢(ABNY;src/org/apache/ws/commons/schema/XmlSchemaContentModel.javaO]X׫O]X׫! eo4y#(Y8dL[G@src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.javaO]X׫O]X׫! f'PS`aRp:{:src/org/apache/ws/commons/schema/XmlSchemaContentType.javaO]X׫O]X׫! gFG?,S')dHNTZ=src/org/apache/ws/commons/schema/XmlSchemaMaxLengthFacet.javaO]X׫O]X׫! }P/=MeMZRȵփ@src/org/apache/ws/commons/schema/XmlSchemaMinExclusiveFacet.javaO]X O]X ! ~GHw)yhY @src/org/apache/ws/commons/schema/XmlSchemaMinInclusiveFacet.javaO]X O]X ! Ja+A\+$ ݤ,=src/org/apache/ws/commons/schema/XmlSchemaMinLengthFacet.javaO]X O]X ! V6f(UAв.x/7src/org/apache/ws/commons/schema/XmlSchemaNotation.javaO]X O]X ! ;N3Cǧ1g;src/org/apache/ws/commons/schema/XmlSchemaNumericFacet.javaO]X O]X ! 4/Yx1y5src/org/apache/ws/commons/schema/XmlSchemaObject.javaO]X O]X !  EHO@ƛ?src/org/apache/ws/commons/schema/XmlSchemaObjectCollection.javaO]X O]X ! V7;4h+uBɲ?src/org/apache/ws/commons/schema/XmlSchemaObjectEnumerator.javaO]X O]X ! >| pa~*+v=:src/org/apache/ws/commons/schema/XmlSchemaObjectTable.javaO]X O]X ! `!.U%hv7src/org/apache/ws/commons/schema/XmlSchemaParticle.javaO]X O]X ! 5SI J x#;src/org/apache/ws/commons/schema/XmlSchemaPatternFacet.javaO]X O]X ! l4+>fp(m_7src/org/apache/ws/commons/schema/XmlSchemaRedefine.javaO]X O]X ! -&([82"T?7src/org/apache/ws/commons/schema/XmlSchemaSequence.javaO]X O]X ! LS+xtGʈ  29src/org/apache/ws/commons/schema/XmlSchemaSerializer.javaO]X O]X ! ĪIkfy $^ onw@src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.javaO]X O]X ! ̟8aBAhOm=src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.javaO]X O]X !  r\RV{śjJDsrc/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.javaO]X O]X ! ]Mն]:W;t>src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeUnion.javaO]X O]X ! X %r`6d·Q5 ?src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.javaO]X O]X !  XΖGSІ|3src/org/apache/ws/commons/schema/XmlSchemaType.javaO]X O]X ! ~ 4n][q5src/org/apache/ws/commons/schema/XmlSchemaUnique.javaO]X O]X ! GL4m%X!2src/org/apache/ws/commons/schema/XmlSchemaUse.javaO]X O]X ! sj"{+mc?>src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.javaO]X O]X ! 0*Rp$&9,w,E4src/org/apache/ws/commons/schema/XmlSchemaXPath.javaO]X O]X ! YYlf"Q]jj[cM~eMsrc/org/apache/ws/commons/schema/extensions/DefaultExtensionDeserializer.javaO]X O]X !  jJqVEg5Ksrc/org/apache/ws/commons/schema/extensions/DefaultExtensionSerializer.javaO]X O]X ! 03cIJ L&YfFsrc/org/apache/ws/commons/schema/extensions/ExtensionDeserializer.javaO]X O]X ! K_iU5k[w_ Asrc/org/apache/ws/commons/schema/utils/NamespaceContextOwner.javaO]X O]X !  E>E j`8src/org/apache/ws/commons/schema/utils/NamespaceMap.javaO]X O]X ! IA*Mn +?src/org/apache/ws/commons/schema/utils/NamespacePrefixList.javaO]X O]X ! LDJ^V>Sj@src/org/apache/ws/commons/schema/utils/NodeNamespaceContext.javaO]X O]X !  .4Y4ԐsV\8;src/org/apache/ws/commons/schema/utils/PrefixCollector.javaO]X O]X ! vPH$΀6>,eDsrc/org/apache/ws/commons/schema/utils/TargetNamespaceValidator.javaO]X O]X ! whA|FS.Kb=84L4src/org/apache/ws/commons/schema/utils/XDOMUtil.javaO]X O]X ! =,Y1[̚.8Ӏ6src/org/codehaus/annogen/generate/AnnoBeanMapping.javaO]X O]X ! ,9d^ a .src/org/codehaus/annogen/generate/Annogen.javaO]X O]X ! wȅ[ujF '!'2src/org/codehaus/annogen/generate/AnnogenTask.javaO]X O]X ! }Z"z>Glo) $=src/org/codehaus/annogen/generate/internal/PropfileUtils.javaO]X O]X ! *V`CL؎KZcNN@src/org/codehaus/annogen/generate/internal/joust/Annotation.javaO]X O]X !  W`' p4_Dsrc/org/codehaus/annogen/generate/internal/joust/AnnotationImpl.javaO]X O]X ! 5ĄH%s[|O$.HAsrc/org/codehaus/annogen/generate/internal/joust/CodeGenUtil.javaO]X O]X ! 9Ҿ`X=$ 9lٿOsrc/org/codehaus/annogen/generate/internal/joust/CompilingJavaOutputStream.javaO]X O]X ! "eGGuQ˳lƖP@src/org/codehaus/annogen/generate/internal/joust/Expression.javaO]X O]X ! p\p;WȢ??Z0Gsrc/org/codehaus/annogen/generate/internal/joust/ExpressionFactory.javaO]X O]X !  ;(HLsrc/org/codehaus/annogen/generate/internal/joust/SourceJavaOutputStream.javaO]X O]X ! ȁ33R7˙WA!Psrc/org/codehaus/annogen/generate/internal/joust/ValidatingJavaOutputStream.javaO]X O]X ! t%^zwe|]V>src/org/codehaus/annogen/generate/internal/joust/Variable.javaO]X O]X !  dRɛ/yگ!WCsrc/org/codehaus/annogen/generate/internal/joust/WriterFactory.javaO]X O]X ! yX!F=HKZѩW@T``.src/org/codehaus/annogen/generate/package.htmlO]X O]X ! SL[ #p#ߖpK!4src/org/codehaus/jam/internal/classrefs/package.htmlO]X DO]X D! !*{eD۳GZ&@src/org/codehaus/jam/internal/elements/AnnotatedElementImpl.javaO]X DO]X D! ఫ:ajʢØ2:src/org/codehaus/jam/internal/elements/AnnotationImpl.javaO]X DO]X D! 0ɇH}u6>%5e;@?src/org/codehaus/jam/internal/elements/AnnotationValueImpl.javaO]X DO]X D! R՞x{[j~:src/org/codehaus/jam/internal/elements/ArrayClassImpl.javaO]X DO]X D! %H+'/zKUOj9Xb[O 5src/org/codehaus/jam/internal/elements/ClassImpl.javaO]X DO]X D! dCWU+=7src/org/codehaus/jam/internal/elements/CommentImpl.javaO]X DO]X D!  /y(BD#o{R;src/org/codehaus/jam/internal/elements/ConstructorImpl.javaO]X DO]X D! hgŊ͚ >N[l:src/org/codehaus/jam/internal/elements/ElementContext.javaO]X DO]X D! g,>6ASB7src/org/codehaus/jam/internal/elements/ElementImpl.javaO]X DO]X D! =JOC\[m15y5src/org/codehaus/jam/internal/elements/FieldImpl.javaO]X DO]X D!  m2[%h9<`9src/org/codehaus/jam/internal/elements/InvokableImpl.javaO]X DO]X D!  ?H|yT;Fsrc/org/codehaus/jam/internal/elements/LinebreakTagPropertyParser.javaO]X DO]X D!  \;\t~eP2t?6src/org/codehaus/jam/internal/elements/MemberImpl.javaO]X DO]X D! .HQ/@f#}mZQ"JN6src/org/codehaus/jam/internal/elements/MethodImpl.javaO]X DO]X D!  IJcYQ`O=[}D7src/org/codehaus/jam/internal/elements/PackageImpl.javaO]X DO]X D!  o>yr `ժ^9src/org/codehaus/jam/internal/elements/ParameterImpl.javaO]X DO]X D! Ab5gsrc/org/codehaus/jam/internal/elements/PrimitiveClassImpl.javaO]X O]X ! w|MOwq6,©9EdU8src/org/codehaus/jam/internal/elements/PropertyImpl.javaO]X O]X ! 4' PDOȧgG>src/org/codehaus/jam/internal/elements/SourcePositionImpl.javaO]X O]X !  w.]hR/3src/org/codehaus/jam/internal/elements/TagImpl.javaO]X O]X ! xyrbdLw. M恥?src/org/codehaus/jam/internal/elements/UnresolvedClassImpl.javaO]X O]X ! /bk0qi%O9src/org/codehaus/jam/internal/elements/VoidClassImpl.javaO]X O]X ! !ORf~ Nd 6z]LGsrc/org/codehaus/jam/internal/elements/WhitespaceTagPropertyParser.javaO]X O]X ! "fmUleit3src/org/codehaus/jam/internal/elements/package.htmlO]X O]X ! $<&^},QeC>D>src/org/codehaus/jam/internal/javadoc/JavadocClassBuilder.javaO]X O]X ! % ְn(/ QGsrc/org/codehaus/jam/internal/javadoc/JavadocClassloadingException.javaO]X O]X ! & N !A| "7nU9src/org/codehaus/jam/internal/javadoc/JavadocResults.javaO]X O]X ! '꾽~iFb13ȶ8src/org/codehaus/jam/internal/javadoc/JavadocRunner.javaO]X O]X ! (6`I7XX] p?src/org/codehaus/jam/internal/javadoc/JavadocTigerDelegate.javaO]X O]X ! )sKdE'N8*xea>src/org/codehaus/jam/internal/reflect/ReflectClassBuilder.javaO]X O]X ! 2=4:,7ŦtU??src/org/codehaus/jam/internal/reflect/ReflectTigerDelegate.javaO]X O]X ! 4C.,$"OQbV3src/org/codehaus/jam/mutable/MAnnotatedElement.javaO]X O]X ! 5nC̉U My-src/org/codehaus/jam/mutable/MAnnotation.javaO]X O]X ! 6u@5//(src/org/codehaus/jam/mutable/MClass.javaO]X O]X ! 7 2ʑ^b-p*src/org/codehaus/jam/mutable/MComment.javaO]X O]X ! 8p m~=xɍcෆao.src/org/codehaus/jam/mutable/MConstructor.javaO]X O]X ! 9LTo\Lm7YIƂ>*src/org/codehaus/jam/mutable/MElement.javaO]X O]X ! :"y~@ͧHGG(src/org/codehaus/jam/mutable/MField.javaO]X O]X ! ;~G!ZEY*src/org/codehaus/jam/mutable/MPackage.javaO]X O]X ! ?.:*&wS,src/org/codehaus/jam/mutable/MParameter.javaO]X O]X ! @M| I4y`4|JC1src/org/codehaus/jam/mutable/MSourcePosition.javaO]X O]X ! A}6a5my* 1340038488 -0400 clone: from https://github.com/a13m/wsdl2c.git ./.git/logs/refs/0000775000175000017500000000000011767656530012751 5ustar brianbrian./.git/logs/refs/heads/0000775000175000017500000000000011767656530014035 5ustar brianbrian./.git/logs/refs/heads/master0000664000175000017500000000027611767656530015260 0ustar brianbrian0000000000000000000000000000000000000000 9b0887e14fb7ad7f61910432f5549bf1414a0ceb Brian Thomason 1340038488 -0400 clone: from https://github.com/a13m/wsdl2c.git ./.git/hooks/0000775000175000017500000000000011767656522012172 5ustar brianbrian./.git/hooks/pre-commit.sample0000775000175000017500000000325011767656522015454 0ustar brianbrian#!/bin/sh # # An example hook script to verify what is about to be committed. # Called by "git commit" with no arguments. The hook should # exit with non-zero status after issuing an appropriate message if # it wants to stop the commit. # # To enable this hook, rename this file to "pre-commit". if git rev-parse --verify HEAD >/dev/null 2>&1 then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi # If you want to allow non-ascii filenames set this variable to true. allownonascii=$(git config hooks.allownonascii) # Redirect output to stderr. exec 1>&2 # Cross platform projects tend to avoid non-ascii filenames; prevent # them from being added to the repository. We exploit the fact that the # printable range starts at the space character and ends with tilde. if [ "$allownonascii" != "true" ] && # Note that the use of brackets around a tr range is ok here, (it's # even required, for portability to Solaris 10's /usr/bin/tr), since # the square bracket bytes happen to fall in the designated range. test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 then echo "Error: Attempt to add a non-ascii file name." echo echo "This can cause problems if you want to work" echo "with people on other platforms." echo echo "To be portable it is advisable to rename the file ..." echo echo "If you know what you are doing you can disable this" echo "check using:" echo echo " git config hooks.allownonascii true" echo exit 1 fi # If there are whitespace errors, print the offending file names and fail. exec git diff-index --check --cached $against -- ./.git/hooks/pre-rebase.sample0000775000175000017500000001144211767656522015427 0ustar brianbrian#!/bin/sh # # Copyright (c) 2006, 2008 Junio C Hamano # # The "pre-rebase" hook is run just before "git rebase" starts doing # its job, and can prevent the command from running by exiting with # non-zero status. # # The hook is called with the following parameters: # # $1 -- the upstream the series was forked from. # $2 -- the branch being rebased (or empty when rebasing the current branch). # # This sample shows how to prevent topic branches that are already # merged to 'next' branch from getting rebased, because allowing it # would result in rebasing already published history. publish=next basebranch="$1" if test "$#" = 2 then topic="refs/heads/$2" else topic=`git symbolic-ref HEAD` || exit 0 ;# we do not interrupt rebasing detached HEAD fi case "$topic" in refs/heads/??/*) ;; *) exit 0 ;# we do not interrupt others. ;; esac # Now we are dealing with a topic branch being rebased # on top of master. Is it OK to rebase it? # Does the topic really exist? git show-ref -q "$topic" || { echo >&2 "No such branch $topic" exit 1 } # Is topic fully merged to master? not_in_master=`git rev-list --pretty=oneline ^master "$topic"` if test -z "$not_in_master" then echo >&2 "$topic is fully merged to master; better remove it." exit 1 ;# we could allow it, but there is no point. fi # Is topic ever merged to next? If so you should not be rebasing it. only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` only_next_2=`git rev-list ^master ${publish} | sort` if test "$only_next_1" = "$only_next_2" then not_in_topic=`git rev-list "^$topic" master` if test -z "$not_in_topic" then echo >&2 "$topic is already up-to-date with master" exit 1 ;# we could allow it, but there is no point. else exit 0 fi else not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` /usr/bin/perl -e ' my $topic = $ARGV[0]; my $msg = "* $topic has commits already merged to public branch:\n"; my (%not_in_next) = map { /^([0-9a-f]+) /; ($1 => 1); } split(/\n/, $ARGV[1]); for my $elem (map { /^([0-9a-f]+) (.*)$/; [$1 => $2]; } split(/\n/, $ARGV[2])) { if (!exists $not_in_next{$elem->[0]}) { if ($msg) { print STDERR $msg; undef $msg; } print STDERR " $elem->[1]\n"; } } ' "$topic" "$not_in_next" "$not_in_master" exit 1 fi <<\DOC_END This sample hook safeguards topic branches that have been published from being rewound. The workflow assumed here is: * Once a topic branch forks from "master", "master" is never merged into it again (either directly or indirectly). * Once a topic branch is fully cooked and merged into "master", it is deleted. If you need to build on top of it to correct earlier mistakes, a new topic branch is created by forking at the tip of the "master". This is not strictly necessary, but it makes it easier to keep your history simple. * Whenever you need to test or publish your changes to topic branches, merge them into "next" branch. The script, being an example, hardcodes the publish branch name to be "next", but it is trivial to make it configurable via $GIT_DIR/config mechanism. With this workflow, you would want to know: (1) ... if a topic branch has ever been merged to "next". Young topic branches can have stupid mistakes you would rather clean up before publishing, and things that have not been merged into other branches can be easily rebased without affecting other people. But once it is published, you would not want to rewind it. (2) ... if a topic branch has been fully merged to "master". Then you can delete it. More importantly, you should not build on top of it -- other people may already want to change things related to the topic as patches against your "master", so if you need further changes, it is better to fork the topic (perhaps with the same name) afresh from the tip of "master". Let's look at this example: o---o---o---o---o---o---o---o---o---o "next" / / / / / a---a---b A / / / / / / / / c---c---c---c B / / / / \ / / / / b---b C \ / / / / / \ / ---o---o---o---o---o---o---o---o---o---o---o "master" A, B and C are topic branches. * A has one fix since it was merged up to "next". * B has finished. It has been fully merged up to "master" and "next", and is ready to be deleted. * C has not merged to "next" at all. We would want to allow C to be rebased, refuse A, and encourage B to be deleted. To compute (1): git rev-list ^master ^topic next git rev-list ^master next if these match, topic has not merged in next at all. To compute (2): git rev-list master..topic if this is empty, it is fully merged to "master". DOC_END ./.git/hooks/post-update.sample0000775000175000017500000000027511767656522015651 0ustar brianbrian#!/bin/sh # # An example hook script to prepare a packed repository for use over # dumb transports. # # To enable this hook, rename this file to "post-update". exec git update-server-info ./.git/hooks/prepare-commit-msg.sample0000775000175000017500000000232711767656522017114 0ustar brianbrian#!/bin/sh # # An example hook script to prepare the commit log message. # Called by "git commit" with the name of the file that has the # commit message, followed by the description of the commit # message's source. The hook's purpose is to edit the commit # message file. If the hook fails with a non-zero status, # the commit is aborted. # # To enable this hook, rename this file to "prepare-commit-msg". # This hook includes three examples. The first comments out the # "Conflicts:" part of a merge commit. # # The second includes the output of "git diff --name-status -r" # into the message, just before the "git status" output. It is # commented because it doesn't cope with --amend or with squashed # commits. # # The third example adds a Signed-off-by line to the message, that can # still be edited. This is rarely a good idea. case "$2,$3" in merge,) /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; # ,|template,) # /usr/bin/perl -i.bak -pe ' # print "\n" . `git diff --cached --name-status -r` # if /^#/ && $first++ == 0' "$1" ;; *) ;; esac # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" ./.git/hooks/commit-msg.sample0000775000175000017500000000160011767656522015451 0ustar brianbrian#!/bin/sh # # An example hook script to check the commit log message. # Called by "git commit" with one argument, the name of the file # that has the commit message. The hook should exit with non-zero # status after issuing an appropriate message if it wants to stop the # commit. The hook is allowed to edit the commit message file. # # To enable this hook, rename this file to "commit-msg". # Uncomment the below to add a Signed-off-by line to the message. # Doing this in a hook is a bad idea in general, but the prepare-commit-msg # hook is more suited to it. # # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" # This example catches duplicate Signed-off-by lines. test "" = "$(grep '^Signed-off-by: ' "$1" | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { echo >&2 Duplicate Signed-off-by lines. exit 1 } ./.git/hooks/applypatch-msg.sample0000775000175000017500000000070411767656522016332 0ustar brianbrian#!/bin/sh # # An example hook script to check the commit log message taken by # applypatch from an e-mail message. # # The hook should exit with non-zero status after issuing an # appropriate message if it wants to stop the commit. The hook is # allowed to edit the commit message file. # # To enable this hook, rename this file to "applypatch-msg". . git-sh-setup test -x "$GIT_DIR/hooks/commit-msg" && exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} : ./.git/hooks/update.sample0000775000175000017500000000703311767656522014665 0ustar brianbrian#!/bin/sh # # An example hook script to blocks unannotated tags from entering. # Called by "git receive-pack" with arguments: refname sha1-old sha1-new # # To enable this hook, rename this file to "update". # # Config # ------ # hooks.allowunannotated # This boolean sets whether unannotated tags will be allowed into the # repository. By default they won't be. # hooks.allowdeletetag # This boolean sets whether deleting tags will be allowed in the # repository. By default they won't be. # hooks.allowmodifytag # This boolean sets whether a tag may be modified after creation. By default # it won't be. # hooks.allowdeletebranch # This boolean sets whether deleting branches will be allowed in the # repository. By default they won't be. # hooks.denycreatebranch # This boolean sets whether remotely creating branches will be denied # in the repository. By default this is allowed. # # --- Command line refname="$1" oldrev="$2" newrev="$3" # --- Safety check if [ -z "$GIT_DIR" ]; then echo "Don't run this script from the command line." >&2 echo " (if you want, you could supply GIT_DIR then run" >&2 echo " $0 )" >&2 exit 1 fi if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then echo "Usage: $0 " >&2 exit 1 fi # --- Config allowunannotated=$(git config --bool hooks.allowunannotated) allowdeletebranch=$(git config --bool hooks.allowdeletebranch) denycreatebranch=$(git config --bool hooks.denycreatebranch) allowdeletetag=$(git config --bool hooks.allowdeletetag) allowmodifytag=$(git config --bool hooks.allowmodifytag) # check for no description projectdesc=$(sed -e '1q' "$GIT_DIR/description") case "$projectdesc" in "Unnamed repository"* | "") echo "*** Project description file hasn't been set" >&2 exit 1 ;; esac # --- Check types # if $newrev is 0000...0000, it's a commit to delete a ref. zero="0000000000000000000000000000000000000000" if [ "$newrev" = "$zero" ]; then newrev_type=delete else newrev_type=$(git cat-file -t $newrev) fi case "$refname","$newrev_type" in refs/tags/*,commit) # un-annotated tag short_refname=${refname##refs/tags/} if [ "$allowunannotated" != "true" ]; then echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 exit 1 fi ;; refs/tags/*,delete) # delete tag if [ "$allowdeletetag" != "true" ]; then echo "*** Deleting a tag is not allowed in this repository" >&2 exit 1 fi ;; refs/tags/*,tag) # annotated tag if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 then echo "*** Tag '$refname' already exists." >&2 echo "*** Modifying a tag is not allowed in this repository." >&2 exit 1 fi ;; refs/heads/*,commit) # branch if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then echo "*** Creating a branch is not allowed in this repository" >&2 exit 1 fi ;; refs/heads/*,delete) # delete branch if [ "$allowdeletebranch" != "true" ]; then echo "*** Deleting a branch is not allowed in this repository" >&2 exit 1 fi ;; refs/remotes/*,commit) # tracking branch ;; refs/remotes/*,delete) # delete tracking branch if [ "$allowdeletebranch" != "true" ]; then echo "*** Deleting a tracking branch is not allowed in this repository" >&2 exit 1 fi ;; *) # Anything else (is there anything else?) echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 exit 1 ;; esac # --- Finished exit 0 ./.git/hooks/pre-applypatch.sample0000775000175000017500000000061611767656522016334 0ustar brianbrian#!/bin/sh # # An example hook script to verify what is about to be committed # by applypatch from an e-mail message. # # The hook should exit with non-zero status after issuing an # appropriate message if it wants to stop the commit. # # To enable this hook, rename this file to "pre-applypatch". . git-sh-setup test -x "$GIT_DIR/hooks/pre-commit" && exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} : ./.git/HEAD0000664000175000017500000000002711767656530011471 0ustar brianbrianref: refs/heads/master ./.git/branches/0000775000175000017500000000000011767656522012634 5ustar brianbrian./.git/info/0000775000175000017500000000000011767656522012002 5ustar brianbrian./.git/info/exclude0000664000175000017500000000036011767656522013355 0ustar brianbrian# git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ ./.git/refs/0000775000175000017500000000000011767656530012005 5ustar brianbrian./.git/refs/tags/0000775000175000017500000000000011767656522012744 5ustar brianbrian./.git/refs/heads/0000775000175000017500000000000011767656530013071 5ustar brianbrian./.git/refs/heads/master0000664000175000017500000000005111767656530014303 0ustar brianbrian9b0887e14fb7ad7f61910432f5549bf1414a0ceb ./.git/refs/remotes/0000775000175000017500000000000011767656530013463 5ustar brianbrian./.git/refs/remotes/origin/0000775000175000017500000000000011767656530014752 5ustar brianbrian./.git/refs/remotes/origin/HEAD0000664000175000017500000000004011767656530015370 0ustar brianbrianref: refs/remotes/origin/master ./README.md0000664000175000017500000000231311767656530011463 0ustar brianbrianwsdl2c ====== A stripped down axis2 source bundle suitable for running WSDL2CThis is an amalgam of code from several java projects which are required to use WSDL2C from the Apache Axis 2 project. The goal is to have code which can be built from source without the chain of dependencies needed to build each of these projects in their entirety. The code in this project coms from the following sources: * http://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.4.1 * http://svn.apache.org/repos/asf/webservices/commons/tags/axiom/1.2.12 * http://svn.apache.org/repos/asf/webservices/commons/tags/neethi/neethi-3.0.1 * http://svn.apache.org/repos/asf/webservices/commons/tags/XmlSchema/1.4.2 * http://svn.apache.org/repos/asf/webservices/woden/tags/1.0M9 * https://svn.java.net/svn/jsr311~svn/tags/jsr311-api-1.1.1 * svn://svn.annogen.codehaus.org/annogen/scm [1] At this point, none of the sources have been modified. Note that the jsr311 code (i.e., the files under javax/ws/rs) is provided under the CDDL, while all other code uses the Apache Software License, version 2.0. Notes: [1] I could not access this link, and pulled the code out of a jpackage RPM, but theoretically the code still lives in this repo. ./src/0000775000175000017500000000000011767656530010774 5ustar brianbrian./src/javax/0000775000175000017500000000000011767656530012105 5ustar brianbrian./src/javax/ws/0000775000175000017500000000000011767656530012536 5ustar brianbrian./src/javax/ws/rs/0000775000175000017500000000000011767656530013162 5ustar brianbrian./src/javax/ws/rs/Produces.java0000664000175000017500000000373511767656530015621 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Produces.java * * Created on September 15, 2006, 2:40 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines the media type(s) that the methods of a resource class or * {@link javax.ws.rs.ext.MessageBodyWriter} can produce. * If not specified then a container will assume that any type can be produced. * Method level annotations override a class level annotation. A container * is responsible for ensuring that the method invoked is capable of producing * one of the media types requested in the HTTP request. If no such method is * available the container must respond with a HTTP "406 Not Acceptable" as * specified by RFC 2616. * *

A method for which there is a single-valued Produces * is not required to set the media type of representations that it produces: * the container will use the value of the Produces when * sending a response.

* * @see javax.ws.rs.ext.MessageBodyWriter */ @Inherited @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Produces { /** * A list of media types. Each entry may specify a single type or consist * of a comma separated list of types. E.g. {"image/jpeg,image/gif", * "image/png"}. Use of the comma-separated form allows definition of a * common string constant for use on multiple targets. */ String[] value() default "*/*"; } ./src/javax/ws/rs/Consumes.java0000664000175000017500000000334011767656530015621 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Consumes.java * * Created on September 15, 2006, 2:40 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines the media types that the methods of a resource class or * {@link javax.ws.rs.ext.MessageBodyReader} can accept. If * not specified, a container will assume that any media type is acceptable. * Method level annotations override a class level annotation. A container * is responsible for ensuring that the method invoked is capable of consuming * the media type of the HTTP request entity body. If no such method is * available the container must respond with a HTTP "415 Unsupported Media Type" * as specified by RFC 2616. * * @see javax.ws.rs.ext.MessageBodyReader */ @Inherited @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Consumes { /** * A list of media types. Each entry may specify a single type or consist * of a comma separated list of types. E.g. {"image/jpeg,image/gif", * "image/png"}. Use of the comma-separated form allows definition of a * common string constant for use on multiple targets. */ String[] value() default "*/*"; } ./src/javax/ws/rs/WebApplicationException.java0000664000175000017500000000755111767656530020615 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ package javax.ws.rs; import javax.ws.rs.core.Response; /** * Runtime exception for applications. *

* This exception may be thrown by a resource method, provider or * {@link javax.ws.rs.core.StreamingOutput} implementation if a specific * HTTP error response needs to be produced. Only effective if thrown prior to * the response being committed. * * @author Paul.Sandoz@Sun.Com */ public class WebApplicationException extends RuntimeException { private static final long serialVersionUID = 11660101L; private Response response; /** * Construct a new instance with a blank message and default HTTP status code of 500 */ public WebApplicationException() { this(null, Response.Status.INTERNAL_SERVER_ERROR); } /** * Construct a new instance using the supplied response * @param response the response that will be returned to the client, a value * of null will be replaced with an internal server error response (status * code 500) */ public WebApplicationException(Response response) { this(null,response); } /** * Construct a new instance with a blank message and specified HTTP status code * @param status the HTTP status code that will be returned to the client */ public WebApplicationException(int status) { this(null, status); } /** * Construct a new instance with a blank message and specified HTTP status code * @param status the HTTP status code that will be returned to the client * @throws IllegalArgumentException if status is null */ public WebApplicationException(Response.Status status) { this(null, status); } /** * Construct a new instance with a blank message and default HTTP status code of 500 * @param cause the underlying cause of the exception */ public WebApplicationException(Throwable cause) { this(cause,Response.Status.INTERNAL_SERVER_ERROR); } /** * Construct a new instance using the supplied response * @param response the response that will be returned to the client, a value * of null will be replaced with an internal server error response (status * code 500) * @param cause the underlying cause of the exception */ public WebApplicationException(Throwable cause, Response response) { super(cause); if (response==null) this.response = Response.serverError().build(); else this.response = response; } /** * Construct a new instance with a blank message and specified HTTP status code * @param status the HTTP status code that will be returned to the client * @param cause the underlying cause of the exception */ public WebApplicationException(Throwable cause, int status) { this(cause, Response.status(status).build()); } /** * Construct a new instance with a blank message and specified HTTP status code * @param status the HTTP status code that will be returned to the client * @param cause the underlying cause of the exception * @throws IllegalArgumentException if status is null */ public WebApplicationException(Throwable cause, Response.Status status) { this(cause, Response.status(status).build()); } /** * Get the HTTP response. * * @return the HTTP response. */ public Response getResponse() { return response; } } ./src/javax/ws/rs/package-info.java0000664000175000017500000000104611767656530016352 0ustar brianbrian/** * High-level interfaces and annotations used to create RESTful service * resources. E.g.:

@Path("widgets/{widgetid}")
@Consumes("application/widgets+xml")
@Produces("application/widgets+xml")
public class WidgetResource {

  @GET
  public String getWidget(@PathParam("widgetid") String id) {
    return getWidgetAsXml(id);
  }
  
  @PUT
  public void updateWidget(@PathParam("widgetid") String id,
    Source update) {
    updateWidgetFromXml(id, update);
  }
  
  ...
}
*/ package javax.ws.rs;./src/javax/ws/rs/Path.java0000664000175000017500000001073011767656530014722 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Path.java * * Created on September 15, 2006, 2:33 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Identifies the URI path that a resource class or class method will serve * requests for. * *

Paths are relative. For an annotated class the base URI is the * application path, see {@link javax.ws.rs.ApplicationPath}. For an annotated * method the base URI is the * effective URI of the containing class. For the purposes of absolutizing a * path against the base URI , a leading '/' in a path is * ignored and base URIs are treated as if they ended in '/'. E.g.:

* *
@Path("widgets")
 *public class WidgetsResource {
 *  @GET
 *  String getList() {...}
 * 
 *  @GET @Path("{id}")
 *  String getWidget(@PathParam("id") String id) {...}
 *}
* *

In the above, if the application path is * catalogue and the application is deployed at * http://example.com/, then GET requests for * http://example.com/catalogue/widgets will be handled by the * getList method while requests for * http://example.com/catalogue/widgets/nnn (where * nnn is some value) will be handled by the * getWidget method. The same would apply if the value of either * @Path annotation started with '/'. * *

Classes and methods may also be annotated with {@link Consumes} and * {@link Produces} to filter the requests they will receive.

* * @see Consumes * @see Produces * @see PathParam */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Path { /** * Defines a URI template for the resource class or method, must not * include matrix parameters. * *

Embedded template parameters are allowed and are of the form:

* *
 param = "{" *WSP name *WSP [ ":" *WSP regex *WSP ] "}"
     * name = (ALPHA / DIGIT / "_")*(ALPHA / DIGIT / "." / "_" / "-" ) ; \w[\w\.-]*
     * regex = *( nonbrace / "{" *nonbrace "}" ) ; where nonbrace is any char other than "{" and "}"
* *

The literal part of the supplied value (those characters * that are not part of a template parameter) is automatically percent * encoded to conform to the {@code path} production of * {@link RFC 3986 section 3.3}. * Note that percent encoded values are allowed in the literal part of the * value, an implementation will recognize such values and will not double * encode the '%' character.

*/ String value(); } ./src/javax/ws/rs/MatrixParam.java0000664000175000017500000000536411767656530016262 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * MatrixParam.java * * Created on January 24, 2007, 2:40 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value(s) of a URI matrix parameter to a resource method parameter, * resource class field, or resource class bean property. * Values are URL decoded unless this is disabled using the {@link Encoded} * annotation. A default value can be specified using the {@link DefaultValue} * annotation. * * The type T of the annotated parameter, field or property must * either: *
    *
  1. Be a primitive type
  2. *
  3. Have a constructor that accepts a single String argument
  4. *
  5. Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)})
  6. *
  7. Be List<T>, Set<T> or * SortedSet<T>, where T satisfies 2 or 3 above. * The resulting collection is read-only.
  8. *
* *

If the type is not one of those listed in 4 above then the first value * (lexically) of the parameter is used.

* *

Because injection occurs at object creation time, use of this annotation * on resource class fields and bean properties is only supported for the * default per-request resource class lifecycle. Resource classes using * other lifecycles should only use this annotation on resource method * parameters.

* * @see DefaultValue * @see Encoded * @see Matrix URIs */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface MatrixParam { /** * Defines the name of the URI matrix parameter whose value will be used * to initialize the value of the annotated method argument, class field or * bean property. The name is specified in decoded form, any percent encoded * literals within the value will not be decoded and will instead be * treated as literal text. E.g. if the parameter name is "a b" then the * value of the annotation is "a b", not "a+b" or "a%20b". */ String value(); } ./src/javax/ws/rs/HeaderParam.java0000664000175000017500000000456711767656530016212 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * HeaderParam.java * * Created on January 24, 2007, 2:33 PM * */ package javax.ws.rs; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value(s) of a HTTP header to a resource method parameter, * resource class field, or resource class bean property. A default value * can be specified using the {@link DefaultValue} annotation. * * The type T of the annotated parameter, field or property * must either: *
    *
  1. Be a primitive type
  2. *
  3. Have a constructor that accepts a single String argument
  4. *
  5. Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)})
  6. *
  7. Be List<T>, Set<T> or * SortedSet<T>, where T satisfies 2 or 3 above. * The resulting collection is read-only.
  8. *
* *

If the type is not one of those listed in 4 above then the first value * (lexically) of the header is used.

* *

Because injection occurs at object creation time, use of this annotation * on resource class fields and bean properties is only supported for the * default per-request resource class lifecycle. Resource classes using * other lifecycles should only use this annotation on resource method * parameters.

* * @see DefaultValue * @see javax.ws.rs.core.HttpHeaders */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface HeaderParam { /** * Defines the name of the HTTP header whose value will be used * to initialize the value of the annotated method argument, class field or * bean property. Case insensitive. */ String value(); } ./src/javax/ws/rs/DefaultValue.java0000664000175000017500000000362311767656530016412 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * DefaultValue.java * * Created on November 16, 2006, 2:04 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines the default value of request metadata that is bound using one of the * following annotations: * {@link javax.ws.rs.PathParam}, * {@link javax.ws.rs.QueryParam}, * {@link javax.ws.rs.MatrixParam}, * {@link javax.ws.rs.CookieParam}, * {@link javax.ws.rs.FormParam}, * or {@link javax.ws.rs.HeaderParam}. * The default value is used if the corresponding metadata is not present in the * request. * *

If the type of the annotated parameter is * List, Set or SortedSet then the * resulting collection will have a single entry mapped from the supplied * default value.

* *

If this annotation is not used and the corresponding metadata is not * present in the request, the value will be an empty collection for * List, Set or SortedSet, null for * other object types, and the Java-defined default for primitive types.

* * @see PathParam * @see QueryParam * @see FormParam * @see HeaderParam * @see MatrixParam * @see CookieParam */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface DefaultValue { /** * The default value. */ String value(); } ./src/javax/ws/rs/CookieParam.java0000664000175000017500000000436311767656530016225 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * CookieParam.java * * Created on November 16, 2006, 2:04 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value of a HTTP cookie to a resource method parameter, * resource class field, or resource class bean property. * A default value can be specified using the {@link DefaultValue} * annotation. * * The type T of the annotated parameter, field or property must * either: *
    *
  1. Be a primitive type
  2. *
  3. Be {@link javax.ws.rs.core.Cookie}
  4. *
  5. Have a constructor that accepts a single String argument
  6. *
  7. Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)}) *
  8. Be List<T>, Set<T> or * SortedSet<T>, where T satisfies 2, 3 or 4 above. * The resulting collection is read-only.
  9. *
* *

Because injection occurs at object creation time, use of this annotation * on resource class fields and bean properties is only supported for the * default per-request resource class lifecycle. Resource classes using * other lifecycles should only use this annotation on resource method * parameters.

* * @see DefaultValue * @see javax.ws.rs.core.Cookie * @see javax.ws.rs.core.HttpHeaders#getCookies */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface CookieParam { /** * Defines the name of the HTTP cookie whose value will be used * to initialize the value of the annotated method argument, class field or * bean property. */ String value(); } ./src/javax/ws/rs/QueryParam.java0000664000175000017500000000532711767656530016122 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * QueryParam.java * * Created on November 16, 2006, 2:04 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value(s) of a HTTP query parameter to a resource method parameter, * resource class field, or resource class bean property. * Values are URL decoded unless this is disabled using the {@link Encoded} * annotation. A default value can be specified using the {@link DefaultValue} * annotation. * * The type T of the annotated parameter, field or property must * either: *
    *
  1. Be a primitive type
  2. *
  3. Have a constructor that accepts a single String argument
  4. *
  5. Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)})
  6. *
  7. Be List<T>, Set<T> or * SortedSet<T>, where T satisfies 2 or 3 above. * The resulting collection is read-only.
  8. *
* *

If the type is not one of those listed in 4 above then the first value * (lexically) of the parameter is used.

* *

Because injection occurs at object creation time, use of this annotation * on resource class fields and bean properties is only supported for the * default per-request resource class lifecycle. Resource classes using * other lifecycles should only use this annotation on resource method * parameters.

* * @see DefaultValue * @see Encoded * @see javax.ws.rs.core.UriInfo#getQueryParameters */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface QueryParam { /** * Defines the name of the HTTP query parameter whose value will be used * to initialize the value of the annotated method argument, class field or * bean property. The name is specified in decoded form, any percent encoded * literals within the value will not be decoded and will instead be * treated as literal text. E.g. if the parameter name is "a b" then the * value of the annotation is "a b", not "a+b" or "a%20b". */ String value(); } ./src/javax/ws/rs/DELETE.java0000664000175000017500000000156411767656530014775 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * DELETE.java * * Created on October 24, 2007, 5:12 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP DELETE requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.DELETE) public @interface DELETE { } ./src/javax/ws/rs/PUT.java0000664000175000017500000000155011767656530014476 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * PUT.java * * Created on October 24, 2007, 5:12 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP PUT requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.PUT) public @interface PUT { } ./src/javax/ws/rs/ext/0000775000175000017500000000000011767656530013762 5ustar brianbrian./src/javax/ws/rs/ext/package-info.java0000664000175000017500000000015211767656530017147 0ustar brianbrian/** * APIs that provide extensions to the types supported by the JAX-RS API. */ package javax.ws.rs.ext;./src/javax/ws/rs/ext/ContextResolver.java0000664000175000017500000000253111767656530017774 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ package javax.ws.rs.ext; /** * Contract for a provider that supplies context information to resource * classes and other providers. An implementation of this interface must be * annotated with {@link Provider}. * * A ContextResolver implementation may be annotated * with {@link javax.ws.rs.Produces} to restrict the media types for * which it will be considered suitable. * * @see javax.ws.rs.core.Context * @see Providers#getContextResolver(java.lang.Class, javax.ws.rs.core.MediaType) * @see Provider * @see javax.ws.rs.Produces */ public interface ContextResolver { /** * Get a context of type T that is applicable to the supplied * type. * @param type the class of object for which a context is desired * @return a context for the supplied type or null if a * context for the supplied type is not available from this provider. */ T getContext(Class type); } ./src/javax/ws/rs/ext/FactoryFinder.java0000664000175000017500000001270211767656530017366 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * FactoryFinder.java * * Created on November 16, 2007, 3:14 PM * */ package javax.ws.rs.ext; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; class FactoryFinder { static ClassLoader getContextClassLoader() { return AccessController.doPrivileged( new PrivilegedAction() { public ClassLoader run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } /** * Creates an instance of the specified class using the specified * ClassLoader object. * * @exception ClassNotFoundException if the given class could not be found * or could not be instantiated */ private static Object newInstance(String className, ClassLoader classLoader) throws ClassNotFoundException { try { Class spiClass; if (classLoader == null) { spiClass = Class.forName(className); } else { try { spiClass = Class.forName(className, false, classLoader); } catch (ClassNotFoundException ex) { spiClass = Class.forName(className); } } return spiClass.newInstance(); } catch (ClassNotFoundException x) { throw x; } catch (Exception x) { throw new ClassNotFoundException( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Finds the implementation Class object for the given * factory name, or if that fails, finds the Class object * for the given fallback class name. The arguments supplied MUST be * used in order. If using the first argument is successful, the second * one will not be used. *

* This method is package private so that this code can be shared. * * @return the Class object of the specified message factory; * may not be null * * @param factoryId the name of the factory to find, which is * a system property * @param fallbackClassName the implementation class name, which is * to be used only if nothing else * is found; null to indicate that * there is no fallback class name * @exception WebServiceException if there is an error */ static Object find(String factoryId, String fallbackClassName) throws ClassNotFoundException { ClassLoader classLoader = getContextClassLoader(); String serviceId = "META-INF/services/" + factoryId; // try to find services in CLASSPATH try { InputStream is; if (classLoader == null) { is = ClassLoader.getSystemResourceAsStream(serviceId); } else { is = classLoader.getResourceAsStream(serviceId); } if (is != null) { BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); String factoryClassName = rd.readLine(); rd.close(); if (factoryClassName != null && !"".equals(factoryClassName)) { return newInstance(factoryClassName, classLoader); } } } catch (Exception ex) { } // try to read from $java.home/lib/jaxrs.properties try { String javah = System.getProperty("java.home"); String configFile = javah + File.separator + "lib" + File.separator + "jaxrs.properties"; File f = new File(configFile); if (f.exists()) { Properties props = new Properties(); props.load(new FileInputStream(f)); String factoryClassName = props.getProperty(factoryId); return newInstance(factoryClassName, classLoader); } } catch (Exception ex) { } // Use the system property try { String systemProp = System.getProperty(factoryId); if (systemProp != null) { return newInstance(systemProp, classLoader); } } catch (SecurityException se) { } if (fallbackClassName == null) { throw new ClassNotFoundException( "Provider for " + factoryId + " cannot be found", null); } return newInstance(fallbackClassName, classLoader); } } ./src/javax/ws/rs/ext/MessageBodyWriter.java0000664000175000017500000001074411767656530020232 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * MessageBodyWriter.java * * Created on November 8, 2007, 3:57 PM * */ package javax.ws.rs.ext; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; /** * Contract for a provider that supports the conversion of a Java type to a * stream. To add a MessageBodyWriter implementation, annotate the * implementation class with @Provider. * * A MessageBodyWriter implementation may be annotated * with {@link javax.ws.rs.Produces} to restrict the media types for which it will * be considered suitable. * * @param T the type that can be written * @see Provider * @see javax.ws.rs.Produces */ public interface MessageBodyWriter { /** * Ascertain if the MessageBodyWriter supports a particular type. * * @param type the class of object that is to be written. * @param genericType the type of object to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations on the resource * method that returns the object. * @param mediaType the media type of the HTTP entity. * @return true if the type is supported, otherwise false. */ boolean isWriteable(Class type, Type genericType, Annotation annotations[], MediaType mediaType); /** * Called before writeTo to ascertain the length in bytes of * the serialized form of t. A non-negative return value is * used in a HTTP Content-Length header. * @param t the instance to write * @param type the class of object that is to be written. * @param genericType the type of object to be written, obtained either * by reflection of a resource method return type or by inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations on the resource * method that returns the object. * @param mediaType the media type of the HTTP entity. * @return length in bytes or -1 if the length cannot be determined in * advance */ long getSize(T t, Class type, Type genericType, Annotation annotations[], MediaType mediaType); /** * Write a type to an HTTP response. The response header map is mutable * but any changes must be made before writing to the output stream since * the headers will be flushed prior to writing the response body. * * @param t the instance to write. * @param type the class of object that is to be written. * @param genericType the type of object to be written, obtained either * by reflection of a resource method return type or by inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations on the resource * method that returns the object. * @param mediaType the media type of the HTTP entity. * @param httpHeaders a mutable map of the HTTP response headers. * @param entityStream the {@link OutputStream} for the HTTP entity. The * implementation should not close the output stream. * @throws java.io.IOException if an IO error arises * @throws javax.ws.rs.WebApplicationException if a specific * HTTP error response needs to be produced. Only effective if thrown prior * to the response being committed. */ void writeTo(T t, Class type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException; } ./src/javax/ws/rs/ext/MessageBodyReader.java0000664000175000017500000001053711767656530020160 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * MessageBodyReader.java * * Created on November 8, 2007, 3:57 PM * */ package javax.ws.rs.ext; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; /** * Contract for a provider that supports the conversion of a stream to a * Java type. To add a MessageBodyReader implementation, annotate the * implementation class with @Provider. * * A MessageBodyReader implementation may be annotated * with {@link javax.ws.rs.Consumes} to restrict the media types for which it will * be considered suitable. * * @see Provider * @see javax.ws.rs.Consumes */ public interface MessageBodyReader { /** * Ascertain if the MessageBodyReader can produce an instance of a * particular type. The type parameter gives the * class of the object that should be produced, the genericType parameter * gives the java.lang.reflect.Type of the object that should be produced. * E.g. if the object to be produced is List, the type parameter * will be java.util.List and the genericType parameter will be * java.lang.reflect.ParameterizedType. * * @param type the class of object to be produced. * @param genericType the type of object to be produced. E.g. if the * message body is to be converted into a method parameter, this will be * the formal type of the method parameter as returned by * Method.getGenericParameterTypes. * @param annotations an array of the annotations on the declaration of the * artifact that will be initialized with the produced instance. E.g. if the * message body is to be converted into a method parameter, this will be * the annotations on that parameter returned by * Method.getParameterAnnotations. * @param mediaType the media type of the HTTP entity, if one is not * specified in the request then application/octet-stream is * used. * @return true if the type is supported, otherwise false. */ boolean isReadable(Class type, Type genericType, Annotation annotations[], MediaType mediaType); /** * Read a type from the {@link InputStream}. * * @return the type that was read from the stream. * @param type the type that is to be read from the entity stream. * @param genericType the type of object to be produced. E.g. if the * message body is to be converted into a method parameter, this will be * the formal type of the method parameter as returned by * Method.getGenericParameterTypes. * @param annotations an array of the annotations on the declaration of the * artifact that will be initialized with the produced instance. E.g. if the * message body is to be converted into a method parameter, this will be * the annotations on that parameter returned by * Method.getParameterAnnotations. * @param mediaType the media type of the HTTP entity. * @param httpHeaders the read-only HTTP headers associated with HTTP entity. * @param entityStream the {@link InputStream} of the HTTP entity. The * caller is responsible for ensuring that the input stream ends when the * entity has been consumed. The implementation should not close the input stream. * @throws java.io.IOException if an IO error arises * @throws javax.ws.rs.WebApplicationException if a specific * HTTP error response needs to be produced. Only effective if thrown prior * to the response being committed. */ T readFrom(Class type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException; } ./src/javax/ws/rs/ext/Provider.java0000664000175000017500000000172311767656530016422 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Provider.java * * Created on May 15, 2007, 11:59 AM * */ package javax.ws.rs.ext; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marks an implementation of an extension interface. * * @see MessageBodyReader * @see MessageBodyWriter * @see ContextResolver * @see ExceptionMapper */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Provider { } ./src/javax/ws/rs/ext/RuntimeDelegate.java0000664000175000017500000002076211767656530017712 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * RuntimeDelegate.java * * Created on November 15, 2007, 4:00 PM * */ package javax.ws.rs.ext; import java.lang.reflect.ReflectPermission; import java.net.URL; import javax.ws.rs.core.Application; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Variant.VariantListBuilder; import javax.ws.rs.core.UriBuilder; /** * Implementations of JAX-RS provide a concrete subclass of RuntimeDelegate and * various JAX-RS API methods defer to methods of RuntimeDelegate for their * functionality. Regular users of JAX-RS are not expected to use this class * directly and overriding an implementation of this class with a user supplied * subclass may cause unexpected behavior. * */ public abstract class RuntimeDelegate { public static final String JAXRS_RUNTIME_DELEGATE_PROPERTY = "javax.ws.rs.ext.RuntimeDelegate"; private static final String JAXRS_DEFAULT_RUNTIME_DELEGATE = "com.sun.ws.rs.ext.RuntimeDelegateImpl"; private static ReflectPermission rp = new ReflectPermission("suppressAccessChecks"); protected RuntimeDelegate() { } private static volatile RuntimeDelegate rd; /** * Obtain a RuntimeDelegate instance. If an instance had not already been * created and set via {@link #setInstance}, the first invocation will * create an instance which will then be cached for future use. * *

* The algorithm used to locate the RuntimeDelegate subclass to use consists * of the following steps: *

*

    *
  • * If a resource with the name of * META-INF/services/javax.ws.rs.ext.RuntimeDelegate * exists, then its first line, if present, is used as the UTF-8 encoded * name of the implementation class. *
  • *
  • * If the $java.home/lib/jaxrs.properties file exists and it is readable by * the java.util.Properties.load(InputStream) method and it contains * an entry whose key is javax.ws.rs.ext.RuntimeDelegate, then the value of * that entry is used as the name of the implementation class. *
  • *
  • * If a system property with the name javax.ws.rs.ext.RuntimeDelegate * is defined, then its value is used as the name of the implementation class. *
  • *
  • * Finally, a default implementation class name is used. *
  • *
* * @return an instance of RuntimeDelegate */ public static RuntimeDelegate getInstance() { // Double-check idiom for lazy initialization of fields. RuntimeDelegate result = rd; if (result == null) { // First check (no locking) synchronized(RuntimeDelegate.class) { result = rd; if (result == null) { // Second check (with locking) rd = result = findDelegate(); } } } return result; } /** * Obtain a RuntimeDelegate instance using the method described in * {@link #getInstance}. * @return an instance of RuntimeDelegate */ private static RuntimeDelegate findDelegate() { try { Object delegate = FactoryFinder.find(JAXRS_RUNTIME_DELEGATE_PROPERTY, JAXRS_DEFAULT_RUNTIME_DELEGATE); if (!(delegate instanceof RuntimeDelegate)) { Class pClass = RuntimeDelegate.class; String classnameAsResource = pClass.getName().replace('.', '/') + ".class"; ClassLoader loader = pClass.getClassLoader(); if(loader == null) { loader = ClassLoader.getSystemClassLoader(); } URL targetTypeURL = loader.getResource(classnameAsResource); throw new LinkageError("ClassCastException: attempting to cast" + delegate.getClass().getClassLoader().getResource(classnameAsResource) + "to" + targetTypeURL.toString() ); } return (RuntimeDelegate) delegate; } catch (Exception ex) { throw new RuntimeException(ex); } } /** * Set the runtime delegate that will be used by JAX-RS classes. If this method * is not called prior to {@link #getInstance} then an implementation will * be sought as described in {@link #getInstance}. * @param rd the runtime delegate instance * @throws SecurityException if there is a security manager and the permission * ReflectPermission("suppressAccessChecks") has not been granted. */ public static void setInstance(RuntimeDelegate rd) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(rp); } synchronized(RuntimeDelegate.class) { RuntimeDelegate.rd = rd; } } /** * Create a new instance of a {@link javax.ws.rs.core.UriBuilder}. * @return new UriBuilder instance * @see javax.ws.rs.core.UriBuilder */ public abstract UriBuilder createUriBuilder(); /** * Create a new instance of a {@link javax.ws.rs.core.Response.ResponseBuilder}. * @return new ResponseBuilder instance * @see javax.ws.rs.core.Response.ResponseBuilder */ public abstract ResponseBuilder createResponseBuilder(); /** * Create a new instance of a {@link javax.ws.rs.core.Variant.VariantListBuilder}. * * @return new VariantListBuilder instance * @see javax.ws.rs.core.Variant.VariantListBuilder */ public abstract VariantListBuilder createVariantListBuilder(); /** * Create a configured instance of the supplied endpoint type. How the * returned endpoint instance is published is dependent on the type of * endpoint. * @param application the application configuration * @param endpointType the type of endpoint instance to be created. * @return a configured instance of the requested type. * @throws java.lang.IllegalArgumentException if application is null or the * requested endpoint type is not supported. * @throws java.lang.UnsupportedOperationException if the implementation * supports no endpoint types. */ public abstract T createEndpoint(Application application, Class endpointType) throws IllegalArgumentException, UnsupportedOperationException; /** * Obtain an instance of a HeaderDelegate for the supplied class. An * implementation is required to support the following values for type: * {@link javax.ws.rs.core.Cookie}, {@link javax.ws.rs.core.CacheControl}, * {@link javax.ws.rs.core.EntityTag}, {@link javax.ws.rs.core.NewCookie}, * {@link javax.ws.rs.core.MediaType} and {@code java.util.Date}. * @param type the class of the header * @return an instance of HeaderDelegate for the supplied type * @throws java.lang.IllegalArgumentException if type is null */ public abstract HeaderDelegate createHeaderDelegate(Class type); /** * Defines the contract for a delegate that is responsible for * converting between the String form of a HTTP header and * the corresponding JAX-RS type T. * @param T a JAX-RS type that corresponds to the value of a HTTP header */ public static interface HeaderDelegate { /** * Parse the supplied value and create an instance of T. * @param value the string value * @return the newly created instance of T * @throws IllegalArgumentException if the supplied string cannot be * parsed or is null */ public T fromString(String value) throws IllegalArgumentException; /** * Convert the supplied value to a String. * @param value the value of type T * @return a String representation of the value * @throws IllegalArgumentException if the supplied object cannot be * serialized or is null */ public String toString(T value); } } ./src/javax/ws/rs/ext/Providers.java0000664000175000017500000001400211767656530016577 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Providers.java * * Created on March 5, 2008, 9:00 AM * */ package javax.ws.rs.ext; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.core.MediaType; /** * An injectable interface providing runtime lookup of provider instances. * * @see javax.ws.rs.core.Context * @see MessageBodyReader * @see MessageBodyWriter * @see ContextResolver * @see ExceptionMapper */ public interface Providers { /** * Get a message body reader that matches a set of criteria. The set of * readers is first filtered by comparing the supplied value of * {@code mediaType} with the value of each reader's * {@link javax.ws.rs.Consumes}, ensuring the supplied value of * {@code type} is assignable to the generic type of the reader, and * eliminating those that do not match. * The list of matching readers is then ordered with those with the best * matching values of {@link javax.ws.rs.Consumes} (x/y > x/* > */*) * sorted first. Finally, the * {@link MessageBodyReader#isReadable} * method is called on each reader in order using the supplied criteria and * the first reader that returns {@code true} is selected and returned. * * @param type the class of object that is to be read. * @param genericType the type of object to be produced. E.g. if the * message body is to be converted into a method parameter, this will be * the formal type of the method parameter as returned by * Class.getGenericParameterTypes. * @param annotations an array of the annotations on the declaration of the * artifact that will be initialized with the produced instance. E.g. if the * message body is to be converted into a method parameter, this will be * the annotations on that parameter returned by * Class.getParameterAnnotations. * @param mediaType the media type of the data that will be read. * @return a MessageBodyReader that matches the supplied criteria or null * if none is found. */ MessageBodyReader getMessageBodyReader(Class type, Type genericType, Annotation annotations[], MediaType mediaType); /** * Get a message body writer that matches a set of criteria. The set of * writers is first filtered by comparing the supplied value of * {@code mediaType} with the value of each writer's * {@link javax.ws.rs.Produces}, ensuring the supplied value of * {@code type} is assignable to the generic type of the reader, and * eliminating those that do not match. * The list of matching writers is then ordered with those with the best * matching values of {@link javax.ws.rs.Produces} (x/y > x/* > */*) * sorted first. Finally, the * {@link MessageBodyWriter#isWriteable} * method is called on each writer in order using the supplied criteria and * the first writer that returns {@code true} is selected and returned. * * @param type the class of object that is to be written. * @param genericType the type of object to be written. E.g. if the * message body is to be produced from a field, this will be * the declared type of the field as returned by * Field.getGenericType. * @param annotations an array of the annotations on the declaration of the * artifact that will be written. E.g. if the * message body is to be produced from a field, this will be * the annotations on that field returned by * Field.getDeclaredAnnotations. * @param mediaType the media type of the data that will be written. * @return a MessageBodyReader that matches the supplied criteria or null * if none is found. */ MessageBodyWriter getMessageBodyWriter(Class type, Type genericType, Annotation annotations[], MediaType mediaType); /** * Get an exception mapping provider for a particular class of exception. * Returns the provider whose generic type is the nearest superclass of * {@code type}. * @param type the class of exception * @return an {@link ExceptionMapper} for the supplied type or null if none * is found. */ ExceptionMapper getExceptionMapper(Class type); /** * Get a context resolver for a particular type of context and media type. * The set of resolvers is first filtered by comparing the supplied value of * {@code mediaType} with the value of each resolver's * {@link javax.ws.rs.Produces}, ensuring the generic type of the context * resolver is assignable to the supplied value of {@code contextType}, and * eliminating those that do not match. If only one resolver matches the * criteria then it is returned. If more than one resolver matches then the * list of matching resolvers is ordered with those with the best * matching values of {@link javax.ws.rs.Produces} (x/y > x/* > */*) * sorted first. A proxy is returned that delegates calls to * {@link ContextResolver#getContext(java.lang.Class)} to each matching context * resolver in order and returns the first non-null value it obtains or null * if all matching context resolvers return null. * * @param contextType the class of context desired * @param mediaType the media type of data for which a context is required. * @return a matching context resolver instance or null if no matching * context providers are found. */ ContextResolver getContextResolver(Class contextType, MediaType mediaType); } ./src/javax/ws/rs/ext/ExceptionMapper.java0000664000175000017500000000232411767656530017731 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ package javax.ws.rs.ext; import javax.ws.rs.core.Response; /** * Contract for a provider that maps Java exceptions to * {@link javax.ws.rs.core.Response}. An implementation of this interface must * be annotated with {@link Provider}. * * @see Provider * @see javax.ws.rs.core.Response */ public interface ExceptionMapper { /** * Map an exception to a {@link javax.ws.rs.core.Response}. Returning * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT} * response. Throwing a runtime exception results in a * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response * @param exception the exception to map to a response * @return a response mapped from the supplied exception */ Response toResponse(E exception); } ./src/javax/ws/rs/Encoded.java0000664000175000017500000000243011767656530015365 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Encoded.java * * Created on June 29, 2007, 11:40 AM * */ package javax.ws.rs; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Disables automatic decoding of parameter values bound using {@link QueryParam}, * {@link PathParam}, {@link FormParam} or {@link MatrixParam}. * Using this annotation on a method will disable decoding for all parameters. * Using this annotation on a class will disable decoding for all parameters of * all methods. * * @see QueryParam * @see MatrixParam * @see PathParam * @see FormParam */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Encoded { } ./src/javax/ws/rs/FormParam.java0000664000175000017500000000504111767656530015711 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * FormParam.java * * Created on November 16, 2006, 2:04 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value(s) of a form parameter contained within a request entity body * to a resource method parameter. Values are URL decoded unless this is * disabled using the {@link Encoded} annotation. A default value can be * specified using the {@link DefaultValue} annotation. * If the request entity body is absent or is an unsupported media type, the * default value is used. * * The type T of the annotated parameter must either: *
    *
  1. Be a primitive type
  2. *
  3. Have a constructor that accepts a single String argument
  4. *
  5. Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)})
  6. *
  7. Be List<T>, Set<T> or * SortedSet<T>, where T satisfies 2 or 3 above. * The resulting collection is read-only.
  8. *
* *

If the type is not one of those listed in 4 above then the first value * (lexically) of the parameter is used.

* *

Note that, whilst the annotation target permits use on fields and methods, * this annotation is only required to be supported on resource method * parameters.

* * @see DefaultValue * @see Encoded */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface FormParam { /** * Defines the name of the form parameter whose value will be used * to initialize the value of the annotated method argument. The name is * specified in decoded form, any percent encoded literals within the value * will not be decoded and will instead be treated as literal text. E.g. if * the parameter name is "a b" then the value of the annotation is "a b", * not "a+b" or "a%20b". */ String value(); } ./src/javax/ws/rs/OPTIONS.java0000664000175000017500000000155511767656530015166 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * OPTIONS.java * * Created on March 10, 2009 * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP OPTIONS requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.OPTIONS) public @interface OPTIONS { } ./src/javax/ws/rs/HEAD.java0000664000175000017500000000155411767656530014533 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * HEAD.java * * Created on October 24, 2007, 5:12 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP HEAD requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.HEAD) public @interface HEAD { } ./src/javax/ws/rs/POST.java0000664000175000017500000000155411767656530014617 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * POST.java * * Created on October 24, 2007, 5:12 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP POST requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.POST) public @interface POST { } ./src/javax/ws/rs/ApplicationPath.java0000664000175000017500000000334011767656530017105 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * ApplicationPath.java * * Created on August 21, 2009 * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Identifies the application path that serves as the base URI * for all resource URIs provided by {@link javax.ws.rs.Path}. May only be * applied to a subclass of {@link javax.ws.rs.core.Application}. * *

When published in a Servlet container, the value of the application path * may be overridden using a servlet-mapping element in the web.xml.

* * @see javax.ws.rs.core.Application * @see Path * @since 1.1 */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface ApplicationPath { /** * Defines the base URI for all resource URIs. A trailing '/' character will * be automatically appended if one is not present. * *

The supplied value is automatically percent * encoded to conform to the {@code path} production of * {@link RFC 3986 section 3.3}. * Note that percent encoded values are allowed in the value, an * implementation will recognize such values and will not double * encode the '%' character.

*/ String value(); } ./src/javax/ws/rs/GET.java0000664000175000017500000000155011767656530014445 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * GET.java * * Created on October 24, 2007, 5:12 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the annotated method responds to HTTP GET requests * @see HttpMethod */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @HttpMethod(HttpMethod.GET) public @interface GET { } ./src/javax/ws/rs/HttpMethod.java0000664000175000017500000000352211767656530016107 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * HttpMethod.java * * Created on October 25, 2006, 2:02 PM * */ package javax.ws.rs; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Associates the name of a HTTP method with an annotation. A Java method annotated * with a runtime annotation that is itself annotated with this annotation will * be used to handle HTTP requests of the indicated HTTP method. It is an error * for a method to be annotated with more than one annotation that is annotated * with {@code HttpMethod}. * * @see GET * @see POST * @see PUT * @see DELETE * @see HEAD */ @Target({ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface HttpMethod { /** * HTTP GET method */ public static final String GET="GET"; /** * HTTP POST method */ public static final String POST="POST"; /** * HTTP PUT method */ public static final String PUT="PUT"; /** * HTTP DELETE method */ public static final String DELETE="DELETE"; /** * HTTP HEAD method */ public static final String HEAD="HEAD"; /** * HTTP OPTIONS method */ public static final String OPTIONS="OPTIONS"; /** * Specifies the name of a HTTP method. E.g. "GET". */ String value(); } ./src/javax/ws/rs/PathParam.java0000664000175000017500000000652411767656530015711 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * PathParam.java * * Created on November 16, 2006, 2:04 PM * */ package javax.ws.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Binds the value of a URI template parameter or a path segment * containing the template parameter to a resource method parameter, resource * class field, or resource class * bean property. The value is URL decoded unless this * is disabled using the {@link Encoded} annotation. * A default value can be specified using the {@link DefaultValue} * annotation. * * The type of the annotated parameter, field or property must either: *
    *
  • Be {@link javax.ws.rs.core.PathSegment}, the value will be the final * segment of the matching part of the path. * See {@link javax.ws.rs.core.UriInfo} for a means of retrieving all request * path segments.
  • *
  • Be {@code List<}{@link javax.ws.rs.core.PathSegment}{@code >}, the * value will be a list of {@code PathSegment} corresponding to the path * segment(s) that matched the named template parameter. * See {@link javax.ws.rs.core.UriInfo} for a means of retrieving all request * path segments.
  • *
  • Be a primitive type.
  • *
  • Have a constructor that accepts a single String argument.
  • *
  • Have a static method named valueOf or fromString * that accepts a single * String argument (see, for example, {@link Integer#valueOf(String)}). *
* *

The injected value corresponds to the latest use (in terms of scope) of * the path parameter. E.g. if a class and a sub-resource method are both * annotated with a {@link Path} containing the same URI template parameter, use * of {@code PathParam} on a subresource method parameter will bind the value * matching URI template parameter in the method's {@link Path} annotation.

* *

Because injection occurs at object creation time, use of this annotation * on resource class fields and bean properties is only supported for the * default per-request resource class lifecycle. Resource classes using * other lifecycles should only use this annotation on resource method * parameters.

* * @see Encoded * @see DefaultValue * @see javax.ws.rs.core.PathSegment * @see javax.ws.rs.core.UriInfo */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface PathParam { /** * Defines the name of the URI template parameter whose value will be used * to initialize the value of the annotated method parameter, class field or * property. See {@link Path#value()} for a description of the syntax of * template parameters. * *

E.g. a class annotated with: @Path("widgets/{id}") * can have methods annotated whose arguments are annotated * with @PathParam("id"). */ String value(); } ./src/javax/ws/rs/core/0000775000175000017500000000000011767656530014112 5ustar brianbrian./src/javax/ws/rs/core/PathSegment.java0000664000175000017500000000276211767656530017203 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * PathSegment.java * * Created on January 30, 2007, 4:35 PM * */ package javax.ws.rs.core; /** * Represents a URI path segment and any associated matrix parameters. When an * instance of this type is injected with {@link javax.ws.rs.PathParam}, the * value of the annotation identifies which path segment is selected and the * presence of an {@link javax.ws.rs.Encoded} annotation will result in an * instance that supplies the path and matrix parameter values in * URI encoded form. * * @see UriInfo#getPathSegments * @see javax.ws.rs.PathParam */ public interface PathSegment { /** * Get the path segment. *

* @return the path segment */ String getPath(); /** * Get a map of the matrix parameters associated with the path segment. * The map keys are the names of the matrix parameters with any * percent-escaped octets decoded. * * @return the map of matrix parameters * @see Matrix URIs */ MultivaluedMap getMatrixParameters(); } ./src/javax/ws/rs/core/Variant.java0000664000175000017500000001775111767656530016374 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Variant.java * * Created on September 27, 2007, 3:12 PM * */ package javax.ws.rs.core; import java.io.StringWriter; import java.util.List; import java.util.Locale; import javax.ws.rs.ext.RuntimeDelegate; /** * Abstraction for a resource representation variant. */ public class Variant { private Locale language; private MediaType mediaType; private String encoding; /** * Create a new instance of Variant * @param mediaType the media type of the variant - may be null * @param language the language of the variant - may be null * @param encoding the content encoding of the variant - may be null * @throws java.lang.IllegalArgumentException if all three parameters are * null */ public Variant(MediaType mediaType, Locale language, String encoding) { if (mediaType==null && language==null && encoding==null) throw new IllegalArgumentException("mediaType, language, encoding all null"); this.encoding = encoding; this.language = language; this.mediaType = mediaType; } /** * Get the language of the variant * @return the language or null if none set */ public Locale getLanguage() { return language; } /** * Get the media type of the variant * @return the media type or null if none set */ public MediaType getMediaType() { return mediaType; } /** * Get the encoding of the variant * @return the encoding or null if none set */ public String getEncoding() { return encoding; } /** * Create a {@link VariantListBuilder} initialized with a set of supported * media types. * @param mediaTypes the available mediaTypes. If specific charsets * are supported they should be included as parameters of the respective * media type. * @return the initailized builder * @throws java.lang.IllegalArgumentException if mediaTypes is null or * contains no elements. */ public static VariantListBuilder mediaTypes(MediaType... mediaTypes) { VariantListBuilder b = VariantListBuilder.newInstance(); b.mediaTypes(mediaTypes); return b; } /** * Create a {@link VariantListBuilder} initialized with a set of supported * languages. * @param languages the available languages. * @return the initailized builder * @throws java.lang.IllegalArgumentException if languages is null or * contains no elements. */ public static VariantListBuilder languages(Locale... languages) { VariantListBuilder b = VariantListBuilder.newInstance(); b.languages(languages); return b; } /** * Create a {@link VariantListBuilder} initialized with a set of supported * encodings. * @param encodings the available encodings. * @return the initailized builder * @throws java.lang.IllegalArgumentException if encodings is null or * contains no elements. */ public static VariantListBuilder encodings(String... encodings) { VariantListBuilder b = VariantListBuilder.newInstance(); b.encodings(encodings); return b; } /** * Generate hash code from variant properties. * @return the hash code */ @Override public int hashCode() { int hash = 7; hash = 29 * hash + (this.language != null ? this.language.hashCode() : 0); hash = 29 * hash + (this.mediaType != null ? this.mediaType.hashCode() : 0); hash = 29 * hash + (this.encoding != null ? this.encoding.hashCode() : 0); return hash; } /** * Compares obj to this variant to see if they are the same * considering all property values. * @param obj the object to compare to * @return true if the two variants are the same, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Variant other = (Variant) obj; if (this.language != other.language && (this.language == null || !this.language.equals(other.language))) { return false; } if (this.mediaType != other.mediaType && (this.mediaType == null || !this.mediaType.equals(other.mediaType))) { return false; } if (this.encoding != other.encoding && (this.encoding == null || !this.encoding.equals(other.encoding))) { return false; } return true; } @Override public String toString() { StringWriter w = new StringWriter(); w.append("Variant[mediaType="); w.append(mediaType==null ? "null" : mediaType.toString()); w.append(", language="); w.append(language==null ? "null" : language.toString()); w.append(", encoding="); w.append(encoding==null ? "null" : encoding); w.append("]"); return w.toString(); } /** * A builder for a list of representation variants. */ public static abstract class VariantListBuilder { /** * Protected constructor, use the static newInstance * method to obtain an instance. */ protected VariantListBuilder() {} /** * Create a new builder instance. * @return a new Builder */ public static VariantListBuilder newInstance() { VariantListBuilder b = RuntimeDelegate.getInstance().createVariantListBuilder(); return b; } /** * Build a list of representation variants from the current state of * the builder. After this method is called the builder is reset to * an empty state. * @return a list of representation variants */ public abstract List build(); /** * Add the current combination of metadata to the list of supported variants, * after this method is called the current combination of metadata is emptied. * If more than one value is supplied for one or more of the variant properties * then a variant will be generated for each possible combination. E.g. * in the following list would have four members: *

List list = VariantListBuilder.newInstance().languages("en","fr")
         *   .encodings("zip", "identity").add().build()
* * @return the updated builder * @throws java.lang.IllegalStateException if there is not at least one * mediaType, language or encoding set for the current variant. */ public abstract VariantListBuilder add(); /** * Set the language[s] for this variant. * @param languages the available languages * @return the updated builder */ public abstract VariantListBuilder languages(Locale... languages); /** * Set the encoding[s] for this variant. * @param encodings the available encodings * @return the updated builder */ public abstract VariantListBuilder encodings(String... encodings); /** * Set the media type[s] for this variant. * @param mediaTypes the available mediaTypes. If specific charsets * are supported they should be included as parameters of the respective * media type. * @return the updated builder */ public abstract VariantListBuilder mediaTypes(MediaType... mediaTypes); } } ./src/javax/ws/rs/core/package-info.java0000664000175000017500000000016611767656530017304 0ustar brianbrian/** * Low-level interfaces and annotations used to create RESTful service * resources. */ package javax.ws.rs.core;./src/javax/ws/rs/core/CacheControl.java0000664000175000017500000003311711767656530017326 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * CacheControl.java * * Created on March 5, 2007, 3:36 PM */ package javax.ws.rs.core; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.ws.rs.ext.RuntimeDelegate; import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate; /** * An abstraction for the value of a HTTP Cache-Control response header. * @see HTTP/1.1 section 14.9 */ public class CacheControl { private boolean _private; private List privateFields; private boolean noCache; private List noCacheFields; private boolean noStore; private boolean noTransform; private boolean mustRevalidate; private boolean proxyRevalidate; private int maxAge = -1; private int sMaxAge = -1; private Map cacheExtension; private static final HeaderDelegate delegate = RuntimeDelegate.getInstance().createHeaderDelegate(CacheControl.class); /** * Create a new instance of CacheControl. The new instance will have the * following default settings: * *
    *
  • private = false
  • *
  • noCache = false
  • *
  • noStore = false
  • *
  • noTransform = true
  • *
  • mustRevalidate = false
  • *
  • proxyRevalidate = false
  • *
  • An empty list of private fields
  • *
  • An empty list of no-cache fields
  • *
  • An empty map of cache extensions
  • *
*/ public CacheControl() { _private = false; noCache = false; noStore = false; noTransform = true; mustRevalidate = false; proxyRevalidate = false; } /** * Creates a new instance of CacheControl by parsing the supplied string. * @param value the cache control string * @return the newly created CacheControl * @throws IllegalArgumentException if the supplied string cannot be parsed * or is null */ public static CacheControl valueOf(String value) throws IllegalArgumentException { return delegate.fromString(value); } /** * Corresponds to the must-revalidate cache control directive. * @return true if the must-revalidate cache control directive will be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.4 */ public boolean isMustRevalidate() { return mustRevalidate; } /** * Corresponds to the must-revalidate cache control directive. * @param mustRevalidate true if the must-revalidate cache control directive should be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.4 */ public void setMustRevalidate(boolean mustRevalidate) { this.mustRevalidate = mustRevalidate; } /** * Corresponds to the proxy-revalidate cache control directive. * @return true if the proxy-revalidate cache control directive will be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.4 */ public boolean isProxyRevalidate() { return proxyRevalidate; } /** * Corresponds to the must-revalidate cache control directive. * @param proxyRevalidate true if the proxy-revalidate cache control directive should be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.4 */ public void setProxyRevalidate(boolean proxyRevalidate) { this.proxyRevalidate = proxyRevalidate; } /** * Corresponds to the max-age cache control directive. * @return the value of the max-age cache control directive, -1 if the directive is disabled. * @see HTTP/1.1 section 14.9.3 */ public int getMaxAge() { return maxAge; } /** * Corresponds to the max-age cache control directive. * @param maxAge the value of the max-age cache control directive, a value of -1 will disable the directive. * @see HTTP/1.1 section 14.9.3 */ public void setMaxAge(int maxAge) { this.maxAge = maxAge; } /** * Corresponds to the s-maxage cache control directive. * @return the value of the s-maxage cache control directive, -1 if the directive is disabled. * @see HTTP/1.1 section 14.9.3 */ public int getSMaxAge() { return sMaxAge; } /** * Corresponds to the s-maxage cache control directive. * @param sMaxAge the value of the s-maxage cache control directive, a value of -1 will disable the directive. * @see HTTP/1.1 section 14.9.3 */ public void setSMaxAge(int sMaxAge) { this.sMaxAge = sMaxAge; } /** * Corresponds to the value of the no-cache cache control directive. * @return a mutable list of field-names that will form the value of the no-cache cache control directive. * An empty list results in a bare no-cache directive. * @see #isNoCache * @see #setNoCache * @see HTTP/1.1 section 14.9.1 */ public List getNoCacheFields() { if (noCacheFields == null) noCacheFields = new ArrayList(); return noCacheFields; } /** * Corresponds to the no-cache cache control directive. * @param noCache true if the no-cache cache control directive should be included in the * response, false otherwise. * @see #getNoCacheFields * @see HTTP/1.1 section 14.9.1 */ public void setNoCache(boolean noCache) { this.noCache = noCache; } /** * Corresponds to the no-cache cache control directive. * @return true if the no-cache cache control directive will be included in the * response, false otherwise. * @see #getNoCacheFields * @see HTTP/1.1 section 14.9.1 */ public boolean isNoCache() { return noCache; } /** * Corresponds to the private cache control directive. * @return true if the private cache control directive will be included in the * response, false otherwise. * @see #getPrivateFields * @see HTTP/1.1 section 14.9.1 */ public boolean isPrivate() { return _private; } /** * Corresponds to the value of the private cache control directive. * @return a mutable list of field-names that will form the value of the private cache control directive. * An empty list results in a bare no-cache directive. * @see #isPrivate * @see #setPrivate * @see HTTP/1.1 section 14.9.1 */ public List getPrivateFields() { if (privateFields == null) privateFields = new ArrayList(); return privateFields; } /** * Corresponds to the private cache control directive. * @param _private true if the private cache control directive should be included in the * response, false otherwise. * @see #getPrivateFields * @see HTTP/1.1 section 14.9.1 */ public void setPrivate(boolean _private) { this._private = _private; } /** * Corresponds to the no-transform cache control directive. * @return true if the no-transform cache control directive will be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.5 */ public boolean isNoTransform() { return noTransform; } /** * Corresponds to the no-transform cache control directive. * @param noTransform true if the no-transform cache control directive should be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.5 */ public void setNoTransform(boolean noTransform) { this.noTransform = noTransform; } /** * Corresponds to the no-store cache control directive. * @return true if the no-store cache control directive will be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.2 */ public boolean isNoStore() { return noStore; } /** * Corresponds to the no-store cache control directive. * @param noStore true if the no-store cache control directive should be included in the * response, false otherwise. * @see HTTP/1.1 section 14.9.2 */ public void setNoStore(boolean noStore) { this.noStore = noStore; } /** * Corresponds to a set of extension cache control directives. * @return a mutable map of cache control extension names and their values. * If a key has a null value, it will appear as a bare directive. If a key has * a value that contains no whitespace then the directive will appear as * a simple name=value pair. If a key has a value that contains whitespace * then the directive will appear as a quoted name="value" pair. * @see HTTP/1.1 section 14.9.6 */ public Map getCacheExtension() { if (cacheExtension == null) cacheExtension = new HashMap(); return cacheExtension; } /** * Convert the cache control to a string suitable for use as the value of the * corresponding HTTP header. * @return a stringified cache control */ @Override public String toString() { return delegate.toString(this); } /** * Generate hash code from cache control properties. * @return the hashCode */ @Override public int hashCode() { int hash = 7; hash = 41 * hash + (this._private ? 1 : 0); hash = 41 * hash + (this.privateFields != null ? this.privateFields.hashCode() : 0); hash = 41 * hash + (this.noCache ? 1 : 0); hash = 41 * hash + (this.noCacheFields != null ? this.noCacheFields.hashCode() : 0); hash = 41 * hash + (this.noStore ? 1 : 0); hash = 41 * hash + (this.noTransform ? 1 : 0); hash = 41 * hash + (this.mustRevalidate ? 1 : 0); hash = 41 * hash + (this.proxyRevalidate ? 1 : 0); hash = 41 * hash + this.maxAge; hash = 41 * hash + this.sMaxAge; hash = 41 * hash + (this.cacheExtension != null ? this.cacheExtension.hashCode() : 0); return hash; } /** * Compares obj to this cache control to see if they are the same * considering all property values. * @param obj the object to compare to * @return true if the two cache controls are the same, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CacheControl other = (CacheControl) obj; if (this._private != other._private) { return false; } if (this.privateFields != other.privateFields && (this.privateFields == null || !this.privateFields.equals(other.privateFields))) { return false; } if (this.noCache != other.noCache) { return false; } if (this.noCacheFields != other.noCacheFields && (this.noCacheFields == null || !this.noCacheFields.equals(other.noCacheFields))) { return false; } if (this.noStore != other.noStore) { return false; } if (this.noTransform != other.noTransform) { return false; } if (this.mustRevalidate != other.mustRevalidate) { return false; } if (this.proxyRevalidate != other.proxyRevalidate) { return false; } if (this.maxAge != other.maxAge) { return false; } if (this.sMaxAge != other.sMaxAge) { return false; } if (this.cacheExtension != other.cacheExtension && (this.cacheExtension == null || !this.cacheExtension.equals(other.cacheExtension))) { return false; } return true; } } ./src/javax/ws/rs/core/Context.java0000664000175000017500000000211411767656530016377 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Context.java * * Created on November 16, 2006, 3:37 PM * */ package javax.ws.rs.core; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * This annotation is used to inject information into a class * field, bean property or method parameter. * @see Application * @see UriInfo * @see Request * @see HttpHeaders * @see SecurityContext * @see javax.ws.rs.ext.Providers */ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Context { } ./src/javax/ws/rs/core/UriInfo.java0000664000175000017500000002557611767656530016347 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * UriInfo.java * * Created on April 13, 2007, 2:55 PM * */ package javax.ws.rs.core; import java.net.URI; import java.util.List; /** * An injectable interface that provides access to application and request * URI information. Relative URIs are relative to the base URI of the * application, see {@link #getBaseUri}. * *

All methods throw java.lang.IllegalStateException * if called outside the scope of a request (e.g. from a provider constructor).

* * @see Context */ public interface UriInfo { /** * Get the path of the current request relative to the base URI as * a string. All sequences of escaped octets are decoded, equivalent to * getPath(true). * * @return the relative URI path * @throws java.lang.IllegalStateException if called outside the scope of a request */ public String getPath(); /** * Get the path of the current request relative to the base URI as * a string. * * @param decode controls whether sequences of escaped octets are decoded * (true) or not (false). * @return the relative URI path * @throws java.lang.IllegalStateException if called outside the scope of a request */ public String getPath(boolean decode); /** * Get the path of the current request relative to the base URI as a * list of {@link PathSegment}. This method is useful when the * path needs to be parsed, particularly when matrix parameters may be * present in the path. All sequences of escaped octets in path segments * and matrix parameter values are decoded, * equivalent to getPathSegments(true). * @return an unmodifiable list of {@link PathSegment}. The matrix parameter * map of each path segment is also unmodifiable. * @throws java.lang.IllegalStateException if called outside the scope of a request * @see PathSegment * @see Matrix URIs */ public List getPathSegments(); /** * Get the path of the current request relative to the base URI as a * list of {@link PathSegment}. This method is useful when the * path needs to be parsed, particularly when matrix parameters may be * present in the path. * @param decode controls whether sequences of escaped octets in path segments * and matrix parameter values are decoded (true) or not (false). * @return an unmodifiable list of {@link PathSegment}. The matrix parameter * map of each path segment is also unmodifiable. * @throws java.lang.IllegalStateException if called outside the scope of a request * @see PathSegment * @see Matrix URIs */ public List getPathSegments(boolean decode); /** * Get the absolute request URI including any query parameters. * @return the absolute request URI * @throws java.lang.IllegalStateException if called outside the scope of a request */ public URI getRequestUri(); /** * Get the absolute request URI in the form of a UriBuilder. * @return a UriBuilder initialized with the absolute request URI * @throws java.lang.IllegalStateException if called outside the scope of a request */ public UriBuilder getRequestUriBuilder(); /** * Get the absolute path of the request. This includes everything preceding * the path (host, port etc) but excludes query parameters. * This is a shortcut for * uriInfo.getBase().resolve(uriInfo.getPath()). * @return the absolute path of the request * @throws java.lang.IllegalStateException if called outside the scope of a request */ public URI getAbsolutePath(); /** * Get the absolute path of the request in the form of a UriBuilder. * This includes everything preceding the path (host, port etc) but excludes * query parameters. * @return a UriBuilder initialized with the absolute path of the request * @throws java.lang.IllegalStateException if called outside the scope of a request */ public UriBuilder getAbsolutePathBuilder(); /** * Get the base URI of the application. URIs of root resource classes * are all relative to this base URI. * @return the base URI of the application */ public URI getBaseUri(); /** * Get the base URI of the application in the form of a UriBuilder. * @return a UriBuilder initialized with the base URI of the application. */ public UriBuilder getBaseUriBuilder(); /** * Get the values of any embedded URI template parameters. * All sequences of escaped octets are decoded, * equivalent to getPathParameters(true). * @return an unmodifiable map of parameter names and values * @throws java.lang.IllegalStateException if called outside the scope of a request * @see javax.ws.rs.Path * @see javax.ws.rs.PathParam */ public MultivaluedMap getPathParameters(); /** * Get the values of any embedded URI template parameters. * * @param decode controls whether sequences of escaped octets are decoded * (true) or not (false). * @return an unmodifiable map of parameter names and values * @throws java.lang.IllegalStateException if called outside the scope of a request * @see javax.ws.rs.Path * @see javax.ws.rs.PathParam */ public MultivaluedMap getPathParameters(boolean decode); /** * Get the URI query parameters of the current request. * The map keys are the names of the query parameters with any * escaped characters decoded. * All sequences of escaped octets in parameter values are decoded, * equivalent to getQueryParameters(true). * @return an unmodifiable map of query parameter names and values * @throws java.lang.IllegalStateException if called outside the scope of a request */ public MultivaluedMap getQueryParameters(); /** * Get the URI query parameters of the current request. * The map keys are the names of the query parameters with any * escaped characters decoded. * @param decode controls whether sequences of escaped octets in parameter * values are decoded (true) or not (false). * @return an unmodifiable map of query parameter names and values * @throws java.lang.IllegalStateException if called outside the scope of a request */ public MultivaluedMap getQueryParameters(boolean decode); /** * Get a read-only list of URIs for matched resources. Each entry is a * relative URI that matched a resource class, a * sub-resource method or a sub-resource locator. All sequences of escaped * octets are decoded, equivalent to {@code getMatchedURIs(true)}. * Entries do not include query parameters but do include matrix parameters * if present in the request URI. Entries are ordered in reverse request * URI matching order, with the current resource URI first. E.g. given the * following resource classes: * *
@Path("foo")
     *public class FooResource {
     *  @GET
     *  public String getFoo() {...}
     * 
     *  @Path("bar")
     *  public BarResource getBarResource() {...}
     *}
     * 
     *public class BarResource {
     *  @GET
     *  public String getBar() {...}
     *}
     * 
* *

The values returned by this method based on request uri and where * the method is called from are:

* * * * * * * * * * * * * * * * * * * * * * *
RequestCalled fromValue(s)
GET /fooFooResource.getFoofoo
GET /foo/barFooResource.getBarResourcefoo/bar, foo
GET /foo/barBarResource.getBarfoo/bar, foo
* * * @return a read-only list of URI paths for matched resources. */ public List getMatchedURIs(); /** * Get a read-only list of URIs for matched resources. Each entry is a * relative URI that matched a resource class, a sub-resource * method or a sub-resource locator. Entries do not include query * parameters but do include matrix parameters if present in the request URI. * Entries are ordered in reverse request URI matching order, with the * current resource URI first. See {@link #getMatchedURIs()} for an * example. * * @param decode controls whether sequences of escaped octets are decoded * (true) or not (false). * @return a read-only list of URI paths for matched resources. */ public List getMatchedURIs(boolean decode); /** * Get a read-only list of the currently matched resource class instances. * Each entry is a resource class instance that matched the request URI * either directly or via a sub-resource method or a sub-resource locator. * Entries are ordered according to reverse request URI matching order, * with the current resource first. E.g. given the following resource * classes: * *
@Path("foo")
     *public class FooResource {
     *  @GET
     *  public String getFoo() {...}
     * 
     *  @Path("bar")
     *  public BarResource getBarResource() {...}
     *}
     * 
     *public class BarResource {
     *  @GET
     *  public String getBar() {...}
     *}
     * 
* *

The values returned by this method based on request uri and where * the method is called from are:

* * * * * * * * * * * * * * * * * * * * * * *
RequestCalled fromValue(s)
GET /fooFooResource.getFooFooResource
GET /foo/barFooResource.getBarResourceFooResource
GET /foo/barBarResource.getBarBarResource, FooResource
* * @return a read-only list of matched resource class instances. */ public List getMatchedResources(); } ./src/javax/ws/rs/core/MediaType.java0000664000175000017500000002304511767656530016642 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * MediaType.java * * Created on March 22, 2007, 2:35 PM * */ package javax.ws.rs.core; import java.util.Collections; import java.util.Comparator; import java.util.Map; import java.util.TreeMap; import javax.ws.rs.ext.RuntimeDelegate; import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate; /** * An abstraction for a media type. Instances are immutable. * @see HTTP/1.1 section 3.7 */ public class MediaType { private String type; private String subtype; private Map parameters; /** * Empty immutable map used for all instances without parameters */ private static final Map emptyMap = Collections.emptyMap(); private static final HeaderDelegate delegate = RuntimeDelegate.getInstance().createHeaderDelegate(MediaType.class); /** The value of a type or subtype wildcard: "*" */ public static final String MEDIA_TYPE_WILDCARD = "*"; // Common media type constants /** "*/*" */ public final static String WILDCARD = "*/*"; /** "*/*" */ public final static MediaType WILDCARD_TYPE = new MediaType(); /** "application/xml" */ public final static String APPLICATION_XML = "application/xml"; /** "application/xml" */ public final static MediaType APPLICATION_XML_TYPE = new MediaType("application","xml"); /** "application/atom+xml" */ public final static String APPLICATION_ATOM_XML = "application/atom+xml"; /** "application/atom+xml" */ public final static MediaType APPLICATION_ATOM_XML_TYPE = new MediaType("application","atom+xml"); /** "application/xhtml+xml" */ public final static String APPLICATION_XHTML_XML = "application/xhtml+xml"; /** "application/xhtml+xml" */ public final static MediaType APPLICATION_XHTML_XML_TYPE = new MediaType("application","xhtml+xml"); /** "application/svg+xml" */ public final static String APPLICATION_SVG_XML = "application/svg+xml"; /** "application/svg+xml" */ public final static MediaType APPLICATION_SVG_XML_TYPE = new MediaType("application","svg+xml"); /** "application/json" */ public final static String APPLICATION_JSON = "application/json"; /** "application/json" */ public final static MediaType APPLICATION_JSON_TYPE = new MediaType("application","json"); /** "application/x-www-form-urlencoded" */ public final static String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded"; /** "application/x-www-form-urlencoded" */ public final static MediaType APPLICATION_FORM_URLENCODED_TYPE = new MediaType("application","x-www-form-urlencoded"); /** "multipart/form-data" */ public final static String MULTIPART_FORM_DATA = "multipart/form-data"; /** "multipart/form-data" */ public final static MediaType MULTIPART_FORM_DATA_TYPE = new MediaType("multipart","form-data"); /** "application/octet-stream" */ public final static String APPLICATION_OCTET_STREAM = "application/octet-stream"; /** "application/octet-stream" */ public final static MediaType APPLICATION_OCTET_STREAM_TYPE = new MediaType("application","octet-stream"); /** "text/plain" */ public final static String TEXT_PLAIN = "text/plain"; /** "text/plain" */ public final static MediaType TEXT_PLAIN_TYPE = new MediaType("text","plain"); /** "text/xml" */ public final static String TEXT_XML = "text/xml"; /** "text/xml" */ public final static MediaType TEXT_XML_TYPE = new MediaType("text","xml"); /** "text/html" */ public final static String TEXT_HTML = "text/html"; /** "text/html" */ public final static MediaType TEXT_HTML_TYPE = new MediaType("text","html"); /** * Creates a new instance of MediaType by parsing the supplied string. * @param type the media type string * @return the newly created MediaType * @throws IllegalArgumentException if the supplied string cannot be parsed * or is null */ public static MediaType valueOf(String type) throws IllegalArgumentException { return delegate.fromString(type); } /** * Creates a new instance of MediaType with the supplied type, subtype and * parameters. * @param type the primary type, null is equivalent to * {@link #MEDIA_TYPE_WILDCARD}. * @param subtype the subtype, null is equivalent to * {@link #MEDIA_TYPE_WILDCARD}. * @param parameters a map of media type parameters, null is the same as an * empty map. */ public MediaType(String type, String subtype, Map parameters) { this.type = type==null ? MEDIA_TYPE_WILDCARD : type; this.subtype = subtype==null ? MEDIA_TYPE_WILDCARD : subtype; if (parameters==null) { this.parameters = emptyMap; } else { Map map = new TreeMap(new Comparator() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); for (Map.Entry e: parameters.entrySet()) { map.put(e.getKey().toLowerCase(), e.getValue()); } this.parameters = Collections.unmodifiableMap(map); } } /** * Creates a new instance of MediaType with the supplied type and subtype. * @param type the primary type, null is equivalent to * {@link #MEDIA_TYPE_WILDCARD} * @param subtype the subtype, null is equivalent to * {@link #MEDIA_TYPE_WILDCARD} */ public MediaType(String type, String subtype) { this(type,subtype,emptyMap); } /** * Creates a new instance of MediaType, both type and subtype are wildcards. * Consider using the constant {@link #WILDCARD_TYPE} instead. */ public MediaType() { this(MEDIA_TYPE_WILDCARD, MEDIA_TYPE_WILDCARD); } /** * Getter for primary type. * @return value of primary type. */ public String getType() { return this.type; } /** * Checks if the primary type is a wildcard. * @return true if the primary type is a wildcard */ public boolean isWildcardType() { return this.getType().equals(MEDIA_TYPE_WILDCARD); } /** * Getter for subtype. * @return value of subtype. */ public String getSubtype() { return this.subtype; } /** * Checks if the subtype is a wildcard * @return true if the subtype is a wildcard */ public boolean isWildcardSubtype() { return this.getSubtype().equals(MEDIA_TYPE_WILDCARD); } /** * Getter for a read-only parameter map. Keys are case-insensitive. * @return an immutable map of parameters. */ public Map getParameters() { return parameters; } /** * Check if this media type is compatible with another media type. E.g. * image/* is compatible with image/jpeg, image/png, etc. Media type * parameters are ignored. The function is commutative. * @return true if the types are compatible, false otherwise. * @param other the media type to compare with */ public boolean isCompatible(MediaType other) { if (other == null) return false; if (type.equals(MEDIA_TYPE_WILDCARD) || other.type.equals(MEDIA_TYPE_WILDCARD)) return true; else if (type.equalsIgnoreCase(other.type) && (subtype.equals(MEDIA_TYPE_WILDCARD) || other.subtype.equals(MEDIA_TYPE_WILDCARD))) return true; else return this.type.equalsIgnoreCase(other.type) && this.subtype.equalsIgnoreCase(other.subtype); } /** * Compares obj to this media type to see if they are the same by comparing * type, subtype and parameters. Note that the case-sensitivity of parameter * values is dependent on the semantics of the parameter name, see * {@link HTTP/1.1}. * This method assumes that values are case-sensitive. * @param obj the object to compare to * @return true if the two media types are the same, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof MediaType)) return false; MediaType other = (MediaType)obj; return (this.type.equalsIgnoreCase(other.type) && this.subtype.equalsIgnoreCase(other.subtype) && this.parameters.equals(other.parameters)); } /** * Generate a hashcode from the type, subtype and parameters. * @return a hashcode */ @Override public int hashCode() { return (this.type.toLowerCase()+this.subtype.toLowerCase()).hashCode()+this.parameters.hashCode(); } /** * Convert the media type to a string suitable for use as the value of a * corresponding HTTP header. * @return a stringified media type */ @Override public String toString() { return delegate.toString(this); } } ./src/javax/ws/rs/core/Response.java0000664000175000017500000006671611767656530016573 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Response.java * * Created on April 18, 2007, 9:00 AM * */ package javax.ws.rs.core; import java.net.URI; import java.util.Date; import java.util.List; import java.util.Locale; import javax.ws.rs.ext.RuntimeDelegate; /** * Defines the contract between a returned instance and the runtime when * an application needs to provide metadata to the runtime. An application * class can extend this class directly or can use one of the static * methods to create an instance using a ResponseBuilder. * * Several methods have parameters of type URI, {@link UriBuilder} provides * convenient methods to create such values as does * {@link URI.create()}. * * @see Response.ResponseBuilder */ public abstract class Response { /** * Protected constructor, use one of the static methods to obtain a * {@link ResponseBuilder} instance and obtain a Response from that. */ protected Response() {} /** * Return the response entity. The response will be serialized using a * MessageBodyWriter for either the class of the entity or, in the case of * {@link GenericEntity}, the value of {@link GenericEntity#getRawType()}. * @return an object instance or null if there is no entity * @see javax.ws.rs.ext.MessageBodyWriter */ public abstract Object getEntity(); /** * Get the status code associated with the response. * @return the response status code or -1 if the status was not set. */ public abstract int getStatus(); /** * Get metadata associated with the response as a map. The returned map * may be subsequently modified by the JAX-RS runtime. Values will be * serialized using a {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} * if one is available via * {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the class of the value or using the values {@code toString} method if a * header delegate is not available. * @return response metadata as a map */ public abstract MultivaluedMap getMetadata(); /** * Create a new ResponseBuilder by performing a shallow copy of an * existing Response. The returned builder has its own metadata map but * entries are simply references to the keys and values contained in the * supplied Response metadata map. * @param response a Response from which the status code, entity and metadata * will be copied * @return a new ReponseBuilder */ public static ResponseBuilder fromResponse(Response response) { ResponseBuilder b = status(response.getStatus()); b.entity(response.getEntity()); for (String headerName: response.getMetadata().keySet()) { List headerValues = response.getMetadata().get(headerName); for (Object headerValue: headerValues) { b.header(headerName, headerValue); } } return b; } /** * Create a new ResponseBuilder with the supplied status. * @param status the response status * @return a new ResponseBuilder * @throws IllegalArgumentException if status is null */ public static ResponseBuilder status(StatusType status) { ResponseBuilder b = ResponseBuilder.newInstance(); b.status(status); return b; } /** * Create a new ResponseBuilder with the supplied status. * @param status the response status * @return a new ResponseBuilder * @throws IllegalArgumentException if status is null */ public static ResponseBuilder status(Status status) { return status((StatusType)status); } /** * Create a new ResponseBuilder with the supplied status. * @param status the response status * @return a new ResponseBuilder * @throws IllegalArgumentException if status is less than 100 or greater * than 599. */ public static ResponseBuilder status(int status) { ResponseBuilder b = ResponseBuilder.newInstance(); b.status(status); return b; } /** * Create a new ResponseBuilder with an OK status. * * @return a new ResponseBuilder */ public static ResponseBuilder ok() { ResponseBuilder b = status(Status.OK); return b; } /** * Create a new ResponseBuilder that contains a representation. It is the * callers responsibility to wrap the actual entity with * {@link GenericEntity} if preservation of its generic type is required. * * @param entity the representation entity data * @return a new ResponseBuilder */ public static ResponseBuilder ok(Object entity) { ResponseBuilder b = ok(); b.entity(entity); return b; } /** * Create a new ResponseBuilder that contains a representation. It is the * callers responsibility to wrap the actual entity with * {@link GenericEntity} if preservation of its generic type is required. * * @param entity the representation entity data * @param type the media type of the entity * @return a new ResponseBuilder */ public static ResponseBuilder ok(Object entity, MediaType type) { ResponseBuilder b = ok(); b.entity(entity); b.type(type); return b; } /** * Create a new ResponseBuilder that contains a representation. It is the * callers responsibility to wrap the actual entity with * {@link GenericEntity} if preservation of its generic type is required. * * @param entity the representation entity data * @param type the media type of the entity * @return a new ResponseBuilder */ public static ResponseBuilder ok(Object entity, String type) { ResponseBuilder b = ok(); b.entity(entity); b.type(type); return b; } /** * Create a new ResponseBuilder that contains a representation. It is the * callers responsibility to wrap the actual entity with * {@link GenericEntity} if preservation of its generic type is required. * * @param entity the representation entity data * @param variant representation metadata * @return a new ResponseBuilder */ public static ResponseBuilder ok(Object entity, Variant variant) { ResponseBuilder b = ok(); b.entity(entity); b.variant(variant); return b; } /** * Create a new ResponseBuilder with an server error status. * * @return a new ResponseBuilder */ public static ResponseBuilder serverError() { ResponseBuilder b = status(Status.INTERNAL_SERVER_ERROR); return b; } /** * Create a new ResponseBuilder for a created resource, set the location * header using the supplied value. * * @param location the URI of the new resource. If a relative URI is * supplied it will be converted into an absolute URI by resolving it * relative to the request URI (see {@link UriInfo#getRequestUri}). * @return a new ResponseBuilder * @throws java.lang.IllegalArgumentException if location is null */ public static ResponseBuilder created(URI location) { ResponseBuilder b = status(Status.CREATED).location(location); return b; } /** * Create a new ResponseBuilder for an empty response. * * @return a new ResponseBuilder */ public static ResponseBuilder noContent() { ResponseBuilder b = status(Status.NO_CONTENT); return b; } /** * Create a new ResponseBuilder with a not-modified status. * * @return a new ResponseBuilder */ public static ResponseBuilder notModified() { ResponseBuilder b = status(Status.NOT_MODIFIED); return b; } /** * Create a new ResponseBuilder with a not-modified status. * * @param tag a tag for the unmodified entity * @return a new ResponseBuilder * @throws java.lang.IllegalArgumentException if tag is null */ public static ResponseBuilder notModified(EntityTag tag) { ResponseBuilder b = notModified(); b.tag(tag); return b; } /** * Create a new ResponseBuilder with a not-modified status * and a strong entity tag. This is a shortcut * for notModified(new EntityTag(value)). * * @param tag the string content of a strong entity tag. The JAX-RS * runtime will quote the supplied value when creating the header. * @return a new ResponseBuilder * @throws java.lang.IllegalArgumentException if tag is null */ public static ResponseBuilder notModified(String tag) { ResponseBuilder b = notModified(); b.tag(tag); return b; } /** * Create a new ResponseBuilder for a redirection. Used in the * redirect-after-POST (aka POST/redirect/GET) pattern. * * @param location the redirection URI. If a relative URI is * supplied it will be converted into an absolute URI by resolving it * relative to the base URI of the application (see * {@link UriInfo#getBaseUri}). * @return a new ResponseBuilder * @throws java.lang.IllegalArgumentException if location is null */ public static ResponseBuilder seeOther(URI location) { ResponseBuilder b = status(Status.SEE_OTHER).location(location); return b; } /** * Create a new ResponseBuilder for a temporary redirection. * * @param location the redirection URI. If a relative URI is * supplied it will be converted into an absolute URI by resolving it * relative to the base URI of the application (see * {@link UriInfo#getBaseUri}). * @return a new ResponseBuilder * @throws java.lang.IllegalArgumentException if location is null */ public static ResponseBuilder temporaryRedirect(URI location) { ResponseBuilder b = status(Status.TEMPORARY_REDIRECT).location(location); return b; } /** * Create a new ResponseBuilder for a not acceptable response. * * @param variants list of variants that were available, a null value is * equivalent to an empty list. * @return a new ResponseBuilder */ public static ResponseBuilder notAcceptable(List variants) { ResponseBuilder b = status(Status.NOT_ACCEPTABLE).variants(variants); return b; } /** * A class used to build Response instances that contain metadata instead * of or in addition to an entity. An initial instance may be obtained via * static methods of the Response class, instance methods provide the * ability to set metadata. E.g. to create a response that indicates the * creation of a new resource: *
@POST
     * Response addWidget(...) {
     *   Widget w = ...
     *   URI widgetId = UriBuilder.fromResource(Widget.class)...
     *   return Response.created(widgetId).build();
     * }
* *

Several methods have parameters of type URI, {@link UriBuilder} provides * convenient methods to create such values as does URI.create().

* *

Where multiple variants of the same method are provided, the type of * the supplied parameter is retained in the metadata of the built * {@code Response}.

* */ public static abstract class ResponseBuilder { /** * Protected constructor, use one of the static methods of * Response to obtain an instance. */ protected ResponseBuilder() {} /** * Create a new builder instance. * * @return a new ResponseBuilder */ protected static ResponseBuilder newInstance() { ResponseBuilder b = RuntimeDelegate.getInstance().createResponseBuilder(); return b; } /** * Create a Response instance from the current ResponseBuilder. The builder * is reset to a blank state equivalent to calling the ok method. * * @return a Response instance */ public abstract Response build(); /** * Create a copy of the ResponseBuilder preserving its state. * @return a copy of the ResponseBuilder */ @Override public abstract ResponseBuilder clone(); /** * Set the status on the ResponseBuilder. * * @param status the response status * @return the updated ResponseBuilder * @throws IllegalArgumentException if status is less than 100 or greater * than 599. */ public abstract ResponseBuilder status(int status); /** * Set the status on the ResponseBuilder. * * @param status the response status * @return the updated ResponseBuilder * @throws IllegalArgumentException if status is null */ public ResponseBuilder status(StatusType status) { if (status == null) throw new IllegalArgumentException(); return status(status.getStatusCode()); }; /** * Set the status on the ResponseBuilder. * * @param status the response status * @return the updated ResponseBuilder * @throws IllegalArgumentException if status is null */ public ResponseBuilder status(Status status) { return status((StatusType)status); }; /** * Set the entity on the ResponseBuilder. It is the * callers responsibility to wrap the actual entity with * {@link GenericEntity} if preservation of its generic type is required. * * @param entity the response entity * @return the updated ResponseBuilder */ public abstract ResponseBuilder entity(Object entity); /** * Set the response media type on the ResponseBuilder. * * @param type the media type of the response entity, if null any * existing value for type will be removed * @return the updated ResponseBuilder */ public abstract ResponseBuilder type(MediaType type); /** * Set the response media type on the ResponseBuilder. * * @param type the media type of the response entity, if null any * existing value for type will be removed * @return the updated ResponseBuilder * @throws IllegalArgumentException if type cannot be parsed */ public abstract ResponseBuilder type(String type); /** * Set representation metadata on the ResponseBuilder. Equivalent to * setting the values of content type, content language, and content * encoding separately using the values of the variant properties. * * @param variant metadata of the response entity, a null value is * equivalent to a variant with all null properties. * @return the updated ResponseBuilder */ public abstract ResponseBuilder variant(Variant variant); /** * Add a Vary header that lists the available variants. * * @param variants a list of available representation variants, a null * value will remove an existing value for vary. * @return the updated ResponseBuilder */ public abstract ResponseBuilder variants(List variants); /** * Set the language on the ResponseBuilder. * * @param language the language of the response entity, if null any * existing value for language will be removed * @return the updated ResponseBuilder */ public abstract ResponseBuilder language(String language); /** * Set the language on the ResponseBuilder. * * * @param language the language of the response entity, if null any * existing value for type will be removed * @return the updated ResponseBuilder */ public abstract ResponseBuilder language(Locale language); /** * Set the location on the ResponseBuilder. * * @param location the location. If a relative URI is * supplied it will be converted into an absolute URI by resolving it * relative to the base URI of the application (see * {@link UriInfo#getBaseUri}). If null any * existing value for location will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder location(URI location); /** * Set the content location on the ResponseBuilder. * * @param location the content location. Relative or absolute URIs * may be used for the value of content location. If null any * existing value for content location will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder contentLocation(URI location); /** * Set an entity tag on the ResponseBuilder. * * @param tag the entity tag, if null any * existing entity tag value will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder tag(EntityTag tag); /** * Set a strong entity tag on the ResponseBuilder. This is a shortcut * for tag(new EntityTag(value)). * * @param tag the string content of a strong entity tag. The JAX-RS * runtime will quote the supplied value when creating the header. If * null any existing entity tag value will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder tag(String tag); /** * Set the last modified date on the ResponseBuilder. * * @param lastModified the last modified date, if null any existing * last modified value will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder lastModified(Date lastModified); /** * Set the cache control data on the ResponseBuilder. * * @param cacheControl the cache control directives, if null removes any * existing cache control directives. * @return the updated ResponseBuilder */ public abstract ResponseBuilder cacheControl(CacheControl cacheControl); /** * Set the expires date on the ResponseBuilder. * * @param expires the expiration date, if null removes any existing * expires value. * @return the updated ResponseBuilder */ public abstract ResponseBuilder expires(Date expires); /** * Add a header to the ResponseBuilder. * * @param name the name of the header * @param value the value of the header, the header will be serialized * using a {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if * one is available via * {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the class of {@code value} or using its {@code toString} method if a * header delegate is not available. If {@code value} is null then all * current headers of the same name will be removed. * @return the updated ResponseBuilder */ public abstract ResponseBuilder header(String name, Object value); /** * Add cookies to the ResponseBuilder. * * @param cookies new cookies that will accompany the response. A null * value will remove all cookies, including those added via the * {@link #header(java.lang.String, java.lang.Object)} method. * @return the updated ResponseBuilder */ public abstract ResponseBuilder cookie(NewCookie... cookies); } /** * Base interface for statuses used in responses. */ public interface StatusType { /** * Get the associated status code * @return the status code */ public int getStatusCode(); /** * Get the class of status code * @return the class of status code */ public Status.Family getFamily(); /** * Get the reason phrase * @return the reason phrase */ public String getReasonPhrase(); } /** * Commonly used status codes defined by HTTP, see * {@link HTTP/1.1 documentation} * for the complete list. Additional status codes can be added by applications * by creating an implementation of {@link StatusType}. */ public enum Status implements StatusType { /** * 200 OK, see {@link HTTP/1.1 documentation}. */ OK(200, "OK"), /** * 201 Created, see {@link HTTP/1.1 documentation}. */ CREATED(201, "Created"), /** * 202 Accepted, see {@link HTTP/1.1 documentation}. */ ACCEPTED(202, "Accepted"), /** * 204 No Content, see {@link HTTP/1.1 documentation}. */ NO_CONTENT(204, "No Content"), /** * 301 Moved Permanently, see {@link HTTP/1.1 documentation}. */ MOVED_PERMANENTLY(301, "Moved Permanently"), /** * 303 See Other, see {@link HTTP/1.1 documentation}. */ SEE_OTHER(303, "See Other"), /** * 304 Not Modified, see {@link HTTP/1.1 documentation}. */ NOT_MODIFIED(304, "Not Modified"), /** * 307 Temporary Redirect, see {@link HTTP/1.1 documentation}. */ TEMPORARY_REDIRECT(307, "Temporary Redirect"), /** * 400 Bad Request, see {@link HTTP/1.1 documentation}. */ BAD_REQUEST(400, "Bad Request"), /** * 401 Unauthorized, see {@link HTTP/1.1 documentation}. */ UNAUTHORIZED(401, "Unauthorized"), /** * 403 Forbidden, see {@link HTTP/1.1 documentation}. */ FORBIDDEN(403, "Forbidden"), /** * 404 Not Found, see {@link HTTP/1.1 documentation}. */ NOT_FOUND(404, "Not Found"), /** * 406 Not Acceptable, see {@link HTTP/1.1 documentation}. */ NOT_ACCEPTABLE(406, "Not Acceptable"), /** * 409 Conflict, see {@link HTTP/1.1 documentation}. */ CONFLICT(409, "Conflict"), /** * 410 Gone, see {@link HTTP/1.1 documentation}. */ GONE(410, "Gone"), /** * 412 Precondition Failed, see {@link HTTP/1.1 documentation}. */ PRECONDITION_FAILED(412, "Precondition Failed"), /** * 415 Unsupported Media Type, see {@link HTTP/1.1 documentation}. */ UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"), /** * 500 Internal Server Error, see {@link HTTP/1.1 documentation}. */ INTERNAL_SERVER_ERROR(500, "Internal Server Error"), /** * 503 Service Unavailable, see {@link HTTP/1.1 documentation}. */ SERVICE_UNAVAILABLE(503, "Service Unavailable"); private final int code; private final String reason; private Family family; /** * An enumeration representing the class of status code. Family is used * here since class is overloaded in Java. */ public enum Family {INFORMATIONAL, SUCCESSFUL, REDIRECTION, CLIENT_ERROR, SERVER_ERROR, OTHER}; Status(final int statusCode, final String reasonPhrase) { this.code = statusCode; this.reason = reasonPhrase; switch(code/100) { case 1: this.family = Family.INFORMATIONAL; break; case 2: this.family = Family.SUCCESSFUL; break; case 3: this.family = Family.REDIRECTION; break; case 4: this.family = Family.CLIENT_ERROR; break; case 5: this.family = Family.SERVER_ERROR; break; default: this.family = Family.OTHER; break; } } /** * Get the class of status code * @return the class of status code */ public Family getFamily() { return family; } /** * Get the associated status code * @return the status code */ public int getStatusCode() { return code; } /** * Get the reason phrase * @return the reason phrase */ public String getReasonPhrase() { return toString(); } /** * Get the reason phrase * @return the reason phrase */ @Override public String toString() { return reason; } /** * Convert a numerical status code into the corresponding Status * @param statusCode the numerical status code * @return the matching Status or null is no matching Status is defined */ public static Status fromStatusCode(final int statusCode) { for (Status s : Status.values()) { if (s.code == statusCode) { return s; } } return null; } } } ./src/javax/ws/rs/core/UriBuilder.java0000664000175000017500000005132611767656530017032 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * UriBuilder.java * * Created on July 18, 2007, 11:53 AM * */ package javax.ws.rs.core; import java.lang.reflect.Method; import java.net.URI; import java.util.Map; import javax.ws.rs.ext.RuntimeDelegate; /** * URI template aware utility class for building URIs from their components. See * {@link javax.ws.rs.Path#value} for an explanation of URI templates. * *

Builder methods perform contextual encoding of characters not permitted in * the corresponding URI component following the rules of the * application/x-www-form-urlencoded * media type for query parameters and * RFC 3986 for all other * components. Note that only characters not permitted in a particular component * are subject to encoding so, e.g., a path supplied to one of the {@code path} * methods may contain matrix parameters or multiple path segments since the * separators are legal characters and will not be encoded. Percent encoded * values are also recognized where allowed and will not be double encoded.

* *

URI templates are allowed in most components of a URI but their value is * restricted to a particular component. E.g. *

UriBuilder.fromPath("{arg1}").build("foo#bar");
* would result in encoding of the '#' such that the resulting URI is * "foo%23bar". To create a URI "foo#bar" use *
UriBuilder.fromPath("{arg1}").fragment("{arg2}").build("foo", "bar")
* instead. URI template names and delimiters are never encoded but their * values are encoded when a URI is built. * Template parameter regular expressions are ignored when building a URI, i.e. * no validation is performed. * * @see java.net.URI * @see javax.ws.rs.Path */ public abstract class UriBuilder { /** * Protected constructor, use one of the static fromXXX * methods to obtain an instance. */ protected UriBuilder() {} /** * Creates a new instance of UriBuilder. * @return a new instance of UriBuilder */ protected static UriBuilder newInstance() { UriBuilder b = RuntimeDelegate.getInstance().createUriBuilder(); return b; } /** * Create a new instance initialized from an existing URI. * @param uri a URI that will be used to initialize the UriBuilder. * @return a new UriBuilder * @throws IllegalArgumentException if uri is null */ public static UriBuilder fromUri(URI uri) throws IllegalArgumentException { UriBuilder b = newInstance(); b.uri(uri); return b; } /** * Create a new instance initialized from an existing URI. * @param uri a URI that will be used to initialize the UriBuilder, may not * contain URI parameters. * @return a new UriBuilder * @throws IllegalArgumentException if uri is not a valid URI or is null */ public static UriBuilder fromUri(String uri) throws IllegalArgumentException { URI u; try { u = URI.create(uri); } catch (NullPointerException ex) { throw new IllegalArgumentException(ex.getMessage(), ex); } return fromUri(u); } /** * Create a new instance representing a relative URI initialized from a * URI path. * @param path a URI path that will be used to initialize the UriBuilder, * may contain URI template parameters. * @return a new UriBuilder * @throws IllegalArgumentException if path is null */ public static UriBuilder fromPath(String path) throws IllegalArgumentException { UriBuilder b = newInstance(); b.path(path); return b; } /** * Create a new instance representing a relative URI initialized from a * root resource class. * * @param resource a root resource whose {@link javax.ws.rs.Path} value will * be used to initialize the UriBuilder. * @return a new UriBuilder * @throws IllegalArgumentException if resource is not annotated with * {@link javax.ws.rs.Path} or resource is null. */ public static UriBuilder fromResource(Class resource) throws IllegalArgumentException { UriBuilder b = newInstance(); b.path(resource); return b; } /** * Create a copy of the UriBuilder preserving its state. This is a more * efficient means of creating a copy than constructing a new UriBuilder * from a URI returned by the {@link #build} method. * @return a copy of the UriBuilder */ @Override public abstract UriBuilder clone(); /** * Copies the non-null components of the supplied URI to the UriBuilder replacing * any existing values for those components. * @param uri the URI to copy components from * @return the updated UriBuilder * @throws IllegalArgumentException if uri is null */ public abstract UriBuilder uri(URI uri) throws IllegalArgumentException; /** * Set the URI scheme. * @param scheme the URI scheme, may contain URI template parameters. * A null value will unset the URI scheme. * @return the updated UriBuilder * @throws IllegalArgumentException if scheme is invalid */ public abstract UriBuilder scheme(String scheme) throws IllegalArgumentException; /** * Set the URI scheme-specific-part (see {@link java.net.URI}). This * method will overwrite any existing * values for authority, user-info, host, port and path. * @param ssp the URI scheme-specific-part, may contain URI template parameters * @return the updated UriBuilder * @throws IllegalArgumentException if ssp cannot be parsed or is null */ public abstract UriBuilder schemeSpecificPart(String ssp) throws IllegalArgumentException; /** * Set the URI user-info. * @param ui the URI user-info, may contain URI template parameters. * A null value will unset userInfo component of the URI. * @return the updated UriBuilder */ public abstract UriBuilder userInfo(String ui); /** * Set the URI host. * @return the updated UriBuilder * @param host the URI host, may contain URI template parameters. * A null value will unset the host component of the URI. * @throws IllegalArgumentException if host is invalid. */ public abstract UriBuilder host(String host) throws IllegalArgumentException; /** * Set the URI port. * @param port the URI port, a value of -1 will unset an explicit port. * @return the updated UriBuilder * @throws IllegalArgumentException if port is invalid */ public abstract UriBuilder port(int port) throws IllegalArgumentException; /** * Set the URI path. This method will overwrite * any existing path and associated matrix parameters. * Existing '/' characters are preserved thus a single value can * represent multiple URI path segments. * @param path the path, may contain URI template parameters. * A null value will unset the path component of the URI. * @return the updated UriBuilder */ public abstract UriBuilder replacePath(String path); /** * Append path to the existing path. * When constructing the final path, a '/' separator will be inserted * between the existing path and the supplied path if necessary. * Existing '/' characters are preserved thus a single value can * represent multiple URI path segments. * @param path the path, may contain URI template parameters * @return the updated UriBuilder * @throws IllegalArgumentException if path is null */ public abstract UriBuilder path(String path) throws IllegalArgumentException; /** * Append the path from a Path-annotated class to the * existing path. * When constructing the final path, a '/' separator will be inserted * between the existing path and the supplied path if necessary. * * @param resource a resource whose {@link javax.ws.rs.Path} value will be * used to obtain the path to append. * @return the updated UriBuilder * @throws IllegalArgumentException if resource is null, or * if resource is not annotated with {@link javax.ws.rs.Path} */ public abstract UriBuilder path(Class resource) throws IllegalArgumentException; /** * Append the path from a Path-annotated method to the * existing path. * When constructing the final path, a '/' separator will be inserted * between the existing path and the supplied path if necessary. * This method is a convenience shortcut to path(Method), it * can only be used in cases where there is a single method with the * specified name that is annotated with {@link javax.ws.rs.Path}. * * @param resource the resource containing the method * @param method the name of the method whose {@link javax.ws.rs.Path} value will be * used to obtain the path to append * @return the updated UriBuilder * @throws IllegalArgumentException if resource or method is null, * or there is more than or less than one variant of the method annotated with * {@link javax.ws.rs.Path} */ public abstract UriBuilder path(Class resource, String method) throws IllegalArgumentException; /** * Append the path from a {@link javax.ws.rs.Path}-annotated method to the * existing path. * When constructing the final path, a '/' separator will be inserted * between the existing path and the supplied path if necessary. * * @param method a method whose {@link javax.ws.rs.Path} value will be * used to obtain the path to append to the existing path * @return the updated UriBuilder * @throws IllegalArgumentException if method is null or is * not annotated with a {@link javax.ws.rs.Path} */ public abstract UriBuilder path(Method method) throws IllegalArgumentException; /** * Append path segments to the existing path. * When constructing the final path, a '/' separator will be inserted * between the existing path and the first path segment if necessary and * each supplied segment will also be separated by '/'. * Existing '/' characters are encoded thus a single value can * only represent a single URI path segment. * @param segments the path segment values, each may contain URI template * parameters * @return the updated UriBuilder * @throws IllegalArgumentException if segments or any element of segments * is null */ public abstract UriBuilder segment(String... segments) throws IllegalArgumentException; /** * Set the matrix parameters of the current final segment of the current URI path. * This method will overwrite any existing matrix parameters on the current final * segment of the current URI path. Note that the matrix parameters * are tied to a particular path segment; subsequent addition of path segments * will not affect their position in the URI path. * @param matrix the matrix parameters, may contain URI template parameters. * A null value will remove all matrix parameters of the current final segment * of the current URI path. * @return the updated UriBuilder * @throws IllegalArgumentException if matrix cannot be parsed * @see Matrix URIs */ public abstract UriBuilder replaceMatrix(String matrix) throws IllegalArgumentException; /** * Append a matrix parameter to the existing set of matrix parameters of * the current final segment of the URI path. If multiple values are supplied * the parameter will be added once per value. Note that the matrix parameters * are tied to a particular path segment; subsequent addition of path segments * will not affect their position in the URI path. * @param name the matrix parameter name, may contain URI template parameters * @param values the matrix parameter value(s), each object will be converted * to a {@code String} using its {@code toString()} method. Stringified * values may contain URI template parameters. * @return the updated UriBuilder * @throws IllegalArgumentException if name or values is null * @see Matrix URIs */ public abstract UriBuilder matrixParam(String name, Object... values) throws IllegalArgumentException; /** * Replace the existing value(s) of a matrix parameter on * the current final segment of the URI path. If multiple values are supplied * the parameter will be added once per value. Note that the matrix parameters * are tied to a particular path segment; subsequent addition of path segments * will not affect their position in the URI path. * @param name the matrix parameter name, may contain URI template parameters * @param values the matrix parameter value(s), each object will be converted * to a {@code String} using its {@code toString()} method. Stringified * values may contain URI template parameters. If {@code values} is empty * or null then all current values of the parameter are removed. * @return the updated UriBuilder * @throws IllegalArgumentException if name is null. * @see Matrix URIs */ public abstract UriBuilder replaceMatrixParam(String name, Object... values) throws IllegalArgumentException; /** * Set the URI query string. This method will overwrite any existing query * parameters. * @param query the URI query string, may contain URI template parameters. * A null value will remove all query parameters. * @return the updated UriBuilder * @throws IllegalArgumentException if query cannot be parsed */ public abstract UriBuilder replaceQuery(String query) throws IllegalArgumentException; /** * Append a query parameter to the existing set of query parameters. If * multiple values are supplied the parameter will be added once per value. * @param name the query parameter name, may contain URI template parameters * @param values the query parameter value(s), each object will be converted * to a {@code String} using its {@code toString()} method. Stringified * values may contain URI template parameters. * @return the updated UriBuilder * @throws IllegalArgumentException if name or values is null */ public abstract UriBuilder queryParam(String name, Object... values) throws IllegalArgumentException; /** * Replace the existing value(s) of a query parameter. If * multiple values are supplied the parameter will be added once per value. * @param name the query parameter name, may contain URI template parameters * @param values the query parameter value(s), each object will be converted * to a {@code String} using its {@code toString()} method. Stringified * values may contain URI template parameters. If {@code values} is empty * or null then all current values of the parameter are removed. * @return the updated UriBuilder * @throws IllegalArgumentException if name is null */ public abstract UriBuilder replaceQueryParam(String name, Object... values) throws IllegalArgumentException; /** * Set the URI fragment. * @param fragment the URI fragment, may contain URI template parameters. * A null value will remove any existing fragment. * @return the updated UriBuilder */ public abstract UriBuilder fragment(String fragment); /** * Build a URI, any URI template parameters will be replaced by the value in * the supplied map. Values are converted to String using * their toString method and are then encoded to match the * rules of the URI component to which they pertain. All '%' characters * in the stringified values will be encoded. * The state of the builder is unaffected; this method may be called * multiple times on the same builder instance. * @param values a map of URI template parameter names and values * @return the URI built from the UriBuilder * @throws IllegalArgumentException if there are any URI template parameters * without a supplied value, or if a template parameter value is null. * @throws UriBuilderException if a URI cannot be constructed based on the * current state of the builder. */ public abstract URI buildFromMap(Map values) throws IllegalArgumentException, UriBuilderException; /** * Build a URI, any URI template parameters will be replaced by the value in * the supplied map. Values are converted to String using * their toString method and are then encoded to match the * rules of the URI component to which they pertain. All % characters in * the stringified values that are not followed by two hexadecimal numbers * will be encoded. * The state of the builder is unaffected; this method may be called * multiple times on the same builder instance. * @param values a map of URI template parameter names and values * @return the URI built from the UriBuilder * @throws IllegalArgumentException if there are any URI template parameters * without a supplied value, or if a template parameter value is null. * @throws UriBuilderException if a URI cannot be constructed based on the * current state of the builder. */ public abstract URI buildFromEncodedMap(Map values) throws IllegalArgumentException, UriBuilderException; /** * Build a URI, using the supplied values in order to replace any URI * template parameters. Values are converted to String using * their toString method and are then encoded to match the * rules of the URI component to which they pertain. All '%' characters * in the stringified values will be encoded. * The state of the builder is unaffected; this method may be called * multiple times on the same builder instance. *

All instances of the same template parameter * will be replaced by the same value that corresponds to the position of the * first instance of the template parameter. e.g. the template "{a}/{b}/{a}" * with values {"x", "y", "z"} will result in the the URI "x/y/x", not * "x/y/z". * @param values a list of URI template parameter values * @return the URI built from the UriBuilder * @throws IllegalArgumentException if there are any URI template parameters * without a supplied value, or if a value is null. * @throws UriBuilderException if a URI cannot be constructed based on the * current state of the builder. */ public abstract URI build(Object... values) throws IllegalArgumentException, UriBuilderException; /** * Build a URI. * Any URI templates parameters will be replaced with the supplied values in * order. Values are converted to String using * their toString method and are then encoded to match the * rules of the URI component to which they pertain. All % characters in * the stringified values that are not followed by two hexadecimal numbers * will be encoded. * The state of the builder is unaffected; this method may be called * multiple times on the same builder instance. *

All instances of the same template parameter * will be replaced by the same value that corresponds to the position of the * first instance of the template parameter. e.g. the template "{a}/{b}/{a}" * with values {"x", "y", "z"} will result in the the URI "x/y/x", not * "x/y/z". * @param values a list of URI template parameter values * @return the URI built from the UriBuilder * @throws IllegalArgumentException if there are any URI template parameters * without a supplied value, or if a value is null. * @throws UriBuilderException if a URI cannot be constructed based on the * current state of the builder. */ public abstract URI buildFromEncoded(Object... values) throws IllegalArgumentException, UriBuilderException; } ./src/javax/ws/rs/core/MultivaluedMap.java0000664000175000017500000000256611767656530017717 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * MultivaluedMap.java * * Created on February 13, 2007, 2:30 PM * */ package javax.ws.rs.core; import java.util.List; import java.util.Map; /** * A map of key-values pairs. Each key can have zero or more values. * */ public interface MultivaluedMap extends Map> { /** * Set the key's value to be a one item list consisting of the supplied value. * Any existing values will be replaced. * * @param key the key * @param value the single value of the key */ void putSingle(K key, V value); /** * Add a value to the current list of values for the supplied key. * @param key the key * @param value the value to be added. */ void add(K key, V value); /** * A shortcut to get the first value of the supplied key. * @param key the key * @return the first value for the specified key or null if the key is * not in the map. */ V getFirst(K key); } ./src/javax/ws/rs/core/UriBuilderException.java0000664000175000017500000000455511767656530020713 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * UriBuilderException.java * * Created on August 22, 2007, 4:41 PM * */ package javax.ws.rs.core; /** * A runtime exception thrown by {@link UriBuilder#build} methods when a {@link * java.net.URI} cannot be constructed based on the current state of the * builder. */ public class UriBuilderException extends java.lang.RuntimeException { private static final long serialVersionUID = 956255913370721193L; /** * Creates a new instance of UriBuilderException without detail message. */ public UriBuilderException() { } /** * Constructs an instance of UriBuilderException with the specified detail message. * @param msg the detail message (which is saved for later retrieval by the Throwable.getMessage() method). */ public UriBuilderException(String msg) { super(msg); } /** * Constructs an instance of UriBuilderException with the specified detail message and cause. *

Note that the detail message associated with cause is not automatically incorporated in this exception's detail message. * @param msg the detail message (which is saved for later retrieval by the Throwable.getMessage() method). * @param cause the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) */ public UriBuilderException(String msg, Throwable cause) { super(msg, cause); } /** * Constructs a new exception with the specified cause and a detail message * of (cause==null ? null : cause.toString()) (which typically contains * the class and detail message of cause). This constructor is useful * for exceptions that are little more than wrappers for other throwables. * @param cause the original exception */ public UriBuilderException(Throwable cause) { super(cause); } } ./src/javax/ws/rs/core/HttpHeaders.java0000664000175000017500000002016611767656530017175 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * HttpHeaders.java * * Created on April 13, 2007, 3:00 PM * */ package javax.ws.rs.core; import java.util.List; import java.util.Locale; import java.util.Map; /** * An injectable interface that provides access to HTTP header information. * All methods throw java.lang.IllegalStateException if called outside the scope of a request * (e.g. from a provider constructor). * @see Context */ public interface HttpHeaders { /** * Get the values of a HTTP request header. The returned List is read-only. * This is a shortcut for getRequestHeaders().get(name). * @param name the header name, case insensitive * @return a read-only list of header values. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public List getRequestHeader(String name); /** * Get the values of HTTP request headers. The returned Map is case-insensitive * wrt keys and is read-only. * @return a read-only map of header names and values. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public MultivaluedMap getRequestHeaders(); /** * Get a list of media types that are acceptable for the response. * @return a read-only list of requested response media types sorted according * to their q-value, with highest preference first. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public List getAcceptableMediaTypes(); /** * Get a list of languages that are acceptable for the response. * @return a read-only list of acceptable languages sorted according * to their q-value, with highest preference first. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public List getAcceptableLanguages(); /** * Get the media type of the request entity * @return the media type or null if there is no request entity. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public MediaType getMediaType(); /** * Get the language of the request entity * @return the language of the entity or null if not specified * @throws java.lang.IllegalStateException if called outside the scope of a request */ public Locale getLanguage(); /** * Get any cookies that accompanied the request. * @return a read-only map of cookie name (String) to Cookie. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public Map getCookies(); /** * See {@link HTTP/1.1 documentation}. */ public static final String ACCEPT = "Accept"; /** * See {@link HTTP/1.1 documentation}. */ public static final String ACCEPT_CHARSET = "Accept-Charset"; /** * See {@link HTTP/1.1 documentation}. */ public static final String ACCEPT_ENCODING = "Accept-Encoding"; /** * See {@link HTTP/1.1 documentation}. */ public static final String ACCEPT_LANGUAGE = "Accept-Language"; /** * See {@link HTTP/1.1 documentation}. */ public static final String AUTHORIZATION = "Authorization"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CACHE_CONTROL = "Cache-Control"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CONTENT_ENCODING = "Content-Encoding"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CONTENT_LANGUAGE = "Content-Language"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CONTENT_LENGTH = "Content-Length"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CONTENT_LOCATION = "Content-Location"; /** * See {@link HTTP/1.1 documentation}. */ public static final String CONTENT_TYPE = "Content-Type"; /** * See {@link HTTP/1.1 documentation}. */ public static final String DATE = "Date"; /** * See {@link HTTP/1.1 documentation}. */ public static final String ETAG = "ETag"; /** * See {@link HTTP/1.1 documentation}. */ public static final String EXPIRES = "Expires"; /** * See {@link HTTP/1.1 documentation}. */ public static final String HOST = "Host"; /** * See {@link HTTP/1.1 documentation}. */ public static final String IF_MATCH = "If-Match"; /** * See {@link HTTP/1.1 documentation}. */ public static final String IF_MODIFIED_SINCE = "If-Modified-Since"; /** * See {@link HTTP/1.1 documentation}. */ public static final String IF_NONE_MATCH = "If-None-Match"; /** * See {@link HTTP/1.1 documentation}. */ public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; /** * See {@link HTTP/1.1 documentation}. */ public static final String LAST_MODIFIED = "Last-Modified"; /** * See {@link HTTP/1.1 documentation}. */ public static final String LOCATION = "Location"; /** * See {@link HTTP/1.1 documentation}. */ public static final String USER_AGENT = "User-Agent"; /** * See {@link HTTP/1.1 documentation}. */ public static final String VARY = "Vary"; /** * See {@link HTTP/1.1 documentation}. */ public static final String WWW_AUTHENTICATE = "WWW-Authenticate"; /** * See {@link IETF RFC 2109}. */ public static final String COOKIE = "Cookie"; /** * See {@link IETF RFC 2109}. */ public static final String SET_COOKIE = "Set-Cookie"; } ./src/javax/ws/rs/core/NewCookie.java0000664000175000017500000002037611767656530016650 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * NewCookie.java * * Created on March 12, 2007, 5:08 PM * */ package javax.ws.rs.core; import javax.ws.rs.ext.RuntimeDelegate; import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate; /** * Used to create a new HTTP cookie, transferred in a response. * @see IETF RFC 2109 */ public class NewCookie extends Cookie { /** * Specifies that the cookie expires with the current application/browser session. */ public static final int DEFAULT_MAX_AGE = -1; private static final HeaderDelegate delegate = RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class); private String comment = null; private int maxAge = DEFAULT_MAX_AGE; private boolean secure = false; /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @throws IllegalArgumentException if name is null */ public NewCookie(String name, String value) { super(name, value); } /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @param path the URI path for which the cookie is valid * @param domain the host domain for which the cookie is valid * @param comment the comment * @param maxAge the maximum age of the cookie in seconds * @param secure specifies whether the cookie will only be sent over a secure connection * @throws IllegalArgumentException if name is null */ public NewCookie(String name, String value, String path, String domain, String comment, int maxAge, boolean secure) { super(name, value, path, domain); this.comment = comment; this.maxAge = maxAge; this.secure = secure; } /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @param path the URI path for which the cookie is valid * @param domain the host domain for which the cookie is valid * @param version the version of the specification to which the cookie complies * @param comment the comment * @param maxAge the maximum age of the cookie in seconds * @param secure specifies whether the cookie will only be sent over a secure connection * @throws IllegalArgumentException if name is null */ public NewCookie(String name, String value, String path, String domain, int version, String comment, int maxAge, boolean secure) { super(name, value, path, domain, version); this.comment = comment; this.maxAge = maxAge; this.secure = secure; } /** * Create a new instance copying the information in the supplied cookie. * @param cookie the cookie to clone * @throws IllegalArgumentException if cookie is null */ public NewCookie(Cookie cookie) { super(cookie==null ? null : cookie.getName(), cookie==null ? null : cookie.getValue(), cookie==null ? null : cookie.getPath(), cookie==null ? null : cookie.getDomain(), cookie==null ? Cookie.DEFAULT_VERSION : cookie.getVersion()); } /** * Create a new instance supplementing the information in the supplied cookie. * @param cookie the cookie to clone * @param comment the comment * @param maxAge the maximum age of the cookie in seconds * @param secure specifies whether the cookie will only be sent over a secure connection * @throws IllegalArgumentException if cookie is null */ public NewCookie(Cookie cookie, String comment, int maxAge, boolean secure) { this(cookie); this.comment = comment; this.maxAge = maxAge; this.secure = secure; } /** * Creates a new instance of NewCookie by parsing the supplied string. * @param value the cookie string * @return the newly created NewCookie * @throws IllegalArgumentException if the supplied string cannot be parsed * or is null */ public static NewCookie valueOf(String value) throws IllegalArgumentException { return delegate.fromString(value); } /** * Get the comment associated with the cookie. * @return the comment or null if none set */ public String getComment() { return comment; } /** * Get the maximum age of the the cookie in seconds. Cookies older than * the maximum age are discarded. A cookie can be unset by sending a new * cookie with maximum age of 0 since it will overwrite any existing cookie * and then be immediately discarded. The default value of -1 indicates that the cookie * will be discarded at the end of the browser/application session. * @return the maximum age in seconds */ public int getMaxAge() { return maxAge; } /** * Whether the cookie will only be sent over a secure connection. Defaults * to false. * @return true if the cookie will only be sent over a secure connection, * false otherwise. */ public boolean isSecure() { return secure; } /** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(),this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); } /** * Convert the cookie to a string suitable for use as the value of the * corresponding HTTP header. * @return a stringified cookie */ @Override public String toString() { return delegate.toString(this); } /** * Generate a hashcode by hashing all of the properties * @return the hashcode */ @Override public int hashCode() { int hash = super.hashCode(); hash = 59 * hash + (this.comment != null ? this.comment.hashCode() : 0); hash = 59 * hash + this.maxAge; hash = 59 * hash + (this.secure ? 1 : 0); return hash; } /** * Compare for equality. Use {@link #toCookie()} to compare a * {@code NewCookie} to a {@code Cookie} considering only the common * properties. * @param obj * @return true if the object is a {@code NewCookie} with the same value for * all properties, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final NewCookie other = (NewCookie) obj; if (this.getName() != other.getName() && (this.getName() == null || !this.getName().equals(other.getName()))) { return false; } if (this.getValue() != other.getValue() && (this.getValue() == null || !this.getValue().equals(other.getValue()))) { return false; } if (this.getVersion() != other.getVersion()) { return false; } if (this.getPath() != other.getPath() && (this.getPath() == null || !this.getPath().equals(other.getPath()))) { return false; } if (this.getDomain() != other.getDomain() && (this.getDomain() == null || !this.getDomain().equals(other.getDomain()))) { return false; } if (this.comment != other.comment && (this.comment == null || !this.comment.equals(other.comment))) { return false; } if (this.maxAge != other.maxAge) { return false; } if (this.secure != other.secure) { return false; } return true; } } ./src/javax/ws/rs/core/EntityTag.java0000664000175000017500000000713411767656530016672 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * EntityTag.java * * Created on March 21, 2007, 3:14 PM * */ package javax.ws.rs.core; import javax.ws.rs.ext.RuntimeDelegate; import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate; /** * An abstraction for the value of a HTTP Entity Tag, used as the value * of an ETag response header. * @see HTTP/1.1 section 3.11 */ public class EntityTag { private String value; private boolean weak; private static final HeaderDelegate delegate = RuntimeDelegate.getInstance().createHeaderDelegate(EntityTag.class); /** * Creates a new instance of a strong EntityTag. * @param value the value of the tag, quotes not included. * @throws IllegalArgumentException if value is null */ public EntityTag(String value) { this(value, false); } /** * Creates a new instance of an EntityTag * @param value the value of the tag, quotes not included. * @param weak true if this represents a weak tag, false otherwise * @throws IllegalArgumentException if value is null */ public EntityTag(String value, boolean weak) { if (value == null) throw new IllegalArgumentException("value==null"); this.value = value; this.weak = weak; } /** * Creates a new instance of EntityTag by parsing the supplied string. * @param value the entity tag string * @return the newly created EntityTag * @throws IllegalArgumentException if the supplied string cannot be parsed * or is null */ public static EntityTag valueOf(String value) throws IllegalArgumentException { return delegate.fromString(value); } /** * Check the strength of an EntityTag * @return true if this represents a weak tag, false otherwise */ public boolean isWeak() { return weak; } /** * Get the value of an EntityTag * @return the value of the tag */ public String getValue() { return value; } /** * Compares obj to this tag to see if they are the same considering weakness and * value. * @param obj the object to compare to * @return true if the two tags are the same, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof EntityTag)) return super.equals(obj); EntityTag other = (EntityTag)obj; if (value.equals(other.getValue()) && weak==other.isWeak()) return true; return false; } /** * Generate hashCode based on value and weakness. * @return the hashCode */ @Override public int hashCode() { int hash = 3; hash = 17 * hash + (this.value != null ? this.value.hashCode() : 0); hash = 17 * hash + (this.weak ? 1 : 0); return hash; } /** * Convert the entity tag to a string suitable for use as the value of the * corresponding HTTP header. * @return a stringified entity tag */ @Override public String toString() { return delegate.toString(this); } } ./src/javax/ws/rs/core/SecurityContext.java0000664000175000017500000000645211767656530020140 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ package javax.ws.rs.core; import java.security.Principal; /** * An injectable interface that provides access to security related * information. * * @see Context */ public interface SecurityContext { /** * String identifier for Basic authentication. Value "BASIC" */ public static final String BASIC_AUTH = "BASIC"; /** * String identifier for Client Certificate authentication. Value "CLIENT_CERT" */ public static final String CLIENT_CERT_AUTH = "CLIENT_CERT"; /** * String identifier for Digest authentication. Value "DIGEST" */ public static final String DIGEST_AUTH = "DIGEST"; /** * String identifier for Form authentication. Value "FORM" */ public static final String FORM_AUTH = "FORM"; /** * Returns a java.security.Principal object containing the * name of the current authenticated user. If the user * has not been authenticated, the method returns null. * * @return a java.security.Principal containing the name * of the user making this request; null if the user has not been * authenticated * @throws java.lang.IllegalStateException if called outside the scope of a request */ public Principal getUserPrincipal(); /** * Returns a boolean indicating whether the authenticated user is included * in the specified logical "role". If the user has not been authenticated, * the method returns false. * * @param role a String specifying the name of the role * @return a boolean indicating whether the user making * the request belongs to a given role; false if the user * has not been authenticated * @throws java.lang.IllegalStateException if called outside the scope of a request */ public boolean isUserInRole(String role); /** * Returns a boolean indicating whether this request was made * using a secure channel, such as HTTPS. * * @return true if the request was made using a secure * channel, false otherwise * @throws java.lang.IllegalStateException if called outside the scope of a request */ public boolean isSecure(); /** * Returns the string value of the authentication scheme used to protect * the resource. If the resource is not authenticated, null is returned. * * Values are the same as the CGI variable AUTH_TYPE * * @return one of the static members BASIC_AUTH, FORM_AUTH, * CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) or the * container-specific string indicating the authentication scheme, * or null if the request was not authenticated. * @throws java.lang.IllegalStateException if called outside the scope of a request */ public String getAuthenticationScheme(); } ./src/javax/ws/rs/core/GenericEntity.java0000664000175000017500000001574711767656530017544 0ustar brianbrianpackage javax.ws.rs.core; /* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. * * This file incorporates work covered by the following copyright and * permission notice: * * Copyright (C) 2006 Google Inc. * * Licensed 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. */ import java.lang.reflect.GenericArrayType; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import javax.ws.rs.ext.MessageBodyWriter; /** * Represents a response entity of a generic type {@code T}. * *

Normally type erasure removes generic type information such that a * {@link Response} instance that contains, e.g., an entity of type * {@code List} appears to contain a raw {@code List} at runtime. * When the generic type is required to select a suitable * {@link MessageBodyWriter}, this class may be used to wrap the entity and * capture its generic type.

* *

There are two ways to create an instance:

*
    *
  1. Create a (typically anonymous) subclass of this * class which enables retrieval of the type information at runtime despite * type erasure. For example, the following code shows how to create a * {@link Response} containing an entity of type {@code List} whose * generic type will be available at runtime for selection of a suitable * {@link MessageBodyWriter}: * *
    List<String> list = new ArrayList<String>();
     *GenericEntity<List<String>> entity = new GenericEntity<List<String>>(list) {};
     *Response response = Response.ok(entity).build();
    * *

    where list is the instance of List<String> * that will form the response body and entity is an instance of an anonymous * subclass of {@code GenericEntity}.

  2. *
  3. Create an instance directly by supplying the generic type information * with the entity. For example the following code shows how to create * a response containing the result of a method invoked via reflection: *
    Method method = ...;
     *GenericEntity<Object> entity = new GenericEntity<Object>(
     *    method.invoke(...), method.getGenericReturnType());
     *Response response = Response.ok(entity).build();
  4. *

    The above obtains the generic type from the return type of the method, * the raw type is the class of entity.

    *
*/ public class GenericEntity { final Class rawType; final Type type; final T entity; /** * Constructs a new generic entity. Derives represented class from type * parameter. Note that this constructor is protected, users should create * a (usually anonymous) subclass as shown above. * * @param entity the entity instance, must not be null * @throws IllegalArgumentException if entity is null */ protected GenericEntity(T entity) { if (entity == null) { throw new IllegalArgumentException("The entity must not be null"); } this.entity = entity; this.type = getSuperclassTypeParameter(getClass()); this.rawType = entity.getClass(); } /** * Create a new instance of GenericEntity, supplying the generic type * information. The entity must be assignable to a variable of the * supplied generic type, e.g. if {@code entity} is an instance of * {@code ArrayList} then {@code genericType} could * be the same or a superclass of {@code ArrayList} with the same generic * type like {@code List}. * @param entity the entity instance, must not be null * @param genericType the generic type, must not be null * @throws IllegalArgumentException if the entity is not assignable to * a variable of the supplied generic type or if entity or genericType * is null. */ public GenericEntity(T entity, Type genericType) { if (entity == null || genericType==null) { throw new IllegalArgumentException("Arguments must not be null"); } this.entity = entity; this.rawType = entity.getClass(); checkTypeCompatibility(this.rawType, genericType); this.type = genericType; } private void checkTypeCompatibility(Class c, Type t) { if (t instanceof Class) { Class ct = (Class)t; if (ct.isAssignableFrom(c)) return; } else if (t instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType)t; Type rt = pt.getRawType(); checkTypeCompatibility(c, rt); return; } else if (c.isArray() && (t instanceof GenericArrayType)) { GenericArrayType at = (GenericArrayType)t; Type rt = at.getGenericComponentType(); checkTypeCompatibility(c.getComponentType(), rt); return; } throw new IllegalArgumentException("The type is incompatible with the class of the entity"); } /** * Returns the type from super class's type parameter. */ private static Type getSuperclassTypeParameter(Class subclass) { Type superclass = subclass.getGenericSuperclass(); if (!(superclass instanceof ParameterizedType)) { throw new RuntimeException("Missing type parameter."); } ParameterizedType parameterized = (ParameterizedType) superclass; return parameterized.getActualTypeArguments()[0]; } /** * Gets the raw type of the enclosed entity. Note that this is the raw type of * the instance, not the raw type of the type parameter. I.e. in the example * in the introduction, the raw type is {@code ArrayList} not {@code List}. * @return the raw type */ public final Class getRawType() { return rawType; } /** * Gets underlying {@code Type} instance. Note that this is derived from the * type parameter, not the enclosed instance. I.e. in the example * in the introduction, the type is {@code List} not * {@code ArrayList}. * @return the type */ public final Type getType() { return type; } /** * Get the enclosed entity * @return the enclosed entity */ public final T getEntity() { return entity; } }./src/javax/ws/rs/core/Request.java0000664000175000017500000001323511767656530016411 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Request.java * * Created on September 27, 2007, 5:39 PM * */ package javax.ws.rs.core; import java.util.Date; import java.util.List; import javax.ws.rs.core.Response.ResponseBuilder; /** * An injectable helper for request processing, all methods throw * java.lang.IllegalStateException if called outside the scope of a request * (e.g. from a provider constructor). * * Precondition processing (see the evaluatePreconditions methods) * can result in either a null return value to indicate that * preconditions have been met and that the request should continue, or * a non-null return value to indicate that preconditions were not met. In the * event that preconditions were not met, the returned ResponseBuilder * instance will have an appropriate status and will also include a Vary * header if the {@link #selectVariant} method was called prior to to calling * evaluatePreconditions. It is the responsibility of the caller * to check the status and add additional metadata if required. E.g., see * HTTP/1.1, section 10.3.5 * for details of the headers that are expected to accompany a 304 Not Modified * response. */ public interface Request { /** * Get the request method, e.g. GET, POST, etc. * @return the request method * @see javax.ws.rs.HttpMethod */ String getMethod(); /** * Select the representation variant that best matches the request. More * explicit variants are chosen ahead of less explicit ones. A vary header * is computed from the supplied list and automatically added to the * response. * * @param variants a list of Variant that describe all of the * available representation variants. * @return the variant that best matches the request. * @see Variant.VariantListBuilder * @throws java.lang.IllegalArgumentException if variants is empty or null * @throws java.lang.IllegalStateException if called outside the scope of a request */ Variant selectVariant(List variants) throws IllegalArgumentException; /** * Evaluate request preconditions based on the passed in value. * * @param eTag an ETag for the current state of the resource * @return null if the preconditions are met or a ResponseBuilder set with * the appropriate status if the preconditions are not met. A returned * ResponseBuilder will include an ETag header set with the value of eTag. * @throws java.lang.IllegalArgumentException if eTag is null * @throws java.lang.IllegalStateException if called outside the scope of a request */ ResponseBuilder evaluatePreconditions(EntityTag eTag); /** * Evaluate request preconditions based on the passed in value. * * @param lastModified a date that specifies the modification date of the resource * @return null if the preconditions are met or a ResponseBuilder set with * the appropriate status if the preconditions are not met. * @throws java.lang.IllegalArgumentException if lastModified is null * @throws java.lang.IllegalStateException if called outside the scope of a request */ ResponseBuilder evaluatePreconditions(Date lastModified); /** * Evaluate request preconditions based on the passed in value. * * @param lastModified a date that specifies the modification date of the resource * @param eTag an ETag for the current state of the resource * @return null if the preconditions are met or a ResponseBuilder set with * the appropriate status if the preconditions are not met. A returned * ResponseBuilder will include an ETag header set with the value of eTag. * @throws java.lang.IllegalArgumentException if lastModified or eTag is null * @throws java.lang.IllegalStateException if called outside the scope of a request */ ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag); /** * Evaluate request preconditions for a resource that does not currently * exist. The primary use of this method is to support the {@link * If-Match: *} and {@link * If-None-Match: *} preconditions. * *

Note that both preconditions If-None-Match: * and * If-None-Match: something will always be considered to * have been met and it is the applications responsibility * to enforce any additional method-specific semantics. E.g. a * PUT on a resource that does not exist might succeed whereas * a GET on a resource that does not exist would likely result * in a 404 response. It would be the responsibility of the application to * generate the 404 response.

* * @return null if the preconditions are met or a ResponseBuilder set with * the appropriate status if the preconditions are not met. * @throws java.lang.IllegalStateException if called outside the scope of * a request */ ResponseBuilder evaluatePreconditions(); } ./src/javax/ws/rs/core/Application.java0000664000175000017500000000524411767656530017225 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ package javax.ws.rs.core; import java.util.Collections; import java.util.Set; /** * Defines the components of a JAX-RS application and supplies additional * metadata. A JAX-RS application or implementation supplies a concrete * subclass of this abstract class. * *

The implementation-created instance of an Application subclass may be * injected into resource classes and providers using * {@link javax.ws.rs.core.Context}.

* */ public class Application { private static final Set emptyObjectSet = Collections.emptySet(); private static final Set> emptyClassSet = Collections.emptySet(); /** * Get a set of root resource and provider classes. The default lifecycle * for resource class instances is per-request. The default lifecycle for * providers is singleton. * *

Implementations should warn about and ignore classes that do not * conform to the requirements of root resource or provider classes. * Implementations should warn about and ignore classes for which * {@link #getSingletons()} returns an instance. Implementations MUST * NOT modify the returned set.

* *

The default implementation returns an empty set.

* * @return a set of root resource and provider classes. Returning null * is equivalent to returning an empty set. */ public Set> getClasses() { return emptyClassSet; } /** * Get a set of root resource and provider instances. Fields and properties * of returned instances are injected with their declared dependencies * (see {@link Context}) by the runtime prior to use. * *

Implementations should warn about and ignore classes that do not * conform to the requirements of root resource or provider classes. * Implementations should flag an error if the returned set includes * more than one instance of the same class. Implementations MUST * NOT modify the returned set.

* *

The default implementation returns an empty set.

* * @return a set of root resource and provider instances. Returning null * is equivalent to returning an empty set. */ public Set getSingletons() { return emptyObjectSet; } } ./src/javax/ws/rs/core/StreamingOutput.java0000664000175000017500000000262211767656530020131 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * StreamingOutput.java * * Created on March 3, 2008, 4:00 PM * */ package javax.ws.rs.core; import java.io.IOException; import java.io.OutputStream; import javax.ws.rs.WebApplicationException; /** * A type that may be used as a resource method return value or as the entity * in a {@link Response} when the application wishes to stream the output. * This is a lightweight alternative to a * {@link javax.ws.rs.ext.MessageBodyWriter}. * * @see javax.ws.rs.ext.MessageBodyWriter * @see javax.ws.rs.core.Response */ public interface StreamingOutput { /** * Called to write the message body. * @param output the OutputStream to write to. * @throws java.io.IOException if an IO error is encountered * @throws javax.ws.rs.WebApplicationException if a specific * HTTP error response needs to be produced. Only effective if thrown prior * to any bytes being written to output. */ void write(OutputStream output) throws IOException, WebApplicationException; } ./src/javax/ws/rs/core/Cookie.java0000664000175000017500000001321411767656530016167 0ustar brianbrian/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * http://www.opensource.org/licenses/cddl1.php * See the License for the specific language governing * permissions and limitations under the License. */ /* * Cookie.java * * Created on March 12, 2007, 5:01 PM * */ package javax.ws.rs.core; import javax.ws.rs.ext.RuntimeDelegate; import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate; /** * Represents the value of a HTTP cookie, transferred in a request. * RFC 2109 specifies the legal characters for name, * value, path and domain. The default version of 1 corresponds to RFC 2109. * @see IETF RFC 2109 */ public class Cookie { /** * Cookies using the default version correspond to RFC 2109. */ public static final int DEFAULT_VERSION = 1; private static final HeaderDelegate delegate = RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class); private String name; private String value; private int version; private String path; private String domain; /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @param path the URI path for which the cookie is valid * @param domain the host domain for which the cookie is valid * @param version the version of the specification to which the cookie complies * @throws IllegalArgumentException if name is null */ public Cookie(String name, String value, String path, String domain, int version) { if (name == null) throw new IllegalArgumentException("name==null"); this.name = name; this.value = value; this.version = version; this.domain = domain; this.path = path; } /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @param path the URI path for which the cookie is valid * @param domain the host domain for which the cookie is valid * @throws IllegalArgumentException if name is null */ public Cookie(String name, String value, String path, String domain) { this(name, value, path, domain, DEFAULT_VERSION); } /** * Create a new instance. * @param name the name of the cookie * @param value the value of the cookie * @throws IllegalArgumentException if name is null */ public Cookie(String name, String value) { this(name, value, null, null); } /** * Creates a new instance of Cookie by parsing the supplied string. * @param value the cookie string * @return the newly created Cookie * @throws IllegalArgumentException if the supplied string cannot be parsed * or is null */ public static Cookie valueOf(String value) throws IllegalArgumentException { return delegate.fromString(value); } /** * Get the name of the cookie * @return the name */ public String getName() { return name; } /** * Get the value of the cookie * @return the value */ public String getValue() { return value; } /** * Get the version of the cookie * @return the version */ public int getVersion() { return version; } /** * Get the domain of the cookie * @return the domain */ public String getDomain() { return domain; } /** * Get the path of the cookie * @return the path */ public String getPath() { return path; } /** * Convert the cookie to a string suitable for use as the value of the * corresponding HTTP header. * @return a stringified cookie */ @Override public String toString() { return delegate.toString(this); } /** * Generate a hashcode by hashing all of the cookies properties * @return the hashcode */ @Override public int hashCode() { int hash = 7; hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 97 * hash + (this.value != null ? this.value.hashCode() : 0); hash = 97 * hash + this.version; hash = 97 * hash + (this.path != null ? this.path.hashCode() : 0); hash = 97 * hash + (this.domain != null ? this.domain.hashCode() : 0); return hash; } /** * Compare for equality * @param obj the object to compare to * @return true if the object is a {@code Cookie} with the same value for * all properties, false otherwise. */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Cookie other = (Cookie) obj; if (this.name != other.name && (this.name == null || !this.name.equals(other.name))) { return false; } if (this.value != other.value && (this.value == null || !this.value.equals(other.value))) { return false; } if (this.version != other.version) { return false; } if (this.path != other.path && (this.path == null || !this.path.equals(other.path))) { return false; } if (this.domain != other.domain && (this.domain == null || !this.domain.equals(other.domain))) { return false; } return true; } } ./src/org/0000775000175000017500000000000011767656530011563 5ustar brianbrian./src/org/apache/0000775000175000017500000000000011767656530013004 5ustar brianbrian./src/org/apache/neethi/0000775000175000017500000000000011767656530014260 5ustar brianbrian./src/org/apache/neethi/PolicyReference.java0000664000175000017500000001210411767656530020177 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * PolicyReference is a wrapper that holds explicit PolicyReferences. */ public class PolicyReference implements PolicyComponent { private String uri; private PolicyBuilder engine; public PolicyReference() { } public PolicyReference(PolicyBuilder p) { engine = p; } /** * Sets the Policy URI * @param uri the Policy URI */ public void setURI(String uri) { this.uri = uri; } /** * Gets the Policy URI that is referred by self. * @return a String that is the Policy URI referred by self */ public String getURI() { return uri; } public boolean equal(PolicyComponent policyComponent) { if (Constants.TYPE_POLICY_REF != policyComponent.getType()) { return false; } String u = ((PolicyReference)policyComponent).getURI(); return u != null && u.length() != 0 && u.equals(this.uri); } /** * Returns short value of Constants.TYPE_POLICY_REF */ public short getType() { return Constants.TYPE_POLICY_REF; } /** * Throws an UnsupportedOperationException since PolicyReference.normalize() * can't resolve the Policy that it refers to unless a PolicyRegistry is * provided. */ public PolicyComponent normalize() { throw new UnsupportedOperationException("PolicyReference.normalize() is meaningless"); } /** * Returns normalized version of the Policy that is referred by self. The specified * PolicyRegistry is used to lookup for the Policy that is referred and deep * indicates the level of normalization for the returning Policy. * * @param reg the PolicyRegistry that is used to resolved the Policy referred by self * @param deep the flag to indicate whether returning Policy should be fully normalized * @return the normalized version for the Policy refered by self */ public PolicyComponent normalize(PolicyRegistry reg, boolean deep) { String key = getURI(); int pos = key.indexOf("#"); if (pos == 0) { key = key.substring(1); } else if (pos > 0) { key = key.substring(0, pos); } Policy policy = reg.lookup(key); if (policy == null) { policy = getRemoteReferencedPolicy(key); if (policy == null) { throw new RuntimeException(key + " can't be resolved"); } reg.register(key, policy); } return policy.normalize(reg, deep); } public void serialize(XMLStreamWriter writer) throws XMLStreamException { String namespace = Constants.findPolicyNamespace(writer); String wspPrefix = writer.getPrefix(namespace); if (wspPrefix == null) { wspPrefix = Constants.ATTR_WSP; writer.setPrefix(wspPrefix, namespace); } writer.writeStartElement(wspPrefix, Constants.ELEM_POLICY_REF, namespace); writer.writeNamespace(Constants.ATTR_WSP, namespace); writer.writeAttribute(Constants.ATTR_URI, getURI()); writer.writeEndElement(); } public Policy getRemoteReferencedPolicy(String u) { try { //create java.net URL pointing to remote resource URL url = new URL(u); URLConnection connection = url.openConnection(); connection.setDoInput(true); InputStream in = connection.getInputStream(); try { PolicyBuilder pe = engine; if (pe == null) { pe = new PolicyBuilder(); } return pe.getPolicy(connection.getInputStream()); } finally { in.close(); } } catch (MalformedURLException mue) { throw new RuntimeException("Malformed uri: " + u); } catch (IOException ioe) { throw new RuntimeException("Cannot reach remote resource: " + u); } } } ./src/org/apache/neethi/Policy.java0000664000175000017500000002501311767656530016363 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.neethi.util.PolicyIntersector; /** * Policy is a PolicyOperator that requires to satisfy all of its * PolicyComponents. It is always the outermost component of a Policy. * */ public class Policy extends All { private Map attributes = new HashMap(); private String namespace; private PolicyRegistry registry; public Policy() { } public Policy(PolicyRegistry r) { registry = r; } public Policy(PolicyRegistry r, String ns) { this(r); namespace = ns; } public Policy(PolicyOperator parent) { super(parent); } public PolicyRegistry getPolicyRegistry() { return registry; } public void setPolicyRegistry(PolicyRegistry reg) { registry = reg; } public String getNamespace() { return namespace; } /** * Returns a Normalized version of self. If deep is set * false then the assertions are not normalized and it returns a * partially normalized version of self. * * @param deep * a flag to indicate whether to normalize the assertions * @return a Policy that is normalized version of self */ public Policy normalize(boolean deep) { return normalize(registry, deep); } /** * Returns a normalized version of self.If deep is set * false then the assertions are not normalized and it returns a * partially normalized version of self. * * @param reg * a PolicyRegistry from which the PolicyReferences are resolved * @param deep * a flag to indicate whether to normalize the assertions * @return a normalized version of self */ public Policy normalize(PolicyRegistry reg, boolean deep) { return normalize(this, reg, deep); } /** * Returns a Policy that is the merge of specified Policy and self. * * @param policy * the Policy to be merged with self * @return a Policy that is the merge of the specified Policy and self */ public Policy merge(Policy policy) { Policy result = new Policy(registry, namespace); result.addPolicyComponents(getPolicyComponents()); result.addPolicyComponents(policy.getPolicyComponents()); return result; } public Policy intersect(Policy policy) { return intersect(policy, true); } public Policy intersect(Policy policy, boolean strict) { return new PolicyIntersector(strict).intersect(normalize(true), policy.normalize(true), true); } /** * Serializes the Policy to a XMLStreamWriter. */ public void serialize(XMLStreamWriter writer) throws XMLStreamException { String nspace = namespace; if (namespace == null) { nspace = Constants.findPolicyNamespace(writer); } String wspPrefix = writer.getPrefix(nspace); if (wspPrefix == null) { wspPrefix = Constants.ATTR_WSP; writer.setPrefix(wspPrefix, nspace); } String wsuPrefix = writer.getPrefix(Constants.URI_WSU_NS); if (wsuPrefix == null) { wsuPrefix = Constants.ATTR_WSU; writer.setPrefix(wsuPrefix, Constants.URI_WSU_NS); } writer.writeStartElement(wspPrefix, Constants.ELEM_POLICY, nspace); QName key; String prefix = null; String namespaceURI = null; String localName = null; Map prefix2ns = new HashMap(); boolean writeNS = true; for (Map.Entry ents : attributes.entrySet()) { key = ents.getKey(); localName = key.getLocalPart(); namespaceURI = key.getNamespaceURI(); namespaceURI = (namespaceURI == null || namespaceURI.length() == 0) ? null : namespaceURI; if (namespaceURI != null && XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { writer.writeNamespace(localName, ents.getValue()); if (nspace.equals(ents.getValue())) { writeNS = false; } } else if (namespaceURI != null) { String writerPrefix = writer.getPrefix(namespaceURI); writerPrefix = (writerPrefix == null || writerPrefix.length() == 0) ? null : writerPrefix; if (writerPrefix == null) { prefix = key.getPrefix(); prefix = (prefix == null || prefix.length() == 0) ? null : prefix; } else { prefix = writerPrefix; } if (prefix != null) { writer.writeAttribute(prefix, namespaceURI, localName, ents.getValue()); prefix2ns.put(prefix, key.getNamespaceURI()); } else { writer.writeAttribute(namespaceURI, localName, ents.getValue()); } } else { writer.writeAttribute(localName, getAttribute(key)); } } if (writeNS) { // writes xmlns:wsp=".." writer.writeNamespace(wspPrefix, nspace); } String prefiX; for (Iterator iterator = prefix2ns.keySet().iterator(); iterator .hasNext();) { prefiX = (String) iterator.next(); writer.writeNamespace(prefiX, (String) prefix2ns.get(prefiX)); } PolicyComponent policyComponent; for (Iterator iterator = getPolicyComponents().iterator(); iterator .hasNext();) { policyComponent = (PolicyComponent) iterator.next(); policyComponent.serialize(writer); } writer.writeEndElement(); } /** * Returns Constants.TYPE_POLICY */ public short getType() { return Constants.TYPE_POLICY; } /** * Returns an Iterator that will return a list of assertions correspond to a * Policy alternative if any. The iterator.next() will return a * list of assertions correspond to a Policy alternative if any and * iterator.hasNext() will indicates whether there is another * Policy alternative. * * @return */ public Iterator> getAlternatives() { return new PolicyIterator(this, registry); } public Iterator> getAlternatives(PolicyRegistry reg) { return new PolicyIterator(this, reg); } private class PolicyIterator implements Iterator> { Iterator alternatives; public PolicyIterator(Policy policy, PolicyRegistry reg) { policy = policy.normalize(reg, false); ExactlyOne exactlyOne = (ExactlyOne) policy .getFirstPolicyComponent(); alternatives = exactlyOne.getPolicyComponents().iterator(); } public boolean hasNext() { return alternatives.hasNext(); } public List next() { List pcs = ((All) alternatives.next()).getPolicyComponents(); List asserts = new ArrayList(pcs.size()); for (PolicyComponent pc : pcs) { if (pc instanceof Assertion) { asserts.add((Assertion)pc); } } return asserts; } public void remove() { throw new UnsupportedOperationException( "policyAlternative.remove() is not supported"); } } /** * Adds an attribute to self. * * @param name * the name of the attribute * @param value * the value of the attribute */ public void addAttribute(QName name, String value) { attributes.put(name, value); } /** * Returns the value of the attribute specified by the QName. Returns * null if not present. * * @param name * the QName of the attribute * @return the value of the attribute specified by the QName */ public String getAttribute(QName name) { return attributes.get(name); } /** * Returns a Map of all attributes of self. * * @return a Map of all attributes of self */ public Map getAttributes() { return attributes; } /** * Sets the Name attribute of self. * * @param name * the Name attribute of self */ public void setName(String name) { addAttribute(new QName("", Constants.ATTR_NAME), name); } /** * Returns the Name attribute of self. * * @return the Name attribute of self */ public String getName() { return getAttribute(new QName("", Constants.ATTR_NAME)); } /** * Sets the wsu:Id attribute of self. * * @param id * the Id attribute of self */ public void setId(String id) { addAttribute(new QName(Constants.URI_WSU_NS, Constants.ATTR_ID), id); } /** * Returns the Id attribute of self. * * @return the Id attribute of self */ public String getId() { return getAttribute(new QName(Constants.URI_WSU_NS, Constants.ATTR_ID)); } } ./src/org/apache/neethi/PolicyRegistry.java0000664000175000017500000000334711767656530020122 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; /** * PolicyRegistry contains (URI,Policy) pairs and it is used to resolve explicit * Policy references. * */ public interface PolicyRegistry { /** * Associates a key with a Policy * * @param key * the key that the specified Policy to be associated * @param policy * the policy to be associated with the key */ void register(String key, Policy policy); /** * Returns the Policy that the specified key is mapped. Returns null if no * Policy is associated with that key. * * @param key * the key whose associated Policy is to be returned. * @return the policy associated with the specified key. */ Policy lookup(String key); /** * Removes the mapping for this key if present. * * @param key * the key whose mapping is to be removed */ void remove(String key); } ./src/org/apache/neethi/PolicyBuilder.java0000664000175000017500000002050611767656530017674 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.io.InputStream; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import org.w3c.dom.Element; import org.apache.neethi.builders.AssertionBuilder; import org.apache.neethi.builders.converters.ConverterRegistry; /** * PolicyBuilder provides set of methods to create a Policy object from an * InputStream, Element, XMLStreamReader, OMElement, etc.. It maintains an instance of * AssertionBuilderFactory that can return AssertionBuilders that can create a * Domain Assertion out of an element. These AssertionBuilders are used when * constructing a Policy object. */ public class PolicyBuilder { protected AssertionBuilderFactory factory = new AssertionBuilderFactoryImpl(this); protected PolicyRegistry defaultPolicyRegistry; public PolicyBuilder() { factory = new AssertionBuilderFactoryImpl(this); } public PolicyBuilder(AssertionBuilderFactory factory) { this.factory = factory; } /** * Registers an AssertionBuilder instances and associates it with a QName. * PolicyManager or other AssertionBuilders instances can use this * AssertionBuilder instance to process and build an Assertion from a * element with the specified QName. * * @param qname * the QName of the Assertion that the Builder can build * @param builder * the AssertionBuilder that can build assertions that of 'qname' * type */ public void registerBuilder(QName qname, AssertionBuilder builder) { factory.registerBuilder(qname, builder); } /** * The PolicyEngine can have a default PolicyRegistry that the Policy objects * that it creates are setup to use when normalize is called without the * PolicyRegistry. * @return the default PolicyRegistry */ public PolicyRegistry getPolicyRegistry() { return defaultPolicyRegistry; } public void setPolicyRegistry(PolicyRegistry reg) { defaultPolicyRegistry = reg; } public AssertionBuilderFactory getAssertionBuilderFactory() { return factory; } /** * Creates a Policy object from an InputStream. * * @param inputStream * the InputStream of the Policy * @return a Policy object of the Policy that is fed as a InputStream */ public Policy getPolicy(InputStream inputStream) { try { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); return getPolicy(reader); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new RuntimeException("Could not load policy.", ex); } } public Policy getPolicy(Element el) { return getPolicyOperator(el); } public Policy getPolicy(XMLStreamReader reader) { return getPolicyOperator(reader); } /** * Creates a Policy object from an element. * * @param element * the Policy element * @return a Policy object of the Policy element */ public Policy getPolicy(Object element) { return getPolicyOperator(element); } /** * Creates a PolicyReference object. * * @param inputStream * the InputStream of the PolicyReference * @return a PolicyReference object of the PolicyReference */ public PolicyReference getPolicyReference(InputStream inputStream) { try { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); return getPolicyReference(reader); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new RuntimeException("Could not load policy reference.", ex); } } /** * Creates a PolicyReference object from an element. * * @param element * the PolicyReference element * @return a PolicyReference object of the PolicyReference element */ public PolicyReference getPolicyReference(Object element) { QName qn = factory.getConverterRegistry().findQName(element); if (!Constants.isPolicyRef(qn)) { throw new RuntimeException( "Specified element is not a element"); } PolicyReference reference = new PolicyReference(this); Map attributes = factory.getConverterRegistry().getAttributes(element); // setting the URI value reference.setURI(attributes.get(new QName("URI"))); return reference; } private Policy getPolicyOperator(Object element) { QName qn = factory.getConverterRegistry().findQName(element); if (Constants.isPolicyElement(qn)) { String ns = qn.getNamespaceURI(); return (Policy) processOperationElement(element, new Policy(defaultPolicyRegistry, ns)); } throw new IllegalArgumentException(qn + " is not a element."); } private ExactlyOne getExactlyOneOperator(Object element) { return (ExactlyOne) processOperationElement(element, new ExactlyOne()); } private All getAllOperator(Object element) { return (All) processOperationElement(element, new All()); } private PolicyOperator processOperationElement(Object operationElement, PolicyOperator operator) { if (Constants.TYPE_POLICY == operator.getType()) { Policy policyOperator = (Policy) operator; Map attributes = factory.getConverterRegistry().getAttributes(operationElement); for (Map.Entry ent : attributes.entrySet()) { policyOperator.addAttribute(ent.getKey(), ent.getValue()); } } for (Iterator iterator = factory.getConverterRegistry().getChildElements(operationElement); iterator.hasNext();) { Object childElement = iterator.next(); QName qn = factory.getConverterRegistry().findQName(childElement); if (childElement == null || qn == null || qn.getNamespaceURI() == null) { notifyUnknownPolicyElement(childElement); } else if (Constants.isInPolicyNS(qn)) { if (Constants.ELEM_POLICY.equals(qn.getLocalPart())) { operator.addPolicyComponent(getPolicyOperator(childElement)); } else if (Constants.ELEM_EXACTLYONE.equals(qn.getLocalPart())) { operator.addPolicyComponent(getExactlyOneOperator(childElement)); } else if (Constants.ELEM_ALL.equals(qn.getLocalPart())) { operator.addPolicyComponent(getAllOperator(childElement)); } else if (Constants.ELEM_POLICY_REF.equals(qn.getLocalPart())) { operator.addPolicyComponent(getPolicyReference(childElement)); } else { operator.addPolicyComponent(factory.build(childElement)); } } else { operator.addPolicyComponent(factory.build(childElement)); } } return operator; } protected void notifyUnknownPolicyElement(Object childElement) { //NO-Op - subclass could log or throw exception or something } } ./src/org/apache/neethi/util/0000775000175000017500000000000011767656530015235 5ustar brianbrian./src/org/apache/neethi/util/Service.java0000664000175000017500000001234511767656530017505 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; /** * This class handles looking up service providers on the class path. * It implements the system described in: * * JAR * File Specification Under Service Provider. Note that this * interface is very similar to the one they describe which seems to * be missing in the JDK. * * @author Thomas DeWeese * @version $Id$ */ public final class Service { // Remember providers we have looked up before. static Map> instanceMap = new HashMap>(); private Service() { //not constructed } @SuppressWarnings("unchecked") private static List cast(List p) { return (List)p; } /** * Returns an iterator where each element should implement the * interface (or subclass the baseclass) described by cls. The * Classes are found by searching the classpath for service files * named: 'META-INF/services/<fully qualified classname> that list * fully qualified classnames of classes that implement the * service files classes interface. These classes must have * default constructors. * * @param cls The class/interface to search for providers of. */ public static synchronized List providers(Class cls) { String serviceFile = "META-INF/services/" + cls.getName(); List l = cast(instanceMap.get(serviceFile)); if (l != null) { return l; } l = new ArrayList(); instanceMap.put(serviceFile, l); ClassLoader cl = null; try { cl = cls.getClassLoader(); } catch (SecurityException se) { // Ooops! can't get his class loader. } // Can always request your own class loader. But it might be 'null'. if (cl == null) { cl = Service.class.getClassLoader(); } if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } // No class loader so we can't find 'serviceFile'. if (cl == null) { return l; } Enumeration e; try { e = cl.getResources(serviceFile); } catch (IOException ioe) { return l; } while (e.hasMoreElements()) { InputStream is = null; try { URL u = e.nextElement(); is = u.openStream(); Reader r = new InputStreamReader(is, "UTF-8"); BufferedReader br = new BufferedReader(r); String line = br.readLine(); while (line != null) { try { // First strip any comment... int idx = line.indexOf('#'); if (idx != -1) { line = line.substring(0, idx); } // Trim whitespace. line = line.trim(); // If nothing left then loop around... if (line.length() == 0) { line = br.readLine(); continue; } // Try and load the class Object obj = cl.loadClass(line).newInstance(); // stick it into our vector... l.add(cls.cast(obj)); } catch (Exception ex) { // Just try the next line } line = br.readLine(); } } catch (Exception ex) { // Just try the next file... } catch (LinkageError le) { // Just try the next file... } finally { try { if (is != null) { is.close(); } } catch (IOException ex) { //ignore } } } return l; } }./src/org/apache/neethi/util/PolicyIntersector.java0000664000175000017500000001700711767656530021566 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.util; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.apache.neethi.All; import org.apache.neethi.Assertion; import org.apache.neethi.ExactlyOne; import org.apache.neethi.IntersectableAssertion; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyContainingAssertion; /** * This class contains methods dealing with policy intersection. * Intersection of two assertions, i.e. computation if a compatible assertion, * is domain specific and relies on AssertionBuilder.buildCompatible. * See Section 4.5 in http://www.w3.org/TR/2006/WD-ws-policy-20061117. */ public class PolicyIntersector { private boolean strict; public PolicyIntersector() { strict = true; } public PolicyIntersector(boolean s) { strict = s; } public boolean isStrict() { return strict; } public void setStrict(boolean s) { strict = s; } private Assertion intersect(Assertion a1, Assertion a2) { if (a1 instanceof IntersectableAssertion) { if (!((IntersectableAssertion)a1).isCompatible(a2, strict)) { return null; } return ((IntersectableAssertion)a1).intersect(a2, strict); } //the assertion doesn't implement IntersectableAssertion so we //need to try doing a basic intersect ourself if (a1.getName().equals(a2.getName())) { if (a1 instanceof PolicyContainingAssertion && a2 instanceof PolicyContainingAssertion) { PolicyContainingAssertion pc1 = (PolicyContainingAssertion)a1; PolicyContainingAssertion pc2 = (PolicyContainingAssertion)a2; Policy p1 = pc1.getPolicy(); Policy p2 = pc2.getPolicy(); PolicyIntersector pi = new PolicyIntersector(strict); if (pi.compatiblePolicies(p1, p2)) { return a1; } } else { return a1; } } return null; } private Assertion findCompatibleAssertion(Assertion assertion, Collection alt, boolean remove) { Iterator iterator = alt.iterator(); while (iterator.hasNext()) { PolicyComponent a = iterator.next(); if (a instanceof Assertion) { Assertion compatible = intersect(assertion, (Assertion)a); if (null != compatible) { if (remove) { iterator.remove(); } return compatible; } } } return null; } boolean compatibleAlternatives(Collection alt1, Collection alt2) { if (alt1.isEmpty() && alt2.isEmpty()) { return true; } All all = createCompatibleAlternatives(alt1, alt2, true); if (all == null) { return false; } return !all.getAssertions().isEmpty(); } All createCompatibleAlternatives(Collection alt1, Collection alt2, boolean remove) { All all = new All(); if (alt1.isEmpty() && alt2.isEmpty()) { return all; } alt1 = new ArrayList(alt1); alt2 = new ArrayList(alt2); Iterator iterator = alt1.iterator(); while (iterator.hasNext()) { PolicyComponent a1 = iterator.next(); if (a1 instanceof Assertion) { Assertion assertion = findCompatibleAssertion((Assertion)a1, alt2, remove); if (assertion != null) { if (remove) { iterator.remove(); } all.addPolicyComponent(assertion); } else if (!strict && ((Assertion)a1).isIgnorable()) { all.addPolicyComponent(a1); } else if (strict || !((Assertion)a1).isIgnorable()) { return null; } } } iterator = alt2.iterator(); while (iterator.hasNext()) { PolicyComponent a2 = iterator.next(); if (a2 instanceof Assertion) { Assertion assertion = findCompatibleAssertion((Assertion)a2, alt1, remove); if (assertion != null) { all.addPolicyComponent(assertion); } else if (!strict && ((Assertion)a2).isIgnorable()) { all.addPolicyComponent(a2); } else if (strict || !((Assertion)a2).isIgnorable()) { return null; } } } return all; } public boolean compatiblePolicies(Policy p1, Policy p2) { Iterator> i1 = p1.getAlternatives(); while (i1.hasNext()) { List alt1 = i1.next(); Iterator> i2 = p2.getAlternatives(); if (!i2.hasNext() && alt1.isEmpty()) { return true; } while (i2.hasNext()) { List alt2 = i2.next(); if (compatibleAlternatives(alt1, alt2)) { return true; } } return false; } return true; } public Policy intersect(Policy p1, Policy p2) { return intersect(p1, p2, false); } public Policy intersect(Policy p1, Policy p2, boolean allowDups) { Policy compatible = new Policy(p1.getPolicyRegistry(), p1.getNamespace()); ExactlyOne eo = new ExactlyOne(compatible); if (!compatiblePolicies(p1, p2)) { return compatible; } Iterator> i1 = p1.getAlternatives(); while (i1.hasNext()) { List alt1 = i1.next(); Iterator> i2 = p2.getAlternatives(); while (i2.hasNext()) { List alt2 = i2.next(); All all = createCompatibleAlternatives(alt1, alt2, !allowDups); if (all != null) { eo.addPolicyComponent(all); } } } return compatible; } } ./src/org/apache/neethi/util/PolicyComparator.java0000664000175000017500000001116711767656530021375 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.util; import java.util.List; import org.apache.neethi.All; import org.apache.neethi.Assertion; import org.apache.neethi.ExactlyOne; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; /** * A Utility class that provides methods the check the equality of * PolicyComponents. * */ public final class PolicyComparator { private PolicyComparator() { //utility class } /** * Returns true if the two policies have the same semantics * * @param arg1 * a Policy * @param arg2 * an another Policy * @return true if both policies have the same semantics */ public static boolean compare(Policy arg1, Policy arg2) { // check Name attributes of each policies if (arg1.getName() != null) { if (arg2.getName() != null) { arg1.getName().equals(arg2.getName()); } else { return false; } } else { if (arg2.getName() != null) { return false; } } if (arg1.getNamespace() != null && !arg1.getNamespace().equals(arg2.getNamespace())) { return false; } // check Id attributes of each policies if (arg1.getId() != null) { if (arg2.getId() != null) { arg1.getId().equals(arg2.getId()); } else { return false; } } else { if (arg2.getId() != null) { return false; } } return compare(arg1.getPolicyComponents(), arg2.getPolicyComponents()); } /** * Returns true if the two PolicyComponents have the same * semantics. * * @param arg1 * a PolicyComponent * @param arg2 * an another PolicyComponent * @return true if both PolicyComponents have the same semantics */ public static boolean compare(PolicyComponent arg1, PolicyComponent arg2) { if (!arg1.getClass().equals(arg2.getClass())) { return false; } if (arg1 instanceof Policy) { return compare((Policy) arg1, (Policy) arg2); } else if (arg1 instanceof All) { return compare((All) arg1, (All) arg2); } else if (arg1 instanceof ExactlyOne) { return compare((ExactlyOne) arg1, (ExactlyOne) arg2); } else if (arg1 instanceof Assertion) { return compare((Assertion) arg1, (Assertion) arg2); } else { // TODO should I throw an exception .. } return false; } public static boolean compare(All arg1, All arg2) { return compare(arg1.getPolicyComponents(), arg2.getPolicyComponents()); } public static boolean compare(ExactlyOne arg1, ExactlyOne arg2) { return compare(arg1.getPolicyComponents(), arg2.getPolicyComponents()); } public static boolean compare(Assertion arg1, Assertion arg2) { if (!(arg1.getName().equals(arg2.getName()))) { return false; } return true; } private static boolean compare(List arg1, List arg2) { if (arg1.size() != arg2.size()) { return false; } for (PolicyComponent assertion1 : arg1) { boolean match = false; for (PolicyComponent assertion2 : arg2) { if (compare(assertion1, assertion2)) { match = true; break; } } if (!match) { return false; } } return true; } } ./src/org/apache/neethi/Constants.java0000664000175000017500000001365611767656530017112 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * Constants contains the set of Constants that are used throughout the Neethi2 * framework. * */ public final class Constants { public static final String ATTR_NAME = "Name"; public static final String ATTR_ID = "Id"; public static final String ATTR_WSP = "wsp"; public static final String ATTR_WSU = "wsu"; public static final String ATTR_URI = "URI"; // The WS-Policy namespaces that we support public static final String URI_POLICY_13_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy"; public static final String URI_POLICY_15_DEPRECATED_NS = "http://www.w3.org/2006/07/ws-policy"; public static final String URI_POLICY_15_NS = "http://www.w3.org/ns/ws-policy"; // Default will be WS-Policy 1.5 public static final String URI_POLICY_NS = URI_POLICY_15_NS; public static final String URI_WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; public static final String ELEM_POLICY = "Policy"; public static final String ELEM_EXACTLYONE = "ExactlyOne"; public static final String ELEM_ALL = "All"; public static final String ELEM_POLICY_REF = "PolicyReference"; public static final String ELEM_POLICY_ATTACHMENT = "PolicyAttachment"; public static final short TYPE_POLICY = 0x1; public static final short TYPE_EXACTLYONE = 0x2; public static final short TYPE_ALL = 0x3; public static final short TYPE_POLICY_REF = 0x4; public static final short TYPE_ASSERTION = 0x5; public static final String ATTR_OPTIONAL = "Optional"; public static final String ATTR_IGNORABLE = "Ignorable"; public static final String ATTR_POLICYURIS = "PolicyURIs"; public static final String ELEM_POLICY_APPLIES_TO = "AppliesTo"; public static final QName Q_ELEM_POLICY = new QName(Constants.URI_POLICY_13_NS, Constants.ELEM_POLICY, Constants.ATTR_WSP); public static final QName Q_ELEM_POLICY_15 = new QName(Constants.URI_POLICY_15_NS, Constants.ELEM_POLICY, Constants.ATTR_WSP); public static final QName Q_ELEM_OPTIONAL_ATTR = new QName(Constants.URI_POLICY_13_NS, "Optional", Constants.ATTR_WSP); public static final QName Q_ELEM_OPTIONAL_15_ATTR = new QName(Constants.URI_POLICY_15_NS, "Optional", Constants.ATTR_WSP); public static final QName Q_ELEM_IGNORABLE_15_ATTR = new QName(Constants.URI_POLICY_15_NS, "Ignorable", Constants.ATTR_WSP); private Constants() { //utility class, never constructed } /** * Check if the given namespace URI refers to one of the supported WS-Policy versions. * * @param ns * the namespace URI * @return true if the specification identified by the namespace URI is supported * by Neethi, false if it is null or not supported */ public static boolean isPolicyNS(String ns) { return URI_POLICY_13_NS.equals(ns) || URI_POLICY_15_DEPRECATED_NS.equals(ns) || URI_POLICY_15_NS.equals(ns); } public static boolean isInPolicyNS(QName q) { return isPolicyNS(q.getNamespaceURI()); } public static boolean isPolicyElement(String ns, String local) { return isPolicyNS(ns) && ELEM_POLICY.equals(local); } public static boolean isPolicyElement(QName q) { return isInPolicyNS(q) && ELEM_POLICY.equals(q.getLocalPart()); } public static boolean isPolicyRef(String ns, String local) { return isPolicyNS(ns) && ELEM_POLICY_REF.equals(local); } public static boolean isPolicyRef(QName q) { return isInPolicyNS(q) && ELEM_POLICY_REF.equals(q.getLocalPart()); } public static boolean isOptionalAttribute(QName qn) { return ATTR_OPTIONAL.equals(qn.getLocalPart()) && Constants.isInPolicyNS(qn); } public static boolean isIgnorableAttribute(QName qn) { return ATTR_IGNORABLE.equals(qn.getLocalPart()) && Constants.isInPolicyNS(qn); } public static boolean isAppliesToElem(QName qn) { return ELEM_POLICY_APPLIES_TO.equals(qn.getLocalPart()) && Constants.isInPolicyNS(qn); } public static boolean isPolicyURIsAttr(QName qn) { return ATTR_POLICYURIS.equals(qn.getLocalPart()) && Constants.isInPolicyNS(qn); } //Try and figure out if we are outputting 1.5 or 1.2 policy //kind of a hack. Would be better to add a "version" to the serialize method, //but that would be incompatible public static String findPolicyNamespace(XMLStreamWriter writer) throws XMLStreamException { String prefix = writer.getPrefix(Constants.URI_POLICY_15_NS); if (prefix == null || "".equals(prefix)) { prefix = writer.getPrefix(Constants.URI_POLICY_15_DEPRECATED_NS); } if (prefix == null || "".equals(prefix)) { return Constants.URI_POLICY_13_NS; } return Constants.URI_POLICY_NS; } } ./src/org/apache/neethi/builders/0000775000175000017500000000000011767656530016071 5ustar brianbrian./src/org/apache/neethi/builders/converters/0000775000175000017500000000000011767656530020263 5ustar brianbrian./src/org/apache/neethi/builders/converters/Converter.java0000664000175000017500000000322411767656530023076 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; /** * A converter is used to convert from a particular source of * Policy information into a form usable by a registered builder. * * It also contains methods for obtaining information about the * current element while being processed. */ public interface Converter { QName getQName(S s); Map getAttributes(S s); Iterator getChildren(S s); /** * * @param s * @return the result of the conversion; may not be null * @throws ConverterException * if the conversion fails; note that to indicate a failure, the method may throw * other unchecked exceptions specific to the APIs involved in the conversion */ T convert(S s); } ./src/org/apache/neethi/builders/converters/ConverterException.java0000664000175000017500000000246611767656530024764 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; /** * Thrown to indicate that conversion from one XML object model to another failed. */ public class ConverterException extends RuntimeException { private static final long serialVersionUID = 1156276815855954750L; public ConverterException(String message, Throwable cause) { super(message, cause); } public ConverterException(String message) { super(message); } public ConverterException(Throwable cause) { super(cause); } } ./src/org/apache/neethi/builders/converters/OMToDOMConverter.java0000664000175000017500000000302211767656530024171 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import org.w3c.dom.Element; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.dom.DOOMAbstractFactory; /** * */ public class OMToDOMConverter extends AbstractOMConverter implements Converter { public Element convert(OMElement s) { try { return (Element) new StAXOMBuilder(DOOMAbstractFactory.getOMFactory(), s.getXMLStreamReader()).getDocumentElement(); } catch (NoClassDefFoundError err) { // likely no DOOM return new StaxToDOMConverter().convert(s.getXMLStreamReader()); } } } ./src/org/apache/neethi/builders/converters/ConverterRegistry.java0000664000175000017500000001336711767656530024640 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.lang.reflect.ParameterizedType; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import javax.xml.namespace.QName; /** * Contains a registry of Converters. * * By default, there are converters to convert back and forth * between DOM Elements and XMLStreamReaders. If Axiom * is available, converters are also registered to convert * from those format to/from OMElements. */ public class ConverterRegistry { private static class ConverterKey { Class src; Class target; Converter converter; } private List registeredConverters = new CopyOnWriteArrayList(); public ConverterRegistry() { //built into JDK stuff, should have no problem registerConverter(new DOMToDOMConverter()); registerConverter(new StaxToStaxConverter()); registerConverter(new StaxToDOMConverter()); registerConverter(new DOMToStaxConverter()); //requires Axiom, may have an issue registerConverter("org.apache.neethi.builders.converters.DOMToOMConverter"); registerConverter("org.apache.neethi.builders.converters.OMToDOMConverter"); registerConverter("org.apache.neethi.builders.converters.OMToOMConverter"); registerConverter("org.apache.neethi.builders.converters.StaxToOMConverter"); registerConverter("org.apache.neethi.builders.converters.OMToStaxConverter"); } private void registerConverter(String name) { try { Converter c = (Converter)Class.forName(name, true, Converter.class.getClassLoader()).newInstance(); registerConverter(c); } catch (Throwable e) { //likely due to Axiom not available, we're OK with that. There //won't be any builders registered that require Axiom if //axiom isn't avilable anyway } } private static ConverterKey createConverterKey(Converter converter, Class c) { Class interfaces[] = c.getInterfaces(); for (int x = 0; x < interfaces.length; x++) { if (interfaces[x] == Converter.class) { ParameterizedType pt = (ParameterizedType)c.getGenericInterfaces()[x]; ConverterKey key = new ConverterKey(); key.src = (Class)pt.getActualTypeArguments()[0]; key.target = (Class)pt.getActualTypeArguments()[1]; key.converter = converter; return key; } } if (c.getSuperclass() != null) { return createConverterKey(converter, c.getSuperclass()); } return null; } public final void registerConverter(Converter converter) { ConverterKey key = createConverterKey(converter, converter.getClass()); registeredConverters.add(key); } public QName findQName(Object element) { ConverterKey key = findCompatibleConverter(element); try { return (QName)key.converter.getClass().getMethod("getQName", key.src) .invoke(key.converter, element); } catch (Exception e) { e.printStackTrace(); return null; } } @SuppressWarnings("unchecked") public Map getAttributes(Object element) { ConverterKey key = findCompatibleConverter(element); try { return (Map)key.converter.getClass().getMethod("getAttributes", key.src) .invoke(key.converter, element); } catch (Exception e) { e.printStackTrace(); return null; } } @SuppressWarnings("unchecked") public Iterator getChildElements(Object element) { ConverterKey key = findCompatibleConverter(element); try { return (Iterator)key.converter.getClass().getMethod("getChildren", key.src) .invoke(key.converter, element); } catch (Exception e) { e.printStackTrace(); return null; } } @SuppressWarnings("unchecked") public Object convert(Object src, Class target) { for (ConverterKey ent : registeredConverters) { if (ent.src.isInstance(src) && ent.target.isAssignableFrom(target)) { return ent.converter.convert(src); } } throw new RuntimeException("Could not find a converter to convert from " + src.getClass() + " to " + target); } private ConverterKey findCompatibleConverter(Object element) { for (ConverterKey ent : registeredConverters) { if (ent.src.isInstance(element)) { return ent; } } throw new RuntimeException("Could not find a converter to handle " + element.getClass()); } } ./src/org/apache/neethi/builders/converters/DOMToDOMConverter.java0000664000175000017500000000205411767656530024301 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import org.w3c.dom.Element; /** * */ public class DOMToDOMConverter extends AbstractDOMConverter implements Converter { public Element convert(Element s) { return s; } } ./src/org/apache/neethi/builders/converters/StaxToOMConverter.java0000664000175000017500000000253511767656530024501 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLBuilderFactory; /** * */ public class StaxToOMConverter extends AbstractStaxConverter implements Converter { public OMElement convert(XMLStreamReader s) { return OMXMLBuilderFactory .createStAXOMBuilder(OMAbstractFactory.getOMFactory(), s) .getDocumentElement(); } } ./src/org/apache/neethi/builders/converters/AbstractDOMConverter.java0000664000175000017500000000402711767656530025124 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * */ public abstract class AbstractDOMConverter { public QName getQName(Element s) { return new QName(s.getNamespaceURI(), s.getLocalName()); } public Map getAttributes(Element s) { Map mp = new HashMap(); NamedNodeMap attrs = s.getAttributes(); for (int x = 0; x < attrs.getLength(); x++) { Attr attr = (Attr)attrs.item(x); mp.put(new QName(attr.getNamespaceURI(), attr.getLocalName()), attr.getValue()); } return mp; } public Iterator getChildren(Element s) { List children = new LinkedList(); Node nd = s.getFirstChild(); while (nd != null) { if (nd instanceof Element) { children.add((Element)nd); } nd = nd.getNextSibling(); } return children.listIterator(); } } ./src/org/apache/neethi/builders/converters/OMToStaxConverter.java0000664000175000017500000000221011767656530024467 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.om.OMElement; /** * */ public class OMToStaxConverter extends AbstractOMConverter implements Converter { public XMLStreamReader convert(OMElement s) { return s.getXMLStreamReader(); } } ./src/org/apache/neethi/builders/converters/AbstractOMConverter.java0000664000175000017500000000405211767656530025016 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; /** * */ public abstract class AbstractOMConverter { public QName getQName(OMElement s) { if (s.getNamespace() == null) { return new QName(s.getLocalName()); } return new QName(s.getNamespace().getNamespaceURI(), s.getLocalName()); } public Map getAttributes(OMElement s) { Map mp = new HashMap(); Iterator it = s.getAllAttributes(); while (it.hasNext()) { OMAttribute attr = (OMAttribute)it.next(); if (attr.getNamespace() == null) { mp.put(new QName("", attr.getLocalName()), attr.getAttributeValue()); } else { mp.put(new QName(attr.getNamespace().getNamespaceURI(), attr.getLocalName()), attr.getAttributeValue()); } } return mp; } @SuppressWarnings("unchecked") public Iterator getChildren(OMElement el) { return el.getChildElements(); } } ./src/org/apache/neethi/builders/converters/StaxToStaxConverter.java0000664000175000017500000000213311767656530025077 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import javax.xml.stream.XMLStreamReader; /** * */ public class StaxToStaxConverter extends AbstractStaxConverter implements Converter { public XMLStreamReader convert(XMLStreamReader s) { return s; } } ./src/org/apache/neethi/builders/converters/OMToOMConverter.java0000664000175000017500000000206611767656530024074 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import org.apache.axiom.om.OMElement; /** * */ public class OMToOMConverter extends AbstractOMConverter implements Converter { public OMElement convert(OMElement s) { return s; } } ./src/org/apache/neethi/builders/converters/StaxToDOMConverter.java0000664000175000017500000001240611767656530024603 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.util.Stack; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * */ public class StaxToDOMConverter extends AbstractStaxConverter implements Converter { public Element convert(XMLStreamReader reader) { try { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); readDocElements(doc, doc, reader); return doc.getDocumentElement(); } catch (ParserConfigurationException ex) { throw new ConverterException(ex); } catch (XMLStreamException ex) { throw new ConverterException(ex); } } public static void readDocElements(Document doc, Node parent, XMLStreamReader reader) throws XMLStreamException { Stack stack = new Stack(); int event = reader.getEventType(); while (reader.hasNext()) { switch (event) { case XMLStreamConstants.START_ELEMENT: { Element e = doc.createElementNS(reader.getNamespaceURI(), reader.getLocalName()); if (reader.getPrefix() != null) { e.setPrefix(reader.getPrefix()); } e = (Element)parent.appendChild(e); for (int ns = 0; ns < reader.getNamespaceCount(); ns++) { String uri = reader.getNamespaceURI(ns); String prefix = reader.getNamespacePrefix(ns); declare(e, uri, prefix); } for (int att = 0; att < reader.getAttributeCount(); att++) { String name = reader.getAttributeLocalName(att); String prefix = reader.getAttributePrefix(att); if (prefix != null && prefix.length() > 0) { name = prefix + ":" + name; } Attr attr = doc.createAttributeNS(reader.getAttributeNamespace(att), name); attr.setValue(reader.getAttributeValue(att)); e.setAttributeNode(attr); } stack.push(parent); parent = e; break; } case XMLStreamConstants.END_ELEMENT: if (stack.isEmpty()) { return; } parent = stack.pop(); if (parent instanceof Document) { return; } break; case XMLStreamConstants.NAMESPACE: break; case XMLStreamConstants.ATTRIBUTE: break; case XMLStreamConstants.CHARACTERS: if (parent != null) { parent.appendChild(doc.createTextNode(reader.getText())); } break; case XMLStreamConstants.COMMENT: if (parent != null) { parent.appendChild(doc.createComment(reader.getText())); } break; case XMLStreamConstants.CDATA: parent.appendChild(doc.createCDATASection(reader.getText())); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData())); break; case XMLStreamConstants.ENTITY_REFERENCE: parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData())); break; default: break; } if (reader.hasNext()) { event = reader.next(); } } } private static void declare(Element node, String uri, String prefix) { String qualname; if (prefix != null && prefix.length() > 0) { qualname = "xmlns:" + prefix; } else { qualname = "xmlns"; } Attr attr = node.getOwnerDocument().createAttributeNS("http://www.w3.org/2000/xmlns/", qualname); attr.setValue(uri); node.setAttributeNodeNS(attr); } } ./src/org/apache/neethi/builders/converters/AbstractStaxConverter.java0000664000175000017500000000721111767656530025422 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * */ public abstract class AbstractStaxConverter { public QName getQName(XMLStreamReader s) { if (s.getEventType() == XMLStreamReader.START_DOCUMENT) { try { s.nextTag(); } catch (XMLStreamException e) { //ignore } } return new QName(s.getNamespaceURI(), s.getLocalName()); } public Map getAttributes(XMLStreamReader s) { Map mp = new HashMap(); for (int x = 0; x < s.getAttributeCount(); x++) { mp.put(new QName(s.getAttributeNamespace(x), s.getAttributeLocalName(x)), s.getAttributeValue(x)); } return mp; } public Iterator getChildren(final XMLStreamReader s) { final QName base = s.getName(); try { int evt = s.getEventType(); if (s.hasNext()) { evt = s.next(); } while (s.hasNext() && evt != XMLStreamReader.END_ELEMENT && evt != XMLStreamReader.START_ELEMENT) { evt = s.next(); } } catch (Exception ex) { return null; } return new Iterator() { boolean first = true; public boolean hasNext() { if (first) { first = false; return s.getEventType() != XMLStreamReader.END_ELEMENT; } try { int evt = s.next(); while (s.hasNext() && evt != XMLStreamReader.END_ELEMENT && evt != XMLStreamReader.START_ELEMENT) { evt = s.next(); } if (evt == XMLStreamReader.END_ELEMENT && !s.getName().equals(base)) { evt = s.next(); while (s.hasNext() && evt != XMLStreamReader.END_ELEMENT && evt != XMLStreamReader.START_ELEMENT) { evt = s.next(); } } return evt == XMLStreamReader.START_ELEMENT; } catch (Exception ex) { return false; } } public XMLStreamReader next() { return s; } public void remove() { throw new UnsupportedOperationException(); } }; } } ./src/org/apache/neethi/builders/converters/DOMToStaxConverter.java0000664000175000017500000000263511767656530024606 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Element; /** * */ public class DOMToStaxConverter extends AbstractDOMConverter implements Converter { public XMLStreamReader convert(Element s) { try { return XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(s)); } catch (XMLStreamException ex) { throw new ConverterException(ex); } } } ./src/org/apache/neethi/builders/converters/DOMToOMConverter.java0000664000175000017500000000237011767656530024176 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.converters; import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Element; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLBuilderFactory; /** * */ public class DOMToOMConverter extends AbstractDOMConverter implements Converter { public OMElement convert(Element s) { return OMXMLBuilderFactory.createOMBuilder(new DOMSource(s)).getDocumentElement(); } } ./src/org/apache/neethi/builders/PrimitiveAssertion.java0000664000175000017500000002031611767656530022576 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.neethi.All; import org.apache.neethi.Assertion; import org.apache.neethi.Constants; import org.apache.neethi.ExactlyOne; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; /** * */ public class PrimitiveAssertion implements Assertion { protected QName name; protected boolean optional; protected boolean ignorable; protected String textValue; protected Map attributes; public PrimitiveAssertion() { this((QName)null); } public PrimitiveAssertion(QName n) { this(n, false); } public PrimitiveAssertion(QName n, boolean o) { this(n, o, false); } public PrimitiveAssertion(QName n, boolean o, boolean i) { this(n, o, i, null, null); } public PrimitiveAssertion(QName n, boolean o, boolean i, Map atts) { this(n, o, i, atts, null); } public PrimitiveAssertion(QName n, boolean o, boolean i, Map atts, String value) { name = n; optional = o; ignorable = i; if (atts != null) { attributes = new HashMap(atts); } textValue = value; } public String getAttribute(QName n) { if (attributes != null) { return attributes.get(n); } return null; } public synchronized void addAttribute(QName n, String value) { if (attributes == null) { attributes = new HashMap(); } attributes.put(n, value); } public synchronized void addAttributes(Map atts) { if (attributes == null) { attributes = new HashMap(atts); } else { attributes.putAll(atts); } } public String getTextValue() { return textValue; } public void setTextValue(String s) { textValue = s; } public String toString() { return name.toString(); } public boolean equal(PolicyComponent policyComponent) { if (this == policyComponent) { return true; } if (policyComponent.getType() != Constants.TYPE_ASSERTION) { return false; } return getName().equals(((Assertion)policyComponent).getName()); } public short getType() { return Constants.TYPE_ASSERTION; } public QName getName() { return name; } public void setName(QName n) { name = n; } public boolean isOptional() { return optional; } public void setOptional(boolean o) { optional = o; } public boolean isIgnorable() { return ignorable; } public void setIgnorable(boolean i) { ignorable = i; } public PolicyComponent normalize() { if (isOptional()) { Policy policy = new Policy(); ExactlyOne exactlyOne = new ExactlyOne(); All all = new All(); all.addPolicyComponent(clone(false)); exactlyOne.addPolicyComponent(all); exactlyOne.addPolicyComponent(new All()); policy.addPolicyComponent(exactlyOne); return policy; } return clone(false); } public void serialize(XMLStreamWriter writer) throws XMLStreamException { String namespace = Constants.findPolicyNamespace(writer); String pfx = writer.getPrefix(name.getNamespaceURI()); boolean writeNS = false; if (pfx == null && name.getPrefix() != null && !"".equals(name.getPrefix())) { pfx = name.getPrefix(); writeNS = true; } if ("".equals(pfx) || pfx == null) { pfx = ""; writeNS = true; } if (!hasContents() && attributes == null && !writeNS) { writer.writeEmptyElement(pfx, name.getLocalPart(), name.getNamespaceURI()); return; } writer.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI()); if (writeNS) { if ("".equals(pfx) || pfx == null) { writer.writeDefaultNamespace(name.getNamespaceURI()); } else if (attributes == null || !attributes.containsKey(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, pfx))) { writer.writeNamespace(pfx, name.getNamespaceURI()); } } if (optional) { writer.writeAttribute(namespace, Constants.ATTR_OPTIONAL, "true"); } if (ignorable) { writer.writeAttribute(namespace, Constants.ATTR_IGNORABLE, "true"); } writeAttributes(writer); writeContents(writer); writer.writeEndElement(); } protected void writeContents(XMLStreamWriter writer) throws XMLStreamException { if (textValue != null) { writer.writeCharacters(textValue); } } protected boolean hasContents() { return textValue != null && !"".equals(textValue); } protected void writeAttributes(XMLStreamWriter writer) throws XMLStreamException { if (attributes != null) { for (Map.Entry att : attributes.entrySet()) { if (Constants.isIgnorableAttribute(att.getKey())) { //already handled continue; } if (Constants.isOptionalAttribute(att.getKey())) { //already handled continue; } if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(att.getKey().getNamespaceURI())) { writer.writeNamespace(att.getKey().getLocalPart(), att.getValue()); continue; } String ns = att.getKey().getNamespaceURI(); if (ns != null && !"".equals(ns)) { String prefix = getOrCreatePrefix(att.getKey().getNamespaceURI(), writer); writer.writeAttribute(prefix, att.getKey().getNamespaceURI(), att.getKey().getLocalPart(), att.getValue()); } else { writer.writeAttribute(att.getKey().getLocalPart(), att.getValue()); } } } } protected String getOrCreatePrefix(String ns, XMLStreamWriter writer) throws XMLStreamException { if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(ns)) { return null; } String prefix = writer.getPrefix(ns); int count = 1; while (prefix == null || "".equals(prefix)) { prefix = "ns" + count++; String ns2 = writer.getNamespaceContext().getNamespaceURI(prefix); if (ns2 == null || "".equals(ns2)) { //found one that will work writer.writeNamespace(prefix, ns); } else { prefix = null; } } return prefix; } protected Assertion clone(boolean isoptional) { return new PrimitiveAssertion(name, isoptional, ignorable, attributes, textValue); } }./src/org/apache/neethi/builders/xml/0000775000175000017500000000000011767656530016671 5ustar brianbrian./src/org/apache/neethi/builders/xml/XmlPrimitiveAssertion.java0000664000175000017500000001622611767656530024064 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.xml; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.Characters; import javax.xml.stream.events.Comment; import javax.xml.stream.events.Namespace; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.apache.neethi.All; import org.apache.neethi.Assertion; import org.apache.neethi.Constants; import org.apache.neethi.ExactlyOne; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.builders.PrimitiveAssertion; /** * XmlPrimitiveAssertion wraps an Element s.t. any unknown elements can be * treated an assertions if there is no AssertionBuilder that can build an * assertion from that Element. * */ public class XmlPrimitiveAssertion extends PrimitiveAssertion implements Assertion { protected Element element; /** * Constructs a XmlPrimitiveAssertion from an Element. * * @param element * the Element from which the XmlAssertion is constructed */ public XmlPrimitiveAssertion(Element element) { super(new QName(element.getNamespaceURI(), element.getLocalName()), XMLPrimitiveAssertionBuilder.isOptional(element), XMLPrimitiveAssertionBuilder.isIgnorable(element)); this.element = element; } /** * Sets the wrapped Element. * * @param element * the Element to be set as wrapped */ public void setValue(Element el) { this.element = el; } /** * Returns the wrapped Element. * * @return the wrapped Element */ public Element getValue() { return element; } /** * Returns the partial normalized version of the wrapped Element, that is * assumed to be an assertion. */ public PolicyComponent normalize() { if (optional) { Policy policy = new Policy(); ExactlyOne exactlyOne = new ExactlyOne(); All all = new All(); Element el = (Element)this.element.cloneNode(true); Attr attr = el.getAttributeNodeNS(Constants.URI_POLICY_13_NS, Constants.ATTR_OPTIONAL); if (attr != null) { el.removeAttributeNode(attr); } attr = el.getAttributeNodeNS(Constants.URI_POLICY_15_NS, Constants.ATTR_OPTIONAL); if (attr != null) { el.removeAttributeNode(attr); } all.addPolicyComponent(new XmlPrimitiveAssertion(el)); exactlyOne.addPolicyComponent(all); exactlyOne.addPolicyComponent(new All()); policy.addPolicyComponent(exactlyOne); return policy; } return this; } public void serialize(XMLStreamWriter writer) throws XMLStreamException { if (element != null) { copyEvents(XMLInputFactory.newInstance().createXMLEventReader(new DOMSource(element)), writer); } else { throw new RuntimeException("Wrapped Element is not set"); } } /** * Returns Constants.TYPE_ASSERTION */ public final short getType() { return Constants.TYPE_ASSERTION; } public boolean equal(PolicyComponent policyComponent) { if (policyComponent.getType() != Constants.TYPE_ASSERTION) { return false; } return getName().equals(((Assertion) policyComponent).getName()); } private void copyEvents(XMLEventReader reader, XMLStreamWriter writer) throws XMLStreamException { while (reader.hasNext()) { XMLEvent event = reader.nextEvent(); switch (event.getEventType()) { case XMLEvent.ATTRIBUTE: { Attribute attr = (Attribute) event; QName name = attr.getName(); writer.writeAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), attr.getValue()); break; } case XMLEvent.START_DOCUMENT: case XMLEvent.END_DOCUMENT: //not doing this as we're in a partial write mode break; case XMLEvent.END_ELEMENT: writer.writeEndElement(); break; case XMLEvent.NAMESPACE: { Namespace ns = (Namespace) event; writer.writeNamespace(ns.getPrefix(), ns.getNamespaceURI()); break; } case XMLEvent.START_ELEMENT: { StartElement se = event.asStartElement(); QName n = se.getName(); writer.writeStartElement(n.getPrefix(), n.getLocalPart(), n.getNamespaceURI()); Iterator it = se.getNamespaces(); while (it.hasNext()) { Namespace ns = (Namespace) it.next(); writer.writeNamespace(ns.getPrefix(), ns.getNamespaceURI()); } it = se.getAttributes(); while (it.hasNext()) { Attribute attr = (Attribute) it.next(); QName name = attr.getName(); writer.writeAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), attr.getValue()); } break; } case XMLEvent.CHARACTERS: { Characters ch = event.asCharacters(); String text = ch.getData(); if (ch.isCData()) { writer.writeCData(text); } else { writer.writeCharacters(text); } break; } case XMLEvent.CDATA: writer.writeCData(event.asCharacters().getData()); break; case XMLEvent.COMMENT: writer.writeComment(((Comment) event).getText()); break; default: } } } } ./src/org/apache/neethi/builders/xml/XMLPrimitiveAssertionBuilder.java0000664000175000017500000001146011767656530025266 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders.xml; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.apache.neethi.Assertion; import org.apache.neethi.AssertionBuilderFactory; import org.apache.neethi.Constants; import org.apache.neethi.Policy; import org.apache.neethi.builders.AssertionBuilder; import org.apache.neethi.builders.PolicyContainingPrimitiveAssertion; import org.apache.neethi.builders.PrimitiveAssertion; public class XMLPrimitiveAssertionBuilder implements AssertionBuilder { public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException { Node nd = element.getFirstChild(); int count = 0; int policyCount = 0; Element policyEl = null; while (nd != null) { if (nd instanceof Element) { count++; Element el = (Element)nd; if (Constants.isPolicyElement(el.getNamespaceURI(), el.getLocalName())) { policyEl = el; policyCount++; } } nd = nd.getNextSibling(); } Map atts = new HashMap(); NamedNodeMap attrs = element.getAttributes(); if (attrs != null) { for (int x = 0; x < attrs.getLength(); x++) { Attr attr = (Attr)attrs.item(x); atts.put(new QName(attr.getNamespaceURI(), attr.getLocalName()), attr.getValue()); } } if (count == 0) { return newPrimitiveAssertion(element, atts.isEmpty() ? null : atts); } else if (policyCount == 1 && count == 1) { Policy policy = factory.getPolicyEngine().getPolicy(policyEl); return newPolicyContainingAssertion(element, atts.isEmpty() ? null : atts, policy); } return new XmlPrimitiveAssertion(element); } protected QName getQName(Element element) { if (element.getPrefix() == null) { return new QName(element.getNamespaceURI(), element.getLocalName()); } return new QName(element.getNamespaceURI(), element.getLocalName(), element.getPrefix()); } public Assertion newPrimitiveAssertion(Element element, Map atts) { return new PrimitiveAssertion(getQName(element), isOptional(element), isIgnorable(element), atts, element.getTextContent()); } public Assertion newPolicyContainingAssertion(Element element, Map atts, Policy policy) { return new PolicyContainingPrimitiveAssertion(getQName(element), isOptional(element), isIgnorable(element), policy); } public static boolean isOptional(Element el) { Attr optional = el.getAttributeNodeNS(Constants.URI_POLICY_13_NS, Constants.ATTR_OPTIONAL); if (optional == null) { optional = el.getAttributeNodeNS(Constants.URI_POLICY_15_NS, Constants.ATTR_OPTIONAL); } if (optional == null) { optional = el.getAttributeNodeNS(Constants.URI_POLICY_15_DEPRECATED_NS, Constants.ATTR_OPTIONAL); } return optional == null ? false : Boolean.parseBoolean(optional.getValue()); } public static boolean isIgnorable(Element el) { Attr ignorable = el.getAttributeNodeNS(Constants.URI_POLICY_15_NS, Constants.ATTR_IGNORABLE); if (ignorable == null) { ignorable = el.getAttributeNodeNS(Constants.URI_POLICY_15_DEPRECATED_NS, Constants.ATTR_IGNORABLE); } return ignorable == null ? false : Boolean.parseBoolean(ignorable.getValue()); } public QName[] getKnownElements() { return new QName[] {new QName("UnknownElement")}; } } ./src/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java0000664000175000017500000001036711767656530025775 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.neethi.All; import org.apache.neethi.Assertion; import org.apache.neethi.Constants; import org.apache.neethi.ExactlyOne; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyContainingAssertion; /** * Implementation of an assertion that required exactly one (possibly empty) child element * of type Policy (as does for examples the wsam:Addressing assertion). * */ public class PolicyContainingPrimitiveAssertion extends PrimitiveAssertion implements PolicyContainingAssertion { protected Policy nested; public PolicyContainingPrimitiveAssertion(QName name, boolean optional, boolean ignorable, Policy p) { super(name, optional, ignorable); this.nested = p; } public PolicyContainingPrimitiveAssertion(QName name, boolean optional, boolean ignorable, Map atts, Policy p) { super(name, optional, ignorable, atts); this.nested = p; } public PolicyComponent normalize() { Policy normalisedNested = (Policy)nested.normalize(true); Policy p = new Policy(nested.getPolicyRegistry(), nested.getNamespace()); ExactlyOne ea = new ExactlyOne(); p.addPolicyComponent(ea); if (isOptional()) { ea.addPolicyComponent(new All()); } // for all alternatives in normalized nested policy Iterator> alternatives = normalisedNested.getAlternatives(); while (alternatives.hasNext()) { All all = new All(); List alternative = alternatives.next(); Policy n = new Policy(nested.getPolicyRegistry(), nested.getNamespace()); Assertion a = clone(false, n); ExactlyOne nea = new ExactlyOne(); n.addPolicyComponent(nea); All na = new All(); nea.addPolicyComponent(na); na.addPolicyComponents(alternative); all.addPolicyComponent(a); ea.addPolicyComponent(all); } return p; } protected Assertion clone(boolean optional, Policy n) { return new PolicyContainingPrimitiveAssertion(name, optional, ignorable, attributes, n); } public boolean equal(PolicyComponent policyComponent) { if (this == policyComponent) { return true; } if (!super.equal(policyComponent)) { return false; } PolicyContainingPrimitiveAssertion other = (PolicyContainingPrimitiveAssertion)policyComponent; return getPolicy().equal(other.getPolicy()); } public void setPolicy(Policy n) { nested = n; } public Policy getPolicy() { return nested; } protected void writeContents(XMLStreamWriter writer) throws XMLStreamException { nested.serialize(writer); } protected boolean hasContents() { return true; } } ./src/org/apache/neethi/builders/AssertionBuilder.java0000664000175000017500000000530411767656530022214 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi.builders; import javax.xml.namespace.QName; import org.apache.neethi.Assertion; import org.apache.neethi.AssertionBuilderFactory; /** * AssertionBuilder is the interface which must implement by any * CustomAssertionBuilder. It defines a single method which takes an element * definitionand an AssertionFactory instance and creates an Assertion. The * AssertionBuilder must use one of the types for which there is a * Converter registered. By default, that would be either an Element, * and XMLStreamReader, or OMElement (if Axiom is available). * Custom AssertionBuilder authors can use the AssertionFactory * specified to build Assertions for any unknown elements inside the given * element. They are given the opportunity to control the behavior of * Assertion operations based on the corresponding domain policy assertion of * the given element and the level of its processing. * */ public interface AssertionBuilder { /** * Constructs an assertion from a known element. If that element contains * other child elements that the Builder doesn't understand, it uses the * AssertionBuilderFactory to construct assertions from them. * * @param element * the known element from which an assertion can be built * @param factory * the factory from which AssertionBuilders are taken to build * assertion from unknown child elements * @return an Assertion built from the given element * @throws IllegalArgumentException * if the given element is malformed */ Assertion build(T element, AssertionBuilderFactory factory) throws IllegalArgumentException; /** * Returns an array of QNames of elements from which assertion can be * built by this AssertionFactory. * * @return an array of QNames of known elements */ QName[] getKnownElements(); } ./src/org/apache/neethi/ExactlyOne.java0000664000175000017500000000437411767656530017206 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.Iterator; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * ExactlyOne PolicyOperator requires exactly one of its PolicyComponents to be * met. * */ public class ExactlyOne extends AbstractPolicyOperator { public ExactlyOne() { super(); } public ExactlyOne(PolicyOperator parent) { super(parent); } public void serialize(XMLStreamWriter writer) throws XMLStreamException { String namespace = Constants.findPolicyNamespace(writer); String prefix = writer.getPrefix(namespace); if (prefix == null) { writer.writeStartElement(Constants.ATTR_WSP, Constants.ELEM_EXACTLYONE, namespace); writer.writeNamespace(Constants.ATTR_WSP, namespace); writer.setPrefix(Constants.ATTR_WSP, namespace); } else { writer.writeStartElement(namespace, Constants.ELEM_EXACTLYONE); } PolicyComponent policyComponent; for (Iterator iterator = getPolicyComponents().iterator(); iterator .hasNext();) { policyComponent = (PolicyComponent) iterator.next(); policyComponent.serialize(writer); } writer.writeEndElement(); } /** * Returns Constants.TYPE_EXACTLYONE; */ public final short getType() { return Constants.TYPE_EXACTLYONE; } } ./src/org/apache/neethi/PolicyOperator.java0000664000175000017500000000331411767656530020077 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.List; /** * PolicyOperator is an interface that all Policy operators must implement. It * can contain any number of Assertions or PolicyOperators and it has an * Implicit logic of how those PolicyComponents should be met. * */ public interface PolicyOperator extends PolicyComponent { /** * Add a PolicyComponent to the PolicyOperator. * * @param component */ void addPolicyComponent(PolicyComponent component); /** * Returns a List of PolicyComponents which this PolicyOperator contains. * * @return the List of PolicyComponents that this PolicyOperator contains. */ List getPolicyComponents(); /** * Returns true if the PolicyOperator doesn't contain any PolicyComponents. * * @return true if this PolicyOperator doesn't contain any PolicyComponenets */ boolean isEmpty(); } ./src/org/apache/neethi/AssertionBuilderFactory.java0000664000175000017500000000565111767656530021740 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import javax.xml.namespace.QName; import org.apache.neethi.builders.AssertionBuilder; import org.apache.neethi.builders.converters.ConverterRegistry; /** * AssertionFactory is used to create an Assertion from an Element. It uses an * appropriate AssertionBuilder instance to create an Assertion based on the * QName of the given element. Domain Policy authors could right custom * AssertionBuilders to build Assertions for domain specific assertions. */ public interface AssertionBuilderFactory { /** * Returns the PolicyEngine associated with this factory * @return */ PolicyBuilder getPolicyEngine(); /** * Returns the ConverterRegistry that the builder * uses for converting the object to the types * needed for the AssertionBuilders * @return */ ConverterRegistry getConverterRegistry(); /** * Registers an AssertionBuilder with a specified QName. * * @param key the QName that the AssertionBuilder understand * @param builder the AssertionBuilder that can build an Assertion from * an element of specified type */ void registerBuilder(QName key, AssertionBuilder builder); /** * Registers an AssertionBuilder with all the builder's known elements. * * @param builder the AssertionBuilder that can build an Assertion from * an element of specified type */ void registerBuilder(AssertionBuilder builder); /** * Returns an assertion that is built using the specified element. * * @param element the element that the AssertionBuilder can use to build an * Assertion. * @return an Assertion that is built using the specified element. */ Assertion build(Object element); /** * Returns an AssertionBuilder that build an Assertion from an element of * qname type. * * @param qname the type that the AssertionBuilder understands and builds an * Assertion from * @return an AssertionBuilder that understands qname type */ public AssertionBuilder getBuilder(QName qname); } ./src/org/apache/neethi/AbstractPolicyOperator.java0000664000175000017500000002242211767656530021564 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.neethi.util.PolicyComparator; /** * AbstractPolicyOperator provides an implementation of few functions of * PolicyOperator interface that other PolicyOperators can use. */ public abstract class AbstractPolicyOperator implements PolicyOperator { protected List policyComponents = new ArrayList(); public AbstractPolicyOperator() { } public AbstractPolicyOperator(PolicyOperator parent) { parent.addPolicyComponent(this); } public void addPolicyComponent(PolicyComponent component) { if (component == null) { throw new IllegalArgumentException("Component must not be null"); } policyComponents.add(component); } public void addPolicyComponents(List components) { policyComponents.addAll(components); } public List getPolicyComponents() { return policyComponents; } public PolicyComponent getFirstPolicyComponent() { if (policyComponents.isEmpty()) { return null; } return policyComponents.get(0); } public boolean isEmpty() { return policyComponents.isEmpty(); } public boolean equal(PolicyComponent policyComponent) { return PolicyComparator.compare(this, policyComponent); } protected static Policy normalize(Policy policy, PolicyRegistry reg, boolean deep) { Policy result = new Policy(reg, policy.getNamespace()); String policyName = policy.getName(); if (policyName != null) { result.setName(policyName); } String id = policy.getId(); if (id != null) { result.setId(id); } result.addPolicyComponent(normalizeOperator(policy, policy, reg, deep)); return result; } private static PolicyComponent normalizeOperator(Policy policy, PolicyOperator operator, PolicyRegistry reg, boolean deep) { short type = operator.getType(); if (operator.isEmpty()) { ExactlyOne exactlyOne = new ExactlyOne(); if (Constants.TYPE_EXACTLYONE != type) { exactlyOne.addPolicyComponent(new All()); } return exactlyOne; } List childComponentsList = new ArrayList(); for (PolicyComponent policyComponent : operator.getPolicyComponents()) { if (policyComponent.getType() == Constants.TYPE_ASSERTION) { if (deep) { policyComponent = ((Assertion) policyComponent).normalize(); } if (policyComponent.getType() == Constants.TYPE_POLICY) { childComponentsList.add(((Policy) policyComponent).getFirstPolicyComponent()); } else { ExactlyOne exactlyOne = new ExactlyOne(); All all = new All(); all.addPolicyComponent(policyComponent); exactlyOne.addPolicyComponent(all); childComponentsList.add(exactlyOne); } } else if (policyComponent.getType() == Constants.TYPE_POLICY_REF) { String uri = ((PolicyReference) policyComponent).getURI(); policyComponent = reg == null ? null : reg.lookup(uri); if (policyComponent == null && uri.charAt(0) == '#') { String id = uri.substring(1); policyComponent = reg == null ? null : reg.lookup(id); if (policyComponent == null) { for (PolicyComponent p : policy.getPolicyComponents()) { if (p instanceof Policy && id.equals(((Policy)p).getId())) { policyComponent = p; } } } } if (policyComponent == null) { throw new RuntimeException(uri + " can't be resolved"); } All all = new All(); all.addPolicyComponents(((Policy) policyComponent).getPolicyComponents()); childComponentsList.add(AbstractPolicyOperator.normalizeOperator(policy, all, reg, deep)); } else if (policyComponent.getType() == Constants.TYPE_POLICY) { All all = new All(); all.addPolicyComponents(((Policy) policyComponent).getPolicyComponents()); childComponentsList.add(AbstractPolicyOperator.normalizeOperator(policy, all, reg, deep)); } else { childComponentsList.add(AbstractPolicyOperator .normalizeOperator(policy, (PolicyOperator)policyComponent, reg, deep)); } } return computeResultantComponent(childComponentsList, type); } private static PolicyComponent computeResultantComponent(List normalizedInnerComponets, short componentType) { ExactlyOne exactlyOne = new ExactlyOne(); if (componentType == Constants.TYPE_EXACTLYONE) { for (PolicyComponent comp : normalizedInnerComponets) { ExactlyOne innerExactlyOne = (ExactlyOne)comp; exactlyOne.addPolicyComponents(innerExactlyOne.getPolicyComponents()); } } else if ((componentType == Constants.TYPE_POLICY) || (componentType == Constants.TYPE_ALL)) { // if the parent type is All then we have to get the cross product if (normalizedInnerComponets.size() > 1) { // then we have to get the cross product with each other to process all elements Iterator iter = normalizedInnerComponets.iterator(); // first get the first element exactlyOne = (ExactlyOne) iter.next(); // if this is empty, this is an not admissible policy and total result is equivalent to that if (!exactlyOne.isEmpty()) { ExactlyOne currentExactlyOne; while (iter.hasNext()) { currentExactlyOne = (ExactlyOne) iter.next(); if (currentExactlyOne.isEmpty()) { // if this is empty, this is an not admissible policy and total // result is equivalent to that exactlyOne = currentExactlyOne; break; } else { exactlyOne = getCrossProduct(exactlyOne, currentExactlyOne); } } } } else { // i.e only one element exists in the list then we can safely // return that element this is ok even if it is an empty element exactlyOne = (ExactlyOne) normalizedInnerComponets.get(0); } } return exactlyOne; } private static ExactlyOne getCrossProduct(ExactlyOne exactlyOne1, ExactlyOne exactlyOne2) { ExactlyOne crossProduct = new ExactlyOne(); All crossProductAll; All currentAll1; All currentAll2; for (Iterator iter1 = exactlyOne1.getPolicyComponents().iterator(); iter1.hasNext();) { currentAll1 = (All) iter1.next(); for (Iterator iter2 = exactlyOne2.getPolicyComponents().iterator(); iter2.hasNext();) { currentAll2 = (All) iter2.next(); crossProductAll = new All(); crossProductAll.addPolicyComponents(currentAll1.getPolicyComponents()); crossProductAll.addPolicyComponents(currentAll2.getPolicyComponents()); crossProduct.addPolicyComponent(crossProductAll); } } return crossProduct; } } ./src/org/apache/neethi/PolicyRegistryImpl.java0000664000175000017500000000414211767656530020736 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Provides a default implementation of PolicyRegistry interface. */ public class PolicyRegistryImpl implements PolicyRegistry { private PolicyRegistry parent; private Map reg = new ConcurrentHashMap(); public PolicyRegistryImpl() { } /** * Constructs a PolicyRegistryImpl with the specified PolicyRegistry * as it's parent. If it can't lookup a Policy in it's own registry * then it lookup in the parent and returns the results. * * @param parent the Parent of this PolicyRegistry */ public PolicyRegistryImpl(PolicyRegistry parent) { this.parent = parent; } public Policy lookup(String key) { Policy policy = reg.get(key); if (policy == null && parent != null) { return parent.lookup(key); } return policy; } public void register(String key, Policy policy) { reg.put(key, policy); } public void remove(String key) { reg.remove(key); } public void setParent(PolicyRegistry parent) { this.parent = parent; } public PolicyRegistry getParent() { return parent; } } ./src/org/apache/neethi/PolicyContainingAssertion.java0000664000175000017500000000175411767656530022273 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; /** * Interface to mark Assertions that contain child Policy documents */ public interface PolicyContainingAssertion extends Assertion { Policy getPolicy(); } ./src/org/apache/neethi/All.java0000664000175000017500000000466311767656530015644 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.util.List; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * All is a PolicyOperator that require all its PolicyComponents to be met. */ public class All extends AbstractPolicyOperator { public All() { super(); } public All(PolicyOperator parent) { super(parent); } /** * Adds an assertion to its PolicyComponent list. * * @param assertion the assertion to be added. */ public void addAssertion(Assertion assertion) { addPolicyComponent(assertion); } /** * Returns a List of it's PolicyComponents. * * @return a List of it's PolicyComponents */ public List getAssertions() { return policyComponents; } public void serialize(XMLStreamWriter writer) throws XMLStreamException { String namespace = Constants.findPolicyNamespace(writer); String prefix = writer.getPrefix(namespace); if (prefix == null) { writer.writeStartElement(Constants.ATTR_WSP, Constants.ELEM_ALL, namespace); writer.writeNamespace(Constants.ATTR_WSP, namespace); writer.setPrefix(Constants.ATTR_WSP, namespace); } else { writer.writeStartElement(namespace, Constants.ELEM_ALL); } for (PolicyComponent policyComponent : getPolicyComponents()) { policyComponent.serialize(writer); } writer.writeEndElement(); } /** * Returns Constants.TYPE_ALL */ public short getType() { return Constants.TYPE_ALL; } } ./src/org/apache/neethi/PolicyEngine.java0000664000175000017500000001075011767656530017513 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import org.apache.axiom.om.OMElement; import org.apache.neethi.builders.AssertionBuilder; import javax.xml.namespace.QName; import javax.xml.stream.XMLInputFactory; import java.io.InputStream; import java.util.Iterator; /** * PolicyEngine provides set of static methods to create a Policy object from an * InputStream, OMElement, .. etc. It wrappers a static PolicyBuilder to actually * do the building. This class is provided to ease transition from Neethi 2.x to * Neethi 3.x */ public class PolicyEngine { public static final String POLICY_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/09/policy"; public static final String POLICY = "Policy"; public static final String EXACTLY_ONE = "ExactlyOne"; public static final String ALL = "All"; public static final String POLICY_REF = "PolicyReference"; private static PolicyBuilder builder; private static synchronized PolicyBuilder getBuilder() { if (builder == null) { builder = new PolicyBuilder(); } return builder; } /** * Registers an AssertionBuilder instances and associates it with a QName. * PolicyManager or other AssertionBuilders instances can use this * AssertionBuilder instance to process and build an Assertion from a * OMElement with the specified QName. * * @param qname * the QName of the Assertion that the Builder can build * @param builder * the AssertionBuilder that can build assertions that of 'qname' * type */ public static void registerBuilder(QName qname, AssertionBuilder builder) { getBuilder().getAssertionBuilderFactory().registerBuilder(qname, builder); } /** * Creates a Policy object from an InputStream. * * @param inputStream * the InputStream of the Policy * @return a Policy object of the Policy that is fed as a InputStream */ public static Policy getPolicy(InputStream inputStream) { return getBuilder().getPolicy(inputStream); } /** * Creates a PolicyReference object. * * @param inputStream * the InputStream of the PolicyReference * @return a PolicyReference object of the PolicyReference */ public static PolicyReference getPolicyReferene(InputStream inputStream) { return getBuilder().getPolicyReference(inputStream); } /** * Creates a Policy object from an OMElement. * * @param element * the Policy element * @retun a Policy object of the Policy element */ public static Policy getPolicy(OMElement element) { return getBuilder().getPolicy(element); } /** * Creates a Policy object from an Element. * * @param element * the Policy element * @retun a Policy object of the Policy element */ public static Policy getPolicy(Object element) { return getBuilder().getPolicy(element); } /** * Creates a PolicyReference object from an OMElement. * * @param element * the PolicyReference element * @return a PolicyReference object of the PolicyReference element */ public static PolicyReference getPolicyReference(OMElement element) { return getBuilder().getPolicyReference(element); } /** * Creates a PolicyReference object from an Element. * * @param element * the PolicyReference element * @return a PolicyReference object of the PolicyReference element */ public static PolicyReference getPolicyReference(Object element) { return getBuilder().getPolicyReference(element); } } ./src/org/apache/neethi/AssertionBuilderFactoryImpl.java0000664000175000017500000001315711767656530022562 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import java.lang.reflect.ParameterizedType; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.xml.namespace.QName; import org.apache.neethi.builders.AssertionBuilder; import org.apache.neethi.builders.converters.ConverterRegistry; import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder; import org.apache.neethi.util.Service; /** * AssertionFactory is used to create an Assertion from an Element. It uses an * appropriate AssertionBuilder instance to create an Assertion based on the * QName of the given element. Domain Policy authors could right custom * AssertionBuilders to build Assertions for domain specific assertions. */ public class AssertionBuilderFactoryImpl implements AssertionBuilderFactory { private Map> registeredBuilders = new ConcurrentHashMap>(); protected AssertionBuilder defaultBuilder; protected ConverterRegistry converters = new ConverterRegistry(); protected PolicyBuilder engine; public AssertionBuilderFactoryImpl(PolicyBuilder eng) { engine = eng; for (AssertionBuilder builder : Service.providers(AssertionBuilder.class)) { QName[] knownElements = builder.getKnownElements(); for (int i = 0; i < knownElements.length; i++) { registeredBuilders.put(knownElements[i], builder); } } defaultBuilder = new XMLPrimitiveAssertionBuilder(); } public ConverterRegistry getConverterRegistry() { return converters; } public PolicyBuilder getPolicyEngine() { return engine; } /** * Touch point for subclasses that would like to dynamically load * builders when policies are first encountered */ protected void loadDynamic() { } /** * Registers an AssertionBuilder with a specified QName. * * @param key the QName that the AssertionBuilder understand * @param builder the AssertionBuilder that can build an Assertion from * an element of specified type */ public void registerBuilder(QName key, AssertionBuilder builder) { loadDynamic(); registeredBuilders.put(key, builder); } public void registerBuilder(AssertionBuilder builder) { loadDynamic(); for (QName q : builder.getKnownElements()) { registeredBuilders.put(q, builder); } } /** * Returns an assertion that is built using the specified element. * * @param element the element that the AssertionBuilder can use to build an * Assertion. * @return an Assertion that is built using the specified element. */ public Assertion build(Object element) { loadDynamic(); AssertionBuilder builder; QName qname = converters.findQName(element); builder = registeredBuilders.get(qname); if (builder == null) { builder = handleNoRegisteredBuilder(qname); } return invokeBuilder(element, builder); } /** * A subclass may want to log when an unknown assertion is encountered * or possibly throw an exception or similar. Another option is to * provide a unique AssertionBuilder specific for that QName. * @param qname * @return a AssertionBuilder to use for the element. */ protected AssertionBuilder handleNoRegisteredBuilder(QName qname) { // if we can't locate an appropriate AssertionBuilder, we always use the // XMLPrimitiveAssertionBuilder return defaultBuilder; } @SuppressWarnings("unchecked") private Assertion invokeBuilder(Object element, AssertionBuilder builder) { Class type = findAssertionBuilderTarget(builder.getClass()); return builder.build(converters.convert(element, type), this); } private Class findAssertionBuilderTarget(Class c) { Class interfaces[] = c.getInterfaces(); for (int x = 0; x < interfaces.length; x++) { if (interfaces[x] == AssertionBuilder.class) { ParameterizedType pt = (ParameterizedType)c.getGenericInterfaces()[x]; return (Class)pt.getActualTypeArguments()[0]; } } if (c.getClass().getSuperclass() != null) { return findAssertionBuilderTarget(c.getSuperclass()); } return null; } /** * Returns an AssertionBuilder that build an Assertion from an element of * qname type. * * @param qname the type that the AssertionBuilder understands and builds an * Assertion from * @return an AssertionBuilder that understands qname type */ public AssertionBuilder getBuilder(QName qname) { loadDynamic(); return registeredBuilders.get(qname); } } ./src/org/apache/neethi/PolicyComponent.java0000664000175000017500000000412211767656530020244 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * This is an interface which any component of the framework must implement. */ public interface PolicyComponent { /** * Serializes the PolicyComponent using an XMLStreamWriter. * * @param writer the writer that the component should write itself * @throws XMLStreamException if an errors in the process of serialization of the * PolicyComponent. */ void serialize(XMLStreamWriter writer) throws XMLStreamException; /** * Returns a short value which uniquely identify the type of the * PolicyComponent. * * @return Constants.TYPE_POLICY for Policy type PolicyComponent * Constants.TYPE_EXACTLYONE for ExactlyOne type PolicyComponent * Constants.TYPE_ALL for All type PolicyComponent * Constants.TYPE_ASSERTION for Assertion type PolicyComponent */ short getType(); /** * Returns true if the argument is equal to self. * * @param policyComponent the PolicyComponent to check whether self is * logically equal or not * @return true if the argument is equal to self. */ boolean equal(PolicyComponent policyComponent); } ./src/org/apache/neethi/Assertion.java0000664000175000017500000000376211767656530017102 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * This is an interface that any Assertion must implement. Hence any domain * specific type can be used with this framework if it implements this * interface. */ public interface Assertion extends PolicyComponent { /** * Returns the QName of the Root Element of this Assertion. * * @return QName the QName of the Root Element of this Assertion. */ QName getName(); /** * Returns true if this Assertion is optional. Returns false otherwise. * * @return true if the assertion is optional. */ boolean isOptional(); /** * Returns true if this Assertion is ignorable. Returns false otherwise. * * @return true if the assertion is ignorable. */ boolean isIgnorable(); /** * Serialize this Assertion into its XML infoset using XMLStreamWriter. */ void serialize(XMLStreamWriter writer) throws XMLStreamException; /** * Returns a new PolicyComponent that is the normalized version of this. */ PolicyComponent normalize(); } ./src/org/apache/neethi/IntersectableAssertion.java0000664000175000017500000000310711767656530021600 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.neethi; /** * Assertions that need special consideration to implement * the intersection algorithms should implement this interface. * * If an assertion does not implement this interface, the * intersection algorithm will just check the qname of the * assertion as well as the contained policy if the assertion * implements the PolicyContainingAssertion interface. This * is adequate for most use cases and per spec, but this * interface allows an assertion to possibly consider special * attributes or other details to determine the behavior * for the intersection. */ public interface IntersectableAssertion extends Assertion { boolean isCompatible(Assertion assertion, boolean strict); Assertion intersect(Assertion assertion, boolean strict); } ./src/org/apache/ws/0000775000175000017500000000000011767656530013435 5ustar brianbrian./src/org/apache/ws/commons/0000775000175000017500000000000011767656530015110 5ustar brianbrian./src/org/apache/ws/commons/schema/0000775000175000017500000000000011767656530016350 5ustar brianbrian./src/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java0000664000175000017500000000337411767656530024271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Provides different methods for preventing derivation. */ public class XmlSchemaDerivationMethod extends org.apache.ws.commons.schema.constants.Enum { static String[] members = new String[]{ Constants.BlockConstants.ALL, Constants.BlockConstants.EMPTY, Constants.BlockConstants.EXTENSION, Constants.BlockConstants.LIST, Constants.BlockConstants.NONE, Constants.BlockConstants.RESTRICTION, Constants.BlockConstants.SUBSITUTION, Constants.BlockConstants.UNION}; /** * Creates new XmlSeverityType */ public XmlSchemaDerivationMethod() { super(); } public XmlSchemaDerivationMethod(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaKey.java0000664000175000017500000000215111767656530021544 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Identifies a key constraint. Represents the World Wide Web Consortium * (W3C) key element. */ public class XmlSchemaKey extends XmlSchemaIdentityConstraint { /** * Creates new XmlSchemaKey */ public XmlSchemaKey() { } } ./src/org/apache/ws/commons/schema/XmlSchemaIdentityConstraint.java0000664000175000017500000000323311767656530024654 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for the identity constraints: key, keyref, and unique elements. */ public class XmlSchemaIdentityConstraint extends XmlSchemaAnnotated { /** * Creates new XmlSchemaIdentityConstraint */ public XmlSchemaIdentityConstraint() { fields = new XmlSchemaObjectCollection(); } XmlSchemaObjectCollection fields; public XmlSchemaObjectCollection getFields() { return fields; } String name; public String getName() { return name; } public void setName(String name) { this.name = name; } XmlSchemaXPath selector; public XmlSchemaXPath getSelector() { return selector; } public void setSelector(XmlSchemaXPath selector) { this.selector = selector; } } ./src/org/apache/ws/commons/schema/XmlSchemaUse.java0000664000175000017500000000302211767656530021546 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Indicator of how the attribute is used. */ public class XmlSchemaUse extends org.apache.ws.commons.schema.constants.Enum { static String[] members = new String[]{ Constants.BlockConstants.NONE, Constants.BlockConstants.OPTIONAL, Constants.BlockConstants.PROHIBITED, Constants.BlockConstants.REQUIRED }; /** * Creates new XmlSchemaUse */ public XmlSchemaUse() { super(); } public XmlSchemaUse(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaMinLengthFacet.java0000664000175000017500000000311211767656530023642 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining minLength facets. Represents the World Wide * Web Consortium (W3C) minLength facet. */ public class XmlSchemaMinLengthFacet extends XmlSchemaNumericFacet { /** * Creates new XmlSchemaMinLengthFacet */ public XmlSchemaMinLengthFacet() { } public XmlSchemaMinLengthFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaMinExclusiveFacet.java0000664000175000017500000000312011767656530024367 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining minExclusive facets. Represents the World * Wide Web Consortium (W3C) minExclusive facet. */ public class XmlSchemaMinExclusiveFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaMinExclusive */ public XmlSchemaMinExclusiveFacet() { } public XmlSchemaMinExclusiveFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/TypeReceiver.java0000664000175000017500000000204311767656530021620 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * A TypeReceiver is something that can have its type set. This gets used * to resolve forward references. */ public interface TypeReceiver { void setType(XmlSchemaType type); } ./src/org/apache/ws/commons/schema/XmlSchemaComplexType.java0000664000175000017500000001065011767656530023270 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Class for complex types. Defines a complex type that determines the * set of attributes and content of an element. Represents the World Wide * Web Consortium (W3C) complexType element. */ public class XmlSchemaComplexType extends XmlSchemaType { XmlSchemaAnyAttribute anyAttribute, attributeWildcard; XmlSchemaObjectCollection attributes; XmlSchemaObjectTable attributeUses; XmlSchemaDerivationMethod block, blockResolved; XmlSchemaContentModel contentModel; XmlSchemaContentType contentType; XmlSchemaParticle particleType, particle; boolean isAbstract, isMixed; /** * Creates new XmlSchemaComplexType */ public XmlSchemaComplexType(XmlSchema schema) { super(schema); attributes = new XmlSchemaObjectCollection(); block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); isAbstract = false; isMixed = false; } public XmlSchemaAnyAttribute getAnyAttribute() { return anyAttribute; } public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } public XmlSchemaObjectCollection getAttributes() { return attributes; } public XmlSchemaObjectTable getAttributeUses() { return attributeUses; } public XmlSchemaAnyAttribute getAttributeWildcard() { return attributeWildcard; } public XmlSchemaDerivationMethod getBlock() { return block; } public void setBlock(XmlSchemaDerivationMethod block) { this.block = block; } public XmlSchemaDerivationMethod getBlockResolved() { return blockResolved; } public XmlSchemaContentModel getContentModel() { return contentModel; } public void setContentModel(XmlSchemaContentModel contentModel) { this.contentModel = contentModel; } public XmlSchemaContentType getContentType() { return contentType; } public void setContentType(XmlSchemaContentType contentType) { this.contentType = contentType; } public XmlSchemaParticle getContentTypeParticle() { return particleType; } public boolean isAbstract() { return isAbstract; } public void setAbstract(boolean b) { isAbstract = b; } public boolean isMixed() { return isMixed; } public void setMixed(boolean b) { isMixed = b; } public XmlSchemaParticle getParticle() { return particle; } public void setParticle(XmlSchemaParticle particle) { this.particle = particle; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; String typeName = name != null ? name : ""; xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n"; if (particle != null) xml += particle.toString(prefix, (tab + 1)); if (contentModel != null) xml += contentModel.toString(prefix, (tab + 1)); for (int i = 0; i < attributes.getCount(); i++) { xml += attributes.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.java0000664000175000017500000000313011767656530024204 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining totalDigits facets. Represents the World Wide * Web Consortium (W3C) totalDigits facet. */ public class XmlSchemaTotalDigitsFacet extends XmlSchemaNumericFacet { /** * Creates new XmlSchemaTotalDigitsFacet */ public XmlSchemaTotalDigitsFacet() { } public XmlSchemaTotalDigitsFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.java0000664000175000017500000000215311767656530024444 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Abstract class for simple type content classes. */ public abstract class XmlSchemaSimpleTypeContent extends XmlSchemaAnnotated { /** * Creates new XmlSchemaSimpleTypeContent */ protected XmlSchemaSimpleTypeContent() { } } ./src/org/apache/ws/commons/schema/XmlSchemaComplexContent.java0000664000175000017500000000474411767656530023770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class that represents the complex content model for complex types. * Contains extensions or restrictions on a complex type that has mixed * content or elements only. Represents the World Wide Web Consortium (W3C) * complexContent element. */ // Vidyanand - 16th Oct - initial implementation public class XmlSchemaComplexContent extends XmlSchemaContentModel { /** * Creates new XmlSchemaComplexContent */ public XmlSchemaComplexContent() { } /* One of either the XmlSchemaComplexContentRestriction or * XmlSchemaComplexContentExtension classes. */ XmlSchemaContent content; public XmlSchemaContent getContent() { return this.content; } public void setContent(XmlSchemaContent content) { this.content = content; } /* Indicates that this type has a mixed content model. Character data * is allowed to appear between the child elements of the complex type. */ public boolean mixed; public boolean isMixed() { return this.mixed; } public void setMixed(boolean mixed) { this.mixed = mixed; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "complexContent>\n"; xml += content.toString(prefix, (tab + 1)); for (int i = 0; i < tab; i++) xml += "\t"; xml += "<" + prefix + "complexContent>\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaFractionDigitsFacet.java0000664000175000017500000000325211767656530024673 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining fractionDigits facets. Represents the World Wide * Web Consortium (W3C) fractionDigits facet. */ public class XmlSchemaFractionDigitsFacet extends XmlSchemaNumericFacet { /** * Creates new XmlSchemaFractionDigitsFacet */ public XmlSchemaFractionDigitsFacet() { } public XmlSchemaFractionDigitsFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeUnion.java0000664000175000017500000000342411767656530024124 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for the union of simpleType elements. Defines a simpleType element * as a list of values of a specified data type. Represents the World * Wide Web Consortium (W3C) union element. */ public class XmlSchemaSimpleTypeUnion extends XmlSchemaSimpleTypeContent { XmlSchemaObjectCollection baseTypes; String memberTypesSource; QName[] memberTypesQNames; public XmlSchemaSimpleTypeUnion() { baseTypes = new XmlSchemaObjectCollection(); } public XmlSchemaObjectCollection getBaseTypes() { return this.baseTypes; } public void setMemberTypesSource(String memberTypesSources) { this.memberTypesSource = memberTypesSources; } public String getMemberTypesSource() { return this.memberTypesSource; } public QName[] getMemberTypesQNames() { return this.memberTypesQNames; } } ./src/org/apache/ws/commons/schema/SchemaBuilder.java0000664000175000017500000017303411767656530021732 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.XmlSchemaCollection.SchemaKey; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.extensions.ExtensionRegistry; import org.apache.ws.commons.schema.utils.NodeNamespaceContext; import org.apache.ws.commons.schema.utils.TargetNamespaceValidator; import org.apache.ws.commons.schema.utils.XDOMUtil; import org.apache.ws.commons.schema.utils.DOMUtil; import org.w3c.dom.*; import org.xml.sax.InputSource; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import java.util.StringTokenizer; import java.util.Vector; public class SchemaBuilder { Document doc; XmlSchema schema; XmlSchemaCollection collection; private final TargetNamespaceValidator validator; DocumentBuilderFactory docFac; /** * The extension registry to be used while building the * schema model */ private ExtensionRegistry extReg = null; public ExtensionRegistry getExtReg() { return extReg; } public void setExtReg(ExtensionRegistry extReg) { this.extReg = extReg; } /** * Schema builder constructor * @param collection */ SchemaBuilder(XmlSchemaCollection collection, TargetNamespaceValidator validator) { this.collection = collection; this.validator = validator; if (collection.getExtReg() != null) { this.extReg = collection.getExtReg(); } schema = new XmlSchema(); } /** * build method taking in a document and a validation handler * @param doc * @param uri * @param veh */ XmlSchema build(Document doc, String uri, ValidationEventHandler veh) { Element schemaEl = doc.getDocumentElement(); XmlSchema xmlSchema = handleXmlSchemaElement(schemaEl, uri); xmlSchema.setInputEncoding(DOMUtil.getInputEncoding(doc)); return xmlSchema; } /** * handles the schema element * @param schemaEl * @param uri */ XmlSchema handleXmlSchemaElement(Element schemaEl, String uri) { // get all the attributes along with the namespace declns schema.setNamespaceContext(new NodeNamespaceContext(schemaEl)); setNamespaceAttributes(schema, schemaEl); XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey( schema.logicalTargetNamespace, uri); if (!collection.containsSchema(schemaKey)) { collection.addSchema(schemaKey, schema); schema.parent = collection; // establish parentage now. } else { throw new XmlSchemaException("Schema name conflict in collection. Namespace: " + schema.logicalTargetNamespace); } schema.setElementFormDefault(this.getFormDefault(schemaEl, "elementFormDefault")); schema.setAttributeFormDefault(this.getFormDefault(schemaEl, "attributeFormDefault")); schema.setBlockDefault(this.getDerivation(schemaEl, "blockDefault")); schema.setFinalDefault(this.getDerivation(schemaEl, "finalDefault")); /* set id attribute */ if (schemaEl.hasAttribute("id")) { schema.id = schemaEl.getAttribute("id"); } schema.setSourceURI(uri); /*********** * for ( each childElement) * if( simpleTypeElement) * handleSimpleType * else if( complexType) * handleComplexType * else if( element) * handleElement * else if( include) * handleInclude * else if( import) * handleImport * else if (group) * handleGroup * else if (attributeGroup) * handleattributeGroup * else if( attribute) * handleattribute * else if (redefine) * handleRedefine * else if(notation) * handleNotation * else if (annotation) * handleAnnotation */ Element el = XDOMUtil.getFirstChildElementNS(schemaEl, XmlSchema.SCHEMA_NS); if (el == null && XDOMUtil.getFirstChildElementNS(schemaEl, "http://www.w3.org/1999/XMLSchema") != null) { throw new XmlSchemaException( "Schema defined using \"http://www.w3.org/1999/XMLSchema\" is not supported. " + "Please update the schema to the \"" + XmlSchema.SCHEMA_NS + "\" namespace"); } for (; el != null; el = XDOMUtil.getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { // String elPrefix = el.getPrefix() == null ? "" : el.getPrefix(); //if(elPrefix.equals(schema.schema_ns_prefix)) { if (el.getLocalName().equals("simpleType")) { XmlSchemaType type = handleSimpleType(schema, el, schemaEl); schema.addType(type); schema.items.add(type); collection.resolveType(type.getQName(), type); } else if (el.getLocalName().equals("complexType")) { XmlSchemaType type = handleComplexType(schema, el, schemaEl); schema.addType(type); schema.items.add(type); collection.resolveType(type.getQName(), type); } else if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, true); if (element.qualifiedName != null) schema.elements.collection.put(element.qualifiedName, element); else if (element.refName != null) schema.elements.collection.put(element.refName, element); schema.items.add(element); } else if (el.getLocalName().equals("include")) { XmlSchemaInclude include = handleInclude(schema, el, schemaEl); schema.includes.add(include); schema.items.add(include); } else if (el.getLocalName().equals("import")) { XmlSchemaImport schemaImport = handleImport(schema, el, schemaEl); schema.includes.add(schemaImport); schema.items.add(schemaImport); } else if (el.getLocalName().equals("group")) { XmlSchemaGroup group = handleGroup(schema, el, schemaEl); schema.groups.collection.put(group.name, group); schema.items.add(group); } else if (el.getLocalName().equals("attributeGroup")) { XmlSchemaAttributeGroup group = handleAttributeGroup(schema, el, schemaEl); schema.attributeGroups.collection.put(group.name, group); schema.items.add(group); } else if (el.getLocalName().equals("attribute")) { XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl, true); //pass true to indicate that it is a top level child schema.attributes.collection.put(attr.qualifiedName, attr); schema.items.add(attr); } else if (el.getLocalName().equals("redefine")) { XmlSchemaRedefine redefine = handleRedefine(schema, el, schemaEl); schema.includes.add(redefine); } else if (el.getLocalName().equals("notation")) { XmlSchemaNotation notation = handleNotation(el); schema.notations.collection.put(new QName(schema .getTargetNamespace(), notation.name), notation); schema.items.add(notation); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); schema.setAnnotation(annotation); } } //add the extesibility components processExtensibilityComponents(schema, schemaEl); return schema; } private XmlSchemaNotation handleNotation(Element notationEl) { XmlSchemaNotation notation = new XmlSchemaNotation(); if (notationEl.hasAttribute("id")) { notation.id = notationEl.getAttribute("id"); } if (notationEl.hasAttribute("name")) { notation.name = notationEl.getAttribute("name"); } if (notationEl.hasAttribute("public")) { notation.publicNotation = notationEl.getAttribute("public"); } if (notationEl.hasAttribute("system")) { notation.system = notationEl.getAttribute("system"); } Element annotationEl = XDOMUtil.getFirstChildElementNS(notationEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); notation.setAnnotation(annotation); } return notation; } /** * Handle redefine * @param schema * @param redefineEl * @param schemaEl * @return */ private XmlSchemaRedefine handleRedefine(XmlSchema schema, Element redefineEl, Element schemaEl) { XmlSchemaRedefine redefine = new XmlSchemaRedefine(); redefine.schemaLocation = redefineEl.getAttribute("schemaLocation"); final TargetNamespaceValidator validator = newIncludeValidator(schema); if (schema.getSourceURI() != null) { redefine.schema = resolveXmlSchema(schema.logicalTargetNamespace, redefine.schemaLocation, schema.getSourceURI(), validator); } else { redefine.schema = resolveXmlSchema(schema.logicalTargetNamespace, redefine.schemaLocation, validator); } /* * FIXME - This seems not right. Since the redefine should take into account * the attributes of the original element we cannot just build the type * defined in the redefine section - what we need to do is to get the original type * object and modify it. However one may argue (quite reasonably) that the purpose * of this object model is to provide just the representation and not the validation * (as it has been always the case) */ for (Element el = XDOMUtil.getFirstChildElementNS(redefineEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("simpleType")) { XmlSchemaType type = handleSimpleType(schema, el, schemaEl); redefine.schemaTypes.collection.put(type.getQName(), type); redefine.items.add(type); } else if (el.getLocalName().equals("complexType")) { XmlSchemaType type = handleComplexType(schema, el, schemaEl); redefine.schemaTypes.collection.put(type.getQName(), type); redefine.items.add(type); } else if (el.getLocalName().equals("group")) { XmlSchemaGroup group = handleGroup(schema, el, schemaEl); redefine.groups.collection.put(group.name, group); redefine.items.add(group); } else if (el.getLocalName().equals("attributeGroup")) { XmlSchemaAttributeGroup group = handleAttributeGroup(schema, el, schemaEl); redefine.attributeGroups.collection.put(group.name, group); redefine.items.add(group); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); redefine.setAnnotation(annotation); } // } } return redefine; } void setNamespaceAttributes(XmlSchema schema, Element schemaEl) { //no targetnamespace found ! if (schemaEl.getAttributeNode("targetNamespace") != null) { String contain = schemaEl.getAttribute("targetNamespace"); schema.setTargetNamespace(contain); } else { //do nothing here } if (validator != null) { validator.validate(schema); } } /** * Handles simple types * @param schema * @param simpleEl * @param schemaEl */ XmlSchemaSimpleType handleSimpleType(XmlSchema schema, Element simpleEl, Element schemaEl) { XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema); if (simpleEl.hasAttribute("name")) { simpleType.name = simpleEl.getAttribute("name"); } if (simpleEl.hasAttribute("final")) { String finalstr = simpleEl.getAttribute("final"); if (finalstr.equalsIgnoreCase("all") | finalstr.equalsIgnoreCase("#all")) simpleType.setFinal(new XmlSchemaDerivationMethod( Constants.BlockConstants.ALL)); else simpleType.setFinal(new XmlSchemaDerivationMethod(finalstr)); } Element simpleTypeAnnotationEl = XDOMUtil.getFirstChildElementNS( simpleEl, XmlSchema.SCHEMA_NS, "annotation"); if (simpleTypeAnnotationEl != null) { XmlSchemaAnnotation simpleTypeAnnotation = handleAnnotation(simpleTypeAnnotationEl); simpleType.setAnnotation(simpleTypeAnnotation); } Element unionEl, listEl, restrictionEl; if ((restrictionEl = XDOMUtil.getFirstChildElementNS(simpleEl, XmlSchema.SCHEMA_NS, "restriction")) != null) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); Element restAnnotationEl = XDOMUtil.getFirstChildElementNS( restrictionEl, XmlSchema.SCHEMA_NS, "annotation"); if (restAnnotationEl != null) { XmlSchemaAnnotation restAnnotation = handleAnnotation(restAnnotationEl); restriction.setAnnotation(restAnnotation); } /** if (restriction has a base attribute ) * set the baseTypeName and look up the base type * else if( restricion has a SimpleType Element as child) * get that element and do a handleSimpleType; * get the children of restriction other than annotation * and simpleTypes and construct facets from it; * * set the restriction has the content of the simpleType * **/ Element inlineSimpleType = XDOMUtil.getFirstChildElementNS( restrictionEl, XmlSchema.SCHEMA_NS, "simpleType"); if (restrictionEl.hasAttribute("base")) { NamespaceContext ctx = new NodeNamespaceContext(restrictionEl); restriction.baseTypeName = getRefQName(restrictionEl .getAttribute("base"), ctx); } else if (inlineSimpleType != null) { restriction.baseType = handleSimpleType(schema, inlineSimpleType, schemaEl); } for (Element el = XDOMUtil.getFirstChildElementNS(restrictionEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (!el.getLocalName().equals("annotation") && !el.getLocalName().equals("simpleType")) { XmlSchemaFacet facet = XmlSchemaFacet.construct(el); Element annotation = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "annotation"); if (annotation != null) { XmlSchemaAnnotation facetAnnotation = handleAnnotation(annotation); facet.setAnnotation(facetAnnotation); } restriction.facets.add(facet); } } simpleType.content = restriction; } else if ((listEl = XDOMUtil.getFirstChildElementNS(simpleEl, XmlSchema.SCHEMA_NS, "list")) != null) { XmlSchemaSimpleTypeList list = new XmlSchemaSimpleTypeList(); /****** * if( list has an itemType attribute ) * set the baseTypeName and look up the base type * else if( list has a SimpleTypeElement as child) * get that element and do a handleSimpleType * * set the list has the content of the simpleType */ Element inlineListType, listAnnotationEl; if (listEl.hasAttribute("itemType")) { String name = listEl.getAttribute("itemType"); list.itemTypeName = getRefQName(name, listEl); } else if ((inlineListType = XDOMUtil.getFirstChildElementNS( listEl, XmlSchema.SCHEMA_NS, "simpleType")) != null) { list.itemType = handleSimpleType(schema, inlineListType, schemaEl); } if ((listAnnotationEl = XDOMUtil.getFirstChildElementNS(listEl, XmlSchema.SCHEMA_NS, "annotation")) != null) { XmlSchemaAnnotation listAnnotation = handleAnnotation(listAnnotationEl); list.setAnnotation(listAnnotation); } simpleType.content = list; } else if ((unionEl = XDOMUtil.getFirstChildElementNS(simpleEl, XmlSchema.SCHEMA_NS, "union")) != null) { XmlSchemaSimpleTypeUnion union = new XmlSchemaSimpleTypeUnion(); /****** * if( union has a memberTypes attribute ) * add the memberTypeSources string * for (each memberType in the list ) * lookup(memberType) * for( all SimpleType child Elements) * add the simpleTypeName (if any) to the memberType Sources * do a handleSimpleType with the simpleTypeElement */ if (unionEl.hasAttribute("memberTypes")) { String memberTypes = unionEl.getAttribute("memberTypes"); union.memberTypesSource = memberTypes; Vector v = new Vector(); StringTokenizer tokenizer = new StringTokenizer(memberTypes, " "); while (tokenizer.hasMoreTokens()) { String member = tokenizer.nextToken(); v.add(getRefQName(member, unionEl)); } union.memberTypesQNames = new QName[v.size()]; v.copyInto(union.memberTypesQNames); } Element inlineUnionType = XDOMUtil.getFirstChildElementNS(unionEl, XmlSchema.SCHEMA_NS, "simpleType"); while (inlineUnionType != null) { XmlSchemaSimpleType unionSimpleType = handleSimpleType(schema, inlineUnionType, schemaEl); union.baseTypes.add(unionSimpleType); if (unionSimpleType.name != null) { union.memberTypesSource += " " + unionSimpleType.name; } inlineUnionType = XDOMUtil.getNextSiblingElementNS( inlineUnionType, XmlSchema.SCHEMA_NS, "simpleType"); } //NodeList annotations = unionEl.getElementsByTagNameNS( //XmlSchema.SCHEMA_NS, "annotation"); Element unionAnnotationEl = XDOMUtil.getFirstChildElementNS( unionEl, XmlSchema.SCHEMA_NS, "annotation"); if (unionAnnotationEl != null) { XmlSchemaAnnotation unionAnnotation = handleAnnotation(unionAnnotationEl); union.setAnnotation(unionAnnotation); } simpleType.content = union; } //process extra attributes and elements processExtensibilityComponents(simpleType, simpleEl); return simpleType; } private QName getRefQName(String pName, Node pNode) { return getRefQName(pName, new NodeNamespaceContext(pNode)); } private QName getRefQName(String pName, NamespaceContext pContext) { final int offset = pName.indexOf(':'); String uri; final String localName; final String prefix; if (offset == -1) { uri = pContext.getNamespaceURI(Constants.DEFAULT_NS_PREFIX); if (Constants.NULL_NS_URI.equals(uri)) { return new QName(Constants.NULL_NS_URI, pName); } localName = pName; prefix = Constants.DEFAULT_NS_PREFIX; } else { prefix = pName.substring(0, offset); uri = pContext.getNamespaceURI(prefix); if (uri == null || Constants.NULL_NS_URI.equals(uri)) { if (schema.parent != null && schema.parent.getNamespaceContext() != null) { uri = schema.parent.getNamespaceContext().getNamespaceURI( prefix); } } if (uri == null || Constants.NULL_NS_URI.equals(uri)) { throw new IllegalStateException("The prefix " + prefix + " is not bound."); } localName = pName.substring(offset + 1); } return new QName(uri, localName, prefix); } /** * Handle complex types * @param schema * @param complexEl * @param schemaEl */ XmlSchemaComplexType handleComplexType(XmlSchema schema, Element complexEl, Element schemaEl) { /****** * set the complexTypeName if any * for( eachChildNode) * if ( simpleContent) * if( restrcition) * handle_simple_content_restriction * else if( extension) * handle_simple_content_extension * break; // it has to be the only child * else if( complexContent) * if( restriction) * handle_complex_content_restriction * else if( extension) * handle_complex_content_extension * break; // it has to be the only child * else if( group) * if( group has ref) * store the group name * else * handleGroup * else if( sequence ) * handleSequence * else if( all ) * handleAll * else if(choice) * handleChoice * else if(attribute) * handleAttribute * else if(attributeGroup) * handleAttributeGroup * else if(anyAttribute) * handleAnyAttribute */ XmlSchemaComplexType ct = new XmlSchemaComplexType(schema); if (complexEl.hasAttribute("name")) { //String namespace = (schema.targetNamespace==null)? // "":schema.targetNamespace; ct.name = complexEl.getAttribute("name"); } for (Element el = XDOMUtil.getFirstChildElementNS(complexEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { //String elPrefix = el.getPrefix() == null ? "" : //el.getPrefix(); //if(elPrefix.equals(schema.schema_ns_prefix)) { if (el.getLocalName().equals("sequence")) { ct.particle = handleSequence(schema, el, schemaEl); } else if (el.getLocalName().equals("choice")) { ct.particle = handleChoice(schema, el, schemaEl); } else if (el.getLocalName().equals("all")) { ct.particle = handleAll(schema, el, schemaEl); } else if (el.getLocalName().equals("attribute")) { ct.attributes.add(handleAttribute(schema, el, schemaEl)); } else if (el.getLocalName().equals("attributeGroup")) { ct.attributes.add(handleAttributeGroupRef(el)); } else if (el.getLocalName().equals("group")) { XmlSchemaGroupRef group = handleGroupRef(schema, el, schemaEl); ct.particle = (group.particle == null) ? (XmlSchemaParticle) group : group.particle; } else if (el.getLocalName().equals("simpleContent")) { ct.contentModel = handleSimpleContent(schema, el, schemaEl); } else if (el.getLocalName().equals("complexContent")) { ct.contentModel = handleComplexContent(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { ct.setAnnotation(handleAnnotation(el)); } else if (el.getLocalName().equals("anyAttribute")) { ct.setAnyAttribute(handleAnyAttribute(schema, el, schemaEl)); } //} } if (complexEl.hasAttribute("block")) { String blockStr = complexEl.getAttribute("block"); if (blockStr.equalsIgnoreCase("all") | blockStr.equalsIgnoreCase("#all")) { ct.setBlock(new XmlSchemaDerivationMethod( Constants.BlockConstants.ALL)); } else ct.setBlock(new XmlSchemaDerivationMethod(blockStr)); //ct.setBlock(new XmlSchemaDerivationMethod(block)); } if (complexEl.hasAttribute("final")) { String finalstr = complexEl.getAttribute("final"); if (finalstr.equalsIgnoreCase("all") | finalstr.equalsIgnoreCase("#all")) { ct.setFinal(new XmlSchemaDerivationMethod( Constants.BlockConstants.ALL)); } else ct.setFinal(new XmlSchemaDerivationMethod(finalstr)); } if (complexEl.hasAttribute("abstract")) { String abs = complexEl.getAttribute("abstract"); if (abs.equalsIgnoreCase("true")) ct.setAbstract(true); else ct.setAbstract(false); } if (complexEl.hasAttribute("mixed")) { String mixed = complexEl.getAttribute("mixed"); if (mixed.equalsIgnoreCase("true")) ct.setMixed(true); else ct.setMixed(false); } //process extra attributes and elements processExtensibilityComponents(ct, complexEl); return ct; } private XmlSchemaSimpleContent handleSimpleContent(XmlSchema schema, Element simpleEl, Element schemaEl) { XmlSchemaSimpleContent simpleContent = new XmlSchemaSimpleContent(); for (Element el = XDOMUtil.getFirstChildElementNS(simpleEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("restriction")) { simpleContent.content = handleSimpleContentRestriction(schema, el, schemaEl); } else if (el.getLocalName().equals("extension")) { simpleContent.content = handleSimpleContentExtension(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { simpleContent.setAnnotation(handleAnnotation(el)); } } return simpleContent; } private XmlSchemaComplexContent handleComplexContent(XmlSchema schema, Element complexEl, Element schemaEl) { XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent(); for (Element el = XDOMUtil.getFirstChildElementNS(complexEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("restriction")) { complexContent.content = handleComplexContentRestriction( schema, el, schemaEl); } else if (el.getLocalName().equals("extension")) { complexContent.content = handleComplexContentExtension(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { complexContent.setAnnotation(handleAnnotation(el)); } } if (complexEl.hasAttribute("mixed")) { String mixed = complexEl.getAttribute("mixed"); if (mixed.equalsIgnoreCase("true")) complexContent.setMixed(true); else complexContent.setMixed(false); } return complexContent; } private XmlSchemaSimpleContentRestriction handleSimpleContentRestriction( XmlSchema schema, Element restrictionEl, Element schemaEl) { XmlSchemaSimpleContentRestriction restriction = new XmlSchemaSimpleContentRestriction(); if (restrictionEl.hasAttribute("base")) { String name = restrictionEl.getAttribute("base"); restriction.baseTypeName = getRefQName(name, restrictionEl); } if (restrictionEl.hasAttribute("id")) restriction.id = restrictionEl.getAttribute("id"); // check back simpleContent tag children to add attributes and simpleType if any occur for (Element el = XDOMUtil.getFirstChildElementNS(restrictionEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("attribute")) { XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl); restriction.attributes.add(attr); } else if (el.getLocalName().equals("attributeGroup")) { XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(el); restriction.attributes.add(attrGroup); } else if (el.getLocalName().equals("simpleType")) { restriction.baseType = handleSimpleType(schema, el, schemaEl); } else if (el.getLocalName().equals("anyAttribute")) { restriction.anyAttribute = handleAnyAttribute(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { restriction.setAnnotation(handleAnnotation(el)); } else { XmlSchemaFacet facet = XmlSchemaFacet.construct(el); NodeList annotations = el.getElementsByTagNameNS( XmlSchema.SCHEMA_NS, "annotation"); if (annotations.getLength() > 0) { XmlSchemaAnnotation facetAnnotation = handleAnnotation(el); facet.setAnnotation(facetAnnotation); } restriction.facets.add(facet); } } return restriction; } private XmlSchemaSimpleContentExtension handleSimpleContentExtension( XmlSchema schema, Element extEl, Element schemaEl) { XmlSchemaSimpleContentExtension ext = new XmlSchemaSimpleContentExtension(); if (extEl.hasAttribute("base")) { String name = extEl.getAttribute("base"); ext.baseTypeName = getRefQName(name, extEl); } for (Element el = XDOMUtil.getFirstChildElementNS(extEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("attribute")) { XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl); ext.attributes.add(attr); } else if (el.getLocalName().equals("attributeGroup")) { XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(el); ext.attributes.add(attrGroup); } else if (el.getLocalName().equals("anyAttribute")) { ext.anyAttribute = handleAnyAttribute(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation ann = handleAnnotation(el); ext.setAnnotation(ann); } } return ext; } private XmlSchemaComplexContentRestriction handleComplexContentRestriction( XmlSchema schema, Element restrictionEl, Element schemaEl) { XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction(); if (restrictionEl.hasAttribute("base")) { String name = restrictionEl.getAttribute("base"); restriction.baseTypeName = getRefQName(name, restrictionEl); } for (Element el = XDOMUtil.getFirstChildElementNS(restrictionEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("sequence")) { restriction.particle = handleSequence(schema, el, schemaEl); } else if (el.getLocalName().equals("choice")) { restriction.particle = handleChoice(schema, el, schemaEl); } else if (el.getLocalName().equals("all")) { restriction.particle = handleAll(schema, el, schemaEl); } else if (el.getLocalName().equals("attribute")) { restriction.attributes .add(handleAttribute(schema, el, schemaEl)); } else if (el.getLocalName().equals("attributeGroup")) { restriction.attributes.add(handleAttributeGroupRef(el)); } else if (el.getLocalName().equals("group")) { restriction.particle = handleGroupRef(schema, el, schemaEl); } else if (el.getLocalName().equals("anyAttribute")) { restriction.anyAttribute = handleAnyAttribute(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { restriction.setAnnotation(handleAnnotation(el)); } } return restriction; } private XmlSchemaComplexContentExtension handleComplexContentExtension( XmlSchema schema, Element extEl, Element schemaEl) { XmlSchemaComplexContentExtension ext = new XmlSchemaComplexContentExtension(); if (extEl.hasAttribute("base")) { String name = extEl.getAttribute("base"); ext.baseTypeName = getRefQName(name, extEl); } for (Element el = XDOMUtil.getFirstChildElementNS(extEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("sequence")) { ext.particle = handleSequence(schema, el, schemaEl); } else if (el.getLocalName().equals("choice")) { ext.particle = handleChoice(schema, el, schemaEl); } else if (el.getLocalName().equals("all")) { ext.particle = handleAll(schema, el, schemaEl); } else if (el.getLocalName().equals("attribute")) { ext.attributes.add(handleAttribute(schema, el, schemaEl)); } else if (el.getLocalName().equals("attributeGroup")) { ext.attributes.add(handleAttributeGroupRef(el)); } else if (el.getLocalName().equals("group")) { ext.particle = handleGroupRef(schema, el, schemaEl); } else if (el.getLocalName().equals("anyAttribute")) { ext.anyAttribute = handleAnyAttribute(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { ext.setAnnotation(handleAnnotation(el)); } } return ext; } private XmlSchemaAttributeGroupRef handleAttributeGroupRef( Element attrGroupEl) { XmlSchemaAttributeGroupRef attrGroup = new XmlSchemaAttributeGroupRef(); if (attrGroupEl.hasAttribute("ref")) { String ref = attrGroupEl.getAttribute("ref"); attrGroup.refName = getRefQName(ref, attrGroupEl); } if (attrGroupEl.hasAttribute("id")) attrGroup.id = attrGroupEl.getAttribute("id"); Element annotationEl = XDOMUtil.getFirstChildElementNS(attrGroupEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); attrGroup.setAnnotation(annotation); } return attrGroup; } private XmlSchemaSequence handleSequence(XmlSchema schema, Element sequenceEl, Element schemaEl) { XmlSchemaSequence sequence = new XmlSchemaSequence(); //handle min and max occurences sequence.minOccurs = getMinOccurs(sequenceEl); sequence.maxOccurs = getMaxOccurs(sequenceEl); for (Element el = XDOMUtil.getFirstChildElementNS(sequenceEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("sequence")) { XmlSchemaSequence seq = handleSequence(schema, el, schemaEl); sequence.items.add(seq); } else if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); sequence.items.add(element); } else if (el.getLocalName().equals("group")) { XmlSchemaGroupRef group = handleGroupRef(schema, el, schemaEl); sequence.items.add(group); } else if (el.getLocalName().equals("choice")) { XmlSchemaChoice choice = handleChoice(schema, el, schemaEl); sequence.items.add(choice); } else if (el.getLocalName().equals("any")) { XmlSchemaAny any = handleAny(schema, el, schemaEl); sequence.items.add(any); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); sequence.setAnnotation(annotation); } } return sequence; } /** @noinspection UnusedParameters*/ private XmlSchemaAny handleAny(XmlSchema schema, Element anyEl, Element schemaEl) { XmlSchemaAny any = new XmlSchemaAny(); if (anyEl.hasAttribute("namespace")) any.namespace = anyEl.getAttribute("namespace"); if (anyEl.hasAttribute("processContents")) { String processContent = getEnumString(anyEl, "processContents"); any.processContent = new XmlSchemaContentProcessing(processContent); } Element annotationEl = XDOMUtil.getFirstChildElementNS(anyEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); any.setAnnotation(annotation); } any.minOccurs = getMinOccurs(anyEl); any.maxOccurs = getMaxOccurs(anyEl); return any; } private XmlSchemaChoice handleChoice(XmlSchema schema, Element choiceEl, Element schemaEl) { XmlSchemaChoice choice = new XmlSchemaChoice(); if (choiceEl.hasAttribute("id")) choice.id = choiceEl.getAttribute("id"); choice.minOccurs = getMinOccurs(choiceEl); choice.maxOccurs = getMaxOccurs(choiceEl); for (Element el = XDOMUtil.getFirstChildElementNS(choiceEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("sequence")) { XmlSchemaSequence seq = handleSequence(schema, el, schemaEl); choice.items.add(seq); } else if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); choice.items.add(element); } else if (el.getLocalName().equals("group")) { XmlSchemaGroupRef group = handleGroupRef(schema, el, schemaEl); choice.items.add(group); } else if (el.getLocalName().equals("choice")) { XmlSchemaChoice choiceItem = handleChoice(schema, el, schemaEl); choice.items.add(choiceItem); } else if (el.getLocalName().equals("any")) { XmlSchemaAny any = handleAny(schema, el, schemaEl); choice.items.add(any); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); choice.setAnnotation(annotation); } } return choice; } private XmlSchemaAll handleAll(XmlSchema schema, Element allEl, Element schemaEl) { XmlSchemaAll all = new XmlSchemaAll(); //handle min and max occurences all.minOccurs = getMinOccurs(allEl); all.maxOccurs = getMaxOccurs(allEl); for (Element el = XDOMUtil.getFirstChildElementNS(allEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); all.items.add(element); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); all.setAnnotation(annotation); } } return all; } private XmlSchemaGroup handleGroup(XmlSchema schema, Element groupEl, Element schemaEl) { XmlSchemaGroup group = new XmlSchemaGroup(); group.name = new QName(schema.getTargetNamespace(), groupEl .getAttribute("name")); for (Element el = XDOMUtil.getFirstChildElementNS(groupEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("all")) { group.particle = handleAll(schema, el, schemaEl); } else if (el.getLocalName().equals("sequence")) { group.particle = handleSequence(schema, el, schemaEl); } else if (el.getLocalName().equals("choice")) { group.particle = handleChoice(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation groupAnnotation = handleAnnotation(el); group.setAnnotation(groupAnnotation); } } return group; } private XmlSchemaAttributeGroup handleAttributeGroup(XmlSchema schema, Element groupEl, Element schemaEl) { XmlSchemaAttributeGroup attrGroup = new XmlSchemaAttributeGroup(); if (groupEl.hasAttribute("name")) attrGroup.name = new QName(schema.getTargetNamespace(), groupEl .getAttribute("name")); if (groupEl.hasAttribute("id")) attrGroup.id = groupEl.getAttribute("id"); for (Element el = XDOMUtil.getFirstChildElementNS(groupEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("attribute")) { XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl); attrGroup.attributes.add(attr); } else if (el.getLocalName().equals("attributeGroup")) { XmlSchemaAttributeGroupRef attrGroupRef = handleAttributeGroupRef(el); attrGroup.attributes.add(attrGroupRef); } else if (el.getLocalName().equals("anyAttribute")) { attrGroup.anyAttribute = handleAnyAttribute(schema, el, schemaEl); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation ann = handleAnnotation(el); attrGroup.setAnnotation(ann); } } return attrGroup; } /** @noinspection UnusedParameters*/ private XmlSchemaAnyAttribute handleAnyAttribute(XmlSchema schema, Element anyAttrEl, Element schemaEl) { XmlSchemaAnyAttribute anyAttr = new XmlSchemaAnyAttribute(); if (anyAttrEl.hasAttribute("namespace")) anyAttr.namespace = anyAttrEl.getAttribute("namespace"); if (anyAttrEl.hasAttribute("processContents")) { String contentProcessing = getEnumString(anyAttrEl, "processContents"); anyAttr.processContent = new XmlSchemaContentProcessing( contentProcessing); } if (anyAttrEl.hasAttribute("id")) anyAttr.id = anyAttrEl.getAttribute("id"); Element annotationEl = XDOMUtil.getFirstChildElementNS(anyAttrEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); anyAttr.setAnnotation(annotation); } return anyAttr; } private XmlSchemaGroupRef handleGroupRef(XmlSchema schema, Element groupEl, Element schemaEl) { XmlSchemaGroupRef group = new XmlSchemaGroupRef(); group.maxOccurs = getMaxOccurs(groupEl); group.minOccurs = getMinOccurs(groupEl); Element annotationEl = XDOMUtil.getFirstChildElementNS(groupEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); group.setAnnotation(annotation); } if (groupEl.hasAttribute("ref")) { String ref = groupEl.getAttribute("ref"); group.refName = getRefQName(ref, groupEl); return group; } for (Element el = XDOMUtil.getFirstChildElementNS(groupEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElement(el)) { if (el.getLocalName().equals("sequence")) { group.particle = handleSequence(schema, el, schemaEl); } else if (el.getLocalName().equals("all")) { group.particle = handleAll(schema, el, schemaEl); } else if (el.getLocalName().equals("choice")) { group.particle = handleChoice(schema, el, schemaEl); } } return group; } private QName newLocalQName(String pLocalName) { String uri = schema.logicalTargetNamespace; if (uri == null) { uri = Constants.NULL_NS_URI; } return new QName(uri, pLocalName); } /** * Process non-toplevel attributes * @param schema * @param attrEl * @param schemaEl * @return */ private XmlSchemaAttribute handleAttribute(XmlSchema schema, Element attrEl, Element schemaEl) { return handleAttribute(schema, attrEl, schemaEl, false); } /** * Process attributes * @param schema * @param attrEl * @param schemaEl * @param topLevel * @return */ private XmlSchemaAttribute handleAttribute(XmlSchema schema, Element attrEl, Element schemaEl, boolean topLevel) { //todo: need to implement different rule of attribute such as //restriction between ref and name. This can be implemented //in the compile function XmlSchemaAttribute attr = new XmlSchemaAttribute(); if (attrEl.hasAttribute("name")) { String name = attrEl.getAttribute("name"); //String namespace = (schema.targetNamespace==null)? // "" :schema.targetNamespace; attr.name = name; } boolean isQualified = schema.getAttributeFormDefault().getValue() .equals(XmlSchemaForm.QUALIFIED); if (attr.name != null) { final String name = attr.name; if (topLevel) { attr.qualifiedName = newLocalQName(name); } else { attr.qualifiedName = (isQualified) ? newLocalQName(name) : new QName(name); } } if (attrEl.hasAttribute("type")) { String name = attrEl.getAttribute("type"); attr.schemaTypeName = getRefQName(name, attrEl); } if (attrEl.hasAttribute("default")) attr.defaultValue = attrEl.getAttribute("default"); if (attrEl.hasAttribute("fixed")) attr.fixedValue = attrEl.getAttribute("fixed"); if (attrEl.hasAttribute("form")) { String formValue = getEnumString(attrEl, "form"); attr.form = new XmlSchemaForm(formValue); } if (attrEl.hasAttribute("id")) attr.id = attrEl.getAttribute("id"); if (attrEl.hasAttribute("use")) { String useType = getEnumString(attrEl, "use"); attr.use = new XmlSchemaUse(useType); } if (attrEl.hasAttribute("ref")) { String name = attrEl.getAttribute("ref"); attr.refName = getRefQName(name, attrEl); attr.name = name; } Element simpleTypeEl = XDOMUtil.getFirstChildElementNS(attrEl, XmlSchema.SCHEMA_NS, "simpleType"); if (simpleTypeEl != null) { attr.schemaType = handleSimpleType(schema, simpleTypeEl, schemaEl); } Element annotationEl = XDOMUtil.getFirstChildElementNS(attrEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); attr.setAnnotation(annotation); } NamedNodeMap attrNodes = attrEl.getAttributes(); Vector attrs = new Vector(); NodeNamespaceContext ctx = null; for (int i = 0; i < attrNodes.getLength(); i++) { Attr att = (Attr) attrNodes.item(i); String attName = att.getName(); if (!attName.equals("name") && !attName.equals("type") && !attName.equals("default") && !attName.equals("fixed") && !attName.equals("form") && !attName.equals("id") && !attName.equals("use") && !attName.equals("ref")) { attrs.add(att); String value = att.getValue(); if (value.indexOf(":") > -1) { // there is a possiblily of some namespace mapping String prefix = value.substring(0, value.indexOf(":")); if (ctx == null) { ctx = new NodeNamespaceContext(attrEl); } String namespace = ctx.getNamespaceURI(prefix); if (!Constants.NULL_NS_URI.equals(namespace)) { Attr nsAttr = attrEl.getOwnerDocument() .createAttribute("xmlns:" + prefix); nsAttr.setValue(namespace); attrs.add(nsAttr); } } } } if (attrs.size() > 0) attr.setUnhandledAttributes((Attr[]) attrs.toArray(new Attr[0])); //process extra attributes and elements processExtensibilityComponents(attr, attrEl); return attr; } /* * handle_simple_content_restriction * * if( restriction has base attribute ) * set the baseType * else if( restriciton has an inline simpleType ) * handleSimpleType * add facets if any to the restriction */ /* * handle_simple_content_extension * * extension should have a base name and cannot have any inline defn * for( each childNode ) * if( attribute) * handleAttribute * else if( attributeGroup) * handleAttributeGroup * else if( anyAttribute) * handleAnyAttribute */ /* * ******** * handle_complex_content_restriction */ /** * handle elements * @param schema * @param el * @param schemaEl * @param isGlobal */ XmlSchemaElement handleElement(XmlSchema schema, Element el, Element schemaEl, boolean isGlobal) { XmlSchemaElement element = new XmlSchemaElement(); if (el.getAttributeNode("name") != null) element.name = el.getAttribute("name"); // String namespace = (schema.targetNamespace==null)? // "" : schema.targetNamespace; boolean isQualified = schema.getElementFormDefault().getValue().equals( XmlSchemaForm.QUALIFIED); if (el.hasAttribute("form")) { String formDef = el.getAttribute("form"); element.form = new XmlSchemaForm(formDef); isQualified = formDef.equals(XmlSchemaForm.QUALIFIED); } if (element.name != null) { final String name = element.name; element.qualifiedName = (isQualified || isGlobal) ? newLocalQName(name) : new QName(Constants.NULL_NS_URI, name); } Element annotationEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); element.setAnnotation(annotation); } if (el.getAttributeNode("type") != null) { String typeName = el.getAttribute("type"); QName typeQName = element.schemaTypeName = getRefQName(typeName, el); XmlSchemaType type = collection.getTypeByQName(typeQName); if (type == null) { // Could be a forward reference... collection.addUnresolvedType(typeQName, element); } element.schemaType = type; } else if (el.getAttributeNode("ref") != null) { String refName = el.getAttribute("ref"); QName refQName = getRefQName(refName, el); element.setRefName(refQName); element.name = refQName.getLocalPart(); } Element simpleTypeEl, complexTypeEl, keyEl, keyrefEl, uniqueEl; if ((simpleTypeEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "simpleType")) != null) { XmlSchemaSimpleType simpleType = handleSimpleType(schema, simpleTypeEl, schemaEl); element.schemaType = simpleType; element.schemaTypeName = simpleType.getQName(); } else if ((complexTypeEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "complexType")) != null) { element.schemaType = handleComplexType(schema, complexTypeEl, schemaEl); } if ((keyEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "key")) != null) { while (keyEl != null) { element.constraints.add(handleConstraint(keyEl, "Key")); keyEl = XDOMUtil.getNextSiblingElement(keyEl, "key"); } } if ((keyrefEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "keyref")) != null) { while (keyrefEl != null) { XmlSchemaKeyref keyRef = (XmlSchemaKeyref) handleConstraint( keyrefEl, "Keyref"); if (keyrefEl.hasAttribute("refer")) { String name = keyrefEl.getAttribute("refer"); keyRef.refer = getRefQName(name, el); } element.constraints.add(keyRef); keyrefEl = XDOMUtil.getNextSiblingElement(keyrefEl, "keyref"); } } if ((uniqueEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "unique")) != null) { while (uniqueEl != null) { element.constraints.add(handleConstraint(uniqueEl, "Unique")); uniqueEl = XDOMUtil.getNextSiblingElement(uniqueEl, "unique"); } } if (el.hasAttribute("abstract")) { element.isAbstract = Boolean.valueOf(el.getAttribute("abstract")) .booleanValue(); } if (el.hasAttribute("block")) element.block = getDerivation(el, "block"); if (el.hasAttribute("default")) element.defaultValue = el.getAttribute("default"); if (el.hasAttribute("final")) element.finalDerivation = getDerivation(el, "final"); if (el.hasAttribute("fixed")) element.fixedValue = el.getAttribute("fixed"); if (el.hasAttribute("id")) element.id = el.getAttribute("id"); if (el.hasAttribute("nillable")) element.isNillable = Boolean.valueOf(el.getAttribute("nillable")) .booleanValue(); if (el.hasAttribute("substitutionGroup")) { String substitutionGroup = el.getAttribute("substitutionGroup"); element.setSubstitutionGroup(getRefQName(substitutionGroup, el)); } element.minOccurs = getMinOccurs(el); element.maxOccurs = getMaxOccurs(el); //process extra attributes and elements processExtensibilityComponents(element, el); return element; } private XmlSchemaIdentityConstraint handleConstraint(Element constraintEl, String type) { try { XmlSchemaIdentityConstraint constraint = (XmlSchemaIdentityConstraint) Class .forName("org.apache.ws.commons.schema.XmlSchema" + type) .newInstance(); if (constraintEl.hasAttribute("name")) constraint.name = constraintEl.getAttribute("name"); if (constraintEl.hasAttribute("refer")) { String name = constraintEl.getAttribute("refer"); ((XmlSchemaKeyref) constraint).refer = getRefQName(name, constraintEl); } for (Element el = XDOMUtil.getFirstChildElementNS(constraintEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { // String elPrefix = el.getPrefix() == null ? "" // : el.getPrefix(); //if(elPrefix.equals(schema.schema_ns_prefix)) { if (el.getLocalName().equals("selector")) { XmlSchemaXPath selectorXPath = new XmlSchemaXPath(); selectorXPath.xpath = el.getAttribute("xpath"); Element annotationEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); selectorXPath.setAnnotation(annotation); } constraint.selector = selectorXPath; } else if (el.getLocalName().equals("field")) { XmlSchemaXPath fieldXPath = new XmlSchemaXPath(); fieldXPath.xpath = el.getAttribute("xpath"); constraint.fields.add(fieldXPath); Element annotationEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); fieldXPath.setAnnotation(annotation); } } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation constraintAnnotation = handleAnnotation(el); constraint.setAnnotation(constraintAnnotation); } } return constraint; } catch (ClassNotFoundException e) { throw new XmlSchemaException(e.getMessage()); } catch (InstantiationException e) { throw new XmlSchemaException(e.getMessage()); } catch (IllegalAccessException e) { throw new XmlSchemaException(e.getMessage()); } } /** * Hanlde the import * @param schema * @param importEl * @param schemaEl * @return XmlSchemaObject */ XmlSchemaImport handleImport(XmlSchema schema, Element importEl, Element schemaEl) { XmlSchemaImport schemaImport = new XmlSchemaImport(); Element annotationEl = XDOMUtil.getFirstChildElementNS(importEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation importAnnotation = handleAnnotation(annotationEl); schemaImport.setAnnotation(importAnnotation); } final String uri = schemaImport.namespace = importEl .getAttribute("namespace"); schemaImport.schemaLocation = importEl.getAttribute("schemaLocation"); TargetNamespaceValidator validator = new TargetNamespaceValidator() { private boolean isEmpty(String pValue) { return pValue == null || Constants.NULL_NS_URI.equals(pValue); } public void validate(XmlSchema pSchema) { final boolean valid; if (isEmpty(uri)) { valid = isEmpty(pSchema.syntacticalTargetNamespace); } else { valid = pSchema.syntacticalTargetNamespace.equals(uri); } if (!valid) { throw new XmlSchemaException( "An imported schema was announced to have the namespace " + uri + ", but has the namespace " + pSchema.syntacticalTargetNamespace); } } }; if ((schemaImport.schemaLocation != null) && (!schemaImport.schemaLocation.equals(""))) { if (schema.getSourceURI() != null) { schemaImport.schema = resolveXmlSchema(uri, schemaImport.schemaLocation, schema.getSourceURI(), validator); } else { schemaImport.schema = resolveXmlSchema(schemaImport.namespace, schemaImport.schemaLocation, validator); } } return schemaImport; } /** * Handles the include * @param schema * @param includeEl * @param schemaEl */ XmlSchemaInclude handleInclude(final XmlSchema schema, Element includeEl, Element schemaEl) { XmlSchemaInclude include = new XmlSchemaInclude(); Element annotationEl = XDOMUtil.getFirstChildElementNS(includeEl, XmlSchema.SCHEMA_NS, "annotation"); if (annotationEl != null) { XmlSchemaAnnotation includeAnnotation = handleAnnotation(annotationEl); include.setAnnotation(includeAnnotation); } include.schemaLocation = includeEl.getAttribute("schemaLocation"); //includes are not supposed to have a target namespace // we should be passing in a null in place of the target //namespace final TargetNamespaceValidator validator = newIncludeValidator(schema); if (schema.getSourceURI() != null) { include.schema = resolveXmlSchema(schema.logicalTargetNamespace, include.schemaLocation, schema.getSourceURI(), validator); } else { include.schema = resolveXmlSchema(schema.logicalTargetNamespace, include.schemaLocation, validator); } //process extra attributes and elements processExtensibilityComponents(include, includeEl); return include; } private TargetNamespaceValidator newIncludeValidator(final XmlSchema schema) { return new TargetNamespaceValidator() { private boolean isEmpty(String pValue) { return pValue == null || Constants.NULL_NS_URI.equals(pValue); } public void validate(XmlSchema pSchema) { if (isEmpty(pSchema.syntacticalTargetNamespace)) { pSchema.logicalTargetNamespace = schema.logicalTargetNamespace; } else { if (!pSchema.syntacticalTargetNamespace .equals(schema.logicalTargetNamespace)) { String msg = "An included schema was announced to have the default target namespace"; if (!isEmpty(schema.logicalTargetNamespace)) { msg += " or the target namespace " + schema.logicalTargetNamespace; } throw new XmlSchemaException(msg + ", but has the target namespace " + pSchema.logicalTargetNamespace); } } } }; } /** * Handles the annotation * Traversing if encounter appinfo or documentation * add it to annotation collection * */ XmlSchemaAnnotation handleAnnotation(Element annotEl) { XmlSchemaObjectCollection content = new XmlSchemaObjectCollection(); XmlSchemaAppInfo appInfoObj; XmlSchemaDocumentation docsObj; for (Element appinfo = XDOMUtil.getFirstChildElementNS(annotEl, XmlSchema.SCHEMA_NS, "appinfo"); appinfo != null; appinfo = XDOMUtil .getNextSiblingElementNS(appinfo, XmlSchema.SCHEMA_NS, "appinfo")) { appInfoObj = handleAppInfo(appinfo); if (appInfoObj != null) { content.add(appInfoObj); } } for (Element documentation = XDOMUtil.getFirstChildElementNS(annotEl, XmlSchema.SCHEMA_NS, "documentation"); documentation != null; documentation = XDOMUtil .getNextSiblingElementNS(documentation, XmlSchema.SCHEMA_NS, "documentation")) { docsObj = handleDocumentation(documentation); if (docsObj != null) { content.add(docsObj); } } XmlSchemaAnnotation annotation = new XmlSchemaAnnotation(); annotation.items = content; //process extra attributes and elements processExtensibilityComponents(annotation, annotEl); return annotation; } /** * create new XmlSchemaAppinfo and add value goten from element * to this obj * @param content */ XmlSchemaAppInfo handleAppInfo(Element content) { XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); NodeList markup = getChildren(content); if (!content.hasAttribute("source") && (markup == null || markup.getLength() <= 0)) { return null; } appInfo.setSource(getAttribute(content, "source")); appInfo.setMarkup(markup); return appInfo; } //iterate each documentation element, create new XmlSchemaAppinfo and add to collection XmlSchemaDocumentation handleDocumentation(Element content) { XmlSchemaDocumentation documentation = new XmlSchemaDocumentation(); NodeList markup = getChildren(content); if (!content.hasAttribute("source") && !content.hasAttribute("xml:lang") && (markup == null || markup.getLength() <= 0)) return null; documentation.setSource(getAttribute(content, "source")); documentation.setLanguage(getAttribute(content, "xml:lang")); documentation.setMarkup(getChildren(content)); return documentation; } private String getAttribute(Element content, String attrName) { if (content.hasAttribute(attrName)) return content.getAttribute(attrName); return null; } private NodeList getChildren(Element content) { NodeList childs = content.getChildNodes(); if (childs.getLength() > 0) return childs; return null; } long getMinOccurs(Element el) { try { if (el.getAttributeNode("minOccurs") != null) { String value = el.getAttribute("minOccurs"); if (value.equals("unbounded")) return Long.MAX_VALUE; else return Long.parseLong(value); } return 1; } catch (java.lang.NumberFormatException e) { return 1; } } long getMaxOccurs(Element el) { try { if (el.getAttributeNode("maxOccurs") != null) { String value = el.getAttribute("maxOccurs"); if (value.equals("unbounded")) return Long.MAX_VALUE; else return Long.parseLong(value); } return 1; } catch (java.lang.NumberFormatException e) { return 1; } } XmlSchemaForm getFormDefault(Element el, String attrName) { if (el.getAttributeNode(attrName) != null) { String value = el.getAttribute(attrName); return new XmlSchemaForm(value); } else return new XmlSchemaForm("unqualified"); } //Check value entered by user and change according to .net spec, //according to w3c spec have to be "#all" //but in .net the valid enum value is "all". XmlSchemaDerivationMethod getDerivation(Element el, String attrName) { if (el.hasAttribute(attrName) && !el.getAttribute(attrName).equals("")) { //#all | List of (extension | restriction | substitution String derivationMethod = el.getAttribute(attrName).trim(); if (derivationMethod.equals("#all")) return new XmlSchemaDerivationMethod( Constants.BlockConstants.ALL); else return new XmlSchemaDerivationMethod(derivationMethod); } return new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); } //Check value entered by user and change according to .net spec, user String getEnumString(Element el, String attrName) { if (el.hasAttribute(attrName)) { return el.getAttribute(attrName).trim(); } return Constants.BlockConstants.NONE; } /** * Resolve the schemas * @param targetNamespace * @param schemaLocation */ XmlSchema resolveXmlSchema(String targetNamespace, String schemaLocation, String baseUri, TargetNamespaceValidator validator) { //use the entity resolver provided if the schema location is present null if (schemaLocation != null && !"".equals(schemaLocation)) { InputSource source = collection.schemaResolver.resolveEntity( targetNamespace, schemaLocation, baseUri); //the entity resolver was unable to resolve this!! if (source == null) { //try resolving it with the target namespace only with the //known namespace map XmlSchema schema = collection.getKnownSchema(targetNamespace); if (schema != null) { return schema; }else{ return null; } } final String systemId = source.getSystemId() == null ? schemaLocation : source.getSystemId(); final SchemaKey key = new XmlSchemaCollection.SchemaKey( targetNamespace, systemId); XmlSchema schema = collection.getSchema(key); if (schema != null) { return schema; } if (collection.check(key)) { collection.push(key); try { return collection.read(source, null, validator); } catch (Exception e) { throw new RuntimeException(e); } finally { collection.pop(); } } }else{ XmlSchema schema = collection.getKnownSchema(targetNamespace); if (schema != null) { return schema; } } return null; } /** * Resolve the schemas * @param targetNamespace * @param schemaLocation */ XmlSchema resolveXmlSchema(String targetNamespace, String schemaLocation, TargetNamespaceValidator validator) { return resolveXmlSchema(targetNamespace, schemaLocation, collection.baseUri, validator); } /** * A generic method to process the extra attributes and the the extra * elements present within the schema. * What are considered extensions are child elements with non schema namespace * and child attributes with any namespace * @param schemaObject * @param parentElement */ private void processExtensibilityComponents(XmlSchemaObject schemaObject, Element parentElement) { if (extReg != null) { //process attributes NamedNodeMap attributes = parentElement.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attribute = (Attr) attributes.item(i); String namespaceURI = attribute.getNamespaceURI(); String name = attribute.getLocalName(); if (namespaceURI != null && !"".equals(namespaceURI) && //ignore unqualified attributes !namespaceURI .startsWith(Constants.XMLNS_ATTRIBUTE_NS_URI) && //ignore namespaces !Constants.URI_2001_SCHEMA_XSD.equals(namespaceURI)) //does not belong to the schema namespace by any chance! { QName qName = new QName(namespaceURI, name); extReg.deserializeExtension(schemaObject, qName, attribute); } } //process elements NodeList allChildren = parentElement.getChildNodes(); for (int i = 0; i < allChildren.getLength(); i++) { if (allChildren.item(i).getNodeType() == Node.ELEMENT_NODE) { Element extElement = (Element) allChildren.item(i); String namespaceURI = extElement.getNamespaceURI(); String name = extElement.getLocalName(); if (namespaceURI != null && !Constants.URI_2001_SCHEMA_XSD .equals(namespaceURI)) //does not belong to the schema namespace { QName qName = new QName(namespaceURI, name); extReg.deserializeExtension(schemaObject, qName, extElement); } } } } } } ./src/org/apache/ws/commons/schema/XmlSchemaForm.java0000664000175000017500000000303011767656530021714 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Enum; /** * Indicates if attributes or elements need to be qualified or left unqualified. */ public class XmlSchemaForm extends Enum { public static final String QUALIFIED = "qualified"; public static final String UNQUALIFIED = "unqualified"; public static final String NONE = "none"; static String[] members = new String[]{NONE, QUALIFIED, UNQUALIFIED}; /** * Creates new XmlSchemaForm */ public XmlSchemaForm() { super(); } public XmlSchemaForm(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java0000664000175000017500000000612211767656530025655 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for complex types with a complex content model derived by extension. * Extends the complex type by adding attributes or elements. Represents the * World Wide Web Consortium (W3C) extension element for complex content. */ public class XmlSchemaComplexContentExtension extends XmlSchemaContent { /** * Creates new XmlSchemaComplexContentExtension */ public XmlSchemaComplexContentExtension() { attributes = new XmlSchemaObjectCollection(); } /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/ XmlSchemaAnyAttribute anyAttribute; public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } public XmlSchemaAnyAttribute getAnyAttribute() { return this.anyAttribute; } /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/ XmlSchemaObjectCollection attributes; public XmlSchemaObjectCollection getAttributes() { return this.attributes; } /* Name of the built-in data type, simple type, or complex type.*/ QName baseTypeName; public void setBaseTypeName(QName baseTypeName) { this.baseTypeName = baseTypeName; } public QName getBaseTypeName() { return this.baseTypeName; } /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.*/ XmlSchemaParticle particle; public XmlSchemaParticle getParticle() { return this.particle; } public void setParticle(XmlSchemaParticle particle) { this.particle = particle; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "extension>\n"; if (particle != null) xml += particle.toString(prefix, (tab + 1)); for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaChoice.java0000664000175000017500000000235611767656530022215 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Allows only one of its children to appear in an instance. Represents * the World Wide Web Consortium (W3C) choice (compositor) element. */ public class XmlSchemaChoice extends XmlSchemaGroupBase { /** * Creates new XmlSchemaChoice */ public XmlSchemaChoice() { } public XmlSchemaObjectCollection getItems() { return this.items; } } ./src/org/apache/ws/commons/schema/XmlSchemaExternal.java0000664000175000017500000000277411767656530022611 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * An abstract class. Provides information about the included schema. */ public abstract class XmlSchemaExternal extends XmlSchemaAnnotated { /** * Creates new XmlSchemaExternal */ protected XmlSchemaExternal() { } XmlSchema schema; public XmlSchema getSchema() { return schema; } public void setSchema(XmlSchema schema) { this.schema = schema; } String schemaLocation; public String getSchemaLocation() { return schemaLocation; } public void setSchemaLocation(String schemaLocation) { this.schemaLocation = schemaLocation; } } ./src/org/apache/ws/commons/schema/XmlSchemaSequence.java0000664000175000017500000000403311767656530022565 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Requires the elements in the group to appear in the specified sequence * within the containing element. Represents the World Wide Web Consortium * (W3C) sequence (compositor) element. */ public class XmlSchemaSequence extends XmlSchemaGroupBase { /** * Creates new XmlSchemaSequence */ public XmlSchemaSequence() { } /** * The elements contained within the compositor. * Collection of XmlSchemaElement, XmlSchemaGroupRef, * XmlSchemaChoice, XmlSchemaSequence, or XmlSchemaAny. */ public XmlSchemaObjectCollection getItems() { return items; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "sequence>\n"; for (int i = 0; i < items.getCount(); i++) { xml += items.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaDatatype.java0000664000175000017500000000221511767656530022570 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; public abstract class XmlSchemaDatatype { /** * Creates new XmlSchemaDatatype */ public XmlSchemaDatatype() { } public abstract Object parseValue(Object input); public abstract Class valueType(); public abstract XmlTokenizedType tokenizedType(); } ./src/org/apache/ws/commons/schema/XmlSchemaNotation.java0000664000175000017500000000352611767656530022616 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class represents a notation. An XML Schema definition language (XSD) * notation declaration is a reconstruction of XML 1.0 NOTATION * declarations. The purpose of notations is to describe the format of * non-XML data within an XML document. Represents the World Wide Web Consortium * (W3C) notation element. */ public class XmlSchemaNotation extends XmlSchemaAnnotated { String name, system, publicNotation; /** * Creates new XmlSchemaNotation */ public XmlSchemaNotation() { } public String getName() { return name; } public void setString(String name) { this.name = name; } public String getPublic() { return publicNotation; } public void setPublic(String publicNotation) { this.publicNotation = publicNotation; } public String getSystem() { return system; } public void setSystem(String system) { this.system = system; } } ./src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.java0000664000175000017500000000316311767656530024017 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /* * XmlSchemaWhiteSpaceFacet.java */ package org.apache.ws.commons.schema; /** * Class for defining whiteSpace facets. Represents the World Wide * Web Consortium (W3C) whiteSpace facet. */ public class XmlSchemaWhiteSpaceFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaWhiteSpaceFacet */ public XmlSchemaWhiteSpaceFacet() { } public XmlSchemaWhiteSpaceFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java0000664000175000017500000000354311767656530023435 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Enables any attribute from the specified namespace or namespaces * to appear in the containing complexType element. Represents the * World Wide Web Consortium (W3C) anyAttribute element. */ public class XmlSchemaAnyAttribute extends XmlSchemaAnnotated { /** * Creates new XmlSchemaAnyAttribute */ public XmlSchemaAnyAttribute() { processContent = new XmlSchemaContentProcessing( Constants.BlockConstants.NONE); } String namespace; public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } XmlSchemaContentProcessing processContent; public XmlSchemaContentProcessing getProcessContent() { return processContent; } public void setProcessContent(XmlSchemaContentProcessing processContent) { this.processContent = processContent; } } ./src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java0000664000175000017500000000315711767656530024472 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Provides information about the validation mode of any * and anyAttribute element replacements. */ public class XmlSchemaContentProcessing extends org.apache.ws.commons.schema.constants.Enum { static String[] members = new String[]{ Constants.BlockConstants.LAX, Constants.BlockConstants.NONE, Constants.BlockConstants.SKIP, Constants.BlockConstants.STRICT }; /** * Creates new XmlSeverityType */ public XmlSchemaContentProcessing() { super(); } public XmlSchemaContentProcessing(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaGroupBase.java0000664000175000017500000000237511767656530022713 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * An abstract class for XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence. */ public abstract class XmlSchemaGroupBase extends XmlSchemaParticle { XmlSchemaObjectCollection items; /** * Creates new XmlSchemaGroupBase */ public XmlSchemaGroupBase() { items = new XmlSchemaObjectCollection(); } public abstract XmlSchemaObjectCollection getItems(); } ./src/org/apache/ws/commons/schema/XmlSchemaLengthFacet.java0000664000175000017500000000315511767656530023205 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining length facets. Represents the World Wide Web * Consortium (W3C) length facet. */ public class XmlSchemaLengthFacet extends XmlSchemaNumericFacet { /** * Creates new XmlSchemaLengthFacet */ public XmlSchemaLengthFacet() { } public XmlSchemaLengthFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaEnumerationFacet.java0000664000175000017500000000321611767656530024250 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining enumeration facets. Represents the World Wide * Web Consortium (W3C) enumeration facet. */ public class XmlSchemaEnumerationFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaEnumerationFacet */ public XmlSchemaEnumerationFacet() { } public XmlSchemaEnumerationFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaImport.java0000664000175000017500000000254111767656530022271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * The class to import schema components from any schema. * Represents the World Wide Web Consortium (W3C) import element. */ public class XmlSchemaImport extends XmlSchemaExternal { /** * Creates new XmlSchemaImport */ public XmlSchemaImport() { super(); } String namespace; public String getNamespace() { return this.namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } } ./src/org/apache/ws/commons/schema/XmlSchemaAttribute.java0000664000175000017500000000702711767656530022766 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import javax.xml.namespace.QName; /** * Class for attribute types. Represents the World Wide Web Consortium * (W3C) attribute element. */ // October 15th - momo - initial implementation public class XmlSchemaAttribute extends XmlSchemaAnnotated { Object attributeType; String defaultValue, fixedValue, name; XmlSchemaForm form; XmlSchemaSimpleType schemaType; QName schemaTypeName, qualifiedName, refName; XmlSchemaUse use; /** * Creates new XmlSchemaAttribute */ public XmlSchemaAttribute() { form = new XmlSchemaForm(XmlSchemaForm.NONE); use = new XmlSchemaUse(Constants.BlockConstants.NONE); } public Object getAttributeType() { return attributeType; } public String getDefaultValue() { return defaultValue; } public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public String getFixedValue() { return fixedValue; } public void setFixedValue(String fixedValue) { this.fixedValue = fixedValue; } public XmlSchemaForm getForm() { return form; } public void setSchemaForm(XmlSchemaForm form) { this.form = form; } public QName getQName() { return qualifiedName; } public void setQName(QName qualifiedName) { this.qualifiedName = qualifiedName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public QName getRefName() { return refName; } public void setRefName(QName refName) { this.refName = refName; } public XmlSchemaSimpleType getSchemaType() { return schemaType; } public void setSchemaType(XmlSchemaSimpleType schemaType) { this.schemaType = schemaType; } public QName getSchemaTypeName() { return schemaTypeName; } public void setSchemaTypeName(QName schemaTypeName) { this.schemaTypeName = schemaTypeName; } public XmlSchemaUse getUse() { return use; } public void setUse(XmlSchemaUse use) { this.use = use; } public String toString(String prefix, int tab) { String xml = new String(); if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; for (int i = 0; i < tab; i++) xml += "\t"; xml += "<" + prefix + "attribute name=\"" + name + "\" type=\"" + schemaTypeName + "\"/>\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaContentType.java0000664000175000017500000000322411767656530023272 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.constants.Enum; /** * Enumerations for the content model of the complex type. This * represents the content in the post-schema-validation infoset. */ public class XmlSchemaContentType extends Enum { static String[] members = new String[]{ Constants.BlockConstants.ELEMENT_ONLY, Constants.BlockConstants.EMPTY, Constants.BlockConstants.MIXED, Constants.BlockConstants.TEXT_ONLY}; /** * Creates new XmlSchemaContentType */ public XmlSchemaContentType() { super(); } public XmlSchemaContentType(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaObjectEnumerator.java0000664000175000017500000000212611767656530024266 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * An enumerator class to walk the XmlSchemaObjectCollection collections. */ public class XmlSchemaObjectEnumerator { /** * Creates new XmlSchemaObjectEnumerator */ public XmlSchemaObjectEnumerator() { } } ./src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java0000664000175000017500000000262411767656530024436 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for the attribute group reference. Represents the World Wide * Web Consortium (W3C) attributeGroup element with the ref attribute. */ public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated { /** * Creates new XmlSchemaAttributeGroupRef */ public XmlSchemaAttributeGroupRef() { } QName refName; public QName getRefName() { return this.refName; } public void setRefName(QName refName) { this.refName = refName; } } ./src/org/apache/ws/commons/schema/XmlSchemaUnique.java0000664000175000017500000000222011767656530022257 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Identifies a unique constraint among a set of elements. Represents * the World Wide Web Consortium (W3C) unique element. */ public class XmlSchemaUnique extends XmlSchemaIdentityConstraint { /** * Creates new XmlSchemaUnique */ public XmlSchemaUnique() { } } ./src/org/apache/ws/commons/schema/XmlSchemaMaxInclusiveFacet.java0000664000175000017500000000312011767656530024363 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining maxInclusive facets. Represents the World * Wide Web Consortium (W3C) maxInclusive facet. */ public class XmlSchemaMaxInclusiveFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaMaxInclusiveFacet */ public XmlSchemaMaxInclusiveFacet() { } public XmlSchemaMaxInclusiveFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaRedefine.java0000664000175000017500000000355411767656530022545 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Allows simple and complex types, groups, and attribute groups from * external schema files to be redefined in the current schema. This * class provides versioning for the schema elements. Represents the * World Wide Web Consortium (W3C) redefine element. */ public class XmlSchemaRedefine extends XmlSchemaExternal { /** * Creates new XmlSchemaRedefine */ public XmlSchemaRedefine() { items = new XmlSchemaObjectCollection(); schemaTypes = new XmlSchemaObjectTable(); groups = new XmlSchemaObjectTable(); attributeGroups = new XmlSchemaObjectTable(); } XmlSchemaObjectTable attributeGroups, groups, schemaTypes; public XmlSchemaObjectTable getAttributeGroup() { return attributeGroups; } public XmlSchemaObjectTable getGroup() { return groups; } XmlSchemaObjectCollection items; public XmlSchemaObjectCollection getItems() { return items; } public XmlSchemaObjectTable getSchemaTypes() { return schemaTypes; } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java0000664000175000017500000000516211767656530025342 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for the restriction of simpleType elements. Represents the World * Wide Web Consortium (W3C) restriction element for simple types. */ public class XmlSchemaSimpleTypeRestriction extends XmlSchemaSimpleTypeContent { /** * Creates new XmlSchemaSimpleTypeRestriction */ public XmlSchemaSimpleTypeRestriction() { facets = new XmlSchemaObjectCollection(); } XmlSchemaSimpleType baseType; public XmlSchemaSimpleType getBaseType() { return this.baseType; } public void setBaseType(XmlSchemaSimpleType baseType) { this.baseType = baseType; } QName baseTypeName; public QName getBaseTypeName() { return this.baseTypeName; } public void setBaseTypeName(QName baseTypeName) { this.baseTypeName = baseTypeName; } XmlSchemaObjectCollection facets;// = new XmlSchemaObjectCollection(); public XmlSchemaObjectCollection getFacets() { return this.facets; } public String toString(String prefix, int tab) { String xml = new String(); if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; for (int i = 0; i < tab; i++) xml += "\t"; xml += "<" + prefix + "restriction "; if (baseTypeName != null) { xml += "base =\"" + baseTypeName + "\">\n"; } else { xml += ">\n"; // inline def xml += baseType.toString(prefix, (tab + 1)); } xml += facets.toString(prefix, (tab + 1)); for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaAnnotation.java0000664000175000017500000000244011767656530023127 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Defines an annotation. Represents the World Wide Web Consortium (W3C) * annotation element. */ public class XmlSchemaAnnotation extends XmlSchemaObject { XmlSchemaObjectCollection items; /** * Creates new XmlSchemaAnnotation */ public XmlSchemaAnnotation() { items = new XmlSchemaObjectCollection(); } public XmlSchemaObjectCollection getItems() { return items; } } ./src/org/apache/ws/commons/schema/XmlSchemaException.java0000664000175000017500000000310011767656530022745 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Returns detailed information about the schema exception. */ public class XmlSchemaException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; /** * Creates new XmlSchemaException */ public XmlSchemaException() { } public XmlSchemaException(String message) { super(message); } public XmlSchemaException(String message, Throwable cause) { super(message, cause); } // TODO :implement public int getLineNumer() { return 1; } public int getLinePosition() { return 1; } public XmlSchemaObject getSourceSchemaObject() { return null; } public String getSourceUri() { return null; } } ./src/org/apache/ws/commons/schema/XmlSchemaElement.java0000664000175000017500000001576511767656530022424 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import javax.xml.namespace.QName; /** * Class for elements. Represents the World Wide Web Consortium (W3C) element element. */ public class XmlSchemaElement extends XmlSchemaParticle implements TypeReceiver { /** * Attribute used to block a type derivation. */ XmlSchemaDerivationMethod block; /** * The value after an element has been compiled to post-schema infoset. * This value is either from the type itself or, if not defined on the type, taken from the schema element. */ XmlSchemaDerivationMethod blockResolved; XmlSchemaObjectCollection constraints; /** * Provides the default value of the element if its content * is a simple type or the element's content is textOnly. */ String defaultValue; String fixedValue; /** * Returns the correct common runtime library * object based upon the SchemaType for the element. */ Object elementType; XmlSchemaDerivationMethod finalDerivation; XmlSchemaDerivationMethod finalDerivationResolved; /** * The default value is the value of the elementFormDefault attribute for the schema element containing the attribute. * The default is Unqualified. */ XmlSchemaForm form; boolean isAbstract; boolean isNillable; String name; QName qualifiedName; QName refName; /** * Returns the type of the element. * This can either be a complex type or a simple type. */ XmlSchemaType schemaType; /** * QName of a built-in data type defined in this schema or another * schema indicated by the specified namespace. */ QName schemaTypeName; /** * QName of an element that can be a substitute for this element. */ QName substitutionGroup; /** * Creates new XmlSchemaElement */ public XmlSchemaElement() { constraints = new XmlSchemaObjectCollection(); isAbstract = false; isNillable = false; form = new XmlSchemaForm(XmlSchemaForm.NONE); finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); } /** * Returns a collection of constraints on the element. */ public XmlSchemaObjectCollection getConstraints() { return constraints; } public String getDefaultValue() { return defaultValue; } public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public XmlSchemaDerivationMethod getBlock() { return block; } public void setBlock(XmlSchemaDerivationMethod block) { this.block = block; } public XmlSchemaDerivationMethod getFinal() { return finalDerivation; } public void setFinal(XmlSchemaDerivationMethod finalDerivation) { this.finalDerivation = finalDerivation; } public XmlSchemaDerivationMethod getBlockResolved() { return blockResolved; } public String getFixedValue() { return fixedValue; } public void setFixedValue(String fixedValue) { this.fixedValue = fixedValue; } public Object getElementType() { return elementType; } public XmlSchemaForm getForm() { return form; } public void setForm(XmlSchemaForm form) { this.form = form; } public boolean isAbstract() { return isAbstract; } public void setAbstract(boolean isAbstract) { this.isAbstract = isAbstract; } public boolean isNillable() { return isNillable; } public void setNillable(boolean isNillable) { this.isNillable = isNillable; } public String getName() { return name; } public void setName(String name) { this.name = name; } public QName getRefName() { return refName; } public void setRefName(QName refName) { this.refName = refName; } public QName getQName() { return qualifiedName; } public void setQName(QName qualifiedName) { this.qualifiedName = qualifiedName; } public XmlSchemaType getSchemaType() { return schemaType; } public void setSchemaType(XmlSchemaType schemaType) { this.schemaType = schemaType; } public QName getSchemaTypeName() { return schemaTypeName; } public void setSchemaTypeName(QName schemaTypeName) { this.schemaTypeName = schemaTypeName; } public QName getSubstitutionGroup() { return substitutionGroup; } public void setSubstitutionGroup(QName substitutionGroup) { this.substitutionGroup = substitutionGroup; } public String toString(String prefix, int tab) { String xml = new String(); if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; for (int i = 0; i < tab; i++) xml += "\t"; xml += "<" + prefix + "element "; if (!name.equals("")) xml += "name=\"" + name + "\" "; if (schemaTypeName != null) xml += "type=\"" + schemaTypeName + "\""; if (refName != null) xml += "ref=\"" + refName + "\" "; if (minOccurs != 1) xml += "minOccurs=\"" + minOccurs + "\" "; if (maxOccurs != 1) xml += "maxOccurs=\"" + maxOccurs + "\" "; if (isNillable) xml += "nillable=\"" + isNillable + "\" "; xml += ">\n"; if (constraints != null) xml += constraints.toString(prefix, (tab + 1)); if (schemaType != null) { xml += schemaType.toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } public void setType(XmlSchemaType type) { this.schemaType = type; } } ./src/org/apache/ws/commons/schema/utils/0000775000175000017500000000000011767656530017510 5ustar brianbrian./src/org/apache/ws/commons/schema/utils/NamespaceContextOwner.java0000664000175000017500000000207411767656530024632 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; /** * Interface of an object, which is able to provide a namespace * context. */ public interface NamespaceContextOwner { /** * Returns the objects namespace context. */ NamespacePrefixList getNamespaceContext(); } ./src/org/apache/ws/commons/schema/utils/PrefixCollector.java0000664000175000017500000000520111767656530023455 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import org.apache.ws.commons.schema.constants.Constants; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * Searches for namespace prefix declarations. */ public abstract class PrefixCollector { /** * Records a single namespace prefix declaration. */ protected abstract void declare(String pPrefix, String pNamespaceURI); /** * Searches for namespace prefix declarations in the given node. * For any prefix declaration, it invokes {@link #declare(String, String)}. * This method doesn't work recursively: The parent nodes prefix * declarations are ignored. */ public void searchLocalPrefixDeclarations(Node pNode) { if (pNode.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap map = pNode.getAttributes(); for (int i = 0; i < map.getLength(); i++) { Node attr = map.item(i); final String uri = attr.getNamespaceURI(); if (Constants.XMLNS_ATTRIBUTE_NS_URI.equals(uri)) { String localName = attr.getLocalName(); String prefix = Constants.XMLNS_ATTRIBUTE.equals(localName) ? Constants.DEFAULT_NS_PREFIX : localName; declare(prefix, attr.getNodeValue()); } } } } /** * Searches for namespace prefix declarations in the given node. * For any prefix declaration, it invokes {@link #declare(String, String)}. * This method works recursively: The parent nodes prefix * declarations are collected before the current nodes. */ public void searchAllPrefixDeclarations(Node pNode) { Node parent = pNode.getParentNode(); if (parent != null) { searchAllPrefixDeclarations(parent); } searchLocalPrefixDeclarations(pNode); } } ./src/org/apache/ws/commons/schema/utils/DOMUtil.java0000664000175000017500000005132211767656530021633 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import org.w3c.dom.*; import java.lang.reflect.Method; /** * Some useful utility methods. * This class was modified in Xerces2 with a view to abstracting as * much as possible away from the representation of the underlying * parsed structure (i.e., the DOM). This was done so that, if Xerces * ever adopts an in-memory representation more efficient than the DOM * (such as a DTM), we should easily be able to convert our schema * parsing to utilize it. * * @version $ID DOMUtil */ public class DOMUtil { private static final String DEFAULT_ENCODING = "UTF-8"; // // Constructors // /** * This class cannot be instantiated. */ protected DOMUtil() { } // // Public static methods // /** * Finds and returns the first child element node. */ public static Element getFirstChildElement(Node parent) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { return (Element) child; } child = child.getNextSibling(); } // not found return null; } // getFirstChildElement(Node):Element /** * Finds and returns the last child element node. */ public static Element getLastChildElement(Node parent) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { return (Element) child; } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElement(Node):Element /** * Finds and returns the next sibling element node. */ public static Element getNextSiblingElement(Node node) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { return (Element) sibling; } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingElement(Node):Element /** * Finds and returns the first child node with the given name. */ public static Element getFirstChildElement(Node parent, String elemName) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { if (child.getNodeName().equals(elemName)) { return (Element) child; } } child = child.getNextSibling(); } // not found return null; } // getFirstChildElement(Node,String):Element /** * Finds and returns the last child node with the given name. */ public static Element getLastChildElement(Node parent, String elemName) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { if (child.getNodeName().equals(elemName)) { return (Element) child; } } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElement(Node,String):Element /** * Finds and returns the next sibling node with the given name. */ public static Element getNextSiblingElement(Node node, String elemName) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { if (sibling.getNodeName().equals(elemName)) { return (Element) sibling; } } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingdElement(Node,String):Element /** * Finds and returns the first child node with the given qualified name. */ public static Element getFirstChildElementNS(Node parent, String uri, String localpart) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { String childURI = child.getNamespaceURI(); if (childURI != null && childURI.equals(uri) && child.getLocalName().equals(localpart)) { return (Element) child; } } child = child.getNextSibling(); } // not found return null; } // getFirstChildElementNS(Node,String,String):Element /** * Finds and returns the last child node with the given qualified name. */ public static Element getLastChildElementNS(Node parent, String uri, String localpart) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { String childURI = child.getNamespaceURI(); if (childURI != null && childURI.equals(uri) && child.getLocalName().equals(localpart)) { return (Element) child; } } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElementNS(Node,String,String):Element /** * Finds and returns the next sibling node with the given qualified name. */ public static Element getNextSiblingElementNS(Node node, String uri, String localpart) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { String siblingURI = sibling.getNamespaceURI(); if (siblingURI != null && siblingURI.equals(uri) && sibling.getLocalName().equals(localpart)) { return (Element) sibling; } } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingdElementNS(Node,String,String):Element /** * Finds and returns the first child node with the given name. */ public static Element getFirstChildElement(Node parent, String elemNames[]) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { if (child.getNodeName().equals(elemNames[i])) { return (Element) child; } } } child = child.getNextSibling(); } // not found return null; } // getFirstChildElement(Node,String[]):Element /** * Finds and returns the last child node with the given name. */ public static Element getLastChildElement(Node parent, String elemNames[]) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { if (child.getNodeName().equals(elemNames[i])) { return (Element) child; } } } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElement(Node,String[]):Element /** * Finds and returns the next sibling node with the given name. */ public static Element getNextSiblingElement(Node node, String elemNames[]) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { if (sibling.getNodeName().equals(elemNames[i])) { return (Element) sibling; } } } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingdElement(Node,String[]):Element /** * Finds and returns the first child node with the given qualified name. */ public static Element getFirstChildElementNS(Node parent, String[][] elemNames) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { String uri = child.getNamespaceURI(); if (uri != null && uri.equals(elemNames[i][0]) && child.getLocalName().equals(elemNames[i][1])) { return (Element) child; } } } child = child.getNextSibling(); } // not found return null; } // getFirstChildElementNS(Node,String[][]):Element /** * Finds and returns the last child node with the given qualified name. */ public static Element getLastChildElementNS(Node parent, String[][] elemNames) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { String uri = child.getNamespaceURI(); if (uri != null && uri.equals(elemNames[i][0]) && child.getLocalName().equals(elemNames[i][1])) { return (Element) child; } } } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElementNS(Node,String[][]):Element /** * Finds and returns the next sibling node with the given qualified name. */ public static Element getNextSiblingElementNS(Node node, String[][] elemNames) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { for (int i = 0; i < elemNames.length; i++) { String uri = sibling.getNamespaceURI(); if (uri != null && uri.equals(elemNames[i][0]) && sibling.getLocalName().equals(elemNames[i][1])) { return (Element) sibling; } } } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingdElementNS(Node,String[][]):Element /** * Finds and returns the first child node with the given name and * attribute name, value pair. */ public static Element getFirstChildElement(Node parent, String elemName, String attrName, String attrValue) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) child; if (element.getNodeName().equals(elemName) && element.getAttribute(attrName).equals(attrValue)) { return element; } } child = child.getNextSibling(); } // not found return null; } // getFirstChildElement(Node,String,String,String):Element /** * Finds and returns the last child node with the given name and * attribute name, value pair. */ public static Element getLastChildElement(Node parent, String elemName, String attrName, String attrValue) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) child; if (element.getNodeName().equals(elemName) && element.getAttribute(attrName).equals(attrValue)) { return element; } } child = child.getPreviousSibling(); } // not found return null; } // getLastChildElement(Node,String,String,String):Element /** * Finds and returns the next sibling node with the given name and * attribute name, value pair. Since only elements have attributes, * the node returned will be of type Node.ELEMENT_NODE. */ public static Element getNextSiblingElement(Node node, String elemName, String attrName, String attrValue) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) sibling; if (element.getNodeName().equals(elemName) && element.getAttribute(attrName).equals(attrValue)) { return element; } } sibling = sibling.getNextSibling(); } // not found return null; } // getNextSiblingElement(Node,String,String,String):Element /** * Returns the concatenated child text of the specified node. * This method only looks at the immediate children of type * Node.TEXT_NODE or the children of any child * node that is of type Node.CDATA_SECTION_NODE * for the concatenation. * * @param node The node to look at. */ public static String getChildText(Node node) { // is there anything to do? if (node == null) { return null; } // concatenate children text StringBuffer str = new StringBuffer(); Node child = node.getFirstChild(); while (child != null) { short type = child.getNodeType(); if (type == Node.TEXT_NODE) { str.append(child.getNodeValue()); } else if (type == Node.CDATA_SECTION_NODE) { str.append(getChildText(child)); } child = child.getNextSibling(); } // return text value return str.toString(); } // getChildText(Node):String // return the name of this element public static String getName(Node node) { return node.getNodeName(); } // getLocalName(Element): String /** * returns local name of this element if not null, otherwise * returns the name of the node */ public static String getLocalName(Node node) { String name = node.getLocalName(); return (name != null) ? name : node.getNodeName(); } // getLocalName(Element): String public static Element getParent(Element elem) { Node parent = elem.getParentNode(); if (parent instanceof Element) return (Element) parent; return null; } // getParent(Element):Element // get the Document of which this Node is a part public static Document getDocument(Node node) { return node.getOwnerDocument(); } // getDocument(Node):Document // return this Document's root node public static Element getRoot(Document doc) { return doc.getDocumentElement(); } // getRoot(Document(: Element // some methods for handling attributes: // return the right attribute node public static Attr getAttr(Element elem, String name) { return elem.getAttributeNode(name); } // getAttr(Element, String):Attr // return the right attribute node public static Attr getAttrNS(Element elem, String nsUri, String localName) { return elem.getAttributeNodeNS(nsUri, localName); } // getAttrNS(Element, String):Attr // get all the attributes for an Element public static Attr[] getAttrs(Element elem) { NamedNodeMap attrMap = elem.getAttributes(); Attr[] attrArray = new Attr[attrMap.getLength()]; for (int i = 0; i < attrMap.getLength(); i++) attrArray[i] = (Attr) attrMap.item(i); return attrArray; } // getAttrs(Element): Attr[] // get attribute's value public static String getValue(Attr attribute) { return attribute.getValue(); } // getValue(Attr):String // It is noteworthy that, because of the way the DOM specs // work, the next two methods return the empty string (not // null!) when the attribute with the specified name does not // exist on an element. Beware! // return the value of the attribute of the given element // with the given name public static String getAttrValue(Element elem, String name) { return elem.getAttribute(name); } // getAttr(Element, String):Attr // return the value of the attribute of the given element // with the given name public static String getAttrValueNS(Element elem, String nsUri, String localName) { return elem.getAttributeNS(nsUri, localName); } // getAttrValueNS(Element, String):Attr // return the namespace URI public static String getNamespaceURI(Node node) { return node.getNamespaceURI(); } /** * Get the input encoding of the document. This uses a DOM 3 API * call getInputEncoding hence it returns the correct value * only if a DOM3 API is used. Otherwise it returns the default encoding * @param doc * @return */ public static String getInputEncoding(Document doc) { try { Method m = Document.class.getMethod("getInputEncoding", new Class[]{}); return (String) m.invoke(doc, new Object[]{}); } catch (Exception e) { return DEFAULT_ENCODING; } } /** * Get the xml encoding of the document. This uses a DOM 3 API * call getXmlEncoding hence it returns the correct value * only if a DOM3 API is used. Otherwise it returns the default encoding * @see #getInputEncoding(Document) * @param doc * @return */ public static String getXmlEncoding(Document doc) { try { Method m = Document.class.getMethod("getXmlEncoding", new Class[]{}); return (String) m.invoke(doc, new Object[]{}); } catch (Exception e) { return DEFAULT_ENCODING; } } } // class XUtil ./src/org/apache/ws/commons/schema/utils/TargetNamespaceValidator.java0000664000175000017500000000216611767656530025271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import org.apache.ws.commons.schema.XmlSchema; /** * Interface of an object, which may validate a schemas target namespace. */ public interface TargetNamespaceValidator { /** * Called for validating the given schemas target namespace. */ void validate(XmlSchema pSchema); } ./src/org/apache/ws/commons/schema/utils/XDOMUtil.java0000664000175000017500000000424411767656530021764 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import org.w3c.dom.Element; import org.w3c.dom.Node; public class XDOMUtil extends DOMUtil { /** * Creates a new instance of XDOMUtil */ private XDOMUtil() { } public static Element getFirstChildElementNS(Node parent, String uri) { // search for node Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { String childURI = child.getNamespaceURI(); if (childURI != null && childURI.equals(uri)) { return (Element) child; } } child = child.getNextSibling(); } // not found return null; } public static Element getNextSiblingElementNS(Node node, String uri) { // search for node Node sibling = node.getNextSibling(); while (sibling != null) { if (sibling.getNodeType() == Node.ELEMENT_NODE) { String siblingURI = sibling.getNamespaceURI(); if (siblingURI != null && siblingURI.equals(uri)) { return (Element) sibling; } } sibling = sibling.getNextSibling(); } // not found return null; } } ./src/org/apache/ws/commons/schema/utils/NamespacePrefixList.java0000664000175000017500000000225411767656530024264 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import javax.xml.namespace.NamespaceContext; /** * Interface of an object, which is able to provide a list of currently * defined namespace prefixes. */ public interface NamespacePrefixList extends NamespaceContext { /** * Returns the list of currently defined namespace prefixes. */ public String[] getDeclaredPrefixes(); } ./src/org/apache/ws/commons/schema/utils/NodeNamespaceContext.java0000664000175000017500000001074511767656530024431 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import org.apache.ws.commons.schema.constants.Constants; import org.w3c.dom.Node; import javax.xml.namespace.NamespaceContext; import java.util.*; /** * Implementation of {@link NamespaceContext}, which is based on a DOM node. */ public class NodeNamespaceContext implements NamespacePrefixList { private static final Collection XML_NS_PREFIX_COLLECTION = Collections.singletonList(Constants.XML_NS_PREFIX); private static final Collection XMLNS_ATTRIBUTE_COLLECTION = Collections.singletonList(Constants.XMLNS_ATTRIBUTE); private Node node; private Map declarations; private String[] prefixes; /** * Creates a new instance with the given nodes context. */ public NodeNamespaceContext(Node pNode) { node = pNode; } private Map getDeclarations() { if (declarations == null) { declarations = new HashMap(); //FIXME: Do we really need to add this mapping? shows up in the serialized schema as xmlns="" //declarations.put(Constants.DEFAULT_NS_PREFIX, Constants.NULL_NS_URI); new PrefixCollector(){ protected void declare(String pPrefix, String pNamespaceURI) { declarations.put(pPrefix, pNamespaceURI); } }.searchAllPrefixDeclarations(node); Collection keys = declarations.keySet(); prefixes = (String[]) keys.toArray(new String[keys.size()]); } return declarations; } public String getNamespaceURI(String pPrefix) { if (pPrefix == null) { throw new IllegalArgumentException("The prefix must not be null."); } if (Constants.XML_NS_PREFIX.equals(pPrefix)) { return Constants.XML_NS_URI; } if (Constants.XMLNS_ATTRIBUTE.equals(pPrefix)) { return Constants.XMLNS_ATTRIBUTE_NS_URI; } final String uri = (String) getDeclarations().get(pPrefix); return uri == null ? Constants.NULL_NS_URI : uri; } public String getPrefix(String pNamespaceURI) { if (pNamespaceURI == null) { throw new IllegalArgumentException("The namespace URI must not be null."); } if (Constants.XML_NS_URI.equals(pNamespaceURI)) { return Constants.XML_NS_PREFIX; } if (Constants.XMLNS_ATTRIBUTE_NS_URI.equals(pNamespaceURI)) { return Constants.XMLNS_ATTRIBUTE; } Map decl = getDeclarations(); for (Iterator iter = decl.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (pNamespaceURI.equals(entry.getValue())) { return (String) entry.getKey(); } } return null; } public Iterator getPrefixes(String pNamespaceURI) { if (pNamespaceURI == null) { throw new IllegalArgumentException("The namespace URI must not be null."); } if (Constants.XML_NS_URI.equals(pNamespaceURI)) { return XML_NS_PREFIX_COLLECTION.iterator(); } if (Constants.XMLNS_ATTRIBUTE_NS_URI.equals(pNamespaceURI)) { return XMLNS_ATTRIBUTE_COLLECTION.iterator(); } final List list = new ArrayList(); for (Iterator iter = getDeclarations().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (pNamespaceURI.equals(entry.getValue())) { list.add(entry.getKey()); } } return list.iterator(); } public String[] getDeclaredPrefixes() { getDeclarations(); // Make sure, that the prefixes array is valid return prefixes; } } ./src/org/apache/ws/commons/schema/utils/NamespaceMap.java0000664000175000017500000000441111767656530022705 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.utils; import java.util.*; public class NamespaceMap extends HashMap implements NamespacePrefixList { /** * */ private static final long serialVersionUID = 1L; public NamespaceMap() { } public NamespaceMap(Map map) { super(map); } public void add(String prefix, String namespaceURI) { put(prefix, namespaceURI); } public String[] getDeclaredPrefixes() { Set keys = keySet(); return (String[]) keys.toArray(new String[keys.size()]); } public String getNamespaceURI(String prefix) { return get(prefix).toString(); } public String getPrefix(String namespaceURI) { Iterator iterator = entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); if (entry.getValue().toString().equals(namespaceURI)) { return (String) entry.getKey(); } } return null; } public Iterator getPrefixes(String namespaceURI) { ArrayList list = new ArrayList(); Iterator iterator = entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); if (entry.getValue().toString().equals(namespaceURI)) { list.add(entry.getKey()); } } return list.iterator(); } } ./src/org/apache/ws/commons/schema/extensions/0000775000175000017500000000000011767656530020547 5ustar brianbrian./src/org/apache/ws/commons/schema/extensions/ExtensionSerializer.java0000664000175000017500000000356311767656530025427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.extensions; import org.apache.ws.commons.schema.XmlSchemaObject; import org.w3c.dom.Node; /** * Interface for the extension serializer. The purpose of an instance * of this is to serialize the relevant custom object * and generate attribute/elementa desired . This custom object * may be stored in the metadata map * of the parent schema object. When to invoke a given serializer is a decision * taken by the extension registry */ public interface ExtensionSerializer { /** * serialize the given element * @param schemaObject - Parent schema object.contains the extension * to be serialized * @param classOfType - The class of type to be serialized * @param domNode - the parent DOM Node that will ultimately be serialized. The XMLSchema * serialization mechanism is to create a DOM tree first and serialize it */ public void serialize(XmlSchemaObject schemaObject, Class classOfType, Node domNode); } ./src/org/apache/ws/commons/schema/extensions/DefaultExtensionDeserializer.java0000664000175000017500000000727511767656530027251 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.extensions; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.constants.Constants; import org.w3c.dom.Node; import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; /** * Default deserializer. The action taken when there is nothing specific * to be done would be to attach the raw element object as it is to the * meta information map for an element or the raw attribute object * */ public class DefaultExtensionDeserializer implements ExtensionDeserializer { /** * deserialize the given element * * @param schemaObject - Parent schema element * @param name - the QName of the element/attribute to be deserialized. * in the case where a deserializer is used to handle multiple elements/attributes * this may be useful to determine the correct deserialization * @param node - the raw DOM Node read from the source. This will be the * extension element itself if for an element or the extension attribute object if * it is an attribute */ public void deserialize(XmlSchemaObject schemaObject, QName name, Node node) { // we just attach the raw node either to the meta map of // elements or the attributes Map metaInfoMap = schemaObject.getMetaInfoMap(); if (metaInfoMap==null){ metaInfoMap = new HashMap(); } if (node.getNodeType()==Node.ATTRIBUTE_NODE){ Map attribMap; if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES)){ attribMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES); }else{ attribMap = new HashMap(); metaInfoMap.put(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES,attribMap); } attribMap.put(name,node); }else if (node.getNodeType()==Node.ELEMENT_NODE){ Map elementMap; if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ELEMENTS)){ elementMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ELEMENTS); }else{ elementMap = new HashMap(); metaInfoMap.put(Constants.MetaDataConstants.EXTERNAL_ELEMENTS,elementMap); } elementMap.put(name,node); } //subsequent processing takes place only if this map is not empty if (!metaInfoMap.isEmpty()){ Map metaInfoMapFromSchemaElement = schemaObject.getMetaInfoMap(); if (metaInfoMapFromSchemaElement==null){ schemaObject.setMetaInfoMap(metaInfoMap); }else{ metaInfoMapFromSchemaElement.putAll(metaInfoMap); } } } } ./src/org/apache/ws/commons/schema/extensions/ExtensionRegistry.java0000664000175000017500000001411311767656530025117 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.extensions; import org.apache.ws.commons.schema.XmlSchemaObject; import org.w3c.dom.Node; import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; /** * The task of the extension serializer is to delegate the serilization of * the extensions. The extension serializers/deserializers are retained in seperate * maps and there are also two seperate references to default serializers and deserializers * which would jump into action when there are no specifically attached * serializers/deserializers */ public class ExtensionRegistry { /** * Maps for the storage of extension serializers /deserializers */ private Map extensionSerializers = new HashMap(); private Map extensionDeserializers = new HashMap(); /** * Default serializer and serializer */ private ExtensionSerializer defaultExtensionSerializer =new DefaultExtensionSerializer(); private ExtensionDeserializer defaultExtensionDeserializer = new DefaultExtensionDeserializer(); public ExtensionSerializer getDefaultExtensionSerializer() { return defaultExtensionSerializer; } public void setDefaultExtensionSerializer(ExtensionSerializer defaultExtensionSerializer) { this.defaultExtensionSerializer = defaultExtensionSerializer; } public ExtensionDeserializer getDefaultExtensionDeserializer() { return defaultExtensionDeserializer; } public void setDefaultExtensionDeserializer(ExtensionDeserializer defaultExtensionDeserializer) { this.defaultExtensionDeserializer = defaultExtensionDeserializer; } /** * Register a deserializer with a QName * @param name - the QName of the element/attribute * @param deserializer - an instance of the deserializer */ public void registerDeserializer(QName name,ExtensionDeserializer deserializer){ extensionDeserializers.put(name,deserializer); } /** * Register a serializer with a Class * @param classOfType - the class of the object that would be serialized * @param serializer - an instance of the deserializer */ public void registerSerializer(Class classOfType,ExtensionSerializer serializer){ extensionSerializers.put(classOfType,serializer); } /** * remove the registration for a serializer with a QName * @param name - the QName of the element/attribute the * serializer is associated with */ public void unregisterSerializer(QName name){ extensionSerializers.remove(name); } /** * remove the registration for a deserializer with a QName * @param classOfType - the the * deserializer is associated with */ public void unregisterDeserializer(Class classOfType){ extensionDeserializers.remove(classOfType); } /** * Serialize a given extension element * @param parentSchemaObject - the parent schema object. This is what * would contain the extension object, probably in side its meta information * map * @param classOfType - The class of type to be serialized * @param node - the parent DOM Node that will ultimately be serialized. The XMLSchema * serialization mechanism is to create a DOM tree first and serialize it */ public void serializeExtension(XmlSchemaObject parentSchemaObject, Class classOfType, Node node){ Object serializerObject = extensionSerializers.get(classOfType); if (serializerObject!=null){ //perform the serialization ExtensionSerializer ser = (ExtensionSerializer)serializerObject; ser.serialize(parentSchemaObject,classOfType,node); }else if (defaultExtensionSerializer!=null) { defaultExtensionSerializer.serialize(parentSchemaObject,classOfType,node); } } /** * Deserialize a given extension element * @param parentSchemaObject - the parent schema object. This is anticipated * to be created already and the relevant object would contain the extension * object, probably in side its meta information map * @param name - The qname of the element/attribute to be deserialized. This will be used to * search for the extension as well as by the deserializer if a single deserializer is * registered against a number of qnames * @param rawNode - the raw DOM Node read from the source. This will be the * extension element itself if for an element or extension attribute itself * in case of an attribute */ public void deserializeExtension(XmlSchemaObject parentSchemaObject, QName name, Node rawNode){ Object deserializerObject = extensionDeserializers.get(name); if (deserializerObject !=null){ //perform the serialization ExtensionDeserializer deser = (ExtensionDeserializer)deserializerObject; deser.deserialize(parentSchemaObject,name,rawNode); } else if (defaultExtensionDeserializer!=null){ defaultExtensionDeserializer.deserialize(parentSchemaObject,name,rawNode); } } } ./src/org/apache/ws/commons/schema/extensions/DefaultExtensionSerializer.java0000664000175000017500000000555211767656530026734 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.extensions; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.constants.Constants; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.Element; import org.w3c.dom.Attr; import java.util.Iterator; import java.util.Map; /** */ public class DefaultExtensionSerializer implements ExtensionSerializer{ /** * serialize the given element * * @param schemaObject - Parent schema element * @param classOfType - the class of the object to be serialized * @param node - The DOM Node that is the parent of the serialzation */ public void serialize(XmlSchemaObject schemaObject, Class classOfType, Node node) { // serialization is somewhat tricky in most cases hence this default serializer will // do the exact reverse of the deserializer - look for any plain 'as is' items // and attach them to the parent node. // we just attach the raw node either to the meta map of // elements or the attributes Map metaInfoMap = schemaObject.getMetaInfoMap(); Document parentDoc = node.getOwnerDocument(); if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES)){ Map attribMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES); for(Iterator it = attribMap.values().iterator();it.hasNext();){ if (node.getNodeType()==Node.ELEMENT_NODE){ ((Element)node).setAttributeNodeNS((Attr)parentDoc.importNode((Node)it.next(),true)); } } } if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ELEMENTS)){ Map elementMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ELEMENTS); for(Iterator it = elementMap.values().iterator();it.hasNext();){ node.appendChild( parentDoc.importNode((Node)it.next(),true)); } } } } ./src/org/apache/ws/commons/schema/extensions/ExtensionDeserializer.java0000664000175000017500000000406011767656530025731 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.extensions; import org.apache.ws.commons.schema.XmlSchemaObject; import org.w3c.dom.Node; import javax.xml.namespace.QName; /** * Interface for the extension deserializer. The purpose of an instance * of this is to deserialize the relevant attribute/element and perhaps generate * a desired custom object. This custom object can be stored in the metadata map * of the parent schema object. When to invoke a given deserializer is a decision * taken by the extension registry */ public interface ExtensionDeserializer { /** * deserialize the given element * @param schemaObject - Parent schema element * @param name - the QName of the element/attribute to be deserialized. * in the case where a deserializer is used to handle multiple elements/attributes * this may be useful to determine the correct deserialization * @param domNode - the raw DOM Node read from the source. This will be the * extension element itself if for an element or the extension attribute object if * it is an attribute * */ public void deserialize(XmlSchemaObject schemaObject, QName name, Node domNode); } ./src/org/apache/ws/commons/schema/XmlSchemaContent.java0000664000175000017500000000210711767656530022427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * An abstract class for schema content. * */ public abstract class XmlSchemaContent extends XmlSchemaAnnotated { /** * Creates new XmlSchemaContent */ protected XmlSchemaContent() { } } ./src/org/apache/ws/commons/schema/XmlSchemaPatternFacet.java0000664000175000017500000000306511767656530023401 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining pattern facets. Represents the World Wide * Web Consortium (W3C) pattern facet. */ public class XmlSchemaPatternFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaPatternFacet */ public XmlSchemaPatternFacet() { } public XmlSchemaPatternFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSeverityType.java0000664000175000017500000000272511767656530022356 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.constants.Enum; /** * Represents the severity of the validation event. */ public class XmlSeverityType extends Enum { static String[] members = new String[]{ Constants.BlockConstants.ERROR, Constants.BlockConstants.WARNING }; /** * Creates new XmlSeverityType */ public XmlSeverityType() { super(); } public XmlSeverityType(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaAnnotated.java0000664000175000017500000000420311767656530022731 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.w3c.dom.Attr; /** * The base class for any element that can contain annotation elements. */ public class XmlSchemaAnnotated extends XmlSchemaObject { /** * Defines an annotation. * Creates an annotation element. * Represents the W3C annotation element. */ XmlSchemaAnnotation annotation; String id; // Stores qualified attributes that do not belong to the schema target namespace. public Attr[] unhandledAttributes; /** * Creates new XmlSchemaAnnotated */ public XmlSchemaAnnotated() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public XmlSchemaAnnotation getAnnotation() { return annotation; } public void setAnnotation(XmlSchemaAnnotation annotation) { this.annotation = annotation; } public Attr[] getUnhandledAttributes() { return unhandledAttributes; } public void setUnhandledAttributes(Attr[] unhandledAttributes) { this.unhandledAttributes = unhandledAttributes; } public String toString() { if (id == null) return super.toString(); else return super.toString() + " [id:" + id + "]"; } } ./src/org/apache/ws/commons/schema/XmlSchemaSerializer.java0000664000175000017500000033002011767656530023124 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.extensions.ExtensionRegistry; import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.w3c.dom.*; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.util.*; public class XmlSchemaSerializer { /** * Extension registry for the serializer * */ private ExtensionRegistry extReg; public ExtensionRegistry getExtReg() { return extReg; } public void setExtReg(ExtensionRegistry extReg) { this.extReg = extReg; } private Hashtable schema_ns; static String xsdPrefix = "xs"; public static final String xsdNamespace = "http://www.w3.org/2001/XMLSchema"; ArrayList docs; Element schemaElement; private static final String XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/"; XmlSchemaSerializer() { docs = new ArrayList(); schema_ns = new Hashtable(); } /** * ********************************************************************* * Document[] serializeSchema(XmlSchema schemaObj, * boolean serializeIncluded) *

* Serialize XmlSchema object pass back the document containing a schema * element as its root. *

* Parameter: * schemaObj - Schema object to serialize. * serialzeIncluded - whether to serialize the included(imported) * schema or not. pass true for serialize all included * schema. *

* Return: * Array of Documents that include/imported. * ********************************************************************** */ public Document[] serializeSchema(XmlSchema schemaObj, boolean serializeIncluded) throws XmlSchemaSerializerException { return serializeSchemaElement(schemaObj, serializeIncluded); } Document[] serializeSchemaElement(XmlSchema schemaObj, boolean serializeIncluded) throws XmlSchemaSerializerException { XmlSchemaObjectCollection items = schemaObj.getItems(); Document serializedSchemaDocs; try { DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance(); docFac.setNamespaceAware(true); DocumentBuilder builder = docFac.newDocumentBuilder(); serializedSchemaDocs = builder.newDocument(); } catch (ParserConfigurationException e) { throw new XmlSchemaException(e.getMessage()); } Element serializedSchema; serializedSchema = setupNamespaces(serializedSchemaDocs, schemaObj); schemaElement = serializedSchema; if (schemaObj.syntacticalTargetNamespace != null) { serializedSchema.setAttribute("targetNamespace", schemaObj.syntacticalTargetNamespace); Object targetNS = schema_ns.get(schemaObj.syntacticalTargetNamespace); //if the namespace is not entered then add //the targetNamespace as its if (targetNS == null) { if(!Constants.XMLNS_URI.equals(schemaObj.syntacticalTargetNamespace)){ serializedSchema.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns", schemaObj.syntacticalTargetNamespace); } String prefix = null; if(schemaObj.getNamespaceContext() != null) { prefix = schemaObj.getNamespaceContext().getPrefix(schemaObj.syntacticalTargetNamespace); } if(prefix == null && schemaObj.parent != null && schemaObj.parent.getNamespaceContext() != null) { prefix = schemaObj.parent.getNamespaceContext().getPrefix(schemaObj.syntacticalTargetNamespace); } if(prefix == null) { prefix = ""; } schema_ns.put(schemaObj.syntacticalTargetNamespace, prefix); } } //todo: implement xml:lang, if (schemaObj.attributeFormDefault != null) { String formQualified = schemaObj.attributeFormDefault.getValue(); if (!formQualified.equals(XmlSchemaForm.NONE)) serializedSchema.setAttribute("attributeFormDefault", convertString(formQualified)); } if (schemaObj.elementFormDefault != null) { String formQualified = schemaObj.elementFormDefault.getValue(); if (!formQualified.equals(XmlSchemaForm.NONE)) serializedSchema.setAttribute("elementFormDefault", convertString(formQualified)); } if (schemaObj.annotation != null) { Element annotation = serializeAnnotation(serializedSchemaDocs, schemaObj.annotation, schemaObj); serializedSchema.appendChild(annotation); } if (schemaObj.id != null) { serializedSchema.setAttribute("id", schemaObj.id); } if (schemaObj.blockDefault != null) { String blockDefault = schemaObj.blockDefault.getValue(); if (!blockDefault.equals(Constants.BlockConstants.NONE)) { blockDefault = convertString(blockDefault); serializedSchema.setAttribute("blockDefault", blockDefault); } } if (schemaObj.finalDefault != null) { String finalDefault = schemaObj.finalDefault.getValue(); if (!finalDefault.equals(Constants.BlockConstants.NONE)) { finalDefault = convertString(finalDefault); serializedSchema.setAttribute("finalDefault", finalDefault); } } if (schemaObj.version != null) { serializedSchema.setAttribute("version", schemaObj.version); } //add the extra namespace decalarations if any are available NamespacePrefixList ctx = schemaObj.getNamespaceContext(); String[] prefixes = ctx.getDeclaredPrefixes(); for (int i = 0; i < prefixes.length; i++) { String prefix = prefixes[i]; String uri = ctx.getNamespaceURI(prefix); if (!Constants.DEFAULT_NS_PREFIX.equals(prefix)) { serializedSchema.setAttributeNS(Constants.XMLNS_ATTRIBUTE_NS_URI, Constants.XMLNS_ATTRIBUTE + ":" + prefix, uri); } } //after serialize the schema add into documentation //and add to document collection array which at the end //returned serializeSchemaChild(items, serializedSchema, serializedSchemaDocs, schemaObj, serializeIncluded); //process extension elements/attributes processExtensibilityComponents(schemaObj,serializedSchema); serializedSchemaDocs.appendChild(serializedSchema); docs.add(serializedSchemaDocs); Document[] serializedDocs = new Document[docs.size()]; docs.toArray(serializedDocs); return serializedDocs; } private void serializeSchemaChild(XmlSchemaObjectCollection items, Element serializedSchema, Document serializedSchemaDocs, XmlSchema schemaObj, boolean serializeIncluded) throws XmlSchemaSerializerException { int itemsLength = items.getCount(); /** * For each of the items that belong to this schema, * serialize each member found. * Permittable member is: element, simpleType, complexType, * group, attrributeGroup, Attribute, include, import and redefine. * if any of the member found then serialize the component. */ // Since imports and includes need to be the first items of the // serialized schema. So this loop does the serialization of the // imports and includes for (int i = 0; i < itemsLength; i++) { XmlSchemaObject obj = items.getItem(i); if (obj instanceof XmlSchemaInclude) { Element e = serializeInclude(serializedSchemaDocs, (XmlSchemaInclude) obj, schemaObj, serializeIncluded); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaImport) { Element e = serializeImport(serializedSchemaDocs, (XmlSchemaImport) obj, schemaObj, serializeIncluded); serializedSchema.appendChild(e); } } // reloop to serialize the others for (int i = 0; i < itemsLength; i++) { XmlSchemaObject obj = items.getItem(i); if (obj instanceof XmlSchemaElement) { Element e = serializeElement(serializedSchemaDocs, (XmlSchemaElement) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaSimpleType) { Element e = serializeSimpleType(serializedSchemaDocs, (XmlSchemaSimpleType) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaComplexType) { Element e = serializeComplexType(serializedSchemaDocs, (XmlSchemaComplexType) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaGroup) { Element e = serializeGroup(serializedSchemaDocs, (XmlSchemaGroup) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaAttributeGroup) { Element e = serializeAttributeGroup(serializedSchemaDocs, (XmlSchemaAttributeGroup) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaAttribute) { Element e = serializeAttribute(serializedSchemaDocs, (XmlSchemaAttribute) obj, schemaObj); serializedSchema.appendChild(e); } else if (obj instanceof XmlSchemaRedefine) { Element e = serializeRedefine(serializedSchemaDocs, (XmlSchemaRedefine) obj, schemaObj); serializedSchema.appendChild(e); } } } /** * Set up namespaces appropriately and append that attr * into specified element */ private Element setupNamespaces(Document schemaDocs, XmlSchema schemaObj) { NamespacePrefixList ctx = schemaObj.getNamespaceContext(); schemaObj.schema_ns_prefix = xsdPrefix = ctx.getPrefix(xsdNamespace); if(xsdPrefix == null) { schemaObj.schema_ns_prefix = xsdPrefix = ""; } String[] prefixes = ctx.getDeclaredPrefixes(); for (int i = 0; i < prefixes.length; i++) { String prefix = prefixes[i]; String uri = ctx.getNamespaceURI(prefix); if(uri != null && prefix != null) { schema_ns.put(uri, prefix); } } //for schema that not set the xmlns attrib member if (schema_ns.get(xsdNamespace) == null) { schema_ns.put(xsdNamespace, xsdPrefix); schemaObj.schema_ns_prefix = xsdPrefix; } Element schemaEl = createNewElement(schemaDocs, "schema", schemaObj.schema_ns_prefix, XmlSchema.SCHEMA_NS); Iterator entries = schema_ns.entrySet().iterator(); while (entries.hasNext()) { //let it crash for null pointer because then either the schema //is wrong(namespace not set properly or bug in setting ns) Map.Entry entry = (Map.Entry) entries.next(); String key = entry.getKey().toString(); String value = entry.getValue().toString(); value = (value.length() > 0) ? "xmlns:" + value : "xmlns"; schemaEl.setAttributeNS(XMLNS_NAMESPACE_URI, value, key); } return schemaEl; } /** * ********************************************************************* * Element serializeInclude(Document doc, XmlSchemaInclude includeObj, * XmlSchema schema)throws XmlSchemaSerializerException *

* set appropriate attribute as per this object attribute availability. * Call included schema to append to this schema document collection. * Then add the document created into document pool. *

* Parameter: * doc - Document the parent use. * includeObj - XmlSchemaInclude that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element object representation of XmlSchemaInclude * ********************************************************************** */ Element serializeInclude(Document doc, XmlSchemaInclude includeObj, XmlSchema schema, boolean serializeIncluded) throws XmlSchemaSerializerException { Element includeEl = createNewElement(doc, "include", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (includeObj.schemaLocation != null) { includeEl.setAttribute("schemaLocation", includeObj.schemaLocation); } if (includeObj.id != null) includeEl.setAttribute("id", includeObj.id); if (includeObj.annotation != null) { Element annotation = serializeAnnotation(doc, includeObj.annotation, schema); includeEl.appendChild(annotation); } //Get the XmlSchema obj and append that to the content XmlSchema includedSchemaObj = includeObj.getSchema(); if (includedSchemaObj != null && serializeIncluded) { XmlSchemaSerializer includeSeri = new XmlSchemaSerializer(); includeSeri.serializeSchemaElement(includedSchemaObj, true); // XmlSchemaObjectCollection ii = includedSchemaObj.getItems(); docs.addAll(includeSeri.docs); } //process includes processExtensibilityComponents(includeObj,includeEl); return includeEl; } /** * ********************************************************************* * Element serializeImport(Document doc, XmlSchemaImport importObj, * XmlSchema schema)throws XmlSchemaSerializerException *

* Add each of the attribute of XmlSchemaImport obj into import Element * Then serialize schema that is included by this import. Include the * serialized schema into document pool. *

* Parameter: * doc - Document the parent use. * includeObj - XmlSchemaInclude that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element object representation of XmlSchemaImport * ********************************************************************** */ Element serializeImport(Document doc, XmlSchemaImport importObj, XmlSchema schema, boolean serializeIncluded) throws XmlSchemaSerializerException { Element importEl = createNewElement(doc, "import", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (importObj.namespace != null) importEl.setAttribute("namespace", importObj.namespace); if (importObj.schemaLocation != null && !importObj.schemaLocation.trim().equals("")) importEl.setAttribute("schemaLocation", importObj.schemaLocation); if (importObj.id != null) importEl.setAttribute("id", importObj.id); if (importObj.annotation != null) { Element annotation = serializeAnnotation(doc, importObj.annotation, schema); importEl.appendChild(annotation); } if (importObj.schema != null && serializeIncluded) { XmlSchemaSerializer importSeri = new XmlSchemaSerializer(); importSeri.serializeSchemaElement(importObj.schema, serializeIncluded); docs.addAll(importSeri.docs); } //process extension processExtensibilityComponents(importObj,importEl); return importEl; } /** * ********************************************************************* * Element serializeRedefine(Document doc, XmlSchemaRedefine redefineObj, * XmlSchema schema)throws XmlSchemaSerializerException *

* Add each of the attribute of XmlSchemaImport obj into import Element * Then serialize schema that is included by this import. Include the * serialized schema into document pool. *

* Parameter: * doc - Document the parent use. * redefineObj - XmlSchemaInclude that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element object representation of XmlSchemaRedefine * ********************************************************************** */ Element serializeRedefine(Document doc, XmlSchemaRedefine redefineObj, XmlSchema schema) throws XmlSchemaSerializerException { Element redefine = createNewElement(doc, "redefine", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (redefineObj.schemaLocation != null) redefine.setAttribute("schemaLocation", redefineObj.schemaLocation); else throw new XmlSchemaSerializerException("redefine must have " + "schemaLocation fields fill"); if (redefineObj.id != null) redefine.setAttribute("id", redefineObj.id); if (redefineObj.annotation != null) { Element annotation = serializeAnnotation(doc, redefineObj.annotation, schema); redefine.appendChild(annotation); } int itemsLength = redefineObj.items.getCount(); for (int i = 0; i < itemsLength; i++) { XmlSchemaObject obj = redefineObj.items.getItem(i); if (obj instanceof XmlSchemaSimpleType) { Element simpleType = serializeSimpleType(doc, (XmlSchemaSimpleType) obj, schema); redefine.appendChild(simpleType); } else if (obj instanceof XmlSchemaComplexType) { Element complexType = serializeComplexType(doc, (XmlSchemaComplexType) obj, schema); redefine.appendChild(complexType); } else if (obj instanceof XmlSchemaGroupRef) { Element groupRef = serializeGroupRef(doc, (XmlSchemaGroupRef) obj, schema); redefine.appendChild(groupRef); } else if (obj instanceof XmlSchemaGroup) { Element group = serializeGroup(doc, (XmlSchemaGroup) obj, schema); redefine.appendChild(group); } else if (obj instanceof XmlSchemaAttributeGroup) { Element attributeGroup = serializeAttributeGroup(doc, (XmlSchemaAttributeGroup) obj, schema); redefine.appendChild(attributeGroup); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attributeGroupRef = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); redefine.appendChild(attributeGroupRef); } } //process extension processExtensibilityComponents(redefineObj,redefine); return redefine; } /** * ********************************************************************* * Element serializeElement(Document doc, XmlSchemaElement elementObj, * XmlSchema schema) throws XmlSchemaSerializerException *

* Each member of Element will be appended and pass the element * created. Element processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * elementObj - XmlSchemaInclude that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element object of element. * ********************************************************************** */ Element serializeElement(Document doc, XmlSchemaElement elementObj, XmlSchema schema) throws XmlSchemaSerializerException { Element serializedEl = createNewElement(doc, "element", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (elementObj.refName != null) { String resolvedName = resolveQName(elementObj.refName, schema); serializedEl.setAttribute("ref", resolvedName); } else if (elementObj.name != null && elementObj.name.length() > 0) { serializedEl.setAttribute("name", elementObj.name); } if (elementObj.isAbstract) serializedEl.setAttribute("abstract", "true"); String block = elementObj.block.getValue(); if (!block.equals(Constants.BlockConstants.NONE)) { block = convertString(block); serializedEl.setAttribute("block", block); } if (elementObj.defaultValue != null) serializedEl.setAttribute("default", elementObj.defaultValue); String finalDerivation = elementObj.finalDerivation.getValue(); if (!finalDerivation.equals(Constants.BlockConstants.NONE)) { finalDerivation = convertString(finalDerivation); serializedEl.setAttribute("final", finalDerivation); } if (elementObj.fixedValue != null) serializedEl.setAttribute("fixed", elementObj.fixedValue); String formDef = elementObj.form.getValue(); if (!formDef.equals(XmlSchemaForm.NONE)) { formDef = convertString(formDef); serializedEl.setAttribute("form", formDef); } if (elementObj.id != null) serializedEl.setAttribute("id", elementObj.id); serializeMaxMinOccurs(elementObj, serializedEl); if (elementObj.substitutionGroup != null) { String resolvedQName = resolveQName(elementObj.substitutionGroup, schema); serializedEl.setAttribute("substitutionGroup", resolvedQName); } if (elementObj.schemaTypeName != null) { String resolvedName = resolveQName(elementObj.schemaTypeName, schema); serializedEl.setAttribute("type", resolvedName); } if (elementObj.annotation != null) { Element annotationEl = serializeAnnotation(doc, elementObj.annotation, schema); serializedEl.appendChild(annotationEl); } if (elementObj.schemaType != null && elementObj.schemaTypeName == null) { if (elementObj.schemaType instanceof XmlSchemaComplexType) { Element complexType = serializeComplexType(doc, (XmlSchemaComplexType) elementObj.schemaType, schema); serializedEl.appendChild(complexType); } else if (elementObj.schemaType instanceof XmlSchemaSimpleType) { Element simpleType = serializeSimpleType(doc, (XmlSchemaSimpleType) elementObj.schemaType, schema); serializedEl.appendChild(simpleType); } } if (elementObj.constraints.getCount() > 0) { for (int i = 0; i < elementObj.constraints.getCount(); i++) { Element constraint = serializeIdentityConstraint(doc, (XmlSchemaIdentityConstraint) elementObj.constraints.getItem(i), schema); serializedEl.appendChild(constraint); } } if (elementObj.isNillable) { serializedEl.setAttribute("nillable", "true"); } //process extension processExtensibilityComponents(elementObj,serializedEl); return serializedEl; } /** * ********************************************************************* * Element serializeSimpleType(Document doc, * XmlSchemaSimpleType simpleTypeObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of simple type will be appended and pass the element * created. Simple type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * simpleTypeObj - XmlSchemaSimpleType that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element object of SimpleType * ********************************************************************** */ Element serializeSimpleType(Document doc, XmlSchemaSimpleType simpleTypeObj, XmlSchema schema) throws XmlSchemaSerializerException { Element serializedSimpleType = createNewElement(doc, "simpleType", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); String tmp; tmp = simpleTypeObj.finalDerivation.getValue(); if (!tmp.equals(Constants.BlockConstants.NONE)) { tmp = convertString(tmp); serializedSimpleType.setAttribute("final", tmp); } if (simpleTypeObj.id != null) serializedSimpleType.setAttribute("id", simpleTypeObj.id); if ((simpleTypeObj.name != null) && (!simpleTypeObj.name.equals(""))) serializedSimpleType.setAttribute("name", simpleTypeObj.name); if (simpleTypeObj.annotation != null) { Element annotationEl = serializeAnnotation(doc, simpleTypeObj.annotation, schema); serializedSimpleType.appendChild(annotationEl); } if (simpleTypeObj.content != null) { if (simpleTypeObj.content instanceof XmlSchemaSimpleTypeRestriction) { Element restEl = serializeSimpleTypeRestriction(doc, (XmlSchemaSimpleTypeRestriction) simpleTypeObj.content, schema); serializedSimpleType.appendChild(restEl); } else if (simpleTypeObj.content instanceof XmlSchemaSimpleTypeList) { Element listEl = serializeSimpleTypeList(doc, (XmlSchemaSimpleTypeList) simpleTypeObj.content, schema); serializedSimpleType.appendChild(listEl); } else if (simpleTypeObj.content instanceof XmlSchemaSimpleTypeUnion) { Element unionEl = serializeSimpleTypeUnion(doc, (XmlSchemaSimpleTypeUnion) simpleTypeObj.content, schema); serializedSimpleType.appendChild(unionEl); }/*else throw new XmlSchemaSerializerException("Invalid type inserted " + "in simpleType content, the content is: " + simpleTypeObj.content.getClass().getName() + " valid content should be XmlSchemaSimpleTypeunion, " + "XmlSchemaSimpleTyperestriction or list");*/ }/*else throw new XmlSchemaSerializerException("simple type must be set " + "with content, either union, restriction or list");*/ //process extension processExtensibilityComponents(simpleTypeObj,serializedSimpleType); return serializedSimpleType; } /** * ********************************************************************* * Element serializeSimpleTypeRestriction(Document doc, * XmlSchemaSimpleTypeRestriction restrictionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of simple type will be appended and pass the element * created. Simple type's processed according to w3c * Recommendation May 2 2001. *

* Parameter: * doc - Document the parent use. * restrictionObj - XmlSchemaRestriction that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple type restriction and its child. * ********************************************************************** */ Element serializeSimpleTypeRestriction(Document doc, XmlSchemaSimpleTypeRestriction restrictionObj, XmlSchema schema) throws XmlSchemaSerializerException { //todo: need to implement any attribute that related to non schema namespace Element serializedRestriction = createNewElement(doc, "restriction", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (schema.schema_ns_prefix.length() > 0) serializedRestriction.setPrefix(schema.schema_ns_prefix); if (restrictionObj.baseTypeName != null) { String baseType = resolveQName(restrictionObj.baseTypeName, schema); serializedRestriction.setAttribute("base", baseType); } else if (restrictionObj.baseType != null && restrictionObj.baseType instanceof XmlSchemaSimpleType) { Element inlineSimpleType = serializeSimpleType(doc, restrictionObj.baseType, schema); serializedRestriction.appendChild(inlineSimpleType); } else throw new XmlSchemaSerializerException("restriction must be define " + "with specifying base or inline simpleType"); if (restrictionObj.id != null) serializedRestriction.setAttribute("id", restrictionObj.id); if (restrictionObj.annotation != null) { Element annotation = serializeAnnotation(doc, restrictionObj.annotation, schema); serializedRestriction.appendChild(annotation); } if (restrictionObj.facets.getCount() > 0) { int facetsNum = restrictionObj.facets.getCount(); for (int i = 0; i < facetsNum; i++) { Element facetEl = serializeFacet(doc, (XmlSchemaFacet) restrictionObj.facets.getItem(i), schema); serializedRestriction.appendChild(facetEl); } } //process extension processExtensibilityComponents(restrictionObj,serializedRestriction); return serializedRestriction; } /** * ********************************************************************* * Element serializeFacet(Document doc, XmlSchemaFacet facetObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* detect what type of facet and cass appropriatelly, * construct the element and pass it. *

* Parameter: * doc - Document the parent use. * facetObj - XmlSchemaFacet that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple type with facet. * ********************************************************************** */ Element serializeFacet(Document doc, XmlSchemaFacet facetObj, XmlSchema schema) throws XmlSchemaSerializerException { Element serializedFacet; if (facetObj instanceof XmlSchemaMinExclusiveFacet) serializedFacet = constructFacet(facetObj, doc, schema, "minExclusive"); else if (facetObj instanceof XmlSchemaMinInclusiveFacet) serializedFacet = constructFacet(facetObj, doc, schema, "minInclusive"); else if (facetObj instanceof XmlSchemaMaxExclusiveFacet) serializedFacet = constructFacet(facetObj, doc, schema, "maxExclusive"); else if (facetObj instanceof XmlSchemaMaxInclusiveFacet) serializedFacet = constructFacet(facetObj, doc, schema, "maxInclusive"); else if (facetObj instanceof XmlSchemaTotalDigitsFacet) serializedFacet = constructFacet(facetObj, doc, schema, "totalDigits"); else if (facetObj instanceof XmlSchemaFractionDigitsFacet) serializedFacet = constructFacet(facetObj, doc, schema, "fractionDigits"); else if (facetObj instanceof XmlSchemaLengthFacet) serializedFacet = constructFacet(facetObj, doc, schema, "length"); else if (facetObj instanceof XmlSchemaMinLengthFacet) serializedFacet = constructFacet(facetObj, doc, schema, "minLength"); else if (facetObj instanceof XmlSchemaMaxLengthFacet) serializedFacet = constructFacet(facetObj, doc, schema, "maxLength"); else if (facetObj instanceof XmlSchemaEnumerationFacet) serializedFacet = constructFacet(facetObj, doc, schema, "enumeration"); else if (facetObj instanceof XmlSchemaWhiteSpaceFacet) serializedFacet = constructFacet(facetObj, doc, schema, "whiteSpace"); else if (facetObj instanceof XmlSchemaPatternFacet) serializedFacet = constructFacet(facetObj, doc, schema, "pattern"); else throw new XmlSchemaSerializerException("facet not exist " + facetObj.getClass().getName()); if (facetObj.id != null) serializedFacet.setAttribute("id", facetObj.id); // if (facetObj.annotation != null) { // Element annotation = serializeAnnotation(doc, facetObj.annotation, // schema); // serializedFacet.appendChild(annotation); // } //process extension processExtensibilityComponents(facetObj,serializedFacet); return serializedFacet; } private Element constructFacet(XmlSchemaFacet facetObj, Document doc, XmlSchema schema, String tagName) { Element facetEl = createNewElement(doc, tagName, schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); facetEl.setAttribute("value", facetObj.value.toString()); if (facetObj.fixed) facetEl.setAttribute("fixed", "true"); if (facetObj.annotation != null) { Element annotation = serializeAnnotation(doc, facetObj.annotation, schema); facetEl.appendChild(annotation); } return facetEl; } /** * ********************************************************************* * Element serializeComplexType(Document doc, * XmlSchemaComplexType complexTypeObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * complexTypeObj - XmlSchemaFacet that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of complexType. * ********************************************************************** */ Element serializeComplexType(Document doc, XmlSchemaComplexType complexTypeObj, XmlSchema schema) throws XmlSchemaSerializerException { //todo: need to implement abstract, id, mixed Element serializedComplexType = createNewElement(doc, "complexType", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if ((complexTypeObj.name != null) && (!complexTypeObj.name.equals(""))) serializedComplexType.setAttribute("name", complexTypeObj.name); /*if(complexTypeObj.annotation != null){ Element annotationEl = serializeAnnotation(doc, complexTypeObj.annotation, schema); serializedComplexType.appendChild(annotationEl); }*/ if (complexTypeObj.isMixed) serializedComplexType.setAttribute("mixed", "true"); if (complexTypeObj.isAbstract) serializedComplexType.setAttribute( "abstract", "true"); if (complexTypeObj.id != null) serializedComplexType.setAttribute("id", complexTypeObj.id); if (complexTypeObj.annotation != null) { Element annotationEl = serializeAnnotation(doc, complexTypeObj.annotation, schema); serializedComplexType.appendChild(annotationEl); } if (complexTypeObj.contentModel instanceof XmlSchemaSimpleContent) { Element simpleContent = serializeSimpleContent(doc, (XmlSchemaSimpleContent) complexTypeObj.contentModel, schema); serializedComplexType.appendChild(simpleContent); } else if (complexTypeObj.contentModel instanceof XmlSchemaComplexContent) { Element complexContent = serializeComplexContent(doc, (XmlSchemaComplexContent) complexTypeObj.contentModel, schema); serializedComplexType.appendChild(complexContent); } if (complexTypeObj.particle instanceof XmlSchemaSequence) { Element sequence = serializeSequence(doc, (XmlSchemaSequence) complexTypeObj.particle, schema); serializedComplexType.appendChild(sequence); } else if (complexTypeObj.particle instanceof XmlSchemaChoice) { Element choice = serializeChoice(doc, (XmlSchemaChoice) complexTypeObj.particle, schema); serializedComplexType.appendChild(choice); } else if (complexTypeObj.particle instanceof XmlSchemaAll) { Element all = serializeAll(doc, (XmlSchemaAll) complexTypeObj.particle, schema); serializedComplexType.appendChild(all); } else if (complexTypeObj.particle instanceof XmlSchemaGroupRef) { Element group = serializeGroupRef(doc, (XmlSchemaGroupRef) complexTypeObj.particle, schema); serializedComplexType.appendChild(group); } String block = complexTypeObj.block.getValue(); if (!block.equals(Constants.BlockConstants.NONE)) { block = convertString(block); serializedComplexType.setAttribute( "block", block); } String finalDerivation = complexTypeObj.finalDerivation.getValue(); if (!finalDerivation.equals(Constants.BlockConstants.NONE)) { finalDerivation = convertString(finalDerivation); serializedComplexType.setAttribute("final", finalDerivation); } XmlSchemaObjectCollection attrColl = complexTypeObj.attributes; if (attrColl.getCount() > 0) setupAttr(doc, attrColl, schema, serializedComplexType); //process extension processExtensibilityComponents(complexTypeObj,serializedComplexType); return serializedComplexType; } /** * ********************************************************************* * Element serializeSequence(Document doc, XmlSchemaSequence sequenceObj, * XmlSchema schema)throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. `Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * sequenceObj - XmlSchemaFacet that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of sequence particle. * ********************************************************************** */ Element serializeSequence(Document doc, XmlSchemaSequence sequenceObj, XmlSchema schema) throws XmlSchemaSerializerException { Element sequence = createNewElement(doc, "sequence", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (sequenceObj.id != null) sequence.setAttribute("id", sequenceObj.id); serializeMaxMinOccurs(sequenceObj, sequence); XmlSchemaObjectCollection seqColl = sequenceObj.items; int containLength = seqColl.getCount(); for (int i = 0; i < containLength; i++) { XmlSchemaObject obj = seqColl.getItem(i); if (obj instanceof XmlSchemaElement) { Element el = serializeElement(doc, (XmlSchemaElement) obj, schema); sequence.appendChild(el); } else if (obj instanceof XmlSchemaGroupRef) { Element group = serializeGroupRef(doc, (XmlSchemaGroupRef) obj, schema); sequence.appendChild(group); } else if (obj instanceof XmlSchemaChoice) { Element choice = serializeChoice(doc, (XmlSchemaChoice) obj, schema); sequence.appendChild(choice); } else if (obj instanceof XmlSchemaSequence) { Element sequenceChild = serializeSequence(doc, (XmlSchemaSequence) obj, schema); sequence.appendChild(sequenceChild); } else if (obj instanceof XmlSchemaAny) { Element any = serializeAny(doc, (XmlSchemaAny) obj, schema); sequence.appendChild(any); } } //process extension processExtensibilityComponents(sequenceObj,sequence); return sequence; } /** * A common method to serialize the max/min occurs * @param particle * @param element */ private void serializeMaxMinOccurs(XmlSchemaParticle particle, Element element) { if (particle.maxOccurs < Long.MAX_VALUE && (particle.maxOccurs > 1 || particle.maxOccurs == 0)) element.setAttribute("maxOccurs", particle.maxOccurs + ""); else if (particle.maxOccurs == Long.MAX_VALUE) element.setAttribute("maxOccurs", "unbounded"); //else not serialized //1 is the default and hence not serialized //there is no valid case where min occurs can be unbounded! if (particle.minOccurs > 1 || particle.minOccurs == 0) element.setAttribute("minOccurs", particle.minOccurs + ""); } /** * ********************************************************************* * Element serializeAttribute(Document doc, XmlSchemaAttribute attributeObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. `Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * attributeObj - XmlSchemaAttribute that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of attribute. * ********************************************************************** */ Element serializeAttribute(Document doc, XmlSchemaAttribute attributeObj, XmlSchema schema) throws XmlSchemaSerializerException { Element attribute = createNewElement(doc, "attribute", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (attributeObj.refName != null) { String refName = resolveQName(attributeObj.refName, schema); attribute.setAttribute("ref", refName); } else if (attributeObj.name != null) attribute.setAttribute("name", attributeObj.name); if (attributeObj.schemaTypeName != null) { String typeName = resolveQName(attributeObj.schemaTypeName, schema); attribute.setAttribute("type", typeName); } if (attributeObj.defaultValue != null) attribute.setAttribute("default", attributeObj.defaultValue); if (attributeObj.fixedValue != null) attribute.setAttribute("fixed", attributeObj.fixedValue); String formType = attributeObj.form.getValue(); if (!formType.equals(XmlSchemaForm.NONE)) { formType = convertString(formType); attribute.setAttribute("form", formType); } if (attributeObj.id != null) attribute.setAttribute("id", attributeObj.id); String useType = attributeObj.use.getValue(); if (!useType.equals(Constants.BlockConstants.NONE)) { useType = convertString(useType); attribute.setAttribute("use", useType); } if (attributeObj.annotation != null) { Element annotation = serializeAnnotation(doc, attributeObj.annotation, schema); attribute.appendChild(annotation); } if (attributeObj.schemaType != null) { try { XmlSchemaSimpleType simpleType = attributeObj.schemaType; Element simpleTypeEl = serializeSimpleType(doc, simpleType, schema); attribute.appendChild(simpleTypeEl); } catch (ClassCastException e) { throw new XmlSchemaSerializerException("only inline simple type allow as attribute's inline type"); } } Attr[] unhandled = attributeObj.getUnhandledAttributes(); Hashtable namespaces = new Hashtable(); if (unhandled != null) { // this is to make the wsdl:arrayType work // since unhandles attributes are not handled this is a special case // but the basic idea is to see if there is any attibute whose value has ":" // if it is present then it is likely that it is a namespace prefix // do what is neccesary to get the real namespace for it and make // required changes to the prefix for (int i = 0; i < unhandled.length; i++) { String name = unhandled[i].getNodeName(); String value = unhandled[i].getNodeValue(); if (name.equals("xmlns")) { namespaces.put("", value); } else if (name.startsWith("xmlns")) { namespaces.put(name.substring(name.indexOf(":") + 1), value); } } for (int i = 0; i < unhandled.length; i++) { String value = unhandled[i].getNodeValue(); String nodeName = unhandled[i].getNodeName(); if (value.indexOf(":") > -1 && !nodeName.startsWith("xmlns")) { String prefix = value.substring(0, value.indexOf(":")); String oldNamespace; if ((oldNamespace = (String) namespaces.get(prefix)) != null) { value = value.substring(value.indexOf(":") + 1); NamespacePrefixList ctx = schema.getNamespaceContext(); String[] prefixes = ctx.getDeclaredPrefixes(); for (int j = 0; j < prefixes.length; j++) { String pref = prefixes[j]; String uri = ctx.getNamespaceURI(pref); if (uri.equals(oldNamespace)) { value = prefix + ":" + value; } } } } if (unhandled[i].getNamespaceURI() != null) attribute.setAttributeNS(unhandled[i].getNamespaceURI(), nodeName, value); else attribute.setAttribute(nodeName, value); } } //process extension processExtensibilityComponents(attributeObj,attribute); return attribute; } /** * ********************************************************************* * Element serializeChoice(Document doc, XmlSchemaChoice choiceObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * choiceObj - XmlSchemaChoice that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of choice schema object. * ********************************************************************** */ Element serializeChoice(Document doc, XmlSchemaChoice choiceObj, XmlSchema schema) throws XmlSchemaSerializerException { //todo: handle any non schema attri ? Element choice = createNewElement(doc, "choice", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (choiceObj.id != null) if (choiceObj.id.length() > 0) choice.setAttribute("id", choiceObj.id); serializeMaxMinOccurs(choiceObj, choice); /* if(choiceObj.maxOccursString != null) choice.setAttribute("maxOccurs", choiceObj.maxOccursString); else if(choiceObj.maxOccurs > 1) choice.setAttribute("maxOccurs", choiceObj.maxOccurs +""); */ if (choiceObj.annotation != null) { Element annotation = serializeAnnotation(doc, choiceObj.annotation, schema); choice.appendChild(annotation); } XmlSchemaObjectCollection itemColl = choiceObj.items; if (itemColl != null) { int itemLength = itemColl.getCount(); for (int i = 0; i < itemLength; i++) { XmlSchemaObject obj = itemColl.getItem(i); if (obj instanceof XmlSchemaElement) { Element el = serializeElement(doc, (XmlSchemaElement) obj, schema); choice.appendChild(el); } else if (obj instanceof XmlSchemaGroupRef) { Element group = serializeGroupRef(doc, (XmlSchemaGroupRef) obj, schema); choice.appendChild(group); } else if (obj instanceof XmlSchemaChoice) { Element inlineChoice = serializeChoice(doc, (XmlSchemaChoice) obj, schema); choice.appendChild(inlineChoice); } else if (obj instanceof XmlSchemaSequence) { Element inlineSequence = serializeSequence(doc, (XmlSchemaSequence) obj, schema); choice.appendChild(inlineSequence); } else if (obj instanceof XmlSchemaAny) { Element any = serializeAny(doc, (XmlSchemaAny) obj, schema); choice.appendChild(any); } } } //process extension processExtensibilityComponents(choiceObj,choice); return choice; } /** * ********************************************************************* * Element serializeAll(Document doc, XmlSchemaAll allObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * allObj - XmlSchemaAll that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of particle all. * ********************************************************************** */ Element serializeAll(Document doc, XmlSchemaAll allObj, XmlSchema schema) throws XmlSchemaSerializerException { Element allEl = createNewElement(doc, "all", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); serializeMaxMinOccurs(allObj, allEl); if (allObj.annotation != null) { Element annotation = serializeAnnotation(doc, allObj.annotation, schema); allEl.appendChild(annotation); } XmlSchemaObjectCollection itemColl = allObj.items; if (itemColl != null) { int itemLength = itemColl.getCount(); for (int i = 0; i < itemLength; i++) { XmlSchemaObject obj = itemColl.getItem(i); if (obj instanceof XmlSchemaElement) { Element el = serializeElement(doc, (XmlSchemaElement) obj, schema); allEl.appendChild(el); } else throw new XmlSchemaSerializerException("Only element " + "allowed as child of all model type"); } } //process extension processExtensibilityComponents(allObj,allEl); return allEl; } /** * ********************************************************************* * Element serializeSimpleTypeList(Document doc, * XmlSchemaSimpleTypeList listObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * listObj - XmlSchemaSimpleTypeList that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple type with list method. * ********************************************************************** */ Element serializeSimpleTypeList(Document doc, XmlSchemaSimpleTypeList listObj, XmlSchema schema) throws XmlSchemaSerializerException { Element list = createNewElement(doc, "list", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (listObj.itemTypeName != null) { String listItemType = resolveQName(listObj.itemTypeName, schema); list.setAttribute("itemType", listItemType); } if (listObj.id != null) list.setAttribute("id", listObj.id); else if (listObj.itemType != null) { Element inlineSimpleEl = serializeSimpleType(doc, listObj.itemType, schema); list.appendChild(inlineSimpleEl); } if (listObj.annotation != null) { Element annotation = serializeAnnotation(doc, listObj.annotation, schema); list.appendChild(annotation); } //process extension processExtensibilityComponents(listObj,list); return list; } /** * ********************************************************************* * Element serializeSimpleTypeUnion(Document doc, * XmlSchemaSimpleTypeUnion unionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * unionObj - XmlSchemaSimpleTypeUnion that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple type with union method. * ********************************************************************** */ Element serializeSimpleTypeUnion(Document doc, XmlSchemaSimpleTypeUnion unionObj, XmlSchema schema) throws XmlSchemaSerializerException { Element union = createNewElement(doc, "union", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (unionObj.id != null) union.setAttribute("id", unionObj.id); if (unionObj.memberTypesSource != null) union.setAttribute("memberTypes", unionObj.memberTypesSource); if (unionObj.baseTypes.getCount() > 0) { int baseTypesLength = unionObj.baseTypes.getCount(); Element baseType; for (int i = 0; i < baseTypesLength; i++) { try { baseType = serializeSimpleType(doc, (XmlSchemaSimpleType) unionObj.baseTypes.getItem(i), schema); union.appendChild(baseType); } catch (ClassCastException e) { throw new XmlSchemaSerializerException("only inline simple type allow as attribute's " + "inline type"); } } } if (unionObj.annotation != null) { Element annotation = serializeAnnotation(doc, unionObj.annotation, schema); union.appendChild(annotation); } //process extension processExtensibilityComponents(unionObj,union); return union; } /** * ********************************************************************* * Element serializeAny(Document doc, XmlSchemaAny anyObj, XmlSchema schema) *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * anyObj - XmlSchemaAny that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of any that is part of its parent. * ********************************************************************** */ Element serializeAny(Document doc, XmlSchemaAny anyObj, XmlSchema schema) { Element anyEl = createNewElement(doc, "any", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (anyObj.id != null) if (anyObj.id.length() > 0) anyEl.setAttribute("id", anyObj.id); serializeMaxMinOccurs(anyObj, anyEl); if (anyObj.namespace != null) anyEl.setAttribute("namespace", anyObj.namespace); if (anyObj.processContent != null) { String value = anyObj.processContent.getValue(); if (!value.equals(Constants.BlockConstants.NONE)) { String processContent = convertString(value); anyEl.setAttribute("processContents", processContent); } } if (anyObj.annotation != null) { Element annotation = serializeAnnotation(doc, anyObj.annotation, schema); anyEl.appendChild(annotation); } //process extension processExtensibilityComponents(anyObj,anyEl); return anyEl; } /** * ********************************************************************* * Element serializeGroup(Document doc, XmlSchemaGroup groupObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * groupObj - XmlSchemaGroup that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of group elements. * ********************************************************************** */ Element serializeGroup(Document doc, XmlSchemaGroup groupObj, XmlSchema schema) throws XmlSchemaSerializerException { Element group = createNewElement(doc, "group", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (groupObj.name != null) { String grpName = groupObj.name.getLocalPart(); if (grpName.length() > 0) { group.setAttribute("name", grpName); } } else throw new XmlSchemaSerializerException("Group must have " + "name or ref"); /* annotations are supposed to be written first!!!!! */ if (groupObj.annotation != null) { Element annotation = serializeAnnotation(doc, groupObj.annotation, schema); group.appendChild(annotation); } if (groupObj.particle instanceof XmlSchemaSequence) { Element sequence = serializeSequence(doc, (XmlSchemaSequence) groupObj.particle, schema); group.appendChild(sequence); } else if (groupObj.particle instanceof XmlSchemaChoice) { Element choice = serializeChoice(doc, (XmlSchemaChoice) groupObj.particle, schema); group.appendChild(choice); } else if (groupObj.particle instanceof XmlSchemaAll) { Element all = serializeAll(doc, (XmlSchemaAll) groupObj.particle, schema); group.appendChild(all); } //process extension processExtensibilityComponents(groupObj,group); return group; } /** * ********************************************************************* * Element serializeGroupRef(Document doc, XmlSchemaGroupRef groupRefObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * groupRefObj - XmlSchemaGroupRef that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of group elements ref inside its parent. * ********************************************************************** */ Element serializeGroupRef(Document doc, XmlSchemaGroupRef groupRefObj, XmlSchema schema) throws XmlSchemaSerializerException { Element groupRef = createNewElement(doc, "group", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (groupRefObj.refName != null) { String groupRefName = resolveQName(groupRefObj.refName, schema); groupRef.setAttribute("ref", groupRefName); } else throw new XmlSchemaSerializerException("Group must have name or ref"); serializeMaxMinOccurs(groupRefObj, groupRef); if (groupRefObj.particle != null) { if (groupRefObj.particle instanceof XmlSchemaChoice) serializeChoice(doc, (XmlSchemaChoice) groupRefObj.particle, schema); else if (groupRefObj.particle instanceof XmlSchemaSequence) serializeSequence(doc,(XmlSchemaSequence) groupRefObj.particle, schema); else if (groupRefObj.particle instanceof XmlSchemaAll) serializeAll(doc,(XmlSchemaAll) groupRefObj.particle, schema); else throw new XmlSchemaSerializerException("The content of group " + "ref particle should be" + " sequence, choice or all reference: " + "www.w3.org/TR/xmlschema-1#element-group-3.7.2"); } if (groupRefObj.annotation != null) { Element annotation = serializeAnnotation(doc, groupRefObj.annotation, schema); groupRef.appendChild(annotation); } //process extension processExtensibilityComponents(groupRefObj,groupRef); return groupRef; } /** * ********************************************************************* * Element serializeSimpleContent(Document doc, * XmlSchemaSimpleContent simpleContentObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * simpleContentObj - XmlSchemaSimpleContent that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of complex type simple content. * ********************************************************************** */ Element serializeSimpleContent(Document doc, XmlSchemaSimpleContent simpleContentObj, XmlSchema schema) throws XmlSchemaSerializerException { Element simpleContent = createNewElement(doc, "simpleContent", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); Element content; if (simpleContentObj.annotation != null) { Element annotation = serializeAnnotation(doc, simpleContentObj.annotation, schema); simpleContent.appendChild(annotation); } if (simpleContentObj.content instanceof XmlSchemaSimpleContentRestriction) content = serializeSimpleContentRestriction(doc, (XmlSchemaSimpleContentRestriction) simpleContentObj.content, schema); else if (simpleContentObj.content instanceof XmlSchemaSimpleContentExtension) content = serializeSimpleContentExtension(doc, (XmlSchemaSimpleContentExtension) simpleContentObj.content, schema); else throw new XmlSchemaSerializerException("content of simple content " + "must be restriction or extension"); simpleContent.appendChild(content); //process extension processExtensibilityComponents(simpleContentObj,simpleContent); return simpleContent; } /** * ********************************************************************* * Element serializeComplexContent(Document doc, * XmlSchemaComplexContent complexContentObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * complexContentObj - XmlSchemaComplexContent that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of complex type complex content. * ********************************************************************** */ Element serializeComplexContent(Document doc, XmlSchemaComplexContent complexContentObj, XmlSchema schema) throws XmlSchemaSerializerException { Element complexContent = createNewElement(doc, "complexContent", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (complexContentObj.annotation != null) { Element annotation = serializeAnnotation(doc, complexContentObj.annotation, schema); complexContent.appendChild(annotation); } if (complexContentObj.mixed) complexContent.setAttribute("mixed", "true"); if (complexContentObj.id != null) complexContent.setAttribute("id", complexContentObj.id); Element content; if (complexContentObj.content instanceof XmlSchemaComplexContentRestriction) content = serializeComplexContentRestriction(doc, (XmlSchemaComplexContentRestriction) complexContentObj.content, schema); else if (complexContentObj.content instanceof XmlSchemaComplexContentExtension) content = serializeComplexContentExtension(doc, (XmlSchemaComplexContentExtension) complexContentObj.content, schema); else throw new XmlSchemaSerializerException("content of complexContent " + "must be restriction or extension"); complexContent.appendChild(content); //process extension processExtensibilityComponents(complexContentObj,complexContent); return complexContent; } /** * ********************************************************************* * Element serializeIdentityConstraint(Document doc, * XmlSchemaIdentityConstraint constraintObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * constraintObj - XmlSchemaIdentityConstraint that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of key, keyref or unique that part of its parent. * ********************************************************************** */ Element serializeIdentityConstraint(Document doc, XmlSchemaIdentityConstraint constraintObj, XmlSchema schema) throws XmlSchemaSerializerException { Element constraint; if (constraintObj instanceof XmlSchemaUnique) constraint = createNewElement(doc, "unique", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); else if (constraintObj instanceof XmlSchemaKey) constraint = createNewElement(doc, "key", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); else if (constraintObj instanceof XmlSchemaKeyref) { constraint = createNewElement(doc, "keyref", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); XmlSchemaKeyref keyref = (XmlSchemaKeyref) constraintObj; if (keyref.refer != null) { String keyrefStr = resolveQName(keyref.refer, schema); constraint.setAttribute( "refer", keyrefStr); } } else throw new XmlSchemaSerializerException("not valid identity " + "constraint"); if (constraintObj.name != null) constraint.setAttribute("name", constraintObj.name); if (constraintObj.annotation != null) { Element annotation = serializeAnnotation(doc, constraintObj.annotation, schema); constraint.appendChild(annotation); } if (constraintObj.selector != null) { Element selector = serializeSelector(doc, constraintObj.selector, schema); constraint.appendChild(selector); } XmlSchemaObjectCollection fieldColl = constraintObj.fields; if (fieldColl != null) { int fieldLength = fieldColl.getCount(); for (int i = 0; i < fieldLength; i++) { Element field = serializeField(doc, (XmlSchemaXPath) fieldColl.getItem(i), schema); constraint.appendChild(field); } } //process extension processExtensibilityComponents(constraintObj,constraint); return constraint; } /** * ********************************************************************* * Element serializeSelector(Document doc, XmlSchemaXPath selectorObj, * XmlSchema schema) throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * selectorObj - XmlSchemaXPath that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of selector with collection of xpath as its attrib. The selector * itself is the part of identity type. eg * Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * fieldObj - XmlSchemaXPath that will be serialized. * schema - Schema Document object of the parent. *

* Return: * field element that part of constraint. * ********************************************************************** */ Element serializeField(Document doc, XmlSchemaXPath fieldObj, XmlSchema schema) throws XmlSchemaSerializerException { Element field = createNewElement(doc, "field", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (fieldObj.xpath != null) field.setAttribute("xpath", fieldObj.xpath); else throw new XmlSchemaSerializerException("xpath can't be null"); if (fieldObj.annotation != null) { Element annotation = serializeAnnotation(doc, fieldObj.annotation, schema); field.appendChild(annotation); } //process extension processExtensibilityComponents(fieldObj,field); return field; } /** * ********************************************************************* * Element serializeAnnotation(Document doc, XmlSchemaAnnotation * annotationObj, XmlSchema schema) *

*

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * annotationObj - XmlSchemaAnnotation that will be serialized. * schema - Schema Document object of the parent. *

* Return: * annotation element that part of any type. will contain document and * appinfo for child. * ********************************************************************** */ Element serializeAnnotation(Document doc, XmlSchemaAnnotation annotationObj, XmlSchema schema) { Element annotation = createNewElement(doc, "annotation", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); XmlSchemaObjectCollection contents = annotationObj.items; int contentLength = contents.getCount(); for (int i = 0; i < contentLength; i++) { XmlSchemaObject obj = contents.getItem(i); if (obj instanceof XmlSchemaAppInfo) { XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) obj; Element appInfoEl = serializeAppInfo(doc, appinfo, schema); annotation.appendChild(appInfoEl); } else if (obj instanceof XmlSchemaDocumentation) { XmlSchemaDocumentation documentation = (XmlSchemaDocumentation) obj; Element documentationEl = serializeDocumentation(doc, documentation, schema); annotation.appendChild(documentationEl); } } //process extension processExtensibilityComponents(annotationObj,annotation); return annotation; } /** * ********************************************************************* * Element serializeAppInfo(Document doc,XmlSchemaAppInfo appInfoObj, * XmlSchema schema) *

*

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * appInfoObj - XmlSchemaAppInfo that will be serialized. * schema - Schema Document object of the parent. *

* Return: * App info element that is part of the annotation. * ********************************************************************** */ Element serializeAppInfo(Document doc, XmlSchemaAppInfo appInfoObj, XmlSchema schema) { Element appInfoEl = createNewElement(doc, "appinfo", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (appInfoObj.source != null) appInfoEl.setAttribute("source", appInfoObj.source); if (appInfoObj.markup != null) { int markupLength = appInfoObj.markup.getLength(); for (int j = 0; j < markupLength; j++) { Node n = appInfoObj.markup.item(j); appInfoEl.appendChild(doc.importNode(n,true)); } } //process extension processExtensibilityComponents(appInfoObj,appInfoEl); return appInfoEl; } /** * ********************************************************************* * Element serializeDocumentation(Document doc,XmlSchemaDocumentation * documentationObj, XmlSchema schema){ *

*

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * documentationObj - XmlSchemaAppInfo that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element representation of documentation that is part of annotation. * ********************************************************************** */ Element serializeDocumentation(Document doc, XmlSchemaDocumentation documentationObj, XmlSchema schema) { Element documentationEl = createNewElement(doc, "documentation", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (documentationObj.source != null) documentationEl.setAttribute("source", documentationObj.source); if (documentationObj.language != null) documentationEl.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang", documentationObj.language); if (documentationObj.markup != null) { int markupLength = documentationObj.markup.getLength(); for (int j = 0; j < markupLength; j++) { Node n = documentationObj.markup.item(j); switch (n.getNodeType()) { case Node.ELEMENT_NODE: appendElement(doc, documentationEl, n, schema); break; case Node.TEXT_NODE: Text t = doc.createTextNode(n.getNodeValue()); documentationEl.appendChild(t); break; default: break; } } } //process extension processExtensibilityComponents(documentationObj,documentationEl); return documentationEl; } /** * ********************************************************************* * Element serializeSimpleContentRestriction(Document doc, * XmlSchemaSimpleContentRestriction restrictionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

*

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * restrictionObj - XmlSchemaSimpleContentRestriction that will be * serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple content restriction. * ********************************************************************** */ Element serializeSimpleContentRestriction(Document doc, XmlSchemaSimpleContentRestriction restrictionObj, XmlSchema schema) throws XmlSchemaSerializerException { Element restriction = createNewElement(doc, "restriction", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (restrictionObj.baseTypeName != null) { String baseTypeName = resolveQName(restrictionObj.baseTypeName, schema); restriction.setAttribute("base", baseTypeName); } if (restrictionObj.id != null) restriction.setAttribute("id", restrictionObj.id); if (restrictionObj.annotation != null) { Element annotation = serializeAnnotation(doc, restrictionObj.annotation, schema); restriction.appendChild(annotation); } int attrCollLength = restrictionObj.attributes.getCount(); for (int i = 0; i < attrCollLength; i++) { XmlSchemaObject obj = restrictionObj.attributes.getItem(i); if (obj instanceof XmlSchemaAttribute) { Element attribute = serializeAttribute(doc, (XmlSchemaAttribute) obj, schema); restriction.appendChild(attribute); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attributeGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); restriction.appendChild(attributeGroup); } } if (restrictionObj.baseType != null) { Element inlineSimpleType = serializeSimpleType(doc, restrictionObj.baseType, schema); restriction.appendChild(inlineSimpleType); } if (restrictionObj.anyAttribute != null) { Element anyAttribute = serializeAnyAttribute(doc, restrictionObj.anyAttribute, schema); restriction.appendChild(anyAttribute); } XmlSchemaObjectCollection facets = restrictionObj.facets; int facetLength = facets.getCount(); for (int i = 0; i < facetLength; i++) { Element facet = serializeFacet(doc, (XmlSchemaFacet) facets.getItem(i), schema); restriction.appendChild(facet); } //process extension processExtensibilityComponents(restrictionObj,restriction); return restriction; } /** * ********************************************************************* * Element serializeSimpleContentExtension(Document doc, * XmlSchemaSimpleContentExtension extensionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

*

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * extensionObj - XmlSchemaSimpleContentExtension * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple content extension. * ********************************************************************** */ Element serializeSimpleContentExtension(Document doc, XmlSchemaSimpleContentExtension extensionObj, XmlSchema schema) throws XmlSchemaSerializerException { Element extension = createNewElement(doc, "extension", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (extensionObj.baseTypeName != null) { String baseTypeName = resolveQName(extensionObj.baseTypeName, schema); extension.setAttribute("base", baseTypeName); } if (extensionObj.id != null) extension.setAttribute("id", extensionObj.id); if (extensionObj.annotation != null) { Element annotation = serializeAnnotation(doc, extensionObj.annotation, schema); extension.appendChild(annotation); } XmlSchemaObjectCollection attributes = extensionObj.attributes; int attributeLength = attributes.getCount(); for (int i = 0; i < attributeLength; i++) { XmlSchemaObject obj = attributes.getItem(i); if (obj instanceof XmlSchemaAttribute) { Element attribute = serializeAttribute(doc, (XmlSchemaAttribute) obj, schema); extension.appendChild(attribute); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attributeGroupRef = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); extension.appendChild(attributeGroupRef); } } /* * anyAttribute must come *after* any other attributes */ if (extensionObj.anyAttribute != null) { Element anyAttribute = serializeAnyAttribute(doc, extensionObj.anyAttribute, schema); extension.appendChild(anyAttribute); } //process extension processExtensibilityComponents(extensionObj,extension); return extension; } /** * ********************************************************************* * Element serializeComplexContentRestriction(Document doc, * XmlSchemaComplexContentRestriction restrictionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * restrictionObj - XmlSchemaSimpleContentRestriction * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of simple content restriction. * ********************************************************************** */ Element serializeComplexContentRestriction(Document doc, XmlSchemaComplexContentRestriction restrictionObj, XmlSchema schema) throws XmlSchemaSerializerException { Element restriction = createNewElement(doc, "restriction", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (restrictionObj.baseTypeName != null) { String baseTypeName = resolveQName(restrictionObj.baseTypeName, schema); restriction.setAttribute( "base", baseTypeName); } if (restrictionObj.id != null) restriction.setAttribute("id", restrictionObj.id); if (restrictionObj.annotation != null) { Element annotation = serializeAnnotation(doc, restrictionObj.annotation, schema); restriction.appendChild(annotation); } if (restrictionObj.particle instanceof XmlSchemaSequence) { Element sequenceParticle = serializeSequence(doc, (XmlSchemaSequence) restrictionObj.particle, schema); restriction.appendChild(sequenceParticle); } else if (restrictionObj.particle instanceof XmlSchemaChoice) { Element choiceParticle = serializeChoice(doc, (XmlSchemaChoice) restrictionObj.particle, schema); restriction.appendChild(choiceParticle); } else if (restrictionObj.particle instanceof XmlSchemaAll) { Element allParticle = serializeAll(doc, (XmlSchemaAll) restrictionObj.particle, schema); restriction.appendChild(allParticle); } else if (restrictionObj.particle instanceof XmlSchemaGroupRef) { Element groupRefParticle = serializeGroupRef(doc, (XmlSchemaGroupRef) restrictionObj.particle, schema); restriction.appendChild(groupRefParticle); } int attributesLength = restrictionObj.attributes.getCount(); for (int i = 0; i < attributesLength; i++) { XmlSchemaObject obj = restrictionObj.attributes.getItem(i); if (obj instanceof XmlSchemaAttribute) { Element attr = serializeAttribute(doc, (XmlSchemaAttribute) obj, schema); restriction.appendChild(attr); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attrGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); restriction.appendChild(attrGroup); } } if (restrictionObj.anyAttribute != null) { Element anyAttribute = serializeAnyAttribute(doc, restrictionObj.anyAttribute, schema); restriction.appendChild(anyAttribute); } //process extension processExtensibilityComponents(restrictionObj,restriction); return restriction; } /** * ********************************************************************* * Element serializeComplexContentExtension(Document doc, * XmlSchemaComplexContentExtension extensionObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * extensionObj - XmlSchemaComplexContentRestriction * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of complex content extension. * ********************************************************************** */ Element serializeComplexContentExtension(Document doc, XmlSchemaComplexContentExtension extensionObj, XmlSchema schema) throws XmlSchemaSerializerException { Element extension = createNewElement(doc, "extension", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (extensionObj.baseTypeName != null) { String baseType = resolveQName(extensionObj.baseTypeName, schema); extension.setAttribute("base", baseType); } if (extensionObj.annotation != null) { Element annotation = serializeAnnotation(doc, extensionObj.annotation, schema); extension.appendChild(annotation); } if (extensionObj.particle instanceof XmlSchemaSequence) { Element sequenceParticle = serializeSequence(doc, (XmlSchemaSequence) extensionObj.particle, schema); extension.appendChild(sequenceParticle); } else if (extensionObj.particle instanceof XmlSchemaChoice) { Element choiceParticle = serializeChoice(doc, (XmlSchemaChoice) extensionObj.particle, schema); extension.appendChild(choiceParticle); } else if (extensionObj.particle instanceof XmlSchemaAll) { Element allParticle = serializeAll(doc, (XmlSchemaAll) extensionObj.particle, schema); extension.appendChild(allParticle); } else if (extensionObj.particle instanceof XmlSchemaGroupRef) { Element groupRefParticle = serializeGroupRef(doc, (XmlSchemaGroupRef) extensionObj.particle, schema); extension.appendChild(groupRefParticle); } int attributesLength = extensionObj.attributes.getCount(); for (int i = 0; i < attributesLength; i++) { XmlSchemaObject obj = extensionObj.attributes.getItem(i); if (obj instanceof XmlSchemaAttribute) { Element attr = serializeAttribute(doc, (XmlSchemaAttribute) obj, schema); extension.appendChild(attr); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attrGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); extension.appendChild(attrGroup); } } if (extensionObj.anyAttribute != null) { Element anyAttribute = serializeAnyAttribute(doc, extensionObj.anyAttribute, schema); extension.appendChild(anyAttribute); } //process extension processExtensibilityComponents(extensionObj,extension); return extension; } /** * ********************************************************************* * Element serializeAnyAttribute(Document doc, * XmlSchemaAnyAttribute anyAttributeObj, XmlSchema schema) *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * anyAttributeObj - XmlSchemaAnyAttribute * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of any attribute element. * ********************************************************************** */ Element serializeAnyAttribute(Document doc, XmlSchemaAnyAttribute anyAttributeObj, XmlSchema schema) { Element anyAttribute = createNewElement(doc, "anyAttribute", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (anyAttributeObj.namespace != null) anyAttribute.setAttribute("namespace", anyAttributeObj.namespace); if (anyAttributeObj.id != null) anyAttribute.setAttribute("id", anyAttributeObj.id); if (anyAttributeObj.processContent != null) { String processContent = anyAttributeObj.processContent.getValue(); processContent = convertString(processContent); anyAttribute.setAttribute("processContents", processContent); } if (anyAttributeObj.annotation != null) { Element annotation = serializeAnnotation(doc, anyAttributeObj.annotation, schema); anyAttribute.appendChild(annotation); } //process extension processExtensibilityComponents(anyAttributeObj,anyAttribute); return anyAttribute; } /** * ********************************************************************* * Element serializeAttributeGroupRef(Document doc, * XmlSchemaAttributeGroupRef attributeGroupObj, XmlSchema schema) * throws XmlSchemaSerializerException *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * attributeGroupObj - XmlSchemaAttributeGroupRef * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of attribute group ref that part of type. * ********************************************************************** */ Element serializeAttributeGroupRef(Document doc, XmlSchemaAttributeGroupRef attributeGroupObj, XmlSchema schema) throws XmlSchemaSerializerException { Element attributeGroupRef = createNewElement(doc, "attributeGroup", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (attributeGroupObj.refName != null) { String refName = resolveQName(attributeGroupObj.refName, schema); attributeGroupRef.setAttribute("ref", refName); } else throw new XmlSchemaSerializerException("Attribute group must have " + "ref name set"); if (attributeGroupObj.id != null) attributeGroupRef.setAttribute("id", attributeGroupObj.id); if (attributeGroupObj.annotation != null) { Element annotation = serializeAnnotation(doc, attributeGroupObj.annotation, schema); attributeGroupRef.appendChild(annotation); } //process extension processExtensibilityComponents(attributeGroupObj,attributeGroupRef); return attributeGroupRef; } /** * ********************************************************************* * Element serializeAttributeGroup(Document doc, * XmlSchemaAttributeGroup attributeGroupObj, XmlSchema schema) * throws XmlSchemaSerializerException{ *

* Each member of complex type will be appended and pass the element * created. Complex type processed according to w3c Recommendation * May 2 2001. *

* Parameter: * doc - Document the parent use. * attributeGroupObj - XmlSchemaAttributeGroup * that will be serialized. * schema - Schema Document object of the parent. *

* Return: * Element of attribute group. * ********************************************************************** */ Element serializeAttributeGroup(Document doc, XmlSchemaAttributeGroup attributeGroupObj, XmlSchema schema) throws XmlSchemaSerializerException { Element attributeGroup = createNewElement(doc, "attributeGroup", schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); if (attributeGroupObj.name != null) { String attGroupName = attributeGroupObj.name.getLocalPart(); attributeGroup.setAttribute("name", attGroupName); }else throw new XmlSchemaSerializerException("Attribute group must" + "have name"); if (attributeGroupObj.id != null) attributeGroup.setAttribute("id", attributeGroupObj.id); if (attributeGroupObj.annotation != null) { Element annotation = serializeAnnotation(doc, attributeGroupObj.annotation, schema); attributeGroup.appendChild(annotation); } int attributesLength = attributeGroupObj.attributes.getCount(); for (int i = 0; i < attributesLength; i++) { XmlSchemaObject obj = attributeGroupObj.attributes.getItem(i); if (obj instanceof XmlSchemaAttribute) { Element attr = serializeAttribute(doc, (XmlSchemaAttribute) obj, schema); attributeGroup.appendChild(attr); } else if (obj instanceof XmlSchemaAttributeGroupRef) { Element attrGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef) obj, schema); attributeGroup.appendChild(attrGroup); } } if (attributeGroupObj.anyAttribute != null) { Element anyAttribute = serializeAnyAttribute(doc, attributeGroupObj.anyAttribute, schema); attributeGroup.appendChild(anyAttribute); } //process extension processExtensibilityComponents(attributeGroupObj,attributeGroup); return attributeGroup; } //recursively add any attribute, text and children append all //found children base on parent as its root. private void appendElement(Document doc, Element parent, Node children, XmlSchema schema) { Element elTmp = (Element) children; Element el = createNewElement(doc, elTmp.getLocalName(), schema.schema_ns_prefix, XmlSchema.SCHEMA_NS); NamedNodeMap attributes = el.getAttributes(); //check if child node has attribute //create new element and append it if found int attributeLength = attributes.getLength(); for (int i = 0; i < attributeLength; i++) { Node n = attributes.item(i); //assuming attributes got to throw exception if not later el.setAttribute(n.getNodeName(), n.getNodeValue()); } //check any descendant of this node //if there then append its child NodeList decendants = el.getChildNodes(); int decendantLength = decendants.getLength(); for (int i = 0; i < decendantLength; i++) { Node n = decendants.item(i); short nodeType = n.getNodeType(); if (nodeType == Node.TEXT_NODE) { String nValue = n.getNodeValue(); Text t = doc.createTextNode(nValue); el.appendChild(t); } else if (nodeType == Node.ELEMENT_NODE) { appendElement(doc, el, n, schema); } } } //break string with prefix into two parts part[0]:prefix , part[1]:namespace private static String[] getParts(String name) { String[] parts = new String[2]; int index = name.indexOf(":"); if (index > -1) { parts[0] = name.substring(0, index); parts[1] = name.substring(index + 1); } else { parts[0] = ""; parts[1] = name; } return parts; } //Convert given string to lower case or w3c standard private String convertString(String convert) { String input = convert.trim(); if (input.equals(Constants.BlockConstants.ALL)) { return "#all"; } else return input.toLowerCase(); } //Create new element with given local name and namespaces check whether //the prefix is there or not. private Element createNewElement(Document docs, String localName, String prefix, String namespace) { String elementName = ((prefix.length() > 0) ? prefix += ":" : "") + localName; return docs.createElementNS(namespace, elementName); } /** * will search whether the prefix is available in global hash table, if it * is there than append the prefix to the element name. If not then it will * create new prefix corresponding to that namespace and store that in * hash table. Finally add the new prefix and namespace to * element * @param names * @param schemaObj * @return resolved QName of the string */ private String resolveQName(QName names, XmlSchema schemaObj) { String namespace = names.getNamespaceURI(); String type[] = getParts(names.getLocalPart()); String typeName = (type.length > 1) ? type[1] : type[0]; String prefixStr; // If the namespace is "" then the prefix is also "" Object prefix = ("".equals(namespace)) ? "" : schema_ns.get(namespace); if (prefix == null) { if (Constants.XMLNS_URI.equals(namespace)) { prefix = Constants.XMLNS_PREFIX; } else { int magicNumber = 0; Collection prefixes = schema_ns.values(); while(prefixes.contains("ns" + magicNumber)){ magicNumber++; } prefix = "ns" + magicNumber; schema_ns.put(namespace, prefix); //setting xmlns in schema schemaElement.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns:" + prefix.toString(), namespace); } } prefixStr = prefix.toString(); prefixStr = (prefixStr.trim().length() > 0) ? prefixStr + ":" : ""; return prefixStr + typeName; } //for each collection if it is an attribute serialize attribute and //append that child to container element. void setupAttr(Document doc, XmlSchemaObjectCollection collectionObj, XmlSchema schema, Element container) throws XmlSchemaSerializerException { int collectionLength = collectionObj.getCount(); for (int i = 0; i < collectionLength; i++) { XmlSchemaObject obj = collectionObj.getItem(i); if (obj instanceof XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute) obj; Element attrEl = serializeAttribute(doc, attr, schema); container.appendChild(attrEl); } else if (obj instanceof XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef attr = (XmlSchemaAttributeGroupRef) obj; Element attrEl = serializeAttributeGroupRef(doc, attr, schema); container.appendChild(attrEl); } } } public static class XmlSchemaSerializerException extends Exception { /** * */ private static final long serialVersionUID = 1L; public XmlSchemaSerializerException(String msg) { super(msg); } } /** * A generic method to process the extra attributes and the the extra * elements present within the schema. * What are considered extensions are child elements with non schema namespace * and child attributes with any namespace * @param schemaObject * @param parentElement */ private void processExtensibilityComponents(XmlSchemaObject schemaObject,Element parentElement){ if (extReg!=null){ Map metaInfoMap = schemaObject.getMetaInfoMap(); if (metaInfoMap!=null && !metaInfoMap.isEmpty()) { //get the extra objects and call the respective deserializers Iterator keysIt = metaInfoMap.keySet().iterator(); while (keysIt.hasNext()) { Object key = keysIt.next(); extReg.serializeExtension(schemaObject,metaInfoMap.get(key).getClass(),parentElement); } } } } } ./src/org/apache/ws/commons/schema/XmlSchemaGroup.java0000664000175000017500000000327311767656530022116 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class that defines groups at the schema level that are referenced * from the complex types. Groups a set of element declarations so that * they can be incorporated as a group into complex type definitions. * Represents the World Wide Web Consortium (W3C) group element. */ public class XmlSchemaGroup extends XmlSchemaAnnotated { /** * Creates new XmlSchemaGroup */ public XmlSchemaGroup() { } QName name; XmlSchemaGroupBase particle; public QName getName() { return name; } public void setName(QName name) { this.name = name; } public XmlSchemaGroupBase getParticle() { return particle; } public void setParticle(XmlSchemaGroupBase particle) { this.particle = particle; } } ./src/org/apache/ws/commons/schema/ValidationEvent.java0000664000175000017500000000220411767656530022305 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import java.util.EventObject; public class ValidationEvent extends EventObject { /** * */ private static final long serialVersionUID = 1L; /** * Creates new ValidationEvent */ public ValidationEvent(Object source) { super(source); } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java0000664000175000017500000000542311767656530026033 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for simple types that are derived by restriction. Restricts the * range of values for the element to a subset of the inherited simple types. * Represents the World Wide Web Consortium (W3C) restriction element for simple content. */ public class XmlSchemaSimpleContentRestriction extends XmlSchemaContent { /** * Creates new XmlSchemaSimpleContentRestriction */ public XmlSchemaSimpleContentRestriction() { facets = new XmlSchemaObjectCollection(); attributes = new XmlSchemaObjectCollection(); } /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/ XmlSchemaAnyAttribute anyAttribute; public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } public XmlSchemaAnyAttribute getAnyAttribute() { return this.anyAttribute; } /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/ XmlSchemaObjectCollection attributes; public XmlSchemaObjectCollection getAttributes() { return this.attributes; } /*Derived from the type specified by the base value.*/ XmlSchemaSimpleType baseType; public void setBaseType(XmlSchemaSimpleType baseType) { this.baseType = baseType; } public XmlSchemaSimpleType getBaseType() { return this.baseType; } /* Name of the built-in data type, simple type, or complex type.*/ QName baseTypeName; public void setBaseTypeName(QName baseTypeName) { this.baseTypeName = baseTypeName; } public QName getBaseTypeName() { return this.baseTypeName; } /* One or more of the facet classes: */ XmlSchemaObjectCollection facets; public XmlSchemaObjectCollection getFacets() { return this.facets; } } ./src/org/apache/ws/commons/schema/XmlSchemaFacet.java0000664000175000017500000000644711767656530022052 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.w3c.dom.Element; /** * Abstract class for all facets that are used when simple types are * derived by restriction. */ public abstract class XmlSchemaFacet extends XmlSchemaAnnotated { /** * Creates new XmlSchemaFacet */ protected XmlSchemaFacet() { } protected XmlSchemaFacet(Object value, boolean fixed) { this.value = value; this.fixed = fixed; } boolean fixed; Object value; public boolean isFixed() { return fixed; } public void setFixed(boolean fixed) { this.fixed = fixed; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public static XmlSchemaFacet construct(Element el) { String name = el.getLocalName(); boolean fixed = false; if (el.getAttribute("fixed").equals("true")) { fixed = true; } XmlSchemaFacet facet; if (name.equals("enumeration")) { facet = new XmlSchemaEnumerationFacet(); } else if (name.equals("fractionDigits")) { facet = new XmlSchemaFractionDigitsFacet(); } else if (name.equals("length")) { facet = new XmlSchemaLengthFacet(); } else if (name.equals("maxExclusive")) { facet = new XmlSchemaMaxExclusiveFacet(); } else if (name.equals("maxInclusive")) { facet = new XmlSchemaMaxInclusiveFacet(); } else if (name.equals("maxLength")) { facet = new XmlSchemaMaxLengthFacet(); } else if (name.equals("minLength")) { facet = new XmlSchemaMinLengthFacet(); } else if (name.equals("minExclusive")) { facet = new XmlSchemaMinExclusiveFacet(); } else if (name.equals("minInclusive")) { facet = new XmlSchemaMinInclusiveFacet(); } else if (name.equals("pattern")) { facet = new XmlSchemaPatternFacet(); } else if (name.equals("totalDigits")) { facet = new XmlSchemaTotalDigitsFacet(); } else if (name.equals("whiteSpace")) { facet = new XmlSchemaWhiteSpaceFacet(); } else { throw new XmlSchemaException("Incorrect facet with name \"" + name + "\" found."); } if (el.hasAttribute("id"))facet.setId(el.getAttribute("id")); facet.setFixed(fixed); facet.setValue(el.getAttribute("value")); return facet; } } ./src/org/apache/ws/commons/schema/XmlSchemaObjectCollection.java0000664000175000017500000000443311767656530024243 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import java.util.Iterator; import java.util.Vector; /** * An object collection class to handle XmlSchemaObjects when collections * are returned from method calls. */ public class XmlSchemaObjectCollection { Vector objects; /** * Creates new XmlSchemaObjectCollection */ public XmlSchemaObjectCollection() { objects = new Vector(); } public int getCount() { return objects.size(); } public XmlSchemaObject getItem(int i) { return (XmlSchemaObject) objects.elementAt(i); } public void setItem(int i, XmlSchemaObject item) { objects.insertElementAt(item, i); } public void add(XmlSchemaObject item) { objects.addElement(item); } public boolean contains(XmlSchemaObject item) { return objects.contains(item); } public int indexOf(XmlSchemaObject item) { return objects.indexOf(item); } public void remove(XmlSchemaObject item) { objects.remove(item); } public void removeAt(int index) { objects.removeElementAt(index); } public Iterator getIterator() { return objects.iterator(); } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < getCount(); i++) { xml += getItem(i).toString(prefix, tab); } return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java0000664000175000017500000000623511767656530026213 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for complex types with a complex content model that are derived * by restriction. Restricts the contents of the complex type to a subset * of the inherited complex type. Represents the World Wide Web Consortium * (W3C) restriction element for complex content. */ public class XmlSchemaComplexContentRestriction extends XmlSchemaContent { /** * Creates new XmlSchemaComplexContentRestriction */ public XmlSchemaComplexContentRestriction() { attributes = new XmlSchemaObjectCollection(); } /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/ XmlSchemaAnyAttribute anyAttribute; public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } public XmlSchemaAnyAttribute getAnyAttribute() { return this.anyAttribute; } /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. * Collection of attributes for the simple type. */ XmlSchemaObjectCollection attributes; public XmlSchemaObjectCollection getAttributes() { return this.attributes; } /* Name of the built-in data type, simple type, or complex type.*/ QName baseTypeName; public void setBaseTypeName(QName baseTypeName) { this.baseTypeName = baseTypeName; } public QName getBaseTypeName() { return this.baseTypeName; } /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, * or XmlSchemaSequence classes. */ XmlSchemaParticle particle; public XmlSchemaParticle getParticle() { return this.particle; } public void setParticle(XmlSchemaParticle particle) { this.particle = particle; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "restriction>\n"; if (particle != null) xml += particle.toString(prefix, (tab + 1)); for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/ValidationEventHandler.java0000664000175000017500000000177011767656530023612 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; public class ValidationEventHandler { /** * Creates new ValidationEventHandler */ public ValidationEventHandler() { } } ./src/org/apache/ws/commons/schema/XmlSchemaType.java0000664000175000017500000000540711767656530021744 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import javax.xml.namespace.QName; /** * The base class for all simple types and complex types. */ public class XmlSchemaType extends XmlSchemaAnnotated { Object baseSchemaType; XmlSchemaDatatype dataType; XmlSchemaDerivationMethod deriveBy, finalDerivation, finalResolved; boolean isMixed; // name of the type String name; XmlSchema schema; /** * Creates new XmlSchemaType */ public XmlSchemaType(XmlSchema schema) { this.schema = schema; finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); } public Object getBaseSchemaType() { return baseSchemaType; } public XmlSchemaDatatype getDataType() { return dataType; } public XmlSchemaDerivationMethod getDeriveBy() { return deriveBy; } public XmlSchemaDerivationMethod getFinal() { return finalDerivation; } public void setFinal(XmlSchemaDerivationMethod finalDerivation) { this.finalDerivation = finalDerivation; } public XmlSchemaDerivationMethod getFinalResolved() { return finalResolved; } public boolean isMixed() { return isMixed; } public void setMixed(boolean isMixed) { this.isMixed = isMixed; } public String getName() { return name; } public void setName(String name) { this.name = name; } public QName getQName() { if(name == null) { return null; } return new QName(schema.logicalTargetNamespace, name); } public String toString() { if(name == null) { return super.toString() + "[anonymous]"; } else if (schema.logicalTargetNamespace == null) { return super.toString() + "[{}" + name + "]"; } else { return super.toString() + "[{" + schema.logicalTargetNamespace + "}" + name + "]"; } } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleType.java0000664000175000017500000000404011767656530023106 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class defines a simple type that determines the information and * constraints for the values of attributes or elements with text-only * content. Represents the World Wide Web Consortium (W3C) simpleType element. */ public class XmlSchemaSimpleType extends XmlSchemaType { XmlSchemaSimpleTypeContent content; /** * Creates new XmlSchemaSimpleType */ public XmlSchemaSimpleType(XmlSchema schema) { super(schema); } public XmlSchemaSimpleTypeContent getContent() { return content; } public void setContent(XmlSchemaSimpleTypeContent content) { this.content = content; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "simpleType>\n"; if (content != null) xml += content.toString(prefix, (tab + 1)); for (int i = 0; i < tab; i++) xml += "\t"; xml += "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaInclude.java0000664000175000017500000000236611767656530022407 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class to include declarations and definitions from an external schema. * Allows them to be available for processing in the containing schema. * Represents the World Wide Web Consortium (W3C) include element. */ public class XmlSchemaInclude extends XmlSchemaExternal { /** * Creates new XmlSchemaInclude */ public XmlSchemaInclude() { super(); } } ./src/org/apache/ws/commons/schema/XmlSchemaParticle.java0000664000175000017500000000340711767656530022564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Base class for all particle types. */ public class XmlSchemaParticle extends XmlSchemaAnnotated { long maxOccurs = 1; String maxOccursString; long minOccurs = 1; String minOccursString; /** * Creates new XmlSchemaParticle * Particle types are usually interchangeable. * A local element declaration or reference to a global element * declaration (element), a compositor ( sequence, choice, or all), * a reference to a named content model group (group), or an element wildcard (any). */ public XmlSchemaParticle() { } public void setMaxOccurs(long maxOccurs) { this.maxOccurs = maxOccurs; } public long getMaxOccurs() { return maxOccurs; } public void setMinOccurs(long minOccurs) { this.minOccurs = minOccurs; } public long getMinOccurs() { return minOccurs; } } ./src/org/apache/ws/commons/schema/XmlSchemaNumericFacet.java0000664000175000017500000000230111767656530023356 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Abstract class for defining numeric facets. */ public abstract class XmlSchemaNumericFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaNumericFacet */ protected XmlSchemaNumericFacet() { } protected XmlSchemaNumericFacet(Object value, boolean fixed) { super(value, fixed); } } ./src/org/apache/ws/commons/schema/XmlSchemaAny.java0000664000175000017500000000357511767656530021556 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; /** * Enables any element from the specified namespace or namespaces * to appear in the containing complexType element. Represents the * World Wide Web Consortium (W3C) any element. */ public class XmlSchemaAny extends XmlSchemaParticle { /** * Creates new XmlSchemaAny */ public XmlSchemaAny() { processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE); } /** * Namespaces containing the elements that can be used. */ String namespace; public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } XmlSchemaContentProcessing processContent; public XmlSchemaContentProcessing getProcessContent() { return processContent; } public void setProcessContent(XmlSchemaContentProcessing processContent) { this.processContent = processContent; } } ./src/org/apache/ws/commons/schema/XmlSchemaMaxExclusiveFacet.java0000664000175000017500000000322011767656530024372 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining maxExclusive facets. Represents the World Wide * Web Consortium (W3C) maxExclusive facet. */ public class XmlSchemaMaxExclusiveFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaMaxExclusiveFacet */ public XmlSchemaMaxExclusiveFacet() { } public XmlSchemaMaxExclusiveFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaAll.java0000664000175000017500000000242011767656530021523 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Permits the elements in the group to appear (or not appear) * in any order in the containing element. Represents the World * Wide Web Consortium (W3C) all element (compositor). */ public class XmlSchemaAll extends XmlSchemaGroupBase { /** * Creates new XmlSchemaAll */ public XmlSchemaAll() { } public XmlSchemaObjectCollection getItems() { return this.items; } } ./src/org/apache/ws/commons/schema/XmlSchemaObject.java0000664000175000017500000000706411767656530022232 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import java.util.LinkedHashMap; import java.util.Map; public abstract class XmlSchemaObject { int lineNumber; int linePosition; String sourceURI; /** * a map for holding meta information * Initially set to null to gain some improvement * in memory. will be initialized only if a * user attempts */ private Map metaInfoMap = null; /** * returns the metainfo map. may be null * if not utilized */ public Map getMetaInfoMap() { return metaInfoMap; } /** * Directly set the meta info map into the schema element * @param metaInfoMap */ public void setMetaInfoMap(Map metaInfoMap) { this.metaInfoMap = metaInfoMap; } /** * Add a value to the meta info map * will be initialized if not used * previously * @param key * @param value */ public void addMetaInfo(Object key,Object value){ if (metaInfoMap==null){ metaInfoMap = new LinkedHashMap(); } metaInfoMap.put(key,value); } /** * Creates new XmlSchemaObject */ protected XmlSchemaObject() { } public int getLineNumber() { return lineNumber; } public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } public int getLinePosition() { return linePosition; } public void setLinePosition(int linePosition) { this.linePosition = linePosition; } public String getSourceURI() { return sourceURI; } public void setSourceURI(String sourceURI) { this.sourceURI = sourceURI; } public boolean equals(Object what) { if (what == this) { return true; } // note: instanceof returns false if its first operand is null if (!(what instanceof XmlSchemaObject)) { return false; } XmlSchemaObject xso = (XmlSchemaObject) what; if (this.lineNumber != xso.lineNumber) { return false; } if (this.linePosition != xso.linePosition) { return false; } if (this.sourceURI != null) { if (!this.sourceURI.equals(xso.sourceURI)) { return false; } } else { if (xso.sourceURI != null) { return false; } } return true; } public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; xml += this.getClass().toString() + "\n"; return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaAppInfo.java0000664000175000017500000000350611767656530022355 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.w3c.dom.NodeList; /** * Defines application specific information within an annotation. * Represents the World Wide Web Consortium (W3C) appinfo element. */ // Jan 24 2002 - Joni - Change the Node into NodeList public class XmlSchemaAppInfo extends XmlSchemaObject { /** * Provides the source of the application information. */ String source; /** * Returns an array of XmlNode that represents the document text markup. */ NodeList markup; /** * Creates new XmlSchemaAppInfo * The default constructor initializes all fields to their default values. */ public XmlSchemaAppInfo() { } public String getSource() { return source; } public void setSource(String source) { this.source = source; } public NodeList getMarkup() { return markup; } public void setMarkup(NodeList markup) { this.markup = markup; } } ./src/org/apache/ws/commons/schema/XmlTokenizedType.java0000664000175000017500000000266111767656530022477 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; public class XmlTokenizedType extends org.apache.ws.commons.schema.constants.Enum { static String[] members = new String[]{"CDATA", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS", "NOTATION", "ENUMERATION", "QName", "NCName", "None"}; /** * Creates new XmlSchemaForm */ public XmlTokenizedType(String value) { super(value); } public String[] getValues() { return members; } } ./src/org/apache/ws/commons/schema/XmlSchemaCollection.java0000664000175000017500000004715111767656530023120 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.extensions.ExtensionRegistry; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; import org.apache.ws.commons.schema.resolver.URIResolver; import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.apache.ws.commons.schema.utils.TargetNamespaceValidator; import org.apache.ws.commons.schema.utils.DOMUtil; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import java.io.IOException; import java.io.Reader; import java.util.*; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; /** * Contains a cache of XML Schema definition language (XSD). * */ public final class XmlSchemaCollection { // the default extension registry private ExtensionRegistry extReg = new ExtensionRegistry(); public ExtensionRegistry getExtReg() { return extReg; } public void setExtReg(ExtensionRegistry extReg) { this.extReg = extReg; } /** * This map contains a list of Schema objects keyed in by their namespaces * When resolving schemas, this map will be checked for the presence of the schema * first */ private Map knownNamespaceMap = new HashMap(); /** * get the namespace map * @return a map of previously known XMLSchema objects keyed by their namespace (String) */ public Map getKnownNamespaceMap() { return knownNamespaceMap; } /** * sets the known namespace map * @param knownNamespaceMap a map of previously known XMLSchema objects keyed by their namespace (String) */ public void setKnownNamespaceMap(Map knownNamespaceMap) { this.knownNamespaceMap = knownNamespaceMap; } static class SchemaKey { private final String namespace; private final String systemId; SchemaKey(String pNamespace, String pSystemId) { namespace = pNamespace == null ? Constants.NULL_NS_URI : pNamespace; systemId = pSystemId == null ? "" : pSystemId; } String getNamespace() { return namespace; } String getSystemId() { return systemId; } public int hashCode() { final int PRIME = 31; return (PRIME + namespace.hashCode()) * PRIME + systemId.hashCode(); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final SchemaKey other = (SchemaKey) obj; return namespace.equals(other.namespace) && systemId.equals(other.systemId); } public String toString() { return Constants.NULL_NS_URI.equals(namespace) ? systemId : ("{" + namespace + "}" + systemId); } } /** * Map of included schemas. */ private Map schemas = new HashMap(); /** * base URI is used as the base for loading the * imports */ String baseUri = null; /** * In-scope namespaces for XML processing */ private NamespacePrefixList namespaceContext; /** * An org.xml.sax.EntityResolver that is used to * resolve the imports/includes */ URIResolver schemaResolver = new DefaultURIResolver(); XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this); /** * stack to track imports (to prevent recursion) */ Stack stack = new Stack(); /** * Set the base URI. This is used when schemas need to be * loaded from relative locations * @param baseUri baseUri for this */ public void setBaseUri(String baseUri){ this.baseUri = baseUri; } /** * Register a custom URI resolver * @param schemaResolver resolver */ public void setSchemaResolver(URIResolver schemaResolver) { this.schemaResolver = schemaResolver; } /** * This section should comply to the XMLSchema specification; see * * http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes. * This needs to be inspected by another pair of eyes */ public void init() { /* Primitive types 3.2.1 string 3.2.2 boolean 3.2.3 decimal 3.2.4 float 3.2.5 double 3.2.6 duration 3.2.7 dateTime 3.2.8 time 3.2.9 date 3.2.10 gYearMonth 3.2.11 gYear 3.2.12 gMonthDay 3.2.13 gDay 3.2.14 gMonth 3.2.15 hexBinary 3.2.16 base64Binary 3.2.17 anyURI 3.2.18 QName 3.2.19 NOTATION */ addSimpleType(xsd, Constants.XSD_STRING.getLocalPart()); addSimpleType(xsd, Constants.XSD_BOOLEAN.getLocalPart()); addSimpleType(xsd, Constants.XSD_FLOAT.getLocalPart()); addSimpleType(xsd, Constants.XSD_DOUBLE.getLocalPart()); addSimpleType(xsd, Constants.XSD_QNAME.getLocalPart()); addSimpleType(xsd, Constants.XSD_DECIMAL.getLocalPart()); addSimpleType(xsd, Constants.XSD_DURATION.getLocalPart()); addSimpleType(xsd, Constants.XSD_DATE.getLocalPart()); addSimpleType(xsd, Constants.XSD_TIME.getLocalPart()); addSimpleType(xsd, Constants.XSD_DATETIME.getLocalPart()); addSimpleType(xsd, Constants.XSD_DAY.getLocalPart()); addSimpleType(xsd, Constants.XSD_MONTH.getLocalPart()); addSimpleType(xsd, Constants.XSD_MONTHDAY.getLocalPart()); addSimpleType(xsd, Constants.XSD_YEAR.getLocalPart()); addSimpleType(xsd, Constants.XSD_YEARMONTH.getLocalPart()); addSimpleType(xsd, Constants.XSD_NOTATION.getLocalPart()); addSimpleType(xsd, Constants.XSD_HEXBIN.getLocalPart()); addSimpleType(xsd, Constants.XSD_BASE64.getLocalPart()); addSimpleType(xsd, Constants.XSD_ANYURI.getLocalPart()); /* 3.3.1 normalizedString 3.3.2 token 3.3.3 language 3.3.4 NMTOKEN 3.3.5 NMTOKENS 3.3.6 Name 3.3.7 NCName 3.3.8 ID 3.3.9 IDREF 3.3.10 IDREFS 3.3.11 ENTITY 3.3.12 ENTITIES 3.3.13 integer 3.3.14 nonPositiveInteger 3.3.15 negativeInteger 3.3.16 long 3.3.17 int 3.3.18 short 3.3.19 byte 3.3.20 nonNegativeInteger 3.3.21 unsignedLong 3.3.22 unsignedInt 3.3.23 unsignedShort 3.3.24 unsignedByte 3.3.25 positiveInteger */ //derived types from decimal addSimpleType(xsd, Constants.XSD_LONG.getLocalPart()); addSimpleType(xsd, Constants.XSD_SHORT.getLocalPart()); addSimpleType(xsd, Constants.XSD_BYTE.getLocalPart()); addSimpleType(xsd, Constants.XSD_INTEGER.getLocalPart()); addSimpleType(xsd, Constants.XSD_INT.getLocalPart()); addSimpleType(xsd, Constants.XSD_POSITIVEINTEGER.getLocalPart()); addSimpleType(xsd, Constants.XSD_NEGATIVEINTEGER.getLocalPart()); addSimpleType(xsd, Constants.XSD_NONPOSITIVEINTEGER.getLocalPart()); addSimpleType(xsd, Constants.XSD_NONNEGATIVEINTEGER.getLocalPart()); addSimpleType(xsd, Constants.XSD_UNSIGNEDBYTE.getLocalPart()); addSimpleType(xsd, Constants.XSD_UNSIGNEDINT.getLocalPart()); addSimpleType(xsd, Constants.XSD_UNSIGNEDLONG.getLocalPart()); addSimpleType(xsd, Constants.XSD_UNSIGNEDSHORT.getLocalPart()); //derived types from string addSimpleType(xsd, Constants.XSD_NAME.getLocalPart()); addSimpleType(xsd, Constants.XSD_NORMALIZEDSTRING.getLocalPart()); addSimpleType(xsd, Constants.XSD_NCNAME.getLocalPart()); addSimpleType(xsd, Constants.XSD_NMTOKEN.getLocalPart()); addSimpleType(xsd, Constants.XSD_NMTOKENS.getLocalPart()); addSimpleType(xsd, Constants.XSD_ENTITY.getLocalPart()); addSimpleType(xsd, Constants.XSD_ENTITIES.getLocalPart()); addSimpleType(xsd, Constants.XSD_ID.getLocalPart()); addSimpleType(xsd, Constants.XSD_IDREF.getLocalPart()); addSimpleType(xsd, Constants.XSD_IDREFS.getLocalPart()); addSimpleType(xsd, Constants.XSD_LANGUAGE.getLocalPart()); addSimpleType(xsd, Constants.XSD_TOKEN.getLocalPart()); //SchemaKey key = new SchemaKey(XmlSchema.SCHEMA_NS, null); //addSchema(key, xsd); // look for a system property to see whether we have a registered // extension registry class. if so we'll instantiate a new one // and set it as the extension registry //if there is an error, we'll just print out a message and move on. if (System.getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY)!= null){ try { Class clazz = Class.forName(System.getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY)); this.extReg = (ExtensionRegistry)clazz.newInstance(); } catch (ClassNotFoundException e) { System.err.println("The specified extension registry class cannot be found!"); } catch (InstantiationException e) { System.err.println("The specified extension registry class cannot be instantiated!"); } catch (IllegalAccessException e) { System.err.println("The specified extension registry class cannot be accessed!"); } } } boolean containsSchema(SchemaKey pKey) { return schemas.containsKey(pKey); } /** * gets a schema from the external namespace map * @param namespace * @return */ XmlSchema getKnownSchema(String namespace) { return (XmlSchema) knownNamespaceMap.get(namespace); } /** * Get a schema given a SchemaKey * @param pKey * @return */ XmlSchema getSchema(SchemaKey pKey) { return (XmlSchema) schemas.get(pKey); } void addSchema(SchemaKey pKey, XmlSchema pSchema) { if (schemas.containsKey(pKey)) { throw new IllegalStateException("A schema with target namespace " + pKey.getNamespace() + " and system ID " + pKey.getSystemId() + " is already present."); } schemas.put(pKey, pSchema); } private void addSimpleType(XmlSchema schema,String typeName){ XmlSchemaSimpleType type; type = new XmlSchemaSimpleType(schema); type.setName(typeName); schema.addType(type); } public XmlSchema read(Reader r, ValidationEventHandler veh) { return read(new InputSource(r), veh); } XmlSchema read(final InputSource inputSource, ValidationEventHandler veh, TargetNamespaceValidator namespaceValidator) { try { DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance(); docFac.setNamespaceAware(true); final DocumentBuilder builder = docFac.newDocumentBuilder(); Document doc = null; doc = parse_doPriv(inputSource, builder, doc); return read(doc, inputSource.getSystemId(), veh, namespaceValidator); } catch (ParserConfigurationException e) { throw new XmlSchemaException(e.getMessage()); } catch (IOException e) { throw new XmlSchemaException(e.getMessage()); } catch (SAXException e) { throw new XmlSchemaException(e.getMessage()); } } private Document parse_doPriv(final InputSource inputSource, final DocumentBuilder builder, Document doc) throws IOException, SAXException { try { doc = (Document) java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws IOException, SAXException { return builder.parse(inputSource); } } ); } catch (PrivilegedActionException e) { Exception exception = e.getException(); if(exception instanceof IOException) { throw (IOException) exception; } if(exception instanceof SAXException) { throw (SAXException) exception; } } return doc; } public XmlSchema read(InputSource inputSource, ValidationEventHandler veh) { return read(inputSource, veh, null); } public XmlSchema read(Source source, ValidationEventHandler veh) { if (source instanceof SAXSource) { return read(((SAXSource) source).getInputSource(), veh); } else if (source instanceof DOMSource) { Node node = ((DOMSource) source).getNode(); if (node instanceof Document) { node = ((Document) node).getDocumentElement(); } return read((Document) node, veh); } else if (source instanceof StreamSource) { StreamSource ss = (StreamSource) source; InputSource isource = new InputSource(ss.getSystemId()); isource.setByteStream(ss.getInputStream()); isource.setCharacterStream(ss.getReader()); isource.setPublicId(ss.getPublicId()); return read(isource, veh); } else { InputSource isource = new InputSource(source.getSystemId()); return read(isource, veh); } } public XmlSchema read(Document doc, ValidationEventHandler veh) { SchemaBuilder builder = new SchemaBuilder(this, null); return builder.build(doc, null, veh); } public XmlSchema read(Element elem) { SchemaBuilder builder = new SchemaBuilder(this, null); XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null); xmlSchema.setInputEncoding(DOMUtil.getXmlEncoding(elem.getOwnerDocument())); return xmlSchema; } public XmlSchema read(Document doc, String uri, ValidationEventHandler veh) { return read(doc, uri, veh, null); } public XmlSchema read(Document doc, String uri, ValidationEventHandler veh, TargetNamespaceValidator validator) { SchemaBuilder builder = new SchemaBuilder(this, validator); XmlSchema schema = builder.build(doc, uri, veh); schema.setInputEncoding(DOMUtil.getInputEncoding(doc)); return schema; } public XmlSchema read(Element elem, String uri) { SchemaBuilder builder = new SchemaBuilder(this, null); XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, uri); xmlSchema.setInputEncoding(DOMUtil.getInputEncoding(elem.getOwnerDocument())); return xmlSchema; } /** * Creates new XmlSchemaCollection */ public XmlSchemaCollection() { init(); } /** * Retrieve a set of XmlSchema instances with the given its system ID. * In general, this will return a single instance, or none. However, * if the schema has no targetNamespace attribute and was included * from schemata with different target namespaces, then it may * occur, that multiple schema instances with different logical * target namespaces may be returned. * @param systemId the system id for this schema * @return array of XmlSchema objects */ public XmlSchema[] getXmlSchema(String systemId) { if (systemId == null) { systemId = ""; } final List result = new ArrayList(); for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (((SchemaKey) entry.getKey()).getSystemId().equals(systemId)) { result.add(entry.getValue()); } } return (XmlSchema[]) result.toArray(new XmlSchema[result.size()]); } /** * Returns an array of all the XmlSchemas in this collection. * @return the list of XmlSchema objects */ public XmlSchema[] getXmlSchemas() { Collection c = schemas.values(); return (XmlSchema[]) c.toArray(new XmlSchema[c.size()]); } public XmlSchemaElement getElementByQName(QName qname) { String uri = qname.getNamespaceURI(); for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) { XmlSchemaElement element = ((XmlSchema) entry.getValue()).getElementByName(qname); if (element != null) { return element; } } } return null; } public XmlSchemaType getTypeByQName(QName schemaTypeName) { String uri = schemaTypeName.getNamespaceURI(); for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) { XmlSchemaType type = ((XmlSchema) entry.getValue()).getTypeByName(schemaTypeName); if (type != null) { return type; } } } return null; } Map unresolvedTypes = new HashMap(); void addUnresolvedType(QName type, TypeReceiver receiver) { ArrayList receivers = (ArrayList)unresolvedTypes.get(type); if (receivers == null) { receivers = new ArrayList(); unresolvedTypes.put(type, receivers); } receivers.add(receiver); } void resolveType(QName typeName, XmlSchemaType type) { ArrayList receivers = (ArrayList)unresolvedTypes.get(typeName); if (receivers == null) return; for (Iterator i = receivers.iterator(); i.hasNext();) { TypeReceiver receiver = (TypeReceiver) i.next(); receiver.setType(type); } unresolvedTypes.remove(typeName); } public NamespacePrefixList getNamespaceContext() { return namespaceContext; } public void setNamespaceContext(NamespacePrefixList namespaceContext) { this.namespaceContext = namespaceContext; } public void push(SchemaKey pKey){ stack.push(pKey); } public void pop(){ stack.pop(); } public boolean check(SchemaKey pKey){ return (stack.indexOf(pKey)==-1); } public String toString() { return super.toString() + "[" + schemas.toString() + "]"; } } ./src/org/apache/ws/commons/schema/constants/0000775000175000017500000000000011767656530020364 5ustar brianbrian./src/org/apache/ws/commons/schema/constants/Constants.java0000664000175000017500000001742311767656530023212 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.constants; import javax.xml.namespace.QName; /** * Constants */ public class Constants { public static final String XMLNS_URI = "http://www.w3.org/XML/1998/namespace"; public static final String XMLNS_PREFIX = "xml"; // // Schema Namespaces // public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; public static final String URI_2001_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance"; // Define qnames for the all of the XSD and SOAP-ENC encodings public static final QName XSD_STRING = new QName(URI_2001_SCHEMA_XSD, "string"); public static final QName XSD_BOOLEAN = new QName(URI_2001_SCHEMA_XSD, "boolean"); public static final QName XSD_DOUBLE = new QName(URI_2001_SCHEMA_XSD, "double"); public static final QName XSD_FLOAT = new QName(URI_2001_SCHEMA_XSD, "float"); public static final QName XSD_INT = new QName(URI_2001_SCHEMA_XSD, "int"); public static final QName XSD_INTEGER = new QName(URI_2001_SCHEMA_XSD, "integer"); public static final QName XSD_LONG = new QName(URI_2001_SCHEMA_XSD, "long"); public static final QName XSD_SHORT = new QName(URI_2001_SCHEMA_XSD, "short"); public static final QName XSD_BYTE = new QName(URI_2001_SCHEMA_XSD, "byte"); public static final QName XSD_DECIMAL = new QName(URI_2001_SCHEMA_XSD, "decimal"); public static final QName XSD_BASE64 = new QName(URI_2001_SCHEMA_XSD, "base64Binary"); public static final QName XSD_HEXBIN = new QName(URI_2001_SCHEMA_XSD, "hexBinary"); public static final QName XSD_ANYSIMPLETYPE = new QName(URI_2001_SCHEMA_XSD, "anySimpleType"); public static final QName XSD_ANYTYPE = new QName(URI_2001_SCHEMA_XSD, "anyType"); public static final QName XSD_ANY = new QName(URI_2001_SCHEMA_XSD, "any"); public static final QName XSD_QNAME = new QName(URI_2001_SCHEMA_XSD, "QName"); public static final QName XSD_DATETIME = new QName(URI_2001_SCHEMA_XSD, "dateTime"); public static final QName XSD_DATE = new QName(URI_2001_SCHEMA_XSD, "date"); public static final QName XSD_TIME = new QName(URI_2001_SCHEMA_XSD, "time"); public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString"); public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token"); public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong"); public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt"); public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort"); public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte"); public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger"); public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger"); public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger"); public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger"); public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth"); public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay"); public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear"); public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth"); public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay"); public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration"); public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name"); public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName"); public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN"); public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS"); public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION"); public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY"); public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES"); public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF"); public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS"); public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI"); public static final QName XSD_LANGUAGE = new QName(URI_2001_SCHEMA_XSD, "language"); public static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD, "ID"); public static final QName XSD_SCHEMA = new QName(URI_2001_SCHEMA_XSD, "schema"); /** * All constants that are relevant to the names of the * schema elements */ public static class BlockConstants { public static final String ALL = "all"; public static final String NONE = "none"; public static final String EXTENSION = "extension"; public static final String LIST = "list"; public static final String RESTRICTION = "restriction"; public static final String SUBSITUTION = "substitution"; public static final String UNION = "union"; public static final String EMPTY = "empty"; public static final String ELEMENT_ONLY = "elementOnly"; public static final String MIXED = "mixed"; public static final String TEXT_ONLY = "textOnly"; public static final String LAX = "lax"; public static final String SKIP = "skip"; public static final String STRICT = "strict"; public static final String OPTIONAL = "optional"; public static final String PROHIBITED = "prohibited"; public static final String REQUIRED = "required"; public static final String ERROR = "error"; public static final String WARNING = "warning"; } /** * class holding the the constants for meta data storage */ public static class MetaDataConstants{ public static final String EXTERNAL_ATTRIBUTES = "EXTERNAL_ATTRIBUTES"; public static final String EXTERNAL_ELEMENTS = "EXTERNAL_ELEMENTS"; } /** * class holding the the constants for meta data storage */ public static class SystemConstants{ public static final String EXTENSION_REGISTRY_KEY = "org.apache.ws.commons.extensions.ExtensionRegistry"; } public static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/"; public static final String XMLNS_ATTRIBUTE = "xmlns"; public static final String DEFAULT_NS_PREFIX = ""; public static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace"; public static final String XML_NS_PREFIX = "xml"; public static final String NULL_NS_URI = ""; } ./src/org/apache/ws/commons/schema/constants/Enum.java0000664000175000017500000000547211767656530022143 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.constants; public abstract class Enum { public static String NULL = "NULL"; protected Enum(String value) { setValue(value); } protected Enum() { this(NULL); } protected abstract String[] getValues(); protected String value = NULL; public void setValue(String value) { if (value.equals(Enum.NULL)) this.value = Enum.NULL; else { //the value can be a list of space seperated items String possibleValues[] = getValues(); String[] valuesToBeTested = value.split("\\s"); for (int i = 0; i < valuesToBeTested.length; i++) { for (int j = 0; j < possibleValues.length; j++) { if (possibleValues[j].equals(valuesToBeTested[i])) { break; } if (i == possibleValues.length - 1) throw new EnumValueException("Bad Enumeration value '" + value + "'"); } } //when we reach here we have tested all the values to be correct (applicable) this.value = value; } } public String getValue() { return value; } public String toString() { return value; } public boolean equals(Object what) { return what.getClass().equals(this.getClass()) && ((Enum) what).getValue().equals(this.getValue()); } public static class EnumValueException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; public EnumValueException(String mesg) { super(mesg); } } protected static final int index(String value, String values[]) { for (int i = 0; i < values.length; i++) { if (value.equals(values[i])) return i; } return -1; } } ./src/org/apache/ws/commons/schema/XmlSchemaXPath.java0000664000175000017500000000261111767656530022041 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for XML Path Language (XPath) expressions. Represents the * World Wide Web Consortium (W3C) selector element. The World Wide * Web Consortium (W3C) field element is a collection of * XmlSchemaXPath classes. */ public class XmlSchemaXPath extends XmlSchemaAnnotated { /** * Creates new XmlSchemaXPath */ public XmlSchemaXPath() { } String xpath; public String getXPath() { return xpath; } public void setXPath(String xpath) { this.xpath = xpath; } } ./src/org/apache/ws/commons/schema/XmlSchemaObjectTable.java0000664000175000017500000000403711767656530023177 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Iterator; /** * A collection class that provides read-only helpers for XmlSchemaObject * objects. This class is used to provide the collections for contained * elements that are within the schema as collections that are accessed * from the XmlSchema class (for example, Attributes, AttributeGroups, * Elements, and so on). */ public class XmlSchemaObjectTable { HashMap collection; /** * Creates new XmlSchemaObjectTable */ public XmlSchemaObjectTable() { this.collection = new HashMap(); } public int getCount() { return this.collection.size(); } public XmlSchemaObject getItem(QName name) { return (XmlSchemaObject) collection.get(name); } public Iterator getNames() { return collection.keySet().iterator(); } public Iterator getValues() { return collection.values().iterator(); } public boolean contains(QName name) { return collection.containsKey(name); } public void add(QName name, XmlSchemaObject value) { collection.put(name, value); } } ./src/org/apache/ws/commons/schema/XmlSchemaContentModel.java0000664000175000017500000000232211767656530023407 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * An abstract class for the schema content model. */ public abstract class XmlSchemaContentModel extends XmlSchemaAnnotated { /** * Creates new XmlSchemaContentModel */ protected XmlSchemaContentModel() { } public abstract void setContent(XmlSchemaContent content); public abstract XmlSchemaContent getContent(); } ./src/org/apache/ws/commons/schema/XmlSchemaMaxLengthFacet.java0000664000175000017500000000307611767656530023655 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining maxLength facets. Represents the World Wide * Web Consortium (W3C) maxLength facet. */ public class XmlSchemaMaxLengthFacet extends XmlSchemaNumericFacet { /** * Creates new XmlSchemaMaxLengthFacet */ public XmlSchemaMaxLengthFacet() { } public XmlSchemaMaxLengthFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java0000664000175000017500000000401711767656530023777 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for attribute groups. Groups a set of attribute declarations * so that they can be incorporated as a group into complex type * definitions. Represents the World Wide Web Consortium (W3C) * attributeGroup element. */ public class XmlSchemaAttributeGroup extends XmlSchemaAnnotated { /** * Creates new XmlSchemaAttributeGroup */ public XmlSchemaAttributeGroup() { attributes = new XmlSchemaObjectCollection(); } XmlSchemaAnyAttribute anyAttribute; public XmlSchemaAnyAttribute getAnyAttribute() { return this.anyAttribute; } public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } XmlSchemaObjectCollection attributes; public XmlSchemaObjectCollection getAttributes() { return this.attributes; } public void setAttributes(XmlSchemaObjectCollection attributes) { this.attributes = attributes; } QName name; public QName getName() { return this.name; } public void setName(QName name) { this.name = name; } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.java0000664000175000017500000000331411767656530023745 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for the list of simpleType elements. Defines a simpleType element * as a list of values of a specified data type. Represents the World Wide * Web Consortium (W3C) list element. */ public class XmlSchemaSimpleTypeList extends XmlSchemaSimpleTypeContent { /** * Creates new XmlSchemaSimpleTypeList */ public XmlSchemaSimpleTypeList() { } XmlSchemaSimpleType itemType; public XmlSchemaSimpleType getItemType() { return this.itemType; } public void setItemType(XmlSchemaSimpleType itemType) { this.itemType = itemType; } QName itemTypeName; public QName getItemTypeName() { return this.itemTypeName; } public void setItemTypeName(QName itemTypeName) { this.itemTypeName = itemTypeName; } } ./src/org/apache/ws/commons/schema/XmlSchemaGroupRef.java0000664000175000017500000000304711767656530022552 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class used within complex types that defines the reference to * groups defined at the schema level. Represents the World Wide * Web Consortium (W3C) group element with ref attribute. */ public class XmlSchemaGroupRef extends XmlSchemaParticle { /** * Creates new XmlSchemaGroupRef */ public XmlSchemaGroupRef() { } XmlSchemaGroupBase particle; public XmlSchemaGroupBase getParticle() { return this.particle; } QName refName; public QName getRefName() { return this.refName; } public void setRefName(QName refName) { this.refName = refName; } } ./src/org/apache/ws/commons/schema/resolver/0000775000175000017500000000000011767656530020211 5ustar brianbrian./src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java0000664000175000017500000001230411767656530024542 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.resolver; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import org.xml.sax.InputSource; /** * This resolver provides the means of resolving the imports and includes of a * given schema document. The system will call this default resolver if there * is no other resolver present in the system */ public class DefaultURIResolver implements URIResolver { /** * As for the resolver the publid ID is the target namespace of the * schema and the schemaLocation is the value of the schema location * @param namespace * @param schemaLocation * @param baseUri */ public InputSource resolveEntity(String namespace, String schemaLocation, String baseUri){ if (baseUri!=null) { try { File baseFile = new File(baseUri); if (baseFile.exists()) baseUri = baseFile.toURI().toString(); String ref = new URI(baseUri).resolve(new URI(schemaLocation)).toString(); return new InputSource(ref); } catch (URISyntaxException e1) { throw new RuntimeException(e1); } } return new InputSource(schemaLocation); } /** * Find whether a given uri is relative or not * * @param uri * @return boolean */ protected boolean isAbsolute(String uri) { return uri.startsWith("http://"); } /** * This is essentially a call to "new URL(contextURL, spec)" * with extra handling in case spec is * a file. * * @param contextURL * @param spec * @throws java.io.IOException */ protected URL getURL(URL contextURL, String spec) throws IOException { // First, fix the slashes as windows filenames may have backslashes // in them, but the URL class wont do the right thing when we later // process this URL as the contextURL. String path = spec.replace('\\', '/'); // See if we have a good URL. URL url; try { // first, try to treat spec as a full URL url = new URL(contextURL, path); // if we are deail with files in both cases, create a url // by using the directory of the context URL. if ((contextURL != null) && url.getProtocol().equals("file") && contextURL.getProtocol().equals("file")) { url = getFileURL(contextURL, path); } } catch (MalformedURLException me) { // try treating is as a file pathname url = getFileURL(contextURL, path); } // Everything is OK with this URL, although a file url constructed // above may not exist. This will be caught later when the URL is // accessed. return url; } // getURL /** * Method getFileURL * * @param contextURL * @param path * @throws IOException */ protected URL getFileURL(URL contextURL, String path) throws IOException { if (contextURL != null) { // get the parent directory of the contextURL, and append // the spec string to the end. String contextFileName = contextURL.getFile(); URL parent = null; //the logic for finding the parent file is this. //1.if the contextURI represents a file then take the parent file //of it //2. If the contextURI represents a directory, then take that as //the parent File parentFile; File contextFile = new File(contextFileName); if (contextFile.isDirectory()){ parentFile = contextFile; }else{ parentFile = contextFile.getParentFile(); } if (parentFile != null) { parent = parentFile.toURL(); } if (parent != null) { return new URL(parent, path); } } return new URL("file", "", path); } // getFileURL } ./src/org/apache/ws/commons/schema/resolver/URIResolver.java0000664000175000017500000000240711767656530023240 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema.resolver; import org.xml.sax.InputSource; public interface URIResolver { /** * Resolves an interface * @param targetNamespace * @param schemaLocation * @param baseUri */ InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri ); } ./src/org/apache/ws/commons/schema/XmlSchemaKeyref.java0000664000175000017500000000250111767656530022240 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Identifies a keyref constraint. Represents the World Wide Web * Consortium (W3C) keyref element. */ public class XmlSchemaKeyref extends XmlSchemaIdentityConstraint { /** * Creates new XmlSchemaKeyref */ public XmlSchemaKeyref() { } QName refer; public QName getRefer() { return refer; } public void setRefer(QName refer) { this.refer = refer; } } ./src/org/apache/ws/commons/schema/XmlSchema.java0000664000175000017500000004322011767656530021075 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.utils.NamespaceContextOwner; import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.w3c.dom.Document; import javax.xml.namespace.QName; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import java.io.*; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.Stack; /** * Contains the definition of a schema. All XML Schema definition language (XSD) * elements are children of the schema element. Represents the World Wide Web * Consortium (W3C) schema element */ // Oct 15th - momo - initial impl // Oct 17th - vidyanand - add SimpleType + element // Oct 18th - momo - add ComplexType // Oct 19th - vidyanand - handle external // Dec 6th - Vidyanand - changed RuntimeExceptions thrown to XmlSchemaExceptions // Jan 15th - Vidyanand - made changes to SchemaBuilder.handleElement to look for an element ref. // Feb 20th - Joni - Change the getXmlSchemaFromLocation schema // variable to name s. // Feb 21th - Joni - Port to XMLDomUtil and Tranformation. public class XmlSchema extends XmlSchemaAnnotated implements NamespaceContextOwner { private static final String UTF_8_ENCODING = "UTF-8"; static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema"; XmlSchemaForm attributeFormDefault, elementFormDefault; XmlSchemaObjectTable attributeGroups, attributes, elements, groups, notations, schemaTypes; XmlSchemaDerivationMethod blockDefault, finalDefault; XmlSchemaObjectCollection includes, items; boolean isCompiled; String syntacticalTargetNamespace, logicalTargetNamespace, version; String schema_ns_prefix = ""; XmlSchemaCollection parent; private NamespacePrefixList namespaceContext; //keep the encoding of the input private String inputEncoding; public void setInputEncoding(String encoding){ this.inputEncoding = encoding; } /** * Creates new XmlSchema * Create a new XmlSchema. The schema is not added to the parent collection, * since it has no target namespace when created through this constructor. * Call {@link XmlSchema#XmlSchema(String, XmlSchemaCollection)} instead. * * @param parent the parent XmlSchemaCollection * @deprecated */ public XmlSchema(XmlSchemaCollection parent) { this(null, null, parent); } /** * Create a schema that is not a member of a collection. */ public XmlSchema() { this(null, null, null); } /** * Create a new schema and record it as a member of a schema collection. * @param namespace the target namespace. * @param systemId the system ID for the schema. * @param parent the parent collection. */ public XmlSchema(String namespace, String systemId, XmlSchemaCollection parent) { this.parent = parent; attributeFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); elementFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); blockDefault = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); finalDefault = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); items = new XmlSchemaObjectCollection(); includes = new XmlSchemaObjectCollection(); elements = new XmlSchemaObjectTable(); attributeGroups = new XmlSchemaObjectTable(); attributes = new XmlSchemaObjectTable(); groups = new XmlSchemaObjectTable(); notations = new XmlSchemaObjectTable(); schemaTypes = new XmlSchemaObjectTable(); syntacticalTargetNamespace = logicalTargetNamespace = namespace; if (logicalTargetNamespace == null) { logicalTargetNamespace = ""; } if(parent != null) { XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(this.logicalTargetNamespace, systemId); if (parent.containsSchema(schemaKey)) { throw new XmlSchemaException("Schema name conflict in collection"); } else { parent.addSchema(schemaKey, this); } } } public XmlSchema(String namespace, XmlSchemaCollection parent) { this(namespace, namespace, parent); } public XmlSchemaForm getAttributeFormDefault() { return attributeFormDefault; } public void setAttributeFormDefault(XmlSchemaForm value) { attributeFormDefault = value; } public XmlSchemaObjectTable getAttributeGroups() { return attributeGroups; } public XmlSchemaObjectTable getAttributes() { return attributes; } public XmlSchemaDerivationMethod getBlockDefault() { return blockDefault; } public void setBlockDefault(XmlSchemaDerivationMethod blockDefault) { this.blockDefault = blockDefault; } public XmlSchemaForm getElementFormDefault() { return elementFormDefault; } public void setElementFormDefault(XmlSchemaForm elementFormDefault) { this.elementFormDefault = elementFormDefault; } public XmlSchemaObjectTable getElements() { return elements; } protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack schemaStack) { if (schemaStack != null && schemaStack.contains(this)) { // recursive schema - just return null return null; } else { XmlSchemaElement element = (XmlSchemaElement) elements .getItem(name); if (deep) { if (element == null) { // search the imports for (Iterator includedItems = includes.getIterator(); includedItems .hasNext();) { XmlSchema schema = getSchema(includedItems.next()); if (schema != null) { // create an empty stack - push the current parent in // and // use the protected method to process the schema if (schemaStack == null) { schemaStack = new Stack(); } schemaStack.push(this); element = schema.getElementByName(name, deep, schemaStack); if (element != null) { return element; } } } } else { return element; } } return element; } } /** * get an element by the name in the local schema * * @param name * @return */ public XmlSchemaElement getElementByName(String name) { QName nameToSearchFor = new QName(this.getTargetNamespace(),name); return this.getElementByName(nameToSearchFor, false, null); } /** * Look for a element by its qname. Searches through all the schemas * @param name * @return */ public XmlSchemaElement getElementByName(QName name) { return this.getElementByName(name, true, null); } /** * protected method that allows safe (non-recursive schema loading) * * @param name * @param deep * @param schemaStack * @return */ protected XmlSchemaType getTypeByName(QName name, boolean deep, Stack schemaStack) { if (schemaStack != null && schemaStack.contains(this)) { // recursive schema - just return null return null; } else { XmlSchemaType type = (XmlSchemaType) schemaTypes.getItem(name); if (deep) { if (type == null) { // search the imports for (Iterator includedItems = includes.getIterator(); includedItems .hasNext();) { XmlSchema schema = getSchema(includedItems.next()); if (schema != null) { // create an empty stack - push the current parent // use the protected method to process the schema if (schemaStack == null) { schemaStack = new Stack(); } schemaStack.push(this); type = schema .getTypeByName(name, deep, schemaStack); if (type != null) { return type; } } } } else { return type; } } return type; } } /** * Search this schema and all the imported/included ones * for the given Qname * @param name * @return */ public XmlSchemaType getTypeByName(QName name) { return getTypeByName(name, true, null); } /** * * @param name * @return */ public XmlSchemaType getTypeByName(String name) { QName nameToSearchFor = new QName(this.getTargetNamespace(),name); return getTypeByName(nameToSearchFor, false, null); } /** * Get a schema from an import * * @param includeOrImport * @return */ private XmlSchema getSchema(Object includeOrImport) { XmlSchema schema; if (includeOrImport instanceof XmlSchemaImport) { schema = ((XmlSchemaImport) includeOrImport).getSchema(); } else if (includeOrImport instanceof XmlSchemaInclude) { schema = ((XmlSchemaInclude) includeOrImport).getSchema(); } else { // skip ? schema = null; } return schema; } public XmlSchemaDerivationMethod getFinalDefault() { return finalDefault; } public void setFinalDefault(XmlSchemaDerivationMethod finalDefault) { this.finalDefault = finalDefault; } public XmlSchemaObjectTable getGroups() { return groups; } public XmlSchemaObjectCollection getIncludes() { return includes; } public boolean isCompiled() { return isCompiled; } public XmlSchemaObjectCollection getItems() { return items; } public XmlSchemaObjectTable getNotations() { return notations; } public XmlSchemaObjectTable getSchemaTypes() { return schemaTypes; } public String getTargetNamespace() { return syntacticalTargetNamespace; } public void setTargetNamespace(String targetNamespace) { if (!targetNamespace.equals("")) { syntacticalTargetNamespace = logicalTargetNamespace = targetNamespace; } } public String getVersion() { return version; } public void compile(ValidationEventHandler eh) { } /** * Serialize the schema into the given output stream * @param out - the output stream to write to */ public void write(OutputStream out) { try { if (this.inputEncoding!= null && !"".equals(this.inputEncoding)){ write(new OutputStreamWriter(out,this.inputEncoding)); }else{ //As per the XML spec the default is taken to be UTF 8 write(new OutputStreamWriter(out,UTF_8_ENCODING)); } } catch (UnsupportedEncodingException e) { //log the error and just write it without the encoding write(new OutputStreamWriter(out)); } } /** * Serialize the schema into the given output stream * @param out - the output stream to write to * @param options - a map of options */ public void write(OutputStream out, Map options) { try { if (this.inputEncoding!= null && !"".equals(this.inputEncoding)){ write(new OutputStreamWriter(out,this.inputEncoding),options); }else{ write(new OutputStreamWriter(out,UTF_8_ENCODING),options); } } catch (UnsupportedEncodingException e) { //log the error and just write it without the encoding write(new OutputStreamWriter(out)); } } /** * Serialie the schema to a given writer * @param writer - the writer to write this */ public void write(Writer writer,Map options) { serialize_internal(this, writer,options); } /** * Serialie the schema to a given writer * @param writer - the writer to write this */ public void write(Writer writer) { serialize_internal(this, writer,null); } public Document[] getAllSchemas() { try { XmlSchemaSerializer xser = new XmlSchemaSerializer(); xser.setExtReg(this.parent.getExtReg()); return xser.serializeSchema(this, true); } catch (XmlSchemaSerializer.XmlSchemaSerializerException e) { throw new XmlSchemaException(e.getMessage()); } } /** * serialize the schema - this is the method tht does to work * @param schema * @param out * @param options */ private void serialize_internal(XmlSchema schema, Writer out, Map options) { try { XmlSchemaSerializer xser = new XmlSchemaSerializer(); xser.setExtReg(this.parent.getExtReg()); Document[] serializedSchemas = xser.serializeSchema(schema, false); TransformerFactory trFac = TransformerFactory.newInstance(); try { trFac.setAttribute("indent-number", "4"); } catch (IllegalArgumentException e) { //do nothing - we'll just silently let this pass if it //was not compatible } Source source = new DOMSource(serializedSchemas[0]); Result result = new StreamResult(out); javax.xml.transform.Transformer tr = trFac.newTransformer(); //use the input encoding if there is one if (schema.inputEncoding!= null && !"".equals(schema.inputEncoding)){ tr.setOutputProperty(OutputKeys.ENCODING,schema.inputEncoding); } //let these be configured from outside if any is present //Note that one can enforce the encoding by passing the necessary //property in options if (options==null){ options = new HashMap(); loadDefaultOptions(options); } Iterator keys = options.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); tr.setOutputProperty((String)key, (String)options.get(key)); } tr.transform(source, result); out.flush(); } catch (TransformerConfigurationException e) { throw new XmlSchemaException(e.getMessage()); } catch (TransformerException e) { throw new XmlSchemaException(e.getMessage()); } catch (XmlSchemaSerializer.XmlSchemaSerializerException e) { throw new XmlSchemaException(e.getMessage()); } catch (IOException e) { throw new XmlSchemaException(e.getMessage()); } } /** * Load the default options * @param options - the map of */ private void loadDefaultOptions(Map options) { options.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); options.put(OutputKeys.INDENT, "yes"); } public void addType(XmlSchemaType type) { QName qname = type.getQName(); if (schemaTypes.contains(qname)) { throw new XmlSchemaException(" Schema for namespace '" + syntacticalTargetNamespace + "' already contains type '" + qname.getLocalPart() + "'"); } schemaTypes.add(qname, type); } public NamespacePrefixList getNamespaceContext() { return namespaceContext; } /** * Sets the schema elements namespace context. This may be used for schema * serialization, until a better mechanism was found. */ public void setNamespaceContext(NamespacePrefixList namespaceContext) { this.namespaceContext = namespaceContext; } /** * Override the equals(Object) method with equivalence checking * that is specific to this class. */ public boolean equals(Object what) { //Note: this method may no longer be required when line number/position are used correctly in XmlSchemaObject. //Currently they are simply initialized to zero, but they are used in XmlSchemaObject.equals //which can result in a false positive (e.g. if a WSDL contains 2 inlined schemas). if (what == this) { return true; } //If the inherited behaviour determines that the objects are NOT equal, return false. //Otherwise, do some further equivalence checking. if(!super.equals(what)) { return false; } if (!(what instanceof XmlSchema)) { return false; } XmlSchema xs = (XmlSchema) what; if (this.id != null) { if (!this.id.equals(xs.id)) { return false; } } else { if (xs.id != null) { return false; } } if (this.syntacticalTargetNamespace != null) { if (!this.syntacticalTargetNamespace.equals(xs.syntacticalTargetNamespace)) { return false; } } else { if (xs.syntacticalTargetNamespace != null) { return false; } } //TODO decide if further schema content should be checked for equivalence. return true; } public String getInputEncoding() { return inputEncoding; } public String toString() { return super.toString() + "[" + logicalTargetNamespace + "]"; } } ./src/org/apache/ws/commons/schema/XmlSchemaMinInclusiveFacet.java0000664000175000017500000000310711767656530024366 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for defining minInclusive facets. Represents the World Wide * Web Consortium (W3C) minInclusive facet. */ public class XmlSchemaMinInclusiveFacet extends XmlSchemaFacet { /** * Creates new XmlSchemaMinInclusive */ public XmlSchemaMinInclusiveFacet() { } public XmlSchemaMinInclusiveFacet(Object value, boolean fixed) { super(value, fixed); } public String toString(String prefix, int tab) { StringBuffer xml = new StringBuffer(); for (int i = 0; i < tab; i++) { xml.append("\t"); } xml.append("\n"); return xml.toString(); } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleContent.java0000664000175000017500000000330411767656530023601 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Class for simple types and complex types with a simple content model. * Represents the World Wide Web Consortium (W3C) simpleContent element. */ public class XmlSchemaSimpleContent extends XmlSchemaContentModel { /** * Creates new XmlSchemaSimpleContent */ public XmlSchemaSimpleContent() { } /* One of XmlSchemaSimpleContentRestriction or XmlSchemaSimpleContentExtension. */ XmlSchemaContent content; public XmlSchemaContent getContent() { return this.content; } public void setContent(XmlSchemaContent content) { this.content = content; } public String toString(String prefix, int tab) { String xml = new String(); if (!prefix.equals("") && prefix.indexOf(":") == -1) { prefix += ":"; } return xml; } } ./src/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java0000664000175000017500000000435711767656530025507 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import javax.xml.namespace.QName; /** * Class for simple types that are derived by extension. Extends the simple * type content of the element by adding attributes. Represents the World Wide * Web Consortium (W3C) extension element for simple content. */ public class XmlSchemaSimpleContentExtension extends XmlSchemaContent { /** * Creates new XmlSchemaSimpleContentExtension */ public XmlSchemaSimpleContentExtension() { attributes = new XmlSchemaObjectCollection(); } /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/ XmlSchemaAnyAttribute anyAttribute; public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) { this.anyAttribute = anyAttribute; } public XmlSchemaAnyAttribute getAnyAttribute() { return this.anyAttribute; } /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/ XmlSchemaObjectCollection attributes; public XmlSchemaObjectCollection getAttributes() { return this.attributes; } /* Name of the built-in data type, simple type, or complex type.*/ QName baseTypeName; public void setBaseTypeName(QName baseTypeName) { this.baseTypeName = baseTypeName; } public QName getBaseTypeName() { return this.baseTypeName; } } ./src/org/apache/ws/commons/schema/XmlSchemaDocumentation.java0000664000175000017500000000364611767656530023637 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; import org.w3c.dom.NodeList; /** * Class that specifies information to be read or used by humans * within an annotation. Represents the World Wide Web Consortium * (W3C) documentation element. */ public class XmlSchemaDocumentation extends XmlSchemaObject { /** * Creates new XmlSchemaDocumentation */ public XmlSchemaDocumentation() { } /** * Provides the source of the application information. */ String source; String language; /** * Returns an array of XmlNode that represents the document text markup. */ NodeList markup; public String getSource() { return source; } public void setSource(String source) { this.source = source; } public NodeList getMarkup() { return markup; } public void setMarkup(NodeList markup) { this.markup = markup; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } } ./src/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java0000664000175000017500000000216011767656530025151 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.ws.commons.schema; /** * Supports a simple iteration over a collection. This class cannot be inherited. */ public final class XmlSchemaCollectionEnumerator { /** * Creates new XmlSchemaCollectionEnumerator */ public XmlSchemaCollectionEnumerator() { } } ./src/org/apache/woden/0000775000175000017500000000000011767656530014120 5ustar brianbrian./src/org/apache/woden/wsdl20/0000775000175000017500000000000011767656530015233 5ustar brianbrian./src/org/apache/woden/wsdl20/Service.java0000664000175000017500000000506111767656530017500 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.xml.ServiceElement; /** * Represents the Service component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface Service extends WSDLComponent { /** * Returns the qualified name representing the {name} property of this Service. * * @return QName representing the name of this Service */ public QName getName(); /** * Represents the {interface} property of the Service component. This is the Interface component * that this Service defines Endpoints for. * * @return Interface associated with this Service */ public Interface getInterface(); /** * Represents the {endpoints} property of the Service component. This is the set of * Endpoints declared by this Service. The method will return an empty array if there * are no endpoints. * * @return an array of Endpoint objects */ public Endpoint[] getEndpoints(); /** * Returns the Endpoint with the specified local name from the {endpoints} * property of this Service. That is, from the set of Endpoints defined * by this Service. * If the name parameter is null, this method will return null. * * @param name the local name of the Endpoint * @return the named Endpoint */ public Endpoint getEndpoint(NCName name); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the ServiceElement that maps to this Service */ public ServiceElement toElement(); } ./src/org/apache/woden/wsdl20/InterfaceOperation.java0000664000175000017500000000630111767656530021657 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; /** * Represents the InterfaceMessageReference component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceOperation extends NestedComponent { /** * Returns the qualified name representing the {name} property of this InterfaceOperation. * * @return QName representing the name of this InterfaceOperation */ public QName getName(); /** * Returns a URI representing the {message exchange pattern} property of this * InterfaceOperation. * * @return URI of the message exchange pattern. */ public URI getMessageExchangePattern(); /** * Represents the {interface message references} property of the InterfaceOperation component. * This is the set of interface message references declared by this interface operation. * This method will return an empty array if there are no interface message references for * this interface operation. * * @return an array of InterfaceMessageReference */ public InterfaceMessageReference[] getInterfaceMessageReferences(); /** * Represents the {interface fault references} property of the InterfaceOperation component. * This is the set of interface fault references defined by this interface operation. * This method will return an empty array if there are no interface fault references for * this interface operation. * * @return an array of InterfaceFaultReference */ public InterfaceFaultReference[] getInterfaceFaultReferences(); /** * Represents the {style} property of the InterfaceOperation component. * This is a set of URIs which specify the rules that constrain the content of * input and output messages and faults of the interface operation. * This method will return an empty array if there are no style URIs. * * @return an array of URI */ public URI[] getStyle(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the InterfaceOperationElement that maps to this InterfaceOperation */ public InterfaceOperationElement toElement(); } ./src/org/apache/woden/wsdl20/InterfaceFaultReference.java0000664000175000017500000000510611767656530022613 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement; /** * Represents the InterfaceFaultReference component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceFaultReference extends NestedComponent { /** * Returns an InterfaceFault representing the {interface fault} property of this * InterfaceFaultReference. It identifies the interface fault that is associated * with the parent interface operation by this interface fault reference. * * @return an InterfaceFault associated by this InterfaceFaultReference */ public InterfaceFault getInterfaceFault(); /** * Returns an NCName representing the {message label} property of this InterfaceFaultReference. * This associates the fault with a placeholder message in the message exchange pattern * identified by the parent interface operation. * * @return an NCName representing the message label */ public NCName getMessageLabel(); /** * Returns an enumerated type, Direction, that represents the {direction} property * of this InterfaceFaultReference. This indicates the direction in which this fault * is used; 'in' or 'out'. * * @return the Direction of this fault */ public Direction getDirection(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the InterfaceFaultReferenceElement that maps to this InterfaceFaultReference */ public InterfaceFaultReferenceElement toElement(); } ./src/org/apache/woden/wsdl20/WSDLComponent.java0000664000175000017500000000735011767656530020537 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; import org.apache.woden.wsdl20.extensions.PropertyExtensible; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; /** * Represents the top-level super-type of all WSDL 2.0 Components. * Every WSDL 2.0 Component interface must extend this interface, directly or indirectly. * It provides a common way to refer to any type of WSDL Component. * It defines behaviour common to all WSDL components, such as testing for * equivalence and accessing extension properties. * * @author John Kaputin (jkaputin@apache.org) */ public interface WSDLComponent extends PropertyExtensible { /** * Tests whether this component is logically equivalent the specified component. * Equivalence is determined per spec WSDL 2.0 Part 1 Section 2.17 Equivalence * of Components. * * @param comp the WSDL component that this component will be compared to * @return true if the components are logically equivalent */ public boolean isEquivalentTo(WSDLComponent comp); /** * Tests whether this component is logically equivalent the specified component. * Equivalence is determined per spec WSDL 2.0 Part 1 Section 2.17 Equivalence * of Components. * * @param comp the WSDL component that this component will be compared to * @return true if the components are logically equivalent * @deprecated Use isEquivalentTo(WSDLComponent) * @see isEquivalentTo(WSDLComponent) */ public boolean equals(WSDLComponent comp); /** * Stores the ComponentExtensionContext object that provides access to this WSDL component's * extension properties from the specified namespace. * * @param extNamespace the namespace URI of the extension properties * @param compExtCtx the ComponentExtensionContext object for accessing the extension properties */ public void setComponentExtensionContext(URI extNamespace, ComponentExtensionContext compExtCtx); /** * Returns the ComponentExtensionContext object that provides access to this WSDL component's * extension properties from the specified namespace. * * @param extNamespace the namespace URI of the extension properties * @return the ComponentExtensionContext object for accessing the extension properties */ public ComponentExtensionContext getComponentExtensionContext(URI extNamespace); /** * Returns the fragment identifier for this WSDL 2.0 component. * * @return a FragmentIdentifier for this WSDL 2.0 component. */ public FragmentIdentifier getFragmentIdentifier(); /** * Returns a String serialisation of the fragment identifier for this WSDL 2.0 component. * * @return a String the serialisation of the fragment identifier for this WSDL 2.0 component. */ public String toString(); } ./src/org/apache/woden/wsdl20/InterfaceFault.java0000664000175000017500000000502011767656530020767 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; /** * Represents the InterfaceFault component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceFault extends NestedComponent { /** * Returns the qualified name representing the {name} property of this InterfaceFault. * * @return QName representing the name of this InterfaceFault */ public QName getName(); /** * Returns a String representing the {message content model} property of this * InterfaceFault. This specifies a token indicating the type of message content. * '#any' means any single element, '#none' means no message content, * '#other' means non-XML extension type system and '#element' means * XML Schema global element definition. * * TODO CR138 adds this property, so check Spec when its updated to ensure javadoc is accurate * * @return String representing the type of message content */ public String getMessageContentModel(); /** * Returns the ElementDeclaration representing the {element declaration} property * of this InterfaceFault. This describes the content or "payload" of the fault. * * @return the ElementDeclaration that describes the fault content. */ public ElementDeclaration getElementDeclaration(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the InterfaceFaultElement that maps to this InterfaceFault */ public InterfaceFaultElement toElement(); } ./src/org/apache/woden/wsdl20/validation/0000775000175000017500000000000011767656530017365 5ustar brianbrian./src/org/apache/woden/wsdl20/validation/WodenContext.java0000664000175000017500000000261711767656530022657 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.validation; import org.apache.woden.ErrorReporter; import org.apache.woden.resolver.URIResolver; /** * Represents a container of 'helper' objects which can be used * by Assertion implementors *

* TODO consider moving this to org.apache.woden package for general use by all Woden framework extension points (ser/deserializers, assertions, BaseCompExtCtx, ExtReg subclasses, XMLAttr impls) * * @author John Kaputin (jkaputin@apache.org) * */ public interface WodenContext { public ErrorReporter getErrorReporter(); public URIResolver getUriResolver(); } ./src/org/apache/woden/wsdl20/validation/AssertionInfo.java0000664000175000017500000000300311767656530023007 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.validation; /** * Represents an immutable object containing the information about an assertion * which is needed to perform WSDL validation. * This information consists of the Assertion object and the target Class * for the WSDL component that this assertion applies to. *

* TODO assertion dependencies to be added later. * * @author John Kaputin (jkaputin@apache.org) * */ public class AssertionInfo { public final Assertion assertion; public final Class targetClass; //TODO private List dependencies; public AssertionInfo(Assertion assertion, Class targetClass) { this.assertion = assertion; this.targetClass = targetClass; } } ./src/org/apache/woden/wsdl20/validation/Assertion.java0000664000175000017500000000373411767656530022206 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.validation; import org.apache.woden.WSDLException; /** * Represents an assertion about the WSDL document or component model. * This assertion may be defined by the WSDL 2.0 specification or by * a WSDL extension specification. * * @author John Kaputin (jkaputin@apache.org) * */ public interface Assertion { /** * Return the assertion identifier. * For example, "Description-1001". * The WSDL 2.0 specification defines assertion ids for the WSDL infoset and * component model and for the extensions defined in Part 2: Adjuncts * (wsdlx, wrpc, wsoap, whttp). * Providers of other extensions must define unique identifiers for their * assertions. * * @return the String representing the ID of this assertion. */ public String getId(); /** * Validates the specified WSDL object against this assertion. * * @param target the WSDL object that is the target of the assertion * @param wodenCtx WodenContext containing helper objects useful to * Assertion implementors */ public void validate(Object target, WodenContext wodenCtx) throws WSDLException; } ./src/org/apache/woden/wsdl20/BindingFault.java0000664000175000017500000000326511767656530020452 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.wsdl20.xml.BindingFaultElement; /** * Represents the BindingFault component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingFault extends NestedComponent { /** * Returns an InterfaceFault representing the {interface fault} property of the * BindingFault component. That is, the interface fault that this binding fault * provides concrete bindings for. * * @return an InterfaceFault bound by this BindingFault */ public InterfaceFault getInterfaceFault(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the BindingFaultElement that maps to this BindingFault */ public BindingFaultElement toElement(); } ./src/org/apache/woden/wsdl20/InterfaceMessageReference.java0000664000175000017500000000602211767656530023122 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement; /** * Represents the InterfaceMessageReference component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceMessageReference extends NestedComponent { /** * Returns an NCName representing the {message label} property of this * InterfaceMessageReference. This associates the message with a placeholder message * in the message exchange pattern specified by the parent interface operation. * * @return an NCName representing the message label */ public NCName getMessageLabel(); /** * Returns an enumerated type, Direction, that indicates the direction of this message. * Direction.IN corresponds to an input message. * Direction.OUT corresponds to an output message. * * @return the Direction of this message */ public Direction getDirection(); /** * Returns a String representing the {message content model} property of this * InterfaceMessageReference. This specifies a token indicating the type of message content. * '#any' means any single element, '#none' means no message content, * '#other' means non-XML extension type system and '#element' means * XML Schema global element definition. * * @return String representing the type of message content */ public String getMessageContentModel(); /** * Returns the ElementDeclaration representing the {element declaration} property * of this InterfaceMessageReference. This describes the content or "payload" of the message. * * @return the ElementDeclaration that describes the message content. */ public ElementDeclaration getElementDeclaration(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the InterfaceMessageReferenceElement that maps to this InterfaceMessageReference */ public InterfaceMessageReferenceElement toElement(); } ./src/org/apache/woden/wsdl20/enumeration/0000775000175000017500000000000011767656530017561 5ustar brianbrian./src/org/apache/woden/wsdl20/enumeration/MessageLabel.java0000664000175000017500000000242511767656530022753 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.enumeration; import org.apache.woden.types.NCName; /** * This class defines the values of the {message label} property of * InterfaceMessageReference and InterfaceFaultReference as used in the * WSDL 2.0 specification. Other NCName values are also valid. * @author jkaputin@apache.org, hughesj@apache.org */ public class MessageLabel { public static final NCName IN = new NCName("In"); public static final NCName OUT = new NCName("Out"); } ./src/org/apache/woden/wsdl20/enumeration/Direction.java0000664000175000017500000000427511767656530022354 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.enumeration; /** * This class defines the values of the {direction} property of * InterfaceMessageReference and InterfaceFaultReference. This property * indicates whether a message is coming "in" to the service or going "out" * from the service. *

* The property is represented in XML by the message or fault * reference element's tag name: *

    *
  • <input> and <infault> have the direction "in" - * represented by the constant IN *
  • <output> and <outfault> have the direction "out" - * represented by the constant OUT *
* This class uses the typesafe enum pattern. Applications should use the * public static final constants defined in this class to specify or to * evaluate direction. *

* Examples: *

 *     msgRef.setDirection(Direction.IN);
 *     if(msgRef.getDirection() == Direction.IN) ...
 *     if(msgRef.getDirection().equals(Direction.IN)) ...
 * 
 *     Note that == and .equals() are equivalent.
 * 
* TODO if extensibility is required, chg ctor to protected * * @author jkaputin@apache.org */ public class Direction { private final String fValue; private Direction(String value) { fValue = value; } public String toString() {return fValue;} public static final Direction IN = new Direction("in"); public static final Direction OUT = new Direction("out"); } ./src/org/apache/woden/wsdl20/Binding.java0000664000175000017500000000601111767656530017446 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.xml.BindingElement; /** * Represents the Binding component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface Binding extends WSDLComponent { /** * Returns a QName representing the {name} property of the Binding component. * * @return QName the qualified name of the Binding */ public QName getName(); /** * Represents the {interface} property of the Binding component. This is the Interface component * that this Binding defines concrete bindings for. For an 'interface-less' or 'generic' binding, * this method will return null. * * @return Interface for which bindings are provided by this Binding */ public Interface getInterface(); /** * Returns a URI representing the {type} property of the Binding component. *

* For example: *
* For a SOAP binding this will be the uri "http://www.w3.org/ns/wsdl/soap". *
* For an HTTP binding this will be the uri "http://www.w3.org/ns/wsdl/http". * * @return URI representing the binding type */ public URI getType(); /** * Represents the {binding faults} property of the Binding component. This is the set of * binding faults declared by this binding. The method will return an empty array if there * are no binding faults. * * @return an array of BindingFault objects */ public BindingFault[] getBindingFaults(); /** * Represents the {binding operations} property of the Binding component. This is the set of * binding operations declared by this binding. The method will return an empty array if there * are no binding operations. * * @return an array of BindingOperation objects */ public BindingOperation[] getBindingOperations(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the BindingElement that maps to this Binding */ public BindingElement toElement(); } ./src/org/apache/woden/wsdl20/BindingOperation.java0000664000175000017500000000515611767656530021340 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.wsdl20.xml.BindingOperationElement; /** * Represents the BindingOperation component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingOperation extends NestedComponent { /** * Returns an InterfaceOperation representing the {interface operation} property * of the BindingOperation component. That is, the interface operation that this * binding operation provides concrete bindings for. * * @return InterfaceOperation bound by this BindingOperation */ public InterfaceOperation getInterfaceOperation(); /** * Represents the {binding message references} property of the BindingOperation component. * This is the set of binding message references declared by this binding operation. * This method will return an empty array if there are no binding message references for * this binding operation. * * @return an array of BindingMessageReference */ public BindingMessageReference[] getBindingMessageReferences(); /** * Represents the {binding fault references} property of the BindingOperation component. * This is the set of binding fault references declared by this binding operation. * This method will return an empty array if there are no binding fault references for * this binding operation. * * @return an array of BindingFaultReference */ public BindingFaultReference[] getBindingFaultReferences(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the BindingOperationElement that maps to this BindingOperation */ public BindingOperationElement toElement(); } ./src/org/apache/woden/wsdl20/extensions/0000775000175000017500000000000011767656530017432 5ustar brianbrian./src/org/apache/woden/wsdl20/extensions/WSDLExtensionConstants.java0000664000175000017500000000325611767656530024646 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; import javax.xml.namespace.QName; public class WSDLExtensionConstants { // Extension namespace Strings for extensions defined by WSDL 2.0 public static final String NS_STRING_WSDL_EXTENSIONS = "http://www.w3.org/ns/wsdl-extensions".intern(); // Extension namespace URIs for extensions defined by WSDL 2.0 public static final URI NS_URI_WSDL_EXTENSIONS = URI.create(NS_STRING_WSDL_EXTENSIONS); // Extension namespace prefixes public static final String PFX_WSDLX = "wsdlx"; // Extension attribute names public static final String ATTR_SAFE = "safe"; // Extension attribute QNames public static final QName Q_ATTR_SAFE = new QName(NS_STRING_WSDL_EXTENSIONS, ATTR_SAFE, PFX_WSDLX); // Extension property names. public static final String PROP_SAFE = "safe"; } ./src/org/apache/woden/wsdl20/extensions/http/0000775000175000017500000000000011767656530020411 5ustar brianbrian./src/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensions.java0000664000175000017500000000777511767656530027307 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding Operation component * that are in the http://www.w3.org/ns/wsdl/http namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Property nameJava type
http locationorg.apache.woden.wsdl20.extensions.http.HTTPLocation
http location ignore uncitedjava.lang.Boolean
http methodjava.lang.String
http input serializationjava.lang.String
http output serializationjava.lang.String
http fault serializationjava.lang.String
http query parameter separatorjava.lang.String
http content encoding defaultjava.lang.String
*

* In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each HTTP extension property. * * @author John Kaputin (jkaputin@apache.org) * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * - added support for {http location ignore uncited} */ public interface HTTPBindingOperationExtensions extends ComponentExtensionContext { /** * @return HTTPLocation the {http location} property, represented by the whttp:location extension attribute */ public HTTPLocation getHttpLocation(); /** * @return Boolean the {http location ignore uncited} property, represented by the whttp:ignoreUncited extension attribute */ public Boolean isHttpLocationIgnoreUncited(); /** * @return String the {http method} property, represented by the whttp:method extension attribute */ public String getHttpMethod(); /** * @return String the {http input serialization} property, represented by the whttp:inputSerialization extension attribute */ public String getHttpInputSerialization(); /** * @return String the {http output serialization} property, represented by the whttp:outputSerialization extension attribute */ public String getHttpOutputSerialization(); /** * @return String the {http fault serialization} property, represented by the whttp:faultSerialization extension attribute */ public String getHttpFaultSerialization(); /** * @return String the {http query parameter separator}, represented by the whttp:queryParameterSeparator extension attribute */ public String getHttpQueryParameterSeparator(); /** * @return String the {http content encoding default}, represented by the whttp:contentEncodingDefault extension attribute */ public String getHttpContentEncodingDefault(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPEndpointExtensions.java0000664000175000017500000000405511767656530025620 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Endpoint component * that are in the http://www.w3.org/ns/wsdl/http namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

* * * * * * * * * * * * * *
Property nameJava type
http authentication schemeorg.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme
http authentication realmjava.lang.String
*

* In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each HTTP extension property. * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public interface HTTPEndpointExtensions extends ComponentExtensionContext { public HTTPAuthenticationScheme getHttpAuthenticationScheme(); public String getHttpAuthenticationRealm(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPConstants.java0000664000175000017500000001270711767656530023737 0ustar brianbrianpackage org.apache.woden.wsdl20.extensions.http; import java.net.URI; import javax.xml.namespace.QName; public class HTTPConstants { // Extension namespace public static final String NS_STRING_HTTP = "http://www.w3.org/ns/wsdl/http"; public static final URI NS_URI_HTTP = URI.create(NS_STRING_HTTP); // Extension namespace prefix public static final String PFX_WHTTP = "whttp"; // Extension element names. public static final String ELEM_HEADER = "header"; // Extension attribute names public static final String ATTR_AUTHENTICATION_REALM = "authenticationRealm"; public static final String ATTR_AUTHENTICATION_SCHEME = "authenticationScheme"; public static final String ATTR_CODE = "code"; public static final String ATTR_CONTENT_ENCODING = "contentEncoding"; public static final String ATTR_CONTENT_ENCODING_DEFAULT = "contentEncodingDefault"; public static final String ATTR_COOKIES = "cookies"; public static final String ATTR_FAULT_SERIALIZATION = "faultSerialization"; public static final String ATTR_IGNORE_UNCITED = "ignoreUncited"; public static final String ATTR_INPUT_SERIALIZATION = "inputSerialization"; public static final String ATTR_LOCATION = "location"; public static final String ATTR_METHOD = "method"; public static final String ATTR_METHOD_DEFAULT = "methodDefault"; public static final String ATTR_OUTPUT_SERIALIZATION = "outputSerialization"; public static final String ATTR_QUERY_PARAMETER_SEPARATOR = "queryParameterSeparator"; public static final String ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT = "queryParameterSeparatorDefault"; // Extension element QNames public static final QName Q_ELEM_HTTP_HEADER = new QName(NS_STRING_HTTP, ELEM_HEADER, PFX_WHTTP); // Extension attribute QNames public static final QName Q_ATTR_AUTHENTICATION_REALM = new QName(NS_STRING_HTTP, ATTR_AUTHENTICATION_REALM, PFX_WHTTP); public static final QName Q_ATTR_AUTHENTICATION_SCHEME = new QName(NS_STRING_HTTP, ATTR_AUTHENTICATION_SCHEME, PFX_WHTTP); public static final QName Q_ATTR_CODE = new QName(NS_STRING_HTTP, ATTR_CODE, PFX_WHTTP); public static final QName Q_ATTR_CONTENT_ENCODING = new QName(NS_STRING_HTTP, ATTR_CONTENT_ENCODING, PFX_WHTTP); public static final QName Q_ATTR_CONTENT_ENCODING_DEFAULT = new QName(NS_STRING_HTTP, ATTR_CONTENT_ENCODING_DEFAULT, PFX_WHTTP); public static final QName Q_ATTR_COOKIES = new QName(NS_STRING_HTTP, ATTR_COOKIES, PFX_WHTTP); public static final QName Q_ATTR_FAULT_SERIALIZATION = new QName(NS_STRING_HTTP, ATTR_FAULT_SERIALIZATION, PFX_WHTTP); public static final QName Q_ATTR_IGNORE_UNCITED = new QName(NS_STRING_HTTP, ATTR_IGNORE_UNCITED, PFX_WHTTP); public static final QName Q_ATTR_INPUT_SERIALIZATION = new QName(NS_STRING_HTTP, ATTR_INPUT_SERIALIZATION, PFX_WHTTP); public static final QName Q_ATTR_LOCATION = new QName(NS_STRING_HTTP, ATTR_LOCATION, PFX_WHTTP); public static final QName Q_ATTR_METHOD = new QName(NS_STRING_HTTP, ATTR_METHOD, PFX_WHTTP); public static final QName Q_ATTR_METHOD_DEFAULT = new QName(NS_STRING_HTTP, ATTR_METHOD_DEFAULT, PFX_WHTTP); public static final QName Q_ATTR_OUTPUT_SERIALIZATION = new QName(NS_STRING_HTTP, ATTR_OUTPUT_SERIALIZATION, PFX_WHTTP); public static final QName Q_ATTR_QUERY_PARAMETER_SEPARATOR = new QName(NS_STRING_HTTP, ATTR_QUERY_PARAMETER_SEPARATOR, PFX_WHTTP); public static final QName Q_ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT = new QName(NS_STRING_HTTP, ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT, PFX_WHTTP); // Extension property names public static final String PROP_HTTP_AUTHENTICATION_REALM = "http authentication realm"; public static final String PROP_HTTP_AUTHENTICATION_SCHEME = "http authentication scheme"; public static final String PROP_HTTP_CONTENT_ENCODING = "http content encoding"; public static final String PROP_HTTP_CONTENT_ENCODING_DEFAULT = "http content encoding default"; public static final String PROP_HTTP_COOKIES = "http cookies"; public static final String PROP_HTTP_ERROR_STATUS_CODE = "http error status code"; public static final String PROP_HTTP_FAULT_SERIALIZATION = "http fault serialization"; public static final String PROP_HTTP_HEADERS = "http headers"; public static final String PROP_HTTP_INPUT_SERIALIZATION = "http input serialization"; public static final String PROP_HTTP_LOCATION = "http location"; public static final String PROP_HTTP_LOCATION_IGNORE_UNCITED = "http location ignore uncited"; public static final String PROP_HTTP_METHOD = "http method"; public static final String PROP_HTTP_METHOD_DEFAULT = "http method default"; public static final String PROP_HTTP_OUTPUT_SERIALIZATION = "http output serialization"; public static final String PROP_HTTP_QUERY_PARAMETER_SEPARATOR = "http query parameter separator"; public static final String PROP_HTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT = "http query parameter separator default"; //{http method} constants public static final String METHOD_GET = "GET"; public static final String METHOD_POST = "POST"; public static final String METHOD_PUT = "PUT"; public static final String METHOD_DELETE = "DELETE"; //{input/output serialization} constants public static final String SERIAL_APP_URLENCODED = "application/x-www-form-urlencoded"; public static final String SERIAL_APP_XML = "application/xml"; public static final String QUERY_SEP_AMPERSAND = "&"; } ./src/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensions.java0000664000175000017500000000450211767656530030533 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding Message Reference component * that are in the http://www.w3.org/ns/wsdl/http namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

* * * * * * * * * * * * * *
Property nameJava type
http content encodingjava.lang.String
http headersorg.apache.woden.wsdl20.extensions.http.HTTPHeader[]
*

* In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each HTTP extension property. * * @author John Kaputin (jkaputin@apache.org) */ public interface HTTPBindingMessageReferenceExtensions extends ComponentExtensionContext { /** * @return String the {http content encoding} property, represented by the whttp:contentEncoding extension attribute */ public String getHttpContentEncoding(); /** * @return HTTPHeader[] the {http headers} property, represented by an array of * HTTPHeader extension components, which map to whttp:header elements. */ public HTTPHeader[] getHttpHeaders(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPHeaderElement.java0000664000175000017500000000403011767656530024453 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.extensions.AttributeExtensible; import org.apache.woden.wsdl20.extensions.ElementExtensible; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.ws.commons.schema.XmlSchemaType; /** * This interface represents the <whttp:header> extension element that * can appear within a Binding Fault or Binding Message Reference. * * @author John Kaputin (jkaputin@apache.org) */ public interface HTTPHeaderElement extends ExtensionElement, AttributeExtensible, ElementExtensible { public void setName(String name); public String getName(); public void setTypeName(QName qname); public QName getTypeName(); public XmlSchemaType getType(); public void setParentElement(WSDLElement wsdlEl); public WSDLElement getParentElement(); public void addDocumentationElement(DocumentationElement docEl); public DocumentationElement[] getDocumentationElements(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPHeader.java0000664000175000017500000000264011767656530023146 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.TypeDefinition; import org.apache.woden.wsdl20.WSDLComponent; /** * This interface represents the HTTPHeader Component that can appear in the * optional {http headers} property of the WSDL 2.0 components BindingFault * and BindingMessageReference. * * @author John Kaputin (jkaputin@apache.org) */ public interface HTTPHeader { public String getName(); public TypeDefinition getTypeDefinition(); public Boolean isRequired(); public WSDLComponent getParent(); public HTTPHeaderElement toElement(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPAuthenticationScheme.java0000664000175000017500000000345611767656530026070 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; /** * This class defines the values of the {http authentication scheme} property of * Endpoint as defined by the HTTP Binding extension. This property indicates * the HTTP authentication scheme used. * *

* The property is one of: *

    *
  • basic
  • *
  • digest
  • *

    * *

    * This class uses the typesafe enum pattern. Applications should use the public * static final constants defined in this class to specify or to evaluate the * HTTP authentication scheme. *

    * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) */ public class HTTPAuthenticationScheme { private final String fValue; private HTTPAuthenticationScheme(String value) { fValue = value; } public String toString() { return fValue; } public static final HTTPAuthenticationScheme BASIC = new HTTPAuthenticationScheme( "basic"); public static final HTTPAuthenticationScheme DIGEST = new HTTPAuthenticationScheme( "digest"); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPBindingExtensions.java0000664000175000017500000000443411767656530025413 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding component * that are in the http://www.w3.org/ns/wsdl/http namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * * * * * * * * * *
    Property nameJava type
    http method defaultjava.lang.String
    http query parameter separator defaultjava.lang.String
    http cookiesjava.lang.Boolean
    http content encoding defaultjava.lang.String
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each HTTP extension property. * * @author John Kaputin (jkaputin@apache.org) * */ public interface HTTPBindingExtensions extends ComponentExtensionContext { public String getHttpMethodDefault(); public String getHttpQueryParameterSeparatorDefault(); public Boolean isHttpCookies(); //TODO consider whether this convention is ok public String getHttpContentEncodingDefault(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensions.java0000664000175000017500000000425311767656530026406 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding Fault component * that are in the http://www.w3.org/ns/wsdl/http namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * * * * * *
    Property nameJava type
    http error status codeorg.apache.woden.wsdl20.extensions.http.HTTPErrorStatusCode
    http content encodingjava.lang.String
    http headersorg.apache.woden.wsdl20.extensions.http.HTTPHeader[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each HTTP extension property. * * @author John Kaputin (jkaputin@apache.org) */ public interface HTTPBindingFaultExtensions extends ComponentExtensionContext { public HTTPErrorStatusCode getHttpErrorStatusCode(); public String getHttpContentEncoding(); public HTTPHeader[] getHttpHeaders(); } ./src/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java0000664000175000017500000006743711767656530023545 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Vector; import org.apache.woden.types.NCName; /** * This class represents the {http location} extension property of the * BindingOperation component which maps to the whttp:location * extension attribute of the WSDL binding <operation> element, as defined by the * WSDL 2.0 HTTP binding extensions. *

    * The value of the whttp:location attribute may contain templates in which elements * from the instance data of the message to be serialized in the request IRI are cited by * enclosing their local name within curly braces. * A template can then be substituted by matching the local name against an element in the instance * data and replacing the template in the HTTP Location with the String value of that element. *

    * For example, consider the HTTP Location "temperature/{town}" and the message data element * <town>Sydney</town>. * After substitution, the formatted HTTP Location is "temperature/Sydney". Note, that the entire * template "{town}" is replaced by the matching element's value, "Sydney". *

    * If a template is not matched against the instance data, it is replaced in * the formatted HTTP Location by the empty string (in other words, it is omitted). *

    * This class has one constructor and this takes a String representing a * whttp:location value, which may contain the curly brace templates * described above. * The class can perform template substitution and return the formatted HTTP Location * resulting from such substitution. It can also return the original HTTP Location * value specified on the constructor, so that even after substitution it is possible to * see where any templates were used. *

    * This class uses the EBNF grammar defined for {http location} by the * WSDL 2.0 HTTP binding extensions to parse and validate the original HTTP Location string. * It checks that any single left and right curly braces are correctly paired to enclose a String * that is of the correct type to represent an element local name (that is, a String of type * xs:NCName). *

    * It also supports the double curly brace syntax used to represent a literal single curly brace * in the formatted HTTP Location. That is, a double curly brace escapes a literal single curly * brace to avoid mistaking it for a template. For example, "abc{{def" is formatted as "abc{def" * and this literal left brace is not interpreted as the beginning of a template. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPLocation { private String fOriginalLocation; boolean fValid = true; private List fValidatedList = null; //used for validating the HTTP location string private List fConsolidatedList = null; //used for substitution and formatting private static final String emptyString = "".intern(); private static final String questionMark = "?".intern(); private static final String leftBrace = "{".intern(); private static final String rightBrace = "}".intern(); private static final String doubleLeftBraces = "{{".intern(); private static final String doubleRightBraces = "}}".intern(); private static final String exclamatedLeftBrace = "{!".intern(); /** * Creates an HTTPLocation object to represent the specified HTTP Location String value. * This String is typically the value of the whttp:location attribute within * a binding operation element. *

    * The location template String argument must not be null. * * @param location the String value of the http location */ public HTTPLocation(String location) { fOriginalLocation = location; if(location == null) { //TODO throw NPE with suitable error message fValid = false; } else if(location.equals(emptyString)) { fValidatedList = new Vector(); fValidatedList.add(emptyString); fConsolidatedList = new Vector(); fConsolidatedList.add(emptyString); } else { List tokenizedList = tokenizeLocation(); validateTokens(tokenizedList); if(fValid) { consolidateTokens(); } } } /** * Indicates whether the original HTTP Location string used to create this object * is valid. That is, whether it can be parse according to the EBNF grammar specified * for the {http location} property by the WSDL 2.0 HTTP binding extensions. * * @return true if the format of the original HTTP location string is valid, * otherwise false. */ public boolean isLocationValid() { return fValid; } /** * Returns the original HTTP Location String specified when this object * was created. * * @return the original HTTP Location String */ public String getOriginalLocation() { return fOriginalLocation; } /** * Returns a formatted String representing the original HTTP Location modified by any * template substitution that has taken place via the substitute methods. * Templates that have not been matched against any element from the instance data * will be omitted from the formatted String. * An unmatched template is indicated by an HTTPLocationTemplate object whose value is null. *

    * If the original HTTP Location does not contain any templates then substitution * is not applicable and this method will return the same String returned by the * getOriginalLocation() method. *

    * If the HTTP Locationis invalid this method will return null. * * @return the formatted HTTP Location String, after any template substitution */ public String getFormattedLocation() { if(!fValid) { return null; } StringBuffer buffer = new StringBuffer(); Object currToken; HTTPLocationTemplate template; Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { currToken = it.next(); if(currToken instanceof HTTPLocationTemplate) { template = (HTTPLocationTemplate)currToken; String value = template.getValue(); if(value != null) { //the template is replaced in the HTTP Location by the matching element's value buffer.append(value); } } else { buffer.append(currToken); } } return buffer.toString(); } /** * Same behaviour as getFormattedLocation() * * @return the formatted HTTP Location String, after any template substitution */ public String toString() { return getFormattedLocation(); } /** * Return the templates that appear in the HTTP Location string in * the order they appear. * If the HTTP Location contains no templates or if it is * invalid this method will return an empty array. * * @return an array of HTTPLocationTemplate objects */ public HTTPLocationTemplate[] getTemplates() { List templates = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { templates.add(next); } } } HTTPLocationTemplate[] array = new HTTPLocationTemplate[templates.size()]; templates.toArray(array); return array; } /** * Return the templates that appear in the URI Path portion of the HTTP Location * string in the order they appear. * This is the portion before the first occurrence of '?'. * If the HTTP Location contains no templates in the Path or if it is * invalid this method will return an empty array. * * @return an array of HTTPLocationTemplate objects */ public HTTPLocationTemplate[] getTemplatesInPath() { List templates = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { HTTPLocationTemplate template = (HTTPLocationTemplate)next; if(!template.isQuery()) { templates.add(next); } } } } HTTPLocationTemplate[] array = new HTTPLocationTemplate[templates.size()]; templates.toArray(array); return array; } /** * Return templates that appear in the URI Query portion of the HTTP Location * string in the order they appear. * This is the portion after the first occurrence of '?'. * If the HTTP Location contains no templates in the Query or if it is * invalid this method will return an empty array. * * @return an array of HTTPLocationTemplate objects */ public HTTPLocationTemplate[] getTemplatesInQuery() { List templates = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { HTTPLocationTemplate template = (HTTPLocationTemplate)next; if(template.isQuery()) { templates.add(next); } } } } HTTPLocationTemplate[] array = new HTTPLocationTemplate[templates.size()]; templates.toArray(array); return array; } /** * Return the names of the templates that appear in the HTTP Location string * in the order they appear. * If the HTTP Location contains no templates or if it is * invalid this method will return an empty array. * * @return a String array of template names */ public String[] getTemplateNames() { List names = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { HTTPLocationTemplate template = (HTTPLocationTemplate)next; names.add(template.getName()); } } } String[] array = new String[names.size()]; names.toArray(array); return array; } /** * Return the names of the templates that appear in the URI Path portion of the * HTTP Location string in the order they appear. * This is the portion before the first occurrence of '?'. * If the HTTP Location contains no templates in the Path or if it is * invalid this method will return an empty array. * * @return a String array of template names */ public String[] getTemplateNamesInPath() { List names = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { HTTPLocationTemplate template = (HTTPLocationTemplate)next; if(!template.isQuery()) { names.add(template.getName()); } } } } String[] array = new String[names.size()]; names.toArray(array); return array; } /** * Return the names of the templates that appear in the URI Query portion of the * HTTP Location string in the order they appear. * This is the portion after the first occurrence of '?'. * If the HTTP Location contains no templates in the Query or if it is * invalid this method will return an empty array. * * @return a String array of template names */ public String[] getTemplateNamesInQuery() { List names = new Vector(); if(fValid) { Iterator it = fConsolidatedList.iterator(); while(it.hasNext()) { Object next = it.next(); if(next instanceof HTTPLocationTemplate) { HTTPLocationTemplate template = (HTTPLocationTemplate)next; if(template.isQuery()) { names.add(template.getName()); } } } } String[] array = new String[names.size()]; names.toArray(array); return array; } /** * Return the first template with the specified name from the HTTP Location string * or null if no such template is exists. *

    * If the HTTP Location is invalid this method will return null. * * @return an HTTPLocationTemplate with the specified name */ public HTTPLocationTemplate getTemplate(String name) { if(!fValid) { return null; } HTTPLocationTemplate namedTemplate = null; if(name != null) { HTTPLocationTemplate[] templates = getTemplates(); for(int i=0; i * If the HTTP Location is invalid this method will return null. * * @return an HTTPLocationTemplate with the specified name */ public HTTPLocationTemplate getTemplateInPath(String name) { if(!fValid) { return null; } HTTPLocationTemplate namedTemplate = null; if(name != null) { HTTPLocationTemplate[] templates = getTemplatesInPath(); for(int i=0; i * If the HTTP Location is invalid this method will return null. * * @return an HTTPLocationTemplate with the specified name */ public HTTPLocationTemplate getTemplateInQuery(String name) { if(!fValid) { return null; } HTTPLocationTemplate namedTemplate = null; if(name != null) { HTTPLocationTemplate[] templates = getTemplatesInQuery(); for(int i=0; i 0) { tokens.add(buffer.toString()); buffer = new StringBuffer(); } questionMarkFound = true; tokens.add(questionMark); } else if(currChar == '{') { if(buffer.length() > 0) { tokens.add(buffer.toString()); buffer = new StringBuffer(); } if(i < lastPos && fOriginalLocation.charAt(i+1) == '{') { tokens.add(doubleLeftBraces); i++; //move scan position to the 2nd left curly brace } else if(i < lastPos && fOriginalLocation.charAt(i+1) == '!') { tokens.add(exclamatedLeftBrace); i++; //move scan position to the exclamation mark } else { tokens.add(leftBrace); } } else if(currChar == '}') { if(buffer.length() > 0) { tokens.add(buffer.toString()); buffer = new StringBuffer(); } if(i < lastPos && fOriginalLocation.charAt(i+1) == '}') { tokens.add(doubleRightBraces); i++; //move scan position to the 2nd right curly brace } else { tokens.add(rightBrace); } } else { buffer.append(currChar); } } if(buffer.length() > 0) { tokens.add(buffer.toString()); } return tokens; } /* * The EBNF grammar defined for HTTP Location in WSDL 2.0 spec Part2 Section 6.8.1.1 is: * * httpLocation ::= charData? (( openBrace | closeBrace | template ) charData?)* * charData ::= [^{}]* * openBrace ::= '{{' * closeBrace ::= '}}' * template ::= rawTemplate | encodedTemplate * rawTemplate ::= '{!' NCName '}' * encodedTemplate ::= '{' NCName '}' * * The input to this method is an ordered list consisting of the following tokens parsed * from the original HTTP Location string: '{{', '}}', '{!', '{', '}', first occurrence of ?, * any other string. * * This method will validate these tokens according to the EBNF grammar above. That is, * it will do the following checks in order against each token, stopping and moving on * to the next token if any check is satisfied: * 1) check for a '?' indicating the start of the URI Query string * 2) check for the openBrace '{{' * 3) check for the closeBrace '}}' * 4) check for a rawTemplate, based on the sequence of tokens '{!', NCName, '}' * 5) check for an encodedTemplate, based on the sequence of tokens '{', NCName, '}' * 6) check that any remaining string is valid charData (has no curly braces). * * Encoded templates have a matching pairs of left and right curly braces "{...}". * Raw templates have an exclamated left brace and a right brace "{!...}". * The NCName string in a raw or encoded template must be of type xs:NCName * (that is, xs:NCName is the type defined for the local name of an XML element). * * Valid tokens will be copied to a 'validated' list. The tokens comprising any raw or encoded * templates identified at steps 3) or 4) will be replaced in this new list by * HTTPLocationTemplate objects. * * If an error is found, the HTTP Location will be flagged as invalid and no formatted location * or templates will be available. */ private void validateTokens(List tokenizedList) { List tokens = new Vector(); Object currToken; String nextToken; Object nextNextToken; int size = tokenizedList.size(); ListIterator it = tokenizedList.listIterator(); boolean isQuery = false; while(fValid && it.hasNext()) { currToken = it.next(); int currIndex = it.previousIndex(); if(currToken == questionMark) { // 1) check for a '?' indicating the start of the URI Query string isQuery = true; tokens.add(questionMark); } else if(currToken == doubleLeftBraces || currToken == doubleRightBraces) { // 2) check for the openBrace '{{' // 3) check for the closeBrace '}}' tokens.add(currToken); } else if(currToken == leftBrace || currToken == exclamatedLeftBrace) { // 4) check for a rawTemplate, based on the sequence of tokens '{!', NCName, '}' // 5) check for an encodedTemplate, based on the sequence of tokens '{', NCName, '}' if(size-currIndex < 3) { fValid = false; //this token is not followed by two further tokens } else { nextToken = (String)it.next(); nextNextToken = it.next(); if(NCName.isValid(nextToken) && nextNextToken == rightBrace) { boolean isEncoded = (currToken == leftBrace); HTTPLocationTemplate template = new HTTPLocationTemplate(nextToken, isEncoded, isQuery); tokens.add(template); } else { fValid = false; //we don't have a valid template } } } else { // 6) check that any other type of token is valid charData (has no curly braces). String s = (String)currToken; int index = s.indexOf(leftBrace); if(index < 0) { index = s.indexOf(rightBrace); } if(index >= 0) { fValid = false; //contains unmatched curly braces } else { tokens.add(currToken); } } } //end while loop if(fValid) { fValidatedList = tokens; } } /* * Consolidate the validated tokens parsed from the HTTP Location string, into a list containing * only HTTPLocationTemplate objects, literal single braces or Strings representing any other * HTTP Location content. This consolidated list will be used for template substitution * and for producing an external representation of the HTTP Location string, formatted with the * substituted values. * Note, any double curly braces will be replaced by a literal single brace. */ private void consolidateTokens() { StringBuffer buffer = new StringBuffer(); Object currToken; List tokens = new Vector(); Iterator it = fValidatedList.iterator(); while(it.hasNext()) { currToken = it.next(); if(currToken instanceof HTTPLocationTemplate) { //Output any previously concatentated string content then output this template's value. if(buffer.length() > 0) { tokens.add(buffer.toString()); buffer = new StringBuffer(); } tokens.add(currToken); } else if(currToken == doubleLeftBraces) { buffer.append(leftBrace); } else if(currToken == doubleRightBraces) { buffer.append(rightBrace); } else { //concatentate this token to previous string content buffer.append(currToken); } } if(buffer.length() > 0) { tokens.add(buffer.toString()); } fConsolidatedList = tokens; } } ./src/org/apache/woden/wsdl20/extensions/http/HTTPLocationTemplate.java0000664000175000017500000001260411767656530025223 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; /** * This class represents a template specified within the HTTP Location string used as the value * of the whttp:location extension attribute. The template cites an element from * the instance data of the message to be serialized in the request IRI by enclosing the element's * local name in curly braces. The template is then matched against an element in the instance * data and replaced in the HTTP Location string by that element's String value. *

    * For example, the template "{postcode}" is matched to the instance data element * <postcode>90210</postcode> and the String value "90210" replaces "{postcode}" * in the formatted HTTP Location string. *

    * The WSDL 2.0 HTTP binding extension requires certain encoding be performed on the content of * the HTTP Location string. Templates of the form "{localname}" are called encoded * templates because these encoding rules also apply to any element values substituted * for these templates. A raw template is used to indicate that encoding is not to * be performed on the substituted value. Raw templates are identified by the exclamated curly * brace syntax "{!localname}". *

    * A template that appears in the HTTP Location String before the first occurrence of '?' is * in the URI Path portion of the HTTP Location. One that appears after the first occurrence of * '?' is in the URI Query portion. *

    * This class has a single constructor which takes three parameters that indicate the local name * of the element cited in the template, whether the template is encoded and whether it appears * in the Query portion of the HTTP Location. *

    * The class has the following characteristics: *

      *
    • * It returns the element local name cited by the template. *
    • *
    • * It does not permit the cited element name to be modified. *
    • *
    • * It accepts a String value for the element cited by the template. *
    • *
    • * It differentiates an encoded template from a raw template. *
    • *
    • * It differentiates a template that appears in the Path from one that appears in the Query. *
    • *
    * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPLocationTemplate { private String fName; private String fValue = null; private boolean fIsEncoded; private boolean fIsQuery; /** * Creates an HTTP Location template that cites the specified element. The three parameters must * be specified, they cannot be null. * * @param name a String representing the local name of the element cited by this template. * @param isEncoded a boolean value 'true' if it is an encoded template or 'false' if it is a * raw template. * @param isQuery a boolean value 'true' if the template appears in the URI Query portion of the * HTTP Location string or 'false' if it appears in the URI Path. * So 'true' means it appears after first occurrence of '?'. */ public HTTPLocationTemplate(String name, boolean isEncoded, boolean isQuery) { //TODO - check syntax, not null, not empty string...throw IllegalArgExc fName = name; fIsEncoded = isEncoded; fIsQuery = isQuery; } /** * Returns a String representing the local name of the element cited by this template. */ public String getName() { return fName; } /** * Returns a String representing the value of the element cited by this template. */ public String getValue() { return fValue; } /** * Sets the String value of the element cited by this template. This is the String * substituted for the template in the formatted HTTP Location string. * * @param value the cited element's String value */ public void setValue(String value) { fValue = value; } /** * Returns 'true' if the template is encoded, otherwise 'false'. * That is, 'true' if it is of the form "{localname}". * So, 'false' indicates a 'raw' template of the form "{!localname}". */ public boolean isEncoded() { return fIsEncoded; } /** * Returns 'true' if the template appears in the URI Query portion of the HTTP Location string, * otherwise false. That is, 'true' if it appears after the first occurrence of '?'. * So, 'false' indicates a template that appears in the URI Path portion of the HTTP Location * string. */ public boolean isQuery() { return fIsQuery; } } ./src/org/apache/woden/wsdl20/extensions/http/HTTPErrorStatusCode.java0000664000175000017500000000402511767656530025045 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.http; /** * This class represents the {http error status code} property that forms part of the * HTTP extensions to the WSDL BindingFault component. * This property may contain either an integer representing the error status code used * with this fault or the xs:token #any indicating that no claim is made by the service * about the use of error status codes. *

    * It provides methods to query whether the property specifies an error status code * (i.e. an integer) and to retrieve the property value. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPErrorStatusCode { private final String fToken; private final Integer fCode; public static final HTTPErrorStatusCode ANY = new HTTPErrorStatusCode("#any"); private HTTPErrorStatusCode(String token) { fToken = token; fCode = null; } public HTTPErrorStatusCode(Integer errorStatusCode) { fToken = null; fCode = errorStatusCode; } public boolean isCodeUsed() {return fCode != null;} public Integer getCode() {return fCode;} public String toString() {return isCodeUsed() ? fCode.toString() : fToken;} } ./src/org/apache/woden/wsdl20/extensions/UnknownExtensionSerializer.java0000664000175000017500000000370511767656530025670 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.io.PrintWriter; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; //TODO remove internals from the API: import org.apache.woden.internal.util.dom.DOM2Writer; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This class is used to serialize UnknownExtensionElement instances * into the PrintWriter. *

    * Copied from WSDL4J. * * @see UnknownExtensionElement * @see UnknownExtensionDeserializer * * @author Matthew J. Duftler (duftler@us.ibm.com) */ public class UnknownExtensionSerializer implements ExtensionSerializer { public void marshall(Class parentType, QName elementType, ExtensionElement extension, PrintWriter pw, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException { // UnknownExtensionElement unknownExt = // (UnknownExtensionElement)extension; pw.print(" "); //TODO remove internals from the API: DOM2Writer.serializeAsXML(unknownExt.getElement(), pw); pw.println(); } }./src/org/apache/woden/wsdl20/extensions/ElementExtensible.java0000664000175000017500000000300111767656530023703 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; import javax.xml.namespace.QName; /** * This interface represents elements that may contain extension elements. * * @author jkaputin@apache.org */ public interface ElementExtensible { public void addExtensionElement(ExtensionElement extEl); public void removeExtensionElement(ExtensionElement extEl); public ExtensionElement[] getExtensionElements(); public ExtensionElement[] getExtensionElementsOfType(QName extType); /** * Return true if the implementor has extension elements belonging to this namespace, * otherwise false. */ public boolean hasExtensionElementsForNamespace(URI namespace); } ./src/org/apache/woden/wsdl20/extensions/soap/0000775000175000017500000000000011767656530020374 5ustar brianbrian./src/org/apache/woden/wsdl20/extensions/soap/SOAPHeaderBlockElement.java0000664000175000017500000000543511767656530025406 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.extensions.AttributeExtensible; import org.apache.woden.wsdl20.extensions.ElementExtensible; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.ws.commons.schema.XmlSchemaElement; /** * This interface represents the <wsoap:header> extension element that * can appear within a Binding Fault or Binding Message Reference. * * @author jkaputin@apache.org */ public interface SOAPHeaderBlockElement extends ExtensionElement, AttributeExtensible, ElementExtensible { /** * Set the QName that identifies the Schema element declaration * relating to this soap header. * * @param qname the QName that identifies a Schema element declaration */ public void setElementName(QName qname); public QName getElementName(); /** * Returns the Schema element declaration identified by the QName in the 'element' * attribute of the <wsoap:header> element. * If this QName does not resolve to an element declaration in a schema that is visible * to the containing WSDL description, null will be returned by this method. * To be visible, the Schema must have been correctly imported or inlined within * the <types> element. * * @return the XmlSchemaElement identified by the 'element' attribute */ public XmlSchemaElement getElement(); public void setMustUnderstand(Boolean understood); public Boolean mustUnderstand(); public void setParentElement(WSDLElement wsdlEl); public WSDLElement getParentElement(); public void addDocumentationElement(DocumentationElement docEl); public DocumentationElement[] getDocumentationElements(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPEndpointExtensions.java0000664000175000017500000000631311767656530025565 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme; /** * There are no WSDL 2.0 SOAP extension properties (from the namespace * http://www.w3.org/ns/wsdl/soap) attached to the Endpoint component. *

    * The purpose of this interface is to maintain consistency across the * WSDL 2.0 SOAP extensions in Woden, which define accessor methods for the * HTTP properties that are added to WSDL 2.0 components, along with * the SOAP properties, when a SOAP binding specifies HTTP as the underlying * protocol. *

    * For this interface, the generic ExtensionProperty accessor methods, * getProperties and getProperty, return null * (because they only apply to SOAP extension properties, which are not present * for the Endpoint component). *

    * This interface defines additional extension-specific accessor methods for the * HTTP extension properties that are added to the Endpoint component by a SOAP binding * when the underlying protocol is HTTP. *

    * These are: *

      *
    • {http authentication scheme}
    • *
    • {http authentication realm}
    • *
    *

    * TODO Re HTTP methods, consider WODEN-158 which proposes keeping extension interfaces namespace-specific, not binding-type-specific * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public interface SOAPEndpointExtensions extends ComponentExtensionContext { /** * If the SOAP binding specifies HTTP as the underlying protocol, the * {http authentication scheme} property is added to the Endpoint component * and it will be returned by this method. * If the underlying protocol is not HTTP, this method will return null. * * @return the HTTPAuthenticationScheme if present, otherwise null */ public HTTPAuthenticationScheme getHttpAuthenticationScheme(); /** * If the SOAP binding specifies HTTP as the underlying protocol, the * {http authentication realm} property is added to the Endpoint component * and it will be returned by this method. * If the underlying protocol is not HTTP, this method will return null. * * @return a String representing the {http authentication realm} property if present, otherwise null. */ public String getHttpAuthenticationRealm(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPFaultSubcodes.java0000664000175000017500000000412011767656530024462 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import javax.xml.namespace.QName; /** * This class represents the {soap fault subcodes} property that forms part of the * SOAP extensions to the WSDL BindingFault component. * This property may contain either a list of QNames representing the subcodes or * the xs:token #any. *

    * This class will restrict the possible values to a collection of QNames or the string "#any". * It provides methods to query whether the property contains QNames or a token and * methods to retrieve the property value of the appropriate type. * * @author jkaputin@apache.org */ public class SOAPFaultSubcodes { private final String fToken; private final QName[] fSubcodeQNs; public static final SOAPFaultSubcodes ANY = new SOAPFaultSubcodes("#any"); private SOAPFaultSubcodes(String token) { fToken = token; fSubcodeQNs = new QName[0]; } public SOAPFaultSubcodes(QName[] subcodeQNs) { fToken = null; fSubcodeQNs = subcodeQNs; } public boolean isQNames() {return fSubcodeQNs.length > 0;} public boolean isToken() {return fToken != null;} public QName[] getQNames() {return fSubcodeQNs;} public String getToken() {return fToken;} } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensions.java0000664000175000017500000000561311767656530030505 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; /** * Provides access to the extension properties of the Binding Message Reference component * that are in the http://www.w3.org/ns/wsdl/soap namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * *
    Property nameJava type
    soap modulesorg.apache.woden.wsdl20.extensions.soap.SOAPModule[]
    soap headersorg.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each SOAP extension property. * It also provides accessor methods for some additional HTTP extension properties * that are present in a SOAP binding when the underlying protocol is HTTP. *

    * These are: *

      *
    • {http content encoding}
    • *
    • {http headers}
    • *
    *

    * TODO Re HTTP methods, consider WODEN-158 which proposes keeping extension interfaces namespace-specific, not binding-type-specific * * @author John Kaputin (jkaputin@apache.org) */ public interface SOAPBindingMessageReferenceExtensions extends ComponentExtensionContext { public SOAPModule[] getSoapModules(); public SOAPHeaderBlock[] getSoapHeaders(); /** * @return String the {http content encoding} property, represented by the whttp:contentEncoding extension attribute */ public String getHttpContentEncoding(); /** * @return HTTPHeader[] the {http headers} property, represented by an array of * HTTPHeader extension components, which map to whttp:header elements. */ public HTTPHeader[] getHttpHeaders(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPModule.java0000664000175000017500000000255511767656530023156 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.wsdl20.WSDLComponent; /** * This interface represents the SOAPModule Component that can appear in the * optional {soap modules} property of the WSDL 2.0 components Binding, BindingFault, * BindingOperation, BindingFaultReference or BindingMessageReference. * * @author jkaputin@apache.org */ public interface SOAPModule { public URI getRef(); public Boolean isRequired(); public WSDLComponent getParent(); public SOAPModuleElement toElement(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPHeaderBlock.java0000664000175000017500000000266411767656530024075 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.WSDLComponent; /** * This interface represents the SOAPHeaderBlock Component that can appear in the * optional {soap headers} property of the WSDL 2.0 components BindingFault * and BindingMessageReference. * * @author jkaputin@apache.org */ public interface SOAPHeaderBlock { public ElementDeclaration getElementDeclaration(); public Boolean mustUnderstand(); public Boolean isRequired(); public WSDLComponent getParent(); public SOAPHeaderBlockElement toElement(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPFaultCode.java0000664000175000017500000000376411767656530023602 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import javax.xml.namespace.QName; /** * This class represents the {soap fault code} property that forms part of the * SOAP extensions to the WSDL BindingFault component. * This property may contain either a QName representing the code or the xs:token #any. *

    * This class will restrict the possible values to a QName reference or the string "#any". * It provides methods to query whether the property contains a QName or a token and * methods to retrieve the property value of the appropriate type. * * @author jkaputin@apache.org */ public class SOAPFaultCode { private final String fToken; private final QName fCodeQN; public static final SOAPFaultCode ANY = new SOAPFaultCode("#any"); private SOAPFaultCode(String token) { fToken = token; fCodeQN = null; } public SOAPFaultCode(QName codeQN) { fToken = null; fCodeQN = codeQN; } public boolean isQName() {return fCodeQN != null;} public boolean isToken() {return fToken != null;} public QName getQName() {return fCodeQN;} public String getToken() {return fToken;} } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPConstants.java0000664000175000017500000001003311767656530023673 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import java.net.URI; import javax.xml.namespace.QName; public class SOAPConstants { // Extension namespace public static final String NS_STRING_SOAP = "http://www.w3.org/ns/wsdl/soap"; public static final URI NS_URI_SOAP = URI.create(NS_STRING_SOAP); // Extension namespace prefix public static final String PFX_WSOAP = "wsoap"; // Extension element names. public static final String ELEM_HEADER = "header"; public static final String ELEM_MODULE = "module"; // Extension attribute names public static final String ATTR_ACTION = "action"; public static final String ATTR_CODE = "code"; public static final String ATTR_MEP = "mep"; public static final String ATTR_MEPDEFAULT = "mepDefault"; public static final String ATTR_MUSTUNDERSTAND = "mustUnderstand"; public static final String ATTR_PROTOCOL = "protocol"; public static final String ATTR_SUBCODES = "subcodes"; public static final String ATTR_VERSION = "version"; // Extension element QNames public static final QName Q_ELEM_SOAP_HEADER = new QName(NS_STRING_SOAP, ELEM_HEADER, PFX_WSOAP); public static final QName Q_ELEM_SOAP_MODULE = new QName(NS_STRING_SOAP, ELEM_MODULE, PFX_WSOAP); // Extension attribute QNames public static final QName Q_ATTR_SOAP_ACTION = new QName(NS_STRING_SOAP, ATTR_ACTION, PFX_WSOAP); public static final QName Q_ATTR_SOAP_CODE = new QName(NS_STRING_SOAP, ATTR_CODE, PFX_WSOAP); public static final QName Q_ATTR_SOAP_MEP = new QName(NS_STRING_SOAP, ATTR_MEP, PFX_WSOAP); public static final QName Q_ATTR_SOAP_MEPDEFAULT = new QName(NS_STRING_SOAP, ATTR_MEPDEFAULT, PFX_WSOAP); public static final QName Q_ATTR_SOAP_PROTOCOL = new QName(NS_STRING_SOAP, ATTR_PROTOCOL, PFX_WSOAP); public static final QName Q_ATTR_SOAP_SUBCODES = new QName(NS_STRING_SOAP, ATTR_SUBCODES, PFX_WSOAP); public static final QName Q_ATTR_SOAP_VERSION = new QName(NS_STRING_SOAP, ATTR_VERSION, PFX_WSOAP); // Extension property names public static final String PROP_SOAP_ACTION = "soap action"; public static final String PROP_SOAP_FAULT_CODE = "soap fault code"; public static final String PROP_SOAP_FAULT_SUBCODES = "soap fault subcodes"; public static final String PROP_SOAP_HEADERS = "soap headers"; public static final String PROP_SOAP_MEP = "soap mep"; public static final String PROP_SOAP_MEP_DEFAULT = "soap mep default"; public static final String PROP_SOAP_MODULES = "soap modules"; public static final String PROP_SOAP_UNDERLYING_PROTOCOL = "soap underlying protocol"; public static final String PROP_SOAP_VERSION = "soap version"; // Protocol values public static final String PROTOCOL_STRING_SOAP11_HTTP = "http://www.w3.org/2006/01/soap11/bindings/HTTP/"; public static final String PROTOCOL_STRING_SOAP12_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/"; public static final URI PROTOCOL_URI_SOAP11_HTTP = URI.create(PROTOCOL_STRING_SOAP11_HTTP); public static final URI PROTOCOL_URI_SOAP12_HTTP = URI.create(PROTOCOL_STRING_SOAP12_HTTP); // Version values public static final String VERSION_1_1 = "1.1"; public static final String VERSION_1_2 = "1.2"; } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java0000664000175000017500000001001711767656530027234 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; import org.apache.woden.wsdl20.extensions.http.HTTPLocation; /** * Provides access to the extension properties of the Binding Operation component * that are in the http://www.w3.org/ns/wsdl/soap namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * * * * *
    Property nameJava type
    soap mepjava.net.URI
    soap actionjava.net.URI
    soap modulesorg.apache.woden.wsdl20.extensions.soap.SOAPModule[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each SOAP extension property. * It also provides accessor methods for some additional HTTP extension properties * that are present in a SOAP binding when the underlying protocol is HTTP. *

    * These are: *

      *
    • {http location}
    • *
    • {http query parameter separator}
    • *
    • {http content encoding default}
    • *
    *

    * TODO Re HTTP methods, consider WODEN-158 which proposes keeping extension interfaces namespace-specific, not binding-type-specific * * @author John Kaputin (jkaputin@apache.org) */ public interface SOAPBindingOperationExtensions extends ComponentExtensionContext { /** * Returns an object representing the {soap mep} property, of type xs:anyURI. */ public URI getSoapMep(); /** * Returns an object representing the {soap action} property, of type xs:anyURI. */ public URI getSoapAction(); /** * Returns an array representing the {soap modules} property, of type wsoap:module. */ public SOAPModule[] getSoapModules(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http location} extension property represented by the * whttp:location extension attribute , otherwise null. * * @return HTTPLocation the {http location} extension property */ public HTTPLocation getHttpLocation(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http query parameter separator} extension property represented by the * whttp:queryParameterSeparator extension attribute , otherwise null. * * @return String the {http query parameter separator} extension property */ public String getHttpQueryParameterSeparator(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http content encoding default} extension property represented by the * whttp:contentEncodingDefault extension attribute , otherwise null. * * @return String the {http content encoding default} extension property */ public String getHttpContentEncodingDefault(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPModuleElement.java0000664000175000017500000000357311767656530024471 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.wsdl20.extensions.AttributeExtensible; import org.apache.woden.wsdl20.extensions.ElementExtensible; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This interface represents the <wsoap:module> extension element that * can appear within a Binding, Binding Fault, Binding Operation, Binding * Fault Reference or Binding Message Reference. * * @author jkaputin@apache.org */ public interface SOAPModuleElement extends ExtensionElement, AttributeExtensible, ElementExtensible { public void setRef(URI uri); public URI getRef(); public void setParentElement(WSDLElement wsdlEl); public WSDLElement getParentElement(); public void addDocumentationElement(DocumentationElement docEl); public DocumentationElement[] getDocumentationElements(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingFaultReferenceExtensions.java0000664000175000017500000000357611767656530030202 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding Fault Reference component * that are in the http://www.w3.org/ns/wsdl/soap namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * *
    Property nameJava type
    soap modulesorg.apache.woden.wsdl20.extensions.soap.SOAPModule[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each SOAP extension property. * * @author John Kaputin (jkaputin@apache.org) */ public interface SOAPBindingFaultReferenceExtensions extends ComponentExtensionContext { public SOAPModule[] getSoapModules(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingFaultExtensions.java0000664000175000017500000000630611767656530026355 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; /** * Provides access to the extension properties of the Binding Fault component * that are in the http://www.w3.org/ns/wsdl/soap namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * * * * * * * * * *
    Property nameJava type
    soap fault codeorg.apache.woden.wsdl20.extensions.soap.SOAPFaultCode
    soap fault subcodesorg.apache.woden.wsdl20.extensions.soap.SOAPFaultSubcodes
    soap modulesorg.apache.woden.wsdl20.extensions.soap.SOAPModule[]
    soap headersorg.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each SOAP extension property. * It also provides accessor methods for some additional HTTP extension properties * that are present in a SOAP binding when the underlying protocol is HTTP. *

    * These are: *

      *
    • {http content encoding}
    • *
    • {http headers}
    • *
    *

    * TODO Re HTTP methods, consider WODEN-158 which proposes keeping extension interfaces namespace-specific, not binding-type-specific * * @author John Kaputin (jkaputin@apache.org) */ public interface SOAPBindingFaultExtensions extends ComponentExtensionContext { /** * Returns an object representing the {soap fault code} property, which may * contain either an xs:QName or the xs:token "#any". */ public SOAPFaultCode getSoapFaultCode(); /** * Returns an object representing the {soap fault subcodes} property, * which contains a List of xs:QName or the xs:token "#any". */ public SOAPFaultSubcodes getSoapFaultSubcodes(); public SOAPModule[] getSoapModules(); public SOAPHeaderBlock[] getSoapHeaders(); public String getHttpContentEncoding(); public HTTPHeader[] getHttpHeaders(); } ./src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java0000664000175000017500000000754511767656530025367 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * Provides access to the extension properties of the Binding component * that are in the http://www.w3.org/ns/wsdl/soap namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * * * * * * * * * *
    Property nameJava type
    soap versionjava.lang.String
    soap underlying protocoljava.net.URI
    soap mep defaultjava.net.URI
    soap modulesorg.apache.woden.wsdl20.extensions.soap.SOAPModule[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each SOAP extension property. * It also provides accessor methods for some additional HTTP extension properties * that are present in a SOAP binding when the underlying protocol is HTTP. *

    * These are: *

      *
    • {http query parameter separator default}
    • *
    • {http cookies}
    • *
    • {http content encoding default}
    • *
    *

    * TODO Re HTTP methods, consider WODEN-158 which proposes keeping extension interfaces namespace-specific, not binding-type-specific * * @author John Kaputin (jkaputin@apache.org) */ public interface SOAPBindingExtensions extends ComponentExtensionContext { public String getSoapVersion(); public URI getSoapUnderlyingProtocol(); public URI getSoapMepDefault(); public SOAPModule[] getSoapModules(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http query parameter separator default} extension property represented by the * whttp:queryParameterSeparatorDefault extension attribute , otherwise null. * * @return String the {http query parameter separator default} extension property */ public String getHttpQueryParameterSeparatorDefault(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http cookies} extension property represented by the * whttp:cookies extension attribute , otherwise null. * * @return Boolean the {http cookies} extension property if present, otherwise null */ public Boolean isHttpCookies(); /** * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the * {http content encoding default} extension property represented by the * whttp:contentEncodingDefault extension attribute , otherwise null. * * @return String the {http content encoding default} extension property */ public String getHttpContentEncodingDefault(); } ./src/org/apache/woden/wsdl20/extensions/ExtensionSerializer.java0000664000175000017500000000454211767656530024310 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.io.PrintWriter; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This interface should be implemented by classes which serialize * extension-specific instances of ExtensibilityElement into the * PrintWriter. *

    * Copied from WSDL4J. * * @author Matthew J. Duftler (duftler@us.ibm.com) */ public interface ExtensionSerializer { /** * This method serializes extension-specific instances of * ExtensibilityElement into the PrintWriter. * * @param parentType a class object indicating where in the WSDL * definition this extension was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this extensibility element was found in the list of * extensibility elements belonging to a org.apache.woden.Binding. * @param elementType the qname of the extensibility element * @param extension the extensibility element to serialize * @param pw the print writer on which to serialize the extension * @param desc the description element this extensibility element was * encountered in * @param extReg the ExtensionRegistry to use (if needed again) */ public void marshall(Class parentType, QName elementType, ExtensionElement extension, PrintWriter pw, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException; }./src/org/apache/woden/wsdl20/extensions/InterfaceOperationExtensions.java0000664000175000017500000000407411767656530026143 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; /** * InterfaceOperationExtensions represents the WSDL 2.0 * predefined extensions, as specified by WSDL 2.0 Part 2: Adjuncts, for the Interface * Operation component. *

    * Provides access to the extension properties of the Interface Operation component * that are in the http://www.w3.org/ns/wsdl-extensions namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * *
    Property nameJava type
    safejava.lang.Boolean
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each extension property. * * @author Arthur Ryman (ryman@ca.ibm.com) * */ public interface InterfaceOperationExtensions extends ComponentExtensionContext { /** * Returns the value of the {safe} extension property of Interface * Operation as defined by the wsdlx:safe attribute. */ public boolean isSafe(); } ./src/org/apache/woden/wsdl20/extensions/rpc/0000775000175000017500000000000011767656530020216 5ustar brianbrian./src/org/apache/woden/wsdl20/extensions/rpc/Argument.java0000664000175000017500000000261711767656530022651 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.rpc; import javax.xml.namespace.QName; /** * Argument represents a (name,direction) pair where * name is the name of an argument and direction is its direction * as defined in Part 2: Adjuncts. * * @author Arthur Ryman (ryman@ca.ibm.com) * */ public class Argument { private QName name; private Direction direction; public Argument(QName name, Direction direction) { this.name = name; this.direction = direction; } public QName getName() { return name; } public Direction getDirection() { return direction; } } ./src/org/apache/woden/wsdl20/extensions/rpc/RPCInterfaceOperationExtensions.java0000664000175000017500000000430611767656530027272 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.rpc; import org.apache.woden.wsdl20.extensions.ComponentExtensionContext; /** * RPCInterfaceOperationExtensions represents the WSDL 2.0 predefined * RPC extensions, as specified in the WSDL 2.0 Part 2: Adjuncts specification, * for the Interface Operation component. *

    * Provides access to the extension properties of the Interface Operation component * that are in the http://www.w3.org/ns/wsdl/rpc namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * *
    Property nameJava type
    rpc signatureorg.apache.woden.wsdl20.extensions.rpc.Argument[]
    *

    * In addition to the getProperties and getProperty methods, * this interface defines accessor methods specific to each extension property. * * @author Arthur Ryman (ryman@ca.ibm.com) * */ public interface RPCInterfaceOperationExtensions extends ComponentExtensionContext { /** * Returns the {rpc signature} extension property of Interface Operation * as defined by the wrpc:signature attribute. */ public Argument[] getRPCSignature(); } ./src/org/apache/woden/wsdl20/extensions/rpc/RPCConstants.java0000664000175000017500000000330511767656530023403 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.rpc; import java.net.URI; import javax.xml.namespace.QName; public class RPCConstants { // Extension namespace public static final String NS_STRING_RPC = "http://www.w3.org/ns/wsdl/rpc"; public static final URI NS_URI_RPC = URI.create(NS_STRING_RPC); // Style public static final String STYLE_STRING_RPC = "http://www.w3.org/ns/wsdl/style/rpc"; public static final URI STYLE_URI_RPC = URI.create(STYLE_STRING_RPC); // Extension namespace prefix public static final String PFX_WRPC = "wrpc"; // Extension attribute names public static final String ATTR_SIGNATURE = "signature"; // Extension attribute QNames public static final QName Q_ATTR_RPC_SIGNATURE = new QName(NS_STRING_RPC, ATTR_SIGNATURE, PFX_WRPC); // Extension property names public static final String PROP_RPC_SIGNATURE = "rpc signature"; } ./src/org/apache/woden/wsdl20/extensions/rpc/Direction.java0000664000175000017500000000265211767656530023006 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions.rpc; /** * Direction is a typesafe enumeration of the four * possible values, #in, #out, #inout, and #return. * * @author Arthur Ryman (ryman@ca.ibm.com) */ public class Direction { private String token; private Direction(String token) { this.token = token; } public static final Direction IN = new Direction("#in"); public static final Direction OUT = new Direction("#out"); public static final Direction INOUT = new Direction("#inout"); public static final Direction RETURN = new Direction("#return"); public String toString() { return token; } } ./src/org/apache/woden/wsdl20/extensions/UnknownExtensionElement.java0000664000175000017500000000552411767656530025151 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import org.apache.woden.XMLElement; import javax.xml.namespace.*; /** * This class is used to wrap arbitrary elements. *

    * Based on the same class from WSDL4J. * * @see UnknownExtensionSerializer * @see UnknownExtensionDeserializer * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author jkaputin@apache.org */ public class UnknownExtensionElement implements ExtensionElement { protected QName elementQN = null; // Uses the wrapper type so we can tell if it was set or not. protected Boolean required = null; protected XMLElement element = null; /** * Set the type of this extensibility element. * * @param elementQN the type */ public void setExtensionType(QName elementQN) { this.elementQN = elementQN; } /** * Get the type of this extensibility element. * * @return the extensibility element's type */ public QName getExtensionType() { return elementQN; } /** * Set whether or not the semantics of this extension * are required. Relates to the wsdl:required attribute. */ public void setRequired(Boolean required) { this.required = required; } /** * Get whether or not the semantics of this extension * are required. Relates to the wsdl:required attribute. */ public Boolean isRequired() { return required; } /** * Set the Element for this extensibility element. * * @param element the unknown element that was encountered */ public void setElement(XMLElement element) { this.element = element; } /** * Get the Element for this extensibility element. * * @return the unknown element that was encountered */ public XMLElement getElement() { return element; } public String toString() { StringBuffer strBuf = new StringBuffer(); strBuf.append("UnknownExtensionElement (" + elementQN + "):"); strBuf.append("\nrequired=" + required); if (element != null) { strBuf.append("\nelement=" + element); } return strBuf.toString(); } }./src/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.java0000664000175000017500000000613411767656530025505 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; import org.apache.woden.wsdl20.WSDLComponent; /** * This interface defines a generic API for accessing the extension properties * from a particular extension namespace that are attached to a particular * WSDL 2.0 component. That is, for accessing extension properties by namespace * per component. *

    * It provides accessor methods that return ExtensionProperty objects, * which callers can use to access the content of an extension property. *

    * Implementors of WSDL 2.0 extensions must, as a minimum, implement this interface * for each WSDL 2.0 component they extend. They must also register their * extension implementations using the ExtensionRegistry. * Implementors may optionally extend this interface to add their own extension-specific * property accessor methods to the generic accessor methods declared by this interface. * For examples of this, see the SOAP and HTTP binding extensions provided by Woden. *

    * To document extensions consistently, implementors should copy the following Javadoc * fragment to use for their implementation classes or for their sub-interfaces of this * interface, replacing the square bracket parts [...] accordingly. *

    * start of fragment: *

    * Provides access to the extension properties of the [parent component name] component * that are in the [extension namespace] namespace. * These extension properties can be accessed as ExtensionProperty objects * via the getProperties and getProperty methods * using the property names and Java types shown in the following table. *

    * * * * * * * * * * * * * *
    Property nameJava type
    [property name][java type]
    ......
    *

    * end of fragment: * * @author John Kaputin (jkaputin@apache.org) * * @see org.apache.woden.wsdl20.extensions.ExtensionProperty */ public interface ComponentExtensionContext { public WSDLComponent getParent(); public URI getNamespace(); public ExtensionProperty[] getProperties(); public ExtensionProperty getProperty(String propertyName); } ./src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java0000664000175000017500000007345511767656530024020 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.lang.reflect.Constructor; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.AssertionInfo; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.UnknownAttr; import org.apache.woden.xml.XMLAttr; /** * This class is used to associate serializers, deserializers, and * Java implementation types with extension elements. * It also associates Java implementation types only with extension attributes, * but not serializers and deserializers. *

    * This class has been copied from WSDL4J and modified for Woden. * * TODO update method javadocs. * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author John Kaputin (jkaputin@apache.org) */ public class ExtensionRegistry { /** * Creates the extension registry, and sets the defaultSerializer * and defaultDeserializer properties to instances of an * UnknownExtensionSerializer, and an UnknownExtensionDeserializer, * respectively. */ public ExtensionRegistry(ErrorReporter errorReporter) { this.errorReporter = errorReporter; setDefaultSerializer(new UnknownExtensionSerializer()); setDefaultDeserializer(new UnknownExtensionDeserializer()); registerResourceBundle(CORE_RESOURCE_BUNDLE); } /** * The property containing the comma-separated listed of ExtensionRegistrars. * The property name is org.apache.woden.extensionregistrars. */ public static final String REGISTRAR_PROPERTY = "org.apache.woden.extensionregistrars"; /** * This property specifies the resource bundle containing the * core Woden extension registry error messages. * * TODO extract these errors to a new public (non-internal) bundle. */ static final private String CORE_RESOURCE_BUNDLE = "org.apache.woden.internal.Messages"; /* This is a Map of Maps. The top-level Map is keyed by (Class)parentType, and the inner Maps are keyed by (QName)elementQN. */ protected Map serializerReg = new Hashtable(); /* This is a Map of Maps. The top-level Map is keyed by (Class)parentType, and the inner Maps are keyed by (QName)elementQN. */ protected Map deserializerReg = new Hashtable(); /* This is a Map of Maps. The top-level Map is keyed by (Class)parentType, and the inner Maps are keyed by (QName)elementQN. */ protected Map extElementReg = new Hashtable(); protected ExtensionSerializer defaultSer = null; protected ExtensionDeserializer defaultDeser = null; /* This is a Map of Maps. The top-level Map is keyed by (Class)parentType, and the inner Maps are keyed by (QName)attrName. */ protected Map extAttributeReg = new Hashtable(); /* * This is a Map of Maps. The top-level Map is keyed by (Class)parentComponent * and the inner Map is keyed by (URI)extensionNamespace with a value of * (Class)componentExtensions. */ protected Map compExtReg = new Hashtable(); /* * Error message property files. */ private List fResourceBundleNames = new ArrayList(); private ErrorReporter errorReporter = null; public ErrorReporter getErrorReporter() { return this.errorReporter; } /* * A Map of assertions, where the key is an assertion id string and * the value is an AssertionInfo object. */ protected Map assertionReg = new Hashtable(); /** * Set the serializer to be used when none is found for an extensibility * element. Set this to null to have an exception thrown when * unexpected extensibility elements are encountered. Default value is * an instance of UnknownExtensionSerializer. * * @see UnknownExtensionSerializer */ public void setDefaultSerializer(ExtensionSerializer defaultSer) { this.defaultSer = defaultSer; } /** * Get the serializer to be used when none is found for an extensibility * element. Default value is an instance of UnknownExtensionSerializer. * * @see UnknownExtensionSerializer */ public ExtensionSerializer getDefaultSerializer() { return defaultSer; } /** * Set the deserializer to be used when none is found for an encountered * element. Set this to null to have an exception thrown when * unexpected extensibility elements are encountered. Default value is * an instance of UnknownExtensionDeserializer. * * @see UnknownExtensionDeserializer */ public void setDefaultDeserializer(ExtensionDeserializer defaultDeser) { this.defaultDeser = defaultDeser; } /** * Get the deserializer to be used when none is found for an encountered * element. Default value is an instance of UnknownExtensionDeserializer. * * @see UnknownExtensionDeserializer */ public ExtensionDeserializer getDefaultDeserializer() { return defaultDeser; } /** * Declare that the specified serializer should be used to serialize * all extensibility elements with a qname matching elementQN, when * encountered as children of the specified parentType. * * @param parentType a class object indicating where in the WSDL * definition this extension was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this extensibility element was found in the list of * extensibility elements belonging to a org.apache.woden.Binding. * @param elementType the qname of the extensibility element * @param es the extension serializer to use * * @see #querySerializer(Class, QName) */ public void registerSerializer(Class parentType, QName elementType, ExtensionSerializer es) { Map innerSerializerReg = (Map)serializerReg.get(parentType); if (innerSerializerReg == null) { innerSerializerReg = new Hashtable(); serializerReg.put(parentType, innerSerializerReg); } innerSerializerReg.put(elementType, es); } /** * Declare that the specified deserializer should be used to deserialize * all extensibility elements with a qname matching elementQN, when * encountered as immediate children of the element represented by the * specified parentType. * * @param parentType a class object indicating where in the WSDL * document this extensibility element was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this element was encountered as an immediate child of * a <wsdl:binding> element. * @param elementType the qname of the extensibility element * @param ed the extension deserializer to use * * @see #queryDeserializer(Class, QName) */ public void registerDeserializer(Class parentType, QName elementType, ExtensionDeserializer ed) { Map innerDeserializerReg = (Map)deserializerReg.get(parentType); if (innerDeserializerReg == null) { innerDeserializerReg = new Hashtable(); deserializerReg.put(parentType, innerDeserializerReg); } innerDeserializerReg.put(elementType, ed); } /** * Look up the serializer to use for the extensibility element with * the qname elementQN, which was encountered as a child of the * specified parentType. * * @param parentType a class object indicating where in the WSDL * definition this extension was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this extensibility element was found in the list of * extensibility elements belonging to a org.apache.woden.Binding. * @param elementType the qname of the extensibility element * * @return the extension serializer, if one was found. If none was * found, the behavior depends on the value of the defaultSerializer * property. If the defaultSerializer property is set to a non-null * value, that value is returned; otherwise, a WSDLException is * thrown. * * @see #registerSerializer(Class, QName, ExtensionSerializer) * @see #setDefaultSerializer(ExtensionSerializer) */ public ExtensionSerializer querySerializer(Class parentType, QName elementType) throws WSDLException { Map innerSerializerReg = (Map)serializerReg.get(parentType); ExtensionSerializer es = null; if (innerSerializerReg != null) { es = (ExtensionSerializer)innerSerializerReg.get(elementType); } if (es == null) { es = defaultSer; } if (es == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "No ExtensionSerializer found " + "to serialize a '" + elementType + "' element in the context of a '" + parentType.getName() + "'."); } return es; } /** * Look up the deserializer for the extensibility element with the * qname elementQN, which was encountered as an immediate child * of the element represented by the specified parentType. * * @param parentType a class object indicating where in the WSDL * document this extensibility element was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this element was encountered as an immediate child of * a <wsdl:binding> element. * @param elementType the qname of the extensibility element * * @return the extension deserializer, if one was found. If none was * found, the behavior depends on the value of the defaultDeserializer * property. If the defaultDeserializer property is set to a non-null * value, that value is returned; otherwise, a WSDLException is thrown. * * @see #registerDeserializer(Class, QName, ExtensionDeserializer) * @see #setDefaultDeserializer(ExtensionDeserializer) */ public ExtensionDeserializer queryDeserializer(Class parentType, QName elementType) throws WSDLException { Map innerDeserializerReg = (Map)deserializerReg.get(parentType); ExtensionDeserializer ed = null; if (innerDeserializerReg != null) { ed = (ExtensionDeserializer)innerDeserializerReg.get(elementType); } if (ed == null) { ed = defaultDeser; } if (ed == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "No ExtensionDeserializer found " + "to deserialize a '" + elementType + "' element in the context of a '" + parentType.getName() + "'."); } return ed; } /** * Look up the type of the extensibility element with the specified qname, which * was defined as a child of the element represented by the specified parent class. * * @param parentClass a class object indicating where in the WSDL * document this extensibility attribute was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this attribute was defined on a <wsdl:binding> element. * @param elemQN the qname of the extensibility attribute * * @return one of the constants defined on the AttributeExtensible class * * @see #registerExtAttributeType(Class, QName, Class) * @see AttributeExtensible */ public Class queryExtElementType(Class parentClass, QName elemQN) { Map innerExtensionAttributeReg = (Map)extAttributeReg.get(parentClass); Class elemClass = null; if (innerExtensionAttributeReg != null) { elemClass = (Class)innerExtensionAttributeReg.get(elemQN); } return elemClass; } /** * TODO make the return val typesafe, and create similar method for ext attrs. * * Returns a set of QNames representing the extensibility elements * that are allowed as children of the specified parent type. * Basically, this method returns the keys associated with the set * of extension deserializers registered for this parent type. * Returns null if no extension deserializers are registered for * this parent type. */ public Set getAllowableExtensions(Class parentType) { Map innerDeserializerReg = (Map)deserializerReg.get(parentType); return (innerDeserializerReg != null) ? innerDeserializerReg.keySet() : null; } /** * Declare that the specified extensionType is the concrete * class which should be used to represent extensibility elements * with qnames matching elementQN, that are intended to exist as * children of the specified parentType. * * @param parentType a class object indicating where in the WSDL * definition this extension would exist. For example, * org.apache.woden.Binding.class would be used to indicate * this extensibility element would be added to the list of * extensibility elements belonging to a org.apache.woden.Binding, * after being instantiated. * @param elementType the qname of the extensibility element * @param extensionType the concrete class which should be instantiated * * @see #createExtElement(Class, QName) */ public void registerExtElementType(Class parentType, QName elementType, Class extensionType) { Map innerExtensionTypeReg = (Map)extElementReg.get(parentType); if (innerExtensionTypeReg == null) { innerExtensionTypeReg = new Hashtable(); extElementReg.put(parentType, innerExtensionTypeReg); } innerExtensionTypeReg.put(elementType, extensionType); } /** * Create an instance of the type which was declared to be used to * represent extensibility elements with qnames matching elementQN, * when intended to exist as children of the specified parentType. * This method allows a user to instantiate an extensibility element * without having to know the implementing type. * * @param parentType a class object indicating where in the WSDL * definition this extension will exist. For example, * org.apache.woden.Binding.class would be used to indicate * this extensibility element is going to be added to the list of * extensibility elements belonging to a org.apache.woden.Binding, * after being instantiated. * @param elementType the qname of the extensibility element * * @return a new instance of the type used to represent the * specified extension * * @see #registerExtElementType(Class, QName, Class) */ public ExtensionElement createExtElement(Class parentType, QName elementType) throws WSDLException { Map innerExtensionTypeReg = (Map)extElementReg.get(parentType); Class extensionType = null; if (innerExtensionTypeReg != null) { extensionType = (Class)innerExtensionTypeReg.get(elementType); } if (extensionType == null) { //TODO use ErrorReporter to get formatted error msg WSDL012 throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "No Java extensionType found " + "to represent a '" + elementType + "' element in the context of a '" + parentType.getName() + "'."); } else if (!(ExtensionElement.class.isAssignableFrom(extensionType))) { //TODO use ErrorReporter to get formatted error msg WSDL013 throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "The Java extensionType '" + extensionType.getName() + "' does " + "not implement the ExtensibilityElement " + "interface."); } try { ExtensionElement ee = (ExtensionElement)extensionType.newInstance(); /* if (ee.getElementType() == null) { ee.setElementType(elementQN); } */ return ee; } catch (Exception e) { /* Catches: InstantiationException IllegalAccessException */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating Java " + "extensionType '" + extensionType.getName() + "'.", e); } } /** * Declare that the type of the specified extension attribute, when it occurs * as an attribute of the specified parent type, should be assumed to be * attrType. * * @param ownerClass a class object indicating where in the WSDL * document this extensibility attribute was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this attribute was defined on a <wsdl:binding> element. * @param attrQName the qname of the extensibility attribute * @param attrClass one of the constants defined on the AttributeExtensible * class * * @see #queryExtAttributeType(Class, QName) * @see AttributeExtensible */ public void registerExtAttributeType(Class ownerClass, QName attrQName, Class attrClass) { Map innerExtensionAttributeReg = (Map)extAttributeReg.get(ownerClass); if (innerExtensionAttributeReg == null) { innerExtensionAttributeReg = new Hashtable(); extAttributeReg.put(ownerClass, innerExtensionAttributeReg); } innerExtensionAttributeReg.put(attrQName, attrClass); } /** * Look up the type of the extensibility attribute with the specified qname, * which was defined on an element represented by the specified parent class. * * @param parentClass a class object indicating where in the WSDL * document this extensibility attribute was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this attribute was defined on a <wsdl:binding> element. * @param attrQN the qname of the extensibility attribute * * @return one of the constants defined on the AttributeExtensible class * * @see #registerExtAttributeType(Class, QName, Class) * @see AttributeExtensible */ public Class queryExtAttributeType(Class parentClass, QName attrQN) { Map innerExtensionAttributeReg = (Map)extAttributeReg.get(parentClass); Class attrClass = null; if (innerExtensionAttributeReg != null) { attrClass = (Class)innerExtensionAttributeReg.get(attrQN); } return attrClass; } public XMLAttr createExtAttribute(Class ownerClass, QName attrQName, XMLElement ownerElement, String attrValue) throws WSDLException { Map innerExtensionAttributeReg = (Map)extAttributeReg.get(ownerClass); Class implClass = null; XMLAttr attr = null; if (innerExtensionAttributeReg != null) { implClass = (Class)innerExtensionAttributeReg.get(attrQName); } if (implClass == null) { /* * Implementations MAY register a default class to handle unknown extension attributes, * which will be retrieved here from the Extension Registry. For example, the * StringAttr implementation class may be registered as the default. * * TODO TBC, then add this info to javadoc and user docs. See sample code in PopulatedExtReg. */ implClass = queryExtAttributeType(WSDLElement.class, new QName("http://ws.apache.org/woden", "DefaultAttr")); //If no default Java class is registered, use the UnknownAttr class. if(implClass == null) implClass = UnknownAttr.class; //Decided it is not necessary to report WSDL010 as a warning to the user, //however we will keep the message code for now in case we add logging capability //later and can capture it in a log (i.e. pull vs. push diagnositic information) /* TODO the following line was replaced by null in the reportError call below * to avoid an API build problem for Milestone 2. This must be fixed, post-M2. * e.g. provide some creator for error locator that hides the Impl class. * * new ErrorLocatorImpl(), //TODO line/col nos. * getErrorReporter().reportError( null, //see comment above "WSDL010", new Object[] {attrQName.toString(), ownerClass.getName(), implClass.getName()}, ErrorReporter.SEVERITY_WARNING); */ } else if (!(XMLAttr.class.isAssignableFrom(implClass))) { String msg = getErrorReporter().getFormattedMessage("WSDL011", new Object[] {attrQName.toString()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL011: " + msg); } try { Class[] ctorParms = new Class[] {XMLElement.class, QName.class, String.class, ErrorReporter.class}; Constructor ctor = implClass.getConstructor(ctorParms); Object[] ctorParmValues = new Object[] {ownerElement, attrQName, attrValue, getErrorReporter()}; attr = (XMLAttr)ctor.newInstance(ctorParmValues); } catch (Exception e) { //SecurityException //NoSuchMethodException //InvocationTargetException //InstantiationException //IllegalAccessException String msg = getErrorReporter().getFormattedMessage("WSDL009", new Object[] {implClass.getName()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e); } return attr; } /** * Register the Java class which will represent extensions from a specified * namespace that will extend the specified WSDL component class. * The Java class must implement ComponentExtensionContext. * * @param parentClass the WSDL component class * @param extNamespace the extension namespace * @param compExtCtxClass the Java class representing these extensions */ public void registerComponentExtension(Class parentClass, URI extNamespace, Class compExtCtxClass) { if(!(ComponentExtensionContext.class.isAssignableFrom(compExtCtxClass))) { String msg = getErrorReporter().getFormattedMessage("WSDL016", new Object[] {compExtCtxClass.getName()}); throw new IllegalArgumentException(msg); } Map innerCompExtReg = (Map)compExtReg.get(parentClass); if (innerCompExtReg == null) { innerCompExtReg = new Hashtable(); compExtReg.put(parentClass, innerCompExtReg); } innerCompExtReg.put(extNamespace, compExtCtxClass); } /** * Return the Java class that represents the extensions from the specified * namespace that extend the specified WSDL component class. * This class will be an implementation of ComponentExtensionContext. * * @param parentClass the WSDL component * @param extNamespace the extension namespace * @return the Class of the component extensions */ public Class queryComponentExtension(Class parentClass, URI extNamespace) { Map innerCompExtReg = (Map)compExtReg.get(parentClass); Class compExtClass = null; if (innerCompExtReg != null) { compExtClass = (Class)innerCompExtReg.get(extNamespace); } return compExtClass; } /** * Return the extension namespaces registered for the specified WSDL Component class. * * @param parentClass the class of WSDL component extended by these namespaces * @return an array of namespace URIs */ public URI[] queryComponentExtensionNamespaces(Class parentClass) { Map innerCompExtReg = (Map)compExtReg.get(parentClass); if (innerCompExtReg != null) { Set namespaceKeys = innerCompExtReg.keySet(); URI[] extNamespaces = new URI[namespaceKeys.size()]; namespaceKeys.toArray(extNamespaces); return extNamespaces; } else { return new URI[0]; //return an empty array, rather than null } } /** * Return a ComponentExtensionContext object from the Java class registered for * the specified extension namespace against the specified WSDL component class. * * @param parentClass the WSDL component class. * @param extNamespace the extension namespace. * @return a ComponentExtensionContext object * @throws WSDLException if no Java class is registered for this namespace and WSDL component. */ public ComponentExtensionContext createComponentExtension(Class parentClass, WSDLComponent parentComp, URI extNamespace) throws WSDLException { Class compExtCtxClass = queryComponentExtension(parentClass, extNamespace); if(compExtCtxClass == null) { String msg = getErrorReporter().getFormattedMessage("WSDL015", new Object[] {extNamespace.toString(), parentClass.getName()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL015: " + msg); } ComponentExtensionContext compExtCtx = null; /* TODO remove with woden-47 try { compExtCtx = (ComponentExtensionContext)compExtCtxClass.newInstance(); } catch (InstantiationException e) { String msg = getErrorReporter().getFormattedMessage("WSDL009", new Object[] {compExtCtxClass.getName()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e); } catch (IllegalAccessException e) { String msg = getErrorReporter().getFormattedMessage("WSDL009", new Object[] {compExtCtxClass.getName()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e); } */ try { Class[] ctorParms = new Class[] {WSDLComponent.class, URI.class, ErrorReporter.class}; Constructor ctor = compExtCtxClass.getConstructor(ctorParms); Object[] ctorParmValues = new Object[] {parentComp, extNamespace, getErrorReporter()}; compExtCtx = (ComponentExtensionContext)ctor.newInstance(ctorParmValues); } catch (Exception e) { //SecurityException //NoSuchMethodException //InvocationTargetException //InstantiationException //IllegalAccessException String msg = getErrorReporter().getFormattedMessage("WSDL009", new Object[] {compExtCtxClass.getName()}); throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e); } return compExtCtx; } public void registerResourceBundle(String resourceBundleName) { fResourceBundleNames.add(resourceBundleName); } public String[] queryResourceBundleNames() { String[] array = new String[fResourceBundleNames.size()]; fResourceBundleNames.toArray(array); return array; } /** * Register an Assertion along with the target Class that the assertion applies to. * TODO assertion dependencies. * * @param assertion an Assertion object representing the assertion to be registered. * @param targetClass the Class representing the component in the WSDL that the assertion applies to. */ public void registerAssertion(Assertion assertion, Class targetClass) { if(assertion == null) { String msg = this.errorReporter.getFormattedMessage("WSDL026", new Object[] {"assertion"}); throw new NullPointerException(msg); } else if(targetClass == null) { String msg = this.errorReporter.getFormattedMessage("WSDL026", new Object[] {"targetClass"}); throw new NullPointerException(msg); } this.assertionReg.put(assertion.getId(), new AssertionInfo(assertion, targetClass)); } public AssertionInfo queryAssertion(String assertionId) { return (AssertionInfo) this.assertionReg.get(assertionId); } public AssertionInfo[] queryAssertions() { Collection values = this.assertionReg.values(); AssertionInfo[] array = new AssertionInfo[values.size()]; values.toArray(array); return array; } }./src/org/apache/woden/wsdl20/extensions/UnknownExtensionDeserializer.java0000664000175000017500000000651311767656530026201 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; //TODO remove internals from the API: import org.apache.woden.internal.util.dom.DOMUtils; //TODO remove internals from the API: import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.w3c.dom.Element; import org.w3c.dom.Attr; /** * This class is used to deserialize arbitrary elements into * UnknownExtensionElement instances. *

    * Copied from WSDL4J. * * @see UnknownExtensionElement * @see UnknownExtensionSerializer * * @author Matthew J. Duftler (duftler@us.ibm.com) */ public class UnknownExtensionDeserializer implements ExtensionDeserializer { public ExtensionElement unmarshall(Class parentType, Object parent, QName extType, XMLElement extEl, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException { UnknownExtensionElement unknownExt = new UnknownExtensionElement(); //TODO remove internals from the API ... DOMUtils and Constants //String requiredStr = DOMUtils.getAttributeNS(el, // Constants.NS_URI_WSDL20, // Constants.ATTR_REQUIRED); String requiredStr = getAttributeNS(extEl, "http://www.w3.org/ns/wsdl", "required"); unknownExt.setExtensionType(extType); if (requiredStr != null) { unknownExt.setRequired(new Boolean(requiredStr)); } unknownExt.setElement(extEl); return unknownExt; } //Method copied from DOMUtils, to avoid using internal classes //here in the API packages (it was breaking the API build). //TODO workaround for M2, replace with new XMLElement behaviour. private String getAttributeNS (XMLElement xmlElement, String namespaceURI, String localPart) { String sRet = null; if (xmlElement.getSource() instanceof Element){ Element el = (Element)xmlElement.getSource(); Attr attr = el.getAttributeNodeNS (namespaceURI, localPart); if (attr != null) { sRet = attr.getValue (); } } return sRet; } }./src/org/apache/woden/wsdl20/extensions/GenericExtensionProperty.java0000664000175000017500000000576411767656530025327 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; /** * This class implements the ExtensionProperty interface to provide a * generic representation of a component extension property. *

    * This class may be used by implementors of WSDL 2.0 extensions when implementing the * ExtensionProperty accessor methods of the ComponentExtensionContext interface. * For example, when they extend the abstract class BaseComponentExtensionContext, * which partially implements the ComponentExtensionContext interface. * * @author John Kaputin (jkaputin@apache.org) * * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext * @see org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext * */ public class GenericExtensionProperty implements ExtensionProperty { private String fName; private URI fNamespace; private Object fContent; /** * This public constructor stores the extension property's name, namespace and * content. The name and namespace parameters must not be null. * * @param name the String name of the extension property * @param namespace the namespace URI of the extension property * @param content an Object representing the content of the extension property * * @throws NullPointerException if the name or namespace parameter is null */ public GenericExtensionProperty(String name, URI namespace, Object content) { if(name == null) { throw new NullPointerException("name=null"); } if(namespace == null) { throw new NullPointerException("namespace=null"); } fName = name; fNamespace = namespace; fContent = content; } /** * @see org.apache.woden.wsdl20.extensions.ExtensionProperty#getName() */ public String getName() { return fName; } /** * @see org.apache.woden.wsdl20.extensions.ExtensionProperty#getNamespace() */ public URI getNamespace() { return fNamespace; } /** * @see org.apache.woden.wsdl20.extensions.ExtensionProperty#getContent() */ public Object getContent() { return fContent; } } ./src/org/apache/woden/wsdl20/extensions/PropertyExtensible.java0000664000175000017500000000440111767656530024143 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; /** * Defines behaviour for accessing the extension properties * attached to WSDL 2.0 components. * To be extended by each WSDL 2.0 component interface. * * @author John Kaputin (jkaputin@apache.org) */ public interface PropertyExtensible { /** * Returns all of the component's extension properties. These may span multiple namespaces. */ public ExtensionProperty[] getExtensionProperties(); /** * Returns the component's extension properties from a particular namespace. * * @param namespace URI representing the namespace of the required extension properties * @return extension properties from the specified namespace */ public ExtensionProperty[] getExtensionProperties(URI namespace); /** * Returns the component's named extension property from the specified namespace. * Within the WSDL 2.0-defined extensions, the extension property name itself * is unique, but it is possible that property name collisions could occur across * different user-defined extensions, so the extension namespace is used with * property name to ensure uniqueness. * * @param namespace the namespace of the named extension property * @param name the name of the required extension property * @return the named extension property */ public ExtensionProperty getExtensionProperty(URI namespace, String name); } ./src/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java0000664000175000017500000000505311767656530024617 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This interface should be implemented by classes which deserialize * org.w3c.dom.Elements into extension-specific instances of ExtensionElement. *

    * Copied from WSDL4J. * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author jkaputin@apache.org (modified for Woden) */ public interface ExtensionDeserializer { /** * This method deserializes elements into instances of classes * which implement the ExtensionElement interface. The * return value should be explicitly cast to the more-specific * implementing type. * * @param parentType a class object indicating where in the WSDL * document this extension element was encountered. For * example, org.apache.woden.Binding.class would be used to indicate * this element was encountered as an immediate child of * a <wsdl:binding> element. * @param parent the parent object of this extension element * @param extType the qname of the extension element to deserialize * @param extEl the extension element * @param desc the <description> this extension element was * encountered in * @param extReg the ExtensionRegistry to use (if needed again) */ public ExtensionElement unmarshall(Class parentType, Object parent, QName extType, XMLElement extEl, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException; }./src/org/apache/woden/wsdl20/extensions/ExtensionElement.java0000664000175000017500000000300511767656530023561 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import javax.xml.namespace.QName; /** * This interface represents WSDL 2.0 extension elements. That is, any XML element * information items that appear as [children] of a WSDL 2.0 element and are not in * the WSDL 2.0 namespace (http://www.w3.org/ns/wsdl). *

    * Based on a similar interface from WSDL4J element extensibility. * * TODO change this URL if the WSDL 2.0 namespace changes before spec is finalized. * * @author jkaputin@apache.org */ public interface ExtensionElement { public void setExtensionType(QName qname); public QName getExtensionType(); public void setRequired(Boolean required); public Boolean isRequired(); } ./src/org/apache/woden/wsdl20/extensions/ExtensionProperty.java0000664000175000017500000000452311767656530024022 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; /** * Represents a WSDL 2.0 component extension property. That is, a property derived from WSDL 2.0 * extension elements or attributes. This is a generic representation of an extension property * that simply provides the property's name and namespace and its content as a * java.lang.Object. * The caller must know what to do with this content Object. * For example, what Java type to cast it to or whether it provides a useful * toString() implementation. *

    * WSDL 2.0 extensions should be defined by their own specification, which may include this type * of information. * Implementors of WSDL 2.0 extensions in Woden should also specify the names and Java types of * their extension properties using Javadoc comments in their implementations of the * ComponentExtensionContext interface. * For examples, see the SOAP and HTTP binding extensions provided by Woden. * * @author John Kaputin (jkaputin@apache.org) * * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext * */ public interface ExtensionProperty { /** * Returns a String representing the name of the extension property. */ public String getName(); /** * Returns a URI representing the namespace the extension property belongs to. */ public URI getNamespace(); /** * Returns the content of the extension property as a java.lang.Object. */ public Object getContent(); } ./src/org/apache/woden/wsdl20/extensions/about-this-package0000664000175000017500000000016111767656530023023 0ustar brianbrianAPI for handling extensibility defined in the WSDL 2.0 specs (e.g. soap, http, MEPs, type system extensibility)../src/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.java0000664000175000017500000000217211767656530024136 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; /** * Registers Woden extensions with an existing registry. * * @author Peter Danielsen * */ public interface ExtensionRegistrar { /** * Registers Woden extensions with an existing registry. * @param registry */ public void registerExtensions(ExtensionRegistry registry); } ./src/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.java0000664000175000017500000001224511767656530026300 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; /** * This abstract class partially implements the ComponentExtensionContext interface. * It implements common behaviour, leaving the extension-specific methods abstract. * That is, it leaves the getProperties and getProperty methods * abstract, for subclasses to implement. *

    * Implementors of WSDL 2.0 extensions may extend this class to reuse common behaviour * for accessing the parent component and the extension namespace. * It provides a constructor which subclasses should call that stores the parent component * and extension namespace. * * @author John Kaputin (jkaputin@apache.org) */ public abstract class BaseComponentExtensionContext implements ComponentExtensionContext { private WSDLComponent parent; private URI extNamespace; protected ErrorReporter errorReporter; /** * Constructor accepts the parent component, the extension namespace and an error reporter. * These parameters cannot be null. *

    * Normal behaviour is for these 3 parameters to be provided by the ExtensionRegistry when * it calls this constructor. * Woden client code should not need to call this constructor directly. * However, this assumes that extension properties from the required namespace have been * registered in the ExtensionRegistry. * This is done automatically by Woden for the extensions defined by the * WSDL 2.0 Recommendation (SOAP, HTTP, RPC, WSDLX), but implementors of other WSDL 2.0 * extensions must ensure they register their extension properties so that this constructor * gets called by the ExtensionRegistry. * * @param parent WSDLComponent containing these extension properties * @param extNamespace extension namespace URI * @param errorReporter ErrorReporter available to subclasses for reporting errors * * @throws NullPointerException if any of the parameters are null */ protected BaseComponentExtensionContext(WSDLComponent parent, URI extNamespace, ErrorReporter errorReporter) { if(errorReporter == null) { throw new NullPointerException("ErrorReporter=null"); } if(parent == null) { throw new NullPointerException(errorReporter.getFormattedMessage("WSDL025", null)); } if(extNamespace == null) { throw new NullPointerException(errorReporter.getFormattedMessage("WSDL023", null)); } this.parent = parent; this.extNamespace = extNamespace; this.errorReporter = errorReporter; } /* ************************************************************ * Methods declared by ComponentExtensionContext * ************************************************************/ /** * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getParent() */ public WSDLComponent getParent() { return this.parent; } /** * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getNamespace() */ public URI getNamespace() { return this.extNamespace; } /** * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ abstract public ExtensionProperty[] getProperties(); /** * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ abstract public ExtensionProperty getProperty(String propertyName); /* ************************************************************ * Helper methods * ************************************************************/ /** * A factory-type method for instantiating and initialising ExtensionProperty objects. * This is a helper method for subclasses, as it automatically provides the extension namespace. * The only additional information the caller must provide is the property name and its content. * The property name parameter must not be null. * * @throws NullPointerException if the name parameter is null. */ protected ExtensionProperty newExtensionProperty(String name, Object content) { return new GenericExtensionProperty(name, getNamespace(), content); } } ./src/org/apache/woden/wsdl20/extensions/AttributeExtensible.java0000664000175000017500000000402411767656530024263 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.extensions; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.xml.XMLAttr; /** * This interface represents elements that may contain extension attributes. * * @author jkaputin@apache.org */ public interface AttributeExtensible { /** * Store the extension attribute object identified by the QName. * If the attribute argument is null, remove the extension attribute identified * by the specified QName argument. * * TODO ? @throws IllegalArgumentException if the QName is null */ public void setExtensionAttribute(QName attrType, XMLAttr attr); /** * Return the extension attribute with this QName. */ public XMLAttr getExtensionAttribute(QName attrType); /** * Return the extension attributes from this namespace. */ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace); /** * Return all extension attributes. */ public XMLAttr[] getExtensionAttributes(); /** * Return true if the implementor has extension attributes belonging to this namespace, * otherwise false. */ public boolean hasExtensionAttributesForNamespace(URI namespace); } ./src/org/apache/woden/wsdl20/BindingMessageReference.java0000664000175000017500000000353611767656530022603 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement; /** * Represents the BindingMessageReference component from the WSDL 2.0 Component model * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingMessageReference extends NestedComponent { /** * Returns an InterfaceMessageReference representing the {interface message reference} * property of the BindingMessageReference component. That is, the interface message * reference that this binding message reference provides concrete bindings for. * * @return an InterfaceMessageReference bound by this BindingMessageReference */ public InterfaceMessageReference getInterfaceMessageReference(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the BindingMessageReferenceElement that maps to this BindingMessageReference */ public BindingMessageReferenceElement toElement(); } ./src/org/apache/woden/wsdl20/BindingFaultReference.java0000664000175000017500000000350011767656530022261 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement; /** * Represents the BindingFaultReference component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingFaultReference extends NestedComponent { /** * Returns an InterfaceFaultReference representing the {interface fault reference} * property of the BindingFaultReference component. That is, the interface fault * reference that this binding fault reference provides concrete bindings for. * * @return an InterfaceFaultReference bound by this BindingFaultReference */ public InterfaceFaultReference getInterfaceFaultReference(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the BindingFaultReferenceElement that maps to this BindingFaultReference */ public BindingFaultReferenceElement toElement(); } ./src/org/apache/woden/wsdl20/xml/0000775000175000017500000000000011767656530016033 5ustar brianbrian./src/org/apache/woden/wsdl20/xml/ServiceElement.java0000664000175000017500000000654711767656530021624 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <service> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface ServiceElement extends DocumentableElement, NestedElement { /** * Set the name of this ServiceElement to the specified NCName. * This corresponds to the name attribute of the <service> element. * * @param name the NCName that represents the local name of this service */ public void setName(NCName name); /** * Return the qualified name of this ServiceElement, which consists of its * local name and the targetNamespace of the enclosing DescriptionElement. * * @return the service QName */ public QName getName(); /** * Specify the name of the InterfaceElement referred to by this ServiceElement. * The specified QName corresponds to the interface attribute of the * <service> element. * * @param interfaceName the QName of the interface */ public void setInterfaceName(QName interfaceName); /** * Return the name of the InterfaceElement referred to by this ServiceElement. * This corresponds to the interface attribute of the * <service> element. * * @return the QName of the interface */ public QName getInterfaceName(); /** * Return the InterfaceElement referred to by this ServiceElement. * This equates to the <interface> element referred to by the interface * attribute of the <service> element. * If this reference cannot be resolved to an InterfaceElement, this method will return null. * * @return the InterfaceElement */ public InterfaceElement getInterfaceElement(); /** * Create an EndpointElement with this ServiceElement as its parent and * return a reference to it. * This equates to adding an <endpoint> element to the <service> element. * * @return the EndpointElement */ public EndpointElement addEndpointElement(); /** * Return the set of EndpointElements within this ServiceElement. * This equates to the set of <endpoint> elements within the <service> element. * If no EndpointElements exist, an empty array is returned. * * @return an array of EndpointElement */ public EndpointElement[] getEndpointElements(); } ./src/org/apache/woden/wsdl20/xml/DocumentableElement.java0000664000175000017500000000423311767656530022614 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; /** * Represents WSDL 2.0 elements that can have <documentation> child elements. * That is, all WSDL 2.0 elements except the <documentation> element itself. * The Java interfaces that correspond to these WSDL elements will extend this * interface to inherit the behaviour for getting, adding and removing * DocumentationElements. *

    * TODO a removeDocmentationElement method * * @author John Kaputin (jkaputin@apache.org) */ public interface DocumentableElement extends WSDLElement { /** * Create a DocumentationElement with this WSDLElement as its parent and * return a reference to it. * This equates to adding a <documentation> element to any of the other * WSDL elements (except the <documentation> element itself). * * @return the DocumentationElement */ public DocumentationElement addDocumentationElement(); /** * Return the set of DocumentationElements defined directly within this WSDLElement. * This equates to the set of <documentation> elements declared within a WSDL * element. * If no DocumentationElements exist, an empty array is returned. * * @return array of DocumentationElement */ public DocumentationElement[] getDocumentationElements(); //TODO a removeDocmentationElement method } ./src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java0000664000175000017500000001543111767656530023775 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <operation> element, declared as a child * of the <interface> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceOperationElement extends DocumentableElement, NestedElement { /* * Attributes */ /** * Set the name of this InterfaceOperationElement to the specified NCName. * This corresponds to the name attribute of the interface <operation> element. * * @param name the NCName that represents the local name of this interface operation */ public void setName(NCName name); /** * Return the qualified name of this InterfaceOperationElement, which consists of its * local name and the targetNamespace of the enclosing DescriptionElement. * * @return the interface operation QName */ public QName getName(); /** * Set the message exchange pattern used by this InterfaceOperationElement to the specified * URI. * This corresponds to the pattern attribute of the interface <operation> * element. * * @param mep the message exchange pattern URI */ public void setPattern(URI mep); /** * Return the URI representing the message exchange pattern used by this InterfaceOperationElement. * This corresponds to the name attribute of the interface <operation> element. * * @return the URI representing the message exchange pattern */ public URI getPattern(); /** * Add the specified URI to the set of style URIs used by this InterfaceOperationElement. * This equates to adding a URI to the style attribute of the interface * <operation> element. * If a null style URI is specified, no action is performed. * * @param style a URI representing an operation style */ public void addStyleURI(URI style); /** * Remove the specified URI from the set of style URIs used by this InterfaceOperationElement. * This equates to removing a URI from the style attribute of the interface * <operation> element. * If the specified URI is not present in the set of style URIs or if a null URI is specified, * no action is performed. * * @param style a URI representing an operation style */ public void removeStyleURI(URI style); /** * Return the set of URIs representing the operation style. * This corresponds to the URIs defined in the style attribute of the interface * <operation> element. * If no style URIs exist, an empty array is returned. * * @return an array of URI representing the operation style */ public URI[] getStyle(); /* * Elements */ /** * Create an InterfaceMessageReferenceElement with this InterfaceOperationElement as its parent * and return a reference to it. * This equates to adding an <input> or <output> element to the interface * <operation> element. * * @return the InterfaceMessageReferenceElement */ public InterfaceMessageReferenceElement addInterfaceMessageReferenceElement(); /** * Remove the specified InterfaceMessageReferenceElement from the set of * InterfaceMessageReferenceElements within this InterfaceOperationElement. * This equates to removing an <input> or <output> element * from the interface <operation> element. * If the specified InterfaceMessageReferenceElement does not exist or if a * null value is specified, no action is performed. * * @param msgRef the InterfaceMessageReferenceElement to be removed */ public void removeInterfaceMessageReferenceElement(InterfaceMessageReferenceElement msgRef); /** * Return the set of InterfaceMessageReferenceElements within this InterfaceOperationElement. * This equates to the set of <input> and <output> elements * within the interface <operation> element. * If no InterfaceMessageReferenceElements exist, an empty array is returned. * * @return an array of InterfaceMessageReferenceElement */ public InterfaceMessageReferenceElement[] getInterfaceMessageReferenceElements(); /** * Create an InterfaceFaultReferenceElement with this InterfaceOperationElement as its parent * and return a reference to it. * This equates to adding an <infault> or <outfault> element to the interface * <operation> element. * * @return the InterfaceFaultReferenceElement */ public InterfaceFaultReferenceElement addInterfaceFaultReferenceElement(); /** * Remove the specified InterfaceFaultReferenceElement from the set of * InterfaceFaultReferenceElements within this InterfaceOperationElement. * This equates to removing an <infault> or <outfault> element * from the interface <operation> element. * If the specified InterfaceFaultReferenceElement does not exist or if a * null value is specified, no action is performed. * * @param faultRef the InterfaceFaultReferenceElement to be removed */ public void removeInterfaceFaultReferenceElement(InterfaceFaultReferenceElement faultRef); /** * Return the set of InterfaceFaultReferenceElement within this InterfaceOperationElement. * This equates to the set of <infault> and <outfault> elements * within the interface <operation> element. * If no InterfaceFaultReferenceElements exist, an empty array is returned. * * @return an array of InterfaceFaultReferenceElement */ public InterfaceFaultReferenceElement[] getInterfaceFaultReferenceElements(); } ./src/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElement.java0000664000175000017500000001122611767656530025236 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import org.apache.woden.types.NCName; import org.apache.woden.types.QNameTokenUnion; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.ws.commons.schema.XmlSchemaElement; /** * Represents the WSDL 2.0 <input> and <output> elements, * declared as child elements of interface <operation> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceMessageReferenceElement extends DocumentableElement, NestedElement { /** * Set the message label to the specified NCName. * This corresponds to the messageLabel attribute of the interface operation * <input> and <output> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent interface <operation> element. * * @param msgLabel the NCName representing the message label */ public void setMessageLabel(NCName msgLabel); /** * Return the NCName representing the message label. * This corresponds to the messageLabel attribute of the interface operation * <input> and <output> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent interface <operation> element. * * @return NCName the message label */ public NCName getMessageLabel(); /** * Specify the union of the xs:token and xs:QName of the global schema element declaration referred to by this * InterfaceMessageReferenceElement. * The specified QNameTokenEnum corresponds to the element attribute of the interface * operation <input> or <output> element. * * @param element the QNameTokenEnum of the element declaration. */ public void setElement(QNameTokenUnion element); /** * Return the union of the xs:token and xs:QName of the global schema element declaration referred to by this * InterfaceMessageReferenceElement. * This corresponds to the element attribute of the interface * operation <input> or <output> element. * * @return the QNameTokenEnum of the element declaration */ public QNameTokenUnion getElement(); /** * Return the XmlSchemaElement representing the global schema element declaration * referred to by this InterfaceMessageReferenceElement. * This equates to the <xs:element> element referred to by the element * attribute of the interface operation <input> or <output> element. * If this reference cannot be resolved to an element declaration in a schema that * is visible to the enclosing <description>, this method will return null. * To be visible, the schema must have been correctly imported or inlined within * the <types> element. * * @return the XmlSchemaElement */ public XmlSchemaElement getXmlSchemaElement(); /** * Set the message direction using the specified enumerated type, Direction, * which indicates the direction of the message. * Direction.IN corresponds to the interface operation <input> element. * Direction.OUT corresponds to the interface operation <output> element. * * @param dir the Direction of the message */ public void setDirection(Direction dir); /** * Returns an enumerated type, Direction, that indicates the direction of this message. * Direction.IN corresponds to the interface operation <input> element. * Direction.OUT corresponds to the interface operation <output> element. * * @return the Direction of the message */ public Direction getDirection(); } ./src/org/apache/woden/wsdl20/xml/NestedElement.java0000664000175000017500000000264111767656530021435 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; /** * Represents the WSDL 2.0 elements that are nested within the <description> * element. That is, all WSDL 2.0 elements except <description> itself. * The Java interfaces that represent these WSDL elements will extend this * interface to inherit behaviour for specifying and accessing their parent * WSDLElement. *

    * TODO make DocumentationElement, ImportElement and IncludeElement subtypes of NestedElement * * @author John Kaputin (jkaputin@apache.org) */ public interface NestedElement extends WSDLElement { public WSDLElement getParentElement(); } ./src/org/apache/woden/wsdl20/xml/InterfaceElement.java0000664000175000017500000002034411767656530022113 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <interface> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceElement extends DocumentableElement, NestedElement { /* * Attributes */ /** * Set the name of this InterfaceElement to the specified NCName. * This corresponds to the name attribute of the <interface> element. * * @param name the NCName that represents the local name of this interface */ public void setName(NCName name); /** * Return the qualified name of this InterfaceElement, which consists of its * local name and the targetNamespace of the parent DescriptionElement. * * @return the interface QName */ public QName getName(); /** * Add the named InterfaceElement to the set of InterfaceElements that this InterfaceElement * extends. This equates to adding a QName to the extends attribute * of the <interface> element. * If a null interface name is specified, no action is performed. * * @param interfaceName the QName of an extended interface */ public void addExtendedInterfaceName(QName interfaceName); /** * Remove the named InterfaceElement from the set of InterfaceElements that this * InterfaceElement extends. This equates to removing a QName from the extends * attribute of the <interface> element. * If the named InterfaceElement is not extended by this InterfaceElement or if a null * interface name is specified, no action is performed. * * @param interfaceName the QName of an extended interface */ public void removeExtendedInterfaceName(QName interfaceName); /** * Return the qualified names of the InterfaceElements that this InterfaceElement extends. * This equates to the set of QNames defined in the extends attribute * of the <interface> element. * If no extended interfaces exist, an empty array is returned. * * @return an array of QName */ public QName[] getExtendedInterfaceNames(); /** * Return the named InterfaceElement from the set of IntefaceElements extended by this * InterfaceElement. The specified QName should equate to a QName defined in the * extends attribute of the <interface> element. * If the named InterfaceElement is not extended by this InterfaceElement or if a null * interface name is specified, this method will return null. * * @param interfaceName the QName of an extended interface * @return the named InterfaceElement */ public InterfaceElement getExtendedInterfaceElement(QName interfaceName); /** * Return the set of InterfaceElements extended by this InterfaceElement. * This equates to the set of QNames defined in the extends attribute * of the <interface> element. * If no extended interfaces exist, an empty array is returned. * * @return an array of InterfaceElement */ public InterfaceElement[] getExtendedInterfaceElements(); /** * Add the specified URI to the set of default operation style URIs. * This equates to adding a URI to the styleDefault attribute * of the <interface> element. * If a null style URI is specified, no action is performed. * * @param style a URI representing an operation style */ public void addStyleDefaultURI(URI style); //TODO public void removeStyleDefaultURI(URI uri); /** * Return the set of URIs representing the default operation style. * This equates to the URIs defined in the styleDefault attribute * of the <interface> element. * If no style default URIs exist, an empty array is returned. * * @return an array of URI representing the default operation style */ public URI[] getStyleDefault(); //TODO add a remove method /* * Elements */ /** * Create an InterfaceFaultElement with this InterfaceElement as its parent and * return a reference to it. * This equates to adding a <fault> element to the <interface> element. * * @return the InterfaceFaultElement */ public InterfaceFaultElement addInterfaceFaultElement(); //TODO public void removeInterfaceFaultElement(QName faultName); /** * Return the named InterfaceFaultElement from the set of InterfaceFaultElements defined * directly within this InterfaceElement. This equates to a named <fault> element * declared within the <interface> element. * This set does not include faults derived from extended interfaces. * If the named InterfaceFaultElement does not exist or if a null value is specified, * this method will return null. * * @param faultName the QName of the required InterfaceFaultElement * @return the named InterfaceFaultElement */ public InterfaceFaultElement getInterfaceFaultElement(QName faultName); /** * Return the set of InterfaceFaultElements defined directly within this InterfaceElement. * This equates to the set of <fault> elements declared within this <interface> * element. * This set does not include faults derived from extended interfaces. * If no InterfaceFaultElements exist, an empty array is returned. * * @return array of InterfaceFaultElement */ public InterfaceFaultElement[] getInterfaceFaultElements(); /** * Create an InterfaceOperationElement with this InterfaceElement as its parent and * return a reference to it. * This equates to adding an <operation> element to the <interface> element. * If no InterfaceOperationElements exist, an empty array is returned. * * @return the InterfaceOperationElement */ public InterfaceOperationElement addInterfaceOperationElement(); //TODO public void removeInterfaceOperationElement(QName operName); /** * Return the named InterfaceOperationElement from the set of InterfaceOperationElements defined * directly within this InterfaceElement. This equates to a named <operation> element * declared within the <interface> element. * This set does not include operations derived from extended interfaces. * If the named InterfaceOperationElement does not exist or if a null value is specified, * this method will return null. * * @param operName the QName of the required InterfaceOperationElement * @return the named InterfaceOperationElement */ public InterfaceOperationElement getInterfaceOperationElement(QName operName); /** * Return the set of InterfaceOperationElements defined directly within this InterfaceElement. * This equates to the set of <operation> elements declared within this <interface> * element. * This set does not include operations derived from extended interfaces. * If no InterfaceOperationElements exist, an empty array is returned. * * @return array of InterfaceOperationElement */ public InterfaceOperationElement[] getInterfaceOperationElements(); } ./src/org/apache/woden/wsdl20/xml/TypesElement.java0000664000175000017500000000603311767656530021316 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import org.apache.woden.schema.ImportedSchema; import org.apache.woden.schema.InlinedSchema; import org.apache.woden.schema.Schema; /** * Represents the WSDL 2.0 <types> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface TypesElement extends DocumentableElement, NestedElement { /** * Indicates the type system used within the <types> element. * Typically the W3C XML Schema type system will be used, indicated by * the namespace "http://www.w3.org/2001/XMLSchema". An alternative * schema-like type system is Relax NG (http://www.relaxng.org/). */ public void setTypeSystem(String typeSystem); /** * Get the string indicating the type system used within the <types> * element. */ public String getTypeSystem(); /** * Add a Schema object for a schema inlined or imported within the <types> element. * * @param schema the Schema object. */ public void addSchema(Schema schema); /** * Delete the specified Schema object. */ public void removeSchema(Schema schema); /** * Return the schemas inlined or imported directly within this <types> element. * * @return an array of Schema objects */ public Schema[] getSchemas(); /** * Return the schemas inlined or imported directly within this <types> element * whose target namespace matches the specified namespace. *

    * A null namespace argument will return schemas that have no target namespace. * * @return an array of Schema objects with the specified target namespace. */ public Schema[] getSchemas(URI namespace); /** * Return the schemas inlined directly within this <types> element * in the order in which they occur. * * @return an array of Schema objects. */ public InlinedSchema[] getInlinedSchemas(); /** * Return the schemas imported directly by this <types> element * in the order in which they occur. * * @return an array of Schema objects. */ public ImportedSchema[] getImportedSchemas(); } ./src/org/apache/woden/wsdl20/xml/ImportElement.java0000664000175000017500000000246211767656530021466 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; /** * Represents the WSDL 2.0 <import> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface ImportElement extends DocumentableElement, NestedElement { public void setNamespace(URI nsURI); public URI getNamespace(); public void setLocation(URI locURI); public URI getLocation(); public void setDescriptionElement(DescriptionElement desc); public DescriptionElement getDescriptionElement(); } ./src/org/apache/woden/wsdl20/xml/DocumentationElement.java0000664000175000017500000000340011767656530023016 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; /** * Represents the WSDL 2.0 <documentation> element. *

    * The <documentation> element may contain mixed content, but this * interface does not define methods that interpret that content. Instead it just wraps * the <documentation> element as a java.lang.Object. *

    * * @author John Kaputin (jkaputin@apache.org) */ import org.apache.woden.XMLElement; public interface DocumentationElement extends NestedElement { /** * Sets the documentationElement XMLElement for this DocumentationElement. * * @param documentationElement A XMLElement representing the DocumentationElement xml element. */ public void setContent(XMLElement documentationElement); /** * Returns a XMLElement representing the DocumentationElement xml element. * * @return XMLElement the xml representation of the DocumentationElement. */ public XMLElement getContent(); } ./src/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElement.java0000664000175000017500000001036111767656530024724 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.enumeration.Direction; /** * Represents the WSDL 2.0 <infault> and <outfault> elements, * declared as child elements of the interface <operation> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceFaultReferenceElement extends DocumentableElement, NestedElement { /** * Specify the name of the InterfaceFaultElement referred to by this * InterfaceFaultReferenceElement. * The specified QName corresponds to the ref attribute of the interface operation * <infault> or <outfault> element. * * @param faultName the QName of the interface fault */ public void setRef(QName faultName); /** * Return the name of the InterfaceFaultElement referred to by this * InterfaceFaultReferenceElement. * This corresponds to the ref attribute of the interface operation * <infault> or <outfault> element. * * @return the QName of the interface fault */ public QName getRef(); /** * Return the InterfaceFaultElement referred to by this InterfaceFaultReferenceElement. * This equates to the interface <fault> element referred to by the ref * attribute of the interface operation <infault> or <outfault> element. * If this reference cannot be resolved to an InterfaceFaultElement, this method will * return null. * * @return the InterfaceFaultElement */ public InterfaceFaultElement getInterfaceFaultElement(); /** * Set the message label to the specified NCName. * This corresponds to the messageLabel attribute of the interface operation * <infault> and <outfault> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent interface <operation> element. * * @param msgLabel the NCName representing the message label */ public void setMessageLabel(NCName msgLabel); /** * Return the NCName representing the message label. * This corresponds to the messageLabel attribute of the interface operation * <infault> and <outfault> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent interface <operation> element. * * @return NCName the message label */ public NCName getMessageLabel(); /** * Set the message direction using the specified enumerated type, Direction, * which indicates the direction of the fault. * Direction.IN corresponds to the interface operation <infault> element. * Direction.OUT corresponds to the interface operation <outfault> element. * * @param dir the Direction of the fault */ public void setDirection(Direction dir); /** * Returns an enumerated type, Direction, that indicates the direction of this fault. * Direction.IN corresponds to the interface operation <infault> element. * Direction.OUT corresponds to the interface operation <outfault> element. * * @return the Direction of the fault */ public Direction getDirection(); } ./src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java0000664000175000017500000000653711767656530023117 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.types.QNameTokenUnion; import org.apache.ws.commons.schema.XmlSchemaElement; /** * Represents the WSDL 2.0 <fault> element, declared as a child of the * <interface> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface InterfaceFaultElement extends DocumentableElement, NestedElement { /** * Set the name of this InterfaceFaultElement to the specified NCName. * This corresponds to the name attribute of the interface <fault> element. * * @param name the NCName that represents the local name of this interface fault */ public void setName(NCName name); /** * Return the qualified name of this InterfaceFaultElement, which consists of its * local name and the targetNamespace of the enclosing DescriptionElement. * * @return the interface fault QName */ public QName getName(); /** * Specify the union of the xs:token and xs:QName of the global schema element declaration referred to by this * InterfaceFaultElement. * The specified QName corresponds to the element attribute of the interface * <fault> element. * * @param elementName the QNameTokenUnion of the element declaration */ public void setElement(QNameTokenUnion elementName); /** * Return the union of the xs:token and xs:QName of the global schema element declaration referred to by this * InterfaceFaultElement. * This corresponds to the element attribute of the interface * <fault> element. * * @return the QNameTokenUnion of the element declaration */ public QNameTokenUnion getElement(); /** * Return the XmlSchemaElement representing the global schema element declaration * referred to by this InterfaceFaultElement. * This equates to the <xs:element> element referred to by the element * attribute of the interface <fault> element. * If this reference cannot be resolved to an element declaration in a schema that * is visible to the enclosing <description>, this method will return null. * To be visible, the schema must have been correctly imported or inlined within * the <types> element. * * @return the XmlSchemaElement */ public XmlSchemaElement getXmlSchemaElement(); } ./src/org/apache/woden/wsdl20/xml/BindingFaultElement.java0000664000175000017500000000434311767656530022562 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; /** * Represents the WSDL 2.0 <fault> element, declared as a child * of the <binding> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingFaultElement extends DocumentableElement, NestedElement { /** * Specify the name of the InterfaceFaultElement referred to by this BindingFaultElement. * The specified QName corresponds to the ref attribute of the binding * <fault> element. * * @param faultName the QName of the interface fault */ public void setRef(QName faultName); /** * Return the name of the InterfaceFaultElement referred to by this BindingFaultElement. * This corresponds to the ref attribute of the binding <fault> element. * * @return the QName of the interface fault */ public QName getRef(); /** * Return the InterfaceFaultElement referred to by this BindingFaultElement. * This equates to the interface <fault> element referred to by the * ref attribute of the binding <fault> element. * If this reference cannot be resolved to an InterfaceFaultElement, this method will * return null. * * @return the InterfaceFaultElement */ public InterfaceFaultElement getInterfaceFaultElement(); } ./src/org/apache/woden/wsdl20/xml/DescriptionElement.java0000664000175000017500000002035711767656530022502 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.Description; /** * Represents the WSDL 2.0 <description> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface DescriptionElement extends DocumentableElement { /** * Set the document base URI to the specified URI. * This is the base URI used to locate the <description> element that this * DescriptionElement corresponds to. * This is used to resolve relative paths specified within this WSDL description that * refer to other WSDL or Schema documents. For example, via <xs:import>, <wsdl:import> * or <wsdl:include> elements. * * @param documentBaseURI the base URI of the WSDL */ public void setDocumentBaseURI(URI documentBaseURI); /** * Return the document base URI that was used to locate the <description> element that * this DescriptionElement corresponds to. This is used to resolve relative paths within this * WSDL description that refer to other WSDL or Schema documents. * * @return the document base URI */ public URI getDocumentBaseURI(); /* * Attributes and namespaces */ /** * Set the target namespace to the specified URI. * This corresponds to the targetNamespace attribute of the <description> * element. * * @param namespaceURI the target namespace URI */ public void setTargetNamespace(URI namespaceURI); /** * Return the target namespace URI. * This corresponds to the targetNamespace attribute of the <description> * element. * * @return the target namespace URI. */ public URI getTargetNamespace(); /* * Element factory methods */ /** * Create an ImportElement with this DescriptionElement as its parent and * return a reference to it. * This equates to adding an <import> element to the <description> element. * * @return the ImportElement */ public ImportElement addImportElement(); /** * Create an IncludeElement with this DescriptionElement as its parent and * return a reference to it. * This equates to adding an <include> element to the <description> element. * * @return the IncludeElement */ public IncludeElement addIncludeElement(); /** * Create an InterfaceElement with this DescriptionElement as its parent and * return a reference to it. * This equates to adding an <interface> element to the <description> element. * * @return the InterfaceElement */ public InterfaceElement addInterfaceElement(); /** * Create a BindingElement with this DescriptionElement as its parent and * return a reference to it. * This equates to adding an <binding> element to the <description> element. * * @return the BindingElement */ public BindingElement addBindingElement(); /** * Create a ServiceElement with this DescriptionElement as its parent and * return a reference to it. * This equates to adding an <service> element to the <description> element. * * @return the ServiceElement */ public ServiceElement addServiceElement(); /* * Element accessor and modifier methods * * TODO removeXXX(obj), getXXX(key) methods * */ /** * Return the set of ImportElements within this DescriptionElement. * This equates to the set of <import> elements within the <description> element. * If no ImportElements exist, an empty array is returned. * * @return an array of ImportElement */ public ImportElement[] getImportElements(); /** * Return the set of IncludeElements within this DescriptionElement. * This equates to the set of <include> elements within the <description> element. * If no IncludeElements exist, an empty array is returned. * * @return an array of IncludeElement */ public IncludeElement[] getIncludeElements(); /** * Return the TypesElement within this DescriptionElement. * This corresponds to the <types> element within the <description> element. * If no TypesElement exists, this method will return null. * * @return the TypesElement */ public TypesElement getTypesElement(); /** * Create a TypesElement with this DescriptionElement as its parent and * return a reference to it. * If a TypesElement already exists for this DescriptionElement a WSDLException will be thrown. * * @return the TypesElement */ public TypesElement addTypesElement() throws WSDLException; /** * Return the set of InterfaceElements within this DescriptionElement. * This equates to the set of <interface> elements within the <description> element. * If no InterfaceElements exist, an empty array is returned. * * @return an array of InterfaceElement */ public InterfaceElement[] getInterfaceElements(); /** * Return the set of BindingElements within this DescriptionElement. * This equates to the set of <binding> elements within the <description> element. * If no BindingElements exist, an empty array is returned. * * @return an array of BindingElement */ public BindingElement[] getBindingElements(); /** * Return the set of ServiceElements within this DescriptionElement. * This equates to the set of <service> elements within the <description> element. * If no ServiceElements exist, an empty array is returned. * * @return an array of ServiceElement */ public ServiceElement[] getServiceElements(); /** * Return the Description component derived from this DescriptionElement. *

    * The Description component is unlike other WSDL components which map neatly to a single * WSDL element. Description represents a 'flattened' view of the entire WSDL infoset tree, * including the WSDL components from any imported or included WSDL documents, so it could * contain the content of multiple <description> elements. *

    * If this DescriptionElement imports or includes other DescriptionElements (that is, * if it is the root of a composite WSDL document), the behaviour of this method is equivalent * to traversing the WSDL tree recursively and aggregating the WSDL content of each * DescriptionElement into a single Description component. *

    * This equates to retrieving the root <description> element and traversing any * <wsdl:import> or <wsdl:include> elements to retrieve WSDL content of * any nested <description> elements. *

    * The toComponent() method is only defined for DescriptionElement, not for * other WSDL Element interfaces. This is because the WSDL 2.0 Component model is a nested * hierarchy with a single Description component at the top. To access WSDL components, * we must start at the Description and traverse the component model from there. * @return the Description component derived from this DescriptionElement */ public Description toComponent(); } ./src/org/apache/woden/wsdl20/xml/WSDLElement.java0000664000175000017500000001121011767656530020754 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import org.apache.woden.types.NamespaceDeclaration; import org.apache.woden.wsdl20.extensions.AttributeExtensible; import org.apache.woden.wsdl20.extensions.ElementExtensible; /** * Represents all WSDL 2.0 elements. The Java interfaces representing the WSDL 2.0 * elements will directly or indirectly extend this interface. * * @author John Kaputin (jkaputin@apache.org) */ public interface WSDLElement extends AttributeExtensible, ElementExtensible { /* * All elements in the WSDL 2.0 namespace support attribute extensibility and * element extensibility, so by inheriting directly or indirectly from this * interface they also inherit the extensibility interfaces. */ /** * Associate the specified prefix with the specified namespace URI to this WSDL element. * This equates to adding an xmlns namespace declaration to this * WSDL element. * To define the default namespace, specify null or the empty string "" for the prefix. * If null is specified for the namespace URI, the prefix/namespace association will be * removed (i.e. the same behaviour as the removeNamespace method). * If the specified prefix is already associated with a namespace URI, * that association will be replaced by the specified prefix/namespace association. * * @param prefix the prefix String associated with namespaceURI * @param namespaceURI the namespace URI associated with prefix */ public void addNamespace(String prefix, URI namespaceURI); /** * Remove the namespace URI associated with the specified prefix from this WSDL element. * This equates to removing an xmlns namespace declaration from this * WSDL element. * To remove the default namespace, specify null or the empty string "" for the prefix. * * @param prefix the prefix String associated with the namespace to be removed * @return the removed namespace URI or null if no prefix/namespace association exists */ public URI removeNamespace(String prefix); /** * Return the namespace URI associated with the specified prefix, or null if there is no * such namespace declaration. * The scope of the search corresponds to the scope of namespace declarations * in XML. That is, from the current element upwards to the root element * (to the wsdl:description). * To request the default namespace, specify null or the empty string "" for the prefix. * * @param prefix the prefix whose associated namespace URI is required * @return the associated namespace URI */ public URI getNamespaceURI(String prefix); /** * Return the prefix associated with the specified namespace URI. * The scope of the search corresponds to the scope of namespace declarations * in XML. That is, from the current element upwards to the root element * (to the wsdl:description). * * @param namespaceURI the namespace URI whose associated prefix is required * @return the associated prefix String */ public String getNamespacePrefix(URI namespaceURI); /** * Return the namespaces and their associated prefixes declared directly * within this WSDL element. * * @return an array of NamespaceDeclaration */ public NamespaceDeclaration[] getDeclaredNamespaces(); /** * Return all namespaces and their associated prefixes that are in-scope * to this WSDL element. That is, those declared directly within this element * and those declared in ancestor elements upwards to the root element * (to the wsdl:description). * * @return an array of NamespaceDeclaration */ public NamespaceDeclaration[] getInScopeNamespaces(); } ./src/org/apache/woden/wsdl20/xml/BindingElement.java0000664000175000017500000001157211767656530021570 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <binding> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingElement extends DocumentableElement, NestedElement { /* * Attributes */ /** * Set the name of this BindingElement to the specified NCName. * This corresponds to the name attribute of the <binding> element. * * @param name the NCName that represents this binding. */ public void setName(NCName name); /** * Return the qualified name of this BindingElement, which consists of its * local name and the targetNamespace of the parent DescriptionElement. * * @return the binding QName */ public QName getName(); /** * Specify the name of the InterfaceElement referred to by this BindingElement. * This corresponds to the interface attribute of the <binding> element. * * @param interfaceName the QName of the interface */ public void setInterfaceName(QName interfaceName); /** * Return the name of the InterfaceElement referred to by this BindingElement. * This corresponds to the interface attribute of the <binding> element. * * @return the interface QName */ public QName getInterfaceName(); /** * Return the InterfaceElement referred to by this BindingElement. * This equates to the <interface> element referred to by the interface * attribute of the <binding> element. * If this reference cannot be resolved to an InterfaceElement or if this BindingElement * is a generic (interface-less) binding, this method will return null. * * @return the InterfaceElement */ public InterfaceElement getInterfaceElement(); /** * Set the binding type to the specified URI. * This identifies the type of WSDL extensions used with this binding. * This corresponds to the type attribute of the <binding> element. * * @param type the URI indicating the binding type */ public void setType(URI type); /** * Return the URI that identifies the binding type. * This corresponds to the type attribute of the <binding> element. * * @return the binding type URI */ public URI getType(); /* * Elements */ /** * Create a BindingFaultElement with this BindingElement as its parent and * return a reference to it. * This equates to adding a <fault> element to the <binding> element. * * @return the BindingFaultElement */ public BindingFaultElement addBindingFaultElement(); /** * Return the set of BindingFaultElements within this BindingElement. * This equates to the set of <fault> elements within the <binding> element. * If no BindingFaultElements exist, an empty array is returned. * * @return an array of BindingFaultElement */ public BindingFaultElement[] getBindingFaultElements(); //TODO removeBindingFaultElement method /** * Create a BindingOperationElement with this BindingElement as its parent and * return a reference to it. * This equates to adding an <operation> element to the <binding> element. * * @return the BindingOperationElement */ public BindingOperationElement addBindingOperationElement(); /** * Return the set of BindingOperationElements within this BindingElement * This equates to the set of <operation> elements within the <binding> element. * If no BindingOperationElements exist, an empty array is returned. * * @return an array of BindingOperationElement */ public BindingOperationElement[] getBindingOperationElements(); //TODO removeBindingOperationElement method } ./src/org/apache/woden/wsdl20/xml/BindingFaultReferenceElement.java0000664000175000017500000000644311767656530024404 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <infault> and <outfault> elements, * declared as child elements of the binding <operation> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingFaultReferenceElement extends DocumentableElement, NestedElement { /** * Specify the name of the InterfaceFaultReferenceElement referred to by this * BindingFaultReferenceElement. * The specified QName corresponds to the ref attribute of the binding operation * <infault> or <outfault> element. * * @param faultRefName the QName of the interface fault reference. */ public void setRef(QName faultRefName); /** * Return the name of the InterfaceFaultReferenceElement referred to by this * BindingFaultReferenceElement. * This corresponds to the ref attribute of the binding operation * <infault> or <outfault> element. * * @return the QName of the interface fault reference */ public QName getRef(); /** * Return the InterfaceFaultReferenceElement referred to by this BindingFaultReferenceElement. * This equates to an <infault> or <outfault> element of the interface operation being * bound whose message label is equal to the effective message label of this binding fault * reference and whose associated interface fault is identified by the ref attribute * if this binding fault reference. * If such an element does not exist, this method will return null. * * @return the InterfaceFaultReferenceElement */ public InterfaceFaultReferenceElement getInterfaceFaultReferenceElement(); /** * Set the message label to the specified NCName. This corresponds to a placeholder message * in the message exchange pattern specified by the parent binding <operation> element. * * @param msgLabel the NCName representing the message label */ public void setMessageLabel(NCName msgLabel); /** * Return the NCName representing the message label. This corresponds to a placeholder message * in the message exchange pattern specified by the parent binding <operation> element. * * @return NCName the message label */ public NCName getMessageLabel(); } ./src/org/apache/woden/wsdl20/xml/EndpointElement.java0000664000175000017500000000647211767656530022001 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * Represents the WSDL 2.0 <endpoint> element, * declared as a child of the <service> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface EndpointElement extends DocumentableElement, NestedElement { /** * Set the name of this EndpointElement to the specified NCName. * This corresponds to the name attribute of the <endpoint> element. * * @param name the NCName that represents the local name of this endpoint */ public void setName(NCName name); /** * Return the qualified name of this EndpointElement, which consists of its * local name and the targetNamespace of the enclosing DescriptionElement. * * @return the endpoint QName */ public NCName getName(); /** * Specify the name of the BindingElement referred to by this EndpointElement. * The specified QName corresponds to the binding attribute of the * <endpoint> element. * * @param bindingName the QName of the binding */ public void setBindingName(QName bindingName); /** * Return the name of the BindingElement referred to by this EndpointElement. * This corresponds to the binding attribute of the * <endpoint> element. * * @return the QName of the binding */ public QName getBindingName(); /** * Return the BindingElement referred to by this EndpointElement. * This equates to the <binding> element referred to by the binding * attribute of the <endpoint> element. * If this reference cannot be resolved to a BindingElement, this method will return null. * * @return the BindingElement */ public BindingElement getBindingElement(); /** * Set the endpoint address of this EndpointElement to the specified URI. * This corresponds to the address attribute of the <endpoint> element. * * @param address the endpoint address URI */ public void setAddress(URI address); /** * Return the URI representing the endpoint address of this EndpointElement. * This corresponds to the address attribute of the <endpoint> element. * * @return the endpoint address URI */ public URI getAddress(); } ./src/org/apache/woden/wsdl20/xml/IncludeElement.java0000664000175000017500000000234711767656530021601 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import java.net.URI; /** * Represents the WSDL 2.0 <include> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface IncludeElement extends DocumentableElement, NestedElement { public void setLocation(URI locURI); public URI getLocation(); public void setDescriptionElement(DescriptionElement desc); public DescriptionElement getDescriptionElement(); } ./src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java0000664000175000017500000000675611767656530024724 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.enumeration.Direction; /** * Represents the WSDL 2.0 <input> and <output> elements, * declared as child elements of the binding <operation> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingMessageReferenceElement extends DocumentableElement, NestedElement { /** * Set the message direction using the specified enumerated type, Direction, * which indicates the direction of the message. * Direction.IN corresponds to the binding operation <input> element. * Direction.OUT corresponds to the binding operation <output> element. * * @param dir the Direction of the message */ public void setDirection(Direction dir); /** * Returns an enumerated type, Direction, that indicates the direction of this message. * Direction.IN corresponds to the binding operation <input> element. * Direction.OUT corresponds to the binding operation <output> element. * * @return the Direction of the message */ public Direction getDirection(); /** * Set the message label to the specified NCName. * This corresponds to the messageLabel attribute of the binding operation * <input> and <output> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent binding <operation> element. * * @param msgLabel the NCName representing the message label */ public void setMessageLabel(NCName msgLabel); /** * Return the NCName representing the message label. * This corresponds to the messageLabel attribute of the binding operation * <input> and <output> elements. * It represents a placeholder message in the message exchange pattern specified by the * parent binding <operation> element. * * @return NCName the message label */ public NCName getMessageLabel(); /** * Return the InterfaceMessageReferenceElement associated with this BindingMessageReferenceElement. * This equates to an <input> or <output> element of the interface operation being * bound whose message label is equal to the effective message label of this binding message * reference. * If such an element does not exist, this method will return null. * * @return the InterfaceMessageReferenceElement */ public InterfaceMessageReferenceElement getInterfaceMessageReferenceElement(); } ./src/org/apache/woden/wsdl20/xml/BindingOperationElement.java0000664000175000017500000001241611767656530023447 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.xml; import javax.xml.namespace.QName; /** * Represents the WSDL 2.0 <operation> element, declared as a child * of the <binding> element. * * @author John Kaputin (jkaputin@apache.org) */ public interface BindingOperationElement extends DocumentableElement, NestedElement { /* * Attributes */ /** * Specify the name of the InterfaceOperationElement referred to by this BindingOperationElement. * The specified QName corresponds to the ref attribute of the binding * <operation> element. * * @param operName the QName of the interface operation. */ public void setRef(QName operName); /** * Return the name of the InterfaceOperationElement referred to by this BindingOperationElement. * This corresponds to the ref attribute of the binding <operation> element. * * @return the QName of the interface operation */ public QName getRef(); /** * Return the InterfaceOperationElement referred to by this BindingOperationElement. * This equates to the interface <operation> element referred to by the * ref attribute of the binding <operation> element. * If this reference cannot be resolved to an InterfaceOperationElement, this method will * return null. * * @return the InterfaceOperationElement */ public InterfaceOperationElement getInterfaceOperationElement(); /* * Elements */ /** * Create a BindingMessageReferenceElement with this BindingOperationElement as its parent * and return a reference to it. * This equates to adding an <input> or <output> element * to the binding <operation> element. * * @return the BindingMessageReferenceElement */ public BindingMessageReferenceElement addBindingMessageReferenceElement(); /** * Remove the specified BindingMessageReferenceElement from the set of * BindingMessageReferenceElements within this BindingOperationElement. * This equates to removing an <input> or <output> element * from the binding <operation> element. * If the specified BindingMessageReferenceElement does not exist or if a * null value is specified, no action is performed. * * @param msgRef the BindingMessageReferenceElement to be removed */ public void removeBindingMessageReferenceElement(BindingMessageReferenceElement msgRef); /** * Return the set of BindingMessageReferenceElements within this BindingOperationElement. * This equates to the set of <input> and <output> elements * within the binding <operation> element. * If no BindingMessageReferenceElements exist, an empty array is returned. * * @return an array of BindingMessageReferenceElement */ public BindingMessageReferenceElement[] getBindingMessageReferenceElements(); /** * Create a BindingFaultReferenceElement with this BindingOperationElement as its parent * and return a reference to it. * This equates to adding an <infault> or <outfault> element * to the binding <operation> element. * * @return the BindingFaultReferenceElement */ public BindingFaultReferenceElement addBindingFaultReferenceElement(); /** * Remove the specified BindingFaultReferenceElement from the set of * BindingFaultReferenceElements within this BindingOperationElement. * This equates to removing an <infault> or <outfault> element * from the binding <operation> element. * If the specified BindingFaultReferenceElement does not exist or if a * null value is specified, no action is performed. * * @param faultRef the BindingFaultReferenceElement to be removed */ public void removeBindingFaultReferenceElement(BindingFaultReferenceElement faultRef); /** * Return the set of BindingFaultReferenceElements within this BindingOperationElement. * This equates to the set of <infault> and <outfault> elements * within the binding <operation> element. * If no BindingFaultReferenceElements exist, an empty array is returned. * * @return an array of BindingFaultReferenceElement */ public BindingFaultReferenceElement[] getBindingFaultReferenceElements(); } ./src/org/apache/woden/wsdl20/Endpoint.java0000664000175000017500000000423111767656530017656 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.xml.EndpointElement; /** * Represents the Endpoint component from the WSDL 2.0 Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface Endpoint extends NestedComponent { /** * Returns the local name representing the {name} property of this Endpoint. * * @return NCName representing the name of this Endpoint */ public NCName getName(); /** * Represents the {binding} property of the Endpoint component. This is the Binding component * that this Endpoint is associated with. * * @return Binding associated with this Endpoint */ public Binding getBinding(); /** * Returns a URI that represents the {address} property of this Endpoint. * This is the network address at which the parent service can be found using the * binding associated with this endpoint. * * @return the URI address of the Service via this Endpoint */ public URI getAddress(); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the EndpointElement that maps to this Endpoint */ public EndpointElement toElement(); } ./src/org/apache/woden/wsdl20/fragids/0000775000175000017500000000000011767656530016652 5ustar brianbrian./src/org/apache/woden/wsdl20/fragids/ElementDeclarationPart.java0000664000175000017500000000761311767656530024112 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.WSDLReader; import java.net.URI; /** * ElementDeclarationPart is a Element Declaration Pointer Part for the Element Declaration WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.elementDeclaration * * @author Dan Harvey (danharvey42@gmail.com) * */ public class ElementDeclarationPart implements ComponentPart { private static final String emptyString = "".intern(); private QName element; //Name of the Element Declaration component. private final URI system; //Namespace absolute IRI of the extension type system used for the Element Declaration component. /** * Constructs a ElementDeclarationPart class for an Element Declaration component with an XMLScheme type system. * * @param element the name of the Element Declaration component. * @param system namespace absolute IRI of the extension type system used for the Element Declaration component. * @throws IllegalArgumentException if element or system are null. */ public ElementDeclarationPart(QName element, URI system) { if (element == null | system == null) { throw new IllegalArgumentException(); } this.element = element; if (system.toString().equals(WSDLReader.TYPE_XSD_2001)) { this.system = null; } else { this.system = system; } } /** * Constructs a ElementDeclarationPart class for an Element Declaration component with another type system. * * @param element the name of the Element Declaration component. * @throws IllegalArgumentException if element is null. */ public ElementDeclarationPart(QName element) { if (element == null) { throw new IllegalArgumentException(); } this.element = element; this.system = null; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.fragids.ComponentPart#prefixNamespaces(org.apache.woden.wsdl20.fragids.FragmentIdentifier) */ public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { if (system == null) { return new ElementDeclarationPart(fragmentIdentifier.prefixQNameNamespace(element)); } else { return new ElementDeclarationPart(fragmentIdentifier.prefixQNameNamespace(element), system); } } /** * Returns a String of the serialised Element Declaration Pointer Part. * * @return a String the serialised Element Declaration Pointer Part. */ public String toString() { String elementString = (element.getPrefix() != null && !element.getPrefix().equals(emptyString) ? element.getPrefix() + ":" + element.getLocalPart() : element.getLocalPart()); if (system == null) { return "wsdl.elementDeclaration(" + elementString + ")"; } else { return "wsdl.elementDeclaration(" + elementString + "," + system + ")"; } } } ./src/org/apache/woden/wsdl20/fragids/InterfaceOperationPart.java0000664000175000017500000000467211767656530024136 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * InterfaceOperationPart is a Interface Operation Pointer Part for the Interface Operation WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.interfaceOperation * * @author Dan Harvey (danharvey42@gmail.com) * */ public class InterfaceOperationPart implements ComponentPart { private final NCName interfaceName; //Local name of the parent Interface component. private final NCName operation; //Local name of the Interface Operation component. /** * Constructs a InterfaceOperationPart class from the values given. * * @param interfaceName the local name of the parent Interface component. * @param operation the local name of the Interface Operation component. * @throws IllegalArgumentException if interfaceName or operation are null. */ public InterfaceOperationPart(NCName interfaceName, NCName operation) { if (interfaceName == null | operation == null) { throw new IllegalArgumentException(); } this.interfaceName = interfaceName; this.operation = operation; } /** * Returns a String of the serialised Binding Operation Pointer Part. * * @return a String the serialised Binding Operation Pointer Part. */ public String toString() { return "wsdl.interfaceOperation(" + interfaceName + "/" + operation + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/InterfacePart.java0000664000175000017500000000407511767656530022252 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * InterfacePart is a Interface Pointer Part for the Interface WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.interface * * @author Dan Harvey (danharvey42@gmail.com) * */ public class InterfacePart implements ComponentPart { private final NCName interfaceName; //Local name of the parent Interface component. /** * Constructs a InterfacePart class from the value given. * * @param interfaceName the local name of the Interface component. * @throws IllegalArgumentException if interfaceName is null. */ public InterfacePart(NCName interfaceName) { if (interfaceName == null) { throw new IllegalArgumentException(); } this.interfaceName = interfaceName; } /** * Returns a String of the serialised Interface Pointer Part. * * @return a String the serialised Interface Pointer Part. */ public String toString() { return "wsdl.interface(" + interfaceName + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/BindingFaultPart.java0000664000175000017500000000525111767656530022715 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * BindingFaultPart is a Binding Fault Pointer Part for the Binding Fault WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.bindingFault * * @author Dan Harvey (danharvey42@gmail.com) * */ public class BindingFaultPart implements ComponentPart { private static final String emptyString = "".intern(); private final NCName binding; //Local name of the parent Binding component. private QName fault; //Name of the Interface Fault referred to by this Binding Fault component. /** * Constructs a BindingFaultPart class from the values given. * * @param binding the local name of the parent Binding component. * @param fault the name of the Interface Fault component referred to by this Binding Fault component. * @throws IllegalArgumentException if binding or fault are null. */ public BindingFaultPart(NCName binding, QName fault) { if (binding == null | fault == null) { throw new IllegalArgumentException(); } this.binding = binding; this.fault = fault; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return new BindingFaultPart(binding, fragmentIdentifier.prefixQNameNamespace(fault)); } /** * Returns a String of the serialised Binding Fault Pointer Part. * * @return a String the serialised Binding Fault Pointer Part. */ public String toString() { String faultString = (fault.getPrefix() != null && !fault.getPrefix().equals(emptyString) ? fault.getPrefix() + ":" + fault.getLocalPart() : fault.getLocalPart()); return "wsdl.bindingFault(" + binding + "/" + faultString + ")"; } } ./src/org/apache/woden/wsdl20/fragids/InterfaceFaultReferencePart.java0000664000175000017500000000671611767656530025071 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * InterfaceFaultReferencePart is a Interface Fault Reference Pointer Part for the Interface Fault Reference WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.interfaceFaultReference * * @author Dan Harvey (danharvey42@gmail.com) * */ public class InterfaceFaultReferencePart implements ComponentPart { private static final String emptyString = "".intern(); private final NCName interfaceName; //Local name of the parent Interface component. private final NCName operation; //Name of the parent Interface Operation component. private final NCName message; //Message Label of the Interface Fault Reference component. private QName fault; //Name of the Interface Fault component referred to by the Interface Fault Reference component. /** * Constructs a InterfaceFaultReferencePart class from the values given. * * @param interfaceName the local name of the parent Interface component. * @param operation the name of the parent Interface Operation component. * @param message the message label of the Interface Fault Reference component. * @param fault the name of the Interface Fault component referred to by the Interface Fault Reference component. * @throws IllegalArgumentException if interfaceName, operation, message or fault are null. */ public InterfaceFaultReferencePart(NCName interfaceName, NCName operation, NCName message, QName fault) { if (interfaceName == null | operation == null | message == null | fault == null) { throw new IllegalArgumentException(); } this.interfaceName = interfaceName; this.operation = operation; this.message = message; this.fault = fault; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return new InterfaceFaultReferencePart(interfaceName, operation, message, fragmentIdentifier.prefixQNameNamespace(fault)); } /** * Returns a String of the serialised Binding Fault Reference Pointer Part. * * @return a String the serialised Binding Fault Reference Pointer Part. */ public String toString() { String faultString = (fault.getPrefix() != null && !fault.getPrefix().equals(emptyString) ? fault.getPrefix() + ":" + fault.getLocalPart() : fault.getLocalPart()); return "wsdl.interfaceFaultReference(" + interfaceName + "/" + operation + "/" + message + "/" + faultString + ")"; } } ./src/org/apache/woden/wsdl20/fragids/InterfaceMessageReferencePart.java0000664000175000017500000000544411767656530025377 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * InterfaceMessageReferencePart is a Interface Message Reference Pointer Part for the Interface Message Reference WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.interfaceMessageReference * * @author Dan Harvey (danharvey42@gmail.com) * */ public class InterfaceMessageReferencePart implements ComponentPart{ private final NCName interfaceName; //Local name of the parent Interface component. private final NCName operation; //Name of the parent Interface Operation component. private final NCName message; //Message Label of the Interface Message Reference component. /** * Constructs a InterfaceMessageReferencePart class from the values given. * * @param interfaceName the local name of the parent Interface component. * @param operation the name of the parent Interface Operation component. * @param message the message label of the Interface Message Reference component. * @throws IllegalArgumentException if interfaceName, operation or message are null. */ public InterfaceMessageReferencePart(NCName interfaceName, NCName operation, NCName message) { if (interfaceName == null | operation == null | message == null) { throw new IllegalArgumentException(); } this.interfaceName = interfaceName; this.operation = operation; this.message = message; } /** * Returns a String of the serialised Binding Message Reference Pointer Part. * * @return a String the serialised Binding Message Reference Pointer Part. */ public String toString() { return "wsdl.interfaceMessageReference(" + interfaceName + "/" + operation + "/" + message + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/FragmentIdentifier.java0000664000175000017500000001051111767656530023261 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.fragids.ComponentPart; import org.apache.woden.xpointer.XPointer; import org.apache.woden.xpointer.XmlnsPointerPart; /** * This Class extends the XPointer class to work with WSDL fragment identifiers which are WSDL XPointer in effect. * * @author Dan Harvey (danharvey42@gmail.com) * * TODO Add methods to find WSDL component from the FragmentIdentifier. * Add deserialisation code in a constructor with a String argument. (Pass this onto XPointer to do the work?) * */ public class FragmentIdentifier { private static XPointer xpointer; /** * Constructs a new empty Fragment Identifier * * @param wsdlPart The WSDL2.0 component pointer part for this fragment identifier. * */ public FragmentIdentifier(ComponentPart wsdlPart) { xpointer = new XPointer(); wsdlPart = wsdlPart.prefixNamespaces(this); //Prefix namespaces if needed. xpointer.addPointerPart(wsdlPart); } /** * Returns a String serialisation of this fragment identifier. * * @return a String fragment identifier */ public String toString() { return xpointer.toString(); } /** Namespace management code **/ /** * Returns the prefix for the Xml namespace of the QName in the XPointer. * If the namespace does not have a prefix in the XPointer it will create a new prefix * with the prefix from the QName or one of the form nsXX and add a xmlns Pointer Part, then return that. * * @param qname The QName containing the namespace and a prefix. * @return a NCName of the prefix for the namespace. */ public NCName getXmlNamespacePrefix(QName qname) { return getXmlNamespacePrefix(qname.getNamespaceURI()); } /** * Returns the prefix for the Xml namespace in the XPointer. * If the namespace does not have a prefix in the XPointer it will create a new prefix * of the form nsXX and add a xmlns Pointer Part, then return that. * * @param namespace The namespace to get the prefix for. * @return a NCName of the prefix for the namespace. */ public NCName getXmlNamespacePrefix(String namespace) { //Lookup prefix NCName prefix = (NCName)xpointer.getNamespaceBinding(namespace); if (prefix == null) { //The namespace does not have a prefix yet so lets add one. //Find next available nsXXX prefix int i = 1; do { prefix = new NCName("ns" + i); i++; } while (xpointer.hasPrefixBinding(prefix)); //Add prefix pointer part. xpointer.addPointerPart(new XmlnsPointerPart(prefix, namespace)); //Add to our binding contex. xpointer.addPrefixNamespaceBinding(prefix, namespace); } return prefix; } /** * Returns a QName prefixed from the map of local namespaces and prefixes. * The namespace and localpart remain unchanged. * * @param qname the QName used to lookup the namespace and copy. * @return a QName with the new prefix, but same namespace and localpart. */ public QName prefixQNameNamespace(QName qname) { //Get prefix for the fault QName in the XPointer. NCName prefix = getXmlNamespacePrefix(qname); return new QName(qname.getNamespaceURI(), qname.getLocalPart(), prefix.toString()); } } ./src/org/apache/woden/wsdl20/fragids/BindingPart.java0000664000175000017500000000455211767656530021724 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Binding; /** * BindingPart is a Binding Pointer Part for the Binding WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.binding * * @author Dan Harvey (danharvey42@gmail.com) * */ public class BindingPart implements ComponentPart { private final NCName binding; //Local name of the Binding component. /** * Constructs a BindingPart class using values from the Binding WSDL 2.0 component. * * @param binding the local name of the Binding component. * @throws IllegalArgumentException if binding is null. */ public BindingPart(Binding binding) { if (binding == null) { throw new IllegalArgumentException(); } this.binding = new NCName(binding.getName().getLocalPart()); } /** * Constructs a BindingPart from the given value. * * @param binding */ public BindingPart(NCName binding) { if (binding == null) { throw new IllegalArgumentException(); } this.binding = binding; } /** * Returns a String of the serialised Binding Pointer Part. * * @return a String the serialised Binding Pointer Part. */ public String toString() { return "wsdl.binding(" + binding + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/ComponentPart.java0000664000175000017500000000331711767656530022312 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.xpointer.PointerPart; /** * ComponentPart is the abstract base class for all WSDL 2.0 component * fragment identifiers. * * @author Dan Harvey (danharvey42@gmail.com) * */ public interface ComponentPart extends PointerPart { /** * Checks that the namespace prefixes used in this PointerPart are consistent with those in the WSDL Fragment Identifier. * It returns a identical copy of this object with the required changes. * This method is called by the add method on WSDL Fragment Identifier when PointerParts are added to it. * * @param fragmentIdentifier a Fragment Identifier which the namespace prefixes are checked against. * @return a ComponentPart which has been checked with changed namespaces if needed. */ public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier); } ./src/org/apache/woden/wsdl20/fragids/EndpointPart.java0000664000175000017500000000435611767656530022134 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * EndpointPart is a Endpoint Pointer Part for the Endpoint WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.endpoint * * @author Dan Harvey (danharvey42@gmail.com) * */ public class EndpointPart implements ComponentPart { private final NCName service; //Local name of the parent Service component. private final NCName endpoint; //Name of the Endpoint component /** * Constructs an EndpointPart class from the values given. * * @param service the local name of the parent Service component. * @param endpoint the name of the Endpoint component. * @throws IllegalArgumentException if service or endpoint are null. */ public EndpointPart(NCName service, NCName endpoint) { if (service == null | endpoint == null) { throw new IllegalArgumentException(); } this.service = service; this.endpoint = endpoint; } /** * Returns a String of the serialised Endpoint Pointer Part. * * @return a String the serialised Endpoint Pointer Part. */ public String toString() { return "wsdl.endpoint(" + service + "/" + endpoint + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/DescriptionPart.java0000664000175000017500000000302411767656530022626 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; /** * DescriptionPart is a Description Pointer Part for the Description WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.description * * @author Dan Harvey (danharvey42@gmail.com) * */ public class DescriptionPart implements ComponentPart{ /** * Returns a String of the serialised Description Pointer Part. * * @return a String the serialised Description Pointer Part. */ public String toString() { return "wsdl.description()"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/InterfaceFaultPart.java0000664000175000017500000000455111767656530023245 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * InterfaceFaultPart is a Interface Fault Pointer Part for the Interface Fault WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.interfaceFault * * @author Dan Harvey (danharvey42@gmail.com) * */ public class InterfaceFaultPart implements ComponentPart { private final NCName interfaceName; //Local name of the parent Interface component. private final NCName fault; //Local name of the Interface Fault component. /** * Constructs a InterfaceFaultPart class from the values given. * * @param interfaceName the local name of the parent Interface component. * @param fault the name of the Interface Fault component. * @throws IllegalArgumentException if interfaceName or fault are null. */ public InterfaceFaultPart(NCName interfaceName, NCName fault) { if (interfaceName == null | fault == null) { throw new IllegalArgumentException(); } this.interfaceName = interfaceName; this.fault = fault; } /** * Returns a String of the serialised Binding Fault Pointer Part. * * @return a String the serialised Binding Fault Pointer Part. */ public String toString() { return "wsdl.interfaceFault(" + interfaceName + "/" + fault + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/BindingOperationPart.java0000664000175000017500000000547311767656530023610 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * BindingOperationPart is a Binding Operation Pointer Part for the Binding Operation WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.bindingOperation * * @author Dan Harvey (danharvey42@gmail.com) * */ public class BindingOperationPart implements ComponentPart { private static final String emptyString = "".intern(); private final NCName binding; //Local name of the parent Binding component. private QName operation; //Name of the Interface Operation component referred to by this Binding Operation component. /** * Constructs a BindingOperationPart class from the values given. * * @param binding the local name of the parent Binding component. * @param operation the name of the Interface Operation component referred to by this Binding Operation component. * @throws IllegalArgumentException if binding or operation are null. */ public BindingOperationPart(NCName binding, QName operation) { if (binding == null | operation == null) { throw new IllegalArgumentException(); } this.binding = binding; this.operation = operation; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return new BindingOperationPart(binding, fragmentIdentifier.prefixQNameNamespace(operation)); } /** * Returns a String of the serialised Binding Operation Pointer Part. * * @return a String the serialised Binding Operation Pointer Part. */ public String toString() { String operationString = (operation.getPrefix() != null && !operation.getPrefix().equals(emptyString) ? operation.getPrefix() + ":" + operation.getLocalPart() : operation.getLocalPart()); return "wsdl.bindingOperation(" + binding + "/" + operationString + ")"; } } ./src/org/apache/woden/wsdl20/fragids/ExtensionsPart.java0000664000175000017500000000445711767656530022515 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import java.net.URI; /** * ExtensionPart is a Extension Pointer Part for the Extension WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.extension * * @author Dan Harvey (danharvey42@gmail.com) * */ public class ExtensionsPart implements ComponentPart { private final URI namespace; //Namespace IRI that identifies the Extension component. private final String identifier; //Defined by the extension. /** * Constructs a Extensions Part class for an Extension component with an XMLScheme type system. * * @param namespace the namespace IRI that identifies the Extension component. * @param identifier Defined by the extension. * @throws IllegalArgumentException if namespace or identifier are null. */ public ExtensionsPart(URI namespace, String identifier) { if (namespace == null | identifier == null) { throw new IllegalArgumentException(); } this.namespace = namespace; this.identifier = identifier; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } /** * Returns a String of the serialised Extension Pointer Part. * * @return a String the serialised Extension Pointer Part. */ public String toString() { return "wsdl.extension(" + namespace + "/" + identifier + ")"; } } ./src/org/apache/woden/wsdl20/fragids/TypeDefinitionPart.java0000664000175000017500000000710111767656530023275 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import java.net.URI; /** * TypeDefinitionPart is a Type Definition Pointer Part for the Type Definition WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.typeDefinition * * @author Dan Harvey (danharvey42@gmail.com) * */ public class TypeDefinitionPart implements ComponentPart{ private static final String emptyString = "".intern(); private QName type; //Name of the Type Definition component. private final URI system; //Namespace absolute IRI of the extension type system used for the Type Definition component. /** * Constructs a TypeDefinitionPart class for an Type Definition component with an XMLScheme type system. * * @param type the name of the Type Definition component. * @param system namespace absolute IRI of the extension type system used for the Type Definition component. * @throws IllegalArgumentException if type or system are null. */ public TypeDefinitionPart(QName type, URI system) { if (type == null | system == null) { throw new IllegalArgumentException(); } this.type = type; this.system = system; } /** * Constructs an TypeDefinitionPart class for an Type Definition component with another type system. * * @param type the name of the Definition component. * @throws IllegalArgumentException if type is null. */ public TypeDefinitionPart(QName type) { if (type == null) { throw new IllegalArgumentException(); } this.type = type; this.system = null; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.fragids.ComponentPart#prefixNamespaces(org.apache.woden.wsdl20.fragids.FragmentIdentifier) */ public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { if (system == null) { return new TypeDefinitionPart(fragmentIdentifier.prefixQNameNamespace(type)); } else { return new TypeDefinitionPart(fragmentIdentifier.prefixQNameNamespace(type), system); } } /** * Returns a String of the serialised Type Definition Pointer Part. * * @return a String the serialised Type Definition Pointer Part. */ public String toString() { String typeString = (type.getPrefix() != null && !type.getPrefix().equals(emptyString) ? type.getPrefix() + ":" + type.getLocalPart() : type.getLocalPart()); if (system == null) { return "wsdl.typeDefinition(" + typeString + ")"; } else { return "wsdl.typeDefinition(" + typeString + "," + system + ")"; } } } ./src/org/apache/woden/wsdl20/fragids/BindingFaultReferencePart.java0000664000175000017500000000772611767656530024545 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * BindingFaultReferencePart is a Binding Fault Reference Pointer Part for the Binding Fault Reference WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.bindingFaultReference * * @author Dan Harvey (danharvey42@gmail.com) * */ public class BindingFaultReferencePart implements ComponentPart { private static final String emptyString = "".intern(); private final NCName binding; //Local name of the parent Binding component. private QName operation; //Name of the Interface Operation referred to by the parent Binding Operation component. private final NCName message; //Message Label of the Interface Fault Reference component referred to by this Binding Fault Reference component. private QName fault; //Name of the Interface Fault component referred to by the Interface Fault Reference component referred to by this Binding Fault Reference component. /** * Constructs an BindingFaultReferencePart class from the values given. * * @param binding the local name of the parent Binding component. * @param operation the name of the Interface Operation referred to by the parent Binding Operation component. * @param message the message label of the Interface Fault Reference component referred to by this Binding Message Reference component. * @param fault the name of the Interface Fault component referred to by the Interface Fault Reference component referred to by this Binding Fault Reference component. * @throws IllegalArgumentException if binding, operation, message or fault are null. */ public BindingFaultReferencePart(NCName binding, QName operation, NCName message, QName fault) { if (binding == null | operation == null | message == null | fault == null) { throw new IllegalArgumentException(); } this.binding = binding; this.operation = operation; this.message = message; this.fault = fault; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { QName nOperation = fragmentIdentifier.prefixQNameNamespace(operation); QName nFault = fragmentIdentifier.prefixQNameNamespace(fault); return new BindingFaultReferencePart(binding, nOperation, message, nFault); } /** * Returns a String of the serialised Binding Fault Reference Pointer Part. * * @return a String the serialised Binding Fault Reference Pointer Part. */ public String toString() { String operationString = (operation.getPrefix() != null && !operation.getPrefix().equals(emptyString) ? operation.getPrefix() + ":" + operation.getLocalPart() : operation.getLocalPart()); String faultString = (fault.getPrefix() != null && !fault.getPrefix().equals(emptyString) ? fault.getPrefix() + ":" + fault.getLocalPart() : fault.getLocalPart()); return "wsdl.bindingFaultReference(" + binding + "/" + operationString + "/" + message + "/" + faultString + ")"; } } ./src/org/apache/woden/wsdl20/fragids/ServicePart.java0000664000175000017500000000375611767656530021757 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import org.apache.woden.types.NCName; /** * ServicePart is a Service Pointer Part for the Service WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.service * * @author Dan Harvey (danharvey42@gmail.com) * */ public class ServicePart implements ComponentPart { private final NCName service; //Local name of the Service component. /** * Constructs an ServicePart class from the value given. * * @param service the local name of the Service component. * @throws IllegalArgumentException if service is null. */ public ServicePart(NCName service) { if (service == null) { throw new IllegalArgumentException(); } this.service = service; } /** * Returns a String of the serialised Service Pointer Part. * * @return a String the serialised Service Pointer Part. */ public String toString() { return "wsdl.service(" + service + ")"; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return this; } } ./src/org/apache/woden/wsdl20/fragids/BindingMessageReferencePart.java0000664000175000017500000000642011767656530025044 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20.fragids; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; /** * BindingMessageReferencePart is a Binding Message Reference Pointer Part for the Binding Message Reference WSDL 2.0 component. * See the specification at http://www.w3.org/TR/wsdl20/#wsdl.bindingMessageReference * * @author Dan Harvey (danharvey42@gmail.com) * */ public class BindingMessageReferencePart implements ComponentPart { private static final String emptyString = "".intern(); private final NCName binding; //Local name of the parent Binding component. private QName operation; //Name of the Interface Operation referred to the parent Binding Operation component. private final NCName message; //Message Label of the Interface Message Reference component referred to by this Binding Message Reference component. /** * Constructs a BindingMessageReferencePart class from the values given. * * @param binding the local name of the parent Binding component. * @param operation the name of the Interface Operation referred to by this Binding Operation component. * @param message the message label of the Interface Message Reference component referred to by this Binding Message Reference component. * @throws IllegalArgumentException if binding, operation or message are null. */ public BindingMessageReferencePart(NCName binding, QName operation, NCName message) { if (binding == null | operation == null | message == null) { throw new IllegalArgumentException(); } this.binding = binding; this.operation = operation; this.message = message; } public ComponentPart prefixNamespaces(FragmentIdentifier fragmentIdentifier) { return new BindingMessageReferencePart(binding, fragmentIdentifier.prefixQNameNamespace(operation), message); } /** * Returns a String of the serialised Binding Message Reference Pointer Part. * * @return a String the serialised Binding Message Reference Pointer Part. */ public String toString() { String operationString = (operation.getPrefix() != null && !operation.getPrefix().equals(emptyString) ? operation.getPrefix() + ":" + operation.getLocalPart() : operation.getLocalPart()); return "wsdl.bindingMessageReference(" + binding + "/" + operationString + "/" + message + ")"; } } ./src/org/apache/woden/wsdl20/NestedComponent.java0000664000175000017500000000333211767656530021204 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; /** * Represents a super-type of all WSDL Components which are 'nested' directly * or indirectly within the 'top-level' WSDL components; Interface, Binding * and Service. * This interface defines behaviour for retrieving the parent WSDL component. *

    * The nested WSDL components are: *

      *
    • InterfaceFault
    • *
    • InterfaceOperation
    • *
    • InterfaceFaultReference
    • *
    • InterfaceMessageReference
    • *
    • BindingFault
    • *
    • BindingOperation
    • *
    • BindingFaultReference
    • *
    • BindingMessageReference
    • *
    • Endpoint
    • *
    * * @author John Kaputin (jkaputin@apache.org) */ public interface NestedComponent extends WSDLComponent { /** * Returns a WSDLComponent representing the parent of this nested component. * * @return the parent WSDLComponent */ public WSDLComponent getParent(); } ./src/org/apache/woden/wsdl20/TypeDefinition.java0000664000175000017500000001051511767656530021032 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import javax.xml.namespace.QName; /** * Represents the TypeDefinition component described in the WSDL 2.0 component model * (within the Description Component section of the W3C WSDL 2.0 spec). * This component represents global data type definitions such as top-level, * named type definitions in W3C XML Schema (e.g. <xs:simpleType> or * <xs:complexType>). *

    * However, it does not mandate W3C XML Schema as the type system. * It defines behaviour to query the type system and the underlying content * model or API being used to represent the type definitions, and to * return a java.lang.Object representing the actual type definition object. * Based on the type system and content model, the application must cast this * Object to the appropriate type to manipulate its contents. *

    * Note that while TypeDefinition is described along with the Component model * in the W3C WSDL 2.0 specification, it is not a WSDL component itself. * It simply provides a way of representing components from the underlying type * system within the WSDL Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface TypeDefinition { /** * A constant representing the DOM API. This may be used to indicate the * content model of the underlying type definition. */ public static final String API_W3C_DOM = "org.w3c.dom"; /** * A constant representing the Apache WS-Commons XmlSchema API. This may be used to * indicate the content model of the underlying type definition. */ public static final String API_APACHE_WS_XS = "org.apache.ws.commons.schema"; /** * Representing the {name} property of the TypeDefinition component, this * method returns the qualified name of this TypeDefinition. * * @return the QName that identifies this TypeDefinition */ public QName getName(); /** * Representing the {system} property of the TypeDefinition component, this * method indicates the type system from which this type definition is derived. * For example, "http://www.w3.org/2001/XMLSchema" indicates the W3C XML Schema * type system. * * @return the URI identifying the type system */ public URI getSystem(); /** * Indicates the type of object model or API which should be used to * access the content of the underlying type definition. * This can be used to determine how to cast the Object returned by * the getContent() method. *

    * For example: *

      *
    • The content model "org.w3c.dom" indicates that the DOM API should be used, * so the type org.w3c.dom.Element will be used to represent the content of the * type definition. *
    • The content model "org.apache.ws.commons.schema" indicates that the * WS-Commons XmlSchema API from the Apache WebServices project is used, * so an org.apache.ws.commons.schema.XmlSchemaType will be used to represent the * content of the type definition. *
    * * @return a String identifying the type definition's content model */ public String getContentModel(); /** * Returns the underlying type definition as a java.lang.Object, which should * be cast to the appropriate type as indicated by the getContentModel() * method. * * @return the Object representing the content of the type definition */ public Object getContent(); } ./src/org/apache/woden/wsdl20/Interface.java0000664000175000017500000001503211767656530017777 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.xml.InterfaceElement; /** * Represents the Interface component from the WSDL 2.0 Component model. * Defines behaviour for accessing the WSDL components nested within * the Interface component, including those inherited via Interface extension. * * @author John Kaputin (jkaputin@apache.org) */ public interface Interface extends WSDLComponent { /** * Returns the qualified name representing the {name} property of this Interface. * * @return QName representing the name of this Interface */ public QName getName(); /** * Represents the {extended interfaces} property of the Interface component. * This is the set of declared Interface components that this Interface directly * extends, but does not include any Interfaces that those Interfaces extend. * The method will return an empty array if there are no extended interfaces. * * @return an array of Interface components */ public Interface[] getExtendedInterfaces(); /** * Return the named Interface from the {extended interfaces} property of this Interface. * That is, from the set of declared Interfaces that this Interface directly extends. * If null is specified for the name, this method will return null. * * @param interfaceName the qualified name of the required Interface * @return the named Interface */ public Interface getExtendedInterface(QName interfaceName); /** * Represents the {interface faults} property of the Interface component. This is the set of * interface faults declared directly by this interface, but not those defined by any * interfaces that this interface extends. * The method will return an empty array if there are no interface faults. * * @return array of InterfaceFault components */ public InterfaceFault[] getInterfaceFaults(); /** * Returns the InterfaceFault with the specified name from the {interface faults} * property of this Interface. That is, from the set of InterfaceFaults declared * directly by this Interface and excluding any inherited directly or indirectly * from extended Interfaces. * If the name parameter is null, this method will return null. * * @param faultName the qualified name of the InterfaceFault * @return the InterfaceFault object */ public InterfaceFault getInterfaceFault(QName faultName); /** * Returns the set of all InterfaceFault components available to this Interface, * which includes those declared by this Interface and those defined by any Interfaces * it extends, directly or indirectly. * The method will return an empty array if there are no interface faults. * * @return array of InterfaceFault components */ public InterfaceFault[] getAllInterfaceFaults(); /** * Returns the InterfaceFault with the specified name from the set of all InterfaceFaults * available to this Interface, which includes those declared by this Interface and those * defined by any Interfaces it extends, directly or indirectly. * If the name parameter is null, this method will return null. * * @param faultName the qualified name of the InterfaceFault * @return the InterfaceFault object */ public InterfaceFault getFromAllInterfaceFaults(QName faultName); /** * Represents the {interface operations} property of the Interface component. This is the set * of interface operations declared directly by this interface, but not those defined by any * interfaces that this interface extends. * The method will return an empty array if there are no interface operations. * * @return array of InterfaceOperation components */ public InterfaceOperation[] getInterfaceOperations(); /** * Returns the InterfaceOperation with the specified name from the {interface operations} * property of this Interface. That is, from the set of InterfaceOperations declared directly * by this Interface and excluding any inherited directly or indirectly from extended * Interfaces. * If the name parameter is null, this method will return null. * * @param operName the qualified name of the required InterfaceOperation * @return the InterfaceOperation object */ public InterfaceOperation getInterfaceOperation(QName operName); /** * Returns the set of all InterfaceOperation components available to this Interface, * which includes those declared by this Interface and those defined by the Interfaces * it extends, directly or indirectly. * The method will return an empty array if there are no interface operations. * * @return array of InterfaceOperation components */ public InterfaceOperation[] getAllInterfaceOperations(); /** * Returns the InterfaceOperation with the specified name from the set of all InterfaceOperations * available to this Interface, which includes those declared by this Interface and those * defined by any Interfaces it extends, directly or indirectly. * If the name parameter is null, this method will return null. * * @param operName the qualified name of the InterfaceOperation * @return the InterfaceOperation object */ public InterfaceOperation getFromAllInterfaceOperations(QName operName); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. * * @return the InterfaceElement that maps to this Interface */ public InterfaceElement toElement(); } ./src/org/apache/woden/wsdl20/Description.java0000664000175000017500000001500311767656530020360 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * Represents the Description component from the WSDL 2.0 Component model, * as described in the W3C WSDL 2.0 specification. It provides an abstract * view of a WSDL document by flattening the composite document structure created * by the use of <wsdl:import> or <wsdl:include> elements into a single * WSDL Description component containing the WSDL components declared within * the root <description> and within any imported or included descriptions. *

    * In other words, if a WSDL component model is derived from composite WSDL document * made up of WSDL imports or includes, then its Description component acts as a * container for all of the top-level WSDL components in the WSDL tree, starting with the * root <description> element. These top-level WSDL components include Interface, * Binding, Service, ElementDeclaration and TypeDefinition. * * @author John Kaputin (jkaputin@apache.org) */ public interface Description extends WSDLComponent { /** * Represents the {interfaces} property of the Description component. This is the set of * all interfaces available to the Description, including those that are declared in the * root WSDL document and any declared in included or imported WSDL documents. * * @return an array of Interface objects */ public Interface[] getInterfaces(); /** * Returns an Interface with the specified name from the {interfaces} property of this * Description. * * @param name the QName of the required Interface * @return an Interface with the specified name */ public Interface getInterface(QName name); /** * Represents the {bindings} property of the Description component. This is the set of * all bindings available to the Description, including those that are declared in the * root WSDL document and any declared in included or imported WSDL documents. * * @return an array of Binding objects */ public Binding[] getBindings(); /** * Returns a Binding with the specified name from the {bindings} property of this * Description. * * @param name the QName of the required Binding * @return a Binding with the specified name */ public Binding getBinding(QName name); /** * Represents the {services} property of the Description component. This is the set of * all services available to the Description, including those that are declared in the * root WSDL document and any declared in included or imported WSDL documents. * * @return an array of Service objects */ public Service[] getServices(); /** * Returns a Service with the specified name from the {services} property of this * Description. * * @param name the QName of the required Service * @return a Service with the specified name */ public Service getService(QName name); /** * Represents the {element declarations} property of the Description component. This is the set of * all global element declarations available to the Description, including those that are declared * by schemas inlined or imported by the root WSDL document and those declared by schemas inlined * or imported by WSDL documents that the root WSDL document includes or imports, directly or * indirectly. * * @return an array of ElementDeclaration objects */ public ElementDeclaration[] getElementDeclarations(); /** * Returns the ElementDeclaration with the specified name from the set of ElementDeclarations * represented by the {element declarations} property of this Description. * * @param name the QName of the required ElementDeclaration * @return the named ElementDeclaration */ public ElementDeclaration getElementDeclaration(QName name); /** * Represents the {type definitions} property of the Description component. This is the set of * all global type definitions available to the Description, including those that are defined * by schemas inlined or imported by the root WSDL document and those defined by schemas inlined * or imported by WSDL documents that the root WSDL document includes or imports, directly or * indirectly. * * @return an array of TypeDefinition objects */ public TypeDefinition[] getTypeDefinitions(); /** * Returns the TypeDefinition with the specified name from the set of TypeDefinitions * represented by the {type definitions} property of this Description. * * @param name the QName of the required TypeDefinition * @return the named TypeDefinition */ public TypeDefinition getTypeDefinition(QName name); /** * Returns a WSDLElement that represents the element information item from the WSDL 2.0 * infoset that maps to this WSDLComponent. *

    * The Description component is unlike other WSDL components which map neatly to a single * WSDL element. Description represents a 'flattened' view of the entire WSDL infoset tree, * including the WSDL components from any imported or included WSDL documents, so it could * contain the content of multiple <wsdl:description> elements. *

    * If the Component model has been derived from such a composite WSDL infoset, the behaviour * of this method is to return the DescriptionElement that represents the root * <wsdl:description> element. * * @return the DescriptionElement that maps to this Description */ public DescriptionElement toElement(); } ./src/org/apache/woden/wsdl20/ElementDeclaration.java0000664000175000017500000001070411767656530021637 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.wsdl20; import java.net.URI; import javax.xml.namespace.QName; /** * Represents the ElementDeclaration component described in the WSDL 2.0 component * model (within the Description Component section of the W3C WSDL 2.0 spec). * It describes the content of WSDL input, output and fault messages. * This component represents global element declarations such as top-level, * named element declarations in W3C XML Schema (i.e. <xs:element>). *

    * However, it does not mandate W3C XML Schema as the type system. * It defines behaviour to query the type system and the underlying content * model or API being used to represent the element declarations, and to * return a java.lang.Object representing the actual element declaration object. * Based on the type system and content model, the application must cast this * Object to the appropriate type to manipulate its contents. *

    * Note that while ElementDeclaration is described along with the Component model * in the W3C WSDL 2.0 specification, it is not a WSDL component itself. * It simply provides a way of representing components from the underlying type * system within the WSDL Component model. * * @author John Kaputin (jkaputin@apache.org) */ public interface ElementDeclaration { /** * A constant representing the DOM API. This may be used to indicate the * content model of the underlying element declaration. */ public static final String API_W3C_DOM = "org.w3c.dom"; /** * A constant representing the Apache WS-Commons XmlSchema API. This may be used to * indicate the content model of the underlying element declaration. */ public static final String API_APACHE_WS_XS = "org.apache.ws.commons.schema"; /** * Representing the {name} property of the ElementDeclaration component, this * method returns the qualified name of this ElementDeclaration. * * @return the QName that identifies this ElementDeclaration */ public QName getName(); /** * Representing the {system} property of the ElementDeclaration component, this * method indicates the type system from which this element declaration is derived. * For example, "http://www.w3.org/2001/XMLSchema" indicates the W3C XML Schema * type system. * * @return the URI identifying the type system */ public URI getSystem(); /** * Indicates the type of object model or API which should be used to * access the content of the underlying element declaration. * This can be used to determine how to cast the Object returned by * the getContent() method. *

    * For example: *

      *
    • The content model "org.w3c.dom" indicates that the DOM API should be used, * so the type org.w3c.dom.Element will be used to represent the content of the * element declaration. *
    • The content model "org.apache.ws.commons.schema" indicates that the * WS-Commons XmlSchema API from the Apache WebServices project is used, * so an org.apache.ws.commons.schema.XmlSchemaElement will be used to represent the * content of the element declaration. *
    * * @return a String identifying the element declaration's content model */ public String getContentModel(); /** * Returns the underlying element declaration as a java.lang.Object, which should * be cast to the appropriate type as indicated by the getContentModel() * method. * * @return the Object representing the content of the element declaration */ public Object getContent(); } ./src/org/apache/woden/WSDLWriter.java0000664000175000017500000000574411767656530016743 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.io.Writer; import java.io.OutputStream; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This interface describes a collection of methods * that allow a WSDL model to be written to a writer * in an XML format that follows the WSDL schema. * * Based on wsdl4j WSDLWriter. * *@author Sagara Gunathunga (sagara.gunathunga@gmail.com) */ public interface WSDLWriter { /** * Sets the specified feature to the specified value. *

    * There are no minimum features that must be supported. *

    * All feature names must be fully-qualified, Java package style. All * names starting with javax.wsdl. are reserved for features defined * by the JWSDL specification. It is recommended that implementation- * specific features be fully-qualified to match the package name * of that implementation. For example: com.abc.featureName * * @param name the name of the feature to be set. * @param value the value to set the feature to. * @throws IllegalArgumentException if the feature name is not recognized. * @see #getFeature(String) */ public void setFeature(String name, boolean value) throws IllegalArgumentException; /** * Gets the value of the specified feature. * * @param name the name of the feature to get the value of. * @return the value of the feature. * @throws IllegalArgumentException if the feature name is not recognized. * @see #setFeature(String, boolean) */ public boolean getFeature(String name) throws IllegalArgumentException; /** * Write the specified WSDL Description to the specified Writer. * * @param wsdlDes the WSDL description to be written. * @param sink the Writer to write the xml to. */ public void writeWSDL(DescriptionElement wsdlDes, Writer sink) throws WSDLException; /** * Write the specified WSDL Description to the specified OutputStream. * * @param wsdlDes the WSDL description to be written. * @param sink the OutputStream to write the xml to. */ public void writeWSDL(DescriptionElement wsdlDes, OutputStream sink) throws WSDLException; } ./src/org/apache/woden/WSDLFactory.java0000664000175000017500000001367211767656530017075 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * * Based on wsdl4j factory. * * @author jkaputin@apache.org */ public abstract class WSDLFactory { private static final String PROPERTY_NAME = "org.apache.woden.WSDLFactory"; private static final String PROPERTY_FILE_NAME = "wsdl.properties"; private static final String DEFAULT_FACTORY_IMPL_NAME = "org.apache.woden.internal.DOMWSDLFactory"; private static String fFullPropertyFileName = null; public static WSDLFactory newInstance() throws WSDLException { String factoryImplName = findFactoryImplName(); return newInstance(factoryImplName); } public static WSDLFactory newInstance(String factoryImplName) throws WSDLException { if (factoryImplName != null) { try { Class cl = Class.forName(factoryImplName); return (WSDLFactory)cl.newInstance(); } catch (Exception e) { /* Catches and wraps: ClassNotFoundException InstantiationException IllegalAccessException */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating a WSDLFactory implementation " + "using factory impl name '" + factoryImplName + "' ", e); } } else { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Unable to find the name of a WSDLFactory implementation class."); } } private static String findFactoryImplName() throws WSDLException { String factoryImplName = null; // First, check the system property. try { factoryImplName = System.getProperty(PROPERTY_NAME); if (factoryImplName != null) { return factoryImplName; } } catch (SecurityException e) { //TODO empty catch block copied from wsdl4j. Decide if OK to ignore? } // Second, check /META-INF/services //TODO put code here to check for factory impl name property in /META... // Third, check for a properties file on the system path. String propFileName = getFullPropertyFileName(); if (propFileName != null) { try { Properties properties = new Properties(); File propFile = new File(propFileName); FileInputStream fis = new FileInputStream(propFile); properties.load(fis); fis.close(); factoryImplName = properties.getProperty(PROPERTY_NAME); if (factoryImplName != null) { return factoryImplName; } } catch (FileNotFoundException e1) { // This just means no properties file was found. OK to ignore. } catch (IOException e) { /* * thrown by Properties.load if an error occurred when reading * from the input stream. */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem loading the properties file '" + propFileName + "' ", e); } catch (IllegalArgumentException e) { /* * thrown by Properties.load if the input stream contains a * malformed Unicode escape sequence. */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem with the content of the properties file '" + propFileName + "' ", e); } } // Fourth, return the default. return DEFAULT_FACTORY_IMPL_NAME; } private static String getFullPropertyFileName() { if (fFullPropertyFileName == null) { try { String javaHome = System.getProperty("java.home"); fFullPropertyFileName = javaHome + File.separator + "lib" + File.separator + PROPERTY_FILE_NAME; } catch (SecurityException e) { //TODO empty catch block copied from wsdl4j. Decide if OK to ignore? } } return fFullPropertyFileName; } public abstract WSDLWriter newWSDLWriter() throws WSDLException; public abstract WSDLReader newWSDLReader() throws WSDLException; public abstract DescriptionElement newDescription(); public abstract ExtensionRegistry newPopulatedExtensionRegistry() throws WSDLException; } ./src/org/apache/woden/ErrorReporter.java0000664000175000017500000001740111767656530017602 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.util.Locale; /** * Defines the approach for reporting errors that occur while parsing, * validating or * manipulating WSDL descriptions, such as XML parser errors or violations * of the rules defined in the WSDL specification. That is, errors that * relate specifically to the WSDL. It does not report system runtime * or configuration errors, which are instead treated as exceptions. *

    * There are four ways to report an error: *

    * An error id and an array of message arguments are used to produce * a formatted error message from some parameterized message text. * The error may be reported with an target exception or without one. *

    * An error id is specified with some ready-formatted message text. * The error may be reported with an target exception or without one. *

    * The error is handled according to the severity level * (warning, error or fatal error) reported with the error. *

    * The error reporter supports the 'en' (English) locale by default * and has a default error handler (i.e. a default implementation of * ErrorHandler). However, a different locale may be configured * via setLocale and a custom error handler implementation * may be configured as a system property. * * @author jkaputin@apache.org */ public interface ErrorReporter { public static final short SEVERITY_WARNING = 1; public static final short SEVERITY_ERROR = 2; public static final short SEVERITY_FATAL_ERROR = 3; /** * Insert the message arguments into a parameterized message identified * by errorId to produce a formatted error message, then report the * message and the error location in the document according to the * severity. * * @param errLoc ErrorLocator showing the location of the error in the document. * @param errorId String that identifies the message for this error. * @param arguments Object[] with values to be inserted into the message text. * @param severity a short indicating warning, error or fatal error. * * @throws WSDLException if the severity is fatal error */ public void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity) throws WSDLException; /** * Insert the message arguments into a parameterized message identified * by errorId to produce a formatted error message, then report the * message and the error location in the document according to the * severity. Also report the exception that caused this error. * * @param errLoc ErrorLocator showing the location of the error in the document. * @param errorId String that identifies the message for this error. * @param arguments Object[] with values to be inserted into the message text. * @param severity a short indicating warning, error or fatal error. * @param exception the Exception that caused this error * * @throws WSDLException if the severity is fatal error */ public void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity, Exception exception) throws WSDLException; /** * Report the message and the error location in the document according * to the severity. * * @param errLoc ErrorLocator showing the location of the error in the document. * @param errorId String that identifies the message for this error. * @param message message text. * @param severity a short indicating warning, error or fatal error. * * @throws WSDLException if the severity is fatal error */ public void reportError(ErrorLocator errLoc, String errorId, String message, short severity) throws WSDLException; /** * Report the message and the error location in the document according * to the severity. Also report the exception that caused this error. * * @param errLoc ErrorLocator showing the location of the error in the document. * @param errorId String that identifies the message for this error. * @param message message text. * @param severity a short indicating warning, error or fatal error. * @param exception the Exception that caused this error * * @throws WSDLException if the severity is fatal error */ public void reportError(ErrorLocator errLoc, String errorId, String message, short severity, Exception exception) throws WSDLException; /** * Set a custom error handler on this error reporter to replace the * default error handler. * * TODO: identify all use cases for setting the error handler and determine how best to * expose this on the API. Currently, just via WSDLReader.setLocale which supports * the 'read wsdl' use case, but others may include 'modify wsdl', * 'create wsdl programmatically' and maybe 'write wsdl'. * * @param errorHandler the custom error handler * */ public void setErrorHandler(ErrorHandler errorHandler); /** * Return the custom error handler if one has been set, * otherwise return the default error handler. * * @return the ErrorHandler used by this error reporter */ public ErrorHandler getErrorHandler(); /** * Set the Locale used for localization of error messages. * * TODO: identify all use cases for setting the locale and determine how best to * expose this on the API. Currently, just via WSDLReader.setLocale which supports * the 'read wsdl' use case, but others may include 'modify wsdl', * 'create wsdl programmatically' and maybe 'write wsdl'. * * @param locale the required locale * */ public void setLocale(Locale locale); /** * @return the Locale used for localization of error messages. */ public Locale getLocale(); /** * Returns a formatted message string for the specified message key and arguments. * Used for formatting messages that will not be reported by the error reporter as * parsing errors (via the reportError method). Typically these types of messages * will be for configuration or runtime errors that will be thrown as exceptions * by the caller. * If there are no message arguments, a null value may be specified for the * arguments parameter instead of an empty array. * * @param errorId a String representing the message key * @param arguments an Object array of message parameters * @return the formatted message string */ public String getFormattedMessage(String errorId, Object[] arguments); }./src/org/apache/woden/ErrorInfo.java0000664000175000017500000000251411767656530016672 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; /** * This interface describes the three types of errors * (warning, error and fatal error) that may be reported. * Implementations may choose to override the * toString() method inherited from java.lang.Object * to concatenate this information into format suitable for * reporting purposes. * * @author kaputin */ public interface ErrorInfo { public ErrorLocator getErrorLocator(); public String getKey(); public String getMessage(); public Exception getException(); }./src/org/apache/woden/ErrorLocator.java0000664000175000017500000000240111767656530017375 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; /** * Represents the location of a parsing error within an XML document. *

    * TODO decide if URI info of the document is needed, * and maybe XPATH of the element or attribute in error. * * @author John Kaputin (jkaputin@apache.org) */ public interface ErrorLocator { public String getDocumentBaseURI(); public String getLocationURI(); public int getLineNumber(); public int getColumnNumber(); } ./src/org/apache/woden/ErrorHandler.java0000664000175000017500000000274611767656530017363 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; /** * This interface declares operations for handling three types * of errors; warnings, errors and fatal errors. Implementations should define * behaviour for these types of errors appropriate to their requirements. * For example, errors may be reported immediately by printing to the system * output stream or they may be cached for further processing by the invoking * application. * * This is based on the Xerces error reporter. * * @author jkaputin@apache.org */ public interface ErrorHandler { public void warning(ErrorInfo errorInfo); public void error(ErrorInfo errorInfo); public void fatalError(ErrorInfo errorInfo); } ./src/org/apache/woden/xml/0000775000175000017500000000000011767656530014720 5ustar brianbrian./src/org/apache/woden/xml/StringAttr.java0000664000175000017500000000224711767656530017671 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; /** * This interface represents XML attribute information items of type xs:string. * If the object is initialized with a null value, the getContents() and getString() * methods will return null and isValid() will return false. * * @author jkaputin@apache.org */ public interface StringAttr extends XMLAttr { public String getString(); } ./src/org/apache/woden/xml/URIAttr.java0000664000175000017500000000227611767656530017064 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import java.net.URI; /** * This interface represents XML attribute information items of type xs:anyURI. * If the attribute value cannot be converted into a java.net.URI the getContent() * and getURI() methods will return null and isValid() will return false. * * @author jkaputin@apache.org */ public interface URIAttr extends XMLAttr { public URI getURI(); } ./src/org/apache/woden/xml/QNameListOrTokenAttr.java0000664000175000017500000000432411767656530021560 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; /** * This interface represents XML attribute information items of type * 'Union of list of xs:QName or xs:token', for example * the wsoap:subcodes extension attribute of binding <fault>. *

    * The isQNameList method can be used to determine whether * to call the getQNames method or the getToken * method. If the implementor object is initialized with a list of QNames, * isQNameList will return 'true', getQNames * will return an array of QName objects and getToken will return * null. If it is initialized with a xs:token, isQNameList will * return 'false', getQNames will return null and * getToken will return the token string. *

    * If the implementor object is initialized with a null value (i.e. because * of an attribute value conversion error or because the attribute value * was empty in the WSDL), the getContents, * getQNameList and getToken methods will return null * and isQNameList and isValid will return false. * * @author jkaputin@apache.org */ public interface QNameListOrTokenAttr extends XMLAttr { public boolean isQNameList(); public boolean isToken(); public QName[] getQNames(); public String getToken(); } ./src/org/apache/woden/xml/ArgumentArrayAttr.java0000664000175000017500000000240611767656530021201 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import org.apache.woden.wsdl20.extensions.rpc.Argument; /** * This interface represents an XML attribute information items whose type * is a list of pairs (xs:QName, xs:token) that obey the contraints of * wrpc:signature as defined in Part 2 of the WSDL 2.0 spec. * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public interface ArgumentArrayAttr extends XMLAttr { public Argument[] getArgumentArray(); } ./src/org/apache/woden/xml/TokenAttr.java0000664000175000017500000000251611767656530017502 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; /** * This interface represents XML attribute information items of type xs:token. * If the object is initialized with a null value, the getContents() and getToken() * methods will return null and isValid() will return false. * * TODO create org.apache.woden.types.Token based on the same class in org.apache.axis.types * and modify the getToken method here to return Token instead of String. * * @author jkaputin@apache.org */ public interface TokenAttr extends XMLAttr { public String getToken(); } ./src/org/apache/woden/xml/BooleanAttr.java0000664000175000017500000000227711767656530020005 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; /** * This interface represents XML attribute information items of type xs:boolean. * If the attribute value is not "true" or "false" the Boolean content will * be initialized to "false" by default, but the isValid() method will * return "false". * * @author jkaputin@apache.org */ public interface BooleanAttr extends XMLAttr { public Boolean getBoolean(); } ./src/org/apache/woden/xml/QNameListAttr.java0000664000175000017500000000301411767656530020251 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; /** * This interface represents XML attribute information items of type * xs:list of QNames. The string is converted into a collection of QNames, * one for each valid name in the string. The QNames can be retrieved as an * array of QName. If an error occurs converting a QName it will not be included * in the array and the isValid() method will return false (even if there are * some valid QNames in the list). If no qnames can be converted from the string, * getContent() and getQNames() will return null and isValid() will return false. * * @author jkaputin@apache.org */ public interface QNameListAttr extends XMLAttr { public QName[] getQNames(); } ./src/org/apache/woden/xml/XMLAttr.java0000664000175000017500000000315211767656530017057 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; /** * This interface represents an XML attribute information item. It can be initialized * with the string value of an attribute and the implementation must convert the string into * an object of the appropriate type. The getContent() method will return the converted * Object and the caller must cast this to the appropriate type. * If a conversion error occured because the string was not in the correct form, * the isValid() method will return false. The toExternalForm() method will return the * attribute's original string value. * * @author jkaputin@apache.org */ public interface XMLAttr { public QName getAttributeType(); public Object getContent(); public String toExternalForm(); public boolean isValid(); } ./src/org/apache/woden/xml/QNameAttr.java0000664000175000017500000000233611767656530017423 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; /** * This interface represents XML attribute information items of type xs:QName. * If the attribute's string value cannot be converted into a QName object the * getContent() and getQName() methods will return null and isValid() will return * false. * * @author jkaputin@apache.org */ public interface QNameAttr extends XMLAttr { public QName getQName(); } ./src/org/apache/woden/xml/QNameOrTokenAttr.java0000664000175000017500000000422411767656530020723 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; /** * This interface represents XML attribute information items of type * 'Union of xs:QName or xs:token', for example * the wsoap:code extension attribute of binding <fault>. *

    * The isQName method can be used to determine whether * to call the getQName method or the getToken * method. If the implementor object is initialized with a QName, * isQName will return 'true', getQName * will return the QName object and getToken will return * null. If it is initialized with a xs:token, isQName will * return 'false', getQName will return null and * getToken will return the token string. *

    * If the implementor object is initialized with a null value (i.e. because * of an attribute value conversion error or because the attribute value * was empty in the WSDL), the getContents, * getQName and getToken methods will return null * and isQName and isValid will return false. * * @author jkaputin@apache.org */ public interface QNameOrTokenAttr extends XMLAttr { public boolean isQName(); public boolean isToken(); public QName getQName(); public String getToken(); } ./src/org/apache/woden/xml/UnknownAttr.java0000664000175000017500000000460111767656530020056 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; /** * This class represents extension attributes (those not in the WSDL namespace) * that do not have a Java type registered in the Extension Registry. * It treats the attribute's value as a string. * * @author jkaputin@apache.org */ public class UnknownAttr implements XMLAttr { private QName fAttrType = null; private Object fContent = null; private String fExternalForm = null; private boolean fValid = true; private ErrorReporter fErrorReporter = null; public UnknownAttr(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { fErrorReporter = errRpt; fAttrType = attrType; fExternalForm = attrValue; fContent = attrValue; if(fContent == null) { fValid = false; } } /* (non-Javadoc) * @see org.apache.woden.xml.XMLAttr#getAttributeType() */ public QName getAttributeType() { return fAttrType; } /* (non-Javadoc) * @see org.apache.woden.xml.XMLAttr#getContent() */ public Object getContent() { return fContent; } /* (non-Javadoc) * @see org.apache.woden.xml.XMLAttr#toExternalForm() */ public String toExternalForm() { return fExternalForm; } /* (non-Javadoc) * @see org.apache.woden.xml.XMLAttr#isValid() */ public boolean isValid() { return fValid; } } ./src/org/apache/woden/xml/HTTPAuthenticationSchemeAttr.java0000664000175000017500000000224711767656530023227 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme; /** * This interface represents the value of the whttp:authenticationScheme * attribute. * * @author Arthur Ryman (ryman@ca.ibm.ca, arthur.ryman@gmail.com) * */ public interface HTTPAuthenticationSchemeAttr extends XMLAttr { HTTPAuthenticationScheme getScheme(); } ./src/org/apache/woden/xml/IntOrTokenAttr.java0000664000175000017500000000430411767656530020453 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xml; /** * This interface represents XML attribute information items of type * 'Union of xs:int, xs:token', for example * the whttp:code extension attribute of binding <fault>. *

    * The isInt and isToken methods determine whether * to call the getInt or getToken methods. * If the implementor object is initialized with an int, * isInt will return 'true', isToken will return * 'false', getInt will return the int value and getToken * will return null. If it is initialized with an xs:token, isInt * will return 'false', isToken will return 'true', getInt * will return null and getToken will return the token string. *

    * If the implementor object is initialized with a null value (i.e. because * of an attribute value conversion error or because the attribute value * was empty in the WSDL), the getContents, getInt * and getToken methods will return null and isInt, * isToken and isValid will return false. * * @author jkaputin@apache.org */ public interface IntOrTokenAttr extends XMLAttr { public boolean isInt(); public boolean isToken(); public Integer getInt(); public String getToken(); } ./src/org/apache/woden/types/0000775000175000017500000000000011767656530015264 5ustar brianbrian./src/org/apache/woden/types/NamespaceDeclaration.java0000664000175000017500000000315711767656530022177 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.types; import java.net.URI; /** * Represents an XML namespace declaration, consisting of a namespace prefix * and a namespace URI. This is an immutable class. * * @author John Kaputin (jkaputin@apache.org) */ public class NamespaceDeclaration { public static final String XMLNS_NS_STRING = "http://www.w3.org/2000/xmlns/"; public static final URI XMLNS_NS_URI = URI.create("http://www.w3.org/2000/xmlns/"); private final String prefix; private final URI namespaceURI; public NamespaceDeclaration(String prefix, URI namespaceURI) { this.prefix = prefix; this.namespaceURI = namespaceURI; } public String getPrefix() { return this.prefix; } public URI getNamespaceURI() { return this.namespaceURI; } } ./src/org/apache/woden/types/QNameTokenUnion.java0000664000175000017500000000620511767656530021145 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.types; import javax.xml.namespace.QName; /** * This class represents the data type "Union of xs:QName and xs:Token" * where the token values are #any, #none, or #other. * * @author Dan Harvey, danharvey42@gmail.com * */ public class QNameTokenUnion { private final QName qname; private final String token; public static final QNameTokenUnion ANY = new QNameTokenUnion("#any"); public static final QNameTokenUnion NONE = new QNameTokenUnion("#none"); public static final QNameTokenUnion OTHER = new QNameTokenUnion("#other"); /* * Constructs a QNameTokenUnion as a 'token' type with the specified token value. * This constructor has been declared private so that it cannot be used to specify * arbitrary tokens. It is used only to create an enumeration of static variables * representing the token types #any, #none and #other. */ private QNameTokenUnion(String token) { this.token = token.intern(); this.qname = null; } /** * Constructs a QNameTokenUnion as a 'QName' type with the specified qname value. * The qname parameter must not be null. * * @param qname the QName to set as its value. * @throws NullPointerException if qname is null */ public QNameTokenUnion(QName qname) { if (qname != null) { this.qname = qname; this.token = null; } else { throw new NullPointerException("QName=null"); } } /** * Returns the QName if it exists otherwise null. * * @return a QName if it exists otherwise null. */ public QName getQName() { return qname; } /** * Returns the token value if it exists otherwise null. * * @return a String value of the token if it exists otherwise null. */ public String getToken() { return token; } /** * Returns True if a QName exists, otherwise it returns False; * * @return a boolean representing if this has a QName value. */ public boolean isQName() { return qname != null; } /** * Returns True is a token value exists, otherwise it returns False. * * @return a boolean representing if this has a token value. */ public boolean isToken() { return token != null; } } ./src/org/apache/woden/types/XMLChar.java0000664000175000017500000005476511767656530017406 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.types; /** * This class defines the basic XML character properties. The data * in this class can be used to verify that a character is a valid * XML character or if the character is a space, name start, or name * character. *

    * This class has been copied from Axis into Woden to support the NCName class. *

    * A series of convenience methods are supplied to ease the burden * of the developer. Because inlining the checks can improve per * character performance, the tables of character properties are * public. Using the character as an index into the CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. * * @author Glenn Marcy, IBM * @author Andy Clark, IBM * @author Eric Ye, IBM * @author Arnaud Le Hors, IBM * @author Rahul Srivastava, Sun Microsystems Inc. */ public class XMLChar { // // Constants // /** Character flags. */ private static final byte[] CHARS = new byte[1 << 16]; /** Valid character mask. */ public static final int MASK_VALID = 0x01; /** Space character mask. */ public static final int MASK_SPACE = 0x02; /** Name start character mask. */ public static final int MASK_NAME_START = 0x04; /** Name character mask. */ public static final int MASK_NAME = 0x08; /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; /** * Content character mask. Special characters are those that can * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

    * This is an optimization for the inner loop of character scanning. */ public static final int MASK_CONTENT = 0x20; /** NCName start character mask. */ public static final int MASK_NCNAME_START = 0x40; /** NCName character mask. */ public static final int MASK_NCNAME = 0x80; // // Static initialization // static { // // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | // [#xE000-#xFFFD] | [#x10000-#x10FFFF] // int charRange[] = { 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD, }; // // [3] S ::= (#x20 | #x9 | #xD | #xA)+ // int spaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; // // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | // CombiningChar | Extender // int nameChar[] = { 0x002D, 0x002E, // '-' and '.' }; // // [5] Name ::= (Letter | '_' | ':') (NameChar)* // int nameStartChar[] = { 0x003A, 0x005F, // ':' and '_' }; // // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] // int pubidChar[] = { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; int pubidRange[] = { 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A }; // // [84] Letter ::= BaseChar | Ideographic // int letterRange[] = { // BaseChar 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E, 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217, 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1, 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C, 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4, 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5, 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA, 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7, 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6, 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990, 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD, 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10, 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36, 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B, 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3, 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28, 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D, 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95, 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA, 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10, 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61, 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3, 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10, 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E, 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88, 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB, 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47, 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103, 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155, 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF, 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9, 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D, 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC, 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB, 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B, 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C, 0xAC00, 0xD7A3, // Ideographic 0x3021, 0x3029, 0x4E00, 0x9FA5, }; int letterChar[] = { // BaseChar 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, 0x1F5D, 0x1FBE, 0x2126, 0x212E, // Ideographic 0x3007, }; // // [87] CombiningChar ::= ... // int combiningCharRange[] = { 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1, 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652, 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954, 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8, 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48, 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43, 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83, 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03, 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56, 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD, 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48, 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9, 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84, 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7, 0x20D0, 0x20DC, 0x302A, 0x302F, }; int combiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; // // [88] Digit ::= ... // int digitRange[] = { 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F, 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F, 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F, 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, }; // // [89] Extender ::= ... // int extenderRange[] = { 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE, }; int extenderChar[] = { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; // // SpecialChar ::= '<', '&', '\n', '\r', ']' // int specialChar[] = { '<', '&', '\n', '\r', ']', }; // // Initialize // // set valid characters for (int i = 0; i < charRange.length; i += 2) { for (int j = charRange[i]; j <= charRange[i + 1]; j++) { CHARS[j] |= MASK_VALID | MASK_CONTENT; } } // remove special characters for (int i = 0; i < specialChar.length; i++) { CHARS[specialChar[i]] = (byte)(CHARS[specialChar[i]] & ~MASK_CONTENT); } // set space characters for (int i = 0; i < spaceChar.length; i++) { CHARS[spaceChar[i]] |= MASK_SPACE; } // set name start characters for (int i = 0; i < nameStartChar.length; i++) { CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } for (int i = 0; i < letterRange.length; i += 2) { for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) { CHARS[j] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } } for (int i = 0; i < letterChar.length; i++) { CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } // set name characters for (int i = 0; i < nameChar.length; i++) { CHARS[nameChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < digitRange.length; i += 2) { for (int j = digitRange[i]; j <= digitRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharRange.length; i += 2) { for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharChar.length; i++) { CHARS[combiningCharChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < extenderRange.length; i += 2) { for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < extenderChar.length; i++) { CHARS[extenderChar[i]] |= MASK_NAME | MASK_NCNAME; } // remove ':' from allowable MASK_NCNAME_START and MASK_NCNAME chars CHARS[':'] &= ~(MASK_NCNAME_START | MASK_NCNAME); // set Pubid characters for (int i = 0; i < pubidChar.length; i++) { CHARS[pubidChar[i]] |= MASK_PUBID; } for (int i = 0; i < pubidRange.length; i += 2) { for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) { CHARS[j] |= MASK_PUBID; } } } // () // // Public static methods // /** * Returns true if the specified character is a supplemental character. * * @param c The character to check. */ public static boolean isSupplemental(int c) { return (c >= 0x10000 && c <= 0x10FFFF); } /** * Returns true the supplemental character corresponding to the given * surrogates. * * @param h The high surrogate. * @param l The low surrogate. */ public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; } /** * Returns the high surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char highSurrogate(int c) { return (char) (((c - 0x00010000) >> 10) + 0xD800); } /** * Returns the low surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char lowSurrogate(int c) { return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); } /** * Returns whether the given character is a high surrogate * * @param c The character to check. */ public static boolean isHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDBFF); } /** * Returns whether the given character is a low surrogate * * @param c The character to check. */ public static boolean isLowSurrogate(int c) { return (0xDC00 <= c && c <= 0xDFFF); } /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

    * If the program chooses to apply the mask directly to the * CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isValid(int c) { return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isValid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean /** * Returns true if the specified character can be considered content. * * @param c The character to check. */ public static boolean isContent(int c) { return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isContent(int):boolean /** * Returns true if the specified character can be considered markup. * Markup characters include '<', '&', and '%'. * * @param c The character to check. */ public static boolean isMarkup(int c) { return c == '<' || c == '&' || c == '%'; } // isMarkup(int):boolean /** * Returns true if the specified character is a space character * as defined by production [3] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isSpace(int c) { return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0; } // isSpace(int):boolean /** * Returns true if the specified character is a space character * as amdended in the XML 1.1 specification. * * @param c The character to check. */ public static boolean isXML11Space(int c) { return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) || c == 0x85 || c == 0x2028; } // isXML11Space(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [5] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; } // isNameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; } // isName(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; } // isNCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; } // isNCName(int):boolean /** * Returns true if the specified character is a valid Pubid * character as defined by production [13] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isPubid(int c) { return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; } // isPubid(int):boolean /* * [5] Name ::= (Letter | '_' | ':') (NameChar)* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) return false; char ch = name.charAt(0); if( isNameStart(ch) == false) return false; for (int i = 1; i < name.length(); i++ ) { ch = name.charAt(i); if( isName( ch ) == false ){ return false; } } return true; } // isValidName(String):boolean /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) return false; char ch = ncName.charAt(0); if( isNCNameStart(ch) == false) return false; for (int i = 1; i < ncName.length(); i++ ) { ch = ncName.charAt(i); if( isNCName( ch ) == false ){ return false; } } return true; } // isValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) return false; for (int i = 0; i < nmtoken.length(); i++ ) { char ch = nmtoken.charAt(i); if( ! isName( ch ) ){ return false; } } return true; } // isValidName(String):boolean // encodings /** * Returns true if the encoding name is a valid IANA encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * IANA encoding name. * * @param ianaEncoding The IANA encoding name. */ public static boolean isValidIANAEncoding(String ianaEncoding) { if (ianaEncoding != null) { int length = ianaEncoding.length(); if (length > 0) { char c = ianaEncoding.charAt(0); if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { for (int i = 1; i < length; i++) { c = ianaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } } return false; } // isValidIANAEncoding(String):boolean /** * Returns true if the encoding name is a valid Java encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * Java encoding name. * * @param javaEncoding The Java encoding name. */ public static boolean isValidJavaEncoding(String javaEncoding) { if (javaEncoding != null) { int length = javaEncoding.length(); if (length > 0) { for (int i = 1; i < length; i++) { char c = javaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } return false; } // isValidIANAEncoding(String):boolean } // class XMLChar ./src/org/apache/woden/types/NCName.java0000664000175000017500000000670611767656530017241 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.types; /** * This class represents the data type NCName use for XML non-colonized names. * It is based on the class of the same name in Apache Axis. * * @author jkaputin@apache.org */ public class NCName { static public boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan=0; scan < stValue.length(); scan++) { if (scan == 0) bValid = XMLChar.isNCNameStart(stValue.charAt(scan)); else bValid = XMLChar.isNCName(stValue.charAt(scan)); if (bValid == false) break; } return bValid; } private String fValue = null; /** * * @param value String representing an NCName * @throws IllegalArgumentException if value is not a valid NCName */ public NCName(String value) { if (value == null) { throw new IllegalArgumentException(); } setValue(value); } /** * * @param value String representing an NCName * @throws IllegalArgumentException if value is not a valid NCName */ public void setValue(String value) { if(!NCName.isValid(value)) { //TODO use ErrorReporter.getFormattedMessage() here instead of hardcoded message. //Need to implement a suitable accessor for ErrorReporter first (e.g. factory or singleton). throw new IllegalArgumentException("The string \"" + value + "\" does not represent a valid NCName."); } fValue = value; } public String toString() { return fValue; } public boolean equals(Object that) { // If the two object ids are the same then comparing with itself if (this==that) return true; // if 'that' isn't an instance of NCName then not equal. // implicitly tests for 'that' being null if (!(that instanceof NCName)) return false; NCName thatN = (NCName)that; // NCName's value can be null so if both fValues are null they are equal if (this.fValue == null && thatN.fValue == null) return true; // if either the fValues are null then the other one isn't so return false if (this.fValue == null || thatN.fValue == null) return false; // Now that neither fValues are null, compare them if (this.fValue.equals(thatN.fValue)) return true; return false; } public int hashCode() { return fValue.hashCode(); } } ./src/org/apache/woden/XMLElement.java0000664000175000017500000001114211767656530016734 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.net.URI; import javax.xml.namespace.QName; /** * This interface represents an XML element information item in a format to * be interpreted by the Woden implementation. * It permits different representations of an element to be used as method * arguments or return values without making the Woden API dependent on * any particular XML parser or XML object model. * * @author John Kaputin (jkaputin@apache.org) */ public interface XMLElement { /** * Accepts an Object representing an XML element. The implementation should * check that it is of a type appropriate for the underlying XML parser or * XML Object model being used. For example, a DOM implementation might expect * an org.w3c.dom.Element while an AXIOM implementation might expect * org.apache.axiom.om.OMElement. * * @param elem the Object representing the XML element * * @throws IllegalArgumentException if elem is not a type supported by the implementation. */ public void setSource(Object elem); /** * Returns an Object representing an XML element, which the caller must * cast to the expected type. For example, for DOM implementation we might * cast it to an org.w3c.dom.Element whereas an AXIOM implementation might * cast it to an org.apache.axiom.om.OMElement. * * @return an Object representing the XML element */ public Object getSource(); /* ********************************************************************** * Methods for Accessing the contents of the element * **********************************************************************/ /* TODO This method is not yet needed but can be added if it's required. * It will require the creation of XMLAttribute with the methods getLocalName, * getNamespaceURI, getPrefix and getValue. Then, the parseExtensionAttributes * method can be refactored into BaseWSDLReader. Will also need to consider * overlap/synergy with the XMLAttr classes used for extension attributes. * * @return a list of attributes associated with the XML element * public XMLAttribute[] getAttributes(); */ /** * Returns the value of the specified attribute or null if it is not found. * * @param attrName name of attribute to look for * @return the attribute value including prefix if present */ public String getAttributeValue(String attrName); /** * * @return the namespace URI of the element or null if it has no namespace */ public URI getNamespaceURI() throws WSDLException; /** * * @return the local name of the element */ public String getLocalName(); /** * Return the qualified name of this element. * * @return QName this element's qualified name. */ public QName getQName(); /** * Return the qualified name from the specified prefixed value. * * @param prefixedValue of the form [namespace prefix]:[local name] * @return the QName corresponding to the prefix * @throws WSDLException */ public QName getQName(String prefixedValue) throws WSDLException; /** * Return the first child element of this element or null if no * children are found. * * @return the first child element. */ public XMLElement getFirstChildElement(); /** * Return the next sibling element of this element or null if no * siblings are found. * * @return the next sibling element. */ public XMLElement getNextSiblingElement(); /** * Return an array of the child elements of this element or * an empty array if no siblings are found. * * @return an XMLElement array containing the child elements. */ public XMLElement[] getChildElements(); } ./src/org/apache/woden/WSDLSource.java0000664000175000017500000000671011767656530016721 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.net.URI; /** * This interface represents WSDL source in a format to be interpreted by the * WSDLReader implementation. It permits WSDL source in various forms to be * passed to the WSDLReader without making the WSDLReader API dependent on * any particular XML parser or XML object model. *

    * Each concrete implementation of WSDLReader will have a concrete implementation * of WSDLSource that can handle the types of WSDL source formats that are * compatible with the WSDLReader implementation. For example, a DOM-based * implementation of WSDLReader will return a DOM-based implementation of * WSDLSource via its WSDLReader.createWSDLSource method and this * DOM-based WSDLSource implemenation will accept as WSDL source an * org.w3c.dom.Element or org.w3c.dom.Document object via its * WSDLSource.setSource method. *

    * The WSDL source is set via the setSource(java.lang.Object) * method. Runtime type safety should be provided in the implementation of * the setSource method, which should check that the Object * argument is of a type compatible with the WSDLReader implementation that * created the WSDLSource object. *

    * Programming example: *

     *   //wsdlURI is the URI of the base wsdl document.
     *   //domReader is a DOM-based implementation of WSDLReader
     *   //domElement is an org.w3c.dom.Element representing a <wsdl:description> element.
     * 
     *   WSDLSource wsdlSource = domReader.createWSDLSource();
     *   wsdlSource.setBaseURI(wsdlURI);
     *   wsdlSource.setSource(domElement);
     *   DescriptionElement desc = reader.readWSDL(wsdlSource);
     * 
    * * @author John Kaputin (jkaputin@apache.org) */ public interface WSDLSource { /** * Store the specified source object representing the WSDL. * * @param wsdlSource the WSDL source object * * @throws IllegalArgumentException if the specified object type is not * recognized by the WSDLSource implementation. */ public void setSource(Object wsdlSource); /** * Returns the implementation specific object representing the WSDL source * (for example, a DOM Element or Document or an Axiom OMElement). The caller should * cast this object to the appropriate type to use its interface. * * @return the Object representing the WSDL source */ public Object getSource(); /** * Store the base URI of the WSDL source document. * * @param baseURI the URI of the WSDL document. */ public void setBaseURI(URI baseURI); /** * * @return the base URI of the WSDL */ public URI getBaseURI(); } ./src/org/apache/woden/internal/0000775000175000017500000000000011767656530015734 5ustar brianbrian./src/org/apache/woden/internal/DOMWSDLReader.java0000664000175000017500000012461111767656530021040 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Hashtable; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.WSDLReader; import org.apache.woden.WSDLSource; import org.apache.woden.XMLElement; import org.apache.woden.internal.resolver.DOMSchemaResolverAdapter; import org.apache.woden.internal.resolver.EntityResolverAdapter; import org.apache.woden.internal.schema.ImportedSchemaImpl; import org.apache.woden.internal.schema.InlinedSchemaImpl; import org.apache.woden.internal.schema.SchemaConstants; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.internal.wsdl20.validation.WSDLComponentValidator; import org.apache.woden.internal.wsdl20.validation.WSDLDocumentValidator; import org.apache.woden.internal.wsdl20.validation.WSDLValidator; import org.apache.woden.internal.xpointer.DOMXMLElementEvaluator; import org.apache.woden.schema.Schema; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.ImportElement; import org.apache.woden.wsdl20.xml.IncludeElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.XMLAttr; import org.apache.woden.xpointer.InvalidXPointerException; import org.apache.woden.xpointer.XPointer; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.apache.ws.commons.schema.XmlSchemaException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * Implements the WSDLReader behaviour for DOM-based parsing. * * @author John Kaputin (jkaputin@apache.org) */ public class DOMWSDLReader extends BaseWSDLReader { private static final String emptyString = "".intern(); static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; // TODO: This external schema location should be removed once an URI resolution framework // with a catalog is added to Woden. static final String WSDL120_SCHEMA_SOURCE = "http://www.w3.org/2007/03/wsdl/wsdl20.xsd"; static final String WSDL120_EXTENSIONS_SCHEMA_SOURCE = "http://www.w3.org/2007/03/wsdl/wsdl20-extensions.xsd"; static final String W3C_XML_SCHEMA_SCHEMA_SOURCE = "http://www.w3.org/2001/XMLSchema.xsd"; static final String[] schemas = { WSDL120_SCHEMA_SOURCE, WSDL120_EXTENSIONS_SCHEMA_SOURCE, W3C_XML_SCHEMA_SCHEMA_SOURCE, }; /** SLF based logger. */ private static final Log logger=LogFactory.getLog(DOMWSDLReader.class); //a map of imported schema definitions keyed by schema location URI private Map fImportedSchemas = new Hashtable(); /** * WSDL document validator. Only one instance is needed. */ private WSDLDocumentValidator docValidator = null; /** * WSDL component validator. Only one instance is needed. */ private WSDLComponentValidator compValidator = null; DOMWSDLReader(WSDLContext wsdlContext) throws WSDLException { super(wsdlContext); } /* ************************************************************ * API public methods * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.WSDLReader#createWSDLSource() */ public WSDLSource createWSDLSource() { return new DOMWSDLSource(getErrorReporter()); } /* * @see org.apache.woden.WSDLReader#readWSDL(String) */ public Description readWSDL(String wsdlURI) throws WSDLException { URL url; try { url = StringUtils.getURL(null, wsdlURI); } catch (MalformedURLException e) { String msg = getErrorReporter().getFormattedMessage( "WSDL516", new Object[] {wsdlURI}); throw new WSDLException(WSDLException.PARSER_ERROR, msg, e); } String wsdlURL = url.toString(); // ensure InputSource runs thru the URI Resolver InputSource inputSource = new InputSource(resolveURI(wsdlURL)); return readWSDL(wsdlURL, inputSource); } /* (non-Javadoc) * @see org.apache.woden.WSDLReader#readWSDL(org.apache.woden.WSDLSource) */ public Description readWSDL(WSDLSource wsdlSource) throws WSDLException { //TODO decide on how to handle null args in readWSDL methods (e.g. //IllegalArgExc, WSDLExc, return null, etc). Object source = wsdlSource.getSource(); URI baseURI = wsdlSource.getBaseURI(); String wsdlURL = null; if(baseURI != null) { URL url; try { url = StringUtils.getURL(null, baseURI.toString()); } catch (MalformedURLException e) { String msg = getErrorReporter().getFormattedMessage( "WSDL516", new Object[] {baseURI.toString()}); throw new WSDLException(WSDLException.PARSER_ERROR, msg, e); } wsdlURL = url.toString(); } if(source instanceof Element) { return readWSDL(wsdlURL, (Element)source); } else if(source instanceof Document) { return readWSDL(wsdlURL, (Document)source); } else if(source instanceof InputSource) { return readWSDL(wsdlURL, (InputSource)source); } else { //This exception is checked in WSDLSource.setSource but we check //again here in case the wrong type of WSDLSource has been used //with this type of WSDLReader. String sourceClass = source.getClass().getName(); String readerClass = this.getClass().getName(); String msg = getErrorReporter().getFormattedMessage( "WSDL017", new Object[] {sourceClass, readerClass}); throw new WSDLException(WSDLException.PARSER_ERROR, msg); } } /* * Helper method for readWSDL(WSDLSource) */ private Description readWSDL(String wsdlURL, Element docEl) throws WSDLException { XMLElement descEl = createXMLElement(docEl); DescriptionElement descElem = parseDescription(wsdlURL, descEl, null); Description descComp = descElem.toComponent(); //TODO if schema errors, don't do any further validation (i.e. assertions assume WSDL is schema valid) // Validate the model if validation is enabled. if(features.getValue(WSDLReader.FEATURE_VALIDATION)) { /* if(docValidator == null) { docValidator = new WSDLDocumentValidator(); } if(docValidator.validate(descElem, getErrorReporter())) { if(compValidator == null) { compValidator = new WSDLComponentValidator(); } compValidator.validate(descComp, getErrorReporter()); } */ (new WSDLValidator()).validate(descComp, fWsdlContext); } return descComp; } /* * Helper method for readWSDL(WSDLSource) */ private Description readWSDL(String wsdlURI, Document domDoc) throws WSDLException { //Try to find an element the XPointer points to if a Fragment Identifier exists. URI uri = null; try { uri = new URI(wsdlURI); } catch (URISyntaxException e) { String msg = getErrorReporter().getFormattedMessage( "WSDL506", new Object[] {null, wsdlURI}); throw new WSDLException(WSDLException.PARSER_ERROR, msg, e); } String fragment = uri.getFragment(); if (fragment == null) { //No fragment identifier so just use the root element. return readWSDL(wsdlURI, domDoc.getDocumentElement());//Use document root if no WSDL20 root found. } else { XPointer xpointer; try { xpointer = new XPointer(fragment); } catch(InvalidXPointerException e) { String msg = getErrorReporter().getFormattedMessage( "WSDL530", new Object[] {fragment, wsdlURI}); throw new WSDLException(WSDLException.PARSER_ERROR, msg, e); } Element root = domDoc.getDocumentElement(); DOMXMLElementEvaluator evaluator = new DOMXMLElementEvaluator(xpointer, root, getErrorReporter()); Element result = evaluator.evaluateElement(); if (result != null) { //Element from XPointer evaluation. return readWSDL(wsdlURI, result); } else { String msg = getErrorReporter().getFormattedMessage( "WSDL531", new Object[] {fragment, wsdlURI}); throw new WSDLException(WSDLException.PARSER_ERROR, msg); } } } /* * Helper method for readWSDL(WSDLSource) */ private Description readWSDL(String wsdlURI, InputSource inputSource) throws WSDLException { try { Document wsdlDocument = getDocument(inputSource, wsdlURI); return readWSDL(wsdlURI, wsdlDocument); } catch (IOException e) { String msg = getErrorReporter().getFormattedMessage( "WSDL503", new Object[] {wsdlURI}); throw new WSDLException(WSDLException.PARSER_ERROR, msg, e); } } /* ************************************************************ * Parsing methods - e.g. parseXXXX() * ************************************************************/ protected Schema parseSchemaInline(XMLElement schemaEl, DescriptionElement desc) throws WSDLException { InlinedSchemaImpl schema = new InlinedSchemaImpl(); schema.setXMLElement(schemaEl); schema.setId(schemaEl.getAttributeValue(SchemaConstants.ATTR_ID)); String tns = schemaEl.getAttributeValue(SchemaConstants.ATTR_TARGET_NAMESPACE); if(tns != null) { schema.setNamespace(getURI(tns)); } String baseURI = desc.getDocumentBaseURI() != null ? desc.getDocumentBaseURI().toString() : null; XmlSchema schemaDef = null; try { Element domSchemaEl = (Element)schemaEl.getSource(); XmlSchemaCollection xsc = new XmlSchemaCollection(); xsc.setBaseUri(baseURI); // Plug in the selected woden URI Resolver xsc.setSchemaResolver(new DOMSchemaResolverAdapter(getURIResolver(), schemaEl)); schemaDef = xsc.read(domSchemaEl, baseURI); } catch (XmlSchemaException e) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL521", new Object[] {baseURI}, ErrorReporter.SEVERITY_WARNING, e); } catch (RuntimeException e) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL521", new Object[] {baseURI}, ErrorReporter.SEVERITY_ERROR, e); } if(schemaDef != null) { schema.setSchemaDefinition(schemaDef); } else { schema.setReferenceable(false); } return schema; } /* * Parse the <xs:import> element and resolve the import to an * XML Schema definition. Failure to retrieve * the schema will only matter if any WSDL components contain elements or * constraints that refer to the schema, and typically this will be * determined later by WSDL validation. So just report any such errors * and return the SchemaImport object (i.e. with a null schema property). * * WSDL 2.0 spec validation: * - namespace attribute is REQUIRED * - imported schema MUST have a targetNamespace * - namespace and targetNamespace MUST be the same * * TODO implement a framework for caching schemas by namespace and resolving xs:import */ protected Schema parseSchemaImport(XMLElement importEl, DescriptionElement desc) throws WSDLException { ImportedSchemaImpl schema = new ImportedSchemaImpl(); schema.setXMLElement(importEl); String importNS = importEl.getAttributeValue(SchemaConstants.ATTR_NAMESPACE); if(importNS != null) { schema.setNamespace(getURI(importNS)); } String schemaLoc = importEl.getAttributeValue(SchemaConstants.ATTR_SCHEMA_LOCATION); if(schemaLoc != null) { schema.setSchemaLocation(getURI(schemaLoc)); } if(schema.getNamespace() == null) { //The namespace attribute is REQUIRED on xs:import, so don't continue. schema.setReferenceable(false); return schema; } XmlSchema schemaDef = null; if(schema.getSchemaLocation() != null) { schemaDef = retrieveSchema(importEl, desc.getDocumentBaseURI(), schemaLoc); } if(schemaDef == null) { //Either there was no schemaLocation or it did not resolve to a schema, //so try to retrieve a schema at the namespace. schemaDef = retrieveSchema(importEl, null, importNS); } if(schemaDef == null) { //Check if any WSDL imports contain a schema with this namespace. //TODO there may be multiple schemas that this namespace import could resolve to. This is a temporary solution pending WODEN- post M7. ImportElement[] imports = desc.getImportElements(); for(int i=0; i QName docElQN = new QName(docEl.getNamespaceURI(), docEl.getLocalName()); if(!Constants.Q_ELEM_DESCRIPTION.equals(docElQN)) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL501", new Object[] {Constants.Q_ELEM_DESCRIPTION, docElQN}, ErrorReporter.SEVERITY_ERROR); //cannot continue without a element return null; } XMLElement descEl = createXMLElement(docEl); referencedDesc = parseDescription(locationStr, descEl, wsdlModules); if(!wsdlModules.containsKey(locationStr)) { wsdlModules.put(locationStr, referencedDesc); } } return referencedDesc; } /** * Create the JAXP DocumentBuilderFactory instance.Use JAXP 1.2 API for validation. * @param namespaceAware whether the returned factory is to provide support for XML namespaces * @return the JAXP DocumentBuilderFactory * @throws ParserConfigurationException if we failed to build a proper DocumentBuilderFactory */ protected DocumentBuilderFactory createDocumentBuilderFactory(boolean namespaceAware) throws ParserConfigurationException, WSDLException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(namespaceAware); // Enable validation on the XML parser if it has been enabled // for the Woden parser. if (features.getValue(WSDLReader.FEATURE_VALIDATION)) { factory.setValidating(true); // Enforce namespace aware for XSD... factory.setNamespaceAware(true); try { factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); factory.setAttribute(JAXP_SCHEMA_SOURCE, schemas); } catch (IllegalArgumentException e) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL515", new Object[] {factory.getClass().getName()}, ErrorReporter.SEVERITY_FATAL_ERROR, e); } }else{ factory.setValidating(false); } return factory; } /** * Create a JAXP DocumentBuilder will use for parsing XML documents. * @param factory the JAXP DocumentBuilderFactory that the DocumentBuilder * should be created with * @param entityResolver the SAX EntityResolver to use * @param errorHandler the SAX ErrorHandler to use * @return the JAXP DocumentBuilder * @throws ParserConfigurationException if thrown by JAXP methods */ protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory, EntityResolver entityResolver, ErrorHandler errorHandler) throws ParserConfigurationException { DocumentBuilder docBuilder = factory.newDocumentBuilder(); if (entityResolver != null) { docBuilder.setEntityResolver(entityResolver); } if (errorHandler != null) { docBuilder.setErrorHandler(errorHandler); } return docBuilder; } /** * A wrapper that plugs Woden's error reporter mechanism into the * XML parser used to parse the WSDL document. */ class ErrorHandlerWrapper implements org.xml.sax.ErrorHandler { /** * The error reporter used to report errors in Woden. */ private ErrorReporter errorReporter; /** * Constructor. * * @param errorReporter The error reporter to be wrapped. */ public ErrorHandlerWrapper(ErrorReporter errorReporter) { this.errorReporter = errorReporter; } /* (non-Javadoc) * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) */ public void error(SAXParseException error) throws SAXException { ErrorLocatorImpl locator = new ErrorLocatorImpl(); locator.setLineNumber(error.getLineNumber()); locator.setColumnNumber(error.getColumnNumber()); try { errorReporter.reportError(locator, null, error.getMessage(), ErrorReporter.SEVERITY_ERROR, error.getException()); } catch(WSDLException e) { throw new SAXException("A problem occurred setting the error in the Woden error reporter wrapper.", e); } } /* (non-Javadoc) * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) */ public void fatalError(SAXParseException error) throws SAXException { ErrorLocatorImpl locator = new ErrorLocatorImpl(); locator.setLineNumber(error.getLineNumber()); locator.setColumnNumber(error.getColumnNumber()); try { errorReporter.reportError(locator, null, error.getMessage(), ErrorReporter.SEVERITY_FATAL_ERROR, error.getException()); } catch(WSDLException e) { throw new SAXException("A problem occurred setting the error in the Woden error reporter wrapper.", e); } } /* (non-Javadoc) * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) */ public void warning(SAXParseException warning) throws SAXException { ErrorLocatorImpl locator = new ErrorLocatorImpl(); locator.setLineNumber(warning.getLineNumber()); locator.setColumnNumber(warning.getColumnNumber()); try { errorReporter.reportError(locator, null, warning.getMessage(), ErrorReporter.SEVERITY_WARNING, warning.getException()); } catch(WSDLException e) { throw new SAXException("A problem occurred setting the error in the Woden error reporter wrapper.", e); } } } class WSDLEntityResolver implements org.xml.sax.EntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // TODO Auto-generated method stub return null; } } } ./src/org/apache/woden/internal/wsdl20/0000775000175000017500000000000011767656530017047 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/DescriptionImpl.java0000664000175000017500000005307611767656530023032 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; import org.apache.woden.internal.WSDLContext; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.Service; import org.apache.woden.wsdl20.TypeDefinition; import org.apache.woden.wsdl20.fragids.DescriptionPart; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.xml.BindingElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.ImportElement; import org.apache.woden.wsdl20.xml.IncludeElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.NestedElement; import org.apache.woden.wsdl20.xml.ServiceElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This class provides the implementation for a Description component from * the WSDL Component Model, as described in the WSDL 2.0 specification. *

    * Note: this class is different to the other WSDL implementation classes, * which all implement two Java interfaces; a component model interface and the * interface for the corresponding WSDL element. Different implementations * are used for the Description component and for the <wsdl:description> * element because the latter exposes the composite structure of imported and * included WSDL documents, while the Description component 'flattens' this * structure into an abstract view of the WSDL. A separate implementation * class, DescriptionElementImpl, exists to represent * the <wsdl:description> element. * * @author jkaputin@apache.org */ public class DescriptionImpl extends WSDLComponentImpl implements Description, DescriptionElement { private static final String emptyString = "".intern(); /* * WSDL Component model data (flattened properties of Description Component) * TODO cache top-level components here with a flush-on-update mechanism */ private List fAllElementDeclarations = new Vector(); private List fAllTypeDefinitions = new Vector(); /* * WSDL Element model data */ private URI fDocumentBaseURI = null; // attributes private URI fTargetNamespace = null; private Map fNamespaces = new HashMap(); // child elements private List fImportElements = new Vector(); private List fIncludeElements = new Vector(); private TypesImpl fTypesElement = null; private List fInterfaceElements = new Vector(); private List fBindingElements = new Vector(); private List fServiceElements = new Vector(); /* * Woden-specific instance variables */ private boolean fComponentsInitialized = false; private WSDLContext fWsdlContext; /* * Constructors */ private DescriptionImpl() {}; public DescriptionImpl(WSDLContext wsdlContext) { fWsdlContext = wsdlContext; } /* ************************************************************ * Description interface methods (the WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.Description#getInterfaces() * * TODO performance to be addressed in this method. Suggest caching with * some sort of notification-on-update to flush the cash and let lazy init * reset it. But best to deal with performance after wsdl create/update has * been implemented, as we can then baseline the existing dynamic approach * to test for correct behaviour after performance mods have been made. * (but see to do comment in getNestedDescriptions method too) */ public Interface[] getInterfaces() { List allInterfaces = new Vector(); //declared interfaces for(Iterator i=fInterfaceElements.iterator(); i.hasNext(); ) { Interface intface = (Interface)i.next(); if(!containsComponent(intface, allInterfaces)) { ((InterfaceImpl)intface).setDescriptionComponent(this); allInterfaces.add(intface); } } //nested interfaces List nestedDescs = new Vector(getNestedDescriptions()); for(Iterator i=nestedDescs.iterator(); i.hasNext(); ) { DescriptionElement desc = (DescriptionElement)i.next(); InterfaceElement[] interfaces = desc.getInterfaceElements(); for(int j=0; j<description> have attributes of type * xs:NCName. The setter method for the attribute will take an NCName object as * the input parameter. However, to be useful, the getter method returns a QName. The * namespace within the QName has to be the targetNamespace of the <description> * element. This method provides a way to retrieve the targetNamespace and any NS prefix * of the enclosing <description> element. * @param wElem instance of WSDLElement for which the targetNamespace is required * @return a String array containing the targetNamespace and prefix of the DescriptionElement * that is the root element of wElem */ static String[] getTargetNamespaceAndPrefix(WSDLElement wElem) { if (wElem instanceof NestedElement) { WSDLElement parent = ((NestedElement) wElem).getParentElement(); return getTargetNamespaceAndPrefix(parent); } //We have a description element DescriptionElement desc = ((DescriptionElement) wElem); //Find its target name and prefix. String[] namespace = new String[] {emptyString, emptyString}; URI tns = desc.getTargetNamespace(); if (tns != null) { namespace[0] = tns.toString(); String prefix = desc.getNamespacePrefix(tns); if(prefix != null) { namespace[1] = prefix; } } return namespace; } } ./src/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.java0000664000175000017500000000706711767656530023136 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import java.util.List; import java.util.Vector; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This abstract class defines the common behaviour for referencing WSDL * documents via the <wsdl:import> and <wsdl:include> elements. * It is extended by the concrete implementation classes for those two elements. * * TODO consider whether to expose a WSDLReferenceElement interface on the API too * to provide a common handle for import and include elements (is there a use case?). * * @author jkaputin@apache.org */ public abstract class WSDLReferenceImpl extends DocumentableImpl { private List fDocumentationElements = new Vector(); private URI fLocation = null; private DescriptionElement fDescriptionElement = null; private WSDLElement fParentElem = null; /* * package private, used only by factory methods in this package */ void setParentElement(WSDLElement parent) { fParentElem = parent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement() */ public WSDLElement getParentElement() { return fParentElem; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#setLocation(java.net.URI) */ public void setLocation(URI locURI) { fLocation = locURI; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#getLocation() */ public URI getLocation() { return fLocation; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#setDescriptionElement(org.apache.woden.wsdl20.xml.DescriptionElement) */ public void setDescriptionElement(DescriptionElement desc) { fDescriptionElement = desc; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#getDescriptionElement() */ public DescriptionElement getDescriptionElement() { return fDescriptionElement; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.DocumentableElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement) */ public void addDocumentationElement(DocumentationElement docEl) { if(docEl != null) { fDocumentationElements.add(docEl); } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.DocumentableElement#getDocumentationElements() */ public DocumentationElement[] getDocumentationElements() { DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()]; fDocumentationElements.toArray(array); return array; } } ./src/org/apache/woden/internal/wsdl20/TypesImpl.java0000664000175000017500000002535511767656530021652 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.internal.schema.SchemaImpl; import org.apache.woden.schema.ImportedSchema; import org.apache.woden.schema.InlinedSchema; import org.apache.woden.schema.Schema; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaType; /** * This class represents the WSDL <types> element. * * TODO consider methods to get directly declared schemas vs getting all 'in-scope' schemas from the wsdl tree. * * @author jkaputin@apache.org */ public class TypesImpl extends DocumentableImpl implements TypesElement { private WSDLElement fParentElem = null; private String fTypeSystem = null; private List fSchemas = new Vector(); //TODO extension attributes and elements /* * @see org.apache.woden.wsdl20.xml.TypesElement#setTypeSystem(java.lang.String) */ public void setTypeSystem(String typeSystem) { fTypeSystem = typeSystem; } /* * @see org.apache.woden.wsdl20.xml.TypesElement#getTypeSystem() */ public String getTypeSystem() { return fTypeSystem; } /* * @see org.apache.woden.wsdl20.xml.TypesElement#addSchema(org.apache.woden.schema.Schema) */ public void addSchema(Schema schema) { if(schema != null) { fSchemas.add(schema); //reset flag so ComponentModelBuilder will rebuild the ElementDeclarations and TypeDefinitions ((DescriptionImpl)getParentElement()).resetComponentsInitialized(); } } /* * @see org.apache.woden.wsdl20.xml.TypesElement#removeSchema(org.apache.woden.schema.Schema) */ public void removeSchema(Schema schema) { fSchemas.remove(schema); } /* * @see org.apache.woden.wsdl20.xml.TypesElement#getSchemas() */ public Schema[] getSchemas() { Schema[] array = new Schema[fSchemas.size()]; fSchemas.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.xml.TypesElement#getSchemas(java.net.URI) */ public Schema[] getSchemas(URI namespace) { List schemas = new Vector(); Iterator i = fSchemas.iterator(); if(namespace != null) { while(i.hasNext()) { Schema s = (Schema)i.next(); if(namespace.equals(s.getNamespace())) { schemas.add(s); } } } else { //get schemas whose namespace is missing while(i.hasNext()) { Schema s = (Schema)i.next(); if(s.getNamespace() == null) { schemas.add(s); } } } Schema[] array = new Schema[schemas.size()]; schemas.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.xml.TypesElement#getInlinedSchemas() */ public InlinedSchema[] getInlinedSchemas() { List schemas = new Vector(); Iterator i = fSchemas.iterator(); while(i.hasNext()) { Schema s = (Schema)i.next(); if(s instanceof InlinedSchema) { schemas.add(s); } } InlinedSchema[] array = new InlinedSchema[schemas.size()]; schemas.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.xml.TypesElement#getImportedSchemas() */ public ImportedSchema[] getImportedSchemas() { List schemas = new Vector(); Iterator i = fSchemas.iterator(); while(i.hasNext()) { Schema s = (Schema)i.next(); if(s instanceof ImportedSchema) { schemas.add(s); } } ImportedSchema[] array = new ImportedSchema[schemas.size()]; schemas.toArray(array); return array; } /* * package private, used only by factory methods in this package */ void setParentElement(WSDLElement parent) { fParentElem = parent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement() */ public WSDLElement getParentElement() { return fParentElem; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * TODO decide if this helper method should be on the API, either as-is or replaced by method that returns all accessible schemas. * * Returns the schema element declaration identified by the QName, * providing the element declaration is referenceable to the * WSDL description (i.e. visible). This means it must exist in a * Schema that has been inlined or resolved from a schema import * within the <types> element according to the schema * referenceability rules in the WSDL 2.0 spec. * If the element declaration is not referenceable, null is returned. * If validation is disabled, the referenceability rules do not apply * so all schemas are considered referenceable by the WSDL. * * TODO tbd - @see org.apache.woden.wsdl20.xml.TypesElement#getElementDeclaration(javax.xml.namespace.QName) */ public XmlSchemaElement getElementDeclaration(QName qname) { // Can't resolve the element if the QName is null. if(qname == null) return null; XmlSchemaElement xmlSchemaElement = null; List schemas = getReferenceableSchemaDefs(qname.getNamespaceURI()); if(schemas != null) { //search the schemas with this qname's namespace Iterator i = schemas.iterator(); while(i.hasNext()) { XmlSchema xmlSchema = (XmlSchema)i.next(); xmlSchemaElement = xmlSchema.getElementByName(qname); if(xmlSchemaElement != null) { break; } } } return xmlSchemaElement; } /* * TODO decide if this helper method should be on the API, either as-is or replaced by method that returns all accessible schemas. * * Returns the schema type definition identified by the QName, * providing the type definition is referenceable by the * WSDL description (i.e. visible). This means it must exist in a * Schema that has been inlined or resolved from a schema import * within the <types> element according to the schema * referenceability rules in the WSDL 2.0 spec. * If the type definition is not referenceable, null is returned. * If validation is disabled, the referenceability rules do not apply * so all schemas are considered referenceable by the WSDL. * * TODO tbd - @see org.apache.woden.wsdl20.xml.TypesElement#getTypeDefinition(javax.xml.namespace.QName) */ public XmlSchemaType getTypeDefinition(QName qname) { XmlSchemaType xmlSchemaType = null; if(qname != null) { List schemaRefs = getReferenceableSchemaDefs(qname.getNamespaceURI()); if(schemaRefs != null) { //search the schemas with this qname's namespace Iterator i = schemaRefs.iterator(); while(i.hasNext()) { XmlSchema xmlSchema = (XmlSchema)i.next(); xmlSchemaType = xmlSchema.getTypeByName(qname); if(xmlSchemaType != null) { break; } } } } return xmlSchemaType; } /* * Returns a List of XmlSchema objects for all schemas that are referenceable * by the containing WSDL. Examples of schemas that are not referenceable include * schemas without a target namespace or schemas resolved from a schema import * whose target namespace does not match the imported namespace. Referenceability * is determined by validation. * NOTE: This is an implementation-only method used to build the ElementDeclarations * components (i.e. it is not an API method). If it is required on the API it must be * changed to use a type safe return value. * * TODO t.b.c. remove if made redundant by WODEN-123 */ private List getReferenceableSchemaDefs() { List schemas = new Vector(); Iterator i = fSchemas.iterator(); while(i.hasNext()) { SchemaImpl s = (SchemaImpl)i.next(); if(s.isReferenceable() && s.getSchemaDefinition() != null) { schemas.add(s.getSchemaDefinition()); } } return schemas; } /* * Return a Lists of XmlSchema for all schemas with the specified target namespace * or import namespace that are referenceable by the WSDL. * Note, this method requires a non-null namespace argument. * * TODO t.b.d. remove the notion of referenceability - just get ALL schemas? */ private List getReferenceableSchemaDefs(String namespace) { List schemas = new Vector(); if(namespace != null) { Iterator i = fSchemas.iterator(); while(i.hasNext()) { SchemaImpl s = (SchemaImpl)i.next(); if(s.isReferenceable() && namespace.equals(s.getNamespaceAsString()) && s.getSchemaDefinition() != null) { schemas.add(s.getSchemaDefinition()); } } } return schemas; } } ./src/org/apache/woden/internal/wsdl20/ServiceImpl.java0000664000175000017500000001724311767656530022143 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.Endpoint; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.Service; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.xml.EndpointElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.ServiceElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.wsdl20.fragids.ServicePart; /** * This class represents the Service component and the * <service> element. * * @author John Kaputin (jkaputin@apache.org) */ public class ServiceImpl extends WSDLComponentImpl implements Service, ServiceElement { private WSDLElement fParentElem = null; /* This field refers to the Description component which contains this Service * component in its {services} property. It is set whenever this Service is * returned by that Description's getServices() or getService(QName) methods. * Note that with modularization via a wsdl import or include, this * reference may be different to fDescriptionElement because it refers to the * importing or including description at the top of the wsdl tree (whereas the * latter refers to the description in which this service is directly declared). * This field is used to retrieve components that are available (i.e. in-scope) * to the top-level Description component. */ private Description fDescriptionComponent = null; private NCName fName = null; private QName fInterfaceName = null; private List fEndpoints = new Vector(); /* ************************************************************ * Service interface methods (the WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.Service#getName() * @see org.apache.woden.wsdl20.xml.ServiceElement#getName() */ public QName getName() { QName name = null; if (fName != null) { String[] tns = DescriptionImpl.getTargetNamespaceAndPrefix(this); name = new QName(tns[0], fName.toString(), tns[1]); } return name; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.Service#getInterface() */ public Interface getInterface() { Description desc = fDescriptionComponent; Interface interfac = desc.getInterface(fInterfaceName); return interfac; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.Service#getEndpoint(org.apache.woden.types.NCName) * * TODO add a testcase for this method */ public Endpoint getEndpoint(NCName name) { Endpoint endpoint = null; if(name != null) { String nameString = name.toString(); for(Iterator i=fEndpoints.iterator(); i.hasNext(); ) { Endpoint tmpEP = (Endpoint)i.next(); String tmpStr = tmpEP.getName() != null ? tmpEP.getName().toString() : null; if(nameString.equals(tmpStr)) { endpoint = tmpEP; break; } } } return endpoint; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.Service#getEndpoints() */ public Endpoint[] getEndpoints() { Endpoint[] array = new Endpoint[fEndpoints.size()]; fEndpoints.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.Service#toElement() */ public ServiceElement toElement() { return this; } /* ************************************************************ * ServiceElement interface methods (the XML Element model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#setName(NCName) */ public void setName(NCName name) { fName = name; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#setInterfaceName(javax.xml.namespace.QName) */ public void setInterfaceName(QName qname) { fInterfaceName = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#getInterfaceName() */ public QName getInterfaceName() { return fInterfaceName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#getInterfaceElement() */ public InterfaceElement getInterfaceElement() { //Cast the containing description element to a description component to re-use its //logic for navigating a composite wsdl to retrieve the in-scope top-level components. Description desc = (Description)fParentElem; InterfaceElement interfac = (InterfaceElement)desc.getInterface(fInterfaceName); return interfac; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#addEndpointElement() */ public EndpointElement addEndpointElement() { EndpointImpl endpoint = new EndpointImpl(); fEndpoints.add(endpoint); endpoint.setParentElement(this); return endpoint; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ServiceElement#getEndpointElements() */ public EndpointElement[] getEndpointElements() { EndpointElement[] array = new EndpointElement[fEndpoints.size()]; fEndpoints.toArray(array); return array; } /* * package private, used only by factory methods in this package */ void setParentElement(WSDLElement parent) { fParentElem = parent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement() */ public WSDLElement getParentElement() { return fParentElem; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * These package private accessors refer to the Description component * in which this Service is contained (i.e. contained in its {services} * property). They are declared package private so that they can be used by the * Woden implementation without exposing them to the API (i.e. by DescriptionImpl) */ void setDescriptionComponent(Description desc) { fDescriptionComponent = desc; } Description getDescriptionComponent() { return fDescriptionComponent; } public FragmentIdentifier getFragmentIdentifier() { return new FragmentIdentifier(new ServicePart(fName)); } } ./src/org/apache/woden/internal/wsdl20/TypeDefinitionImpl.java0000664000175000017500000000650711767656530023476 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.WSDLReader; import org.apache.woden.wsdl20.TypeDefinition; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.TypeDefinitionPart; /** * This class represents a TypeDefinition property of the Description component. * It refers to a global type definition provided by the underlying type * system (e.g. XML Schema) * * @author jkaputin@apache.org */ public class TypeDefinitionImpl implements TypeDefinition { private QName fName = null; private URI fSystem = null; private String fContentModel = null; private Object fContent = null; /* ************************************************************ * TypeDefinition interface methods (the WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.TypeDefinition#getName() */ public QName getName() { return fName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.TypeDefinition#getSystem() */ public URI getSystem() { return fSystem; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.TypeDefinition#getContentModel() */ public String getContentModel() { return fContentModel; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.TypeDefinition#getContent() */ public Object getContent() { return fContent; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ public void setName(QName name) { fName = name; } public void setSystem(URI typeSystemURI) { fSystem = typeSystemURI; } public void setContentModel(String contentModel) { fContentModel = contentModel; } public void setContent(Object typeDefContent) { fContent = typeDefContent; } public FragmentIdentifier getFragmentIdentifier() { if (fSystem == null | fSystem.toString().equals(WSDLReader.TYPE_XSD_2001)) { return new FragmentIdentifier(new TypeDefinitionPart(fName)); } else { return new FragmentIdentifier(new TypeDefinitionPart(fName, fSystem)); } } public String toString() { return getFragmentIdentifier().toString(); } } ./src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java0000664000175000017500000001374611767656530025262 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.InterfaceFault; import org.apache.woden.wsdl20.InterfaceFaultReference; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.InterfaceFaultReferencePart; /** * This class represents the InterfaceFaultReference component of the * WSDL 2.0 Component model and the <infault> and <outfault> * child elements of an interface <operation>. * * @author jkaputin@apache.org */ public class InterfaceFaultReferenceImpl extends NestedImpl implements InterfaceFaultReference, InterfaceFaultReferenceElement { private NCName fMessageLabel = null; private Direction fDirection = null; private QName fRef = null; /* ************************************************************ * InterfaceFaultReference methods (i.e. WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.InterfaceFaultReference#getInterfaceFault() */ public InterfaceFault getInterfaceFault() { InterfaceOperation oper = (InterfaceOperation)getParent(); Interface interfac = (Interface)oper.getParent(); InterfaceFault intFault = interfac.getFromAllInterfaceFaults(fRef); return intFault; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.InterfaceFaultReference#getMessageLabel() * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getMessageLabel() */ public NCName getMessageLabel() { return fMessageLabel; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.InterfaceFaultReference#getDirection() * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getDirection() */ public Direction getDirection() { return fDirection; } /* * @see org.apache.woden.wsdl20.InterfaceFaultReference#toElement() */ public InterfaceFaultReferenceElement toElement() { return this; } /* ************************************************************ * InterfaceFaultReferenceElement methods (i.e. XML Element model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#setRef(javax.xml.namespace.QName) */ public void setRef(QName faultQName) { fRef = faultQName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getRef() */ public QName getRef() { return fRef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getInterfaceFaultElement() */ public InterfaceFaultElement getInterfaceFaultElement() { InterfaceFaultElement fault = null; InterfaceOperationElement oper = (InterfaceOperationElement)getParentElement(); InterfaceElement interfac = (InterfaceElement)oper.getParentElement(); if (interfac != null) { InterfaceFault faultComp = ((Interface)interfac).getFromAllInterfaceFaults(fRef); if (faultComp != null) { fault = faultComp.toElement(); } } return fault; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.FaultReferenceElement#setMessageLabel(org.apache.woden.wsdl20.enumeration.MessageLabel) */ public void setMessageLabel(NCName msgLabel) { fMessageLabel = msgLabel; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.FaultReferenceElement#setDirection(org.apache.woden.wsdl20.enumeration.Direction) */ public void setDirection(Direction dir) { fDirection = dir; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier() */ public FragmentIdentifier getFragmentIdentifier() { //Find parent components. InterfaceOperation interfaceOperationComp = (InterfaceOperation)getParent(); Interface interfaceComp = (Interface)interfaceOperationComp.getParent(); //Get needed properties. NCName interfaceName = new NCName(interfaceComp.getName().getLocalPart()); NCName interfaceOperation = new NCName(interfaceOperationComp.getName().getLocalPart()); //Return a new FragmentIdentifier. return new FragmentIdentifier(new InterfaceFaultReferencePart(interfaceName, interfaceOperation, fMessageLabel, fRef)); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ } ./src/org/apache/woden/internal/wsdl20/ImportImpl.java0000664000175000017500000000274511767656530022016 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import org.apache.woden.wsdl20.xml.ImportElement; /** * This class implements the <wsdl:import> element. * * @author jkaputin@apache.org */ public class ImportImpl extends WSDLReferenceImpl implements ImportElement { private URI fNamespace = null; /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#setNamespace(java.net.URI) */ public void setNamespace(URI nsURI) { fNamespace = nsURI; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.ImportElement#getNamespace() */ public URI getNamespace() { return fNamespace; } } ./src/org/apache/woden/internal/wsdl20/BindingFaultReferenceImpl.java0000664000175000017500000002153111767656530024723 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingFaultReference; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.InterfaceFault; import org.apache.woden.wsdl20.InterfaceFaultReference; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement; import org.apache.woden.wsdl20.xml.BindingOperationElement; import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.BindingFaultReferencePart; /** * This class represents the BindingFaultReference component of the * WSDL 2.0 Component model and the <infault> or <outfault> * child element of a WSDL binding <operation>. * * @author jkaputin@apache.org */ public class BindingFaultReferenceImpl extends NestedImpl implements BindingFaultReference, BindingFaultReferenceElement { private QName fRef = null; private Direction fDirection = null; private NCName fMessageLabel = null; /* ************************************************************ * BindingFaultReference interface methods (i.e. WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.BindingFaultReference#getInterfaceFaultReference() * * The "effective" message label of the binding fault reference must be equal to the message label * of an interface fault reference and the interface fault reference must refer to an interface * fault with its {name} equal to the 'ref' qname of the binding fault reference. * * The WSDL 2.0 Part 1 spec says "Define the effective message label of a binding fault reference element * information item to be either the actual value of the messageLabel attribute information item if it * is present, or the {message label} of the unique placeholder message with {direction} equal to the * message direction if the attribute information item is absent." * * The code in this method currently just supports the first type of "effective" message label, * where the message label property IS present in the binding fault reference. * * TODO effective message label based on message exchange pattern placeholder message, * where the message label property IS NOT present in the binding fault reference. * */ public InterfaceFaultReference getInterfaceFaultReference() { InterfaceFaultReference intFaultRef = null; if(fRef != null) //if 'ref' is null, we cannot match against an interface fault qname. { BindingOperation bindOp = (BindingOperation)getParent(); InterfaceOperation intOp = bindOp.getInterfaceOperation(); if(intOp != null) { //Determine the "effective" msg label for this binding fault ref. NCName effectiveMsgLabel = null; if(fMessageLabel != null) { effectiveMsgLabel = fMessageLabel; } else { //implement placeholder effective msg label, as per the todo comment above } //Now match the effective msg label against the msg label of an interface fault reference //that refers to an interface fault whose qname matches the 'ref' attribute. if(effectiveMsgLabel != null) { InterfaceFaultReference[] intFaultRefs = intOp.getInterfaceFaultReferences(); for(int i=0; i. */ } ./src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java0000664000175000017500000001716611767656530024002 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingFaultReference; import org.apache.woden.wsdl20.BindingMessageReference; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.xml.BindingElement; import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement; import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement; import org.apache.woden.wsdl20.xml.BindingOperationElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.BindingOperationPart; /** * This class represents the BindingOperation component from the WSDL 2.0 Component Model * and the <operation> child element of the WSDL <binding> element. * * @author jkaputin@apache.org */ public class BindingOperationImpl extends NestedImpl implements BindingOperation, BindingOperationElement { private QName fRef = null; private List fMessageRefs = new Vector(); private List fFaultRefs = new Vector(); /* ************************************************************ * BindingOperation interface methods (i.e. WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.BindingOperation#getInterfaceOperation() */ public InterfaceOperation getInterfaceOperation() { InterfaceOperation oper = null; Binding binding = (Binding)getParent(); Interface interfac = binding.getInterface(); if(interfac != null) { oper = interfac.getFromAllInterfaceOperations(fRef); } return oper; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.BindingOperation#getBindingMessageReferences() */ public BindingMessageReference[] getBindingMessageReferences() { BindingMessageReference[] array = new BindingMessageReference[fMessageRefs.size()]; fMessageRefs.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.BindingOperation#getBindingFaultReferences() */ public BindingFaultReference[] getBindingFaultReferences() { BindingFaultReference[] array = new BindingFaultReference[fFaultRefs.size()]; fFaultRefs.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.BindingOperation#toElement() */ public BindingOperationElement toElement() { return this; } /* ************************************************************ * BindingOperationElement interface methods (the XML Element model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#setRef(javax.xml.namespace.QName) */ public void setRef(QName qname) { fRef = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#getRef() */ public QName getRef() { return fRef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#getInterfaceOperationElement() */ public InterfaceOperationElement getInterfaceOperationElement() { InterfaceOperationElement oper = null; BindingElement binding = (BindingElement)getParentElement(); InterfaceElement interfac = binding.getInterfaceElement(); if(interfac != null) { InterfaceOperation operComp = ((Interface)interfac).getFromAllInterfaceOperations(fRef); if(operComp != null) { oper = operComp.toElement(); } } return oper; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#addBindingMessageReferenceElement() */ public BindingMessageReferenceElement addBindingMessageReferenceElement() { BindingMessageReferenceImpl msgRef = new BindingMessageReferenceImpl(); fMessageRefs.add(msgRef); msgRef.setParentElement(this); return msgRef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#removeBindingMessageReferenceElement(org.apache.woden.wsdl20.xml.BindingMessageReferenceElement) */ public void removeBindingMessageReferenceElement(BindingMessageReferenceElement msgRef) { fMessageRefs.remove(msgRef); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#getBindingMessageReferenceElements() */ public BindingMessageReferenceElement[] getBindingMessageReferenceElements() { BindingMessageReferenceElement[] array = new BindingMessageReferenceElement[fMessageRefs.size()]; fMessageRefs.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#addBindingFaultReferenceElement() */ public BindingFaultReferenceElement addBindingFaultReferenceElement() { BindingFaultReferenceImpl faultRef = new BindingFaultReferenceImpl(); fFaultRefs.add(faultRef); faultRef.setParentElement(this); return faultRef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#removeBindingFaultReferenceElement(org.apache.woden.wsdl20.xml.BindingFaultReferenceElement) */ public void removeBindingFaultReferenceElement(BindingFaultReferenceElement faultRef) { fFaultRefs.remove(faultRef); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.BindingOperationElement#getBindingFaultReferenceElements() */ public BindingFaultReferenceElement[] getBindingFaultReferenceElements() { BindingFaultReferenceElement[] array = new BindingFaultReferenceElement[fFaultRefs.size()]; fFaultRefs.toArray(array); return array; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier() */ public FragmentIdentifier getFragmentIdentifier() { //Find parent component and get needed properties. Binding bindingComp = (Binding)getParent(); NCName binding = new NCName(bindingComp.getName().getLocalPart()); //Return a new FragmentIdentifier. return new FragmentIdentifier(new BindingOperationPart (binding , fRef)); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ } ./src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java0000664000175000017500000001327111767656530023434 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.types.QNameTokenUnion; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.InterfaceFault; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.InterfaceFaultPart; /** * This class represents the InterfaceFault component from the WSDL 2.0 Component * Model and the <fault> child element of the <interface> element. * * @author jkaputin@apache.org */ public class InterfaceFaultImpl extends NestedImpl implements InterfaceFault, InterfaceFaultElement { //WSDL Component model data private NCName fName = null; //XML Element model data private QNameTokenUnion fElement = null; /* ************************************************************ * InterfaceFault methods (i.e. WSDL Component model) * ************************************************************/ /* * @see org.apache.woden.wsdl20.InterfaceFault#getName() * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getName() */ public QName getName() { QName name = null; if (fName != null) { String[] tns = DescriptionImpl.getTargetNamespaceAndPrefix(this); name = new QName(tns[0], fName.toString(), tns[1]); } return name; } /* * @see org.apache.woden.wsdl20.InterfaceFault#getMessageContentModel() */ public String getMessageContentModel() { String model = Constants.NMTOKEN_OTHER;; if (fElement != null) { if (fElement.isQName()) { model = Constants.NMTOKEN_ELEMENT; } else if(fElement.isToken()) { model = fElement.getToken(); } } return model; } /* * @see org.apache.woden.wsdl20.InterfaceFault#getElementDeclaration() */ public ElementDeclaration getElementDeclaration() { ElementDeclaration elemDecl = null; if(fElement != null && fElement.isQName()) { Interface interfac = (Interface)getParent(); Description desc = ((InterfaceImpl)interfac).getDescriptionComponent(); elemDecl = desc.getElementDeclaration(fElement.getQName()); } return elemDecl; } /* * @see org.apache.woden.wsdl20.InterfaceFault#toElement() */ public InterfaceFaultElement toElement() { return this; } /* ************************************************************ * InterfaceFaultElement methods (i.e. XML Element model) * ************************************************************/ /* * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setName(NCName) */ public void setName(NCName name) { fName = name; } /* * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setElementName(QName) */ public void setElement(QNameTokenUnion qnameTokenUnion) { fElement = qnameTokenUnion; } /* * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getElementName() */ public QNameTokenUnion getElement() { return fElement; } /* * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getElement() */ public XmlSchemaElement getXmlSchemaElement() { XmlSchemaElement xse = null; if (fElement != null && fElement.isQName()) { InterfaceElement interfac = (InterfaceElement)getParentElement(); DescriptionElement desc = (DescriptionElement)interfac.getParentElement(); TypesElement types = desc.getTypesElement(); if(types != null) { xse = ((TypesImpl)types).getElementDeclaration(fElement.getQName()); } } return xse; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier() */ public FragmentIdentifier getFragmentIdentifier() { Interface interfaceComp = (Interface)getParent(); NCName interfaceName = new NCName(interfaceComp.getName().getLocalPart()); return new FragmentIdentifier(new InterfaceFaultPart(interfaceName, fName)); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ } ./src/org/apache/woden/internal/wsdl20/validation/0000775000175000017500000000000011767656530021201 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/validation/WodenContextImpl.java0000664000175000017500000000335711767656530025317 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.validation; import org.apache.woden.ErrorReporter; import org.apache.woden.resolver.URIResolver; import org.apache.woden.wsdl20.validation.WodenContext; /** * @author John Kaputin (jkaputin@apache.org) */ public class WodenContextImpl implements WodenContext { private ErrorReporter errReporter; private URIResolver uriResolver; //package private ctor WodenContextImpl(ErrorReporter errReporter, URIResolver uriResolver) { this.errReporter = errReporter; this.uriResolver = uriResolver; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.WodenContext#getErrorReporter() */ public ErrorReporter getErrorReporter() { return this.errReporter; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.WodenContext#getUriResolver() */ public URIResolver getUriResolver() { return this.uriResolver; } } ./src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java0000664000175000017500000004515311767656530026172 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.validation; import java.net.URI; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.schema.ImportedSchema; import org.apache.woden.schema.InlinedSchema; import org.apache.woden.schema.Schema; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.ImportElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaObjectTable; /** * The WSDL document validator validates a WSDL XML model against the * document assertions specified in the WSDL 2.0 specification. */ public class WSDLDocumentValidator { /** * Validate the document representation of the WSDL document against * the WSDL 2.0 specification. * * @param descElement The WSDL 2.0 XML model description element. * @param errorReporter The error reporter to use for any errors. * @return True if the WSDL document representation is valid, false otherwise. * @throws WSDLException */ public boolean validate(DescriptionElement descElement, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; // Test the description element. isValid = testAssertionDescription1006(descElement, errorReporter); // Test the import elements. ImportElement[] imports = descElement.getImportElements(); int numImports = imports.length; for(int i = 0; i < numImports; i++) { // TODO: Implement methods once import elements are supported. // if(!testAssertionImport0001(imports[i], errorReporter)) // isValid = false; // if(!testAssertionImport0003(imports[i], errorReporter)) // isValid = false; } if(!validateTypes(descElement.getTypesElement(), errorReporter)) isValid = false; if(!validateInterfaces(descElement, descElement.getInterfaceElements(), errorReporter)) isValid = false; // 1. Call the validators for specific namespaces // - Does this need to be broken up into XML specific and compoent model? // 2. Call post validators // validateTypes(descElement.getTypesElement(), errorReporter); // Description descComponent = descElement.getDescriptionComponent(); // validateInterfaces(descComponent.getInterfaces(), errorReporter); // // TODO: validate bindings, services, and extension elements return isValid; } /** * Validate the contents of the types element. This method runs the assertion * tests for inline and imported types. * * @param types The types element of which to validate the contents. * @param errorReporter The error reporter. * @return True if all the types related assertions pass, false otherwise. * @throws WSDLException */ protected boolean validateTypes(TypesElement types, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; // If there is no types element all types assertions are true. if(types == null) return true; // Test imported schema assertions. ImportedSchema[] importedSchemas = types.getImportedSchemas(); int numImportedSchemas = importedSchemas.length; for(int i = 0; i < numImportedSchemas; i++) { ImportedSchema schema = (ImportedSchema)importedSchemas[i]; if(!testAssertionSchema1069(schema, errorReporter)) isValid = false; if(!testAssertionSchema1070(schema, errorReporter)) isValid = false; } // Test inlined schema assertions. InlinedSchema[] inlinedSchemas = types.getInlinedSchemas(); if(!testAssertionSchema1073(inlinedSchemas, errorReporter)) isValid = false; return isValid; } /** * Validate the contents of the interface element. This method runs the assertion * tests for interface element components. * * @param interfaces An array of interface elements for which to validate the contents. * @param errorReporter The error reporter. * @return True if all the interface related assertions pass, false otherwise. * @throws WSDLException */ protected boolean validateInterfaces(DescriptionElement descElement, InterfaceElement[] interfaces, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; int numInterfaceElements = interfaces.length; for(int i = 0; i < numInterfaceElements; i++) { InterfaceElement interfaceElem = interfaces[i]; if(!testAssertionInterface1012(interfaceElem, errorReporter)) isValid = false; if(!validateInterfaceFaults(descElement, interfaceElem.getInterfaceFaultElements(), errorReporter)) isValid = false; if(!validateInterfaceOperations(descElement, interfaceElem.getInterfaceOperationElements(), errorReporter)) isValid = false; } return isValid; } /** * Validate the InterfaceFault elements. * * @param descElement The root description element. * @param faultElements An array of fault elements. * @param errorReporter An error reporter. * @return True if the interface fault elements are all valid, false otherwise. * @throws WSDLException */ protected boolean validateInterfaceFaults(DescriptionElement descElement, InterfaceFaultElement[] faultElements, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; int numFaultElements = faultElements.length; for(int j = 0; j < numFaultElements; j++) { InterfaceFaultElement faultElement = faultElements[j]; if(!testAssertionSchema1066(descElement, faultElement.getElement().getQName(), errorReporter)) isValid = false; } return isValid; } /** * Validate the InterfaceOperation elements. * * @param descElement The root description element. * @param interfaceOperations An array of interface operation elements. * @param errorReporter An error reporter. * @return True if the interface operation elements are all valid, false otherwise. * @throws WSDLException */ protected boolean validateInterfaceOperations(DescriptionElement descElement, InterfaceOperationElement[] interfaceOperations, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; int numInterfaceOperations = interfaceOperations.length; for(int j = 0; j < numInterfaceOperations; j++) { InterfaceOperationElement interfaceOperation = interfaceOperations[j]; if(!validateInterfaceMessageReferences(descElement, interfaceOperation.getInterfaceMessageReferenceElements(), errorReporter)) isValid = false; if(!validateInterfaceFaultReferences(descElement, interfaceOperation.getInterfaceFaultReferenceElements(), errorReporter)) isValid = false; } return isValid; } /** * Validate the InterfaceMessageReference elements. * * @param descElement The root description element. * @param messageReferences An array of interface message reference elements. * @param errorReporter An error reporter. * @return True if the interface message reference elements are all valid, false otherwise. * @throws WSDLException */ protected boolean validateInterfaceMessageReferences(DescriptionElement descElement, InterfaceMessageReferenceElement[] messageReferences, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; //WODEN-149 removed assertion Schema-0020 from this method. InterfaceMessageReference assertions to be implemented. return isValid; } /** * Validate the InterfaceFaultReference elements. * * @param descElement The root description element. * @param faultReferences An array of interface fault reference elements. * @param errorReporter An error reporter. * @return True if the interface fault reference elements are all valid, false otherwise. * @throws WSDLException */ protected boolean validateInterfaceFaultReferences(DescriptionElement descElement, InterfaceFaultReferenceElement[] faultReferences, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; int numFaultReferences = faultReferences.length; for(int k = 0; k < numFaultReferences; k++) { InterfaceFaultReferenceElement faultReference = faultReferences[k]; if(!testAssertionQNameResolution1064ForInterfaceFaultReference(faultReference, errorReporter)) isValid = false; } return isValid; } /** * Test assertion Description-1006. Tests whether the target namespace * specified is an absolute IRI. * * @param descElement The description element for which to check the target namespace. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionDescription1006(DescriptionElement descElement, ErrorReporter errorReporter) throws WSDLException { URI targetNS = descElement.getTargetNamespace(); if(!targetNS.isAbsolute()) { errorReporter.reportError(new ErrorLocatorImpl(), "Description-1006", new Object[]{targetNS}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Schema-1069. An imported schema must contain a * target namespace. * * @param schema The imported schema to check. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionSchema1069(ImportedSchema schema, ErrorReporter errorReporter) throws WSDLException { XmlSchema schemaDef = schema.getSchemaDefinition(); // The assertion is true if the schema definition is not available. // Problems locating the schema will be reported elseware and are // not part of this assertion. if(schemaDef == null) return true; String targetNS = schemaDef.getTargetNamespace(); if(targetNS == null || targetNS.equals("")) { errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1069", new Object[]{schema.getSchemaLocation()}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Schema-1070. An imported schema must specify the * same target namespace as the import element. * * @param schema The imported schema to check. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionSchema1070(ImportedSchema schema, ErrorReporter errorReporter) throws WSDLException { XmlSchema schemaDef = schema.getSchemaDefinition(); // The assertion is true if the schema definition is not available. // Problems locating the schema will be reported elseware and are // not part of this assertion. if(schemaDef == null) return true; String importedSchemaTargetNS = schemaDef.getTargetNamespace(); String specifiedTargetNS = schema.getNamespace().toString(); if(specifiedTargetNS != null && !specifiedTargetNS.equals(importedSchemaTargetNS)) { errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1070", new Object[]{specifiedTargetNS}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Schema-1073. Inlined XML Schemas must not define * an element that has already been defined by another inline schema * with the same target namespace. * * @param schema An array containing all the inline schemas in the order in which they are defined. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionSchema1073(InlinedSchema[] schema, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; int numInlineSchemas = schema.length; Hashtable schemas = new Hashtable(); for(int i = 0; i < numInlineSchemas; i++) { InlinedSchema iSchema = schema[i]; URI iSchemaNs = iSchema.getNamespace(); // If the namespace isn't defined this assertion doesn't apply. if(iSchemaNs == null) continue; String ns = iSchemaNs.toString(); if(schemas.containsKey(ns)) { List schemaList = (List)schemas.get(ns); XmlSchemaObjectTable elements = iSchema.getSchemaDefinition().getElements(); Iterator elementNames = elements.getNames(); while(elementNames.hasNext()) { QName elementName = (QName)elementNames.next(); Iterator otherInlineSchemas = schemaList.iterator(); while(otherInlineSchemas.hasNext()) { if(((InlinedSchema)otherInlineSchemas.next()).getSchemaDefinition().getElementByName(elementName) != null) { // Duplicate element defined. errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1073", new Object[]{elementName, ns}, ErrorReporter.SEVERITY_ERROR); isValid = false; } } } XmlSchemaObjectTable types = iSchema.getSchemaDefinition().getSchemaTypes(); Iterator typeNames = types.getNames(); while(typeNames.hasNext()) { QName typeName = (QName)typeNames.next(); Iterator otherInlineSchemas = schemaList.iterator(); while(otherInlineSchemas.hasNext()) { if(((InlinedSchema)otherInlineSchemas.next()).getSchemaDefinition().getTypeByName(typeName) != null) { // Duplicate type defined. errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1073b", new Object[]{typeName, ns}, ErrorReporter.SEVERITY_ERROR); isValid = false; } } } //Check if another element has been defined. //check if another type has been defined. //add to the existing list of schemas schemaList.add(iSchema); } else { List schemaList = new ArrayList(); schemaList.add(iSchema); schemas.put(ns, schemaList); } } return isValid; } /** * Test assertion Interface-1012. All style defaults specified on an interface * element must be absolute. * * @param interfaceElem The interface element to check the style default list. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionInterface1012(InterfaceElement interfaceElem, ErrorReporter errorReporter) throws WSDLException { boolean isValid = true; URI[] styleDefaults = interfaceElem.getStyleDefault(); int numStyleDefaults = styleDefaults.length; for(int i = 0; i < numStyleDefaults; i++) { if(!styleDefaults[i].isAbsolute()) { errorReporter.reportError(new ErrorLocatorImpl(), "Interface-1012", new Object[]{styleDefaults[i].toString()}, ErrorReporter.SEVERITY_ERROR); isValid = false; } } return isValid; } /** * Test assertion Schema-1066. References to XML schema components must only refer * to elements and types in namespaces that have been imported or inlined or that * are part of the XML schema namespace. * * @param descElement The description element of the document. * @param namespace Check this namespace to see if it has been defined. * @param errorReporter The error Reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionSchema1066(DescriptionElement descElement, QName qualifiedName, ErrorReporter errorReporter) throws WSDLException { // If the qualifiedName is null it can't be checked. if(qualifiedName != null && !qualifiedName.getNamespaceURI().equals(Constants.TYPE_XSD_2001)) { //Get the namespace and the local name from the qualified name. String namespace = qualifiedName.getNamespaceURI(); String localname = qualifiedName.getLocalPart(); TypesElement types = descElement.getTypesElement(); if(types == null) { errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR); return false; } Schema[] schemas = types.getSchemas(); int numSchemas = schemas.length; boolean schemaNotFound = true; // TODO: This linear search should be improved for performance. for(int i = 0; i < numSchemas; i++) { URI schemaNs = schemas[i].getNamespace(); // If the schema namespace is null continue to the next one. This is not the // schema we're looking for. if(schemaNs == null) continue; if(schemaNs.toString().equals(namespace)) { schemaNotFound = false; break; } } if(schemaNotFound) { errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR); return false; } } return true; } /** * Test assertion QName-resolution-1064 for an InterfaceFaultReference element. \ * A Description component must not contain broken QName references. * * @param faultReference The interface fault reference to check for a broken reference. * @param errorReporter An error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionQNameResolution1064ForInterfaceFaultReference(InterfaceFaultReferenceElement faultReference, ErrorReporter errorReporter) throws WSDLException { QName ref = faultReference.getRef(); if(ref != null) { InterfaceFaultElement fault = faultReference.getInterfaceFaultElement(); if(fault == null) { errorReporter.reportError(new ErrorLocatorImpl(), "QName-resolution-1064", new Object[]{ref.toString(), "interface fault reference", "interface fault"}, ErrorReporter.SEVERITY_ERROR); return false; } } return true; } } ./src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java0000664000175000017500000001564511767656530024476 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.validation; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import org.apache.woden.WSDLException; import org.apache.woden.internal.WSDLContext; import org.apache.woden.internal.wsdl20.assertions.Description1001; import org.apache.woden.internal.wsdl20.assertions.Description1002; import org.apache.woden.internal.wsdl20.assertions.Interface1009; import org.apache.woden.internal.wsdl20.assertions.Interface1010; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; import org.apache.woden.wsdl20.validation.AssertionInfo; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * Validates a WSDL 2.0 Description component by walking the component model * tree and checking the relevant assertions for each component. *

    * TODO add dependency checking for prereq assertions
    * TODO decide if a return value is needed indicating the result (boolean or err/warn/OK) * * @author John Kaputin (jkaputin@apache.org) * */ public class WSDLValidator { private WSDLContext fWsdlCtx; private WodenContext fWodenCtx; //not needed? ... private Map fAssertions; //map of assertion id string -> AssertionInfo private Map fWsdlAsserts; //map of target Class -> list of WSDL 2.0 Assertions private Map fExtAsserts; //map of target Class -> list of extension Assertions public void validate(Description description, WSDLContext wsdlContext) throws WSDLException { int len = 0; this.fWsdlCtx = wsdlContext; this.fWodenCtx = new WodenContextImpl(fWsdlCtx.errorReporter, fWsdlCtx.uriResolver); //setup the WSDL 2.0 assertions //TODO do this once per wsdl reader object, not per document setupWSDLAssertions(); //setup the extension assertions. //TODO check - must be done per document in case ext reg has changed setupExtensionAssertions(); //walk the parts of the xml tree not represented in the component model, calling checkAssertions //method for each element. // - i.e. description(s), import, include, types, documentation? DescriptionElement descElem = description.toElement(); checkAssertions(DescriptionElement.class, descElem); //check assertions for the Description component checkAssertions(Description.class, description); //walk the top-level component trees, calling checkAssertions for each component and for each //component.toElement(). Interface[] intfaces = description.getInterfaces(); len = intfaces.length; for(int i=0; iList of WSDL 2.0 Assertions fWsdlAsserts = new HashMap(); List descElem = new Vector(); descElem.add(new Description1001()); descElem.add(new Description1002()); descElem.add(new Description1002()); fWsdlAsserts.put(DescriptionElement.class, descElem); List desc = new Vector(); desc.add(new Interface1010()); fWsdlAsserts.put(Description.class, desc); List intf = new Vector(); intf.add(new Interface1009()); fWsdlAsserts.put(Interface.class, intf); } private void setupExtensionAssertions() { fExtAsserts = new HashMap(); AssertionInfo[] infos = this.fWsdlCtx.extensionRegistry.queryAssertions(); List asserts; int len = infos.length; for(int i=0; i 0) || (bindingFaults != null && bindingFaults.length > 0)) && bindingInterface == null) { errorReporter.reportError(new ErrorLocatorImpl(), "Binding-1044", new Object[]{}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Binding-1045. A Binding component that defines bindings * for an Interface component MUST define bindings for all the operations * of that Interface component. * * @param binding The binding of which to check the binding operations. * @param errorReporter The error reporter. * @return True if the all the operations specified on the interface have bindings defined, false otherwise. * @throws WSDLException */ protected boolean testAssertionBinding1045(Binding binding, ErrorReporter errorReporter) throws WSDLException { boolean allInterfaceOperationsHaveBinding = true; QName bindingQN = binding.getName(); String bindingName = bindingQN != null ? bindingQN.getLocalPart() : null; Interface interfac = binding.getInterface(); if(interfac == null) return true; BindingOperation[] bindingOperations = binding.getBindingOperations(); int numBindingOperations = bindingOperations.length; List usedInterfaceOperationList = new ArrayList(); for(int i = 0; i < numBindingOperations; i++) { InterfaceOperation io = bindingOperations[i].getInterfaceOperation(); if(io != null) usedInterfaceOperationList.add(io); } // Check the interface operations. if(!checkAllInterfaceOperationsHaveBinding(bindingName, interfac, usedInterfaceOperationList, errorReporter)) allInterfaceOperationsHaveBinding = false; Interface[] extendedInterfaces = interfac.getExtendedInterfaces(); if(extendedInterfaces != null) { int numExtendedInterfaces = extendedInterfaces.length; for(int i = 0; i < numExtendedInterfaces; i++) { if(!checkAllInterfaceOperationsHaveBinding(bindingName, extendedInterfaces[i], usedInterfaceOperationList, errorReporter)) allInterfaceOperationsHaveBinding = false; } } return allInterfaceOperationsHaveBinding; } /** * Helper method for testAssertionBinding0055. This method checks that * each interface operation in the provided interface has a binding * defined. * * @param bindingName The name of the binding. Used in error reporting. * @param interfac The interface of which to check the operations. * @param usedInterfaceOperations A list of interface operations that have bindings specified. * @param errorReporter The error reporter. * @return True if all the interface operations have bindings defined, false otherwise. * @throws WSDLException */ private boolean checkAllInterfaceOperationsHaveBinding(String bindingName, Interface interfac, List usedInterfaceOperations, ErrorReporter errorReporter) throws WSDLException { boolean allInterfaceOperationsHaveBinding = true; InterfaceOperation[] interfaceOperations = interfac.getInterfaceOperations(); if(interfaceOperations == null) return true; int numInterfaceOperations = interfaceOperations.length; // Check the interface operations. for(int i = 0; i < numInterfaceOperations; i++) { if(!usedInterfaceOperations.contains(interfaceOperations[i])) { errorReporter.reportError(new ErrorLocatorImpl(), "Binding-1045", new Object[]{bindingName, interfaceOperations[i].getName()}, ErrorReporter.SEVERITY_ERROR); allInterfaceOperationsHaveBinding = false; } } return allInterfaceOperationsHaveBinding; } /** * Test assertion Binding-1048. The binding type xs:anyURI MUST be an * absolute IRI as defined by [IETF RFC 3987]. * * @param binding The binding of which to check the type. * @param errorReporter The error reporter. * @return True if the type is absolute, false otherwise. * @throws WSDLException */ protected boolean testAssertionBinding1048(Binding binding, ErrorReporter errorReporter) throws WSDLException { URI type = binding.getType(); if(type != null && !type.isAbsolute()) { errorReporter.reportError(new ErrorLocatorImpl(), "Binding-1048", new Object[]{type}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Binding-1049. For each Binding component in the {bindings} property of a * Description component, the {name} property MUST be unique. * * @param bindings The bindings in the description component. * @param errorReporter The error reporter. * @return True if the all the bindings have unique names, false otherwise. * @throws WSDLException */ protected boolean testAssertionBinding1049(Binding[] bindings, ErrorReporter errorReporter) throws WSDLException { boolean duplicateFound = false; List names = new ArrayList(); int numBindings = bindings.length; for(int i = 0; i < numBindings; i++) { QName name = bindings[i].getName(); if(name == null) continue; if(names.contains(name)) { errorReporter.reportError(new ErrorLocatorImpl(), "Binding-1049", new Object[]{name}, ErrorReporter.SEVERITY_ERROR); duplicateFound = true; } else { names.add(name); } } return !duplicateFound; } /** * Test assertion BindingFault-1050. For each Binding Fault component in the * {binding faults} property of a Binding component, the {interface fault} * property MUST be unique. * * @param bindingFaults The binding faults in the description component. * @param errorReporter The error reporter. * @return True if the all the bindings have unique names, false otherwise. * @throws WSDLException */ protected boolean testAssertionBindingFault1050(BindingFault[] bindingFaults, ErrorReporter errorReporter) throws WSDLException { boolean duplicateFound = false; List usedInterfaceFaults = new ArrayList(); int numBindingFaults = bindingFaults.length; for(int i = 0; i < numBindingFaults; i++) { InterfaceFault interfaceFault = bindingFaults[i].getInterfaceFault(); if(interfaceFault == null) continue; if(usedInterfaceFaults.contains(interfaceFault)) { errorReporter.reportError(new ErrorLocatorImpl(), "BindingFault-1050", new Object[]{}, ErrorReporter.SEVERITY_ERROR); duplicateFound = true; } else { usedInterfaceFaults.add(interfaceFault); } } return !duplicateFound; } /** * Test assertion BindingOperation-1051. For each Binding Operation component * in the {binding operations} property of a Binding component, the {interface * operation} property MUST be unique. * * @param bindingOperations The binding operations to check for unique interface operations. * @param errorReporter The error reporter. * @return True if the all the binding operations have specified unique interface operations, false otherwise. * @throws WSDLException */ protected boolean testAssertionBindingOperation1051(BindingOperation[] bindingOperations, ErrorReporter errorReporter) throws WSDLException { boolean duplicateFound = false; List specifiedInterfaceOperations = new ArrayList(); int numBindingOperations = bindingOperations.length; for(int i = 0; i < numBindingOperations; i++) { InterfaceOperation interfaceOperation = bindingOperations[i].getInterfaceOperation(); if(interfaceOperation == null) continue; if(specifiedInterfaceOperations.contains(interfaceOperation)) { errorReporter.reportError(new ErrorLocatorImpl(), "BindingOperation-1051", new Object[]{interfaceOperation.getName()}, ErrorReporter.SEVERITY_ERROR); duplicateFound = true; } else { specifiedInterfaceOperations.add(interfaceOperation); } } return !duplicateFound; } /** * Test assertion BindingMessageReference-1052. For each Binding Message * Reference component in the {binding message references} property of a * Binding Operation component, the {interface message reference} property * MUST be unique. * * @param bindingMessageReferences The binding message references to check for unique interface message references. * @param errorReporter The error reporter. * @return True if the all the binding message references have specified unique interface message references, false otherwise. * @throws WSDLException */ protected boolean testAssertionBindingMessageReference1052(BindingMessageReference[] bindingMessageReferences, ErrorReporter errorReporter) throws WSDLException { boolean duplicateFound = false; List specifiedInterfaceMessageReferences = new ArrayList(); int numBindingMessageReferences = bindingMessageReferences.length; for(int i = 0; i < numBindingMessageReferences; i++) { InterfaceMessageReference interfaceMessageReference = bindingMessageReferences[i].getInterfaceMessageReference(); if(interfaceMessageReference == null) continue; if(specifiedInterfaceMessageReferences.contains(interfaceMessageReference)) { errorReporter.reportError(new ErrorLocatorImpl(), "BindingMessageReference-1052", new Object[]{interfaceMessageReference.getMessageLabel()}, ErrorReporter.SEVERITY_ERROR); duplicateFound = true; } else { specifiedInterfaceMessageReferences.add(interfaceMessageReference); } } return !duplicateFound; } /** * Test assertion BindingFaultReference-1055. For each Binding Fault Reference * component in the {binding fault references} property of a Binding Operation * component, the {interface fault reference} property MUST be unique. * * @param bindingFaultReferences The binding fault references to check for unique interface fault references. * @param errorReporter The error reporter. * @return True if the all the binding fault references have specified unique interface fault references, false otherwise. * @throws WSDLException */ protected boolean testAssertionBindingFaultReference1055(BindingFaultReference[] bindingFaultReferences, ErrorReporter errorReporter) throws WSDLException { boolean duplicateFound = false; List specifiedInterfaceFaultReferences = new ArrayList(); int numBindingFaultReferences = bindingFaultReferences.length; for(int i = 0; i < numBindingFaultReferences; i++) { InterfaceFaultReference interfaceFaultReference = bindingFaultReferences[i].getInterfaceFaultReference(); if(interfaceFaultReference == null) continue; if(specifiedInterfaceFaultReferences.contains(interfaceFaultReference)) { errorReporter.reportError(new ErrorLocatorImpl(), "BindingFaultReference-1055", new Object[]{interfaceFaultReference.getMessageLabel()}, ErrorReporter.SEVERITY_ERROR); duplicateFound = true; } else { specifiedInterfaceFaultReferences.add(interfaceFaultReference); } } return !duplicateFound; } /** * Test assertion BindingFaultReference-1059. There MUST be an Interface Fault * Reference component in the {interface fault references} of the Interface * Operation being bound with {message label} equal to the effective message * label and with {interface fault} equal to an Interface Fault component with * {name} equal to the actual value of the ref attribute information item. * * @param bindingFaultReference The binding fault reference to check if the specified interface fault reference exists. * @param errorReporter The error reporter. * @return True if the binding fault reference specifies a valid interface fault reference, false otherwise. * @throws WSDLException */ protected boolean testAssertionBindingFaultReference1059(BindingFaultReference bindingFaultReference, ErrorReporter errorReporter) throws WSDLException { InterfaceFaultReference interfaceFaultReference = bindingFaultReference.getInterfaceFaultReference(); if(interfaceFaultReference == null) { errorReporter.reportError(new ErrorLocatorImpl(), "BindingFaultReference-1059", new Object[]{}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Service-1060. For each Service component in the {services} property * of a Description component, the {name} property MUST be unique. * * @param services An array containing all the services in the description component. * @param errorReporter The error reporter. * @return True if all services contain unique names, false otherwise. * @throws WSDLException */ protected boolean testAssertionService1060(Service[] services, ErrorReporter errorReporter) throws WSDLException { List names = new ArrayList(); int numServices = services.length; for(int i = 0; i < numServices; i++) { QName name = services[i].getName(); if(name == null) continue; if(names.contains(name)) { errorReporter.reportError(new ErrorLocatorImpl(), "Service-1060", new Object[]{name}, ErrorReporter.SEVERITY_ERROR); return false; } else { names.add(name); } } return true; } /** * Test assertion Endpoint-1061. This xs:anyURI MUST be an absolute IRI as * defined by [IETF RFC 3987]. This xs:anyURI refers to the address IRI. * * @param endpoint The endpoint of which the address should be checked. * @param errorReporter The error reporter. * @return True if the address IRI is absolute, false otherwise. * @throws WSDLException */ protected boolean testAssertionEndpoint1061(Endpoint endpoint, ErrorReporter errorReporter) throws WSDLException { URI address = endpoint.getAddress(); if(address != null && !address.isAbsolute()) { errorReporter.reportError(new ErrorLocatorImpl(), "Endpoint-1061", new Object[]{address}, ErrorReporter.SEVERITY_ERROR); return false; } return true; } /** * Test assertion Endpoint-1062. For each Endpoint component in the {endpoints} property * of a Service component, the {binding} property MUST either be a Binding component with * an unspecified {interface} property or a Binding component with an {interface} property * equal to the {interface} property of the Service component. * * @param endpoint The endpoint of which the binding should be checked. * @param errorReporter The error reporter. * @return True if the binding specified the interface specified by the service or no interface, false otherwise. * @throws WSDLException */ protected boolean testAssertionEndpoint1062(Endpoint endpoint, ErrorReporter errorReporter) throws WSDLException { Binding binding = endpoint.getBinding(); // If no binding has been specified this assertion does not apply. if(binding == null) return true; Interface bindingInterface = binding.getInterface(); WSDLComponent parent = endpoint.getParent(); if(parent != null) { Service service = (Service)parent; Interface serviceInterface = service.getInterface(); // If an interface hasn't been specified on the service this assertion doesn't apply. // If the binding interface is null this assertion passes. if(serviceInterface != null && bindingInterface != null && !serviceInterface.isEquivalentTo(bindingInterface)) { errorReporter.reportError(new ErrorLocatorImpl(), "Endpoint-1062", new Object[]{binding, bindingInterface, serviceInterface}, ErrorReporter.SEVERITY_ERROR); return false; } } return true; } } ./src/org/apache/woden/internal/wsdl20/ElementDeclarationImpl.java0000664000175000017500000000675711767656530024312 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.WSDLReader; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.ElementDeclarationPart; /** * This class represents an ElementDeclaration property of the Description component. * It refers to a global element declaration provided by the underlying type * system (e.g. XML Schema) * * @author jkaputin@apache.org */ public class ElementDeclarationImpl implements ElementDeclaration { private QName fName = null; private URI fSystem = null; private String fContentModel = null; private Object fContent = null; /* ************************************************************ * ElementDeclaration interface methods (the WSDL Component model) * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.ElementDeclaration#getName() */ public QName getName() { return fName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.ElementDeclaration#getSystem() */ public URI getSystem() { return fSystem; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.ElementDeclaration#getContentModel() */ public String getContentModel() { return fContentModel; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.ElementDeclaration#getContent() */ public Object getContent() { return fContent; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ public void setName(QName name) { fName = name; } public void setSystem(URI typeSystemURI) { fSystem = typeSystemURI; } public void setContentModel(String contentModel) { fContentModel = contentModel; } public void setContent(Object elementContent) { fContent = elementContent; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier() */ public FragmentIdentifier getFragmentIdentifier() { if (fSystem == null | fSystem.toString().equals(WSDLReader.TYPE_XSD_2001)) { return new FragmentIdentifier(new ElementDeclarationPart(fName)); } else { return new FragmentIdentifier(new ElementDeclarationPart(fName, fSystem)); } } public String toString() { return getFragmentIdentifier().toString(); } } ./src/org/apache/woden/internal/wsdl20/NestedImpl.java0000664000175000017500000000377611767656530021773 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.xml.NestedElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This abstract superclass implements support for accessing or * setting the 'parent' of a nested WSDL component. * All such classes will directly or indirectly extend this abstract * class. * * @author jkaputin@apache.org */ public abstract class NestedImpl extends WSDLComponentImpl implements NestedComponent, NestedElement { private WSDLElement fParentElem = null; /* (non-Javadoc) * @see org.apache.woden.wsdl20.NestedComponent#getParent() */ public WSDLComponent getParent() { return (WSDLComponent)fParentElem; } /* * package private, used only by factory methods in this package */ void setParentElement(WSDLElement parent) { fParentElem = parent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement() */ public WSDLElement getParentElement() { return fParentElem; } } ./src/org/apache/woden/internal/wsdl20/Constants.java0000664000175000017500000001675211767656530021701 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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. */ //TODO - consider separating common constants from 2.0 constants //TODO - check if any constants copied from w4j can be deleted package org.apache.woden.internal.wsdl20; import java.net.URI; import javax.xml.namespace.QName; /** * Constants for WSDL 2.0 elements, attributes and URIs. * * @author jkaputin@apache.org */ public class Constants { // Namespace Strings. public static final String NS_STRING_WSDL20 = "http://www.w3.org/ns/wsdl"; public static final String NS_STRING_XMLNS = "http://www.w3.org/2000/xmlns/"; public static final String NS_STRING_XSI = "http://www.w3.org/2001/XMLSchema-instance"; public static final String NS_STRING_WSDL11 = "http://schemas.xmlsoap.org/wsdl/"; // Namespace URIs. public static final URI NS_URI_WSDL20 = URI.create(NS_STRING_WSDL20); public static final URI NS_URI_XMLNS = URI.create(NS_STRING_XMLNS); public static final URI NS_URI_XSI = URI.create(NS_STRING_XSI); // Top-level WSDL 2.0 element names. public static final String ELEM_DESCRIPTION = "description"; public static final String ELEM_DOCUMENTATION = "documentation"; public static final String ELEM_IMPORT = "import"; public static final String ELEM_INCLUDE = "include"; public static final String ELEM_TYPES = "types"; public static final String ELEM_INTERFACE = "interface"; public static final String ELEM_BINDING = "binding"; public static final String ELEM_SERVICE = "service"; // Nested WSDL 2.0 element names. public static final String ELEM_FAULT = "fault"; public static final String ELEM_OPERATION = "operation"; public static final String ELEM_INPUT = "input"; public static final String ELEM_OUTPUT = "output"; public static final String ELEM_INFAULT = "infault"; public static final String ELEM_OUTFAULT = "outfault"; public static final String ELEM_ENDPOINT = "endpoint"; // Top-level WSDL 1.1 element names. public static final String ELEM_DEFINITIONS = "definitions"; // Top-level WSDL 2.0 qualified element names. public static final QName Q_ELEM_DESCRIPTION = new QName(NS_STRING_WSDL20, ELEM_DESCRIPTION); public static final QName Q_ELEM_DOCUMENTATION = new QName(NS_STRING_WSDL20, ELEM_DOCUMENTATION); public static final QName Q_ELEM_IMPORT = new QName(NS_STRING_WSDL20, ELEM_IMPORT); public static final QName Q_ELEM_INCLUDE = new QName(NS_STRING_WSDL20, ELEM_INCLUDE); public static final QName Q_ELEM_TYPES = new QName(NS_STRING_WSDL20, ELEM_TYPES); public static final QName Q_ELEM_INTERFACE = new QName(NS_STRING_WSDL20, ELEM_INTERFACE); public static final QName Q_ELEM_BINDING = new QName(NS_STRING_WSDL20, ELEM_BINDING); public static final QName Q_ELEM_SERVICE = new QName(NS_STRING_WSDL20, ELEM_SERVICE); // Nested WSDL 2.0 qualified element names. public static final QName Q_ELEM_FAULT = new QName(NS_STRING_WSDL20, ELEM_FAULT); public static final QName Q_ELEM_OPERATION = new QName(NS_STRING_WSDL20, ELEM_OPERATION); public static final QName Q_ELEM_INPUT = new QName(NS_STRING_WSDL20, ELEM_INPUT); public static final QName Q_ELEM_OUTPUT = new QName(NS_STRING_WSDL20, ELEM_OUTPUT); public static final QName Q_ELEM_INFAULT = new QName(NS_STRING_WSDL20, ELEM_INFAULT); public static final QName Q_ELEM_OUTFAULT = new QName(NS_STRING_WSDL20, ELEM_OUTFAULT); public static final QName Q_ELEM_ENDPOINT = new QName(NS_STRING_WSDL20, ELEM_ENDPOINT); // Top-level WSDL 1.1 qualified element names. public static final QName Q_ELEM_DEFINITIONS = new QName(NS_STRING_WSDL11,ELEM_DEFINITIONS); // Attribute names. public static final String ATTR_ID = "id"; public static final String ATTR_NAME = "name"; public static final String ATTR_TARGET_NAMESPACE = "targetNamespace"; public static final String ATTR_NAMESPACE = "namespace"; public static final String ATTR_XMLNS = "xmlns"; public static final String ATTR_EXTENDS = "extends"; public static final String ATTR_STYLE_DEFAULT = "styleDefault"; public static final String ATTR_ELEMENT = "element"; public static final String ATTR_PATTERN = "pattern"; public static final String ATTR_STYLE = "style"; public static final String ATTR_MESSAGE_LABEL = "messageLabel"; public static final String ATTR_REF = "ref"; public static final String ATTR_REQUIRED = "required"; public static final String ATTR_INTERFACE = "interface"; public static final String ATTR_TYPE = "type"; public static final String ATTR_BINDING = "binding"; public static final String ATTR_ADDRESS = "address"; public static final String ATTR_LOCATION = "location"; // Attribute values and NMTokens public static final String VALUE_EMPTY_STRING = ""; public static final String VALUE_TRUE = "true"; public static final String VALUE_FALSE = "false"; public static final String NMTOKEN_VALUE = "#value"; public static final String NMTOKEN_ANY = "#any"; public static final String NMTOKEN_NONE = "#none"; public static final String NMTOKEN_OTHER = "#other"; public static final String NMTOKEN_ELEMENT = "#element"; //Message Exchange Patterns public static final URI MEP_URI_IN_ONLY = URI.create("http://www.w3.org/ns/wsdl/in-only"); public static final URI MEP_URI_ROBUST_IN_ONLY = URI.create("http://www.w3.org/ns/wsdl/robust-in-only"); public static final URI MEP_URI_IN_OUT = URI.create("http://www.w3.org/ns/wsdl/in-out"); /* Constants representing the values of the properties used to * configure the Woden runtime (i.e. different to WSDL 2.0 properties). * These typically describe the standards, APIs, etc, supported by this * implementation of the Woden API. * * The first part of the constant name indicates its usage: * TYPE_ describes a supported type system, such as the W3C XML Schema. * API_ describes a supported external API, such as DOM */ public static final String TYPE_XSD_2001 = "http://www.w3.org/2001/XMLSchema"; public static final String API_W3C_DOM = "org.w3c.dom"; public static final String API_APACHE_WS_XS = "org.apache.ws.commons.schema"; //Apache WS-Commons XmlSchema // Qualified attribute names. public static final QName Q_ATTR_REQUIRED = new QName(NS_STRING_WSDL20, ATTR_REQUIRED); // // XML Declaration string. public static final String XML_DECL_DEFAULT = "UTF-8"; public static final String XML_DECL_START = ""; } ./src/org/apache/woden/internal/wsdl20/assertions/0000775000175000017500000000000011767656530021241 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java0000664000175000017500000000613311767656530024321 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.assertions; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; /** * This class represents assertion Interface-1009 from the WSDL 2.0 specification. * For details about this assertion see: * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Interface-1009 * * @author Lawrence Mandel (lmandel@apache.org) */ public class Interface1009 implements Assertion { public final static String ID = "Interface-1009".intern(); /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID() */ public String getId() { return ID; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, org.apache.woden.wsdl20.validation.WodenContext) */ public void validate(Object target, WodenContext wodenCtx) throws WSDLException { Interface interfac = (Interface)target; Interface[] extendedInterfaces = interfac.getExtendedInterfaces(); if(containsInterface(interfac, extendedInterfaces)) { try { wodenCtx.getErrorReporter().reportError(new ErrorLocatorImpl(), ID , new Object[]{interfac.getName()}, ErrorReporter.SEVERITY_ERROR); }catch(WSDLException e) { //TODO: Log problem reporting error. } } } /** * Check whether the specified interface is in the list of extended interfaces. * * @param interfac The interface that should be checked to see if it is in the list of exteneded interfaces. * @param extendedInterfaces An array of interfaces representing the list of extended interfaces. * @return true if the interface is in the list of extended interfaces, false otherwise. */ private boolean containsInterface(Interface interfac, Interface[] extendedInterfaces) { boolean foundInterface = false; int numExtInterfaces = extendedInterfaces.length; for(int i = 0; i < numExtInterfaces && !foundInterface; i++) { if(interfac.isEquivalentTo(extendedInterfaces[i])) foundInterface = true; else if(containsInterface(interfac, extendedInterfaces[i].getExtendedInterfaces())) foundInterface = true; } return foundInterface; } } ./src/org/apache/woden/internal/wsdl20/assertions/Description1001.java0000664000175000017500000000620511767656530024674 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.assertions; import java.net.URI; import java.net.URL; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This class represents assertion Description-1001 from the WSDL 2.0 specification. * For details about this assertion see: * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Description-1001 * * @author John Kaputin (jkaputin@apache.org) * @author Lawrence Mandel (lmandel@apache.org) */ public class Description1001 implements Assertion { /** * A list of URI schemes for which this assertion will attempt to check if * the target namespace is dereferencable. */ private static String searchableSchemes = "http,ftp,file"; public String getId() { return "Description-1001".intern(); } public void validate(Object target, WodenContext wodenCtx) throws WSDLException { DescriptionElement descElem = (DescriptionElement) target; URI tns = descElem.getTargetNamespace(); try { URI resolvedUri = wodenCtx.getUriResolver().resolveURI(tns); URI uri = resolvedUri != null ? resolvedUri : tns; String scheme = uri.getScheme(); // Only check if the scheme is a type that we can locate. // TODO: See if the searchable schemes should be extensible. Object o = null; if(searchableSchemes.indexOf(scheme)!=-1) { URL url = uri.toURL(); o = url.getContent(); } if(o == null) { throw new Exception(); } } catch (WSDLException e2) { // A WSDLException may be thrown due to a problem with the URI resolver so we should report this exception. throw e2; } catch (Exception e) { // Any other exception including IOExceptoin, MalformedURLException, UnknownHostException, and // FileNotFoundException means that the namespace was not resolvable. wodenCtx.getErrorReporter().reportError( new ErrorLocatorImpl(), getId(), new Object[] {tns}, ErrorReporter.SEVERITY_WARNING); } } } ./src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java0000664000175000017500000000503311767656530024307 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.assertions; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; /** * This class represents assertion Interface-1010 from the WSDL 2.0 specification. * For details about this assertion see: * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Interface-1010 * * @author Lawrence Mandel (lmandel@apache.org) */ public class Interface1010 implements Assertion { public final static String ID = "Interface-1010".intern(); /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID() */ public String getId() { return ID; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, org.apache.woden.wsdl20.validation.WodenContext) */ public void validate(Object target, WodenContext wodenCtx) throws WSDLException { Description desc = (Description)target; Interface[] interfaces = desc.getInterfaces(); List names = new ArrayList(); int numInterfaces = interfaces.length; for(int i = 0; i < numInterfaces; i++) { QName name = interfaces[i].getName(); if(name == null) continue; if(names.contains(name)) { try { wodenCtx.getErrorReporter().reportError(new ErrorLocatorImpl(), ID, new Object[]{name}, ErrorReporter.SEVERITY_ERROR); }catch(WSDLException e) { //TODO: Log problem reporting error. } } else { names.add(name); } } } } ./src/org/apache/woden/internal/wsdl20/assertions/Description1002.java0000664000175000017500000000073111767656530024673 0ustar brianbrianpackage org.apache.woden.internal.wsdl20.assertions; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; public class Description1002 implements Assertion { public String getId() { return "Description-1002".intern(); } public void validate(Object target, WodenContext wodenCtx) throws WSDLException { // TODO Auto-generated method stub } } ./src/org/apache/woden/internal/wsdl20/assertions/Description1003.java0000664000175000017500000000073111767656530024674 0ustar brianbrianpackage org.apache.woden.internal.wsdl20.assertions; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.validation.Assertion; import org.apache.woden.wsdl20.validation.WodenContext; public class Description1003 implements Assertion { public String getId() { return "Description-1003".intern(); } public void validate(Object target, WodenContext wodenCtx) throws WSDLException { // TODO Auto-generated method stub } } ./src/org/apache/woden/internal/wsdl20/extensions/0000775000175000017500000000000011767656530021246 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/extensions/http/0000775000175000017500000000000011767656530022225 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPHeaderDeserializer.java0000664000175000017500000001020611767656530027322 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.wsdl20.extensions.ExtensionDeserializer; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentableElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * Deserializes the <whttp:header> extension element into a HTTPHeaderElement. * * @author John Kaputin (jkaputin@apache.org) * */ public class HTTPHeaderDeserializer implements ExtensionDeserializer { /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionDeserializer#unmarshall(java.lang.Class, java.lang.Object, javax.xml.namespace.QName, org.w3c.dom.Element, org.apache.woden.wsdl20.xml.DescriptionElement, org.apache.woden.wsdl20.extensions.ExtensionRegistry) */ public ExtensionElement unmarshall(Class parentType, Object parent, QName extType, XMLElement extEl, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException { HTTPHeaderElement httpHdr = (HTTPHeaderElement) extReg.createExtElement(parentType, extType); httpHdr.setExtensionType(extType); httpHdr.setParentElement((WSDLElement)parent); String name = extEl.getAttributeValue(Constants.ATTR_NAME); httpHdr.setName(name); String typeQN = extEl.getAttributeValue(Constants.ATTR_TYPE); if(typeQN != null) { try { QName qname = extEl.getQName(typeQN); httpHdr.setTypeName(qname); } catch (WSDLException e) { extReg.getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL505", new Object[] {typeQN, extEl.getLocalName()}, ErrorReporter.SEVERITY_ERROR); } } //TRUE if attribute is "true", FALSE if it is "false", omitted or non-boolean. String required = extEl.getAttributeValue(Constants.ATTR_REQUIRED); httpHdr.setRequired(new Boolean(required)); return httpHdr; } private DocumentationElement parseDocumentation(XMLElement docEl, DocumentableElement parent) throws WSDLException { DocumentationElement documentation = parent.addDocumentationElement(); documentation.setContent(docEl); //TODO parseExtensionAttributes(docEl, DocumentationElement.class, documentation, desc); //TODO parseExtensionElements(...) return documentation; } } ./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java0000664000175000017500000001436711767656530031053 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.internal.xml.IntOrTokenAnyAttrImpl; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPErrorStatusCode; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the HTTP namespace * added to the WSDL BindingFault component as part * of the HTTP binding extension defined by the WSDL 2.0 spec. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPBindingFaultExtensionsImpl extends BaseComponentExtensionContext implements HTTPBindingFaultExtensions { public HTTPBindingFaultExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(HTTPConstants.PROP_HTTP_ERROR_STATUS_CODE), getProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING), getProperty(HTTPConstants.PROP_HTTP_HEADERS)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(HTTPConstants.PROP_HTTP_ERROR_STATUS_CODE.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_ERROR_STATUS_CODE, getHttpErrorStatusCode()); } else if(HTTPConstants.PROP_HTTP_CONTENT_ENCODING.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING, getHttpContentEncoding()); } else if(HTTPConstants.PROP_HTTP_HEADERS.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_HEADERS, getHttpHeaders()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by HTTPBindingFaultExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions#getHttpErrorStatusCode() */ public HTTPErrorStatusCode getHttpErrorStatusCode() { /* IntOrTokenAnyAttrImpl is the class registered for this extension attribute. Use this type * here, rather than the IntOrTokenAttr interface, to guarantee that if the code contains an * xs:token it is of type #any. */ IntOrTokenAnyAttrImpl code = (IntOrTokenAnyAttrImpl) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CODE); if(code == null) { //defaults to xs:token #any if the attribute is omitted from the WSDL. return HTTPErrorStatusCode.ANY; } else if(code.isToken()) { //if IntOrTokenAnyAttrImpl contains a token then is must be '#any' return HTTPErrorStatusCode.ANY; } else if(code.isInt()) { return new HTTPErrorStatusCode(code.getInt()); } else { //the whttp:code attribute contains an invalid value (i.e. not an xs:QName or the xs:token #any) //TODO confirm if this should be represented in the Component model as a null return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions#getHttpContentEncoding() * */ public String getHttpContentEncoding() { String ce = null; StringAttr contEncoding = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING); if(contEncoding != null) { ce = contEncoding.getString(); } return ce; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions#getHttpHeaders() */ public HTTPHeader[] getHttpHeaders() { ExtensionElement[] extEls = ((WSDLElement) getParent()) .getExtensionElementsOfType(HTTPConstants.Q_ELEM_HTTP_HEADER); int len = extEls.length; HTTPHeader[] httpHeaders = new HTTPHeader[len]; System.arraycopy(extEls, 0, httpHeaders, 0, len); return httpHeaders; } } ./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPHeaderImpl.java0000664000175000017500000002636111767656530025612 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.internal.wsdl20.BindingImpl; import org.apache.woden.internal.wsdl20.TypesImpl; import org.apache.woden.internal.wsdl20.extensions.AttributeExtensibleImpl; import org.apache.woden.internal.wsdl20.extensions.ElementExtensibleImpl; import org.apache.woden.internal.wsdl20.extensions.ExtensionElementImpl; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.TypeDefinition; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.NestedElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.XMLAttr; import org.apache.ws.commons.schema.XmlSchemaType; /** * This class represents the HTTPHeader Component and the <whttp:header> * extension element that can appear within a Binding Fault or Binding Message * Reference. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPHeaderImpl implements HTTPHeader, HTTPHeaderElement { private WSDLElement fParent = null; private List fDocumentationElements = new Vector(); private ExtensionElement fExtElem = new ExtensionElementImpl(); private AttributeExtensibleImpl fAttrExt = new AttributeExtensibleImpl(); private ElementExtensibleImpl fElemExt = new ElementExtensibleImpl(); private String fName = null; private QName fTypeName = null; /* *********************************************************************** * Component model methods (HTTPHeader interface), some shared with Element model * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeader#getName() * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#getName() */ public String getName() { return fName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeader#getTypeDefinition() */ public TypeDefinition getTypeDefinition() { TypeDefinition typeDef = null; Description desc = getDescriptionComponent(getParent()); typeDef = desc.getTypeDefinition(fTypeName); return typeDef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeader#isRequired() * @see org.apache.woden.wsdl20.extensions.ExtensionElement#isRequired() */ public Boolean isRequired() { return fExtElem.isRequired(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeader#getParent() */ public WSDLComponent getParent() { return (WSDLComponent)fParent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeader#toElement() */ public HTTPHeaderElement toElement() { return this; } /* *********************************************************************** * Element model-only methods (HTTPHeaderElement interface) * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#setName(java.lang.String) */ public void setName(String name) { fName = name; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#setTypeName(javax.xml.namespace.QName) */ public void setTypeName(QName qname) { fTypeName = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#getTypeName() */ public QName getTypeName() { return fTypeName; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#getType() */ public XmlSchemaType getType() { XmlSchemaType xst = null; DescriptionElement desc = getDescriptionElement(getParentElement()); TypesImpl types = (TypesImpl)desc.getTypesElement(); if(types != null) { xst = types.getTypeDefinition(fTypeName); } return xst; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#setParentElement(org.apache.woden.wsdl20.xml.WSDLElement) */ public void setParentElement(WSDLElement wsdlEl) { fParent = wsdlEl; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#getParentElement() */ public WSDLElement getParentElement() { return fParent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement) */ public void addDocumentationElement(DocumentationElement docEl) { if(docEl != null) { fDocumentationElements.add(docEl); } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPHeaderElement#getDocumentationElements() */ public DocumentationElement[] getDocumentationElements() { DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()]; fDocumentationElements.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setExtensionType(javax.xml.namespace.QName) */ public void setExtensionType(QName qname) { fExtElem.setExtensionType(qname); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#getExtensionType() */ public QName getExtensionType() { return fExtElem.getExtensionType(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setRequired(java.lang.Boolean) */ public void setRequired(Boolean required) { fExtElem.setRequired(required); } /* *********************************************************************** * Extensibility methods * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr) */ public void setExtensionAttribute(QName attrType, XMLAttr attr) { fAttrExt.setExtensionAttribute(attrType, attr); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName) */ public XMLAttr getExtensionAttribute(QName attrType) { return fAttrExt.getExtensionAttribute(attrType); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributesForNamespace(java.net.URI) */ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace) { return fAttrExt.getExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes() */ public XMLAttr[] getExtensionAttributes() { return fAttrExt.getExtensionAttributes(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(java.net.URI) */ public boolean hasExtensionAttributesForNamespace(URI namespace) { return fAttrExt.hasExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#addExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void addExtensionElement(ExtensionElement extEl) { fElemExt.addExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#removeExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void removeExtensionElement(ExtensionElement extEl) { fElemExt.removeExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElements() */ public ExtensionElement[] getExtensionElements() { return fElemExt.getExtensionElements(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElementsOfType(javax.xml.namespace.QName) */ public ExtensionElement[] getExtensionElementsOfType(QName extType) { return fElemExt.getExtensionElementsOfType(extType); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#hasExtensionElementsForNamespace(java.net.URI) */ public boolean hasExtensionElementsForNamespace(URI namespace) { return fElemExt.hasExtensionElementsForNamespace(namespace); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * This method traverses up the element graph to get the root . * TODO consider its usefulness to user-defined extensions and whether to refactor it. * e.g. declared in ExtensionElement and implemented in ExtensionElementImpl */ private DescriptionElement getDescriptionElement(WSDLElement wsdlElem) { if(wsdlElem instanceof BindingImpl) { return (DescriptionElement) ((NestedElement)wsdlElem).getParentElement(); } else { WSDLElement parentElem = ((NestedElement)wsdlElem).getParentElement(); return getDescriptionElement(parentElem); } } /* * TODO ditto previous comment about possibly refactoring this for user-defined extensions to reuse. */ private Description getDescriptionComponent(WSDLComponent wsdlComp) { if(wsdlComp instanceof BindingImpl) { return ((BindingImpl)wsdlComp).getDescriptionComponent(); } else { WSDLComponent parentComp = ((NestedComponent)wsdlComp).getParent(); return getDescriptionComponent(parentComp); } } } ./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingExtensionsImpl.java0000664000175000017500000001356011767656530030051 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.BooleanAttr; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the HTTP namespace * added to the WSDL Binding component as part * of the HTTP binding extension defined by the WSDL 2.0 spec. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPBindingExtensionsImpl extends BaseComponentExtensionContext implements HTTPBindingExtensions { public HTTPBindingExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(HTTPConstants.PROP_HTTP_METHOD_DEFAULT), getProperty(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT), getProperty(HTTPConstants.PROP_HTTP_COOKIES), getProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(HTTPConstants.PROP_HTTP_METHOD_DEFAULT.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_METHOD_DEFAULT, getHttpMethodDefault()); } else if(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT, getHttpQueryParameterSeparatorDefault()); } else if(HTTPConstants.PROP_HTTP_COOKIES.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_COOKIES, isHttpCookies()); } else if(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT, getHttpContentEncodingDefault()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by HTTPBindingExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions#getHttpMethodDefault() */ public String getHttpMethodDefault() { StringAttr methodDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_METHOD_DEFAULT); return methodDef != null ? methodDef.getString() : null; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions#getHttpQueryParameterSeparatorDefault() */ public String getHttpQueryParameterSeparatorDefault() { //TODO monitor ws-desc proposal 19May06 on changing handling of defaults in spec Part 2 StringAttr qpsDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT); return qpsDef != null ? qpsDef.getString() : HTTPConstants.QUERY_SEP_AMPERSAND; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions#isHttpCookies() */ public Boolean isHttpCookies() { BooleanAttr cookiesUsed = (BooleanAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_COOKIES); return cookiesUsed != null ? cookiesUsed.getBoolean() : new Boolean(false); //defaults to false if omitted } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions#getHttpContentEncodingDefault() */ public String getHttpContentEncodingDefault() { StringAttr ceDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT); return ceDef != null ? ceDef.getString() : null; } } ./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java0000664000175000017500000003361611767656530031736 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.WSDLExtensionConstants; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.InterfaceOperationExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPLocation; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.BooleanAttr; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the HTTP namespace added to the WSDL * BindingOperation component as part of the HTTP binding * extension defined by the WSDL 2.0 spec. * * @author John Kaputin (jkaputin@apache.org) * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) - added * support for {http location ignore uncited} */ public class HTTPBindingOperationExtensionsImpl extends BaseComponentExtensionContext implements HTTPBindingOperationExtensions { public HTTPBindingOperationExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(HTTPConstants.PROP_HTTP_LOCATION), getProperty(HTTPConstants.PROP_HTTP_LOCATION_IGNORE_UNCITED), getProperty(HTTPConstants.PROP_HTTP_METHOD), getProperty(HTTPConstants.PROP_HTTP_INPUT_SERIALIZATION), getProperty(HTTPConstants.PROP_HTTP_OUTPUT_SERIALIZATION), getProperty(HTTPConstants.PROP_HTTP_FAULT_SERIALIZATION), getProperty(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR), getProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(HTTPConstants.PROP_HTTP_LOCATION.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_LOCATION, getHttpLocation()); } else if(HTTPConstants.PROP_HTTP_LOCATION_IGNORE_UNCITED.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_LOCATION_IGNORE_UNCITED, isHttpLocationIgnoreUncited()); } else if(HTTPConstants.PROP_HTTP_METHOD.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_METHOD, getHttpMethod()); } else if(HTTPConstants.PROP_HTTP_INPUT_SERIALIZATION.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_INPUT_SERIALIZATION, getHttpInputSerialization()); } else if(HTTPConstants.PROP_HTTP_OUTPUT_SERIALIZATION.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_OUTPUT_SERIALIZATION, getHttpOutputSerialization()); } else if(HTTPConstants.PROP_HTTP_FAULT_SERIALIZATION.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_FAULT_SERIALIZATION, getHttpFaultSerialization()); } else if(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_QUERY_PARAMETER_SEPARATOR, getHttpQueryParameterSeparator()); } else if(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING_DEFAULT, getHttpContentEncodingDefault()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by HTTPBindingOperationExtensions * ************************************************************/ /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpLocation() */ public HTTPLocation getHttpLocation() { StringAttr httpLoc = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_LOCATION); return httpLoc != null ? new HTTPLocation(httpLoc.getString()) : null; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#isHttpLocationIgnoreUncited() * * The actual value of the whttp:ignoreUncited attribute information item, * if present. Otherwise, "false". */ public Boolean isHttpLocationIgnoreUncited() { BooleanAttr ignoreUncited = (BooleanAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_IGNORE_UNCITED); return ignoreUncited != null ? ignoreUncited.getBoolean() : new Boolean(false); } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpMethod() * * 1. Return whttp:method if present on the binding operation. * 2. Otherwise return null * * TODO implement steps 2,3,4 below if Part 2 spec is modified * to reflect ws-desc posting 30May06 about moving this default * behaviour from binding rules into the component model. * 2. Otherwise, return whttp:methodDefault if present on the binding. * 3. Otherwise, return "GET" if the {safety} extension property of * InterfaceOperation is 'true'. * 4. Otherwise, return "POST" */ public String getHttpMethod() { // 1. try whttp:method StringAttr methodAttr = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_METHOD); if (methodAttr != null) { return methodAttr.getString(); } // 2. return null (i.e. no default specified in the spec...yet) return null; //TODO remove if default behaviour below is used. /* TODO Uncomment the following code if the defaults descibed for * binding rules in Part 2, 6.3.1 HTTP Method Selection, are moved * into the Component model (i.e. the defaults are applied in the * component model, not left to the binder to enforce them. * See posting ws-desc 30May06. * * // 2. try whttp:methodDefault * Binding binding = (Binding) ((BindingOperation) fParent).getParent(); * * HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) binding * .getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP); * * // no need to check for a null httpBindExts because Binding has REQUIRED * // http extension properties * String methodDef = httpBindExts.getHttpMethodDefault(); * if (methodDef != null) { * return methodDef; * } * * // 3. try {safety} * InterfaceOperation intOper = ((BindingOperation) fParent) * .getInterfaceOperation(); * if (intOper != null) { * InterfaceOperationExtensions intOperExts = (InterfaceOperationExtensions) intOper * .getComponentExtensionsForNamespace(URI * .create(ExtensionConstants.NS_URI_WSDL_EXTENSIONS)); * if (intOperExts != null && intOperExts.isSafety()) { * return HTTPConstants.METHOD_GET; * } * } * * // 4. default to POST. * return HTTPConstants.METHOD_POST; */ } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpInputSerialization() * * Per Part 2, sect 6.3.3, if this attribute is omitted then * {http input serialization} will be application/x-www-form-urlencoded if * {http method} is GET or DELETE, or application/xml if {http method} has * any other value. */ public String getHttpInputSerialization() { StringAttr serialization = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_INPUT_SERIALIZATION); if (serialization != null) { return serialization.getString(); } //TODO replace determineHttpMethod() with getHttpMethod() if spec is //modified to define {http method} defaults in the component model String method = determineHttpMethod(); if (method.equals(HTTPConstants.METHOD_GET) || method.equals(HTTPConstants.METHOD_DELETE)) { return HTTPConstants.SERIAL_APP_URLENCODED; } else { // for POST, PUT or any other method type (Part 2 sect 6.3.3) return HTTPConstants.SERIAL_APP_XML; } } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpOutputSerialization() * * Per Part 2, sect 6.3.3, if this attribute is omitted then * {http output serialization} will be application/xml for any {http method} * value. */ public String getHttpOutputSerialization() { StringAttr serialization = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_OUTPUT_SERIALIZATION); return serialization != null ? serialization.getString() : HTTPConstants.SERIAL_APP_XML; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpFaultSerialization() * * Per Part 2, sect 6.4.5, if attribute omitted default to application/xml. */ public String getHttpFaultSerialization() { StringAttr serialization = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_FAULT_SERIALIZATION); return serialization != null ? serialization.getString() : HTTPConstants.SERIAL_APP_XML; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpQueryParameterSeparator() */ public String getHttpQueryParameterSeparator() { StringAttr separator = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR); return separator != null ? separator.getString() : null; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpContentEncodingDefault() */ public String getHttpContentEncodingDefault() { StringAttr contEncodingDef = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT); return contEncodingDef != null ? contEncodingDef.getString() : null; } /* * This default behaviour for http method is referred to in the spec * Part 2 when determining default values for input and output * serialization in the component model extensions (i.e. 6.3.3 refers * to 6.3.1). If spec is changed to define this default behaviour directly * for the {http method} property, this behaviour will move to the * getHttpMethod() method and this private method can be removed. */ private String determineHttpMethod() { // 1. try whttp:method String method = getHttpMethod(); if(method != null) return method; // 2. try whttp:methodDefault Binding binding = (Binding) ((BindingOperation) getParent()).getParent(); HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) binding .getComponentExtensionContext(HTTPConstants.NS_URI_HTTP); // no need to check for a null httpBindExts because Binding has REQUIRED // http extension properties String methodDef = httpBindExts.getHttpMethodDefault(); if (methodDef != null) return methodDef; // 3. try {safety} equals True InterfaceOperation intOper = ((BindingOperation) getParent()).getInterfaceOperation(); if (intOper != null) { InterfaceOperationExtensions intOperExts = (InterfaceOperationExtensions) intOper .getComponentExtensionContext(WSDLExtensionConstants.NS_URI_WSDL_EXTENSIONS); if (intOperExts != null && intOperExts.isSafe()) { return HTTPConstants.METHOD_GET; } } // 4. default to POST. return HTTPConstants.METHOD_POST; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootroot./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.jav0000664000175000017500000001113111767656530033024 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the HTTP namespace * added to the WSDL BindingMessageReference component as part * of the HTTP binding extension defined by the WSDL 2.0 spec. * * @author John Kaputin (jkaputin@apache.org) */ public class HTTPBindingMessageReferenceExtensionsImpl extends BaseComponentExtensionContext implements HTTPBindingMessageReferenceExtensions { public HTTPBindingMessageReferenceExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING), getProperty(HTTPConstants.PROP_HTTP_HEADERS)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(HTTPConstants.PROP_HTTP_CONTENT_ENCODING.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_CONTENT_ENCODING, getHttpContentEncoding()); } else if(HTTPConstants.PROP_HTTP_HEADERS.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_HEADERS, getHttpHeaders()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by HTTPBindingMessageReferenceExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions#getHttpContentEncoding() * */ public String getHttpContentEncoding() { StringAttr contentEncoding = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING); return (contentEncoding != null ? contentEncoding.getString() : null); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions#getHttpHeaders() */ public HTTPHeader[] getHttpHeaders() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(HTTPConstants.Q_ELEM_HTTP_HEADER); int len = extEls.length; HTTPHeader[] httpHeaders = new HTTPHeader[len]; System.arraycopy(extEls, 0, httpHeaders, 0, len); return httpHeaders; } } ./src/org/apache/woden/internal/wsdl20/extensions/http/HTTPEndpointExtensionsImpl.java0000664000175000017500000001063611767656530030260 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.http; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.HTTPAuthenticationSchemeAttr; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the HTTP namespace added to the WSDL * Endpoint component as part of the HTTP binding extension * defined by the WSDL 2.0 spec. * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public class HTTPEndpointExtensionsImpl extends BaseComponentExtensionContext implements HTTPEndpointExtensions { public HTTPEndpointExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(HTTPConstants.PROP_HTTP_AUTHENTICATION_SCHEME), getProperty(HTTPConstants.PROP_HTTP_AUTHENTICATION_REALM)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(HTTPConstants.PROP_HTTP_AUTHENTICATION_SCHEME.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_AUTHENTICATION_SCHEME, getHttpAuthenticationScheme()); } else if(HTTPConstants.PROP_HTTP_AUTHENTICATION_REALM.equals(propertyName)) { return newExtensionProperty(HTTPConstants.PROP_HTTP_AUTHENTICATION_REALM, getHttpAuthenticationRealm()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by HTTPEndpointExtensions * ************************************************************/ /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions#getHttpAuthenticationScheme() */ public HTTPAuthenticationScheme getHttpAuthenticationScheme() { HTTPAuthenticationSchemeAttr scheme = (HTTPAuthenticationSchemeAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_AUTHENTICATION_SCHEME); return scheme != null ? scheme.getScheme() : null; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions#getHttpAuthenticationRealm() */ public String getHttpAuthenticationRealm() { StringAttr realm = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_AUTHENTICATION_REALM); return realm != null ? realm.getString() : null; } } ./src/org/apache/woden/internal/wsdl20/extensions/ElementExtensibleImpl.java0000664000175000017500000000734011767656530026353 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions; import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.extensions.ElementExtensible; import org.apache.woden.wsdl20.extensions.ExtensionElement; /** * Common code for handling extension elements. * Can be reused by inheritance or by delegation. * * @author jkaputin@ws.apache.org */ public class ElementExtensibleImpl implements ElementExtensible { private List fExtElements = new Vector(); /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#addExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void addExtensionElement(ExtensionElement extEl) { if(extEl != null) { fExtElements.add(extEl); } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#removeExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void removeExtensionElement(ExtensionElement extEl) { fExtElements.remove(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElements() */ public ExtensionElement[] getExtensionElements() { ExtensionElement[] array = new ExtensionElement[fExtElements.size()]; fExtElements.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElementsOfType(javax.xml.namespace.QName) */ public ExtensionElement[] getExtensionElementsOfType(QName extType) { List elements = new Vector(); if(extType != null) { for(Iterator i=fExtElements.iterator(); i.hasNext();) { ExtensionElement extElem = (ExtensionElement)i.next(); if(extElem.getExtensionType().equals(extType)) { elements.add(extElem); } } } ExtensionElement[] array = new ExtensionElement[elements.size()]; elements.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#hasExtensionElementsForNamespace(javax.net.URI) */ public boolean hasExtensionElementsForNamespace(URI namespace) { boolean result = false; if(namespace != null) { String extensionNS = namespace.toString(); for(Iterator i=fExtElements.iterator(); i.hasNext();) { ExtensionElement extElem = (ExtensionElement)i.next(); if(extensionNS.equals(extElem.getExtensionType().getNamespaceURI())) { result = true; break; } } } return result; } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/0000775000175000017500000000000011767656530022210 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java0000664000175000017500000002134011767656530031673 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPLocation; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.StringAttr; import org.apache.woden.xml.URIAttr; /** * This class defines the properties from the SOAP namespace * added to the WSDL BindingOperation component as part * of the SOAP binding extension defined by the WSDL 2.0 spec. * * @author jkaputin@apache.org */ public class SOAPBindingOperationExtensionsImpl extends BaseComponentExtensionContext implements SOAPBindingOperationExtensions { public SOAPBindingOperationExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(SOAPConstants.PROP_SOAP_MEP), getProperty(SOAPConstants.PROP_SOAP_ACTION), getProperty(SOAPConstants.PROP_SOAP_MODULES)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(SOAPConstants.PROP_SOAP_MEP.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MEP, getSoapMep()); } else if(SOAPConstants.PROP_SOAP_ACTION.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_ACTION, getSoapAction()); } else if(SOAPConstants.PROP_SOAP_MODULES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MODULES, getSoapModules()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by SOAPBindingOperationExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getSoapMep() */ public URI getSoapMep() { URIAttr mep = (URIAttr) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_MEP); return mep != null ? mep.getURI() : null; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getSoapAction() */ public URI getSoapAction() { URIAttr action = (URIAttr) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_ACTION); return action != null ? action.getURI() : null; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getSoapModules() */ public SOAPModule[] getSoapModules() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_MODULE); int len = extEls.length; SOAPModule[] soapMods = new SOAPModule[len]; System.arraycopy(extEls, 0, soapMods, 0, len); return soapMods; } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getHttpLocation() */ public HTTPLocation getHttpLocation() { Binding binding = (Binding) ((NestedComponent)getParent()).getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { StringAttr httpLoc = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_LOCATION); return httpLoc != null ? new HTTPLocation(httpLoc.getString()) : null; } else { return null; } } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getHttpQueryParameterSeparator() */ public String getHttpQueryParameterSeparator() { Binding binding = (Binding) ((NestedComponent)getParent()).getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { StringAttr separator = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR); return separator != null ? separator.getString() : null; } else { return null; } } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getHttpContentEncodingDefault() */ public String getHttpContentEncodingDefault() { Binding binding = (Binding) ((NestedComponent)getParent()).getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { StringAttr ceDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT); return ceDef != null ? ceDef.getString() : null; } else { return null; } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootroot./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsImpl.java./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsImpl.jav0000664000175000017500000001704611767656530033005 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the SOAP namespace * added to the WSDL BindingMessageReference component as part * of the SOAP binding extension defined by the WSDL 2.0 spec. * * @author jkaputin@apache.org */ public class SOAPBindingMessageReferenceExtensionsImpl extends BaseComponentExtensionContext implements SOAPBindingMessageReferenceExtensions { public SOAPBindingMessageReferenceExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(SOAPConstants.PROP_SOAP_MODULES), getProperty(SOAPConstants.PROP_SOAP_HEADERS)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(SOAPConstants.PROP_SOAP_MODULES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MODULES, getSoapModules()); } else if(SOAPConstants.PROP_SOAP_HEADERS.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_HEADERS, getSoapHeaders()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by SOAPBindingFaultExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions#getSoapModules() */ public SOAPModule[] getSoapModules() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_MODULE); int len = extEls.length; SOAPModule[] soapMods = new SOAPModule[len]; System.arraycopy(extEls, 0, soapMods, 0, len); return soapMods; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions#getSoapHeaders() */ public SOAPHeaderBlock[] getSoapHeaders() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_HEADER); int len = extEls.length; SOAPHeaderBlock[] soapHeaders = new SOAPHeaderBlock[len]; System.arraycopy(extEls, 0, soapHeaders, 0, len); return soapHeaders; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions#getHttpContentEncoding() * */ public String getHttpContentEncoding() { BindingOperation bindingOp = (BindingOperation) ((NestedComponent)getParent()).getParent(); Binding binding = (Binding) bindingOp.getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { StringAttr contEncoding = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING); return contEncoding != null ? contEncoding.getString() : null; } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions#getHttpHeaders() */ public HTTPHeader[] getHttpHeaders() { BindingOperation bindingOp = (BindingOperation) ((NestedComponent)getParent()).getParent(); Binding binding = (Binding) bindingOp.getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return new HTTPHeader[0]; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(HTTPConstants.Q_ELEM_HTTP_HEADER); int len = extEls.length; HTTPHeader[] httpHeaders = new HTTPHeader[len]; System.arraycopy(extEls, 0, httpHeaders, 0, len); return httpHeaders; } else { return new HTTPHeader[0]; } } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingFaultExtensionsImpl.java0000664000175000017500000002474311767656530031020 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.internal.xml.QNameListOrTokenAnyAttrImpl; import org.apache.woden.internal.xml.QNameOrTokenAnyAttrImpl; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPFaultCode; import org.apache.woden.wsdl20.extensions.soap.SOAPFaultSubcodes; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.StringAttr; /** * This class defines the properties from the SOAP namespace * added to the WSDL BindingFault component as part * of the SOAP binding extension defined by the WSDL 2.0 spec. * * @author John Kaputin (jkaputin@apache.org) */ public class SOAPBindingFaultExtensionsImpl extends BaseComponentExtensionContext implements SOAPBindingFaultExtensions { public SOAPBindingFaultExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(SOAPConstants.PROP_SOAP_FAULT_CODE), getProperty(SOAPConstants.PROP_SOAP_FAULT_SUBCODES), getProperty(SOAPConstants.PROP_SOAP_MODULES), getProperty(SOAPConstants.PROP_SOAP_HEADERS)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(SOAPConstants.PROP_SOAP_FAULT_CODE.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_FAULT_CODE, getSoapFaultCode()); } else if(SOAPConstants.PROP_SOAP_FAULT_SUBCODES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_FAULT_SUBCODES, getSoapFaultSubcodes()); } else if(SOAPConstants.PROP_SOAP_MODULES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MODULES, getSoapModules()); } else if(SOAPConstants.PROP_SOAP_HEADERS.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_HEADERS, getSoapHeaders()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by SOAPBindingFaultExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getSoapFaultCode() */ public SOAPFaultCode getSoapFaultCode() { /* QNameOrTokenAnyAttrImpl is the class registered for this extension attribute. Use this type * here, rather than the QNameOrTokenAttr interface, to guarantee that if the code contains an * xs:token it is of type #any. */ QNameOrTokenAnyAttrImpl code = (QNameOrTokenAnyAttrImpl) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_CODE); if(code == null) { //defaults to xs:token #any if the attribute is omitted from the WSDL. return SOAPFaultCode.ANY; } if(code.isToken()) { return SOAPFaultCode.ANY; } if(code.isQName()) { return new SOAPFaultCode(code.getQName()); } else { //the wsoap:code attribute contains an invalid value (i.e. not an xs:QName or the xs:token #any) //TODO confirm if this should be represented in the Component model as a null return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getSoapFaultSubcodes() */ public SOAPFaultSubcodes getSoapFaultSubcodes() { /* QNameListOrTokenAnyAttrImpl is the class registered for this extension attribute. Use this type * here, rather than the QNameListOrTokenAttr interface, to gaurantee that if the code contains an * xs:token it is of type #any. */ QNameListOrTokenAnyAttrImpl subcodes = (QNameListOrTokenAnyAttrImpl) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_SUBCODES); if(subcodes == null) { //defaults to xs:token #any if the attribute is omitted from the WSDL. return SOAPFaultSubcodes.ANY; } if(subcodes.isToken()) { return SOAPFaultSubcodes.ANY; } if(subcodes.isQNameList()) { return new SOAPFaultSubcodes(subcodes.getQNames()); } else { //the wsoap:subcodes attribute contains an invalid value (i.e. not a list of xs:QName or the xs:token #any) //TODO confirm if this should be represented in the Component model as a null return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getSoapModules() */ public SOAPModule[] getSoapModules() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_MODULE); int len = extEls.length; SOAPModule[] soapMods = new SOAPModule[len]; System.arraycopy(extEls, 0, soapMods, 0, len); return soapMods; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getSoapHeaders() */ public SOAPHeaderBlock[] getSoapHeaders() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_HEADER); int len = extEls.length; SOAPHeaderBlock[] soapHeaders = new SOAPHeaderBlock[len]; System.arraycopy(extEls, 0, soapHeaders, 0, len); return soapHeaders; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getHttpContentEncoding() * */ public String getHttpContentEncoding() { Binding binding = (Binding) ((NestedComponent)getParent()).getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { StringAttr contEncoding = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING); return contEncoding != null ? contEncoding.getString() : null; } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions#getHttpHeaders() */ public HTTPHeader[] getHttpHeaders() { Binding binding = (Binding) ((NestedComponent)getParent()).getParent(); SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return new HTTPHeader[0]; } if( (SOAPConstants.VERSION_1_2.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP12_HTTP)) || (SOAPConstants.VERSION_1_1.equals(version) && protocol.equals(SOAPConstants.PROTOCOL_URI_SOAP11_HTTP)) ) { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(HTTPConstants.Q_ELEM_HTTP_HEADER); int len = extEls.length; HTTPHeader[] httpHeaders = new HTTPHeader[len]; System.arraycopy(extEls, 0, httpHeaders, 0, len); return httpHeaders; } else { return new HTTPHeader[0]; } } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPEndpointExtensionsImpl.java0000664000175000017500000001351711767656530030227 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.Endpoint; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPEndpointExtensions; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.HTTPAuthenticationSchemeAttr; import org.apache.woden.xml.StringAttr; /** * This interface represents the properties from the HTTP namespace added to the * WSDL 2.0 Endpoint component when the binding type is SOAP and the * underlying protocol is HTTP. * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public class SOAPEndpointExtensionsImpl extends BaseComponentExtensionContext implements SOAPEndpointExtensions { public SOAPEndpointExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[0]; //no SOAP extensions properties for Endpoint } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { return null; //no SOAP extension properties for Endpoint } /* ************************************************************ * Additional methods declared by SOAPEndpointExtensions * ************************************************************/ /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.soap.SOAPEndpointExtensions#getHttpAuthenticationScheme() */ public HTTPAuthenticationScheme getHttpAuthenticationScheme() { Endpoint endpoint = (Endpoint) getParent(); Binding binding = endpoint.getBinding(); if(binding == null) { return null; //the wsdl is invalid TODO - remove this check? (extensions require valid wsdl?) } SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( ("1.2".equals(version) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP12_HTTP)) || ("1.1".equals(version) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP11_HTTP)) ) { HTTPAuthenticationSchemeAttr scheme = (HTTPAuthenticationSchemeAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_AUTHENTICATION_SCHEME); return scheme != null ? scheme.getScheme() : null; } else { return null; } } /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.soap.SOAPEndpointExtensions#getHttpAuthenticationRealm() */ public String getHttpAuthenticationRealm() { Endpoint endpoint = (Endpoint) getParent(); Binding binding = endpoint.getBinding(); if(binding == null) { return null; //the wsdl is invalid TODO - remove this check? (extensions require valid wsdl?) } SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding .getComponentExtensionContext(SOAPConstants.NS_URI_SOAP); String version = soapBindExt.getSoapVersion(); URI protocol = soapBindExt.getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( ("1.2".equals(version) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP12_HTTP)) || ("1.1".equals(version) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP11_HTTP)) ) { StringAttr realm = (StringAttr) ((WSDLElement) getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_AUTHENTICATION_REALM); return realm != null ? realm.getString() : null; } else { return null; } } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPHeaderBlockImpl.java0000664000175000017500000002704611767656530026534 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.internal.wsdl20.BindingImpl; import org.apache.woden.internal.wsdl20.TypesImpl; import org.apache.woden.internal.wsdl20.extensions.AttributeExtensibleImpl; import org.apache.woden.internal.wsdl20.extensions.ElementExtensibleImpl; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.NestedComponent; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.NestedElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.XMLAttr; import org.apache.ws.commons.schema.XmlSchemaElement; /** * This class represents the SOAPHeaderBlock Component and the <wsoap:header> * extension element that can appear within a Binding Fault or Binding Message * Reference. * * @author jkaputin@apache.org */ public class SOAPHeaderBlockImpl implements SOAPHeaderBlock, SOAPHeaderBlockElement { private WSDLElement fParent = null; private List fDocumentationElements = new Vector(); private QName fExtElementType = null; private Boolean fRequired = null; private AttributeExtensibleImpl fAttrExt = new AttributeExtensibleImpl(); private ElementExtensibleImpl fElemExt = new ElementExtensibleImpl(); private QName fElementDeclQN = null; private Boolean fMustUnderstand = null; private TypesImpl fTypes = null; /* *********************************************************************** * Component model methods (SOAPHeaderBlock interface), some shared with Element model * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock#getElementDeclaration() */ public ElementDeclaration getElementDeclaration() { ElementDeclaration elemDecl = null; Description desc = getDescriptionComponent(getParent()); elemDecl = desc.getElementDeclaration(fElementDeclQN); return elemDecl; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock#mustUnderstand() * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#mustUnderstand() */ public Boolean mustUnderstand() { return fMustUnderstand; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock#isRequired() * @see org.apache.woden.wsdl20.extensions.ExtensionElement#isRequired() */ public Boolean isRequired() { return fRequired; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock#getParent() */ public WSDLComponent getParent() { return (WSDLComponent)fParent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock#toElement() */ public SOAPHeaderBlockElement toElement() { return this; } /* *********************************************************************** * Element model-only methods (SOAPHeaderBlockElement interface) * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#setElementName(javax.xml.namespace.QName) */ public void setElementName(QName qname) { fElementDeclQN = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#getElementName() */ public QName getElementName() { return fElementDeclQN; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#getElement() */ public XmlSchemaElement getElement() { XmlSchemaElement xse = null; if(fTypes != null) { xse = fTypes.getElementDeclaration(fElementDeclQN); } return xse; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#setMustUnderstand(java.lang.Boolean) */ public void setMustUnderstand(Boolean understood) { fMustUnderstand = understood; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#setParent(org.apache.woden.wsdl20.xml.WSDLElement) */ public void setParentElement(WSDLElement wsdlEl) { fParent = wsdlEl; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#getParent() */ public WSDLElement getParentElement() { return fParent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement) */ public void addDocumentationElement(DocumentationElement docEl) { if(docEl != null) { fDocumentationElements.add(docEl); } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement#getDocumentationElements() */ public DocumentationElement[] getDocumentationElements() { DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()]; fDocumentationElements.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setElementQName(javax.xml.namespace.QName) */ public void setExtensionType(QName qname) { fExtElementType = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#getElementQName() */ public QName getExtensionType() { return fExtElementType; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setRequired(java.lang.Boolean) */ public void setRequired(Boolean required) { fRequired = required; } /* *********************************************************************** * Extensibility methods * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr) */ public void setExtensionAttribute(QName attrType, XMLAttr attr) { fAttrExt.setExtensionAttribute(attrType, attr); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName) */ public XMLAttr getExtensionAttribute(QName attrType) { return fAttrExt.getExtensionAttribute(attrType); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributesForNamespace(java.net.URI) */ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace) { return fAttrExt.getExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes() */ public XMLAttr[] getExtensionAttributes() { return fAttrExt.getExtensionAttributes(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(java.net.URI) */ public boolean hasExtensionAttributesForNamespace(URI namespace) { return fAttrExt.hasExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#addExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void addExtensionElement(ExtensionElement extEl) { fElemExt.addExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#removeExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void removeExtensionElement(ExtensionElement extEl) { fElemExt.removeExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElements() */ public ExtensionElement[] getExtensionElements() { return fElemExt.getExtensionElements(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElementsOfType(javax.xml.namespace.QName) */ public ExtensionElement[] getExtensionElementsOfType(QName extType) { return fElemExt.getExtensionElementsOfType(extType); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#hasExtensionElementsForNamespace(java.net.URI) */ public boolean hasExtensionElementsForNamespace(URI namespace) { return fElemExt.hasExtensionElementsForNamespace(namespace); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ public void setTypes(TypesElement types) { fTypes = (TypesImpl)types; } /* * This method traverses up the element graph to get the root . * TODO consider its usefulness to user-defined extensions and whether to refactor it. * e.g. declared in ExtensionElement and implemented in ExtensionElementImpl */ private DescriptionElement getDescriptionElement(WSDLElement wsdlElem) { if(wsdlElem instanceof BindingImpl) { return (DescriptionElement) ((NestedElement)wsdlElem).getParentElement(); } else { WSDLElement parentElem = ((NestedElement)wsdlElem).getParentElement(); return getDescriptionElement(parentElem); } } /* * TODO ditto previous comment about possibly refactoring this for user-defined extensions to reuse. */ private Description getDescriptionComponent(WSDLComponent wsdlComp) { if(wsdlComp instanceof BindingImpl) { return ((BindingImpl)wsdlComp).getDescriptionComponent(); } else { WSDLComponent parentComp = ((NestedComponent)wsdlComp).getParent(); return getDescriptionComponent(parentComp); } } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java0000664000175000017500000002060211767656530030012 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.BooleanAttr; import org.apache.woden.xml.StringAttr; import org.apache.woden.xml.URIAttr; /** * This class defines the properties from the SOAP namespace * added to the WSDL Binding component as part * of the SOAP binding extension defined by the WSDL 2.0 spec. * * @author jkaputin@apache.org */ public class SOAPBindingExtensionsImpl extends BaseComponentExtensionContext implements SOAPBindingExtensions { public SOAPBindingExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(SOAPConstants.PROP_SOAP_VERSION), getProperty(SOAPConstants.PROP_SOAP_UNDERLYING_PROTOCOL), getProperty(SOAPConstants.PROP_SOAP_MEP_DEFAULT), getProperty(SOAPConstants.PROP_SOAP_MODULES)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(SOAPConstants.PROP_SOAP_VERSION.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_VERSION, getSoapVersion()); } else if(SOAPConstants.PROP_SOAP_UNDERLYING_PROTOCOL.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_UNDERLYING_PROTOCOL, getSoapUnderlyingProtocol()); } else if(SOAPConstants.PROP_SOAP_MEP_DEFAULT.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MEP_DEFAULT, getSoapMepDefault()); } else if(SOAPConstants.PROP_SOAP_MODULES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MODULES, getSoapModules()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by SOAPBindingExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getSoapVersion() */ public String getSoapVersion() { StringAttr version = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_VERSION); return version != null ? version.getString() : "1.2"; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getSoapUnderlyingProtocol() */ public URI getSoapUnderlyingProtocol() { URIAttr protocol = (URIAttr) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_PROTOCOL); return protocol != null ? protocol.getURI() : null; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getSoapMepDefault() */ public URI getSoapMepDefault() { URIAttr mepDefault = (URIAttr) ((WSDLElement)getParent()) .getExtensionAttribute(SOAPConstants.Q_ATTR_SOAP_MEPDEFAULT); return mepDefault != null ? mepDefault.getURI() : null; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getSoapModules() */ public SOAPModule[] getSoapModules() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_MODULE); int len = extEls.length; SOAPModule[] soapMods = new SOAPModule[len]; System.arraycopy(extEls, 0, soapMods, 0, len); return soapMods; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getHttpQueryParameterSeparatorDefault() */ public String getHttpQueryParameterSeparatorDefault() { URI protocol = getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( ("1.2".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP12_HTTP)) || ("1.1".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP11_HTTP)) ) { StringAttr qpsDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT); return qpsDef != null ? qpsDef.getString() : HTTPConstants.QUERY_SEP_AMPERSAND; } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#isHttpCookies() */ public Boolean isHttpCookies() { URI protocol = getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( ("1.2".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP12_HTTP)) || ("1.1".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP11_HTTP)) ) { BooleanAttr cookiesUsed = (BooleanAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_COOKIES); return cookiesUsed != null ? cookiesUsed.getBoolean() : new Boolean(false); //defaults to false if omitted } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getHttpContentEncodingDefault() */ public String getHttpContentEncodingDefault() { URI protocol = getSoapUnderlyingProtocol(); if(protocol == null) { return null; } if( ("1.2".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP12_HTTP)) || ("1.1".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.PROTOCOL_STRING_SOAP11_HTTP)) ) { StringAttr ceDef = (StringAttr) ((WSDLElement)getParent()) .getExtensionAttribute(HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT); return ceDef != null ? ceDef.getString() : null; } else { return null; } } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPModuleImpl.java0000664000175000017500000002024611767656530025611 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.internal.wsdl20.extensions.AttributeExtensibleImpl; import org.apache.woden.internal.wsdl20.extensions.ElementExtensibleImpl; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.XMLAttr; /** * This class represents the SOAPModule Component and the <wsoap:module> * extension element that can appear within a Binding, Binding Fault, * Binding Operation, Binding Fault Reference or Binding Message Reference. * * @author jkaputin@apache.org */ public class SOAPModuleImpl implements SOAPModule, SOAPModuleElement { private WSDLElement fParent = null; private List fDocumentationElements = new Vector(); private QName fExtElementType = null; private Boolean fRequired = null; private AttributeExtensibleImpl fAttrExt = new AttributeExtensibleImpl(); private ElementExtensibleImpl fElemExt = new ElementExtensibleImpl(); private URI fRef = null; /* *********************************************************************** * Component model methods (SOAPModule interface), shared with Element model * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModule#getRef() * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#getRef() */ public URI getRef() { return fRef; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModule#isRequired() * @see org.apache.woden.wsdl20.extensions.ExtensionElement#isRequired() */ public Boolean isRequired() { return fRequired; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModule#getParent() */ public WSDLComponent getParent() { return (WSDLComponent)fParent; } /* * @see org.apache.woden.wsdl20.extensions.soap.SOAPModule#toElement() */ public SOAPModuleElement toElement() { return this; } /* *********************************************************************** * Element model-only methods (SOAPModuleElement interface) * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#setRef(java.net.URI) */ public void setRef(URI uri) { fRef = uri; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#setParentElement(org.apache.woden.wsdl20.xml.WSDLElement) */ public void setParentElement(WSDLElement wsdlEl) { fParent = wsdlEl; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#getParentElement() */ public WSDLElement getParentElement() { return fParent; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement) */ public void addDocumentationElement(DocumentationElement docEl) { if(docEl != null) { fDocumentationElements.add(docEl); } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement#getDocumentationElements() */ public DocumentationElement[] getDocumentationElements() { DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()]; fDocumentationElements.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setElementQName(javax.xml.namespace.QName) */ public void setExtensionType(QName qname) { fExtElementType = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#getElementQName() */ public QName getExtensionType() { return fExtElementType; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setRequired(java.lang.Boolean) */ public void setRequired(Boolean required) { fRequired = required; } /* *********************************************************************** * Extensibility methods * ***********************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr) */ public void setExtensionAttribute(QName attrType, XMLAttr attr) { fAttrExt.setExtensionAttribute(attrType, attr); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName) */ public XMLAttr getExtensionAttribute(QName attrType) { return fAttrExt.getExtensionAttribute(attrType); } /* (non-Javadoc) */ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace) { return fAttrExt.getExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes() */ public XMLAttr[] getExtensionAttributes() { return fAttrExt.getExtensionAttributes(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(java.net.URI) */ public boolean hasExtensionAttributesForNamespace(URI namespace) { return fAttrExt.hasExtensionAttributesForNamespace(namespace); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#addExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void addExtensionElement(ExtensionElement extEl) { fElemExt.addExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#removeExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement) */ public void removeExtensionElement(ExtensionElement extEl) { fElemExt.removeExtensionElement(extEl); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElements() */ public ExtensionElement[] getExtensionElements() { return fElemExt.getExtensionElements(); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElementsOfType(javax.xml.namespace.QName) */ public ExtensionElement[] getExtensionElementsOfType(QName extType) { return fElemExt.getExtensionElementsOfType(extType); } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ElementExtensible#hasExtensionElementsForNamespace(java.net.URI) */ public boolean hasExtensionElementsForNamespace(URI namespace) { return fElemExt.hasExtensionElementsForNamespace(namespace); } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingFaultReferenceExtensionsImpl.java0000664000175000017500000000747711767656530032644 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This class defines the properties from the SOAP namespace * added to the WSDL BindingFaultReference component as part * of the SOAP binding extension defined by the WSDL 2.0 spec. * * @author jkaputin@apache.org */ public class SOAPBindingFaultReferenceExtensionsImpl extends BaseComponentExtensionContext implements SOAPBindingFaultReferenceExtensions { public SOAPBindingFaultReferenceExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] { getProperty(SOAPConstants.PROP_SOAP_MODULES)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(SOAPConstants.PROP_SOAP_MODULES.equals(propertyName)) { return newExtensionProperty(SOAPConstants.PROP_SOAP_MODULES, getSoapModules()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by SOAPBindingFaultReferenceExtensions * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions#getSoapModules() */ public SOAPModule[] getSoapModules() { ExtensionElement[] extEls = ((WSDLElement)getParent()) .getExtensionElementsOfType(SOAPConstants.Q_ELEM_SOAP_MODULE); int len = extEls.length; SOAPModule[] soapMods = new SOAPModule[len]; System.arraycopy(extEls, 0, soapMods, 0, len); return soapMods; } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPModuleDeserializer.java0000664000175000017500000001110511767656530027324 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import java.net.URI; import java.net.URISyntaxException; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.wsdl20.extensions.ExtensionDeserializer; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.extensions.soap.SOAPModuleElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentableElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * Deserializes the <wsoap:module> extension element into a SOAPModuleElement. * * @author jkaputin@apache.org * */ public class SOAPModuleDeserializer implements ExtensionDeserializer { /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionDeserializer#unmarshall(java.lang.Class, javax.xml.namespace.QName, org.w3c.dom.Element, org.apache.woden.wsdl20.xml.DescriptionElement, org.apache.woden.wsdl20.extensions.ExtensionRegistry) */ public ExtensionElement unmarshall(Class parentType, Object parent, QName elementType, XMLElement el, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException { SOAPModuleElement soapMod = (SOAPModuleElement) extReg.createExtElement(parentType, elementType); soapMod.setExtensionType(elementType); soapMod.setParentElement((WSDLElement)parent); String ref = el.getAttributeValue(Constants.ATTR_REF); if(ref != null) { URI uri; try { uri = new URI(ref); soapMod.setRef(uri); } catch (URISyntaxException e) { extReg.getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL506", new Object[] {ref}, ErrorReporter.SEVERITY_ERROR, e); } } //This property defaults to 'false' if it is omitted. String required = el.getAttributeValue(Constants.ATTR_REQUIRED); soapMod.setRequired(new Boolean(required)); //TODO parseExtensionAttributes(el, SOAPModuleElement.class, soapMod, desc); XMLElement tempEl = el.getFirstChildElement(); while (tempEl != null) { if (Constants.Q_ELEM_DOCUMENTATION.equals(tempEl.getQName())) { soapMod.addDocumentationElement(parseDocumentation(tempEl, desc)); } else { //TODO parse ext elements } tempEl = tempEl.getNextSiblingElement(); } return soapMod; } private DocumentationElement parseDocumentation(XMLElement docEl, DocumentableElement parent) throws WSDLException { DocumentationElement documentation = parent.addDocumentationElement(); documentation.setContent(docEl); //TODO parseExtensionAttributes(docEl, DocumentationElement.class, documentation, desc); //TODO parseExtensionElements(...) return documentation; } } ./src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPHeaderBlockDeserializer.java0000664000175000017500000001166011767656530030250 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.soap; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.wsdl20.extensions.ExtensionDeserializer; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlockElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentableElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * Deserializes the <wsoap:header> extension element into a SOAPHeaderBlockElement. * * @author jkaputin@apache.org * */ public class SOAPHeaderBlockDeserializer implements ExtensionDeserializer { /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionDeserializer#unmarshall(java.lang.Class, java.lang.Object, javax.xml.namespace.QName, org.w3c.dom.Element, org.apache.woden.wsdl20.xml.DescriptionElement, org.apache.woden.wsdl20.extensions.ExtensionRegistry) */ public ExtensionElement unmarshall(Class parentType, Object parent, QName extType, XMLElement extEl, DescriptionElement desc, ExtensionRegistry extReg) throws WSDLException { SOAPHeaderBlockElement soapHdr = (SOAPHeaderBlockElement) extReg.createExtElement(parentType, extType); soapHdr.setExtensionType(extType); soapHdr.setParentElement((WSDLElement)parent); String elemDeclQN = extEl.getAttributeValue(Constants.ATTR_ELEMENT); if(elemDeclQN != null) { try { QName qname = extEl.getQName(elemDeclQN); soapHdr.setElementName(qname); } catch (WSDLException e) { extReg.getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL505", new Object[] {elemDeclQN, extEl.getLocalName()}, ErrorReporter.SEVERITY_ERROR); } } //This property defaults to 'false' if it is omitted. String mustUnderstand = extEl.getAttributeValue(SOAPConstants.ATTR_MUSTUNDERSTAND); soapHdr.setMustUnderstand(new Boolean(mustUnderstand)); //This property defaults to 'false' if it is omitted. String required = extEl.getAttributeValue(Constants.ATTR_REQUIRED); soapHdr.setRequired(new Boolean(required)); ((SOAPHeaderBlockImpl)soapHdr).setTypes(desc.getTypesElement()); //TODO parseExtensionAttributes(el, SOAPHeaderBlockElement.class, soapHdr, desc); XMLElement tempEl = extEl.getFirstChildElement(); while (tempEl != null) { if (Constants.Q_ELEM_DOCUMENTATION.equals(tempEl.getQName())) { soapHdr.addDocumentationElement(parseDocumentation(tempEl, desc)); } else { //TODO parse ext elements } tempEl = tempEl.getNextSiblingElement(); } return soapHdr; } private DocumentationElement parseDocumentation(XMLElement docEl, DocumentableElement parent) throws WSDLException { DocumentationElement documentation = parent.addDocumentationElement(); documentation.setContent(docEl); //TODO parseExtensionAttributes(docEl, DocumentationElement.class, documentation, desc); //TODO parseExtensionElements(...) return documentation; } } ./src/org/apache/woden/internal/wsdl20/extensions/InterfaceOperationExtensionsImpl.java0000664000175000017500000000715011767656530030577 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.WSDLExtensionConstants; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.InterfaceOperationExtensions; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.BooleanAttr; /** * This class defines the properties from the WSDL extensions namespace added to * the WSDL Interface Operation component as part of the WSDL * extension defined by the WSDL 2.0 spec. * * @author Arthur Ryman (ryman@ca.ibm.com) */ public class InterfaceOperationExtensionsImpl extends BaseComponentExtensionContext implements InterfaceOperationExtensions { public InterfaceOperationExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] {getProperty(WSDLExtensionConstants.PROP_SAFE)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(WSDLExtensionConstants.PROP_SAFE.equals(propertyName) ) { BooleanAttr safe = (BooleanAttr) ((WSDLElement)getParent()) .getExtensionAttribute(WSDLExtensionConstants.Q_ATTR_SAFE); return newExtensionProperty(WSDLExtensionConstants.PROP_SAFE, safe != null ? safe.getBoolean() : Boolean.FALSE); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by InterfaceOperationExtensions * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.InterfaceOperationExtensionContext#isSafe() */ public boolean isSafe() { Boolean safe = (Boolean)getProperty(WSDLExtensionConstants.PROP_SAFE).getContent(); return safe == Boolean.TRUE ? true : false; } } ./src/org/apache/woden/internal/wsdl20/extensions/rpc/0000775000175000017500000000000011767656530022032 5ustar brianbrian./src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCInterfaceOperationExtensionsImpl.java0000664000175000017500000000720111767656530031725 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions.rpc; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext; import org.apache.woden.wsdl20.extensions.ExtensionProperty; import org.apache.woden.wsdl20.extensions.rpc.Argument; import org.apache.woden.wsdl20.extensions.rpc.RPCConstants; import org.apache.woden.wsdl20.extensions.rpc.RPCInterfaceOperationExtensions; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.xml.ArgumentArrayAttr; /** * This class defines the properties from the WSDL RPC extensions namespace * added to the WSDL Interface Operation component as part of the * WSDL RPC extension defined by the WSDL 2.0 spec. * * @author Arthur Ryman (ryman@ca.ibm.com) */ public class RPCInterfaceOperationExtensionsImpl extends BaseComponentExtensionContext implements RPCInterfaceOperationExtensions { public RPCInterfaceOperationExtensionsImpl(WSDLComponent parent, URI extNamespace, ErrorReporter errReporter) { super(parent, extNamespace, errReporter); } /* ************************************************************ * Methods declared by ComponentExtensionContext * * These are the abstract methods inherited from BaseComponentExtensionContext, * to be implemented by this subclass. * ************************************************************/ /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties() */ public ExtensionProperty[] getProperties() { return new ExtensionProperty[] {getProperty(RPCConstants.PROP_RPC_SIGNATURE)}; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String) */ public ExtensionProperty getProperty(String propertyName) { if(RPCConstants.PROP_RPC_SIGNATURE.equals(propertyName) ) { return newExtensionProperty(RPCConstants.PROP_RPC_SIGNATURE, getRPCSignature()); } else { return null; //the specified property name does not exist } } /* ************************************************************ * Additional methods declared by RPCInterfaceOperationExtensions * ************************************************************/ /* * (non-Javadoc) * * @see org.apache.woden.wsdl20.extensions.rpc.RPCInterfaceOperationExtensions#getRPCSignature() */ public Argument[] getRPCSignature() { ArgumentArrayAttr args = (ArgumentArrayAttr) ((WSDLElement)getParent()) .getExtensionAttribute(RPCConstants.Q_ATTR_RPC_SIGNATURE); if (args == null) return new Argument[0]; return args.getArgumentArray(); } } ./src/org/apache/woden/internal/wsdl20/extensions/ExtensionElementImpl.java0000664000175000017500000000370711767656530026230 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.extensions.ExtensionElement; /** * Common code for extension elements. * * @author jkaputin@ws.apache.org */ public class ExtensionElementImpl implements ExtensionElement { private QName fExtElementType = null; private Boolean fRequired = null; /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setExtensionType(javax.xml.namespace.QName) */ public void setExtensionType(QName qname) { fExtElementType = qname; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#getExtensionType() */ public QName getExtensionType() { return fExtElementType; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#setRequired(java.lang.Boolean) */ public void setRequired(Boolean required) { fRequired = required; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.ExtensionElement#isRequired() */ public Boolean isRequired() { return fRequired; } } ./src/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.java0000664000175000017500000001035611767656530026726 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions; import java.net.URI; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.wsdl20.extensions.AttributeExtensible; import org.apache.woden.xml.XMLAttr; /** * Common code for handling extension attributes. * Can be reused by inheritance or by delegation. * * @author jkaputin@ws.apache.org */ public class AttributeExtensibleImpl implements AttributeExtensible { private Map fExtAttributes = new HashMap(); /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr) */ public void setExtensionAttribute(QName attrType, XMLAttr attr) { if(attrType != null) //TODO throw IllegArgExc if it is null? { if(attr != null) { fExtAttributes.put(attrType, attr); } else { fExtAttributes.remove(attrType); } } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName) */ public XMLAttr getExtensionAttribute(QName attrType) { //TODO throw IllegArgExc if it is null? if(attrType != null) { return (XMLAttr)fExtAttributes.get(attrType); } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributesForNamespace(java.net.URI) */ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace) { if(namespace != null) { String extensionNS = namespace.toString(); List list = new Vector(); Collection coll = fExtAttributes.keySet(); for(Iterator i = coll.iterator(); i.hasNext();) { QName qn = (QName)i.next(); if(qn.getNamespaceURI().equals(extensionNS)) { list.add(fExtAttributes.get(qn)); } } XMLAttr[] array = new XMLAttr[list.size()]; list.toArray(array); return array; } else { return new XMLAttr[0]; } } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes() */ public XMLAttr[] getExtensionAttributes() { Collection coll = fExtAttributes.values(); XMLAttr[] array = new XMLAttr[coll.size()]; coll.toArray(array); return array; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(javax.net.URI) */ public boolean hasExtensionAttributesForNamespace(URI namespace) { boolean result = false; if(namespace != null) { String extensionNS = namespace.toString(); Collection coll = fExtAttributes.keySet(); for(Iterator i = coll.iterator(); i.hasNext();) { QName qn = (QName)i.next(); if(extensionNS.equals(qn.getNamespaceURI())) { result = true; break; } } } return result; } } ./src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java0000664000175000017500000004017211767656530027500 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20.extensions; import java.util.Enumeration; import java.util.StringTokenizer; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.util.PropertyUtils; import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingFaultExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingOperationExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPEndpointExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPHeaderDeserializer; import org.apache.woden.internal.wsdl20.extensions.http.HTTPHeaderImpl; import org.apache.woden.internal.wsdl20.extensions.rpc.RPCInterfaceOperationExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingFaultExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingOperationExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPEndpointExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPHeaderBlockDeserializer; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPHeaderBlockImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPModuleDeserializer; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPModuleImpl; import org.apache.woden.internal.xml.ArgumentArrayAttrImpl; import org.apache.woden.internal.xml.BooleanAttrImpl; import org.apache.woden.internal.xml.HTTPAuthenticationSchemeAttrImpl; import org.apache.woden.internal.xml.IntOrTokenAnyAttrImpl; import org.apache.woden.internal.xml.QNameListOrTokenAnyAttrImpl; import org.apache.woden.internal.xml.QNameOrTokenAnyAttrImpl; import org.apache.woden.internal.xml.StringAttrImpl; import org.apache.woden.internal.xml.URIAttrImpl; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingFault; import org.apache.woden.wsdl20.BindingFaultReference; import org.apache.woden.wsdl20.BindingMessageReference; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.Endpoint; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.extensions.WSDLExtensionConstants; import org.apache.woden.wsdl20.extensions.ExtensionRegistrar; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.extensions.http.HTTPConstants; import org.apache.woden.wsdl20.extensions.rpc.RPCConstants; import org.apache.woden.wsdl20.extensions.soap.SOAPConstants; import org.apache.woden.wsdl20.xml.BindingElement; import org.apache.woden.wsdl20.xml.BindingFaultElement; import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement; import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement; import org.apache.woden.wsdl20.xml.BindingOperationElement; import org.apache.woden.wsdl20.xml.EndpointElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; /** * This class extends ExtensionRegistry and pre-registers * serializers/deserializers for the SOAP, HTTP and MIME extensions. Java impl * types are also registered for all the SOAP and HTTP extensions defined in the * WSDL 2.0 Spec. * * This class was copied from WSDL4J and modified for Woden. * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author John Kaputin (jkaputin@apache.org) - Woden changes * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) - added * wsdlx:safe and wrpc:signature to Interface Operation, - added * HTTPAuthenticationSchemeAttrImpl */ public class PopulatedExtensionRegistry extends ExtensionRegistry { public PopulatedExtensionRegistry(ErrorReporter errorReporter) throws WSDLException { super(errorReporter); // ------------ Default type for unregistered extension attributes // ------------ /* * If a default XMLAttr type other than UnknownAttr is to be used for * unregisterd attributes, uncomment this code and replace * with the default type. registerExtAttributeType(WSDLElement.class, * new QName("http://ws.apache.org/woden", "DefaultAttr"), * Impl.class); */ // ------------ WSDL extension attributes ------------ registerExtAttributeType(InterfaceOperationElement.class, WSDLExtensionConstants.Q_ATTR_SAFE, BooleanAttrImpl.class); // ------------ WSDL Component Extensions ------------ registerComponentExtension(InterfaceOperation.class, WSDLExtensionConstants.NS_URI_WSDL_EXTENSIONS, InterfaceOperationExtensionsImpl.class); // ------------ RPC extension attributes ------------ registerExtAttributeType(InterfaceOperationElement.class, RPCConstants.Q_ATTR_RPC_SIGNATURE, ArgumentArrayAttrImpl.class); // ------------ RPC Component Extensions ------------ registerComponentExtension(InterfaceOperation.class, RPCConstants.NS_URI_RPC, RPCInterfaceOperationExtensionsImpl.class); // ------------ SOAP extension attributes ------------ registerExtAttributeType(BindingElement.class, SOAPConstants.Q_ATTR_SOAP_VERSION, StringAttrImpl.class); registerExtAttributeType(BindingElement.class, SOAPConstants.Q_ATTR_SOAP_PROTOCOL, URIAttrImpl.class); registerExtAttributeType(BindingElement.class, SOAPConstants.Q_ATTR_SOAP_MEPDEFAULT, URIAttrImpl.class); registerExtAttributeType(BindingFaultElement.class, SOAPConstants.Q_ATTR_SOAP_CODE, QNameOrTokenAnyAttrImpl.class); registerExtAttributeType(BindingFaultElement.class, SOAPConstants.Q_ATTR_SOAP_SUBCODES, QNameListOrTokenAnyAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, SOAPConstants.Q_ATTR_SOAP_MEP, URIAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, SOAPConstants.Q_ATTR_SOAP_ACTION, URIAttrImpl.class); // ------------ SOAPModule extension elements ------------ SOAPModuleDeserializer soapModuleDeser = new SOAPModuleDeserializer(); // registerSerializer(BindingElement.class, // SOAPConstants.Q_ELEM_SOAP_MODULE, // ); registerDeserializer(BindingElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, soapModuleDeser); registerExtElementType(BindingElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, SOAPModuleImpl.class); registerDeserializer(BindingFaultElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, soapModuleDeser); registerExtElementType(BindingFaultElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, SOAPModuleImpl.class); registerDeserializer(BindingOperationElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, soapModuleDeser); registerExtElementType(BindingOperationElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, SOAPModuleImpl.class); registerDeserializer(BindingMessageReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, soapModuleDeser); registerExtElementType(BindingMessageReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, SOAPModuleImpl.class); registerDeserializer(BindingFaultReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, soapModuleDeser); registerExtElementType(BindingFaultReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_MODULE, SOAPModuleImpl.class); // ------------ SOAPHeaderBlock extension elements ------------ SOAPHeaderBlockDeserializer soapHeaderBlockDeser = new SOAPHeaderBlockDeserializer(); // registerSerializer(BindingFaultElement.class, // SOAPConstants.Q_ELEM_SOAP_HEADER, // ); registerDeserializer(BindingFaultElement.class, SOAPConstants.Q_ELEM_SOAP_HEADER, soapHeaderBlockDeser); registerExtElementType(BindingFaultElement.class, SOAPConstants.Q_ELEM_SOAP_HEADER, SOAPHeaderBlockImpl.class); // registerSerializer(BindingMessageReferenceElement.class, // SOAPConstants.Q_ELEM_SOAP_HEADER, // ); registerDeserializer(BindingMessageReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_HEADER, soapHeaderBlockDeser); registerExtElementType(BindingMessageReferenceElement.class, SOAPConstants.Q_ELEM_SOAP_HEADER, SOAPHeaderBlockImpl.class); // ------------ SOAP Component Extensions ------------ registerComponentExtension(Binding.class, SOAPConstants.NS_URI_SOAP, SOAPBindingExtensionsImpl.class); registerComponentExtension(BindingFault.class, SOAPConstants.NS_URI_SOAP, SOAPBindingFaultExtensionsImpl.class); registerComponentExtension(BindingOperation.class, SOAPConstants.NS_URI_SOAP, SOAPBindingOperationExtensionsImpl.class); registerComponentExtension(BindingMessageReference.class, SOAPConstants.NS_URI_SOAP, SOAPBindingMessageReferenceExtensionsImpl.class); registerComponentExtension(BindingFaultReference.class, SOAPConstants.NS_URI_SOAP, SOAPBindingFaultReferenceExtensionsImpl.class); registerComponentExtension(Endpoint.class, SOAPConstants.NS_URI_SOAP, SOAPEndpointExtensionsImpl.class); // ------------ HTTP extension attributes ------------ registerExtAttributeType(BindingElement.class, HTTPConstants.Q_ATTR_METHOD_DEFAULT, StringAttrImpl.class); registerExtAttributeType(BindingElement.class, HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT, StringAttrImpl.class); registerExtAttributeType(BindingElement.class, HTTPConstants.Q_ATTR_COOKIES, BooleanAttrImpl.class); registerExtAttributeType(BindingElement.class, HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT, StringAttrImpl.class); registerExtAttributeType(BindingFaultElement.class, HTTPConstants.Q_ATTR_CODE, IntOrTokenAnyAttrImpl.class); registerExtAttributeType(BindingFaultElement.class, HTTPConstants.Q_ATTR_CONTENT_ENCODING, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_LOCATION, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_IGNORE_UNCITED, BooleanAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_METHOD, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_INPUT_SERIALIZATION, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_OUTPUT_SERIALIZATION, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_FAULT_SERIALIZATION, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR, StringAttrImpl.class); registerExtAttributeType(BindingOperationElement.class, HTTPConstants.Q_ATTR_CONTENT_ENCODING_DEFAULT, StringAttrImpl.class); registerExtAttributeType(BindingMessageReferenceElement.class, HTTPConstants.Q_ATTR_CONTENT_ENCODING, StringAttrImpl.class); registerExtAttributeType(EndpointElement.class, HTTPConstants.Q_ATTR_AUTHENTICATION_SCHEME, HTTPAuthenticationSchemeAttrImpl.class); registerExtAttributeType(EndpointElement.class, HTTPConstants.Q_ATTR_AUTHENTICATION_REALM, StringAttrImpl.class); // ------------ HTTPHeader extension elements ------------ HTTPHeaderDeserializer httpHeaderDeser = new HTTPHeaderDeserializer(); // registerSerializer(BindingFaultElement.class, // HTTPConstants.Q_ELEM_HTTP_HEADER, // ); registerDeserializer(BindingFaultElement.class, HTTPConstants.Q_ELEM_HTTP_HEADER, httpHeaderDeser); registerExtElementType(BindingFaultElement.class, HTTPConstants.Q_ELEM_HTTP_HEADER, HTTPHeaderImpl.class); // registerSerializer(BindingMessageReferenceElement.class, // HTTPConstants.Q_ELEM_HTTP_HEADER, // ); registerDeserializer(BindingMessageReferenceElement.class, HTTPConstants.Q_ELEM_HTTP_HEADER, httpHeaderDeser); registerExtElementType(BindingMessageReferenceElement.class, HTTPConstants.Q_ELEM_HTTP_HEADER, HTTPHeaderImpl.class); // ------------ HTTP Component Extensions ------------ registerComponentExtension(Binding.class, HTTPConstants.NS_URI_HTTP, HTTPBindingExtensionsImpl.class); registerComponentExtension(BindingFault.class, HTTPConstants.NS_URI_HTTP, HTTPBindingFaultExtensionsImpl.class); registerComponentExtension(BindingOperation.class, HTTPConstants.NS_URI_HTTP, HTTPBindingOperationExtensionsImpl.class); registerComponentExtension(BindingMessageReference.class, HTTPConstants.NS_URI_HTTP, HTTPBindingMessageReferenceExtensionsImpl.class); registerComponentExtension(Endpoint.class, HTTPConstants.NS_URI_HTTP, HTTPEndpointExtensionsImpl.class); //Register other, user-defined WSDL extensions. registerExtensions(); } /* * Registers WSDL extensions with this extension registry, * via the ExtensionRegistrar callback interface. * */ private void registerExtensions() throws WSDLException { Enumeration registrarNames = getRegistrarNames(); if (registrarNames != null) { while (registrarNames.hasMoreElements()) { String extensionRegistrarClassName = ((String)registrarNames.nextElement()).trim(); try { Class clazz = Class.forName(extensionRegistrarClassName); ExtensionRegistrar registrar = (ExtensionRegistrar)clazz.newInstance(); registrar.registerExtensions(this); } catch (ClassNotFoundException cnfe) { ErrorReporter er = getErrorReporter(); er.reportError( null, "WSDL020", new Object[] {extensionRegistrarClassName}, ErrorReporter.SEVERITY_ERROR, cnfe); } catch (ClassCastException cce) { getErrorReporter().reportError( null, "WSDL021", new Object[] {extensionRegistrarClassName}, ErrorReporter.SEVERITY_ERROR, cce); } catch (Exception e) { getErrorReporter().reportError( null, "WSDL022", new Object[] {extensionRegistrarClassName}, ErrorReporter.SEVERITY_ERROR, e); } } } } /* * Returns an Enumeration of ExtensionRegistrar class names. * The REGISTRAR_PROPERTY property contains a comma-separated list of * ExtensionRegistrar class names. * @return an Enumeration of ExtensionRegistrar class names. */ private Enumeration getRegistrarNames() { String registrarNames = PropertyUtils.findProperty(ExtensionRegistry.REGISTRAR_PROPERTY); return registrarNames == null ? null : new StringTokenizer(registrarNames, ","); } }./src/org/apache/woden/internal/wsdl20/InterfaceImpl.java0000664000175000017500000005211311767656530022436 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.wsdl20; import java.net.URI; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.types.NCName; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.InterfaceFault; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.WSDLComponent; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.xml.WSDLElement; import org.apache.woden.wsdl20.fragids.FragmentIdentifier; import org.apache.woden.wsdl20.fragids.InterfacePart; /** * This class represents the Interface component from the * WSDL 2.0 Component Model and <interface> element. * * @author jkaputin@apache.org */ public class InterfaceImpl extends WSDLComponentImpl implements Interface, InterfaceElement { private WSDLElement fParentElem = null; /* This field refers to the Description component which contains this Interface * component in its {interfaces} property. It is set whenever this Interface is * returned by that Description's getInterfaces() or getInterface(QName) methods. * Note that with modularization via a wsdl import or include, this * reference may be different to fDescriptionElement because it refers to the * importing or including description at the top of the wsdl tree (whereas the * latter refers to the description in which this interface is directly declared). * This field is used to retrieve components that are available (i.e. in-scope) * to the top-level Description component. e.g. it is used with interface extension * to retrieve Interface components in this Interface's {extended interfaces} * property from the set of Interfaces available (i.e. in-scope) to the Description. */ private Description fDescriptionComponent = null; private NCName fName = null; private List fExtends = new Vector(); private List fStyleDefault = new Vector(); private List fInterfaceFaultElements = new Vector(); private List fInterfaceOperationElements = new Vector(); /* ************************************************************ * Interface interface methods (the WSDL Component model) * ************************************************************/ /* * @see org.apache.woden.wsdl20.Interface#getName() * @see org.apache.woden.wsdl20.xml.InterfaceElement#getName() */ public QName getName() { QName name = null; if (fName != null) { String[] tns = DescriptionImpl.getTargetNamespaceAndPrefix(this); name = new QName(tns[0], fName.toString(), tns[1]); } return name; } /* * @see org.apache.woden.wsdl20.Interface#getExtendedInterface(javax.xml.namespace.QName) */ public Interface getExtendedInterface(QName qname) { Interface intface = fDescriptionComponent.getInterface(qname); return intface; } /* * @see org.apache.woden.wsdl20.Interface#getExtendedInterfaces() */ public Interface[] getExtendedInterfaces() { List interfaces = new Vector(); for(Iterator it = fExtends.iterator(); it.hasNext();) { QName qn = (QName)it.next(); Interface intface = getExtendedInterface(qn); if(intface != null) interfaces.add(intface); } Interface[] array = new Interface[interfaces.size()]; interfaces.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.Interface#getInterfaceFaults() */ public InterfaceFault[] getInterfaceFaults() { InterfaceFault[] array = new InterfaceFault[fInterfaceFaultElements.size()]; fInterfaceFaultElements.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.Interface#getInterfaceFault(javax.xml.namespace.QName) */ public InterfaceFault getInterfaceFault(QName faultName) { return (InterfaceFault)getInterfaceFaultElement(faultName); } /* * @see org.apache.woden.wsdl20.Interface#getAllInterfaceFaults() */ public InterfaceFault[] getAllInterfaceFaults() { List allInterfaces = new Vector(); List allInterfaceFaults = new Vector(); getAllInterfaceFaults(this, allInterfaces, allInterfaceFaults); InterfaceFault[] array = new InterfaceFault[allInterfaceFaults.size()]; allInterfaceFaults.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.Interface#getFromAllInterfaceFaults(javax.xml.namespace.QName) */ public InterfaceFault getFromAllInterfaceFaults(QName faultName) { InterfaceFault theFault = null; if(faultName != null) { InterfaceFault[] faults = getAllInterfaceFaults(); for(int i=0; i Schema[] schemas = types.getSchemas(); XmlSchema xmlSchema; for(int i=0; i and also xs:imported within by //an inlined schema within the same element. //Error case is result.xsd in the W3C WSDL 2.0 test case SparqlQuerySimplified-1G. //This check may be necessary anyway, because if the document assertion Schema-1073 //is violated, we don't want the duplicate schema components in the component model. //TODO check that this behaviour is correct (eliminating duplicates) } QName edQN = xseQN; if(xseQN.getNamespaceURI() == null && schemaTns != null) { //this is how XmlSchema represents tns for chameleon xs:includes, //so replace it with the including schema's tns. edQN = new QName(schemaTns, xseQN.getLocalPart(), xseQN.getPrefix()); } if(edQN.getPrefix() == "" || edQN.getPrefix() == null) { //if a prefix has been declared for this NS uri, include it in the qname String pfx = prefixes.getPrefix(edQN.getNamespaceURI()); if(pfx != null) { edQN = new QName(edQN.getNamespaceURI(), edQN.getLocalPart(), pfx); } } if(schemaTns == null || schemaTns.equals(edQN.getNamespaceURI())) //TODO test with schema imports, may be incorrect. { ElementDeclarationImpl ed = new ElementDeclarationImpl(); ed.setName(edQN); ed.setSystem(typeSystemURI); ed.setContentModel(Constants.API_APACHE_WS_XS); ed.setContent(elementTable.getItem(xseQN)); fDesc.addElementDeclaration(ed); } } } /* * Extract the type definitions from the given schema. */ private void buildTypeDefinitions(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) { XmlSchemaObjectTable typeTable = schemaDef.getSchemaTypes(); NamespacePrefixList prefixes = schemaDef.getNamespaceContext(); Iterator qnames = typeTable.getNames(); while (qnames.hasNext()) { QName xstQN = (QName) qnames.next(); if(SchemaConstants.NS_STRING_SCHEMA.equals(schemaTns) && !SchemaConstants.LIST_Q_BUILT_IN_TYPES.contains(xstQN)) { //XML Schema namespace is implicitly imported to get built-in types...we don't want non-built-in types. //TODO detect if the XML Schema NS has been explicitly imported (if so, we want ALL type defs) continue; } if(fDesc.getTypeDefinition(xstQN) != null) { //The Description already contains this Type Definition. continue; //The same comments apply here as stated in the buildElementDeclarations method. //TODO check that this behaviour is correct (per assertion Schema-1073). } QName tdQN = xstQN; if(xstQN.getNamespaceURI() == null && schemaTns != null) { //this is how XmlSchema represents tns for chameleon xs:includes, //so replace it with the including schema's tns. tdQN = new QName(schemaTns, xstQN.getLocalPart(), xstQN.getPrefix()); } if(tdQN.getPrefix() == emptyString || tdQN.getPrefix() == null) { //if a prefix has been declared for this NS uri, include it in the qname String pfx = prefixes.getPrefix(tdQN.getNamespaceURI()); if(pfx != null) { tdQN = new QName(tdQN.getNamespaceURI(), tdQN.getLocalPart(), pfx); } } if (schemaTns == null || schemaTns.equals(tdQN.getNamespaceURI())) { TypeDefinitionImpl td = new TypeDefinitionImpl(); td.setName(tdQN); td.setSystem(typeSystemURI); td.setContentModel(Constants.API_APACHE_WS_XS); td.setContent(typeTable.getItem(xstQN)); fDesc.addTypeDefinition(td); } } } /*************************************************************************** * INTERFACE **************************************************************************/ /* * Initialize the Interface component and its child components from the * InterfaceElement and its child elements. */ private void buildInterfaces(DescriptionImpl desc) { InterfaceElement[] interfaceEls = desc.getInterfaceElements(); for (int i = 0; i < interfaceEls.length; i++) { InterfaceImpl interfaceImpl = (InterfaceImpl) interfaceEls[i]; if (!fInterfacesDone.contains(interfaceImpl)) { buildInterfaceOperations(interfaceImpl); fInterfacesDone.add(interfaceImpl); } } } private void buildInterfaceOperations(InterfaceImpl interfaceImpl) { InterfaceOperationElement[] operations = interfaceImpl .getInterfaceOperationElements(); for (int i = 0; i < operations.length; i++) { InterfaceOperationImpl oper = (InterfaceOperationImpl) operations[i]; buildInterfaceOperationExtensions(oper); } } private void buildInterfaceOperationExtensions(InterfaceOperationImpl oper) { /* * Create a ComponentExtensions object for each registered extension * namespace used within this operation by extension elements or attributes. */ ExtensionRegistry er = fDesc.getWsdlContext().extensionRegistry; URI[] extNamespaces = er .queryComponentExtensionNamespaces(InterfaceOperation.class); for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (oper.hasExtensionAttributesForNamespace(extNS)) { ComponentExtensionContext compExt = createComponentExtensions( InterfaceOperation.class, oper, extNS); oper.setComponentExtensionContext(extNS, compExt); } } /* * {safety} is a REQUIRED extension property on interface operation * so if an InterfaceOperationExtensions object has not already been * created, create one now. */ if (oper.getComponentExtensionContext( WSDLExtensionConstants.NS_URI_WSDL_EXTENSIONS) == null) { ComponentExtensionContext compExt = createComponentExtensions( InterfaceOperation.class, oper, WSDLExtensionConstants.NS_URI_WSDL_EXTENSIONS); oper.setComponentExtensionContext( WSDLExtensionConstants.NS_URI_WSDL_EXTENSIONS, compExt); } /* * If interface operation style includes RPC then if an * RPCInterfaceOperationExtensions object has not already been * created, create one now. */ boolean isRPCStyle = false; URI[] style = oper.getStyle(); for(int i=0; i 0) { array = new URI[fStyle.size()]; fStyle.toArray(array); } else { InterfaceElement intf = (InterfaceElement)getParentElement(); URI[] styleDef = intf.getStyleDefault(); if(styleDef.length > 0) { array = styleDef; } } return array; } /* * @see org.apache.woden.wsdl20.InterfaceOperation#toElement() */ public InterfaceOperationElement toElement() { return this; } /* ************************************************************ * InterfaceOperationElement methods (the XML model) * ************************************************************/ /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#setName(NCName) */ public void setName(NCName name) { fName = name; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#setPattern(URI) */ public void setPattern(URI uri) { fMessageExchangePattern = uri; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getPattern() */ public URI getPattern() { return fMessageExchangePattern; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addStyleURI(URI) */ public void addStyleURI(URI uri) { if(uri != null) { fStyle.add(uri); } } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeStyleURI(URI) */ public void removeStyleURI(URI uri) { fStyle.remove(uri); } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addInterfaceMessageReferenceElement() */ public InterfaceMessageReferenceElement addInterfaceMessageReferenceElement() { InterfaceMessageReferenceImpl msgRef = new InterfaceMessageReferenceImpl(); fMessageRefs.add(msgRef); msgRef.setParentElement(this); return msgRef; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeInterfaceMessageReferenceElement(InterfaceMessageReferenceElement) */ public void removeInterfaceMessageReferenceElement(InterfaceMessageReferenceElement msgRef) { fMessageRefs.remove(msgRef); } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getInterfaceMessageReferenceElements() */ public InterfaceMessageReferenceElement[] getInterfaceMessageReferenceElements() { InterfaceMessageReferenceElement[] array = new InterfaceMessageReferenceElement[fMessageRefs.size()]; fMessageRefs.toArray(array); return array; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addInterfaceFaultReferenceElement() */ public InterfaceFaultReferenceElement addInterfaceFaultReferenceElement() { InterfaceFaultReferenceImpl faultRef = new InterfaceFaultReferenceImpl(); fFaultRefs.add(faultRef); faultRef.setParentElement(this); return faultRef; } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeInterfaceFaultReferenceElement(InterfaceFaultReferenceElement) */ public void removeInterfaceFaultReferenceElement(InterfaceFaultReferenceElement faultRef) { fFaultRefs.remove(faultRef); } /* * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getInterfaceFaultReferenceElements() */ public InterfaceFaultReferenceElement[] getInterfaceFaultReferenceElements() { InterfaceFaultReferenceElement[] array = new InterfaceFaultReferenceElement[fFaultRefs.size()]; fFaultRefs.toArray(array); return array; } /* * (non-Javadoc) * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier() */ public FragmentIdentifier getFragmentIdentifier() { NCName interfaceName = new NCName(((Interface)this.getParent()).getName().getLocalPart()); return new FragmentIdentifier(new InterfaceOperationPart(interfaceName, fName)); } } ./src/org/apache/woden/internal/ErrorInfoImpl.java0000664000175000017500000000526311767656530021334 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.ErrorInfo; import org.apache.woden.ErrorLocator; /** * This class is a data object containing the information needed * for reporting warnings, errors and fatal errors. It overrides * the toString() method to concatenate this information into * a single string for reporting purposes. * * @author jkaputin@apache.org */ public class ErrorInfoImpl implements ErrorInfo { //TODO decide if a data container object like this is suitable, //rather than an exception like XMLParserException used in Xerces. //TODO decide if properties captured here are sufficient for reporting needs. private ErrorLocator fErrLoc; private String fKey; private String fMessage; private Exception fException; public ErrorInfoImpl(ErrorLocator errorLocator, String key, String message, Exception exception) { fErrLoc = errorLocator; fKey = key; fMessage = message; fException = exception; } public ErrorLocator getErrorLocator() { return fErrLoc; } public String getKey() { return fKey; } public String getMessage() { return fMessage; } public Exception getException() { return fException; } public String toString() { StringBuffer sb = new StringBuffer(); if(fErrLoc != null) { sb.append(fErrLoc.getLineNumber() + ":" + fErrLoc.getColumnNumber() + ","); } sb.append(fKey + ","); sb.append(fMessage); if(fException != null) { sb.append("," + fException.getClass().getName() + ":" + fException.getMessage()); } return sb.toString(); } } ./src/org/apache/woden/internal/MessageFormatter.java0000664000175000017500000000634611767656530022060 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * This class is used for formatting error messages. Unformatted error messages * are stored in a resource bundle. Formatting involves replacing any parameters * in the unformatted message text with values supplied at invocation. The error * messages may be translated into a localized resource bundle, so a locale may be * specified to determine the localization required. * * @author jkaputin@apache.org */ public class MessageFormatter { private static final Object [] emptyMsgArray = new Object[] {}; /** * The specified key is used to retrieve an unformatted message from a * resource bundle localized for the specified locale. This text is then * formatted with the specified message args. * * @param locale the required locale * @param key the message key * @param args message parameter values * @return the formatted message text * * @throws NullPointerException if key is null * @throws MissingResourceException if a resource bundle or the specified key cannot be found * @throws ClassCastException if the object found for the specified key is not a string * @throws IllegalArgumentException if the args don't match the message. */ public String formatMessage(Locale locale, String key, Object[] args, String[] bundleNames) { ResourceBundle bundle = null; MissingResourceException mre = null; for(int i=0; i * All property names should be fully-qualified, Java package style to * avoid name clashes. All names starting with org.apache.woden. are * reserved for properties defined by the Woden implementation. * Properties specific to other implementations should be fully-qualified * to match the package name structure of that implementation. * For example: com.abc.propertyName * * @param name the name of the property to be set * @param value an Object representing the value to set the property to * @throws IllegalArgumentException if the property name is not recognized. */ public void setProperty(String name, Object value) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null)); } else if(name.equals("xyz")) { //TODO determine the required properties and //create an if block for each one to set the value. } else { //property name is not recognized, so throw an exception Object[] args = new Object[] {name}; throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL008", args)); } } /** * Returns the value of the named property. * * @param name the name of the property to get the value of * @return an Object representing the property's value * @throws IllegalArgumentException if the property name is not recognized. */ public Object getProperty(String name) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null)); } //Return the property's value or throw an exception if the property //name is not recognized if(name.equals("xyz")) { //TODO determine the required properties and //create an if block for each one to get the value. return null; } else { //property name is not recognized, so throw an exception Object[] args = new Object[] {name}; throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL008", args)); } } } ./src/org/apache/woden/internal/util/0000775000175000017500000000000011767656530016711 5ustar brianbrian./src/org/apache/woden/internal/util/StringUtils.java0000664000175000017500000001655411767656530022056 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.StringTokenizer; import java.util.Vector; /** * This class originated from WSDL4J. * * @author Matthew J. Duftler * @author jkaputin@apache.org (Woden changes) */ public class StringUtils { public static final String lineSeparator = System.getProperty("line.separator", "\n"); public static final String lineSeparatorStr = cleanString(lineSeparator); // Ensure that escape sequences are passed through properly. public static String cleanString(String str) { if (str == null) return null; else { char[] charArray = str.toCharArray(); StringBuffer sBuf = new StringBuffer(); for (int i = 0; i < charArray.length; i++) switch (charArray[i]) { case '\"' : sBuf.append("\\\""); break; case '\\' : sBuf.append("\\\\"); break; case '\n' : sBuf.append("\\n"); break; case '\r' : sBuf.append("\\r"); break; default : sBuf.append(charArray[i]); break; } return sBuf.toString(); } } /* This method will return the correct name for a class object representing a primitive, a single instance of a class, as well as n-dimensional arrays of primitives or instances. This logic is needed to handle the string returned from Class.getName(). If the class object represents a single instance (or a primitive), Class.getName() returns the fully-qualified name of the class and no further work is needed. However, if the class object represents an array (of n dimensions), Class.getName() returns a Descriptor (the Descriptor grammar is defined in section 4.3 of the Java VM Spec). This method will parse the Descriptor if necessary. */ public static String getClassName(Class targetClass) { String className = targetClass.getName(); return targetClass.isArray() ? parseDescriptor(className) : className; } /* See the comment above for getClassName(targetClass)... */ private static String parseDescriptor(String className) { char[] classNameChars = className.toCharArray(); int arrayDim = 0; int i = 0; while (classNameChars[i] == '[') { arrayDim++; i++; } StringBuffer classNameBuf = new StringBuffer(); switch (classNameChars[i++]) { case 'B' : classNameBuf.append("byte"); break; case 'C' : classNameBuf.append("char"); break; case 'D' : classNameBuf.append("double"); break; case 'F' : classNameBuf.append("float"); break; case 'I' : classNameBuf.append("int"); break; case 'J' : classNameBuf.append("long"); break; case 'S' : classNameBuf.append("short"); break; case 'Z' : classNameBuf.append("boolean"); break; case 'L' : classNameBuf.append(classNameChars, i, classNameChars.length - i - 1); break; } for (i = 0; i < arrayDim; i++) classNameBuf.append("[]"); return classNameBuf.toString(); } /* * Return a URL created from a context URL and a relative URI. * If a valid URL cannot be created the only other possibility * this method will consider is that an absolute file path has * been passed in as the relative URI argument, and it will try * to create a 'file' URL from it. * * @param contextURL the document base URL * @param fileSpec a file URI relative to the contextURL or an * absolute file path * @return the URL created from contextURL and fileSpec */ public static URL getURL(URL contextURL, String fileSpec) throws MalformedURLException { URL url = null; try { url = new URL(contextURL, fileSpec); } catch (MalformedURLException e) { File file = new File(fileSpec); if (file.isAbsolute()) { url = file.toURL(); } else { throw e; } } return url; } public static InputStream getContentAsInputStream(URL url) throws IllegalArgumentException, IOException { if (url == null) { //TODO externalize the message throw new IllegalArgumentException("URL cannot be null."); } //TODO consider exception handling used in wsdl4j Object content = url.getContent(); if (content == null) { //TODO externalize the message throw new IllegalArgumentException("No content."); } if (content instanceof InputStream) { return (InputStream)content; } else { //TODO externalize the message throw new IllegalArgumentException((content instanceof String) ? (String)content : "This URL points to a: " + StringUtils.getClassName(content.getClass())); } } public static List parseNMTokens(String nmTokens) { return parseNMTokens(nmTokens, " "); } public static List parseNMTokens(String nmTokens, String delimiter) { StringTokenizer strTok = new StringTokenizer(nmTokens, delimiter); List tokens = new Vector(); while (strTok.hasMoreTokens()) { tokens.add(strTok.nextToken()); } return tokens; } public static String getNMTokens(List list) { if (list != null) { StringBuffer strBuf = new StringBuffer(); int size = list.size(); for (int i = 0; i < size; i++) { String token = (String)list.get(i); strBuf.append((i > 0 ? " " : "") + token); } return strBuf.toString(); } else { return null; } } } ./src/org/apache/woden/internal/util/PropertyUtils.java0000664000175000017500000000765111767656530022432 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; /** * This class defines the property lookup mechanism for the three supported * alternatives for specifying configuration properties. * * These alternatives, listed in search order, are: * 1. JVM system properties (e.g. java -D arguments) * 2. application properties defined in /META-INF/services (e.g. in a jar file) * 3. properties defined in a wsdl properties file located in JAVAHOME/lib directory * * @author jkaputin@apache.org */ public class PropertyUtils { private static final String PROPERTY_FILE_NAME = "wsdl.properties"; private static String fFullPropertyFileName = null; private static Properties fProperties; public static String findProperty(String propertyName) { String propertyValue = null; //First, check for a JVM-wide system property. try { propertyValue = System.getProperty(propertyName); if (propertyValue != null) { return propertyValue; } } catch (SecurityException e) { //TODO empty catch block copied from wsdl4j. Is this necessary? //Was possibly used here to ignore exc for applet invocation? } // Second, check for an application-specific /META-INF/services property //TODO put code here to check for factory impl name property in /META... // Third, check the system properties file. if (fProperties == null) { fProperties = new Properties(); String propFileName = getFullPropertyFileName(); if (propFileName != null) { try { File propFile = new File(propFileName); FileInputStream fis = new FileInputStream(propFile); fProperties.load(fis); fis.close(); } catch (IOException e) { //TODO empty catch block copied from wsdl4j. Necessary? } } } propertyValue = fProperties.getProperty(propertyName); if (propertyValue != null) { return propertyValue; } //Return null if we can't find the property return null; } private static String getFullPropertyFileName() { if (fFullPropertyFileName == null) { try { String javaHome = System.getProperty("java.home"); fFullPropertyFileName = javaHome + File.separator + "lib" + File.separator + PROPERTY_FILE_NAME; } catch (SecurityException e) { //TODO empty catch block copied from wsdl4j. Is this necessary? //Was possibly used here to ignore exc for applet invocation? } } return fFullPropertyFileName; } } ./src/org/apache/woden/internal/util/dom/0000775000175000017500000000000011767656530017470 5ustar brianbrian./src/org/apache/woden/internal/util/dom/DOMQNameUtils.java0000664000175000017500000000252511767656530022721 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util.dom; import javax.xml.namespace.QName; import org.w3c.dom.Node; /** * This class originated from WSDL4J * * @author jkaputin@apache.org (Woden changes) * */ public class DOMQNameUtils { public static boolean matches(QName qname, Node node) { return (node != null && qname.equals(newQName(node))); } public static QName newQName(Node node) { if (node != null) { return new QName(node.getNamespaceURI(), node.getLocalName()); } else { return null; } } }./src/org/apache/woden/internal/util/dom/XPathUtils.java0000664000175000017500000001267511767656530022413 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util.dom; import java.util.Vector; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; /** * This class copied from WSDL4J. * * A XPathUtils ... * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com) */ public class XPathUtils { private static Node getPreviousTypedNode(Node node, short nodeType) { node = node.getPreviousSibling(); while (node != null && node.getNodeType() != nodeType) { node = node.getPreviousSibling(); } return node; } private static Node getNextTypedNode(Node node, short nodeType) { node = node.getNextSibling(); while (node != null && node.getNodeType() != nodeType) { node = node.getNextSibling(); } return node; } private static String getValue(Node node, short nodeType) { switch (nodeType) { case Node.ELEMENT_NODE : return ((Element)node).getTagName(); case Node.TEXT_NODE : return ((Text)node).getData(); case Node.PROCESSING_INSTRUCTION_NODE : return ((ProcessingInstruction)node).getData(); default : return ""; } } private static short getNodeType(Node node) { return (node != null ? node.getNodeType() : -1); } private static String getXPathFromVector(Vector path) { StringBuffer strBuf = new StringBuffer(); int length = path.size(); for (int i = 0; i < length; i++) { Node tempNode = (Node)path.elementAt(i); short nodeType = getNodeType(tempNode); String targetValue = getValue(tempNode, nodeType); int position = 1; tempNode = getPreviousTypedNode(tempNode, nodeType); while (tempNode != null) { if (nodeType == Node.ELEMENT_NODE) { if (getValue(tempNode, nodeType).equals(targetValue)) { position++; } } else { position++; } tempNode = getPreviousTypedNode(tempNode, nodeType); } boolean hasMatchingSiblings = (position > 1); if (!hasMatchingSiblings) { tempNode = (Node)path.elementAt(i); tempNode = getNextTypedNode(tempNode, nodeType); while (!hasMatchingSiblings && tempNode != null) { if (nodeType == Node.ELEMENT_NODE) { if (getValue(tempNode, nodeType).equals(targetValue)) { hasMatchingSiblings = true; } else { tempNode = getNextTypedNode(tempNode, nodeType); } } else { hasMatchingSiblings = true; } } } String step; switch (nodeType) { case Node.TEXT_NODE : step = "text()"; break; case Node.PROCESSING_INSTRUCTION_NODE : step = "processing-instruction()"; break; default : step = targetValue; break; } if (step != null && step.length() > 0) { strBuf.append('/' + step); } if (hasMatchingSiblings) { strBuf.append("[" + position + "]"); } } return strBuf.toString(); } private static Vector getVectorPathFromNode(Node node) { Vector path = new Vector(); while (node != null) { path.insertElementAt(node, 0); node = node.getParentNode(); } return path; } /** * Generates an XPath expression that will return only the given node as its * result. This method only works for element, text, document and PI nodes. * * @param node the node to generate an XPath expression for. This node must * be an element node, a text node, a document node, or a processing * instruction node. * @return an XPath expression that will return only the given node as its * result. * @exception IllegalArgumentException if the given node is not an element, * text, document or PI node. */ public static String getXPathExprFromNode(Node node) throws IllegalArgumentException { short nodeType = getNodeType(node); switch (nodeType) { case Node.ELEMENT_NODE : case Node.TEXT_NODE : case Node.PROCESSING_INSTRUCTION_NODE : return getXPathFromVector(getVectorPathFromNode(node)); case Node.DOCUMENT_NODE : return "/"; default : throw new IllegalArgumentException("Only works for element, text, " + "document, and PI nodes."); } } }./src/org/apache/woden/internal/util/dom/DOMUtils.java0000664000175000017500000003517311767656530022004 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util.dom; import java.io.PrintWriter; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.ListIterator; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.xml.WSDLElement; import org.w3c.dom.Attr; import org.w3c.dom.CharacterData; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * This class originated from WSDL4J. * * @author jkaputin@apache.org (Woden changes) */ public class DOMUtils { /** * The namespaceURI represented by the prefix xmlns. */ private static String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/"; private static final String ATTR_XMLNS = "xmlns"; private static final String emptyString = ""; /** * Returns a list of attributes of an element. Returns an * empty list if the element has no attributes. Does not * include namespace declarations. * * @param el Element whose attributes are returned * @return the List of Attr */ static public List getAttributes (Element el) { String nodename, prefix = null; List attrs = new Vector(); NamedNodeMap attrMap = el.getAttributes(); for(int i = 0; i < attrMap.getLength(); i++) { nodename = attrMap.item(i).getNodeName(); prefix = attrMap.item(i).getPrefix(); if (ATTR_XMLNS.equals(nodename) || ATTR_XMLNS.equals(prefix)) { //ignore namespace declarations continue; } else { attrs.add(attrMap.item(i)); } } return attrs; } /** * Returns the value of an attribute of an element. Returns null * if the attribute is not found (whereas Element.getAttribute * returns "" if an attrib is not found). This method should be * used for elements that support extension attributes because it * does not track unexpected attributes. * * @param el Element whose attrib is looked for * @param attrName name of attribute to look for * @return the attribute value including prefix if present */ static public String getAttribute (Element el, String attrName) { String sRet = null; Attr attr = el.getAttributeNode(attrName); if (attr != null) { sRet = attr.getValue(); } return sRet; } /** * Returns the value of an attribute of an element. Returns null * if the attribute is not found (whereas Element.getAttribute * returns "" if an attrib is not found). This method should be * used for elements that do not support extension attributes * because it tracks the element's remaining attributes so that * eventually any unexpected attributes can be identified. * * @param el Element whose attrib is looked for * @param attrName name of attribute to look for * @param remainingAttrs List of remaining attributes * @return the attribute value */ static public String getAttribute (Element el, String attrName, List remainingAttrs) { String sRet = null; Attr attr = el.getAttributeNode(attrName); if (attr != null) { sRet = attr.getValue(); remainingAttrs.remove(attr); } return sRet; } /** * Returns the value of an attribute of an element. Returns null * if the attribute is not found (whereas Element.getAttributeNS * returns "" if an attrib is not found). * * @param el Element whose attrib is looked for * @param namespaceURI namespace URI of attribute to look for * @param localPart local part of attribute to look for * @return the attribute value */ static public String getAttributeNS (Element el, String namespaceURI, String localPart) { String sRet = null; Attr attr = el.getAttributeNodeNS (namespaceURI, localPart); if (attr != null) { sRet = attr.getValue (); } return sRet; } /** * Concat all the text and cdata node children of this elem and return * the resulting text. * * @param parentEl the element whose cdata/text node values are to * be combined. * @return the concatanated string. */ static public String getChildCharacterData (Element parentEl) { if (parentEl == null) { return null; } Node tempNode = parentEl.getFirstChild(); StringBuffer strBuf = new StringBuffer(); CharacterData charData; while (tempNode != null) { switch (tempNode.getNodeType()) { case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : charData = (CharacterData)tempNode; strBuf.append(charData.getData()); break; } tempNode = tempNode.getNextSibling(); } return strBuf.toString(); } /** * Return the first child element of the given element. Null if no * children are found. * * @param elem Element whose child is to be returned * @return the first child element. */ public static Element getFirstChildElement (Element elem) { for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) { if (n.getNodeType () == Node.ELEMENT_NODE) { return (Element) n; } } return null; } /** * Return the next sibling element of the given element. Null if no * more sibling elements are found. * * @param elem Element whose sibling element is to be returned * @return the next sibling element. */ public static Element getNextSiblingElement (Element elem) { for (Node n = elem.getNextSibling (); n != null; n = n.getNextSibling ()) { if (n.getNodeType () == Node.ELEMENT_NODE) { return (Element) n; } } return null; } /** * Return the first child element of the given element which has the * given attribute with the given value. * * @param elem the element whose children are to be searched * @param attrName the attrib that must be present * @param attrValue the desired value of the attribute * * @return the first matching child element. */ public static Element findChildElementWithAttribute (Element elem, String attrName, String attrValue) { for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) { if (n.getNodeType () == Node.ELEMENT_NODE) { if (attrValue.equals (DOMUtils.getAttribute ((Element) n, attrName))) { return (Element) n; } } } return null; } /** * Count number of children of a certain type of the given element. * * @param elem the element whose kids are to be counted * * @return the number of matching kids. */ public static int countKids (Element elem, short nodeType) { int nkids = 0; for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) { if (n.getNodeType () == nodeType) { nkids++; } } return nkids; } public static void throwWSDLException(Element location) throws WSDLException { String elName = DOMQNameUtils.newQName(location).toString(); WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered unexpected element '" + elName + "'."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(location)); throw wsdlExc; } public static void throwWSDLException(Element location, List remainingAttrs) throws WSDLException { String elName = DOMQNameUtils.newQName(location).toString(); StringBuffer sb = new StringBuffer(); ListIterator i = remainingAttrs.listIterator(); while (i.hasNext()) { String attrName = DOMQNameUtils.newQName((Attr)i.next()).toString(); sb.append(attrName); sb.append( i.hasNext() ? " " : ""); } WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Element '" + elName + "' contained unexpected attributes: '" + sb.toString() + "'"); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(location)); throw wsdlExc; } public static void printAttribute(String name, String value, PrintWriter pw) { if (value != null) { pw.print(' ' + name + "=\"" + cleanString(value) + '\"'); } } /** * Prints attributes with qualified names. */ /* public static void printQualifiedAttribute(QName name, String value, Definition def, PrintWriter pw) throws WSDLException { if (name != null) { printAttribute(getQualifiedValue(name.getNamespaceURI(), name.getLocalPart(), def), value, pw); } } public static void printQualifiedAttribute(QName name, QName value, Definition def, PrintWriter pw) throws WSDLException { if (value != null) { printAttribute(getQualifiedValue(name.getNamespaceURI(), name.getLocalPart(), def), getQualifiedValue(value.getNamespaceURI(), value.getLocalPart(), def), pw); } } */ public static void printQualifiedAttribute(String name, QName value, WSDLElement elem, PrintWriter pw) throws WSDLException { if (value != null) { printAttribute(name, getQualifiedValue(value.getNamespaceURI(), value.getLocalPart(), elem), pw); } } public static String getQualifiedValue(URI namespaceURI, String localPart, WSDLElement elem) throws WSDLException { String prefix = null; if (namespaceURI != null && !namespaceURI.toString().equals("")) { prefix = elem.getNamespacePrefix(namespaceURI); } String qv = ((prefix != null && !prefix.equals("")) ? prefix + ":" : "") + localPart; return qv; } public static String getQualifiedValue(String namespaceURI, String localPart, WSDLElement elem) throws WSDLException { URI nsUri = null; if(namespaceURI != null) { try { nsUri = new URI(namespaceURI); } catch (URISyntaxException e) { // TODO handle this correctly throw new RuntimeException(e); } } return getQualifiedValue(nsUri,localPart,elem); } /* public static String getPrefix(String namespaceURI, Definition def) throws WSDLException { String prefix = def.getPrefix(namespaceURI); if (prefix == null) { throw new WSDLException(WSDLException.OTHER_ERROR, "Can't find prefix for '" + namespaceURI + "'. Namespace prefixes must be set on the" + " Definition object using the " + "addNamespace(...) method."); } return prefix; } */ public static String cleanString(String orig) { if (orig == null) { return ""; } StringBuffer strBuf = new StringBuffer(); char[] chars = orig.toCharArray(); boolean inCDATA = false; for (int i = 0; i < chars.length; i++) { if (!inCDATA) { switch (chars[i]) { case '&' : strBuf.append("&"); break; case '\"' : strBuf.append("""); break; case '\'' : strBuf.append("'"); break; case '<' : { if (chars.length >= i + 9) { String tempStr = new String(chars, i, 9); if (tempStr.equals("' : strBuf.append(">"); break; default : strBuf.append(chars[i]); break; } } else { strBuf.append(chars[i]); if (chars[i] == '>' && chars[i - 1] == ']' && chars[i - 2] == ']') { inCDATA = false; } } } return strBuf.toString(); } } ./src/org/apache/woden/internal/util/dom/DOM2Writer.java0000664000175000017500000002645711767656530022247 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util.dom; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import org.apache.woden.internal.util.ObjectRegistry; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.internal.wsdl20.Constants; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * This class copied from WSDL4J. * * This class is a utility to serialize a DOM node as XML. This class * uses the DOM Level 2 APIs. * The main difference between this class and DOMWriter is that this class * generates and prints out namespace declarations. * * @author Matthew J. Duftler (duftler@us.ibm.com) * @author Joseph Kesselman */ public class DOM2Writer { /** * The namespaceURI represented by the prefix xmlns. */ private static String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/"; /** * The namespaceURI represented by the prefix xml. */ private static String NS_URI_XML = "http://www.w3.org/XML/1998/namespace"; private static Map xmlEncodingMap = new HashMap(); static { xmlEncodingMap.put(null, Constants.XML_DECL_DEFAULT); xmlEncodingMap.put(System.getProperty("file.encoding"), Constants.XML_DECL_DEFAULT); xmlEncodingMap.put("UTF8", "UTF-8"); xmlEncodingMap.put("UTF-16", "UTF-16"); xmlEncodingMap.put("UnicodeBig", "UTF-16"); xmlEncodingMap.put("UnicodeLittle", "UTF-16"); xmlEncodingMap.put("ASCII", "US-ASCII"); xmlEncodingMap.put("ISO8859_1", "ISO-8859-1"); xmlEncodingMap.put("ISO8859_2", "ISO-8859-2"); xmlEncodingMap.put("ISO8859_3", "ISO-8859-3"); xmlEncodingMap.put("ISO8859_4", "ISO-8859-4"); xmlEncodingMap.put("ISO8859_5", "ISO-8859-5"); xmlEncodingMap.put("ISO8859_6", "ISO-8859-6"); xmlEncodingMap.put("ISO8859_7", "ISO-8859-7"); xmlEncodingMap.put("ISO8859_8", "ISO-8859-8"); xmlEncodingMap.put("ISO8859_9", "ISO-8859-9"); xmlEncodingMap.put("ISO8859_13", "ISO-8859-13"); xmlEncodingMap.put("ISO8859_15_FDIS", "ISO-8859-15"); xmlEncodingMap.put("GBK", "GBK"); xmlEncodingMap.put("Big5", "Big5"); } /** * Return a string containing this node serialized as XML. */ public static String nodeToString(Node node) { StringWriter sw = new StringWriter(); serializeAsXML(node, sw); return sw.toString(); } /** * Print an XML declaration before serializing the element. */ public static void serializeElementAsDocument(Element el, Writer writer) { PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; String xmlEncoding = java2XMLEncoding(javaEncoding); if (xmlEncoding != null) { pw.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); } else { pw.println(""); } serializeAsXML(el, writer); } /** * Serialize this node into the writer as XML. */ public static void serializeAsXML(Node node, Writer writer) { ObjectRegistry namespaceStack = new ObjectRegistry(); namespaceStack.register("xml", NS_URI_XML); PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; print(node, namespaceStack, pw, java2XMLEncoding(javaEncoding)); } private static void print(Node node, ObjectRegistry namespaceStack, PrintWriter out, String xmlEncoding) { if (node == null) { return; } boolean hasChildren = false; int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE : { if (xmlEncoding != null) { out.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); } else { out.println(""); } NodeList children = node.getChildNodes(); if (children != null) { int numChildren = children.getLength(); for (int i = 0; i < numChildren; i++) { print(children.item(i), namespaceStack, out, xmlEncoding); } } break; } case Node.ELEMENT_NODE : { namespaceStack = new ObjectRegistry(namespaceStack); out.print('<' + node.getNodeName()); String elPrefix = node.getPrefix(); String elNamespaceURI = node.getNamespaceURI(); if (elPrefix != null && elNamespaceURI != null) { boolean prefixIsDeclared = false; try { String namespaceURI = (String)namespaceStack.lookup(elPrefix); if (elNamespaceURI.equals(namespaceURI)) { prefixIsDeclared = true; } } catch (IllegalArgumentException e) { // ignore this and carry on } if (!prefixIsDeclared) { printNamespaceDecl(node, namespaceStack, out); } } NamedNodeMap attrs = node.getAttributes(); int len = (attrs != null) ? attrs.getLength() : 0; for (int i = 0; i < len; i++) { Attr attr = (Attr)attrs.item(i); out.print(' ' + attr.getNodeName() +"=\"" + normalize(attr.getValue()) + '\"'); String attrPrefix = attr.getPrefix(); String attrNamespaceURI = attr.getNamespaceURI(); if (attrPrefix != null && attrNamespaceURI != null) { boolean prefixIsDeclared = false; try { String namespaceURI = (String)namespaceStack.lookup(attrPrefix); if (attrNamespaceURI.equals(namespaceURI)) { prefixIsDeclared = true; } } catch (IllegalArgumentException e) { // ignore this and carry on } if (!prefixIsDeclared) { printNamespaceDecl(attr, namespaceStack, out); } } } NodeList children = node.getChildNodes(); if (children != null) { int numChildren = children.getLength(); hasChildren = (numChildren > 0); if (hasChildren) { out.print('>'); } for (int i = 0; i < numChildren; i++) { print(children.item(i), namespaceStack, out, xmlEncoding); } } else { hasChildren = false; } if (!hasChildren) { out.print("/>"); } break; } case Node.ENTITY_REFERENCE_NODE : { out.print('&'); out.print(node.getNodeName()); out.print(';'); break; } case Node.CDATA_SECTION_NODE : { out.print(""); break; } case Node.TEXT_NODE : { out.print(normalize(node.getNodeValue())); break; } case Node.COMMENT_NODE : { out.print(""); break; } case Node.PROCESSING_INSTRUCTION_NODE : { out.print(" 0) { out.print(' '); out.print(data); } out.println("?>"); break; } } if (type == Node.ELEMENT_NODE && hasChildren == true) { out.print("'); hasChildren = false; } } public static String java2XMLEncoding(String javaEnc) { return (String)xmlEncodingMap.get(javaEnc); } private static void printNamespaceDecl(Node node, ObjectRegistry namespaceStack, PrintWriter out) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE : { printNamespaceDecl(((Attr)node).getOwnerElement(), node, namespaceStack, out); break; } case Node.ELEMENT_NODE : { printNamespaceDecl((Element)node, node, namespaceStack, out); break; } } } private static void printNamespaceDecl(Element owner, Node node, ObjectRegistry namespaceStack, PrintWriter out) { String namespaceURI = node.getNamespaceURI(); String prefix = node.getPrefix(); if (!(namespaceURI.equals(NS_URI_XMLNS) && prefix.equals("xmlns"))) { if (DOMUtils.getAttributeNS(owner, NS_URI_XMLNS, prefix) == null) { out.print(" xmlns:" + prefix + "=\"" + namespaceURI + '\"'); } } else { prefix = node.getLocalName(); namespaceURI = node.getNodeValue(); } namespaceStack.register(prefix, namespaceURI); } private static String normalize(String s) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<' : { str.append("<"); break; } case '>' : { str.append(">"); break; } case '&' : { str.append("&"); break; } case '"' : { str.append("""); break; } case '\n' : { if (i > 0) { char lastChar = str.charAt(str.length() - 1); if (lastChar != '\r') { str.append(StringUtils.lineSeparator); } else { str.append('\n'); } } else { str.append(StringUtils.lineSeparator); } break; } default : { str.append(ch); } } } return (str.toString()); } }./src/org/apache/woden/internal/util/ObjectRegistry.java0000664000175000017500000000426011767656530022515 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.util; import java.util.Hashtable; /** * This class copied from WSDL4J. * * The ObjectRegistry is used to do name-to-object reference lookups. * If an ObjectRegistry is passed as a constructor argument, then this * ObjectRegistry will be a cascading registry: when a lookup is * invoked, it will first look in its own table for a name, and if it's not * there, it will cascade to the parent ObjectRegistry. * All registration is always local. [??] * * @author Sanjiva Weerawarana * @author Matthew J. Duftler */ public class ObjectRegistry { Hashtable reg = new Hashtable (); ObjectRegistry parent = null; public ObjectRegistry () { } public ObjectRegistry (ObjectRegistry parent) { this.parent = parent; } // register an object public void register (String name, Object obj) { reg.put (name, obj); } // unregister an object (silent if unknown name) public void unregister (String name) { reg.remove (name); } // lookup an object: cascade up if needed public Object lookup (String name) throws IllegalArgumentException { Object obj = reg.get (name); if (obj == null && parent != null) { obj = parent.lookup (name); } if (obj == null) { throw new IllegalArgumentException ("object '" + name + "' not in registry"); } return obj; } }./src/org/apache/woden/internal/DOMXMLElement.java0000664000175000017500000001764011767656530021121 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.util.dom.DOMQNameUtils; import org.apache.woden.internal.util.dom.XPathUtils; import org.apache.woden.internal.wsdl20.Constants; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.Node; public class DOMXMLElement extends BaseXMLElement{ private static final String emptyString = "".intern(); public DOMXMLElement(ErrorReporter errorReporter) { super(errorReporter); } /* * @see org.apache.woden.XMLElement#setSource(java.lang.Object) */ public void setSource(Object elem) { if(elem instanceof Element) { fSource = elem; } else { String elemClass = (elem != null ? elem.getClass().getName() : null); String xmlElementClass = this.getClass().getName(); String msg = fErrorReporter.getFormattedMessage( "WSDL019", new Object[] {elemClass, xmlElementClass}); throw new IllegalArgumentException(msg); } } /*TODO complete this method if it's added to XMLElement. * public XMLAttribute[] getAttributes() { String nodename, prefix; Element el = (Element)fSource; List attrs = new Vector(); NamedNodeMap attrMap = el.getAttributes(); for(int i = 0; i < attrMap.getLength(); i++){ nodename = attrMap.item(i).getNodeName(); prefix = attrMap.item(i).getPrefix(); if ( !(Constants.ATTR_XMLNS.equals(nodename) || Constants.ATTR_XMLNS.equals(prefix)) ) { //TODO create an XMLAttribute from attrMap.item(i) //attrs.add(xmlAttribute); } } XMLElement[] array = new XMLElement[attrs.size()]; attrs.toArray(array); return array; } */ protected String doGetAttributeValue(String attrName) { Element el = (Element)fSource; return getAttribute(el, attrName); } protected URI doGetNamespaceURI() throws WSDLException { Element el = (Element)fSource; String nsStr = el.getNamespaceURI(); URI uri = null; if (nsStr != null) { try { uri = new URI(nsStr); } catch (URISyntaxException e) { String msg = fErrorReporter.getFormattedMessage("WSDL506", new Object[] { nsStr }); throw new WSDLException(WSDLException.INVALID_WSDL, msg, e); } } return uri; } protected String doGetLocalName() { Element el = (Element)fSource; return el.getLocalName(); } protected QName doGetQName() { Element el = (Element)fSource; return new QName(el.getNamespaceURI(), el.getLocalName()); } protected QName doGetQName(String prefixedValue) throws WSDLException { Element el = (Element)fSource; int index = prefixedValue.indexOf(':'); String prefix = (index != -1) ? prefixedValue.substring(0, index) : null; String localPart = prefixedValue.substring(index + 1); String namespaceURI = getNamespaceFromPrefix(el, prefix); if(prefix != null && namespaceURI == null) { String faultCode = WSDLException.UNBOUND_PREFIX; String msg = fErrorReporter.getFormattedMessage( "WSDL513", new Object[] {prefixedValue, DOMQNameUtils.newQName(el)}); WSDLException wsdlExc = new WSDLException( faultCode, msg); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el)); throw wsdlExc; } return new QName(namespaceURI, localPart, (prefix != null ? prefix : emptyString)); } protected XMLElement doGetFirstChildElement() { XMLElement xmlElement = new DOMXMLElement(fErrorReporter); Element el = (Element)fSource; for (Node node = el.getFirstChild(); node!=null; node=node.getNextSibling()){ if (node.getNodeType() == Node.ELEMENT_NODE){ xmlElement.setSource(node); return xmlElement; } } return null; //no child element found } protected XMLElement doGetNextSiblingElement() { XMLElement xmlElement = new DOMXMLElement(fErrorReporter); Element el = (Element)fSource; for (Node node = el.getNextSibling (); node != null; node = node.getNextSibling ()) { if (node.getNodeType() == Node.ELEMENT_NODE){ xmlElement.setSource(node); return xmlElement; } } return null; //no sibling element found } protected XMLElement[] doGetChildElements() { List children = new Vector(); XMLElement temp = doGetFirstChildElement(); while(temp != null) { children.add(temp); temp = temp.getNextSiblingElement(); } XMLElement[] array = new XMLElement[children.size()]; children.toArray(array); return array; } /* ************************************************************************ * Private helper methods * ************************************************************************/ private String getAttribute(Element el, String attrName) { String sRet = null; Attr attr = el.getAttributeNode(attrName); if (attr != null) { sRet = attr.getValue(); } return sRet; } private String getAttributeNS (Element el, String namespaceURI, String localPart) { String sRet = null; Attr attr = el.getAttributeNodeNS (namespaceURI, localPart); if (attr != null) { sRet = attr.getValue (); } return sRet; } private String getNamespaceFromPrefix(Node context, String prefix) { short nodeType = context.getNodeType (); Node tempNode = null; switch (nodeType) { case Node.ATTRIBUTE_NODE : { tempNode = ((Attr) context).getOwnerElement (); break; } case Node.ELEMENT_NODE : { tempNode = context; break; } default : { tempNode = context.getParentNode (); break; } } while (tempNode != null && tempNode.getNodeType () == Node.ELEMENT_NODE) { Element tempEl = (Element) tempNode; String namespaceURI = (prefix == null) ? getAttribute (tempEl, Constants.ATTR_XMLNS) : getAttributeNS (tempEl, Constants.NS_STRING_XMLNS, prefix); if (namespaceURI != null) { return namespaceURI; } else { tempNode = tempEl.getParentNode (); } } return null; //no namespace found for specified prefix } } ./src/org/apache/woden/internal/BaseWSDLReader.java0000664000175000017500000017042611767656530021300 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.WSDLFactory; import org.apache.woden.WSDLReader; import org.apache.woden.XMLElement; import org.apache.woden.internal.resolver.SimpleURIResolver; import org.apache.woden.internal.schema.SchemaConstants; import org.apache.woden.internal.util.PropertyUtils; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.internal.wsdl20.Constants; import org.apache.woden.resolver.URIResolver; import org.apache.woden.schema.Schema; import org.apache.woden.types.NCName; import org.apache.woden.types.QNameTokenUnion; import org.apache.woden.wsdl20.enumeration.Direction; import org.apache.woden.wsdl20.enumeration.MessageLabel; import org.apache.woden.wsdl20.extensions.ExtensionDeserializer; import org.apache.woden.wsdl20.extensions.ExtensionElement; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.xml.BindingElement; import org.apache.woden.wsdl20.xml.BindingFaultElement; import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement; import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement; import org.apache.woden.wsdl20.xml.BindingOperationElement; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentableElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.EndpointElement; import org.apache.woden.wsdl20.xml.ImportElement; import org.apache.woden.wsdl20.xml.IncludeElement; import org.apache.woden.wsdl20.xml.InterfaceElement; import org.apache.woden.wsdl20.xml.InterfaceFaultElement; import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement; import org.apache.woden.wsdl20.xml.InterfaceOperationElement; import org.apache.woden.wsdl20.xml.ServiceElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.wsdl20.xml.WSDLElement; /** * This abstract class contains properties and methods common * to WSDLReader implementations. * *

    * TODO a Template Inheritance pattern that ensures WSDL validation gets invoked * (if turned on by some property) after the subclass has parsed the WSDL. Note, * this class is currently WSDL version-independent and XML parser-independent; * should try to keep it that way. * * @author John Kaputin (jkaputin@apache.org) */ public abstract class BaseWSDLReader implements WSDLReader { private final String DEFAULT_RESOLVER_PROPERTY="org.apache.woden.resolver.default"; private String fFactoryImplName = null; //TODO deprecate/remove? protected WSDLContext fWsdlContext; final protected ReaderFeatures features; protected BaseWSDLReader(WSDLContext wsdlContext) throws WSDLException { //TODO decide what to do with fact impl name...re- only known use case is to change newDescription factory method fFactoryImplName = wsdlContext.wsdlFactory.getClass().getName(); features = new ReaderFeatures(); /* Establish the default URIResolver. * * Find the class representing the default: * Search for a property setting for the default URI resolver. * The property can be set via: * 1. JVM system properties (e.g. java -D arguments) * use -Dorg.apache.woden.resolver.default= on the command line * where RHS is the name of the chosen default URIResolver implementation. * 2. application properties defined in /META-INF/services (e.g. in a jar file) * (when implemented in PropertyUtils.findProperty(String p)...) * 3. properties defined in a wsdl properties file located in JAVAHOME/lib directory */ String defaultURIResolver = PropertyUtils.findProperty(DEFAULT_RESOLVER_PROPERTY); URIResolver resolver; if (defaultURIResolver == null) { // property not set (an allowable condition) // use the "default default" URI resolver resolver = new SimpleURIResolver(); } else { try { Class resolverClass = Class.forName(defaultURIResolver); resolver = (URIResolver) resolverClass.newInstance(); } catch (Exception e) { /* Catches and wraps: ClassNotFoundException InstantiationException IllegalAccessException */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating a URIResolver implementation " + "using classname '" + defaultURIResolver + "' ", e); } } fWsdlContext = new WSDLContext( wsdlContext.wsdlFactory, wsdlContext.errorReporter, wsdlContext.extensionRegistry, resolver); } /* ************************************************************ * API public methods * ************************************************************/ /** * @return Returns the fErrorReporter. */ public ErrorReporter getErrorReporter() { return fWsdlContext.errorReporter; } /** * Get the cached WSDLFactory if there is one, otherwise * create and cache a new one. * * TODO see setFactoryImplName todo * * @return Returns a. */ protected WSDLFactory getFactory() throws WSDLException { return fWsdlContext.wsdlFactory; } /** * Stores the name of the WSDLFactory implementation class to be used for * any subsequent WSDLFactory requests, first discarding any cached factory * object. * * TODO the use case is changing the factory that creates Description objects. Decide if/how this works with WSDLContext. * * @param factoryImplName the WSDLFactory implementation classname */ public void setFactoryImplName(String factoryImplName) { //fFactory = null; fFactoryImplName = factoryImplName; } /** * @return the WSDLFactory implementation classname */ public String getFactoryImplName() { return fFactoryImplName; } public void setExtensionRegistry(ExtensionRegistry extReg) { if(extReg == null) { String msg = fWsdlContext.errorReporter.getFormattedMessage( "WSDL014", null); throw new NullPointerException(msg); } fWsdlContext = new WSDLContext( fWsdlContext.wsdlFactory, fWsdlContext.errorReporter, extReg, fWsdlContext.uriResolver); } public ExtensionRegistry getExtensionRegistry() { return fWsdlContext.extensionRegistry; } /** * Set a named feature on or off with a boolean. *

    * All feature names should be fully-qualified, Java package style to * avoid name clashes. All names starting with org.apache.woden. are * reserved for features defined by the Woden implementation. * Features specific to other implementations should be fully-qualified * to match the package name structure of that implementation. * For example: com.abc.featureName * * @param name the name of the feature to be set * @param value a boolean value where true sets the feature on, false sets it off * @throws IllegalArgumentException if the feature name is not recognized. */ public void setFeature(String name, boolean value) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL005", null)); } try { features.setValue(name, value); } catch(IllegalArgumentException e) { // Feature name is not recognized, so throw an exception. throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL006", new Object[] {name})); } } /** * Returns the on/off setting of the named feature, represented as a boolean. * * @param name the name of the feature to get the value of * @return a boolean representing the on/off state of the named feature * @throws IllegalArgumentException if the feature name is not recognized. */ public boolean getFeature(String name) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL005", null)); } try { return features.getValue(name); } catch(IllegalArgumentException e) { // Feature name is not recognized, so throw an exception. throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL006", new Object[] {name})); } } /** * Set a named property to the specified object. *

    * All property names should be fully-qualified, Java package style to * avoid name clashes. All names starting with org.apache.woden. are * reserved for properties defined by the Woden implementation. * Properties specific to other implementations should be fully-qualified * to match the package name structure of that implementation. * For example: com.abc.propertyName * * @param name the name of the property to be set * @param value an Object representing the value to set the property to * @throws IllegalArgumentException if the property name is not recognized. */ public void setProperty(String name, Object value) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null)); } else if(name.equals("xyz")) { //TODO determine the required properties and //create an if block for each one to set the value. } else { //property name is not recognized, so throw an exception Object[] args = new Object[] {name}; throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL008", args)); } } /** * Returns the value of the named property. * * @param name the name of the property to get the value of * @return an Object representing the property's value * @throws IllegalArgumentException if the property name is not recognized. */ public Object getProperty(String name) { if(name == null) { //name must not be null throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null)); } //Return the property's value or throw an exception if the property //name is not recognized if(name.equals("xyz")) { //TODO determine the required properties and //create an if block for each one to get the value. return null; } else { //property name is not recognized, so throw an exception throw new IllegalArgumentException( fWsdlContext.errorReporter.getFormattedMessage("WSDL008", new Object[] {name})); } } /* ************************************************************ * Parsing methods - e.g. parseXXXX() * ************************************************************/ /* Parse the attributes and child elements of the element. * As per the WSDL 2.0 spec, the child elements must be in the * following order if present: * * or WSDL extension elements in any order * * or WSDL extension elements in any order. * TODO validate that the elements are in correct order */ protected DescriptionElement parseDescription( String documentBaseURI, XMLElement descEl, Map wsdlModules) throws WSDLException { if(Constants.Q_ELEM_DEFINITIONS.equals(descEl.getQName())){ //To identify wsdl1.1 documents getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL514", new Object[] {Constants.Q_ELEM_DEFINITIONS, descEl.getQName()}, ErrorReporter.SEVERITY_FATAL_ERROR); } if (!Constants.Q_ELEM_DESCRIPTION.equals(descEl.getQName())) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL501", new Object[] {Constants.Q_ELEM_DESCRIPTION, descEl.getQName()}, ErrorReporter.SEVERITY_FATAL_ERROR); } //Get a new description in the context of this reader DescriptionElement desc = ((BaseWSDLFactory)getFactory()).newDescriptionElement(fWsdlContext); if(wsdlModules == null) { //This is the initial WSDL document. No imports or includes yet. //TODO this might be the place to flag the initial Desc if necessary. wsdlModules = new HashMap(); } desc.setDocumentBaseURI(getURI(documentBaseURI)); String targetNamespace = descEl.getAttributeValue(Constants.ATTR_TARGET_NAMESPACE); if(targetNamespace != null) { desc.setTargetNamespace(getURI(targetNamespace)); } parseNamespaceDeclarations(descEl, desc); parseExtensionAttributes(descEl, DescriptionElement.class, desc, desc); //parse the child elements XMLElement[] children = descEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i must be first. if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN)) { parseDocumentation(tempEl, desc, types); } else if (SchemaConstants.Q_ELEM_SCHEMA_IMPORT.equals(tempElQN)) { types.addSchema(parseSchemaImport(tempEl, desc)); } else if (SchemaConstants.Q_ELEM_SCHEMA.equals(tempElQN)) { types.addSchema(parseSchemaInline(tempEl, desc)); } else { types.addExtensionElement( parseExtensionElement(TypesElement.class, types, tempEl, desc) ); } } return types; } protected abstract Schema parseSchemaImport( XMLElement importEl, DescriptionElement desc) throws WSDLException; protected abstract Schema parseSchemaInline( XMLElement schemaEl, DescriptionElement desc) throws WSDLException; private InterfaceElement parseInterface( XMLElement interfaceEl, DescriptionElement desc) throws WSDLException { InterfaceElement intface = desc.addInterfaceElement(); String name = interfaceEl.getAttributeValue(Constants.ATTR_NAME); if(name != null) { intface.setName(new NCName(name)); } String styleDefault = interfaceEl.getAttributeValue(Constants.ATTR_STYLE_DEFAULT); if(styleDefault != null) { List stringList = StringUtils.parseNMTokens(styleDefault); String uriString = null; Iterator it = stringList.iterator(); while(it.hasNext()) { uriString = (String)it.next(); intface.addStyleDefaultURI(getURI(uriString)); } } String extendsAtt = interfaceEl.getAttributeValue(Constants.ATTR_EXTENDS); if(extendsAtt != null) { List stringList = StringUtils.parseNMTokens(extendsAtt); String qnString = null; Iterator it = stringList.iterator(); while(it.hasNext()) { qnString = (String)it.next(); intface.addExtendedInterfaceName(interfaceEl.getQName(qnString)); } } parseExtensionAttributes(interfaceEl, InterfaceElement.class, intface, desc); /* Parse the child elements of . * As per WSDL 2.0 spec, they must be in the following order if present: * * or extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = interfaceEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, the child elements must be in the following order if present: * * extension elements in any order * * TODO validate that the elements are in correct order */ private InterfaceFaultElement parseInterfaceFault( XMLElement faultEl, DescriptionElement desc, InterfaceElement parent) throws WSDLException { InterfaceFaultElement fault = parent.addInterfaceFaultElement(); String name = faultEl.getAttributeValue(Constants.ATTR_NAME); if(name != null) { fault.setName(new NCName(name)); } String element = faultEl.getAttributeValue(Constants.ATTR_ELEMENT); if(element != null) { if(element.equals(Constants.NMTOKEN_ANY)) { fault.setElement(QNameTokenUnion.ANY); } else if(element.equals(Constants.NMTOKEN_NONE)) { fault.setElement(QNameTokenUnion.NONE); } else if(element.equals(Constants.NMTOKEN_OTHER)) { fault.setElement(QNameTokenUnion.OTHER); } else { //It is not one of the allowed xs:Token values, so it must be an xs:QName try { QName qname = faultEl.getQName(element); fault.setElement(new QNameTokenUnion(qname)); } catch (WSDLException e) { getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL505", new Object[] {element, faultEl.getQName()}, ErrorReporter.SEVERITY_ERROR); } } } parseExtensionAttributes(faultEl, InterfaceFaultElement.class, fault, desc); XMLElement[] children = faultEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * or extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = operEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i is replaced by an . //The is replaced by an . //The msg label should match the msg label. if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())) { faultRef.setMessageLabel(MessageLabel.OUT); } else { faultRef.setMessageLabel(MessageLabel.IN); } } else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep)) { //Ruleset is message-triggers-fault, so fault is opposite direction to msg. //The can trigger an . //The msg label should match the msg label. if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())) { faultRef.setMessageLabel(MessageLabel.IN); //the is triggered by the } else { //TODO this MEP may have only s, not s, so treat this as an error. faultRef.setMessageLabel(MessageLabel.OUT); } } else if(Constants.MEP_URI_IN_ONLY.equals(mep)) { //TODO Ruleset is no-faults, so treat this as an error. } } parseExtensionAttributes(faultRefEl, InterfaceFaultReferenceElement.class, faultRef, desc); XMLElement[] children = faultRefEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * or extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = bindEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = bindFaultEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * or extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = bindOpEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i is replaced by an . //The is replaced by an . //The msg label should match the msg label. if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())) { faultRef.setMessageLabel(MessageLabel.OUT); } else { faultRef.setMessageLabel(MessageLabel.IN); } } else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep)) { //Ruleset is message-triggers-fault, so fault is opposite direction to msg. //The can trigger an . //The msg label should match the msg label. if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())) { faultRef.setMessageLabel(MessageLabel.IN); //the is triggered by the } else { //TODO this MEP may have only s, not s, so treat this as an error. faultRef.setMessageLabel(MessageLabel.OUT); } } else if(Constants.MEP_URI_IN_ONLY.equals(mep)) { //TODO Ruleset is no-faults, so treat this as an error. } } parseExtensionAttributes(faultRefEl, BindingFaultReferenceElement.class, faultRef, desc); /* Parse the child elements of binding operation or . * As per WSDL 2.0 spec, they must be in the following order if present: * * extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = faultRefEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i or . * As per WSDL 2.0 spec, they must be in the following order if present: * * extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = msgRefEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * * extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = serviceEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i. * As per WSDL 2.0 spec, they must be in the following order if present: * * extension elements in any order * TODO validate that the elements are in correct order */ XMLElement[] children = endpointEl.getChildElements(); XMLElement tempEl = null; QName tempElQN = null; for(int i=0; i'); printDocumentation(desEle.getDocumentationElements(), desEle, pw); printImports(desEle.getImportElements(), desEle, pw); printIncludes(desEle.getIncludeElements(), desEle, pw); printTypes(desEle.getTypesElement(), desEle, pw); printInterfaces(desEle.getInterfaceElements(), desEle, pw); printBindings(desEle.getBindingElements(), desEle, pw); printServices(desEle.getServiceElements(), desEle, pw); printExtensibilityElements(desEle.getClass(), desEle.getExtensionElements(), desEle, pw); pw.println("'); pw.flush(); } /** * Serialize the namespace declarations of the WSDL Description. * * @param namespaces a java.util.Map contains namespace of WSDL Description. * @param pw the Writer to write the xml to. */ protected void printNamespaceDeclarations(NamespaceDeclaration[] namespaces, PrintWriter pw) throws WSDLException { if (namespaces != null){ int len = namespaces.length; for(int i=0; i'); printDocumentation(importEle.getDocumentationElements(), des, pw); printExtensibilityElements(importEle.getClass(), importEle.getExtensionElements(), des, pw); pw.println(" '); } } } } /** * Serialize the IncludeElements of the WSDL element model. * * @param imports an array of IncludeElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printIncludes(IncludeElement[] includes, DescriptionElement des, PrintWriter pw) throws WSDLException { if (includes != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_INCLUDE, des); for(int ind=0;ind'); printDocumentation(includeEle.getDocumentationElements(), des, pw); printExtensibilityElements(includeEle.getClass(), includeEle.getExtensionElements(), des, pw); pw.println(" '); } } } } /** * Serialize the InterfaceElements of the WSDL element model. * * @param intrfaces an array of intrfacesElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printInterfaces(InterfaceElement[] intrfaces, DescriptionElement des, PrintWriter pw) throws WSDLException { if (intrfaces != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_INTERFACE, des); for(int ind=0;ind0){ DOMUtils.printAttribute(Constants.ATTR_EXTENDS,attrExtendedInterfaces,pw); } URI[] styleDefaults = intrface.getStyleDefault(); for(int i=0;i'); printDocumentation(intrface.getDocumentationElements(), des, pw); printOperations(intrface.getInterfaceOperationElements(), des, pw); printFaults(intrface.getInterfaceFaultElements(), des, pw); printExtensibilityElements(intrface.getClass(), intrface.getExtensionElements(), des, pw); pw.println(" '); } } } } /** * Serialize the InterfaceOperationElements of the WSDL element model. * * @param operations an array of InterfaceOperationElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printOperations(InterfaceOperationElement[] operations, DescriptionElement des, PrintWriter pw) throws WSDLException { if (operations != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_OPERATION, des); for(int ind=0;ind'); printDocumentation(operation.getDocumentationElements(), des, pw); printInterfaceMessageReferences(operation.getInterfaceMessageReferenceElements(),des, pw); printInterfaceFaultReferences(operation.getInterfaceFaultReferenceElements(),des,pw); printExtensibilityElements(operation.getClass(), operation.getExtensionElements(), des, pw); pw.println(" '); } } } } /** * Serialize the InterfaceMessageReferenceElements of the WSDL element model. * * @param msgrefs an array of InterfaceMessageReferenceElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printInterfaceMessageReferences( InterfaceMessageReferenceElement[] msgrefs, DescriptionElement des, PrintWriter pw) throws WSDLException { for(int ind=0;ind'); printDocumentation(msgRef.getDocumentationElements(), des, pw); printExtensibilityElements(msgRef.getClass(), msgRef.getExtensionElements(), des, pw); pw.println(" '); } } } /** * Serialize the InterfaceFaultReferenceElements of the WSDL element model. * * @param faulRefs an array of InterfaceFaultReferenceElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printInterfaceFaultReferences(InterfaceFaultReferenceElement[] faulRefs, DescriptionElement des, PrintWriter pw) throws WSDLException{ for(int ind=0;ind'); printDocumentation(faulRef.getDocumentationElements(), des, pw); printExtensibilityElements(faulRef.getClass(), faulRef.getExtensionElements(), des, pw); pw.println(" '); } } } /** * Serialize the InterfaceInterfaceFaultElement of the WSDL element model. * * @param faulEles an array of InterfaceFaultElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printFaults(InterfaceFaultElement[] faulEles, DescriptionElement des, PrintWriter pw) throws WSDLException{ for(int ind=0;ind'); printDocumentation(faulEle.getDocumentationElements(), des, pw); printExtensibilityElements(faulEle.getClass(), faulEle.getExtensionElements(), des, pw); pw.println(" '); } } } /** * Serialize the printBindings of the WSDL element model. * * @param bindings an array of printBindings. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printBindings(BindingElement[] bindings, DescriptionElement des, PrintWriter pw) throws WSDLException { String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_BINDING, des); for(int ind=0;ind'); printDocumentation(binding.getDocumentationElements(), des, pw); printExtensibilityElements(binding.getClass(), binding.getExtensionElements(), des, pw); printBindingOperations(binding.getBindingOperationElements(), des, pw); printBindingFaults(binding.getBindingFaultElements(), des, pw); pw.println(" '); } } } /** * Serialize the BindingFaultElements of the WSDL element model. * * @param faults an array of BindingFaultElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printBindingFaults(BindingFaultElement[] faults, DescriptionElement des, PrintWriter pw) throws WSDLException{ if (faults != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_FAULT, des); for(int ind=0;ind"); } } } } /** * Serialize the BindingOperationElements of the WSDL element model. * * @param operations an array of BindingOperationElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printBindingOperations(BindingOperationElement[] operations, DescriptionElement des, PrintWriter pw) throws WSDLException { if (operations != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_OPERATION, des); for(int ind=0;ind"); } } } } /** * Serialize the ServiceElements of the WSDL element model. * * @param services an array of ServiceElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printServices(ServiceElement[] services, DescriptionElement des, PrintWriter pw) throws WSDLException { String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_SERVICE, des); for(int ind=0;ind'); printEndpoints(service.getEndpointElements(), des, pw); printDocumentation(service.getDocumentationElements(), des, pw); printExtensibilityElements(service.getClass(),service.getExtensionElements(), des, pw); pw.println(" '); } } } /** * Serialize the EndpointElements of the WSDL element model. * * @param endpoints an array of IncludeElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printEndpoints(EndpointElement[] endpoints, DescriptionElement des, PrintWriter pw) throws WSDLException { String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_ENDPOINT, des); for(int ind=0;ind'); printDocumentation(endPoint.getDocumentationElements(), des, pw); printExtensibilityElements(endPoint.getClass(), endPoint.getExtensionElements(), des, pw); pw.println(" '); } } } /** * Serialize the TypesElements of the WSDL element model. * * * @param types an array of TypesElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printTypes(TypesElement types, DescriptionElement des, PrintWriter pw) throws WSDLException { if (types != null){ String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20, Constants.ELEM_TYPES, des); pw.print("<" + tagName); printExtensibilityAttributes(types.getExtensionAttributes(), types, pw); pw.println('>'); ExtensionElement[] extElements = types.getExtensionElements(); printExtensibilityElements(types.getClass(), extElements, des, pw); printImportedSchemas(types.getImportedSchemas(),des,pw); printInlinedSchemas(types.getInlinedSchemas(),des,pw); pw.println("'); } } /** * Serialize the InlinedSchemas of the WSDL element model. * * @param inlinedSchema an array of InlinedSchemas. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printInlinedSchemas(InlinedSchema[] inlinedSchema, DescriptionElement des, PrintWriter pw) throws WSDLException { /* previous method * * XmlSchema xs=null; // TODO used XmlSchema serialiser.Cause extra info like // attributeFormDefault="unqualified" elementFormDefault="unqualified" ..etc for(int i=0;i"); } } } /** * Serialize the ExtensibilityElements of the WSDL element model. * * @param parentType parent class of the ExtensibilityElements. * @param extensibilityElements an array of ExtensibilityElements. * @param des corresponding DescriptionElement. * @param pw the Writer to write the xml to. */ protected void printExtensibilityElements(Class parentType, ExtensionElement[] extensibilityElements, DescriptionElement def, PrintWriter pw) throws WSDLException{ if (extensibilityElements != null){ for(int ind=0;ind'); Object o = docEle.getContent().getSource(); org.w3c.dom.Element domEl = (org.w3c.dom.Element)o; /* * This is not enough to handle DocumentationElement * with nested DocumentationElements,if it is required * a recursive method based on getNodeType() * (org.w3c.dom.Node) can be used to solve this issue. */ DOM2Writer.serializeAsXML(domEl.getFirstChild(), pw); // printExtensibilityElements(Operation.class, extElements, def, pw); pw.println(" '); } } } } } ./src/org/apache/woden/internal/BaseXMLElement.java0000664000175000017500000001060511767656530021346 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.net.URI; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; /** * This abstract class implements methods of the XMLElement interface that are * common across all concrete implementations. * */ public abstract class BaseXMLElement implements XMLElement { protected Object fSource = null; protected ErrorReporter fErrorReporter = null; protected BaseXMLElement(ErrorReporter errorReporter) { fErrorReporter = errorReporter; } /* * (non-Javadoc) * @see org.apache.woden.XMLElement#setSource(java.lang.Object) */ abstract public void setSource(Object elem); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getSource() */ public final Object getSource() { return fSource; } //TODO refactor getAttributes() here /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getAttribute(java.lang.String) */ public final String getAttributeValue(String attrName) { if(fSource != null) { return doGetAttributeValue(attrName); } else { return null; } } protected abstract String doGetAttributeValue(String attrName); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getNamespaceURI() */ public final URI getNamespaceURI() throws WSDLException { if(fSource != null) { return doGetNamespaceURI(); } else { return null; } } protected abstract URI doGetNamespaceURI() throws WSDLException; /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getLocalName() */ public final String getLocalName() { if(fSource != null) { return doGetLocalName(); } else { return null; } } protected abstract String doGetLocalName(); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getQName() */ public final QName getQName() { if(fSource != null) { return doGetQName(); } else { return null; } } protected abstract QName doGetQName(); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getQName(java.lang.String) */ public final QName getQName(String prefixedValue) throws WSDLException { if(fSource != null) { return doGetQName(prefixedValue); } else { return null; } } protected abstract QName doGetQName(String prefixedValue) throws WSDLException; /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getFirstChildElement() */ public final XMLElement getFirstChildElement() { if(fSource != null) { return doGetFirstChildElement(); } else { return null; } } protected abstract XMLElement doGetFirstChildElement(); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getNextSiblingElement() */ public final XMLElement getNextSiblingElement() { if(fSource != null) { return doGetNextSiblingElement(); } else { return null; } } protected abstract XMLElement doGetNextSiblingElement(); /* * (non-Javadoc) * @see org.apache.woden.XMLElement#getChildElements() */ public final XMLElement[] getChildElements() { if(fSource != null) { return doGetChildElements(); } else { return null; } } protected abstract XMLElement[] doGetChildElements(); } ./src/org/apache/woden/internal/ReaderFeatures.java0000664000175000017500000000506111767656530021502 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.util.Hashtable; import org.apache.woden.WSDLReader; /** * This class contains all supported Woden reader features and stores * their values for individual parser configurations. * * TODO: determine the required features (e.g. org.apache.woden.verbose) and * create an ID for each value. */ public class ReaderFeatures { /** * This hashtable contains the values for the features. */ protected Hashtable values = new Hashtable(); private Boolean on = new Boolean(true); private Boolean off = new Boolean(false); public ReaderFeatures() { values.put(WSDLReader.FEATURE_VALIDATION, off); } /** * Get the value for the given feature. * @param featureId The ID of the feature for which the value is requested. * @return true if the feature is enabled, false otherwise. * @throws IllegalArgumentException if the feature is not supported. */ public boolean getValue(String featureId) throws IllegalArgumentException { Boolean value = (Boolean)values.get(featureId); if(value == null) { throw new IllegalArgumentException("The feature " + featureId + " is not supported."); } return value.booleanValue(); } /** * Set the value of the given feature * @param featureId The ID of the feature to set. * @param value The value to set for the feature. * @throws IllegalArgumentException if the feature is not supported. */ public void setValue(String featureId, boolean value) throws IllegalArgumentException { // Check if the feature is supported. if(!values.containsKey(featureId)) { throw new IllegalArgumentException("The feature " + featureId + " is not supported."); } if(value) { values.put(featureId, on); } else { values.put(featureId, off); } } } ./src/org/apache/woden/internal/ErrorHandlerImpl.java0000664000175000017500000000425711767656530022020 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.ErrorHandler; import org.apache.woden.ErrorInfo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This class implements the default error handling behaviour, which is simply * to report warnings, errors and fatal errors by printing the error info to * the system output stream. * * Implementations may replace this behaviour by providing their own implementation * of the ErrorHandler interface. * * @author jkaputin@apache.org */ public class ErrorHandlerImpl implements ErrorHandler { /** SLF based logger. */ private static final Log logger=LogFactory.getLog(ErrorHandlerImpl.class); /* (non-Javadoc) * @see org.apache.woden.ErrorHandler#warning(org.apache.woden.ErrorInfo) */ public void warning(ErrorInfo errorInfo) { logger.warn("Woden[Warning]," + errorInfo.toString()); } /* (non-Javadoc) * @see org.apache.woden.ErrorHandler#error(org.apache.woden.ErrorInfo) */ public void error(ErrorInfo errorInfo) { logger.error("Woden[Error]," + errorInfo.toString()); } /* (non-Javadoc) * @see org.apache.woden.ErrorHandler#fatalError(org.apache.woden.ErrorInfo) */ public void fatalError(ErrorInfo errorInfo) { logger.fatal("Woden[Fatal Error]," + errorInfo.toString()); } } ./src/org/apache/woden/internal/xml/0000775000175000017500000000000011767656530016534 5ustar brianbrian./src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java0000664000175000017500000001010011767656530023625 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.wsdl20.extensions.rpc.Argument; import org.apache.woden.wsdl20.extensions.rpc.Direction; import org.apache.woden.xml.ArgumentArrayAttr; /** * This class represents an XML attribute information items whose type is a list * of pairs (xs:QName, xs:token) that obey the contraints of wrpc:signature as * defined in Part 2 of the WSDL 2.0 spec. * * @author Arthur Ryman (ryman@ca.ibm.com) */ public class ArgumentArrayAttrImpl extends XMLAttrImpl implements ArgumentArrayAttr { public ArgumentArrayAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* * (non-Javadoc) * * @see org.apache.woden.xml.ArgumentArrayAttr#getArgumentArray() */ public Argument[] getArgumentArray() { return (Argument[]) getContent(); } protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { setValid(false); if (attrValue != null) { List tokens = StringUtils.parseNMTokens(attrValue); int length = tokens.size(); // list consists of (qname, token) pairs if (length % 2 == 0) { int argc = length / 2; Argument[] args = new Argument[argc]; Iterator i = tokens.iterator(); for (int j = 0; j < argc; j++) { String qnameStr = (String) i.next(); QName qname = convertQName(ownerEl, qnameStr); if (qname == null) return null; String directionStr = (String) i.next(); Direction direction = convertDirection(directionStr); if (direction == null) return null; args[j] = new Argument(qname, direction); } setValid(true); return args; } } // TODO: line&col nos. // TODO: use correct error number getErrorReporter().reportError(new ErrorLocatorImpl(), "WSDL510", new Object[] { attrValue }, ErrorReporter.SEVERITY_ERROR, new IllegalArgumentException()); return null; } private QName convertQName(XMLElement ownerEl, String qnameStr) throws WSDLException { QName qname = null; try { qname = ownerEl.getQName(qnameStr); } catch (WSDLException e) { // TODO: line&col nos. // TODO: use correct error number getErrorReporter().reportError(new ErrorLocatorImpl(), "WSDL510", new Object[] { qnameStr }, ErrorReporter.SEVERITY_ERROR, e); } return qname; } private Direction convertDirection(String directionStr) throws WSDLException { Direction[] directions = new Direction[] { Direction.IN, Direction.INOUT, Direction.OUT, Direction.RETURN }; for (int i = 0; i < directions.length; i++) { if (directionStr.equals(directions[i].toString())) { return directions[i]; } } // TODO: line&col nos. // TODO: use correct error number getErrorReporter().reportError(new ErrorLocatorImpl(), "WSDL510", new Object[] { directionStr }, ErrorReporter.SEVERITY_ERROR, new IllegalArgumentException()); return null; } } ./src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java0000664000175000017500000001213011767656530024660 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.xml.QNameListOrTokenAttr; /** * This class represents XML attribute information items of type * Union of list of QName or xs:token #any. * For example, the wsoap:subcodes extension attribute of binding fault. * * @author jkaputin@apache.org */ public class QNameListOrTokenAnyAttrImpl extends XMLAttrImpl implements QNameListOrTokenAttr { private static final String emptyString = "".intern(); public QNameListOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * QNameListOrTokenAttr interface declared methods * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.xml.QNameListOrTokenAttr#isQNameList() */ public boolean isQNameList() { return getContent() instanceof QName[]; } /* (non-Javadoc) * @see org.apache.woden.xml.QNameListOrTokenAttr#isToken() */ public boolean isToken() { return !isQNameList() && isValid(); } /* (non-Javadoc) * @see org.apache.woden.xml.QNameListOrTokenAttr#getQNames() */ public QName[] getQNames() { if(isQNameList()) { return (QName[])getContent(); } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.xml.QNameListOrTokenAttr#getToken() */ public String getToken() { if(!isQNameList() && isValid()) { return (String)getContent(); } else { return null; } } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String) * * Convert a string of type "Union of list of xs:QName or xs:token #any" to a * java.xml.namespace.QName array or a String. * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { //First, check if the attribute contains the xs:token '#any'. if("#any".equals(attrValue)) return attrValue; //Second, assume the attribute contains a list of xs:QName. if(attrValue == null || emptyString.equals(attrValue)) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL509", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR); return null; } List qnStrings = StringUtils.parseNMTokens(attrValue); Iterator i = qnStrings.iterator(); String qnString; QName qname; List qnames = new Vector(); while(i.hasNext()) { qnString = (String)i.next(); try { qname = ownerEl.getQName(qnString); } catch (WSDLException e) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL510", new Object[] {qnString, attrValue}, ErrorReporter.SEVERITY_ERROR, e); continue; } qnames.add(qname); } QName[] qnArray = new QName[qnames.size()]; qnames.toArray(qnArray); return qnArray; } } ./src/org/apache/woden/internal/xml/QNameListAttrImpl.java0000664000175000017500000000770011767656530022715 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.internal.util.StringUtils; import org.apache.woden.xml.QNameListAttr; /** * This class represents XML attribute information items of type xs:list of QNames. * * @author jkaputin@apache.org */ public class QNameListAttrImpl extends XMLAttrImpl implements QNameListAttr { private static final String emptyString = "".intern(); public QNameListAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * QNameAttr interface declared methods * ************************************************************/ public QName[] getQNames() { return (QName[])getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type 'xs:list of QNames' to a java.xml.namespace.QName[]. * A a null argument will return a null value. * If a QName string in the list causes a conversion error, it will be reported * and that QName will not appear in the array. Valid QName strings will still * be converted, but the object will be marked invalid. If no QName strings can * be converted, a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { if(attrValue == null || emptyString.equals(attrValue)) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL509", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR); return null; } List qnStrings = StringUtils.parseNMTokens(attrValue); Iterator i = qnStrings.iterator(); String qnString; QName qname; List qnames = new Vector(); while(i.hasNext()) { qnString = (String)i.next(); try { qname = ownerEl.getQName(qnString); } catch (WSDLException e) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL510", new Object[] {qnString, attrValue}, ErrorReporter.SEVERITY_ERROR, e); continue; } qnames.add(qname); } QName[] qnArray = new QName[qnames.size()]; qnames.toArray(qnArray); return qnArray; } } ./src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java0000664000175000017500000000767711767656530023601 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.IntOrTokenAttr; /** * This class represents XML attribute information items of type * 'Union of xs:int, xs:token #any', for example the * whttp:code extension attribute of binding <fault>. * * @author jkaputin@apache.org */ public class IntOrTokenAnyAttrImpl extends XMLAttrImpl implements IntOrTokenAttr { public IntOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * QNameOrTokenAttr interface declared methods * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.xml.IntOrTokenAttr#isInt() */ public boolean isInt() { return getContent() instanceof Integer; } /* (non-Javadoc) * @see org.apache.woden.xml.IntOrTokenAttr#isToken() */ public boolean isToken() { return !isInt() && isValid(); } /* (non-Javadoc) * @see org.apache.woden.xml.IntOrTokenAttr#getInt() */ public Integer getInt() { if(isInt()) { return (Integer)getContent(); } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.xml.IntOrTokenAttr#getToken() */ public String getToken() { if(!isInt() && isValid()) { return (String)getContent(); } else { return null; } } /* ************************************************************ * Implementation of abstract method inherited from XmlAttrImpl * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String) * * Convert a string of type "Union of xs:int, xs:token #any" to a * java.lang.Integer or a String. * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { //First, check if the attribute contains the xs:token '#any'. if("#any".equals(attrValue)) return attrValue; //Second, assume the attribute contains a xs:int value. Integer intVal = null; try { intVal = new Integer(attrValue); } catch (NumberFormatException e) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL512", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR, e); } return intVal; } } ./src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java0000664000175000017500000001007411767656530024031 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.QNameOrTokenAttr; /** * This class represents XML attribute information items of type * Union of QName or xs:token #any. * For example, the wsoap:code extension attribute of binding fault. * * @author jkaputin@apache.org */ public class QNameOrTokenAnyAttrImpl extends XMLAttrImpl implements QNameOrTokenAttr { public QNameOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * QNameOrTokenAttr interface declared methods * ************************************************************/ /* (non-Javadoc) * @see org.apache.woden.xml.QNameOrTokenAttr#isQName() */ public boolean isQName() { return getContent() instanceof QName; } /* (non-Javadoc) * @see org.apache.woden.xml.QNameOrTokenAttr#isToken() */ public boolean isToken() { if(!isQName() && isValid()) { return true; } else { return false; } } /* (non-Javadoc) * @see org.apache.woden.xml.QNameOrTokenAttr#getQName() */ public QName getQName() { if(isQName()) { return (QName)getContent(); } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.xml.QNameOrTokenAttr#getToken() */ public String getToken() { if(!isQName() && isValid()) { return (String)getContent(); } else { return null; } } /* (non-Javadoc) * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String) * * Convert a string of type "Union of xs:QName or xs:token #any" to a * java.xml.namespace.QName or a String. * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { //First, check if the attribute contains the xs:token '#any'. if("#any".equals(attrValue)) return attrValue; //Second, assume the attribute contains a xs:QName value. Exception ex = null; QName qn = null; if(attrValue != null) { try { qn = ownerEl.getQName(attrValue); } catch (WSDLException e) { ex = e; } } if(qn == null) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL507", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR, ex); } return qn; } } ./src/org/apache/woden/internal/xml/BooleanAttrImpl.java0000664000175000017500000000566411767656530022446 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.BooleanAttr; /** * This class represents XML attribute information items of type xs:boolean. * If the attribute value is not "true" or "false" the Boolean content will * be initialized to "false" by default, but the isValid() method will * return "false". * * @author jkaputin@apache.org */ public class BooleanAttrImpl extends XMLAttrImpl implements BooleanAttr { public BooleanAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * BooleanAttr interface declared methods * ************************************************************/ public Boolean getBoolean() { return (Boolean)getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type xs:boolean to a java.lang.Boolean. * An empty string or a null argument will initialize the Boolean to false. * Any conversion error will be reported and will initialize the Boolean to false. * If the attrValue does not match the Boolean value the Attr is marked invalid. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { Boolean bool = Boolean.valueOf(attrValue); if(attrValue == null || !attrValue.equals(bool.toString()) ) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL511", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR); } return bool; } } ./src/org/apache/woden/internal/xml/StringAttrImpl.java0000664000175000017500000000504111767656530022322 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.StringAttr; /** * This class represents XML attribute information items of type xs:string. * * @author jkaputin@apache.org */ public class StringAttrImpl extends XMLAttrImpl implements StringAttr { public StringAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * StringAttr interface declared methods * ************************************************************/ public String getString() { return (String)getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type xs:string to a java.lang.String. * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { if(attrValue == null) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL508", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR); } return attrValue; } } ./src/org/apache/woden/internal/xml/QNameAttrImpl.java0000664000175000017500000000562211767656530022062 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.QNameAttr; /** * This class represents XML attribute information items of type xs:QName. * * @author jkaputin@apache.org */ public class QNameAttrImpl extends XMLAttrImpl implements QNameAttr { public QNameAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * QNameAttr interface declared methods * ************************************************************/ public QName getQName() { return (QName)getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type xs:QName to a java.xml.namespace.QName. * A a null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { Exception ex = null; QName qn = null; if(attrValue != null) { try { qn = ownerEl.getQName(attrValue); } catch (WSDLException e) { ex = e; } } if(qn == null) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL507", //TODO chg to WSDL505 and test new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR, ex); } return qn; } } ./src/org/apache/woden/internal/xml/TokenAttrImpl.java0000664000175000017500000000540211767656530022135 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.TokenAttr; /** * This class represents XML attribute information items of type xs:token. * * TODO when the class org.apache.woden.types.Token has been created, convert the * xs:token to a Token instead of a String and modify the getToken method to return * a Token instead of a String. * * @author jkaputin@apache.org */ public class TokenAttrImpl extends XMLAttrImpl implements TokenAttr { public TokenAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * TokenAttr interface declared methods * ************************************************************/ public String getToken() { return (String)getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type xs:token to a java.lang.String (for now, but see 'todo' above). * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { if(attrValue == null) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL508", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR); } return attrValue; } } ./src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java0000664000175000017500000000555711767656530025674 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme; import org.apache.woden.xml.HTTPAuthenticationSchemeAttr; /** * This class implements the whttp:authenticationScheme attribute. * * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com) * */ public class HTTPAuthenticationSchemeAttrImpl extends XMLAttrImpl implements HTTPAuthenticationSchemeAttr { public HTTPAuthenticationSchemeAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* * (non-Javadoc) * * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, * java.lang.String) */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { // TODO: define correct error numbers HTTPAuthenticationScheme scheme = null; if (attrValue == null) { setValid(false); getErrorReporter().reportError(new ErrorLocatorImpl(), // TODO // line&col // nos. "WSDL508", new Object[] { attrValue }, ErrorReporter.SEVERITY_ERROR); } else if (attrValue.equals(HTTPAuthenticationScheme.BASIC.toString())) { setValid(true); scheme = HTTPAuthenticationScheme.BASIC; } else if (attrValue.equals(HTTPAuthenticationScheme.DIGEST.toString())) { setValid(true); scheme = HTTPAuthenticationScheme.DIGEST; } else { setValid(false); getErrorReporter().reportError(new ErrorLocatorImpl(), // TODO // line&col // nos. "WSDL508", new Object[] { attrValue }, ErrorReporter.SEVERITY_ERROR); } return scheme; } /* * (non-Javadoc) * * @see org.apache.woden.xml.HTTPAuthenticationSchemeAttr#getScheme() */ public HTTPAuthenticationScheme getScheme() { return (HTTPAuthenticationScheme) getContent(); } } ./src/org/apache/woden/internal/xml/XMLAttrImpl.java0000664000175000017500000000605111767656530021516 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.xml.XMLAttr; /** * This is an abstract superclass for all classes representing different * types of XML attribute information items. * * @author jkaputin@apache.org */ public abstract class XMLAttrImpl implements XMLAttr { private QName fAttrType = null; private Object fContent = null; private String fExternalForm = null; private boolean fValid = true; private ErrorReporter fErrorReporter = null; protected XMLAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { fErrorReporter = errRpt; fAttrType = attrType; fExternalForm = attrValue; fContent = convert(ownerEl, attrValue); if(fContent == null) { fValid = false; } } /* ************************************************************ * XMLAttr interface declared methods * ************************************************************/ public QName getAttributeType() { return fAttrType; } public Object getContent() { return fContent; } public String toExternalForm() { return fExternalForm; } public boolean isValid() { return fValid; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ abstract protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException; protected ErrorReporter getErrorReporter() { return fErrorReporter; } /* * Validity is initialized to true, but set to false if the attribute's * value is null or if it cannot be converted to an object of the * appropriate type). This method may be used to change the validity later * (e.g. if Validation determines an error). * * TODO confirm this method is needed, otherwise remove it. */ protected void setValid(boolean validity) { fValid = validity; } } ./src/org/apache/woden/internal/xml/URIAttrImpl.java0000664000175000017500000000570111767656530021516 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xml; import java.net.URI; import java.net.URISyntaxException; import javax.xml.namespace.QName; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.XMLElement; import org.apache.woden.internal.ErrorLocatorImpl; import org.apache.woden.xml.URIAttr; /** * This class represents XML attribute information items of type xs:anyURI. * * @author jkaputin@apache.org */ public class URIAttrImpl extends XMLAttrImpl implements URIAttr { public URIAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt) throws WSDLException { super(ownerEl, attrType, attrValue, errRpt); } /* ************************************************************ * URIAttr interface declared methods * ************************************************************/ public URI getURI() { return (URI)getContent(); } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Convert a string of type xs:anyURI to a java.net.URI. * An empty string argument will return an empty string URI. * A null argument will return a null value. * Any conversion error will be reported and a null value will be returned. */ protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException { Exception ex = null; URI uri = null; if(attrValue != null) { try { uri = new URI(attrValue); } catch (URISyntaxException e) { ex = e; } } if(uri == null) { setValid(false); getErrorReporter().reportError( new ErrorLocatorImpl(), //TODO line&col nos. "WSDL506", new Object[] {attrValue}, ErrorReporter.SEVERITY_ERROR, ex); } return uri; } } ./src/org/apache/woden/internal/ErrorReporterImpl.java0000664000175000017500000002762011767656530022244 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.util.Locale; import org.apache.woden.ErrorHandler; import org.apache.woden.ErrorInfo; import org.apache.woden.ErrorLocator; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.internal.util.PropertyUtils; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; /** * This class reports errors that occur while parsing, validating or * manipulating WSDL descriptions, such as XML parser errors or violations * of the rules defined in the WSDL specification. That is, errors that * relate specifically to the WSDL. It does not report system runtime * or configuration errors, which are instead treated as exceptions. *

    * There are four ways to report an error: *

    * An error id and an array of message arguments are used to produce * a formatted error message from some parameterized message text. * The error may be reported with an target exception or without one. *

    * An error id is specified with some ready-formatted message text. * The error may be reported with an target exception or without one. *

    * The error is handled according to the severity level * (warning, error or fatal error) reported with the error. *

    * The error reporter supports the 'en' (English) locale by default * and has a default error handler (i.e. a default implementation of * ErrorHandler). However, a different locale may be configured * via setLocale and a custom error handler implementation * may be configured as a system property. * * @author John Kaputin (jkaputin@apache.org) */ public class ErrorReporterImpl implements ErrorReporter { //TODO: add further behaviour as requirements emerge - e.g. //using a xml locator object to report line/col numbers. //the ISO-639 language code for the required locale protected static final String LOCALE_LANGUAGE = "org.apache.woden.locale-language"; //the class name of a custom error handler protected static final String ERROR_HANDLER_NAME = "org.apache.woden.error-handler-name"; //"true" or "false" to continue parsing after a fatal error protected static final String CONTINUE_AFTER_FATAL_ERROR = "org.apache.woden.continue-after-fatal-error"; /* * This property specifies the resource bundle containing the core Woden error messages. * * TODO extract these errors to a new public (non-internal) bundle. * TODO define a public constants file with this type of info. */ static final private String CORE_RESOURCE_BUNDLE = "org.apache.woden.internal.Messages"; //Used for localization of error messages. private Locale fLocale; //Combines parameterized message text with message parameters private MessageFormatter fMessageFormatter; //Used only if no custom error handler has been specified private ErrorHandler fDefaultErrorHandler; //Custom error handler to use instead of the default error handler private ErrorHandler fErrorHandler; //ExtensionRegistry contains names of user-registered error message ResourceBundles private ExtensionRegistry fExtensionRegistry; /* * The default constructor sets the instance variables. It uses default * implementations for fMessageFormatter and * fDefaultErrorHandler. It checks for optional properties that * specify the settings for the remaining variables. * For fLocale, property org.apache.woden.locale can be used to * specify the ISO-639 language code for the required locale. If it is omitted * it will default to "en" for English. There is also a setter method which will * override any value set by this constructor. * For fErrorHandler, property org.apache.woden.error-handler-name * can be used to specify the class name of the custom error handler or if * omitted, it is set to null. There is also a setter method which will * override any value set by this constructor. *

    * Their are several alternatives for specifying these properties, so the property lookup * mechanism is encapsulated in a separate PropertyUtils class. *

    * TODO fContinueAfterFatalError and related code has been commented out for * the time being. If we cannot identify a use case for it, it will be removed. *

    * For fContinueAfterFatalError, * org.apache.woden.continue-after-fatal-error can be used to specify * "true" or "false". If this property is omitted or contains any other value, * default to "true". * @throws WSDLException wraps exceptions that may occur while creating * objects from Class names specified as properties (e.g. * ClassNotFoundException, InstantiationException and IllegalAccessException). * */ public ErrorReporterImpl() throws WSDLException { fMessageFormatter = new MessageFormatter(); fDefaultErrorHandler = new ErrorHandlerImpl(); //Set the locale using the language code property if specified. String localeLanguage = PropertyUtils.findProperty(LOCALE_LANGUAGE); if (localeLanguage != null) { fLocale = new Locale(localeLanguage);; } //TODO handle an unsupported locale lang code //(e.g. use system locale and log a warning message) //Set the custom error handler from the error handler property if specified. String errorHandlerName = PropertyUtils.findProperty(ERROR_HANDLER_NAME); if (errorHandlerName != null) { try { Class cl = Class.forName(errorHandlerName); fErrorHandler = (ErrorHandler)cl.newInstance(); } catch (Exception e) { /* ClassNotFoundException InstantiationException IllegalAccessException */ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating the customer error handler.", e); } } else { fErrorHandler = null; } } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short) */ public void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity) throws WSDLException { reportError(errLoc, errorId, arguments, severity, null); } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short, java.lang.Exception) */ public void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity, Exception exception) throws WSDLException { String[] names = getResourceBundleNames(); String message = fMessageFormatter.formatMessage(fLocale, errorId, arguments, names); reportError(errLoc, errorId, message, severity, exception); } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short) */ public void reportError(ErrorLocator errLoc, String errorId, String message, short severity) throws WSDLException { reportError(errLoc, errorId, message, severity, null); } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short, java.lang.Exception) */ public void reportError(ErrorLocator errLoc, String errorId, String message, short severity, Exception exception) throws WSDLException { ErrorInfo errorInfo = new ErrorInfoImpl(errLoc, errorId, message, exception); ErrorHandler eh = (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler; if(severity == SEVERITY_WARNING) { eh.warning(errorInfo); } else if(severity == SEVERITY_ERROR) { eh.error(errorInfo); } else if(severity == SEVERITY_FATAL_ERROR) { eh.fatalError(errorInfo); // Fatal error strategy is to terminate with a WSDLException. if(exception == null) { throw new WSDLException(WSDLException.INVALID_WSDL, "Fatal WSDL error:\n" + errorInfo.toString()); } else if(exception instanceof WSDLException) { throw (WSDLException)exception; } else { throw new WSDLException(WSDLException.OTHER_ERROR, "Fatal error.", exception); } } else { //TODO externalize these messages for localization throw new IllegalArgumentException("Invalid severity: " + severity); } } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#setErrorHandler(org.apache.woden.ErrorHandler) */ public void setErrorHandler(ErrorHandler errorHandler) { fErrorHandler = errorHandler; } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#getErrorHandler() */ public ErrorHandler getErrorHandler() { return (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler; } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#setLocale(java.util.Locale) */ public void setLocale(Locale locale) { fLocale = locale; } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#getLocale() */ public Locale getLocale() { return fLocale; } /* * (non-Javadoc) * @see org.apache.woden.ErrorReporter#getFormattedMessage(java.lang.String, java.lang.Object[]) */ public String getFormattedMessage(String key, Object[] arguments) { String[] names = getResourceBundleNames(); String message = fMessageFormatter.formatMessage(fLocale, key, arguments, names); return message; } //Package private as this is only void setExtensionRegistry(ExtensionRegistry extensionRegistry) { fExtensionRegistry = extensionRegistry; } private String[] getResourceBundleNames() { if(fExtensionRegistry != null) { return fExtensionRegistry.queryResourceBundleNames(); } else { return new String[] {CORE_RESOURCE_BUNDLE}; } } } ./src/org/apache/woden/internal/DOMWSDLSource.java0000664000175000017500000000457311767656530021102 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.ErrorReporter; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; /** * This class provides a WSDLSource implementation that supports a * DOM-based representation of the WSDL source. Specifically, it * may accept via its setSource method an object of type * org.w3c.dom.Element, org.w3c.dom.Document or org.xml.sax.InputSource. * Any other type of object passed to this method will result in a * WSDLException being thrown. * * @author John Kaputin (jkaputin@apache.org) */ public class DOMWSDLSource extends BaseWSDLSource { public DOMWSDLSource(ErrorReporter errorReporter) { super(errorReporter); } /* (non-Javadoc) * @see org.apache.woden.WSDLSource#setSource(java.lang.Object) */ public void setSource(Object wsdlSource) { //TODO check if any other types of wsdl source should be supported if(wsdlSource instanceof Element || wsdlSource instanceof Document || wsdlSource instanceof InputSource) { fSource = wsdlSource; } else { String sourceClass = (wsdlSource != null ? wsdlSource.getClass().getName() : null); String wsdlSourceClass = this.getClass().getName(); String msg = fErrorReporter.getFormattedMessage( "WSDL018", new Object[] {sourceClass, wsdlSourceClass}); throw new IllegalArgumentException(msg); } } } ./src/org/apache/woden/internal/BaseWSDLSource.java0000664000175000017500000000425311767656530021330 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.net.URI; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLSource; /** * This abstract class implements methods of the WSDLSource interface that are * common across all concrete implementations. The only method on this interface * that is specific to each concrete implementation is the setSource * method and this method is declared abstract on this class. * * @author John Kaputin (jkaputin@apache.org) */ public abstract class BaseWSDLSource implements WSDLSource { private URI fBaseURI = null; protected Object fSource = null; protected ErrorReporter fErrorReporter = null; protected BaseWSDLSource(ErrorReporter errorReporter) { fErrorReporter = errorReporter; } /* (non-Javadoc) * @see org.apache.woden.WSDLSource#setSource(java.lang.Object) */ abstract public void setSource(Object wsdlSource); /* (non-Javadoc) * @see org.apache.woden.WSDLSource#getSource() */ public Object getSource() { return fSource; } /* (non-Javadoc) * @see org.apache.woden.WSDLSource#setBaseURI(java.net.URI) */ public void setBaseURI(URI baseURI) { fBaseURI = baseURI; } /* (non-Javadoc) * @see org.apache.woden.WSDLSource#getBaseURI() */ public URI getBaseURI() { return fBaseURI; } } ./src/org/apache/woden/internal/schema/0000775000175000017500000000000011767656530017174 5ustar brianbrian./src/org/apache/woden/internal/schema/ImportedSchemaImpl.java0000664000175000017500000000315111767656530023565 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.schema; import java.net.URI; import org.apache.woden.schema.ImportedSchema; /** * This interface represents a schema import, <xs:import>. It extends the abstract * class SchemaImpl, adding support for the schemaLocation attribute. * * @author jkaputin@apache.org */ public class ImportedSchemaImpl extends SchemaImpl implements ImportedSchema { private URI fSchemaLocation = null; /* (non-Javadoc) * @see org.apache.woden.schema.ImportedSchema#setSchemaLocation(java.net.URI) */ public void setSchemaLocation(URI location) { fSchemaLocation = location; } /* (non-Javadoc) * @see org.apache.woden.schema.ImportedSchema#getSchemaLocation() */ public URI getSchemaLocation() { return fSchemaLocation; } } ./src/org/apache/woden/internal/schema/SchemaConstants.java0000664000175000017500000001055711767656530023144 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.schema; import java.net.URI; import java.util.Arrays; import java.util.List; import javax.xml.namespace.QName; /** * Constants for XML Schema elements, attributes and URIs. * * @author jkaputin@apache.org */ public class SchemaConstants { //Schema attribute names public static final String ATTR_ID = "id"; public static final String ATTR_TARGET_NAMESPACE = "targetNamespace"; public static final String ATTR_NAMESPACE = "namespace"; public static final String ATTR_SCHEMA_LOCATION = "schemaLocation"; //Schema element names public static final String ELEM_SCHEMA = "schema"; public static final String ELEM_IMPORT = "import"; //Schema namespace string public static final String NS_STRING_SCHEMA = "http://www.w3.org/2001/XMLSchema"; //Schema namespace uri public static final URI NS_URI_SCHEMA = URI.create(NS_STRING_SCHEMA); //Schema attribute qnames public static final QName Q_ATTR_ID = new QName(ATTR_ID); //Schema element qnames public static final QName Q_ELEM_SCHEMA = new QName(NS_STRING_SCHEMA, ELEM_SCHEMA); public static final QName Q_ELEM_SCHEMA_IMPORT = new QName(NS_STRING_SCHEMA, ELEM_IMPORT); //Built-in XML Schema types. 19 primitive and 25 derived. public static final List LIST_Q_BUILT_IN_TYPES = Arrays.asList(new QName[] { new QName(NS_STRING_SCHEMA, "string"), new QName(NS_STRING_SCHEMA, "boolean"), new QName(NS_STRING_SCHEMA, "decimal"), new QName(NS_STRING_SCHEMA, "float"), new QName(NS_STRING_SCHEMA, "double"), new QName(NS_STRING_SCHEMA, "duration"), new QName(NS_STRING_SCHEMA, "dateTime"), new QName(NS_STRING_SCHEMA, "time"), new QName(NS_STRING_SCHEMA, "date"), new QName(NS_STRING_SCHEMA, "gYearMonth"), new QName(NS_STRING_SCHEMA, "gYear"), new QName(NS_STRING_SCHEMA, "gMonthDay"), new QName(NS_STRING_SCHEMA, "gDay"), new QName(NS_STRING_SCHEMA, "gMonth"), new QName(NS_STRING_SCHEMA, "hexBinary"), new QName(NS_STRING_SCHEMA, "base64Binary"), new QName(NS_STRING_SCHEMA, "anyURI"), new QName(NS_STRING_SCHEMA, "QName"), new QName(NS_STRING_SCHEMA, "NOTATION"), new QName(NS_STRING_SCHEMA, "normalizedString"), new QName(NS_STRING_SCHEMA, "token"), new QName(NS_STRING_SCHEMA, "language"), new QName(NS_STRING_SCHEMA, "NMTOKEN"), new QName(NS_STRING_SCHEMA, "NMTOKENS"), new QName(NS_STRING_SCHEMA, "Name"), new QName(NS_STRING_SCHEMA, "NCName"), new QName(NS_STRING_SCHEMA, "ID"), new QName(NS_STRING_SCHEMA, "IDREF"), new QName(NS_STRING_SCHEMA, "IDREFS"), new QName(NS_STRING_SCHEMA, "ENTITY"), new QName(NS_STRING_SCHEMA, "ENTITIES"), new QName(NS_STRING_SCHEMA, "integer"), new QName(NS_STRING_SCHEMA, "nonPositiveInteger"), new QName(NS_STRING_SCHEMA, "negativeInteger"), new QName(NS_STRING_SCHEMA, "long"), new QName(NS_STRING_SCHEMA, "int"), new QName(NS_STRING_SCHEMA, "short"), new QName(NS_STRING_SCHEMA, "byte"), new QName(NS_STRING_SCHEMA, "nonNegativeInteger"), new QName(NS_STRING_SCHEMA, "unsignedLong"), new QName(NS_STRING_SCHEMA, "unsignedInt"), new QName(NS_STRING_SCHEMA, "unsignedShort"), new QName(NS_STRING_SCHEMA, "unsignedByte"), new QName(NS_STRING_SCHEMA, "positiveInteger") }); } ./src/org/apache/woden/internal/schema/SchemaImpl.java0000664000175000017500000000732011767656530022063 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.schema; import java.net.URI; import org.apache.woden.XMLElement; import org.apache.woden.schema.Schema; import org.apache.ws.commons.schema.XmlSchema; /** * Abstract implementation of an XML Schema. * * @author jkaputin@apache.org */ public abstract class SchemaImpl implements Schema { private URI fNamespace = null; private XmlSchema fSchemaDefinition = null; private boolean fIsReferenceable = true; private XMLElement fXMLElement; /* (non-Javadoc) * @see org.apache.woden.wsdl20.schema.Schema#setNamespace(java.net.URI) */ public void setNamespace(URI namespace) { fNamespace = namespace; } /* (non-Javadoc) * @see org.apache.woden.wsdl20.schema.Schema#getNamespace() */ public URI getNamespace() { return fNamespace; } /* (non-Javadoc) * @see org.apache.woden.schema.Schema#setSchemaDefinition(org.apache.ws.commons.schema.XmlSchema) */ public void setSchemaDefinition(XmlSchema schemaDef) { fSchemaDefinition = schemaDef; } /* (non-Javadoc) * @see org.apache.woden.schema.Schema#getSchemaDefinition() */ public XmlSchema getSchemaDefinition() { return fSchemaDefinition; } /* (non-Javadoc) * @see org.apache.woden.schema.Schema#getXMLElement() */ public XMLElement getXMLElement() { return fXMLElement; } /* (non-Javadoc) * @see org.apache.woden.schema.Schema#setXMLElement(org.apache.woden.XMLElement) */ public void setXMLElement(XMLElement xsdElement) { fXMLElement = xsdElement; } /* ************************************************************ * Non-API implementation methods * ************************************************************/ /* * Indicates whether the schema is referenceable by the containing WSDL, as * defined by the WSDL 2.0 spec. In brief, a schema is referenceable if it is * inlined directly under <types> and has a target namespace or if it is * resolved from a schema import directly under <types> and the import * namespace matches the schema's target namespace. * So for example, when the API is used to retrieve the schema element * declaration identified by a QName attribute, the implementation checks this * referenceable property to determine which schemas can be used to resolve the * qname. * Referenceability is determined during validation. If the validation feature * is disabled, any inlined or imported schema will be considered referenceable. */ public void setReferenceable(boolean referenceable) { fIsReferenceable = referenceable; } public boolean isReferenceable() { return fIsReferenceable; } public String getNamespaceAsString() { return fNamespace != null ? fNamespace.toString() : null; } } ./src/org/apache/woden/internal/schema/InlinedSchemaImpl.java0000664000175000017500000000276611767656530023377 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.schema; import org.apache.woden.schema.InlinedSchema; /** * This class represents an inlined schema, <xs:schema>. * It extends the abstract class SchemaImpl, adding support for the * id attribute. * * @author jkaputin@apache.org */ public class InlinedSchemaImpl extends SchemaImpl implements InlinedSchema { private String fId = null; /* (non-Javadoc) * @see org.apache.woden.schema.InlinedSchema#setId(java.lang.String) */ public void setId(String id) { fId = id; } /* (non-Javadoc) * @see org.apache.woden.schema.InlinedSchema#getId() */ public String getId() { return fId; } } ./src/org/apache/woden/internal/WriterFeatures.java0000664000175000017500000000515611767656530021561 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import java.util.Hashtable; /** * This class contains all supported Woden writer features . * * TODO Decide this is necessary or not? * determine the required features (e.g. org.apache.woden.verbose) and * create an ID for each value. */ public class WriterFeatures { /** * This hashtable contains the values for the features. */ protected Hashtable values = new Hashtable(); private Boolean on = new Boolean(true); private Boolean off = new Boolean(false); public WriterFeatures() { } /** * Get the value for the given feature. * @param featureId The ID of the feature for which the value is requested. * @return true if the feature is enabled, false otherwise. * @throws IllegalArgumentException if the feature is not supported. */ public boolean getValue(String featureId) throws IllegalArgumentException { Boolean value = (Boolean)values.get(featureId); if(value == null) { throw new IllegalArgumentException("The feature " + featureId + " is not supported."); } return value.booleanValue(); } /** * Set the value of the given feature * @param featureId The ID of the feature to set. * @param value The value to set for the feature. * @throws IllegalArgumentException if the feature is not supported. */ public void setValue(String featureId, boolean value) throws IllegalArgumentException { // Check if the feature is supported. if(!values.containsKey(featureId)) { throw new IllegalArgumentException("The feature " + featureId + " is not supported."); } if(value) { values.put(featureId, on); } else { values.put(featureId, off); } } } ./src/org/apache/woden/internal/DOMWSDLFactory.java0000664000175000017500000000261611767656530021245 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.WSDLException; import org.apache.woden.WSDLReader; import org.apache.woden.WSDLWriter; /** * @author John Kaputin (jkaputin@apache.org) */ public class DOMWSDLFactory extends BaseWSDLFactory { public DOMWSDLFactory() throws WSDLException { super(); } public WSDLReader newWSDLReader() throws WSDLException { return new DOMWSDLReader(fWsdlContext); } // Returns an DOMWSDLWriter public WSDLWriter newWSDLWriter() throws WSDLException{ return new DOMWSDLWriter(fWsdlContext); } } ./src/org/apache/woden/internal/ErrorLocatorImpl.java0000664000175000017500000000502011767656530022033 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.ErrorLocator; /** * Represents the location of parsing error within a XML document. * * @author kaputin */ public class ErrorLocatorImpl implements ErrorLocator { private int fLineNumber; private int fColumnNumber; /* (non-Javadoc) * @see org.apache.woden.ErrorLocator#getDocumentBaseURI() */ public String getDocumentBaseURI() { // TODO required? return null; } /* (non-Javadoc) * @see org.apache.woden.ErrorLocator#getLocationURI() */ public String getLocationURI() { // TODO required? return null; } /* (non-Javadoc) * @see org.apache.woden.ErrorLocator#getLineNumber() */ public int getLineNumber() { return fLineNumber; } /* (non-Javadoc) * @see org.apache.woden.ErrorLocator#getColumnNumber() */ public int getColumnNumber() { return fColumnNumber; } /** * Set the base URI of this locator. * * @param uri The URI of the base location to set. */ public void setDocumentBaseURI(String uri) { // TODO required? } /** * Set the location URI of this locator. * * @param uri The URI of the location to set. */ public void setLocationURI(String uri) { // TODO required? } /** * Set the line number of this locator. * * @param line The line number to set. */ public void setLineNumber(int line) { fLineNumber = line; } /** * Set the column number of this locator. * * @param col The column number to set. */ public void setColumnNumber(int col) { fColumnNumber = col; } } ./src/org/apache/woden/internal/resolver/0000775000175000017500000000000011767656530017575 5ustar brianbrian./src/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.java0000664000175000017500000001053311767656530025225 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.resolver; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.woden.XMLElement; import org.apache.woden.internal.schema.SchemaConstants; import org.apache.woden.resolver.URIResolver; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * Class that adds DOM specific behaviour to the SchemaResolverAdapter class. * * TODO consider some approach other than inheritance as part of a broader consideration * of resolving imports and fragids. * * @author John Kaputin (jkaputin@apache.org) * */ public class DOMSchemaResolverAdapter extends SchemaResolverAdapter { public DOMSchemaResolverAdapter(URIResolver actualResolver, XMLElement schemaElement) { super(actualResolver, schemaElement); } protected InputStream resolveFragId(String fragId) { Element contextEl = (Element)fContextElement.getSource(); Document doc = contextEl.getOwnerDocument(); String id = fragId.substring(1); Element schemaEl = doc.getElementById(id); if(schemaEl == null) { //the fragid does not identify any element //TODO suitable error message return null; } String localName = schemaEl.getLocalName(); if(!localName.equals(SchemaConstants.ELEM_SCHEMA)) { //the fragid does not point to a schema element //TODO suitable error message return null; } String prefix = schemaEl.getPrefix(); if(prefix != null) { //check if we need to add a schema NS declaration String nsUri = schemaEl.getNamespaceURI(); String schemaNSDecl = "xmlns:" + prefix; boolean isSchemaNSDeclared = schemaEl.hasAttribute(schemaNSDecl); if(!isSchemaNSDeclared) { schemaEl.setAttribute(schemaNSDecl, nsUri); } } //TODO need to check for other prefixes requiring NS decls to be added to the schema element //replaced with JAXP /* OutputFormat format = new OutputFormat(doc); ByteArrayOutputStream oStream = new ByteArrayOutputStream(); XMLSerializer serializer = new XMLSerializer(oStream, format); try { serializer.serialize(schemaEl); } catch (IOException e) { // TODO this conforms to parent, but needs an error message via ErrorReporter and maybe it should be handled differently? throw new RuntimeException(e); } */ TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer; ByteArrayOutputStream oStream = new ByteArrayOutputStream(); try { transformer = transformerFactory.newTransformer(); transformer.setOutputProperty("indent", "yes"); transformer.transform(new DOMSource(doc), new StreamResult(oStream)); } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } catch (TransformerException e) { throw new RuntimeException(e); } ByteArrayInputStream iStream = new ByteArrayInputStream(oStream.toByteArray()); return iStream; } } ./src/org/apache/woden/internal/resolver/EntityResolverAdapter.java0000664000175000017500000000363611767656530024747 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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. * * @author Graham Turrell */ package org.apache.woden.internal.resolver; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class EntityResolverAdapter implements EntityResolver { private org.apache.woden.resolver.URIResolver fActualResolver; public EntityResolverAdapter(org.apache.woden.resolver.URIResolver actualResolver) { fActualResolver = actualResolver; } public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { /* build the URI from args * */ URI uri = null; try { // dumb placeholder: uri = new URI(systemId); } catch (URISyntaxException e) { throw new RuntimeException(e); } /* resolve with target resolver * */ URI resolved = null; try { resolved = fActualResolver.resolveURI(uri); } catch (Exception e) { throw new RuntimeException(e); } // dumb placeholder: return (resolved == null)? null : new InputSource(resolved.toString()); } } ./src/org/apache/woden/internal/resolver/SchemaResolverAdapter.java0000664000175000017500000001215611767656530024670 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.resolver; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import org.apache.woden.XMLElement; import org.apache.woden.internal.util.StringUtils; import org.xml.sax.InputSource; /** * Adapter from woden to ws.commons resolver, for use with XMLSchemaCollection * (Effectively chains ws.commons DefaultURIResolver...) * * @author Graham Turrell * */ public abstract class SchemaResolverAdapter implements org.apache.ws.commons.schema.resolver.URIResolver { private org.apache.woden.resolver.URIResolver fActualResolver; protected XMLElement fContextElement; public SchemaResolverAdapter(org.apache.woden.resolver.URIResolver actualResolver, XMLElement contextElement) { fActualResolver = actualResolver; fContextElement = contextElement; } /** * returns resolved URI if one can be found, otherwise the URI constructed from * the arguments. Conforms to the interface spec. */ public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri ) { /* build the URI from args * */ URI uri = null; try { /* * Its necessary to provide an absolute URI from the * given schemaLocation. If SchemaLocation is relative * we first try to resolve the base uri (ie that of the enclosing * document), so that all schemaLocation references will be relative * to the resolved base uri. This behaviour is consistent * with the EntityResolverAdapter callback used with wsdl2 parsing. * This removes the need to list relative URIs in the catalog. */ /* * TODO may want to have this behaviour switchable? * currently a convenience for Simple URI resolvers, where * root URI's cannot be specified for groups of URLs. * It removes the need to specify relative URL from source documents * in the catalog. This is at the cost of flexibility, as relative * URLs in the source documents must now have the same relative location * to the resolved source document. * * OASIS XML Catalog resolvers do allow a flexible use of root URI's * and here it may be better to *not* resolve the base URI here. * If so, EntityResolverAdapter should be changed to similar behaviour. */ URI resolvedBaseUri = fActualResolver.resolveURI(new URI(baseUri)); uri = buildUri(targetNamespace, schemaLocation, resolvedBaseUri == null ? baseUri : resolvedBaseUri.toString()); } catch (Exception e) { /* IOException * WSDLException * URISyntaxException * MalformedURLException */ throw new RuntimeException(e); } /* resolve with target resolver * */ URI resolved = null; try { resolved = fActualResolver.resolveURI(uri); } catch (Exception e) { throw new RuntimeException(e); } InputSource iSource = new InputSource(resolved != null ? resolved.toString() : uri.toString()); //Check if the uri ends in a fragid, if so include the schema element it //identifies in the input source. String systemId = iSource.getSystemId(); String fragId = null; int i = systemId.indexOf("#"); if(i > -1) { fragId = systemId.substring(i); iSource.setByteStream(resolveFragId(fragId)); } return iSource; } /* * Helper method to resolve fragid to a schema element, represented as a byte stream. * This will be XML parser-specific, so implementations should override this method. */ protected abstract InputStream resolveFragId(String fradId); /* based on ws commons DefaultURIResolver.resolveEntity(...) * */ private URI buildUri(String targetNamespace, String schemaLocation, String baseUri) throws URISyntaxException, MalformedURLException { if (baseUri != null) { URL ctxUrl = new URL(baseUri); URL schemaUrl = StringUtils.getURL(ctxUrl,schemaLocation); URI uri = new URI(schemaUrl.toString()); return uri; } return new URI(schemaLocation); } } ./src/org/apache/woden/internal/resolver/SimpleURIResolver.java0000664000175000017500000002764611767656530024012 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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. * * @author Graham Turrell */ package org.apache.woden.internal.resolver; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import org.apache.woden.WSDLException; import org.apache.woden.internal.util.PropertyUtils; import org.apache.woden.resolver.URIResolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /* * A Simple URI Resolver. * * Locating the catalog file: * These alternatives, listed in search order, will be: * 1. JVM system properties (e.g. java -D arguments) * use -Dorg.apache.woden.resolver.simpleresolver.catalog="" on the command line * where is the location of the simple resolver catalog on the local file system. * 2. application properties defined in /META-INF/services (e.g. in a jar file) * (when implemented in PropertyUtils.findProperty(String p)...) * 3. properties defined in a wsdl properties file located in JAVAHOME/lib directory * For (2) and (3) use regular property assignment notation: * org.apache.woden.resolver.simpleresolver.catalog="" * * Catalog file format: * This is as for Java Properties file format, with one entry for each resolution mapping: * =. * * Example catalog file contents (fictitious): * * # {referenced URI}={actual location} * # * http\://www.apache.org/schema/remoteSchema.xsd=file:///c:/schema/localSchema.xsd * http\://www.apache.org/schema/myDoc=file:///c:/schema/XMLSchema.xsd * http\://www.w3.org/ns/wsdl-extensions.xsd=file:///c:/schema/wsdl-extensions.xsd * # end * * Note the use of backslash on the first colon of each line. This is necessary as catalog files are * read as Java Properties files. * * Currently, any relative URI references to other documents (such as with the WSDL 2.0 "location" * attribute of the and elements) will be automatically resolved * by virtue of the parent document. * That is, if document a.wsdl references b.wsdl with a relative path and a.wsdl has an entry in the catalog * file, then the reference to b.wsdl will be deemed relative to the resolved location of a.wsdl (not the * original location). This is under review and it is expected that future milestone releases will offer the * choice of either option. * */ public class SimpleURIResolver implements URIResolver { private static final String RESOLVER_PROPERTIES_PROPERTY = "org.apache.woden.resolver.simpleresolver.catalog"; private static final String RESOLVER_BASE_PROPERTY = "org.apache.woden.resolver.simpleresolver.baseURIs"; private final String userCatalogFile = PropertyUtils.findProperty(RESOLVER_PROPERTIES_PROPERTY); private final String rootURLsList = PropertyUtils.findProperty(RESOLVER_BASE_PROPERTY); private final String schemaCatalogFile = "schema.catalog"; private final String schemaCatalogLocation = "META-INF/"; // eg. under woden.jar root private Hashtable uriTable = null; // logging private static final String RESOLVER_LOGGING_PROPERTY = "org.apache.woden.resolver.logging"; private static final String LOGGING_ON = "on"; private final String loggingRequest = PropertyUtils.findProperty(RESOLVER_LOGGING_PROPERTY); private boolean logging; /** SLF based logger. */ private static final Log logger=LogFactory.getLog(SimpleURIResolver.class); public SimpleURIResolver() throws WSDLException { Properties schemaCatalog = null; /* Unlike the user catalog case, the schema catalog does not refer to RESOLVER_PROPERTIES_PROPERTY * for its catalog location (it's hard coded) or to RESOLVER_BASE_PROPERTY (it uses only the unmodified * system classloader to yield absolute URLs from any relative "resolve-to" URLs in the catalog). * The principle is that the schema catalog behaviour should be unaffected by the use of the public user catalog. */ Properties userCatalog = null; // check if resolver logging required logging = (LOGGING_ON.equalsIgnoreCase(loggingRequest)); // find location of schema catalog on the classpath. // This catalog has a hardcoded name and relative location. ClassLoader systemLoader = this.getClass().getClassLoader(); URL schemaCatalogURL = systemLoader.getResource(schemaCatalogLocation + schemaCatalogFile); if (schemaCatalogURL == null) { // schema catalog is not in expected location on classpath, so look for an immediate // entry under the classpath. schemaCatalogURL = systemLoader.getResource(schemaCatalogFile); } // read & retain the system resolver references schemaCatalog = loadCatalog(schemaCatalogURL); if (userCatalogFile != null) { // user catalog file specified, so use it... // read & retain the user resolver references from user catalog properties file try { userCatalog = loadCatalog(new URL(userCatalogFile)); } catch (MalformedURLException e) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem locating the URI resolver user catalog: " + userCatalogFile, e); } } // build a URL[] from a (possibly empty) list of search URL directories/jars URL[] rootURLs = urlPathList(rootURLsList); URLClassLoader userLoader = new URLClassLoader(rootURLs, systemLoader); // convert provided keys and values to URIs try { // process the schema catalog contents Hashtable interrimUriTable = toURI(schemaCatalog, systemLoader); // append the processed user catalog to the schema catalog uriTable = toURI(userCatalog, userLoader, interrimUriTable); } catch (URISyntaxException e) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating the URI resolution table.", e); } } /** * Load properties from specified catalog location * * @param catalogLocation - location of catalog file to load * @return resulting catalog */ private Properties loadCatalog(URL catalogLocation) { return loadCatalog(catalogLocation, new Properties()); } /** * Load properties from specified catalog location and append to exising catalog. * * @param catalogLocation - location of catalog file to load * @param catalog - exisiting catalog data to which to append * @return appended catalog */ private Properties loadCatalog(URL catalogLocation, Properties catalog) { if (catalogLocation != null) { try { catalog.load(catalogLocation.openStream()); } catch (IllegalArgumentException e) { e.printStackTrace(); // treat missing properties file as empty file, ie no resolves specified. // TODO log this } catch (MalformedURLException e) { e.printStackTrace(); // load() failed, continue with no resolves // TODO log this } catch (IOException e) { e.printStackTrace(); // load() failed, continue with no resolves // TODO log this } } return catalog; } /** * Construct a list of URLs from a semi-colon seperated String list of URLs * * @param rootURLs * @return List of URLs or empty list */ private URL[] urlPathList(String rootURLs) throws WSDLException { if (rootURLs == null || rootURLs.length() == 0) { return new URL[0]; } String[] urlStrings = rootURLs.split(";"); ArrayList urls = new ArrayList(); for (int i=0; iuriResolver property (as this is set by the WSDLReader, not the * factory). *

    * Within the finer grained context of a WSDLReader, the uriResolver property * will reference the resolver used by the reader and if the reader's extension registry * reference changes, the extensionRegistry property will reflect that new reference. *

    * TODO if this needs to be made public on the API, either keep it as an immutable data object as-is, * or create an API interface called WSDLContext with getters instead of public variables and create * an implementation class called WSDLContextImpl.
    * TODO check for use cases that break the WSDLFactory context concept (ie WSDLReader.setFactoryImplName).
    * TODO decide if anything else should be kept here (e.g. woden feats & props, Description factory) * * @author John Kaputin (jkaputin@apache.org) */ public class WSDLContext { final public WSDLFactory wsdlFactory; final public ErrorReporter errorReporter; final public ExtensionRegistry extensionRegistry; final public URIResolver uriResolver; //package private ctor WSDLContext(WSDLFactory wsdlFactory, ErrorReporter errorReporter, ExtensionRegistry extensionRegistry, URIResolver uriResolver) { this.wsdlFactory = wsdlFactory; this.errorReporter = errorReporter; this.extensionRegistry = extensionRegistry; this.uriResolver = uriResolver; } } ./src/org/apache/woden/internal/xpointer/0000775000175000017500000000000011767656530017604 5ustar brianbrian./src/org/apache/woden/internal/xpointer/DOMXMLElementEvaluator.java0000664000175000017500000000567111767656530024655 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xpointer; //Woden import org.apache.woden.XMLElement; import org.apache.woden.internal.DOMXMLElement; import org.apache.woden.ErrorReporter; //XPointer import org.apache.woden.xpointer.XPointer; //DOM import org.w3c.dom.Element; /** * This class extends the XMLElementEvaluator to support the DOM implementation in XMLElement. * * @author Dan Harvey * */ public class DOMXMLElementEvaluator extends XMLElementEvaluator { /** * Constructs a new DOMXMLElementEvaluator to evaluate a XPointer on a DOM Element. * * @param xpointer an XPointer to evaluate. * @param element an DOM Element to be evaluated. * @param errorReporter the Woden Error Reporter context object. */ public DOMXMLElementEvaluator(XPointer xpointer, Element element, ErrorReporter errorReporter) { super(xpointer, createXMLElement(element, errorReporter)); } /* * (non-Javadoc) * @see org.apache.woden.internal.xpointer.XMLElementEvaluator#testElementShorthand(org.apache.woden.XMLElement, java.lang.String) */ public boolean testElementShorthand(XMLElement element, String shorthand) { //Simple http://www.w3.org/TR/xml-id/ support for now until we support full scheme based ID's. Element domElement = (Element)element.getSource(); String attr = domElement.getAttributeNS("http://www.w3.org/XML/1998/namespace", "id"); return attr != null && attr.equals(shorthand); } /** * Evaluates the XPointer on the root Element and returns the resulting Element or null. * * @return an Element from the resultant evaluation of the root Element or null if evaluation fails. */ public Element evaluateElement(){ XMLElement element = evaluate(); if (element != null) return (Element)element.getSource(); return null; } //Private methods private static XMLElement createXMLElement(Element element, ErrorReporter errorReporter) { DOMXMLElement domXMLElement = new DOMXMLElement(errorReporter); domXMLElement.setSource(element); return domXMLElement; } } ./src/org/apache/woden/internal/xpointer/XMLElementEvaluator.java0000664000175000017500000002167611767656530024320 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal.xpointer; import java.util.Collections; import java.util.EmptyStackException; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import java.util.Stack; import java.util.Arrays; import org.apache.woden.XMLElement; import org.apache.woden.types.NCName; import org.apache.woden.xpointer.PointerPart; import org.apache.woden.xpointer.ElementPointerPart; import org.apache.woden.xpointer.XPointer; /** * This class Evaluates an XPointer on a XMLElement, using the XPointer model in Woden. * It currently supports shorthand pointer and element() scheme based pointer part. * * @author Dan Harvey * */ public abstract class XMLElementEvaluator { private final XPointer xpointer; private final XMLElement root; /** * Constructs a new XMLElement abstract class for a XPointer and XMLElement. * * @param xpointer an XPointer which to evaluate. * @param root an XMLElement which to evaluate the XPointer against. */ public XMLElementEvaluator(XPointer xpointer, XMLElement root) { this.xpointer = xpointer; this.root = root; } /** * Evaluates the XPointer on the root XMLElement and returns the resulting XMLElement or null. * * @return an XMLElement from the resultant evaluation of the root XMLElement or null if evaluation fails. * */ public XMLElement evaluate() { if(xpointer.hasPointerParts()) { //Scheme based pointer. //Take each pointer part at a time and evaluate it against the root element. The first result found will be returned. XMLElement result = null; for(Iterator it = Arrays.asList(xpointer.getPointerParts()).iterator(); it.hasNext(); ) { PointerPart pointerPart = (PointerPart)it.next(); //TODO Add extra pointer parts here once we support them. if (pointerPart instanceof ElementPointerPart) { result = evaluateElementPointerPart((ElementPointerPart)pointerPart); } if (result != null) return result; } } else if(xpointer.hasShorthandPointer()) { //Shorthand pointer //Iterator for XMLElement from root in document order. See http://www.w3.org/TR/xpath#dt-document-order return evaluateShorthandPointer(xpointer.getShorthandPointer()); } return null; } /** * Evaluates an element() XPointer scheme based pointer part to the specification at * http://www.w3.org/TR/xptr-element/ * * @param elementPointerPart an ElementPointerPart to evaluate. * @return an XMLElement pointed to by this Element pointer part, or null if none exists. */ private XMLElement evaluateElementPointerPart(ElementPointerPart elementPointerPart) { if (elementPointerPart.hasChildSequence() && elementPointerPart.hasNCName()) { //Both NCName and childSequence. //Find NCName. XMLElement element = evaluateShorthandPointer(elementPointerPart.getNCName()); if (element == null) return null; //Walk through children. return evaluateChildSequence(element, elementPointerPart.getChildSequence()); } else if(elementPointerPart.hasNCName()) { //Only NCName return evaluateShorthandPointer(elementPointerPart.getNCName()); } else { //Only a childSequence //XML must only have 1 root element so we can't evaluate it if its > 1 Integer[] childSequence = elementPointerPart.getChildSequence(); if (childSequence[0].intValue() > 1) return null; Integer[] nChildSequence = new Integer[childSequence.length-1]; for (int i=1; ihttp://www.w3.org/TR/xptr-framework/#shorthand * * @param ncname an NCName to evaluate. * @return an XMLElement pointed to by this shorthand name, or null if none exists. */ private XMLElement evaluateShorthandPointer(NCName ncname) { //Iterator for XMLElement from root in document order. See http://www.w3.org/TR/xpath#dt-document-order String shorthand = ncname.toString(); for(Iterator it = new DocumentOrderIterator(root); it.hasNext(); ){ XMLElement element = (XMLElement)it.next(); if (testElementShorthand(element, shorthand)) return element; } return null; } /** * Evaluates a child sequence array of Integers to an XMLElement following XML Document Order. * This is a helper method used by other evaluation methods in this class. * * @param element an XMLElement to start from. * @param childSequence an Integer[] to evaluate from the start XMLElement. * @return an XMLElement pointed to by this childSequence, or null if none exists. */ private XMLElement evaluateChildSequence(XMLElement element, Integer[] childSequence) { for(int i=0; i children.length) { //childSequence int out of bounds of child array so does not exist. return null; } else { element = element.getChildElements()[childSequence[i].intValue()-1]; } } return element; } //Utility classes /** * Filters an XMLElement[] for nodes which are not xml tag elements. * * @param nodes an XMLElement[] of the nodes to filter. * @return an XMLElement[] of the remaining nodes. */ private static XMLElement[] filterNoneElementNodes(XMLElement[] nodes) { List nodeList = Arrays.asList(nodes); for(Iterator it = nodeList.iterator(); it.hasNext(); ) { XMLElement node = (XMLElement)it.next(); if(node.getLocalName().indexOf('#') > -1) { it.remove(); } } XMLElement[] nNodes = new XMLElement[nodeList.size()]; nodeList.toArray(nNodes); return nNodes; } //Abstract Methods /** * Tests the element for an id according to the specification at * http://www.w3.org/TR/xptr-framework/#term-sdi and returns a boolean answer. * * @param element An XMLElement to test for an id. * @param id A String of the id to test for. * @return boolean value of whether the id matches or not. */ public abstract boolean testElementShorthand(XMLElement element, String id); //Internal classes /** * DocumentOrderIterator is a implementation of Iterator which iterates in Document Order from a root XMLElement object. * */ private class DocumentOrderIterator implements Iterator { private final Stack stack; public DocumentOrderIterator(XMLElement root) { stack = new Stack(); stack.add(root); } public boolean hasNext() { return !stack.isEmpty(); } public Object next() { //Get next element. XMLElement element; try { element = (XMLElement)stack.pop(); } catch (EmptyStackException e) { throw new NoSuchElementException(); } //Add children to top of stack in reverse order. List children = Arrays.asList(element.getChildElements()); Collections.reverse(children); stack.addAll(children); return element; } public void remove() { throw new UnsupportedOperationException(); } } } ./src/org/apache/woden/internal/BaseWSDLFactory.java0000664000175000017500000000522011767656530021472 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.internal; import org.apache.woden.ErrorReporter; import org.apache.woden.WSDLException; import org.apache.woden.WSDLFactory; import org.apache.woden.WSDLReader; import org.apache.woden.internal.wsdl20.DescriptionImpl; import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; import org.apache.woden.wsdl20.xml.DescriptionElement; /** * This abstract class contains properties and methods common * to WSDLFactory implementations. * * @author John Kaputin (jkaputin@apache.org) */ public abstract class BaseWSDLFactory extends WSDLFactory { protected WSDLContext fWsdlContext; protected BaseWSDLFactory() throws WSDLException { ErrorReporter errRpt = new ErrorReporterImpl(); ExtensionRegistry extReg = new PopulatedExtensionRegistry(errRpt); ((ErrorReporterImpl)errRpt).setExtensionRegistry(extReg); fWsdlContext = new WSDLContext(this, errRpt, extReg, null); } abstract public WSDLReader newWSDLReader() throws WSDLException; public ExtensionRegistry newPopulatedExtensionRegistry() throws WSDLException { return new PopulatedExtensionRegistry(fWsdlContext.errorReporter); } //TODO change the name of this API method to newDescriptionElement() public DescriptionElement newDescription() { return new DescriptionImpl(fWsdlContext); } /* * Package private method used by the Woden implementation to create a description * element object with a wsdl context different to the default context provided * provided by this wsdl factory. For example, a wsdl reader or writer may pass * its own context object to this method. */ DescriptionElement newDescriptionElement(WSDLContext wsdlContext) { return new DescriptionImpl(wsdlContext); } } ./src/org/apache/woden/WSDLReader.java0000664000175000017500000002534111767656530016664 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import org.apache.woden.resolver.URIResolver; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.extensions.ExtensionRegistry; /** * This interface declares an API for reading WSDL descriptions from different sources * such as WSDL documents or files, parsed XML elements and input byte streams. * It contains various readWSDL methods that obtain the WSDL infoset from * the specified source, parse it into the Woden object model and return this as a WSDL * Description component containing the WSDL components derived from that infoset. * If the WSDL is comprised of a composite set of documents nested via wsdl:import * or wsdl:include, the Description component will represent the abstract, 'flattened' view * of the WSDL tree, containing all of the WSDL components derived from the various WSDL * documents, but without the document structure. * * @author John Kaputin (jkaputin@apache.org) */ public interface WSDLReader { //TODO Create wsdl-version-independent methods. //E.g. public WSDLDocument readWSDL(String uri); where //WSDLDocument is a wrapper for a 1.1 Definition and a //2.0 Description. The client app could/should then use //WSDLDocument to determine which version is has and use //the appropriate WSDL API. //for the 2.0 prototype, just use 2.0 specific methods /** * Constants for reader configuration feature names. * Features are associated with a boolean value (true if they are * enabled, false if not). * * TODO Decide if these features should be exposed on the Woden API * as constants defined here and used via the generic set/getFeature * methods, or whether we should have a finite set of feature-specific * methods on the WSDLReader interface for the features we know about * (e.g. setValidationFeature(boolean) or setValidationFeatureOn() / * setValidationFeatureOff()) and remove the constants defined here. * Note - even in the latter case, we still need the generic * set/getFeature methods. */ /** * Set to true to enable verbose diagnostic tracing, false otherwise. */ public static String FEATURE_VERBOSE = "http://ws.apache.org/woden/features/verbose"; /** * Set to true to enable the WSDL validation feature, false otherwise. */ public static String FEATURE_VALIDATION = "http://ws.apache.org/woden/features/validation"; /** * Set to true if parsing should continue after * encountering a non-fatal error in the WSDL which might result * in incomplete WSDL model being returned by the reader, * false otherwise. */ public static String FEATURE_CONTINUE_ON_ERROR = "http://ws.apache.org/woden/features/continue_on_error"; /** * Constants for reader configuration property names. * Properties have a value represented by an object. * * TODO ditto the comment on features, about whether to define * property constants here and use generic set/getProperty methods * or remove the constants and use property-specific methods. */ public static String PROPERTY_XML_PARSER_API = "http://ws.apache.org/woden/property/xml_parser_api"; public static String PROPERTY_TYPE_SYSTEM_API = "http://ws.apache.org/woden/property/type_system_api"; /** * A constant representing the W3C XML Schema type system. All * implementations of the Woden API must support W3C XML Schema. * An implementation configured to use this type system can * use this constant to specify its value for the property * "http://ws.apache.org/woden/property/type_system_api". */ public static final String TYPE_XSD_2001 = "http://www.w3.org/2001/XMLSchema"; /** * Read the WSDL document at the specified URI and return a WSDL Description * component containing the WSDL components derived from that document. * * @param wsdlURI a URI (absolute filename or URL) pointing to a * WSDL document. * @return the Description component * @throws WSDLException for terminating errors and as wrapper * for checked exceptions. */ public Description readWSDL(String wsdlURI) throws WSDLException; /** * Read the WSDL obtained from the specified WSDLSource object and return a WSDL Description * component containing the WSDL components derived from that WSDL source. *

    * The WSDLSource object must represent the WSDL using a type that the WSDLReader * implementation can understand. That is, the WSDLSource and WSDLReader implementations * must be compatible. * For example, a DOM-based WSDLReader implementation will likely require the WSDLSource * object to represent the WSDL as a DOM Document or Element (org.w3c.dom.Document * or org.w3c.dom.Element), both of which should be type compatible the DOM-based reader. * * @param wsdlSource contains an object representing the WSDL * @return the Description component * @throws WSDLException for terminating errors and as a wrapper * for checked exceptions */ public Description readWSDL(WSDLSource wsdlSource) throws WSDLException; //TODO - decide if an API method createXMLElement() is needed. /** * Returns a WSDLSource object that is compatible with the WSDLReader implementation. * That is, a WSDLSource implementation that represents WSDL using types that * the WSDLReader implementation can understand. * For example, DOM-based WSDLReader implementation will likely return a WSDLSource * object that represents the WSDL as a DOM Document or Element (org.w3c.dom.Document * or org.w3c.dom.Element), both of which should be type compatible the DOM-based reader. *

    * This WSDLSource object can be used to encapsulate the WSDL and is then passed to the * WSDLReader as a parameter to its readWSDL methods. * * @return the WSDLSource class compatible with the WSDLReader implementation. */ public WSDLSource createWSDLSource(); /** * @return the ErrorReporter used by this reader */ public ErrorReporter getErrorReporter(); /** * Store the name of the WSDLFactory implementation class to be used for * any subsequent WSDLFactory requests. The named factory class will * replace any existing factory object in use. * * @param factoryImplName the WSDLFactory implementation classname */ public void setFactoryImplName(String factoryImplName); /** * @return the WSDLFactory implementation classname */ public String getFactoryImplName(); /** * Set the extension registry to the specified registry reference. * The registry parameter cannot be null. * * @param extReg an ExtensionRegistry * @throws NullPointerException if extReg is null */ public void setExtensionRegistry(ExtensionRegistry extReg); public ExtensionRegistry getExtensionRegistry(); /** * Set a named feature on or off with a boolean. Note, this relates to * features of the Woden framework, not to WSDL-specific features such * as the WSDL 2.0 Feature component. *

    * All feature names should be fully-qualified, Java package style to * avoid name clashes. All names starting with org.apache.woden. are * reserved for features defined by the Woden implementation. * Features specific to other implementations should be fully-qualified * to match the package name structure of that implementation. * For example: com.abc.featureName * * @param name the name of the feature to be set * @param value a boolean value where true sets the feature on, false sets it off * @throws IllegalArgumentException if the feature name is not recognized. */ public void setFeature(String name, boolean value); /** * Returns the on/off setting of the named feature, represented as a boolean. * * @param name the name of the feature to get the value of * @return a boolean representing the on/off state of the named feature * @throws IllegalArgumentException if the feature name is not recognized. */ public boolean getFeature(String name); /** * Set a named property to the specified object. Note, this relates to * properties of the Woden implementation, not to WSDL-specific properties * such as the WSDL 2.0 Property component. *

    * All property names should be fully-qualified, Java package style to * avoid name clashes. All names starting with org.apache.woden. are * reserved for properties defined by the Woden implementation. * Properties specific to other implementations should be fully-qualified * to match the package name structure of that implementation. * For example: com.abc.propertyName * * @param name the name of the property to be set * @param value an Object representing the value to set the property to * @throws IllegalArgumentException if the property name is not recognized. */ public void setProperty(String name, Object value); /** * Returns the value of the named property. * * @param name the name of the property to get the value of * @return an Object representing the property's value * @throws IllegalArgumentException if the property name is not recognized. */ public Object getProperty(String name); /** * Sets the URI resolver to be used. * * @param resolver */ public void setURIResolver(URIResolver resolver); /** * Gets the URI Resolver currently in use * @return the URI resolver currently in use */ public URIResolver getURIResolver(); } ./src/org/apache/woden/WSDLException.java0000664000175000017500000000670311767656530017421 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden; import java.io.PrintWriter; import java.io.StringWriter; public class WSDLException extends Exception { public static final long serialVersionUID = 1; public static final String INVALID_WSDL = "INVALID_WSDL"; public static final String PARSER_ERROR = "PARSER_ERROR"; public static final String OTHER_ERROR = "OTHER_ERROR"; public static final String CONFIGURATION_ERROR = "CONFIGURATION_ERROR"; public static final String UNBOUND_PREFIX = "UNBOUND_PREFIX"; public static final String NO_PREFIX_SPECIFIED = "NO_PREFIX_SPECIFIED"; private String fFaultCode = null; private Throwable fTargetThrowable = null; private String fLocation = null; public WSDLException(String faultCode, String msg, Throwable t) { super(msg); setFaultCode(faultCode); setTargetException(t); } public WSDLException(String faultCode, String msg) { this(faultCode, msg, null); } public void setFaultCode(String faultCode) { fFaultCode = faultCode; } public String getFaultCode() { return fFaultCode; } public void setTargetException(Throwable targetThrowable) { fTargetThrowable = targetThrowable; } public Throwable getTargetException() { return fTargetThrowable; } /** * Set the location using an XPath expression. Used for error messages. * * @param location an XPath expression describing the location where * the exception occurred. */ public void setLocation(String location) { fLocation = location; } /** * Get the location, if one was set. Should be an XPath expression which * is used for error messages. */ public String getLocation() { return fLocation; } public String getMessage() { StringBuffer strBuf = new StringBuffer(); strBuf.append("WSDLException"); if (fLocation != null) { strBuf.append(" (at " + fLocation + ")"); } if (fFaultCode != null) { strBuf.append(": faultCode=" + fFaultCode); } String thisMsg = super.getMessage(); String targetMsg = (fTargetThrowable != null) ? fTargetThrowable.getMessage() : null; if (thisMsg != null && (targetMsg == null || !thisMsg.equals(targetMsg))) { strBuf.append(": " + thisMsg); } if (targetMsg != null) { strBuf.append(": " + targetMsg); } return strBuf.toString(); } public String toString() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.print(getMessage() + ": "); if (fTargetThrowable != null) { fTargetThrowable.printStackTrace(pw); } return sw.toString(); } }./src/org/apache/woden/schema/0000775000175000017500000000000011767656530015360 5ustar brianbrian./src/org/apache/woden/schema/ImportedSchema.java0000664000175000017500000000270211767656530021130 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.schema; import java.net.URI; /** * This interface represents a schema import element, <xs:import>. It extends the Schema * interface, adding support for the schemaLocation attribute. * * @author John Kaputin (jkaputin@apache.org) */ public interface ImportedSchema extends Schema { /** * Set the URI representing the schemaLocation attribute of <xs:import>. */ public void setSchemaLocation(URI location); /** * @return the URI representing the schemaLocation attribute of <xs:import>. */ public URI getSchemaLocation(); } ./src/org/apache/woden/schema/Schema.java0000664000175000017500000001002411767656530017420 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.schema; import java.net.URI; import org.apache.woden.XMLElement; import org.apache.ws.commons.schema.XmlSchema; /** * This interface provides an abstract representation of an XML Schema referenced * within the <wsdl:types> element. For example, via <xs:schema> or * <xs:import>. * It provides the namespace used as the target namespace of an inlined schema * or as the imported namespace of a schema import. * It provides a reference to the actual schema definition, represented by * org.apache.ws.commons.schema.XmlSchema. * For applications that use other representations for XML Schema content, * it also provides a reference to the org.apache.woden.XMLElement * object that wraps the underlying <xs:schema> or <xs:import> * element. * It also indicates whether the schema is 'referenceable' by the surrounding * WSDL document, as defined by the schema referenceability rules in the * WSDL 2.0 spec. *

    * * NOTE: non-XML type systems like DTD are not handled by this interface. They must be * handled by WSDL 2.0 extension mechanisms. *
    * TODO Need to determine if this interface is suitable for use with other xml-based * schema types like Relax NG or if some type of schema extension mechanism is required. * * @author John Kaputin (jkaputin@apache.org) */ public interface Schema { /** * Returns a URI representing the targetNamespace attribute of a * <xs:schema> element or the namespace attribute of a * <xs:import> element. * * @return a URI representing the schema's namespace */ public URI getNamespace(); /** * Set the targetNamespace attribute of a <xs:schema> element * or the namespace attribute of a <xs:import> element. * @param namespace */ public void setNamespace(URI namespace); /** * Returns an XmlSchema representing the schema definition inlined by * a <xs:schema> element or imported by a <xs:import> element. * * @return the XmlSchema representing schema definition. */ public XmlSchema getSchemaDefinition(); /** * Sets the schema definition for an inlined schema or schema import to the specified * XmlSchema. * * @param schemaDef the XmlSchema representing this schema */ public void setSchemaDefinition(XmlSchema schemaDef); /** * Returns the XMLElement representing the xs:schema or xs:import * element within the wsdl:types element. This provides an 'wrapper' to the * underlying XML Schema infoset for applications that need schema processing alternatives to * Apache WS Commons XmlSchema. * * @return the XMLElement that wraps the underlying schema or schema import element */ public XMLElement getXMLElement(); /** * Sets the XMLElement representing the underlying xs:schema or xs:import * element. * * @param xsdElement the XMLElement */ public void setXMLElement(XMLElement xsdElement); } ./src/org/apache/woden/schema/InlinedSchema.java0000664000175000017500000000256111767656530020732 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.schema; /** * This interface represents an inlined schema element, <xs:schema>. It extends the Schema * interface, adding support for the id attribute. * * @author John Kaputin (jkaputin@apache.org) */ public interface InlinedSchema extends Schema { /** * Set the String representing the id attribute of <xs:schema>. */ public void setId(String id); /** * @return a String representing the id attribute of <xs:schema>. */ public String getId(); } ./src/org/apache/woden/resolver/0000775000175000017500000000000011767656530015761 5ustar brianbrian./src/org/apache/woden/resolver/URIResolver.java0000664000175000017500000000410211767656530021002 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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. * * @author Graham Turrell */ package org.apache.woden.resolver; import java.io.IOException; import java.net.URI; import org.apache.woden.WSDLException; /** *Implementations of this interface may be used to specify a custom URI resolver. *Such an implementation can then be used to override the default Woden URI Resolver. *To associate a URI resolver programmatically, the following should be called prior to parser invocation. *

    Example: *
    WSDLFactory factory = WSDLFactory.newInstance(); *
    WSDLReader reader = factory.newWSDLReader(); *
    // MyURIResolver implements this interface ... *
    URIResolver resolver = new MyURIResolver(); *
    reader.setURIResolver(resolver); *
    ... *
    // Then, can parse a document and the assigned resolver will be used internally... *
    Description desc = reader.readWSDL("http://myplace/mydoc.wsdl"); *@see org.apache.woden.WSDLFactory *@see org.apache.woden.WSDLReader */ public interface URIResolver { /** * Implementation should return null if there is no resolution for the uri. * * @param uri the uri to be resolved * @return the resolved URI (or null if no resolution available) * @throws WSDLException * @throws IOException */ public URI resolveURI(URI uri) throws WSDLException, IOException; } ./src/org/apache/woden/xpointer/0000775000175000017500000000000011767656530015770 5ustar brianbrian./src/org/apache/woden/xpointer/XPointerParser.java0000664000175000017500000006232011767656530021563 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; import java.util.Hashtable; import org.apache.woden.types.XMLChar; import org.apache.woden.types.NCName; /** * This class parses a String to the XPointer Framework specification for shorthand and scheme based pointers. * For scheme based pointers each know pointer part * * See the XPointer Framework Recommendation for * more information on the XPointer Framework, ShortHand and Scheme based Pointers. * * This class based on the org.apache.xerces.xpointer.XPointerHandler class in the Apache Xerces Project * for the core XPointer parsing code. It has been modified to be used inside the Woden XPointer model. * * @author Dan Harvey (danharvey42@gmail.com) * */ final class XPointerParser { private static final String emptyString = "".intern(); /** * Parses a String XPointer and stores the results into the given XPointer object. * * @param xpointerString * @param xpointer * @throws InvalidXPointerException if the XPointer being parsed contains invalid syntax. */ public static void parseXPointer(String xpointerString, XPointer xpointer) throws InvalidXPointerException{ final String ELEMENT_SCHEME_NAME = "element"; // Supported schemes final Tokens tokens = new Tokens(); // tokens // scan the XPointer expression int length = xpointerString.length(); boolean success = Scanner.scanExpr(tokens, xpointerString, 0, length); if (!success) throw new InvalidXPointerException("Invalid XPointer expression", xpointerString); while (tokens.hasMore()) { int token = tokens.nextToken(); switch (token) { case Tokens.XPTRTOKEN_SHORTHAND: { // The shorthand name token = tokens.nextToken(); String shortHandPointerName = tokens.getTokenString(token); if (shortHandPointerName == null) throw new InvalidXPointerException("Invalid Shorthand XPointer", xpointerString); xpointer.setShorthandPointer(new NCName(shortHandPointerName)); break; } case Tokens.XPTRTOKEN_SCHEMENAME: { // Retrieve the local name and prefix to form the scheme name token = tokens.nextToken(); String prefix = tokens.getTokenString(token); token = tokens.nextToken(); String localName = tokens.getTokenString(token); String schemeName = prefix + localName; // The next character should be an open parenthesis int openParenCount = 0; int closeParenCount = 0; token = tokens.nextToken(); String openParen = tokens.getTokenString(token); if (openParen != "XPTRTOKEN_OPEN_PAREN") { // can not have more than one ShortHand Pointer if (token == Tokens.XPTRTOKEN_SHORTHAND) { throw new InvalidXPointerException("MultipleShortHandPointers", xpointerString); } else { throw new InvalidXPointerException("Invalid XPointer Expression", xpointerString); } } openParenCount++; // followed by zero or more ( and the schemeData String schemeData = null; while (tokens.hasMore()) { token = tokens.nextToken(); schemeData = tokens.getTokenString(token); if (schemeData != "XPTRTOKEN_OPEN_PAREN") { break; } openParenCount++; } token = tokens.nextToken(); schemeData = tokens.getTokenString(token); // followed by the same number of ) if (tokens.hasMore()) { token = tokens.nextToken(); String closeParen = tokens.getTokenString(token); if (closeParen != "XPTRTOKEN_CLOSE_PAREN") new InvalidXPointerException("SchemeDataNotFollowedByCloseParenthesis", xpointerString); } else { new InvalidXPointerException("SchemeDataNotFollowedByCloseParenthesis", xpointerString); } closeParenCount++; while (tokens.hasMore()) { if (tokens.getTokenString(tokens.peekToken()) != "XPTRTOKEN_OPEN_PAREN") { break; } closeParenCount++; } // check if the number of open parenthesis are equal to the number of close parenthesis if (openParenCount != closeParenCount) { throw new InvalidXPointerException("UnbalancedParenthesisInXPointerExpression", xpointerString); } // Perform scheme specific parsing of the pointer part, make this more generic for any pointer part? if (schemeName.equals(ELEMENT_SCHEME_NAME)) { PointerPart elementSchemePointer = ElementPointerPart.parseFromString(schemeData); xpointer.addPointerPart(elementSchemePointer); } //Else an unknown scheme. break; } default: throw new InvalidXPointerException("InvalidXPointerExpression", xpointerString); } } } /** * List of XPointer Framework tokens. * */ private static class Tokens { /** * XPointer Framework tokens * [1] Pointer ::= Shorthand | SchemeBased * [2] Shorthand ::= NCName * [3] SchemeBased ::= PointerPart (S? PointerPart)* * [4] PointerPart ::= SchemeName '(' SchemeData ')' * [5] SchemeName ::= QName * [6] SchemeData ::= EscapedData* * [7] EscapedData ::= NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')' * [8] NormalChar ::= UnicodeChar - [()^] * [9] UnicodeChar ::= [#x0-#x10FFFF] * */ private static final int XPTRTOKEN_OPEN_PAREN = 0, XPTRTOKEN_CLOSE_PAREN = 1, XPTRTOKEN_SHORTHAND = 2, XPTRTOKEN_SCHEMENAME = 3, XPTRTOKEN_SCHEMEDATA = 4; // Token count private static final int INITIAL_TOKEN_COUNT = 1 << 8; private int[] fTokens = new int[INITIAL_TOKEN_COUNT]; private int fTokenCount = 0; // Current token position private int fCurrentTokenIndex; private Hashtable fTokenNames = new Hashtable(); /** * Constructor * */ private Tokens() { fTokenNames.put(new Integer(XPTRTOKEN_OPEN_PAREN), "XPTRTOKEN_OPEN_PAREN"); fTokenNames.put(new Integer(XPTRTOKEN_CLOSE_PAREN), "XPTRTOKEN_CLOSE_PAREN"); fTokenNames.put(new Integer(XPTRTOKEN_SHORTHAND), "XPTRTOKEN_SHORTHAND"); fTokenNames.put(new Integer(XPTRTOKEN_SCHEMENAME), "XPTRTOKEN_SCHEMENAME"); fTokenNames.put(new Integer(XPTRTOKEN_SCHEMEDATA), "XPTRTOKEN_SCHEMEDATA"); } /** * Returns the token String * @param token The index of the token * @return String The token string */ private String getTokenString(int token) { return (String) fTokenNames.get(new Integer(token)); } /** * Add the specified string as a token * * @param token The token string */ private void addToken(String tokenStr) { Integer tokenInt = (Integer) fTokenNames.get(tokenStr); if (tokenInt == null) { tokenInt = new Integer(fTokenNames.size()); fTokenNames.put(tokenInt, tokenStr); } addToken(tokenInt.intValue()); } /** * Add the specified int token * * @param token The int specifying the token */ private void addToken(int token) { try { fTokens[fTokenCount] = token; } catch (ArrayIndexOutOfBoundsException ex) { int[] oldList = fTokens; fTokens = new int[fTokenCount << 1]; System.arraycopy(oldList, 0, fTokens, 0, fTokenCount); fTokens[fTokenCount] = token; } fTokenCount++; } /** * Returns true if the {@link #getNextToken()} method * returns a valid token. */ private boolean hasMore() { return fCurrentTokenIndex < fTokenCount; } /** * Obtains the token at the current position, then advance * the current position by one. * * throws If there's no such next token, this method throws * new XNIException("XPointerProcessingError");. */ private int nextToken() { if (fCurrentTokenIndex == fTokenCount) { throw new IndexOutOfBoundsException("There are no more tokens to return."); } return fTokens[fCurrentTokenIndex++]; } /** * Obtains the token at the current position, without advancing * the current position. * * If there's no such next token, this method throws * new XNIException("XPointerProcessingError");. */ private int peekToken() { if (fCurrentTokenIndex == fTokenCount) { throw new IndexOutOfBoundsException("There are no more tokens to return."); } return fTokens[fCurrentTokenIndex]; } } /** * The XPointer expression scanner. Scans the XPointer framework expression. * */ private static class Scanner { /** * 7-bit ASCII subset * * 0 1 2 3 4 5 6 7 8 9 A B C D E F * 0, 0, 0, 0, 0, 0, 0, 0, 0, HT, LF, 0, 0, CR, 0, 0, // 0 * 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 * SP, !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, // 2 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ;, <, =, >, ?, // 3 * @, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, // 4 * P, Q, R, S, T, U, V, W, X, Y, Z, [, \, ], ^, _, // 5 * `, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, // 6 * p, q, r, s, t, u, v, w, x, y, z, {, |, }, ~, DEL // 7 */ private static final byte CHARTYPE_INVALID = 0, // invalid XML character CHARTYPE_OTHER = 1, // not special - one of "#%&;?\`{}~" or DEL CHARTYPE_WHITESPACE = 2, // one of "\t\n\r " (0x09, 0x0A, 0x0D, 0x20) CHARTYPE_CARRET = 3, // ^ CHARTYPE_OPEN_PAREN = 4, // '(' (0x28) CHARTYPE_CLOSE_PAREN = 5, // ')' (0x29) CHARTYPE_MINUS = 6, // '-' (0x2D) CHARTYPE_PERIOD = 7, // '.' (0x2E) CHARTYPE_SLASH = 8, // '/' (0x2F) CHARTYPE_DIGIT = 9, // '0'-'9' (0x30 to 0x39) CHARTYPE_COLON = 10, // ':' (0x3A) CHARTYPE_EQUAL = 11, // '=' (0x3D) CHARTYPE_LETTER = 12, // 'A'-'Z' or 'a'-'z' (0x41 to 0x5A and 0x61 to 0x7A) CHARTYPE_UNDERSCORE = 13, // '_' (0x5F) CHARTYPE_NONASCII = 14; // Non-ASCII Unicode codepoint (>= 0x80) private static final byte[] fASCIICharMap = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 1, 1, 11, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 3, 13, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 1, 1 }; /** * Scans the XPointer Expression * */ private static boolean scanExpr(Tokens tokens, String data, int currentOffset, int endOffset) throws InvalidXPointerException { int ch; int openParen = 0; int closeParen = 0; int nameOffset, dataOffset; boolean isQName = false; String name = null; String prefix = null; String schemeData = null; StringBuffer schemeDataBuff = new StringBuffer(); while (true) { if (currentOffset == endOffset) { break; } ch = data.charAt(currentOffset); // while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D) { if (++currentOffset == endOffset) { break; } ch = data.charAt(currentOffset); } if (currentOffset == endOffset) { break; } // // [1] Pointer ::= Shorthand | SchemeBased // [2] Shorthand ::= NCName // [3] SchemeBased ::= PointerPart (S? PointerPart)* // [4] PointerPart ::= SchemeName '(' SchemeData ')' // [5] SchemeName ::= QName // [6] SchemeData ::= EscapedData* // [7] EscapedData ::= NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')' // [8] NormalChar ::= UnicodeChar - [()^] // [9] UnicodeChar ::= [#x0-#x10FFFF] // [?] QName ::= (NCName ':')? NCName // [?] NCName ::= (Letter | '_') (NCNameChar)* // [?] NCNameChar ::= Letter | Digit | '.' | '-' | '_' (ascii subset of 'NCNameChar') // [?] Letter ::= [A-Za-z] (ascii subset of 'Letter') // [?] Digit ::= [0-9] (ascii subset of 'Digit') // byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII : fASCIICharMap[ch]; switch (chartype) { case CHARTYPE_OPEN_PAREN: // '(' addToken(tokens, Tokens.XPTRTOKEN_OPEN_PAREN); openParen++; ++currentOffset; break; case CHARTYPE_CLOSE_PAREN: // ')' addToken(tokens, Tokens.XPTRTOKEN_CLOSE_PAREN); closeParen++; ++currentOffset; break; case CHARTYPE_CARRET: case CHARTYPE_COLON: case CHARTYPE_DIGIT: case CHARTYPE_EQUAL: case CHARTYPE_LETTER: case CHARTYPE_MINUS: case CHARTYPE_NONASCII: case CHARTYPE_OTHER: case CHARTYPE_PERIOD: case CHARTYPE_SLASH: case CHARTYPE_UNDERSCORE: case CHARTYPE_WHITESPACE: // Scanning SchemeName | Shorthand if (openParen == 0) { nameOffset = currentOffset; currentOffset = scanNCName(data, endOffset, currentOffset); if (currentOffset == nameOffset) throw new InvalidXPointerException("InvalidShortHandPointer", data); if (currentOffset < endOffset) { ch = data.charAt(currentOffset); } else { ch = -1; } name = data.substring(nameOffset, currentOffset).intern(); prefix = emptyString; // The name is a QName => a SchemeName if (ch == ':') { if (++currentOffset == endOffset) { return false; } ch = data.charAt(currentOffset); prefix = name; nameOffset = currentOffset; currentOffset = scanNCName(data, endOffset, currentOffset); if (currentOffset == nameOffset) { return false; } if (currentOffset < endOffset) { ch = data.charAt(currentOffset); } else { ch = -1; } isQName = true; name = data.substring(nameOffset, currentOffset).intern(); } // REVISIT: if (currentOffset != endOffset) { addToken(tokens, Tokens.XPTRTOKEN_SCHEMENAME); tokens.addToken(prefix); tokens.addToken(name); isQName = false; } else if (currentOffset == endOffset) { // NCName => Shorthand addToken(tokens, Tokens.XPTRTOKEN_SHORTHAND); tokens.addToken(name); isQName = false; } // reset open/close paren for the next pointer part closeParen = 0; break; } else if (openParen > 0 && closeParen == 0 && name != null) { // Scanning SchemeData dataOffset = currentOffset; currentOffset = scanData(data, schemeDataBuff, endOffset, currentOffset); if (currentOffset == dataOffset) throw new InvalidXPointerException("InvalidSchemeDataInXPointer", data); if (currentOffset < endOffset) { ch = data.charAt(currentOffset); } else { ch = -1; } schemeData = schemeDataBuff.toString().intern(); addToken(tokens, Tokens.XPTRTOKEN_SCHEMEDATA); tokens.addToken(schemeData); // reset open/close paren for the next pointer part openParen = 0; schemeDataBuff.delete(0, schemeDataBuff.length()); } else { // ex. schemeName() // Should we throw an exception with a more suitable message instead?? return false; } } } // end while return true; } /** * Scans a NCName. * From Namespaces in XML * [5] NCName ::= (Letter | '_') (NCNameChar)* * [6] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender * * @param data A String containing the XPointer expression * @param endOffset The int XPointer expression length * @param currentOffset An int representing the current position of the XPointer expression pointer */ private static int scanNCName(String data, int endOffset, int currentOffset) { int ch = data.charAt(currentOffset); if (ch >= 0x80) { if (!XMLChar.isNameStart(ch)) { return currentOffset; } } else { byte chartype = fASCIICharMap[ch]; if (chartype != CHARTYPE_LETTER && chartype != CHARTYPE_UNDERSCORE) { return currentOffset; } } //while (currentOffset++ < endOffset) { while (++currentOffset < endOffset) { ch = data.charAt(currentOffset); if (ch >= 0x80) { if (!XMLChar.isName(ch)) { break; } } else { byte chartype = fASCIICharMap[ch]; if (chartype != CHARTYPE_LETTER && chartype != CHARTYPE_DIGIT && chartype != CHARTYPE_PERIOD && chartype != CHARTYPE_MINUS && chartype != CHARTYPE_UNDERSCORE) { break; } } } return currentOffset; } /** * Scans the SchemeData. * [6] SchemeData ::= EscapedData* * [7] EscapedData ::= NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')' * [8] NormalChar ::= UnicodeChar - [()^] * [9] UnicodeChar ::= [#x0-#x10FFFF] * */ private static int scanData(String data, StringBuffer schemeData, int endOffset, int currentOffset) { while (true) { if (currentOffset == endOffset) { break; } int ch = data.charAt(currentOffset); byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII : fASCIICharMap[ch]; if (chartype == CHARTYPE_OPEN_PAREN) { schemeData.append(ch); //schemeData.append(Tokens.XPTRTOKEN_OPEN_PAREN); currentOffset = scanData(data, schemeData, endOffset, ++currentOffset); if (currentOffset == endOffset) { return currentOffset; } ch = data.charAt(currentOffset); chartype = (ch >= 0x80) ? CHARTYPE_NONASCII : fASCIICharMap[ch]; if (chartype != CHARTYPE_CLOSE_PAREN) { return endOffset; } schemeData.append((char) ch); ++currentOffset;// } else if (chartype == CHARTYPE_CLOSE_PAREN) { return currentOffset; } else if (chartype == CHARTYPE_CARRET) { ch = data.charAt(++currentOffset); chartype = (ch >= 0x80) ? CHARTYPE_NONASCII : fASCIICharMap[ch]; if (chartype != CHARTYPE_CARRET && chartype != CHARTYPE_OPEN_PAREN && chartype != CHARTYPE_CLOSE_PAREN) { break; } schemeData.append((char) ch); ++currentOffset; } else { schemeData.append((char) ch); ++currentOffset;// } } return currentOffset; } // // Protected methods // /** * This method adds the specified token to the token list. By * default, this method allows all tokens. However, subclasses * of the XPathExprScanner can override this method in order * to disallow certain tokens from being used in the scanned * XPath expression. This is a convenient way of allowing only * a subset of XPath. */ protected static void addToken(Tokens tokens, int token) { if (token == Tokens.XPTRTOKEN_OPEN_PAREN || token == Tokens.XPTRTOKEN_CLOSE_PAREN || token == Tokens.XPTRTOKEN_SCHEMENAME || token == Tokens.XPTRTOKEN_SCHEMEDATA || token == Tokens.XPTRTOKEN_SHORTHAND) { tokens.addToken(token); return; } throw new IllegalArgumentException("InvalidXPointerToken"); } } // class Scanner } ./src/org/apache/woden/xpointer/XmlnsPointerPart.java0000664000175000017500000000323611767656530022130 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; import org.apache.woden.types.NCName; /** * Represents a fragment identifier conforming to the XML Pointer Language Framework. * * This class is based upon a class of the same name in the Apache Coccon. * * @author Dan Harvey (danharvey42@gmail.com) */ public class XmlnsPointerPart implements PointerPart { private final NCName prefix; private final String namespace; public XmlnsPointerPart(NCName prefix, String namespace) { if (prefix == null | namespace == null) { throw new IllegalArgumentException(); } this.prefix = prefix; this.namespace = namespace; } public String toString() { return "xmlns(" + prefix + "=" + namespace + ")"; } public void prefixNamespaces(XPointer xpointer) { //This PointerPart does not have any namespaces. } } ./src/org/apache/woden/xpointer/InvalidXPointerException.java0000664000175000017500000001276411767656530023603 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; /** * This class represents Exceptions that can happen during parsing an XPointer Expression. * * @author Dan Harvey * */ public class InvalidXPointerException extends Exception { private static final long serialVersionUID = 0; private final String fragment; private final Integer startChar; private final Integer endChar; /** * Constructs a InvalidXPointerException with a message and fragment properties. * * @param message a String message of error. * @param fragment a String fragment of the cause. */ public InvalidXPointerException(String message, String fragment) { this(message, fragment, null, null, null); } /** * Constructs a InvalidXPointerException with a message and fragment properties. * * It also has a Throwable argument to support exception chaining. * * @param message a String message of error. * @param fragment a String fragment of the cause of the error. * @param cause a Throwable which caused this exception to be thrown. */ public InvalidXPointerException(String message, String fragment, Throwable cause) { this(message, fragment, null, null, cause); } /** * Constructs a InvalidXPointerException with a message and fragment properties, * and index to the cause inside the fragment. * * @param message a String message of error. * @param fragment a String fragment of the cause of the error. * @param startChar a int char index to the start of the cause in the fragment. * @param endChar a int char index to the end of the cause in the fragment. */ public InvalidXPointerException(String message, String fragment, int startChar, int endChar) { this(message, fragment, new Integer(startChar), new Integer(endChar), null); } /** * Constructs a InvalidXPointerException with a message and fragment properties, * and index to the cause inside the fragment. * * It also has a Throwable argument to support exception chaining. * * @param message a String message of error. * @param fragment a String fragment of the cause of the error. * @param startChar an int char index to the start of the cause in the fragment. * @param endChar an int char index to the end of the cause in the fragment. * @param cause a Throwable which caused the exception to be thrown. */ public InvalidXPointerException(String message, String fragment, int startChar, int endChar, Throwable cause) { this(message, fragment, new Integer(startChar), new Integer(endChar), cause); } /** * Constructs a new InvalidXPointerException. * This constructor is called by all of the above constructors and stores the in indexes and Integers internally. * * @param message a String message of error. * @param fragment a String fragment of the cause of the error. * @param startChar an Integer char index to the start of the cause in the fragment. * @param endChar an Integer char index to the end of the cause in the fragment. * @param cause a Throwable which caused the exception to be thrown. */ private InvalidXPointerException(String message, String fragment, Integer startChar, Integer endChar, Throwable cause) { super(message, cause); this.fragment = fragment; this.startChar = startChar; this.endChar = endChar; } /** * Returns the fragment String stored inside this exception. * * @return a String fragment. */ public String getFragment() { return fragment; } /** * Returns the startChar index of the cause of this error in the fragment. * * @return an Integer of the startChar index if one exists, otherwise null. */ public Integer getStartChar() { return startChar; } /** * Returns the endChar index of the cause of this error in the fragment. * * @return an Integer of the startChar index if one exists, otherwise null. */ public Integer getEndChar() { return endChar; } /* * (non-Javadoc) * @see java.lang.Throwable#toString() */ public String toString() { String postString; if (startChar != null && endChar!= null) { postString = "{XPointer: " + fragment + ", start: " + startChar.toString()+ ", end: " + endChar.toString() + ", substr: " + fragment.substring(startChar.intValue(), endChar.intValue()) + "}"; } else { postString = "{XPointer: " + fragment + "}"; } return "InvalidXPointerException: " + getMessage() + ". " + postString; } } ./src/org/apache/woden/xpointer/PointerPart.java0000664000175000017500000000221711767656530021104 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; /** * Interface to be implemented by pointer parts (XPointer schemes). */ public interface PointerPart { /** * Returns a String serialisation of this xpointer PointerPart. * * @return a String containing the serialisation of this xpointer PointerPart. */ public String toString(); } ./src/org/apache/woden/xpointer/XPointer.java0000664000175000017500000002346011767656530020410 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.lang.StringBuffer; import org.apache.woden.types.NCName; /** * XPointer is a class which represents an XPointer defined in the XPointer Framework. * This is specified at http://www.w3.org/TR/xptr-framework/ * * @author Dan Harvey (danharvey42@gmail.com) * */ public class XPointer { private static final String emptyString = "".intern(); private final Map prefixBindingContex; private final Map namespaceBindingContex; private NCName shorthandPointer; private final List pointerParts; private static final NCName emptyNCName = new NCName(emptyString); private static final String NS_URI_XML = "http://www.w3.org/XML/1998/namespace"; private static final String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/"; private static final NCName NS_PREFIX_XMLNS = new NCName("xmlns"); /** * Constructs a new XPointer. * */ public XPointer() { pointerParts = new ArrayList(); shorthandPointer = emptyNCName; //Setup prefix/namespace binding context. prefixBindingContex = new HashMap(); namespaceBindingContex = new HashMap(); addPrefixNamespaceBinding(new NCName("xml"), NS_URI_XML); } /** * Constructs a new XPointer from the serialised string. * * @param xpointerString a String form of the XPointer to deserialise. */ public XPointer(String xpointerString) throws InvalidXPointerException { this(); //Construct a new XPointer. if (xpointerString == null || xpointerString.equals(emptyString)) throw new InvalidXPointerException("The XPointer string is either null or empty", emptyString); XPointerParser.parseXPointer(xpointerString, this); //Parse the string and add the Pointers to the new XPointer. } /** * Appends a pointer part to the end of this XPointer. * * @param pointerPart the Pointer Part to append. * @throws UnsupportedOperationException() if a Shorthand Pointer is already set. */ public void addPointerPart(PointerPart pointerPart) { if(!shorthandPointer.equals(emptyNCName)) { throw new UnsupportedOperationException("A Shortname Pointer already exists for this XPointer."); } else { pointerParts.add(pointerPart); } } /** * Inserts a pointer part at index of this XPointer. * * @param pointerPart the Pointer Part to inserted. * @param index an integer specifying the point to insert the pointer part. * @throws UnsupportedOperationException() if a Shorthand Pointer is already set. */ public void addPointerPart(int index, PointerPart pointerPart) { if(hasShorthandPointer()) { throw new UnsupportedOperationException("A Shortname Pointer already exists for this XPointer."); } if(index < 0 || index > pointerParts.size()) { throw new IndexOutOfBoundsException("The index you gave is out of the bounds of the list of XPointers"); } pointerParts.add(index, pointerPart); } /** * Returns the pointer parts in this XPointer. * * @return a PointerPart[] of type Object[] containing the pointer parts in this XPointer. * @throws IllegalStateException if this XPointer has a shorthand pointer. */ public Object[] getPointerParts() { if (hasPointerParts()) { int size = pointerParts.size(); Object[] parts = new Object[size]; //Ugly but it will have to do for Java 1.4 for(int i=0; ihttp://www.w3.org/TR/xptr-framework/#nsContext */ public void addPrefixNamespaceBinding(NCName prefix, String namespace) { if (prefix == null) throw new NullPointerException("The prefix argument provided has a null pointer."); if (namespace == null) throw new NullPointerException("The namespace argument provided has a null pointer."); if (prefix.equals(NS_PREFIX_XMLNS)) throw new IllegalArgumentException("The xmlns prefix must not be bound to any namespace."); if (namespace.equals(NS_URI_XMLNS)) throw new IllegalArgumentException("The " + NS_URI_XMLNS + " namespace must not be bound to any prefix."); //Its a valid binding so add it to the binding contex. prefixBindingContex.put(prefix, namespace); namespaceBindingContex.put(namespace, prefix); } /** * Gets the Namespace the Prefix is bound to if the binding exists, * otherwise it will return null. * * @param prefix a NCName of the prefix bound to the namespace. * @return A String of the namespace bound to this prefix or null if none exists. */ public String getPrefixBinding(NCName prefix) { return (String)prefixBindingContex.get(prefix); } /** * Gets Prefix the Namespace is bound to if the binding exists, * otherwise it will return null. * * @param namespace a String of the prefix bound to the prefix. * @return A NCName of the prefix bound to this namespace or null if none exists. */ public NCName getNamespaceBinding(String namespace) { return (NCName)namespaceBindingContex.get(namespace); } /** * Checks whether a prefix is bound or not. * * @param prefix A NCName of the prefix to check. * @return a boolean value that is true if the binding exists, or false otherwise. */ public boolean hasPrefixBinding(NCName prefix) { return prefixBindingContex.containsKey(prefix); } /** * Checks whether a namespace is bound or not. * * @param namespace A String of the namespace to check. * @return a boolean value that is true if the binding exists, or false otherwise. */ public boolean hasNamespaceBinding(String namespace) { return namespaceBindingContex.containsKey(namespace); } /** * Tests whether this XPointer has a shorthand pointer or not. * * @return a boolean which is true if this XPointer contains an shorthand pointer, false otherwise. */ public boolean hasShorthandPointer() { return !shorthandPointer.equals(emptyNCName); } /** * Tests whether this XPointer has scheme based pointers or not. * * @return a boolean which is true if this XPointer contains scheme based pointers, false otherwise. */ public boolean hasPointerParts() { return !pointerParts.isEmpty(); } /** * Returns a String serialisation of this XPointer. * * @return a String containing the serialisation of this XPointer */ public String toString() { if (shorthandPointer.equals(emptyNCName)) { StringBuffer buffer = new StringBuffer(); Iterator parts = pointerParts.iterator(); while (parts.hasNext()) { buffer.append(parts.next()); } return buffer.toString(); } else { return shorthandPointer.toString(); } } }./src/org/apache/woden/xpointer/ElementPointerPart.java0000664000175000017500000002434511767656530022424 0ustar brianbrian/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to 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.woden.xpointer; import org.apache.woden.types.NCName; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.lang.StringBuffer; import java.lang.NumberFormatException; /** * ElementPointerPart is a class which represents the element() scheme for the XPointer Framework. * The specification is defined at http://www.w3.org/TR/xptr-element/ * * This class is immutable. * * @author Dan Harvey (danharvey42@gmail.com) * */ public class ElementPointerPart implements PointerPart { private final NCName ncname; private final List childSequence; /** * Constructs an ElementPointerPart with only an elementID NCName. * * @param elementID an NCName of the elementID to reference. * @throws NullPointerException is a null elementID is given. */ public ElementPointerPart(NCName elementID) { if(elementID == null) { throw new NullPointerException("The elementID argument is null."); } this.ncname = elementID; this.childSequence = null; } /** * Constructs an ElementPointerPart with only a childSequence. * * @param childSequence a List of Integers representing the child sequence. * @throws NullPointerException if childSequence is null. * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers. */ public ElementPointerPart(List childSequence) { if(childSequence == null) { throw new NullPointerException("The childSequence argument is null."); } if(childSequence.isEmpty()) { throw new IllegalArgumentException("The childSequence list is empty."); } for(Iterator it = childSequence.iterator(); it.hasNext();) { if(!(it.next() instanceof Integer)){ throw new IllegalArgumentException("The childSequence list must only contain Integers."); } } this.ncname = null; this.childSequence = childSequence; } /** * Constructs an ElementPointerPart with both an NCName and a childSequence. * * @param elementID an NCName of the elementID to reference. * @param childSequence a List of Integers representing the child sequence. * @throws NullPointerException if elementID or childSequence are null. * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers. */ public ElementPointerPart(NCName elementID, List childSequence) { if(elementID == null) { throw new NullPointerException("The elementID argument is null."); } if(childSequence == null) { throw new NullPointerException("The childSequence argument is null."); } if(childSequence.isEmpty()) { throw new IllegalArgumentException("The childSequence list is empty."); } for(Iterator it = childSequence.iterator(); it.hasNext();) { Object integer = it.next(); if(!(integer instanceof Integer)){ throw new IllegalArgumentException("the childSequence list must only contain Integers."); } else if (((Integer)integer).intValue() == 0){ throw new IllegalArgumentException("the childSequence list must only contain Integers bigger than 0."); } } this.ncname = elementID; this.childSequence = childSequence; } /** * Returns the NCName for this Element PointerPart. * * @return an NCName if it exists in this Element PointerPart, otherwise null. */ public NCName getNCName() { return ncname; } /** * Returns the child sequence of this Element PointerPart. * * @return a Integer[] of the child sequence for this element pointer part, or an empty array if none exists. */ public Integer[] getChildSequence() { int size = childSequence.size(); Integer[] sequence = new Integer[size]; for(int i=0; i 1 An NCName. switch (startChar) { case -1: //Only an NCName. try { elementID = new NCName(schemeData); } catch (IllegalArgumentException e) { throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData); } return new ElementPointerPart(elementID); case 0: //No NCName. break; default: //An NCName. try { elementID = new NCName(schemeData.substring(0, startChar)); } catch (IllegalArgumentException e) { throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData, 0, startChar); } break; } //Find remaining child sequence. childSequence = new ArrayList(); endChar = schemeData.indexOf("/", startChar+1); // -1 Only single child sequence element. > 0 A childSequence. if (endChar < 0) { //Only single child sequence element. childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, schemeData.length())); } else { //Multiple child sequence elements. while(true) { if (endChar < 0) {//Last integer. childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, schemeData.length())); break; } else { //Inner sequence integer. childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, endChar)); startChar = endChar; endChar = schemeData.indexOf("/", startChar+1); } } } if (elementID == null) { //Only a childSequence return new ElementPointerPart(childSequence); } else { //Both NCName and childSequence return new ElementPointerPart(elementID, childSequence); } } /** * Parses a String for an integer between two indices and returns this as an Integer. * * @param string a String to parse. * @param start an int char index to the start of the Integer. * @param end an int char index to the end of the Integer. * @return an Integer resulting from parsing the given String in the index range. * @throws IllegalArgumentException if the given char range does not contain an integer. */ private static Integer parseIntegerFromChildSequence(String string, int start, int end) throws InvalidXPointerException{ if (start < end) { //Make sure sub string is not of zero length. try { //Make sure the integer is valid. return new Integer(string.substring(start, end)); } catch (NumberFormatException e) { throw new InvalidXPointerException("The child sequence part contained a invalid integer.", string, start, end); } } else { throw new InvalidXPointerException("The child sequence part contained a empty item at " + String.valueOf(start), string, start, end); } } } ./src/org/apache/woden/about-this-package0000664000175000017500000000046611767656530017521 0ustar brianbrianInterfaces for the main functional components of the Woden API, such as factories, readers, writers, extension registry. Initially these may be WSDL 2.0 specific in places, but eventually this package should probably be WSDL-version independent - i.e. the framework API that hides version specific interfaces../src/org/apache/axis2/0000775000175000017500000000000011767656530014032 5ustar brianbrian./src/org/apache/axis2/transport/0000775000175000017500000000000011767656530016066 5ustar brianbrian./src/org/apache/axis2/transport/TransportSender.java0000664000175000017500000000340611767656530022071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.Handler; /** * TransportSender sends the SOAP Message to other SOAP nodes. A TransportSender is responsible for * writing the SOAP Message to the wire. Out flow must be terminated end with a TransportSender */ public interface TransportSender extends Handler { /** * Clean up * * @param msgContext * @throws org.apache.axis2.AxisFault */ public void cleanup(MessageContext msgContext) throws AxisFault; /** * Initialize * * @param confContext * @param transportOut * @throws org.apache.axis2.AxisFault */ public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault; public void stop(); } ./src/org/apache/axis2/transport/RequestResponseTransport.java0000664000175000017500000001205511767656530024020 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; /** * This interface represents a control object for a Request/Response transport. * The normal flow of Axis2 is rooted at the transport -- this does not * allow for an acknowledgement to be transmitted before processing has * completed, nor does it allow for processing to be paused and resumed * on a separate thread without having a response be sent back. This interface * enables both of those scenarios by allowing the transport to expose * controls to the rest of the engine via a callback. */ public interface RequestResponseTransport { /*This is the name of the property that is to be stored on the MessageContext*/ public static final String TRANSPORT_CONTROL = "RequestResponseTransportControl"; /** * If this property is set to true in a message transport will call the awaitResponse method * of the RequestResponseTransport instead of returning. The value should be a Boolean object. */ public static final String HOLD_RESPONSE = "HoldResponse"; /** * Notify the transport that a message should be acknowledged at this time. * * @param msgContext * @throws AxisFault */ public void acknowledgeMessage(MessageContext msgContext) throws AxisFault; /** * Pause execution and wait for a response message to be ready. This will * typically be called by the transport after a message has been paused and * will cause the transport to block until a response message is ready to be * returned. This is required to enable RM for in-out MEPs over a * request/response transport; without it the message would be paused and the * transport would simply ack the request. * * @throws InterruptedException */ public void awaitResponse() throws InterruptedException, AxisFault; /** * Signal that a response has be created and is ready for transmission. This * should release anyone who is blocked on a awaitResponse(). */ public void signalResponseReady(); /** * This will tell the transport to end a current wait by raising the given fault. * @param fault The fault to be raised. */ public void signalFaultReady(AxisFault fault); /** * This gives the current status of an RequestResponseTransport object. * * @return */ public RequestResponseTransportStatus getStatus(); /** * This will indicate whether or not the response has already been written */ public boolean isResponseWritten(); /** * This is used to set the response written flag on the RequestResponseTransport * instance */ public void setResponseWritten(boolean responseWritten); /** * Used to give the current status of the RequestResponseTransport object. */ public class RequestResponseTransportStatus { /** * Transport is in its initial stage. */ public static RequestResponseTransportStatus INITIAL = new RequestResponseTransportStatus(1); /** * awaitResponse has been called. */ public static RequestResponseTransportStatus WAITING = new RequestResponseTransportStatus(2); /** * acknowledgeMessage has been called. */ public static RequestResponseTransportStatus ACKED = new RequestResponseTransportStatus (3); /** * 'signalResponseReady' has been called. */ public static RequestResponseTransportStatus SIGNALLED = new RequestResponseTransportStatus(4); private int value; private RequestResponseTransportStatus(int value) { this.value = value; } public int hashCode() { return value; } public boolean equals(Object obj) { if (!(obj instanceof RequestResponseTransportStatus)) { return false; } final RequestResponseTransportStatus instance = (RequestResponseTransportStatus) obj; return (value == instance.value); } public String toString() { return Integer.toString(value); } } } ./src/org/apache/axis2/transport/http/0000775000175000017500000000000011767656530017045 5ustar brianbrian./src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java0000664000175000017500000001774511767656530024436 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.http.util.URLTemplatingUtil; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; /** * Formates the request message as application/xml */ public class ApplicationXMLFormatter implements MessageFormatter { private static final Log log = LogFactory.getLog(ApplicationXMLFormatter.class); public byte[] getBytes(MessageContext messageContext, OMOutputFormat format) throws AxisFault { return getBytes(messageContext, format, false); } /** * Get the bytes for this message * @param messageContext * @param format * @param preserve (indicates if the OM should be preserved or consumed) * @return * @throws AxisFault */ public byte[] getBytes(MessageContext messageContext, OMOutputFormat format, boolean preserve) throws AxisFault { if (log.isDebugEnabled()) { log.debug("start getBytes()"); log.debug(" fault flow=" + (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW)); } try { OMElement omElement; // Find the correct element to serialize. Normally it is the first element // in the body. But if this is a fault, use the detail entry element or the // fault reason. if (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) { SOAPFault fault = messageContext.getEnvelope().getBody().getFault(); SOAPFaultDetail soapFaultDetail = fault.getDetail(); omElement = soapFaultDetail.getFirstElement(); if (omElement == null) { omElement = fault.getReason(); } } else { // Normal case: The xml payload is the first element in the body. omElement = messageContext.getEnvelope().getBody().getFirstElement(); } ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); if (omElement != null) { try { if (preserve) { omElement.serialize(bytesOut, format); } else { omElement.serializeAndConsume(bytesOut, format); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } return bytesOut.toByteArray(); } return new byte[0]; } finally { if (log.isDebugEnabled()) { log.debug("end getBytes()"); } } } public void writeTo(MessageContext messageContext, OMOutputFormat format, OutputStream outputStream, boolean preserve) throws AxisFault { if (log.isDebugEnabled()) { log.debug("start writeTo()"); } try { OMElement omElement = null; if (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) { SOAPFault fault = messageContext.getEnvelope().getBody().getFault(); SOAPFaultDetail soapFaultDetail = fault.getDetail(); if (soapFaultDetail != null) { omElement = soapFaultDetail.getFirstElement(); } if (omElement == null) { omElement = fault.getReason(); } } else { omElement = messageContext.getEnvelope().getBody().getFirstElement(); } if (omElement != null) { try { if (preserve) { omElement.serialize(outputStream, format); } else { omElement.serializeAndConsume(outputStream, format); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } try { outputStream.flush(); } catch (IOException e) { throw AxisFault.makeFault(e); } } finally { if (log.isDebugEnabled()) { log.debug("end writeTo()"); } } } public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction) { String encoding = format.getCharSetEncoding(); String contentType; contentType = (String) messageContext.getProperty(Constants.Configuration.CONTENT_TYPE); if (log.isDebugEnabled()) { log.debug("contentType set from messageContext =" + contentType); log.debug("(NOTE) contentType from format is=" + format.getContentType()); } if (contentType == null) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } else if (isSOAPContentType(contentType)) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; if (log.isDebugEnabled()) { log.debug("contentType is set incorrectly for Application XML."); log.debug("It is changed to " + contentType); } } if (encoding != null) { contentType += "; charset=" + encoding; } if (log.isDebugEnabled()) { log.debug("contentType returned =" + contentType); } return contentType; } public URL getTargetAddress(MessageContext messageContext, OMOutputFormat format, URL targetURL) throws AxisFault { // Check whether there is a template in the URL, if so we have to replace then with data // values and create a new target URL. targetURL = URLTemplatingUtil.getTemplatedURL(targetURL, messageContext, false); return targetURL; } public String formatSOAPAction(MessageContext messageContext, OMOutputFormat format, String soapAction) { return soapAction; } private boolean isSOAPContentType(String contentType) { if (JavaUtils.indexOfIgnoreCase(contentType, SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { return true; } // search for "type=text/xml" else if (JavaUtils.indexOfIgnoreCase(contentType, SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { return true; } return false; } } ./src/org/apache/axis2/transport/http/AbstractHTTPSender.java0000664000175000017500000006500111767656530023316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.NTCredentials; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthPolicy; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.protocol.Protocol; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.zip.GZIPInputStream; public abstract class AbstractHTTPSender { protected static final String ANONYMOUS = "anonymous"; protected static final String PROXY_HOST_NAME = "proxy_host"; protected static final String PROXY_PORT = "proxy_port"; protected boolean chunked = false; protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11; private static final Log log = LogFactory.getLog(AbstractHTTPSender.class); protected static final String PROTOCOL_HTTP = "http"; protected static final String PROTOCOL_HTTPS = "https"; /** * proxydiscription */ protected TransportOutDescription proxyOutSetting = null; protected OMOutputFormat format = new OMOutputFormat(); /** * isAllowedRetry will be using to check where the * retry should be allowed or not. */ protected boolean isAllowedRetry = false; public void setChunked(boolean chunked) { this.chunked = chunked; } public void setHttpVersion(String version) throws AxisFault { if (version != null) { if (HTTPConstants.HEADER_PROTOCOL_11.equals(version)) { this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11; } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version)) { this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10; // chunked is not possible with HTTP/1.0 this.chunked = false; } else { throw new AxisFault( "Parameter " + HTTPConstants.PROTOCOL_VERSION + " Can have values only HTTP/1.0 or HTTP/1.1"); } } } /** * Collect the HTTP header information and set them in the message context * * @param method HttpMethodBase from which to get information * @param msgContext the MessageContext in which to place the information... OR NOT! * @throws AxisFault if problems occur */ protected void obtainHTTPHeaderInformation(HttpMethodBase method, MessageContext msgContext) throws AxisFault { // Set RESPONSE properties onto the REQUEST message context. They will need to be copied off the request context onto // the response context elsewhere, for example in the OutInOperationClient. Map transportHeaders = new CommonsTransportHeaders(method.getResponseHeaders()); msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders); msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, new Integer(method.getStatusCode())); Header header = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE); if (header != null) { HeaderElement[] headers = header.getElements(); MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE); Object contentType = header.getValue(); Object charSetEnc = null; for (int i = 0; i < headers.length; i++) { NameValuePair charsetEnc = headers[i].getParameterByName( HTTPConstants.CHAR_SET_ENCODING); if (charsetEnc != null) { charSetEnc = charsetEnc.getValue(); } } if (inMessageContext != null) { inMessageContext .setProperty(Constants.Configuration.CONTENT_TYPE, contentType); inMessageContext .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); } else { // Transport details will be stored in a HashMap so that anybody interested can // retrieve them HashMap transportInfoMap = new HashMap(); transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType); transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); //the HashMap is stored in the outgoing message. msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap); } } String sessionCookie = null; // Process old style headers first Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE); String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID); for (int i = 0; i < cookieHeaders.length; i++) { HeaderElement[] elements = cookieHeaders[i].getElements(); for (int e = 0; e < elements.length; e++) { HeaderElement element = elements[e]; if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { sessionCookie = processCookieHeader(element); } if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) { sessionCookie = processCookieHeader(element); } } } // Overwrite old style cookies with new style ones if present cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2); for (int i = 0; i < cookieHeaders.length; i++) { HeaderElement[] elements = cookieHeaders[i].getElements(); for (int e = 0; e < elements.length; e++) { HeaderElement element = elements[e]; if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { sessionCookie = processCookieHeader(element); } if(customCoookiId!=null&&customCoookiId.equalsIgnoreCase(element.getName())){ sessionCookie = processCookieHeader(element); } } } if (sessionCookie != null) { msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie); } } private String processCookieHeader(HeaderElement element) { String cookie = element.getName() + "=" + element.getValue(); NameValuePair[] parameters = element.getParameters(); for (int j = 0; parameters != null && j < parameters.length; j++) { NameValuePair parameter = parameters[j]; cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue(); } return cookie; } protected void processResponse(HttpMethodBase httpMethod, MessageContext msgContext) throws IOException { obtainHTTPHeaderInformation(httpMethod, msgContext); InputStream in = httpMethod.getResponseBodyAsStream(); if (in == null) { throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream")); } Header contentEncoding = httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING); if (contentEncoding != null) { if (contentEncoding.getValue(). equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) { in = new GZIPInputStream(in); } else { throw new AxisFault("HTTP :" + "unsupported content-encoding of '" + contentEncoding.getValue() + "' found"); } } OperationContext opContext = msgContext.getOperationContext(); if (opContext != null) { opContext.setProperty(MessageContext.TRANSPORT_IN, in); } } public abstract void send(MessageContext msgContext, URL url, String soapActionString) throws IOException; /** * getting host configuration to support standard http/s, proxy and NTLM support * * @param client active HttpClient * @param msgCtx active MessageContext * @param targetURL the target URL * @return a HostConfiguration set up with proxy information * @throws AxisFault if problems occur */ protected HostConfiguration getHostConfiguration(HttpClient client, MessageContext msgCtx, URL targetURL)throws AxisFault { boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx); int port = targetURL.getPort(); String protocol = targetURL.getProtocol(); if (port == -1) { if (PROTOCOL_HTTP.equals(protocol)) { port = 80; } else if (PROTOCOL_HTTPS.equals(protocol)) { port = 443; } } // to see the host is a proxy and in the proxy list - available in axis2.xml HostConfiguration config = new HostConfiguration(); // one might need to set his own socket factory. Let's allow that case as well. Protocol protocolHandler = (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER); // setting the real host configuration // I assume the 90% case, or even 99% case will be no protocol handler case. if (protocolHandler == null) { config.setHost(targetURL.getHost(), port, targetURL.getProtocol()); } else { config.setHost(targetURL.getHost(), port, protocolHandler); } if (isAuthenticationEnabled) { // Basic, Digest, NTLM and custom authentications. this.setAuthenticationInfo(client, msgCtx, config); } // proxy configuration if (ProxyConfiguration.isProxyEnabled(msgCtx,targetURL)) { log.debug("ProxyConfiguration"); ProxyConfiguration proxyConfiguration = new ProxyConfiguration(); proxyConfiguration.configure(msgCtx,client,config); } return config; } protected boolean isAuthenticationEnabled(MessageContext msgCtx) { return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null); } /* This will handle server Authentication, It could be either NTLM, Digest or Basic Authentication. Apart from that user can change the priory or add a custom authentication scheme. */ protected void setAuthenticationInfo(HttpClient agent, MessageContext msgCtx, HostConfiguration config) throws AxisFault { HttpTransportProperties.Authenticator authenticator; Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE); if (obj != null) { if (obj instanceof HttpTransportProperties.Authenticator) { authenticator = (HttpTransportProperties.Authenticator) obj; String username = authenticator.getUsername(); String password = authenticator.getPassword(); String host = authenticator.getHost(); String domain = authenticator.getDomain(); int port = authenticator.getPort(); String realm = authenticator.getRealm(); /* If retrying is available set it first */ isAllowedRetry = authenticator.isAllowedRetry(); Credentials creds; agent.getParams() .setAuthenticationPreemptive(authenticator.getPreemptiveAuthentication()); if (host != null) { if (domain != null) { /*Credentials for NTLM Authentication*/ creds = new NTCredentials(username, password, host, domain); } else { /*Credentials for Digest and Basic Authentication*/ creds = new UsernamePasswordCredentials(username, password); } agent.getState().setCredentials(new AuthScope(host, port, realm), creds); } else { if (domain != null) { /*Credentials for NTLM Authentication when host is ANY_HOST*/ creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain); agent.getState().setCredentials( new AuthScope(AuthScope.ANY_HOST, port, realm), creds); } else { /*Credentials only for Digest and Basic Authentication*/ creds = new UsernamePasswordCredentials(username, password); agent.getState().setCredentials(new AuthScope(AuthScope.ANY), creds); } } /* Customizing the priority Order */ List schemes = authenticator.getAuthSchemes(); if (schemes != null && schemes.size() > 0) { List authPrefs = new ArrayList(3); for (int i = 0; i < schemes.size(); i++) { if (schemes.get(i) instanceof AuthPolicy) { authPrefs.add(schemes.get(i)); continue; } String scheme = (String) schemes.get(i); if (HttpTransportProperties.Authenticator.BASIC.equals(scheme)) { authPrefs.add(AuthPolicy.BASIC); } else if (HttpTransportProperties.Authenticator.NTLM.equals(scheme)) { authPrefs.add(AuthPolicy.NTLM); } else if (HttpTransportProperties.Authenticator.DIGEST.equals(scheme)) { authPrefs.add(AuthPolicy.DIGEST); } } agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs); } } else { throw new AxisFault("HttpTransportProperties.Authenticator class cast exception"); } } } /** * Method used to copy all the common properties * * @param msgContext - The messageContext of the request message * @param url - The target URL * @param httpMethod - The http method used to send the request * @param httpClient - The httpclient used to send the request * @param soapActionString - The soap action atring of the request message * @return MessageFormatter - The messageFormatter for the relavent request message * @throws AxisFault - Thrown in case an exception occurs */ protected MessageFormatter populateCommonProperties(MessageContext msgContext, URL url, HttpMethodBase httpMethod, HttpClient httpClient, String soapActionString) throws AxisFault { if (isAuthenticationEnabled(msgContext)) { httpMethod.setDoAuthentication(true); } MessageFormatter messageFormatter = TransportUtils.getMessageFormatter( msgContext); url = messageFormatter.getTargetAddress(msgContext, format, url); httpMethod.setPath(url.getPath()); httpMethod.setQueryString(url.getQuery()); httpMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, messageFormatter.getContentType(msgContext, format, soapActionString)); httpMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost()); if (msgContext.getOptions() != null && msgContext.getOptions().isManageSession()) { // setting the cookie in the out path Object cookieString = msgContext.getProperty(HTTPConstants.COOKIE_STRING); if (cookieString != null) { StringBuffer buffer = new StringBuffer(); buffer.append(cookieString); httpMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE, buffer.toString()); } } if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) { httpClient.getParams().setVersion(HttpVersion.HTTP_1_0); } return messageFormatter; } /** * This is used to get the dynamically set time out values from the * message context. If the values are not available or invalid then * the default values or the values set by the configuration will be used * * @param msgContext the active MessageContext * @param httpClient */ protected void initializeTimeouts(MessageContext msgContext, HttpClient httpClient) { // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the // override the static config Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT); Integer tempConnTimeoutProperty = (Integer) msgContext .getProperty(HTTPConstants.CONNECTION_TIMEOUT); long timeout = msgContext.getOptions().getTimeOutInMilliSeconds(); if (tempConnTimeoutProperty != null) { int connectionTimeout = tempConnTimeoutProperty.intValue(); // timeout for initial connection httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout); } else { // set timeout in client if (timeout > 0) { httpClient.getHttpConnectionManager().getParams().setConnectionTimeout((int) timeout); } } if (tempSoTimeoutProperty != null) { int soTimeout = tempSoTimeoutProperty.intValue(); // SO_TIMEOUT -- timeout for blocking reads httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout); httpClient.getParams().setSoTimeout(soTimeout); } else { // set timeout in client if (timeout > 0) { httpClient.getHttpConnectionManager().getParams().setSoTimeout((int) timeout); httpClient.getParams().setSoTimeout((int) timeout); } } } public void setFormat(OMOutputFormat format) { this.format = format; } protected HttpClient getHttpClient(MessageContext msgContext) { HttpClient httpClient; Object reuse = msgContext.getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT); if (reuse == null) { reuse = msgContext.getConfigurationContext().getProperty(HTTPConstants.REUSE_HTTP_CLIENT); } if (reuse != null && JavaUtils.isTrueExplicitly(reuse)) { httpClient = (HttpClient) msgContext.getOptions().getProperty(HTTPConstants.CACHED_HTTP_CLIENT); if (httpClient == null) { httpClient = (HttpClient) msgContext.getConfigurationContext() .getProperty(HTTPConstants.CACHED_HTTP_CLIENT); } if (httpClient != null) return httpClient; MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); httpClient = new HttpClient(connectionManager); msgContext.getConfigurationContext() .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); } else { HttpConnectionManager connManager = (HttpConnectionManager) msgContext.getProperty( HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER); if (connManager == null) { connManager = (HttpConnectionManager) msgContext.getProperty( HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER); } if(connManager != null){ httpClient = new HttpClient(connManager); } else { //Multi threaded http connection manager has set as the default connManager = new MultiThreadedHttpConnectionManager(); httpClient = new HttpClient(connManager); } } // Get the timeout values set in the runtime initializeTimeouts(msgContext, httpClient); return httpClient; } protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url, HttpMethod method) throws IOException { HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url); msgContext.setProperty(HTTPConstants.HTTP_METHOD, method); // set the custom headers, if available addCustomHeaders(method, msgContext); // add compression headers if needed if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) { method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING, HTTPConstants.COMPRESSION_GZIP); } if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) { method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING, HTTPConstants.COMPRESSION_GZIP); } String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY); if (cookiePolicy != null) { method.getParams().setCookiePolicy(cookiePolicy); } httpClient.executeMethod(config, method); } public void addCustomHeaders(HttpMethod method, MessageContext msgContext) { boolean isCustomUserAgentSet = false; // set the custom headers, if available Object httpHeadersObj = msgContext.getProperty(HTTPConstants.HTTP_HEADERS); if (httpHeadersObj != null) { if (httpHeadersObj instanceof ArrayList) { ArrayList httpHeaders = (ArrayList) httpHeadersObj; Header header; for (int i = 0; i < httpHeaders.size(); i++) { header = (Header) httpHeaders.get(i); if (HTTPConstants.HEADER_USER_AGENT.equals(header.getName())) { isCustomUserAgentSet = true; } method.addRequestHeader(header); } } if (httpHeadersObj instanceof Map) { Map httpHeaders = (Map) httpHeadersObj; for (Iterator iterator = httpHeaders.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); if (HTTPConstants.HEADER_USER_AGENT.equals(key)) { isCustomUserAgentSet = true; } method.addRequestHeader(key, value); } } } if (!isCustomUserAgentSet) { String userAgentString = getUserAgent(msgContext); method.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString); } } private String getUserAgent(MessageContext messageContext) { String userAgentString = "Axis2"; boolean locked = false; if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) { OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement(); userAgentString = userAgentElement.getText().trim(); OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked")); if (lockedAttribute != null) { if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) { locked = true; } } } // Runtime overing part if (!locked) { if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) { userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT); } } return userAgentString; } } ./src/org/apache/axis2/transport/http/HTTPWorker.java0000664000175000017500000004215111767656530021664 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.Handler.InvocationResponse; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.server.AxisHttpRequest; import org.apache.axis2.transport.http.server.AxisHttpResponse; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.axis2.transport.http.server.Worker; import org.apache.axis2.transport.http.util.RESTUtil; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpStatus; import org.apache.http.MethodNotSupportedException; import org.apache.http.message.BasicHeader; import org.apache.http.protocol.HTTP; import org.apache.http.util.EncodingUtils; import org.apache.ws.commons.schema.XmlSchema; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class HTTPWorker implements Worker { public HTTPWorker() { } public void service( final AxisHttpRequest request, final AxisHttpResponse response, final MessageContext msgContext) throws HttpException, IOException { ConfigurationContext configurationContext = msgContext.getConfigurationContext(); final String servicePath = configurationContext.getServiceContextPath(); final String contextPath = (servicePath.startsWith("/") ? servicePath : "/" + servicePath) + "/"; String uri = request.getRequestURI(); String method = request.getMethod(); String soapAction = HttpUtils.getSoapAction(request); InvocationResponse pi; if (method.equals(HTTPConstants.HEADER_GET)) { if (uri.equals("/favicon.ico")) { response.setStatus(HttpStatus.SC_MOVED_PERMANENTLY); response.addHeader(new BasicHeader("Location", "http://ws.apache.org/favicon.ico")); return; } if (!uri.startsWith(contextPath)) { response.setStatus(HttpStatus.SC_MOVED_PERMANENTLY); response.addHeader(new BasicHeader("Location", contextPath)); return; } if (uri.endsWith("axis2/services/")) { String s = HTTPTransportReceiver.getServicesHTML(configurationContext); response.setStatus(HttpStatus.SC_OK); response.setContentType("text/html"); OutputStream out = response.getOutputStream(); out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1)); return; } if (uri.indexOf("?") < 0) { if (!uri.endsWith(contextPath)) { if (uri.endsWith(".xsd") || uri.endsWith(".wsdl")) { HashMap services = configurationContext.getAxisConfiguration().getServices(); String file = uri.substring(uri.lastIndexOf("/") + 1, uri.length()); if ((services != null) && !services.isEmpty()) { Iterator i = services.values().iterator(); while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = service.getClassLoader(). getResourceAsStream("META-INF/" + file); if (stream != null) { OutputStream out = response.getOutputStream(); response.setContentType("text/xml"); ListingAgent.copy(stream, out); out.flush(); out.close(); return; } } } } else { String serviceName = uri.replaceAll(contextPath, ""); if (serviceName.indexOf("/") < 0) { String s = HTTPTransportReceiver .printServiceHTML(serviceName, configurationContext); response.setStatus(HttpStatus.SC_OK); response.setContentType("text/html"); OutputStream out = response.getOutputStream(); out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1)); return; } } } } if (uri.endsWith("?wsdl2")) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 6); HashMap services = configurationContext.getAxisConfiguration().getServices(); AxisService service = (AxisService) services.get(serviceName); if (service != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); service.printWSDL2(response.getOutputStream(), getHost(request)); return; } } if (uri.endsWith("?wsdl")) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 5); HashMap services = configurationContext.getAxisConfiguration().getServices(); AxisService service = (AxisService) services.get(serviceName); if (service != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); service.printWSDL(response.getOutputStream(), getHost(request)); return; } } if (uri.endsWith("?xsd")) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 4); HashMap services = configurationContext.getAxisConfiguration().getServices(); AxisService service = (AxisService) services.get(serviceName); if (service != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); service.printSchema(response.getOutputStream()); return; } } //cater for named xsds - check for the xsd name if (uri.indexOf("?xsd=") > 0) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("?xsd=")); String schemaName = uri.substring(uri.lastIndexOf("=") + 1); HashMap services = configurationContext.getAxisConfiguration().getServices(); AxisService service = (AxisService) services.get(serviceName); if (service != null) { //run the population logic just to be sure service.populateSchemaMappings(); //write out the correct schema Map schemaTable = service.getSchemaMappingTable(); XmlSchema schema = (XmlSchema) schemaTable.get(schemaName); if (schema == null) { int dotIndex = schemaName.indexOf('.'); if (dotIndex > 0) { String schemaKey = schemaName.substring(0,dotIndex); schema = (XmlSchema) schemaTable.get(schemaKey); } } //schema found - write it to the stream if (schema != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); schema.write(response.getOutputStream()); return; } else { InputStream instream = service.getClassLoader() .getResourceAsStream(DeploymentConstants.META_INF + "/" + schemaName); if (instream != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); OutputStream outstream = response.getOutputStream(); boolean checkLength = true; int length = Integer.MAX_VALUE; int nextValue = instream.read(); if (checkLength) length--; while (-1 != nextValue && length >= 0) { outstream.write(nextValue); nextValue = instream.read(); if (checkLength) length--; } outstream.flush(); return; } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int ret = service.printXSD(baos, schemaName); if(ret>0) { baos.flush(); instream = new ByteArrayInputStream(baos.toByteArray()); response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); OutputStream outstream = response.getOutputStream(); boolean checkLength = true; int length = Integer.MAX_VALUE; int nextValue = instream.read(); if (checkLength) length--; while (-1 != nextValue && length >= 0) { outstream.write(nextValue); nextValue = instream.read(); if (checkLength) length--; } outstream.flush(); return; } // no schema available by that name - send 404 response.sendError(HttpStatus.SC_NOT_FOUND, "Schema Not Found!"); return; } } } } if (uri.indexOf("?wsdl2=") > 0) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("?wsdl2=")); if (processInternalWSDL(uri, configurationContext, serviceName, response)) return; } if (uri.indexOf("?wsdl=") > 0) { String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("?wsdl=")); if (processInternalWSDL(uri, configurationContext, serviceName, response)) return; } String contentType = null; Header[] headers = request.getHeaders(HTTPConstants.HEADER_CONTENT_TYPE); if (headers != null && headers.length > 0) { contentType = headers[0].getValue(); int index = contentType.indexOf(';'); if (index > 0) { contentType = contentType.substring(0, index); } } // deal with GET request pi = RESTUtil.processURLRequest( msgContext, response.getOutputStream(), contentType); } else if (method.equals(HTTPConstants.HEADER_POST)) { // deal with POST request String contentType = request.getContentType(); if (HTTPTransportUtils.isRESTRequest(contentType)) { pi = RESTUtil.processXMLRequest( msgContext, request.getInputStream(), response.getOutputStream(), contentType); } else { String ip = (String)msgContext.getProperty(MessageContext.TRANSPORT_ADDR); if (ip != null){ uri = ip + uri; } pi = HTTPTransportUtils.processHTTPPostRequest( msgContext, request.getInputStream(), response.getOutputStream(), contentType, soapAction, uri); } } else if (method.equals(HTTPConstants.HEADER_PUT)) { String contentType = request.getContentType(); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType); pi = RESTUtil.processXMLRequest( msgContext, request.getInputStream(), response.getOutputStream(), contentType); } else if (method.equals(HTTPConstants.HEADER_DELETE)) { pi = RESTUtil.processURLRequest( msgContext, response.getOutputStream(), null); } else { throw new MethodNotSupportedException(method + " method not supported"); } Boolean holdResponse = (Boolean) msgContext.getProperty(RequestResponseTransport.HOLD_RESPONSE); if (pi.equals(InvocationResponse.SUSPEND) || (holdResponse != null && Boolean.TRUE.equals(holdResponse))) { try { ((RequestResponseTransport) msgContext .getProperty(RequestResponseTransport.TRANSPORT_CONTROL)).awaitResponse(); } catch (InterruptedException e) { throw new IOException("We were interrupted, so this may not function correctly:" + e.getMessage()); } } // Finalize response RequestResponseTransport requestResponseTransportControl = (RequestResponseTransport) msgContext. getProperty(RequestResponseTransport.TRANSPORT_CONTROL); if (TransportUtils.isResponseWritten(msgContext) || ((requestResponseTransportControl != null) && requestResponseTransportControl.getStatus().equals( RequestResponseTransport.RequestResponseTransportStatus.SIGNALLED))) { // The response is written or signalled. The current status is used (probably SC_OK). } else { // The response may be ack'd, mark the status as accepted. response.setStatus(HttpStatus.SC_ACCEPTED); } } private boolean processInternalWSDL(String uri, ConfigurationContext configurationContext, String serviceName, AxisHttpResponse response) throws IOException { String wsdlName = uri.substring(uri.lastIndexOf("=") + 1); HashMap services = configurationContext.getAxisConfiguration().getServices(); AxisService service = (AxisService) services.get(serviceName); if (service != null) { response.setStatus(HttpStatus.SC_OK); response.setContentType("text/xml"); service.printUserWSDL(response.getOutputStream(), wsdlName); response.getOutputStream().flush(); return true; } else { // no schema available by that name - send 404 response.sendError(HttpStatus.SC_NOT_FOUND, "Schema Not Found!"); return true; } } public String getHost(AxisHttpRequest request) throws java.net.SocketException { String host = null; Header hostHeader = request.getFirstHeader("host"); if (hostHeader != null) { String parts[] = hostHeader.getValue().split("[:]"); if (parts.length > 0) { host = parts[0].trim(); } } return host; } } ./src/org/apache/axis2/transport/http/HTTPConstants.java0000664000175000017500000003467311767656530022401 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import java.io.UnsupportedEncodingException; /** * HTTP protocol and message context constants. */ public class HTTPConstants { public static final String HTTP_CONTENT_TYPE = "HTTP_CONTENT_TYPE"; public static final String PROTOCOL_VERSION = "PROTOCOL"; public static final String MEDIA_TYPE_X_WWW_FORM = "application/x-www-form-urlencoded"; public static final String MEDIA_TYPE_TEXT_XML = "text/xml"; public static final String MEDIA_TYPE_MULTIPART_RELATED = "multipart/related"; public static final String MEDIA_TYPE_MULTIPART_FORM_DATA = "multipart/form-data"; public static final String MEDIA_TYPE_APPLICATION_XML = "application/xml"; public static final String MEDIA_TYPE_APPLICATION_SOAP_XML = "application/soap+xml"; public static final String MEDIA_TYPE_APPLICATION_ECHO_XML = "application/echo+xml"; /** * Field REQUEST_URI */ public static final String REQUEST_URI = "REQUEST_URI"; /** * Field RESPONSE_CODE */ public static final String RESPONSE_CODE = "RESPONSE_CODE"; /** * Field RESPONSE_WORD */ public static final String RESPONSE_WORD = "RESPONSE_WORD"; /** * Field RESPONSE_ACK_CODE_VAL */ public static final String RESPONSE_ACK_CODE_VAL = "202"; /** * Field SOCKET */ public static final String SOCKET = "SOCKET"; /** * Field RESPONSE_HEADERS */ public static final String RESPONSE_HEADERS = "HTTP-Response-Headers"; /** * Field REQUEST_HEADERS */ public static final String REQUEST_HEADERS = "HTTP-Request-Headers"; /** * Field PLUGIN_WRITER */ public static final String PLUGIN_WRITER = "transport.http.plugin.writer"; /** * Field PLUGIN_SERVICE_NAME */ public static final String PLUGIN_SERVICE_NAME = "transport.http.plugin.serviceName"; /** * AXIS servlet plugin parameter names. */ public static final String PLUGIN_NAME = "transport.http.plugin.pluginName"; /** * Field PLUGIN_LOG */ public static final String PLUGIN_LOG = "transport.http.plugin.log"; /** * Field PLUGIN_IS_DEVELOPMENT */ public static final String PLUGIN_IS_DEVELOPMENT = "transport.http.plugin.isDevelopment"; /** * Field PLUGIN_EXCEPTION_LOG */ public static final String PLUGIN_EXCEPTION_LOG = "transport.http.plugin.exceptionLog"; /** * Field PLUGIN_ENGINE */ public static final String PLUGIN_ENGINE = "transport.http.plugin.engine"; /** * Field PLUGIN_ENABLE_LIST */ public static final String PLUGIN_ENABLE_LIST = "transport.http.plugin.enableList"; /** * Field OK[] */ public static final char OK[] = ("200 OK").toCharArray(); /** * Field NOCONTENT[] */ public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes(); /** * Field MC_HTTP_STATUS_MESSAGE */ public static String MC_HTTP_STATUS_MESSAGE = "transport.http.statusMessage"; /** * Field MC_HTTP_STATUS_CODE */ public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode"; /** * Field MC_HTTP_SERVLETRESPONSE */ public static String MC_HTTP_SERVLETRESPONSE = "transport.http.servletResponse"; /** * Field MC_HTTP_SERVLETREQUEST */ public static String MC_HTTP_SERVLETREQUEST = "transport.http.servletRequest"; /** * Field MC_HTTP_SERVLETPATHINFO */ public static String MC_HTTP_SERVLETPATHINFO = "transport.http.servletPathInfo"; /** * Field MC_HTTP_SERVLETLOCATION */ public static String MC_HTTP_SERVLETLOCATION = "transport.http.servletLocation"; /** * Field MC_HTTP_SERVLET */ public static String MC_HTTP_SERVLET = "transport.http.servlet"; /** * Field MC_HTTP_SERVLETCONTEXT */ public static String MC_HTTP_SERVLETCONTEXT = "transport.http.servletContext"; /** * transport.http.servletConfig */ public static String HTTP_SERVLETCONFIG = "transport.http.servletConfig"; /** * Field HEADER_USER_AGENT */ public static final String HEADER_USER_AGENT = "User-Agent"; /** * Field HEADER_TRANSFER_ENCODING_CHUNKED */ public static final String HEADER_TRANSFER_ENCODING_CHUNKED = "chunked".intern(); /* http 1.1 */ /** * Field HEADER_TRANSFER_ENCODING */ public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding".intern(); /** * Field HEADER_SOAP_ACTION */ public static final String HEADER_SOAP_ACTION = "SOAPAction"; /** * Field HEADER_SET_COOKIE2 */ public static final String HEADER_SET_COOKIE2 = "Set-Cookie2"; /** * Field HEADER_SET_COOKIE */ public static final String HEADER_SET_COOKIE = "Set-Cookie"; /** * Field HEADER_PROXY_AUTHORIZATION */ public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization"; /** * Field HEADER_PROTOCOL_V11 */ public static final String HEADER_PROTOCOL_V11 = "1.1".intern(); /** * Field HEADER_PROTOCOL_V10 */ public static final String HEADER_PROTOCOL_V10 = "1.0".intern(); /** * Field HEADER_PROTOCOL_11 */ public static final String HEADER_PROTOCOL_11 = "HTTP/1.1"; /** * Field HEADER_PROTOCOL_10 */ public static final String HEADER_PROTOCOL_10 = "HTTP/1.0"; /** * Field HEADER_PRAGMA */ public static final String HEADER_PRAGMA = "Pragma"; /** * Field HEADER_POST */ public static final String HEADER_POST = "POST"; /** * Field HEADER_PUT */ public static final String HEADER_PUT = "PUT"; /** * Field HEADER_LOCATION */ public static final String HEADER_LOCATION = "Location"; /** * Field HEADER_HOST */ public static final String HEADER_HOST = "Host"; /** * Field HEADER_GET */ public static final String HEADER_GET = "GET"; /** * Field HEADER_DELETE */ public static final String HEADER_DELETE = "DELETE"; /** * Field HEADER_EXPECT_100_Continue */ public static final String HEADER_EXPECT_100_Continue = "100-continue"; /** * Field HEADER_EXPECT */ public static final String HEADER_EXPECT = "Expect"; /** * Field HEADER_DEFAULT_CHAR_ENCODING */ public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1"; /** * Field HEADER_COOKIE2 */ public static final String HEADER_COOKIE2 = "Cookie2"; /** * Field HEADER_COOKIE */ public static final String HEADER_COOKIE = "Cookie"; /** * Field HEADER_CONTENT_TYPE */ public static final String HEADER_CONTENT_TYPE = "Content-Type"; /** * Field HEADER_CONTENT_TRANSFER_ENCODING */ public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding"; /** * Field HEADER_CONTENT_LOCATION */ public static final String HEADER_CONTENT_LOCATION = "Content-Location"; /** * Field HEADER_CONTENT_LENGTH */ public static final String HEADER_CONTENT_LENGTH = "Content-Length"; /** * Field HEADER_CONTENT_ID */ public static final String HEADER_CONTENT_ID = "Content-Id"; /** * Field HEADER_CONTENT_DESCRIPTION */ public static final String HEADER_CONTENT_DESCRIPTION = "Content-Description"; /** * Field HEADER_CONNECTION_KEEPALIVE */ public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive".intern(); /** * Field HEADER_CONNECTION_CLOSE */ public static final String HEADER_CONNECTION_CLOSE = "close".intern(); /** * Field HEADER_CONNECTION */ public static final String HEADER_CONNECTION = "Connection"; /** * Field HEADER_CACHE_CONTROL_NOCACHE */ public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache"; /** * Field HEADER_CACHE_CONTROL */ public static final String HEADER_CACHE_CONTROL = "Cache-Control"; /** * Field HEADER_AUTHORIZATION */ public static final String HEADER_AUTHORIZATION = "Authorization"; /** * Field HEADER_ACCEPT_TEXT_ALL */ public static final String HEADER_ACCEPT_TEXT_ALL = "text/*"; /** * Field HEADER_ACCEPT_MULTIPART_RELATED */ public static final String HEADER_ACCEPT_MULTIPART_RELATED = "multipart/related"; /** * Field HEADER_ACCEPT_APPL_SOAP */ public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml"; /** * Field HEADER_ACCEPT_APPLICATION_DIME */ public static final String HEADER_ACCEPT_APPLICATION_DIME = "application/dime"; /** * Field HEADER_ACCEPT */ public static final String HEADER_ACCEPT = "Accept"; /** * Field CHAR_SET_ENCODING */ public static String CHAR_SET_ENCODING = "charset"; /** * Field UNAUTH[] */ public static final byte UNAUTH[] = ("401 Unauthorized").getBytes(); /** * Field SO_TIMEOUT */ public static final String SO_TIMEOUT = "SO_TIMEOUT"; /** * Field SENDER[] */ public static final byte SENDER[] = "400".getBytes(); public static final String PROXY = "PROXY"; public static final String AUTHENTICATE = "_NTLM_DIGEST_BASIC_AUTHENTICATION_"; /** * @deprecated */ public static final String MTOM_RECEIVED_CONTENT_TYPE = "MTOM_RECEIVED"; /** * Field ISE[] */ public static final byte ISE[] = ("500 Internal server error").getBytes(); /** * Field HTTP_REQ_TYPE */ public static final String HTTP_REQ_TYPE = "HTTP_REQ_TYPE"; /** * Default content encoding chatset */ public static final String HTTP_ELEMENT_CHARSET = "US-ASCII"; /** * Field HTTP[] */ public static char HTTP[] = "HTTP/1.0 ".toCharArray(); /** * Field DEFAULT_SO_TIMEOUT */ public static final int DEFAULT_SO_TIMEOUT = 60000; /** * Field DEFAULT_CONNECTION_TIMEOUT */ public static final int DEFAULT_CONNECTION_TIMEOUT = 60000; /** * Field CONNECTION_TIMEOUT */ public static final String CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT"; /** * Field CACHED_HTTP_CLIENT */ public static final String CACHED_HTTP_CLIENT = "CACHED_HTTP_CLIENT"; /** * @deprecated please use MULTITHREAD_HTTP_CONNECTION_MANAGER */ public static final String MUTTITHREAD_HTTP_CONNECTION_MANAGER = "MUTTITHREAD_HTTP_CONNECTION_MANAGER"; public static final String MULTITHREAD_HTTP_CONNECTION_MANAGER = "MULTITHREAD_HTTP_CONNECTION_MANAGER"; /** * Field CACHED_HTTP_CLIENT */ public static final String REUSE_HTTP_CLIENT = "REUSE_HTTP_CLIENT"; /** * Field HTTP_METHOD */ public static final String HTTP_METHOD = "HTTP_METHOD_OBJECT"; public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding"; public static final String HEADER_CONTENT_ENCODING = "Content-Encoding"; public static final String HEADER_CONTENT_ENCODING_LOWERCASE = HEADER_CONTENT_ENCODING.toLowerCase(); public static final String COMPRESSION_GZIP = "gzip"; /** * Field to set the coockie policy of commons http client * http://jakarta.apache.org/httpcomponents/httpclient-3.x/cookies.html */ public static final String COOKIE_POLICY = "COOKIE_POLICY"; /** * If you want the HTTP sender to indicate that it can accept a gziped * response, set this message context property to true. The sender will * automatically unzip the response if its gzipped. */ public static final String MC_ACCEPT_GZIP = "transport.http.acceptGzip"; /** * by default the HTTP request body is not compressed. set this message * context property to true to have the request body gzip compressed. */ public static final String MC_GZIP_REQUEST = "transport.http.gzipRequest"; /* by default the HTTP response body is not compressed. set this message * context property to true to have the response body gzip compressed. */ public static final String MC_GZIP_RESPONSE = "gzipResponse"; /** * This will allow users to set any custom headers to the message context, which will be picked * up by the sender while sending the request */ public static final String HTTP_HEADERS = "HTTP_HEADERS"; public static final String CHUNKED = "__CHUNKED__"; public static final String HTTP_PROTOCOL_VERSION = "__HTTP_PROTOCOL_VERSION__"; //to set and get the property from service context public static final String COOKIE_STRING = "Cookie"; public static final String HTTP_METHOD_GET = "GET"; public static final String HTTP_METHOD_POST = "POST"; /** * @deprecated Please use Constants.Configuration.CONTENT_TYPE */ public static final String CONTENT_TYPE = "Content-Type"; public static final String OMIT_SOAP_12_ACTION = "OmitSOAP12Action"; public static final String CUSTOM_PROTOCOL_HANDLER = "CUSTOM_PROTOCOL_HANDLER"; /* * Automatically release connections. */ public static final String AUTO_RELEASE_CONNECTION = "AutoReleaseConnection" ; /** * Method getBytes. * * @param data * @return Returns byte[]. */ public static byte[] getBytes(final String data) { if (data == null) { throw new IllegalArgumentException("Parameter may not be null"); } try { return data.getBytes(HTTP_ELEMENT_CHARSET); } catch (UnsupportedEncodingException e) { } return data.getBytes(); } public static final String USER_AGENT = "userAgent"; public static final String SERVER = "server"; } ./src/org/apache/axis2/transport/http/HTTPSender.java0000664000175000017500000002715611767656530021643 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.DeleteMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.net.URL; public class HTTPSender extends AbstractHTTPSender { private static final Log log = LogFactory.getLog(HTTPSender.class); public void send(MessageContext msgContext, URL url, String soapActionString) throws IOException { // execute the HtttpMethodBase - a connection manager can be given for // handle multiple String httpMethod = (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD); if ((httpMethod != null)) { if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) { this.sendViaGet(msgContext, url, soapActionString); return; } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) { this.sendViaDelete(msgContext, url, soapActionString); return; } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) { this.sendViaPut(msgContext, url, soapActionString); return; } } this.sendViaPost(msgContext, url, soapActionString); } /** * Used to send a request via HTTP Get method * * @param msgContext - The MessageContext of the message * @param url - The target URL * @param soapActiionString - The soapAction string of the request * @throws AxisFault - Thrown in case an exception occurs */ private void sendViaGet(MessageContext msgContext, URL url, String soapActiionString) throws AxisFault { GetMethod getMethod = new GetMethod(); HttpClient httpClient = getHttpClient(msgContext); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, getMethod, httpClient, soapActiionString); // Need to have this here because we can have soap action when using the soap response MEP String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActiionString); if (soapAction != null) { getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, getMethod); handleResponse(msgContext, getMethod); } catch (IOException e) { log.info("Unable to sendViaGet to url[" + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, getMethod); } } private void cleanup(MessageContext msgContext, HttpMethod method) { if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) { method.releaseConnection(); } } /** * Used to send a request via HTTP Delete Method * * @param msgContext - The MessageContext of the message * @param url - The target URL * @param soapActiionString - The soapAction string of the request * @throws AxisFault - Thrown in case an exception occurs */ private void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString) throws AxisFault { DeleteMethod deleteMethod = new DeleteMethod(); HttpClient httpClient = getHttpClient(msgContext); populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActiionString); try { executeMethod(httpClient, msgContext, url, deleteMethod); handleResponse(msgContext, deleteMethod); } catch (IOException e) { log.info("Unable to sendViaDelete to url[" + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, deleteMethod); } } /** * Used to send a request via HTTP Post Method * * @param msgContext - The MessageContext of the message * @param url - The target URL * @param soapActionString - The soapAction string of the request * @throws AxisFault - Thrown in case an exception occurs */ private void sendViaPost(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); /* What's up with this, it never gets used anywhere?? --Glen String charEncoding = (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); if (charEncoding == null) { charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING; } */ PostMethod postMethod = new PostMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString); postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { postMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null) { postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } /* * main excecution takes place.. */ try { executeMethod(httpClient, msgContext, url, postMethod); handleResponse(msgContext, postMethod); } catch (IOException e) { log.info("Unable to sendViaPost to url[" + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, postMethod); } } /** * Used to send a request via HTTP Put Method * * @param msgContext - The MessageContext of the message * @param url - The target URL * @param soapActionString - The soapAction string of the request * @throws AxisFault - Thrown in case an exception occurs */ private void sendViaPut(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); /* Same deal - this value never gets used, why is it here? --Glen String charEncoding = (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); if (charEncoding == null) { charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING; } */ PutMethod putMethod = new PutMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, putMethod, httpClient, soapActionString); putMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { putMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null) { putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } /* * main excecution takes place.. */ try { executeMethod(httpClient, msgContext, url, putMethod); handleResponse(msgContext, putMethod); } catch (IOException e) { log.info("Unable to sendViaPut to url[" + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, putMethod); } } /** * Used to handle the HTTP Response * * @param msgContext - The MessageContext of the message * @param method - The HTTP method used * @throws IOException - Thrown in case an exception occurs */ private void handleResponse(MessageContext msgContext, HttpMethodBase method) throws IOException { int statusCode = method.getStatusCode(); if (statusCode == HttpStatus.SC_OK) { processResponse(method, msgContext); } else if (statusCode == HttpStatus.SC_ACCEPTED) { } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR || statusCode == HttpStatus.SC_BAD_REQUEST) { Header contenttypeHeader = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE); String value = null; if (contenttypeHeader != null) { value = contenttypeHeader.getValue(); } OperationContext opContext = msgContext.getOperationContext(); if(opContext!=null){ MessageContext inMessageContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if(inMessageContext!=null){ inMessageContext.setProcessingFault(true); } } if (value != null) { processResponse(method, msgContext); } Object isTransportNonBlocking = msgContext.getProperty( MessageContext.TRANSPORT_NON_BLOCKING); if (isTransportNonBlocking != null && ((Boolean) isTransportNonBlocking).booleanValue()) { throw new AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode), method.getStatusText())); } } else { throw new AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode), method.getStatusText())); } } } ./src/org/apache/axis2/transport/http/CommonsTransportHeaders.java0000664000175000017500000000601411767656530024535 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.commons.httpclient.Header; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; public class CommonsTransportHeaders implements Map { private Header[] headers; HashMap headerMap = null; public CommonsTransportHeaders(Header[] headers) { this.headers = headers; } private void init() { headerMap = new HashMap(); for (int i = 0; i < headers.length; i++) { headerMap.put(headers[i].getName(), headers[i].getValue()); } } public int size() { if (headerMap == null) { init(); } return headerMap.size(); } public void clear() { if (headerMap != null) { headerMap.clear(); } } public boolean isEmpty() { if (headerMap == null) { init(); } return headerMap.isEmpty(); } public boolean containsKey(Object key) { if (headerMap == null) { init(); } return headerMap.containsKey(key); } public boolean containsValue(Object value) { if (headerMap == null) { init(); } return headerMap.containsValue(value); } public Collection values() { if (headerMap == null) { init(); } return headerMap.values(); } public void putAll(Map t) { if (headerMap == null) { init(); } headerMap.putAll(t); } public Set entrySet() { if (headerMap == null) { init(); } return headerMap.entrySet(); } public Set keySet() { if (headerMap == null) { init(); } return headerMap.keySet(); } public Object get(Object key) { if (headerMap == null) { init(); } return headerMap.get(key); } public Object remove(Object key) { if (headerMap == null) { init(); } return headerMap.remove(key); } public Object put(Object key, Object value) { if (headerMap == null) { init(); } return headerMap.put(key, value); } } ./src/org/apache/axis2/transport/http/RESTRequestEntity2.java0000664000175000017500000000314011767656530023313 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.commons.httpclient.methods.RequestEntity; import java.io.IOException; import java.io.OutputStream; public class RESTRequestEntity2 implements RequestEntity { private String contentType; private String postRequestBody; public RESTRequestEntity2(String postRequestBody, String contentType) { this.postRequestBody = postRequestBody; this.contentType = contentType; } public void writeRequest(OutputStream output) throws IOException { output.write(postRequestBody.getBytes()); } public long getContentLength() { return this.postRequestBody.getBytes().length; } public String getContentType() { return this.contentType; } public boolean isRepeatable() { return true; } } ./src/org/apache/axis2/transport/http/util/0000775000175000017500000000000011767656530020022 5ustar brianbrian./src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java0000664000175000017500000001444711767656530024224 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.util; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.WSDL20DefaultValueHolder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.util.WSDL20Util; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Iterator; /** * This util is used on the client side for creating the URL's for all request (WSDL 2.0 allws to * change the URL's of SOAP messages too). It resolves WSDL 2.0 httplocation property and also * append parameters to URL's when needed. */ public class URLTemplatingUtil { /** * Appends Query parameters to the URL * * @param messageContext - The MessageContext of the request * @param url - Original url string * @return String containing the appended query parameters */ public static URL appendQueryParameters(MessageContext messageContext, URL url) throws AxisFault { String urlString = url.toString(); OMElement firstElement; String queryParameterSeparator = (String) messageContext .getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); // In case queryParameterSeparator is null we better use the default value if (queryParameterSeparator == null) { queryParameterSeparator = WSDL20DefaultValueHolder .getDefaultValue(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); } firstElement = messageContext.getEnvelope().getBody().getFirstElement(); String params = ""; if (firstElement != null) { Iterator iter = firstElement.getChildElements(); String legalCharacters = WSDL2Constants.LEGAL_CHARACTERS_IN_QUERY.replaceAll(queryParameterSeparator, ""); while (iter.hasNext()) { OMElement element = (OMElement) iter.next(); try { params = params + URIEncoderDecoder.quoteIllegal(element.getLocalName(), legalCharacters) + "=" + URIEncoderDecoder.quoteIllegal(element.getText(), legalCharacters) + queryParameterSeparator; } catch (UnsupportedEncodingException e) { throw AxisFault.makeFault(e); } } } if (!"".equals(params)) { int index = urlString.indexOf("?"); if (index == -1) { urlString = urlString + "?" + params.substring(0, params.length() - 1); } else if (index == urlString.length() - 1) { urlString = urlString + params.substring(0, params.length() - 1); } else { urlString = urlString + queryParameterSeparator + params.substring(0, params.length() - 1); } try { return new URL(urlString); } catch (MalformedURLException e) { throw AxisFault.makeFault(e); } } return url; } /** * Returns the templated URL given the original URL * * @param targetURL - The original URL * @param messageContext - The MessageContext of the request * @param detach - Boolean value specifying whether the element should be detached from the * envelop. When serializing data as application/x-form-urlencoded what goes in the body is the * remainder and therefore we should detach the element from the envelop. * @return The templated URL * @throws AxisFault - Thrown in case an exception occurs */ public static URL getTemplatedURL(URL targetURL, MessageContext messageContext, boolean detach) throws AxisFault { String httpLocation = (String) messageContext.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION); // String urlString = targetURL.toString(); if (httpLocation != null) { String replacedQuery = httpLocation; int separator = httpLocation.indexOf('{'); try { if (separator > -1) { replacedQuery = URIEncoderDecoder.quoteIllegal( WSDL20Util.applyURITemplating(messageContext, httpLocation, detach), WSDL2Constants.LEGAL_CHARACTERS_IN_URL); } URI targetURI; URI appendedURI; if (replacedQuery.charAt(0) == '?') { appendedURI = new URI(targetURL.toString () + replacedQuery); } else { String uriString = targetURL.toString(); if (!uriString.endsWith("/")) { targetURI = new URI(uriString + "/"); } else { targetURI = new URI(uriString); } appendedURI = targetURI.resolve(replacedQuery); } targetURL = appendedURI.toURL(); } catch (MalformedURLException e) { throw new AxisFault("An error occured while trying to create request URL"); } catch (URISyntaxException e) { throw new AxisFault("An error occured while trying to create request URL"); } catch (UnsupportedEncodingException e) { throw new AxisFault("An error occured while trying to create request URL"); } } return targetURL; } } ./src/org/apache/axis2/transport/http/util/SOAPUtil.java0000664000175000017500000001135211767656530022267 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.util; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.Handler.InvocationResponse; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @deprecated Since we are not using this class and this might lead to mis-use of this class, we will * removing this class in a future release. */ public class SOAPUtil { private static final Log log = LogFactory.getLog(SOAPUtil.class); public SOAPUtil() { } /** * Handle SOAP Messages * * @param msgContext * @param request * @param response * @throws AxisFault */ public boolean processPostRequest(MessageContext msgContext, HttpServletRequest request, HttpServletResponse response) throws AxisFault { try { response.setHeader("Content-Type", "text/html"); if (server(msgContext) != null) { response.setHeader("Server", server(msgContext)); } String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, request.getContentType()); InvocationResponse ir = HTTPTransportUtils.processHTTPPostRequest(msgContext, request.getInputStream(), response.getOutputStream(), request.getContentType(), soapAction, request.getRequestURL().toString()); response.setContentType("text/xml; charset=" + msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING)); if (!TransportUtils.isResponseWritten(msgContext)) { Integer statusCode = (Integer) msgContext.getProperty(Constants.RESPONSE_CODE); if (statusCode != null) { response.setStatus(statusCode.intValue()); } else { response.setStatus(HttpServletResponse.SC_ACCEPTED); } } boolean closeReader = true; Parameter parameter = msgContext.getConfigurationContext().getAxisConfiguration() .getParameter("axis2.close.reader"); if (parameter != null) { closeReader = JavaUtils.isTrueExplicitly(parameter.getValue()); } if (closeReader && !InvocationResponse.SUSPEND.equals(ir)) { try { ((StAXBuilder) msgContext.getEnvelope().getBuilder()).close(); } catch (Exception e) { log.debug(e); } } return true; } catch (AxisFault axisFault) { throw axisFault; } catch (IOException ioException) { throw AxisFault.makeFault(ioException); } } private String server(MessageContext messageContext) { if (messageContext.getParameter(HTTPConstants.SERVER) != null) { OMElement userAgentElement = messageContext.getParameter(HTTPConstants.SERVER).getParameterElement(); return userAgentElement.getText().trim(); } return null; } } ./src/org/apache/axis2/transport/http/util/RESTUtil.java0000664000175000017500000001742211767656530022306 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.util; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher; import org.apache.axis2.dispatchers.RequestURIBasedDispatcher; import org.apache.axis2.dispatchers.RequestURIOperationDispatcher; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.engine.Handler; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HTTPTransportUtils; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * */ public class RESTUtil { public static Handler.InvocationResponse processXMLRequest(MessageContext msgContext, InputStream in, OutputStream out, String contentType) throws AxisFault { try { msgContext.setDoingREST(true); String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType); msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); dispatchAndVerify(msgContext); in = HTTPTransportUtils.handleGZip(msgContext, in); SOAPEnvelope soapEnvelope = TransportUtils .createSOAPMessage(msgContext, in, contentType); msgContext.setEnvelope(soapEnvelope); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); } catch (AxisFault axisFault) { throw axisFault; } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } finally { String messageType = (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE); if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) || HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) { msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, HTTPConstants.MEDIA_TYPE_APPLICATION_XML); } } return invokeAxisEngine(msgContext); } public static Handler.InvocationResponse processURLRequest(MessageContext msgContext, OutputStream out, String contentType) throws AxisFault { // here, only the parameters in the URI are supported. Others will be discarded. try { if (contentType == null || "".equals(contentType)) { contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM; } // set the required properties so that even if there is an error during the dispatch // phase the response message will be passed to the client well. msgContext.setDoingREST(true); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType); msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); // 1. First dispatchAndVerify and find out the service and the operation. dispatchAndVerify(msgContext); SOAPEnvelope soapEnvelope; try { soapEnvelope = TransportUtils .createSOAPMessage(msgContext, null, contentType); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } msgContext.setEnvelope(soapEnvelope); } catch (AxisFault axisFault) { throw axisFault; } catch (IOException e) { throw AxisFault.makeFault(e); } finally { String messageType = (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE); if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) || HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) { msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, HTTPConstants.MEDIA_TYPE_APPLICATION_XML); } } return invokeAxisEngine(msgContext); } private static Handler.InvocationResponse invokeAxisEngine(MessageContext messageContext) throws AxisFault { AxisEngine axisEngine = new AxisEngine(messageContext.getConfigurationContext()); return axisEngine.receive(messageContext); } private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault { RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher(); requestDispatcher.invoke(msgContext); AxisService axisService = msgContext.getAxisService(); if (axisService != null) { HTTPLocationBasedDispatcher httpLocationBasedDispatcher = new HTTPLocationBasedDispatcher(); httpLocationBasedDispatcher.invoke(msgContext); if (msgContext.getAxisOperation() == null) { RequestURIOperationDispatcher requestURIOperationDispatcher = new RequestURIOperationDispatcher(); requestURIOperationDispatcher.invoke(msgContext); } AxisOperation axisOperation; if ((axisOperation = msgContext.getAxisOperation()) != null) { AxisEndpoint axisEndpoint = (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME); if (axisEndpoint != null) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint .getBinding().getChild(axisOperation.getName()); msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation); } msgContext.setAxisOperation(axisOperation); } } } public static String getConstantFromHTTPLocation(String httpLocation, String httpMethod) { if (httpLocation.charAt(0) != '?') { httpLocation = "/" + httpLocation; } int index = httpLocation.indexOf("{"); if (index > -1) { httpLocation = httpLocation.substring(0, index); } return httpMethod + httpLocation; } } ./src/org/apache/axis2/transport/http/util/URIEncoderDecoder.java0000664000175000017500000001761211767656530024121 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.util; import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; public class URIEncoderDecoder { static final String digits = "0123456789ABCDEF"; //$NON-NLS-1$ static final String encoding = "UTF8"; //$NON-NLS-1$ /** * Validate a string by checking if it contains any characters other than: *

    * 1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in * the legalset parameter 4. others (Unicode characters that are not in * US-ASCII set, and are not ISO Control or are not ISO Space characters) *

    * called from URI.Helper.parseURI() to validate each component *

    * * @param s java.lang.String the string to be validated * @param legal java.lang.String the characters allowed in the String s */ static void validate(String s, String legal) throws URISyntaxException { for (int i = 0; i < s.length();) { char ch = s.charAt(i); if (ch == '%') { do { if (i + 2 >= s.length()) { throw new URISyntaxException(s, "Incomplete % sequence"); } int d1 = Character.digit(s.charAt(i + 1), 16); int d2 = Character.digit(s.charAt(i + 2), 16); if (d1 == -1 || d2 == -1) { throw new URISyntaxException(s, "Invalid % sequence " + s.substring(i, i + 3) , i); } i += 3; } while (i < s.length() && s.charAt(i) == '%'); continue; } if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127 && !Character.isSpaceChar(ch) && !Character .isISOControl(ch)))) { throw new URISyntaxException(s, "Illegal character", i); } i++; } } static void validateSimple(String s, String legal) throws URISyntaxException { for (int i = 0; i < s.length();) { char ch = s.charAt(i); if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) { throw new URISyntaxException(s, "Illegal character", i); //$NON-NLS-1$ } i++; } } /** * All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9') * and legal characters are converted into their hexidecimal value prepended * by '%'. *

    * For example: '#' -> %23 *

    * Other characters, which are Unicode chars that are not US-ASCII, and are * not ISO Control or are not ISO Space chars, are preserved. *

    * Called from URI.quoteComponent() (for multiple argument constructors) *

    * * @param s java.lang.String the string to be converted * @param legal java.lang.String the characters allowed to be preserved in the * string s * @return java.lang.String the converted string */ public static String quoteIllegal(String s, String legal) throws UnsupportedEncodingException { StringBuffer buf = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1) { buf.append(ch); } else { byte[] bytes = new String(new char[]{ch}).getBytes(encoding); for (int j = 0; j < bytes.length; j++) { buf.append('%'); buf.append(digits.charAt((bytes[j] & 0xf0) >> 4)); buf.append(digits.charAt(bytes[j] & 0xf)); } } } return buf.toString(); } /** * Other characters, which are Unicode chars that are not US-ASCII, and are * not ISO Control or are not ISO Space chars are not preserved. They are * converted into their hexidecimal value prepended by '%'. *

    * For example: Euro currency symbol -> "%E2%82%AC". *

    * Called from URI.toASCIIString() *

    * * @param s java.lang.String the string to be converted * @return java.lang.String the converted string */ static String encodeOthers(String s) throws UnsupportedEncodingException { StringBuffer buf = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (ch <= 127) { buf.append(ch); } else { byte[] bytes = new String(new char[]{ch}).getBytes(encoding); for (int j = 0; j < bytes.length; j++) { buf.append('%'); buf.append(digits.charAt((bytes[j] & 0xf0) >> 4)); buf.append(digits.charAt(bytes[j] & 0xf)); } } } return buf.toString(); } /** * Decodes the string argument which is assumed to be encoded in the * x-www-form-urlencoded MIME content type using the UTF-8 * encoding scheme. *

    * '%' and two following hex digit characters are converted to the * equivalent byte value. All other characters are passed through * unmodified. *

    *

    * e.g. "A%20B%20C %24%25" -> "A B C $%" *

    * Called from URI.getXYZ() methods *

    * * @param s java.lang.String The encoded string. * @return java.lang.String The decoded version. */ public static String decode(String s) throws UnsupportedEncodingException { StringBuffer result = new StringBuffer(); ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int i = 0; i < s.length();) { char c = s.charAt(i); if (c == '%') { out.reset(); do { if (i + 2 >= s.length()) { throw new IllegalArgumentException("Incomplete % sequence at " + i); } int d1 = Character.digit(s.charAt(i + 1), 16); int d2 = Character.digit(s.charAt(i + 2), 16); if (d1 == -1 || d2 == -1) { throw new IllegalArgumentException( "Invalid % sequence" + s.substring(i, i + 3) + "at " + String.valueOf(i)); } out.write((byte) ((d1 << 4) + d2)); i += 3; } while (i < s.length() && s.charAt(i) == '%'); result.append(out.toString(encoding)); continue; } result.append(c); i++; } return result.toString(); } }./src/org/apache/axis2/transport/http/util/ComplexPart.java0000664000175000017500000000754611767656530023137 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.util; import org.apache.commons.httpclient.methods.multipart.PartBase; import org.apache.commons.httpclient.util.EncodingUtil; import java.io.IOException; import java.io.OutputStream; public class ComplexPart extends PartBase { /** * Default content encoding of string parameters. */ public static final String DEFAULT_CONTENT_TYPE = "application/xml"; /** * Default charset of string parameters */ public static final String DEFAULT_CHARSET = "US-ASCII"; /** * Default transfer encoding of string parameters */ public static final String DEFAULT_TRANSFER_ENCODING = "8bit"; /** * Contents of this StringPart. */ private byte[] content; /** * The String value of this part. */ private String value; /** * Constructor. * * @param name The name of the part * @param value the string to post * @param charset the charset to be used to encode the string, if null * the {@link #DEFAULT_CHARSET default} is used */ public ComplexPart(String name, String value, String charset) { super( name, DEFAULT_CONTENT_TYPE, charset == null ? DEFAULT_CHARSET : charset, DEFAULT_TRANSFER_ENCODING ); if (value == null) { throw new IllegalArgumentException("Value may not be null"); } if (value.indexOf(0) != -1) { // See RFC 2048, 2.8. "8bit Data" throw new IllegalArgumentException("NULs may not be present in string parts"); } this.value = value; } /** * Constructor. * * @param name The name of the part * @param value the string to post */ public ComplexPart(String name, String value) { this(name, value, null); } /** * Gets the content in bytes. Bytes are lazily created to allow the charset to be changed * after the part is created. * * @return the content in bytes */ private byte[] getContent() { if (content == null) { content = EncodingUtil.getBytes(value, getCharSet()); } return content; } /** * Writes the data to the given OutputStream. * * @param out the OutputStream to write to * @throws IOException if there is a write error */ protected void sendData(OutputStream out) throws IOException { out.write(getContent()); } /** * Return the length of the data. * * @return The length of the data. * @throws IOException If an IO problem occurs * @see org.apache.commons.httpclient.methods.multipart.Part#lengthOfData() */ protected long lengthOfData() throws IOException { return getContent().length; } /* (non-Javadoc) * @see org.apache.commons.httpclient.methods.multipart.BasePart#setCharSet(java.lang.String) */ public void setCharSet(String charSet) { super.setCharSet(charSet); this.content = null; } } ./src/org/apache/axis2/transport/http/CustomListener.java0000664000175000017500000001000711767656530022666 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.transport.TransportListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.http.HttpServletRequest; /** * This class is used just to add additional transports at runtime if user sends a request using * alternate schemes, example to handle http/https separately */ public class CustomListener implements TransportListener { private static final Log log = LogFactory.getLog(CustomListener.class); private int port; private String schema; private ConfigurationContext axisConf; public CustomListener(int port, String schema) { this.port = port; this.schema = schema; } public void init(ConfigurationContext axisConf, TransportInDescription transprtIn) throws AxisFault { this.axisConf = axisConf; Parameter param = transprtIn.getParameter(PARAM_PORT); if (param != null) { this.port = Integer.parseInt((String) param.getValue()); } } public void start() throws AxisFault { } public void stop() throws AxisFault { } public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { String path = axisConf.getServiceContextPath() + "/" + serviceName; if(path.charAt(0)!='/'){ path = '/' + path; } return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":" + port + path + "/" )}; } public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return getEPRsForService(serviceName, ip)[0]; } public SessionContext getSessionContext(MessageContext messageContext) { HttpServletRequest req = (HttpServletRequest) messageContext.getProperty( HTTPConstants.MC_HTTP_SERVLETREQUEST); SessionContext sessionContext = (SessionContext) req.getSession(true).getAttribute( Constants.SESSION_CONTEXT_PROPERTY); String sessionId = null; try { sessionId = req.getSession().getId(); if (sessionContext == null) { sessionContext = new SessionContext(null); sessionContext.setCookieID(sessionId); req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY, sessionContext); } } catch (Throwable t){ log.info("Old Servlet API :" + t); return null; } messageContext.setSessionContext(sessionContext); messageContext.setProperty(AxisServlet.SESSION_ID, sessionId); return sessionContext; } public void destroy() { } } ./src/org/apache/axis2/transport/http/TransportHeaders.java0000664000175000017500000001253011767656530023201 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import javax.servlet.http.HttpServletRequest; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * Pass-Thru / delayed get and put of the values from HttpServletRequest */ public class TransportHeaders implements Map { HttpServletRequest req; // This map contains the headers from the request; it will be filled in lazily if needed, // for performance HashMap headerMap = null; // This map contains properties that have been put onto the map; it is not populated by values // from the HttpServletRequest. A null value means the headerMap has been fully populated and // any values that were in localHeaderMap have been migrated to headerMap. HashMap localHeaderMap = new HashMap(); public TransportHeaders(HttpServletRequest req) { this.req = req; } /** * This will fully populate the HashMap with the value from the HttpSerlvetRequest and migrate * any values previously put onto localHeaderMap into the new HashMap. * * Note this is a bit non-performant, so it is only done if needed. * If/when it is done, there may be properties that have been set on the localHeaderMap. * If headerMap must be created due to a call * to size, or isEmpty, or some other method which requires a fully populated map, then any * previously created entries in the localHeaderMap are migrated to the new hashmap. * After that localHeaderMap is released and only headerMap is used after that. */ private void init() { headerMap = new HashMap(); Enumeration headerNames = req.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = (String) headerNames.nextElement(); String value = req.getHeader(key); headerMap.put(key, value); } // Migrate any previously set local properties to the newly created hashmap then release // the local hashmap Set localHeaderSet = localHeaderMap.entrySet(); Iterator localHeaderIterator = localHeaderSet.iterator(); while (localHeaderIterator.hasNext()) { Map.Entry localHeaderEntry = (Map.Entry) localHeaderIterator.next(); headerMap.put(localHeaderEntry.getKey(), localHeaderEntry.getValue()); } localHeaderMap = null; } public int size() { if (headerMap == null) { init(); } return headerMap.size(); } public void clear() { if (headerMap != null) { headerMap.clear(); } if (localHeaderMap != null) { localHeaderMap.clear(); } } public boolean isEmpty() { if (headerMap == null) { init(); } return headerMap.isEmpty(); } public boolean containsKey(Object key) { if (headerMap == null) { init(); } return headerMap.containsKey(key); } public boolean containsValue(Object value) { if (headerMap == null) { init(); } return headerMap.containsValue(value); } public Collection values() { if (headerMap == null) { init(); } return headerMap.values(); } public void putAll(Map t) { if (headerMap == null) { init(); } headerMap.putAll(t); } public Set entrySet() { if (headerMap == null) { init(); } return headerMap.entrySet(); } public Set keySet() { if (headerMap == null) { init(); } return headerMap.keySet(); } public Object get(Object key) { // If there is a local map, look there first. if (localHeaderMap != null) { Object returnValue = null; returnValue = localHeaderMap.get(key); if (returnValue != null) { return returnValue; } } if (headerMap == null) { return req.getHeader((String) key); } return headerMap.get(key); } public Object remove(Object key) { if (headerMap == null) { init(); } return headerMap.remove(key); } public Object put(Object key, Object value) { if (localHeaderMap != null) { return localHeaderMap.put(key, value); } if (headerMap == null) { init(); } return headerMap.put(key, value); } } ./src/org/apache/axis2/transport/http/AdminAgent.java0000664000175000017500000006736511767656530021740 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.RequestContext; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.servlet.ServletRequestContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; /** * Provides methods to process axis2 admin requests. */ public class AdminAgent extends AbstractAgent { private static final Log log = LogFactory.getLog(AbstractAgent.class); /** * Field LIST_MULTIPLE_SERVICE_JSP_NAME */ private static final String LIST_SERVICE_GROUP_JSP = "ListServiceGroup.jsp"; private static final String LIST_SERVICES_JSP_NAME = "listService.jsp"; private static final String LIST_SINGLE_SERVICES_JSP_NAME = "listSingleService.jsp"; private static final String SELECT_SERVICE_JSP_NAME = "SelectService.jsp"; private static final String IN_ACTIVATE_SERVICE_JSP_NAME = "InActivateService.jsp"; private static final String ACTIVATE_SERVICE_JSP_NAME = "ActivateService.jsp"; /** * Field LIST_SINGLE_SERVICE_JSP_NAME */ private static final String LIST_PHASES_JSP_NAME = "viewphases.jsp"; private static final String LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME = "globalModules.jsp"; private static final String LIST_AVAILABLE_MODULES_JSP_NAME = "listModules.jsp"; private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME = "engagingtoaservice.jsp"; private static final String ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME = "EngageToServiceGroup.jsp"; private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME = "engagingglobally.jsp"; public static final String ADMIN_JSP_NAME = "admin.jsp"; private static final String VIEW_GLOBAL_HANDLERS_JSP_NAME = "ViewGlobalHandlers.jsp"; private static final String VIEW_SERVICE_HANDLERS_JSP_NAME = "ViewServiceHandlers.jsp"; private static final String SERVICE_PARA_EDIT_JSP_NAME = "ServiceParaEdit.jsp"; private static final String ENGAGE_TO_OPERATION_JSP_NAME = "engagingtoanoperation.jsp"; private static final String LOGIN_JSP_NAME = "Login.jsp"; private File serviceDir; public AdminAgent(ConfigurationContext aConfigContext) { super(aConfigContext); try { if (configContext.getAxisConfiguration().getRepository() != null) { File repoDir = new File(configContext.getAxisConfiguration().getRepository().getFile()); serviceDir = new File(repoDir, "services"); if (!serviceDir.exists()) { serviceDir.mkdirs(); } } } catch (Exception e) { log.info(e.getMessage(), e); } catch (Throwable e) { log.error(e.getMessage(), e); } } public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { // We forward to login page if axis2 security is enabled // and the user is not authorized // TODO Fix workaround for login test if (axisSecurityEnabled() && authorizationRequired(httpServletRequest)) { renderView(LOGIN_JSP_NAME, httpServletRequest, httpServletResponse); } else { super.handle(httpServletRequest, httpServletResponse); } } protected void processIndex(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { renderView(ADMIN_JSP_NAME, req, res); } // supported web operations protected void processUpload(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String hasHotDeployment = (String) configContext.getAxisConfiguration().getParameterValue("hotdeployment"); String hasHotUpdate = (String) configContext.getAxisConfiguration().getParameterValue("hotupdate"); req.setAttribute("hotDeployment", (hasHotDeployment.equals("true")) ? "enabled" : "disabled"); req.setAttribute("hotUpdate", (hasHotUpdate.equals("true")) ? "enabled" : "disabled"); RequestContext reqContext = new ServletRequestContext(req); boolean isMultipart = ServletFileUpload.isMultipartContent(reqContext); if (isMultipart) { try { //Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); //Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); List items = upload.parseRequest(req); // Process the uploaded items Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { String fileName = item.getName(); String fileExtesion = fileName; fileExtesion = fileExtesion.toLowerCase(); if (!(fileExtesion.endsWith(".jar") || fileExtesion.endsWith(".aar"))) { req.setAttribute("status", "failure"); req.setAttribute("cause", "Unsupported file type " + fileExtesion); } else { String fileNameOnly; if (fileName.indexOf("\\") < 0) { fileNameOnly = fileName.substring(fileName.lastIndexOf("/") + 1, fileName .length()); } else { fileNameOnly = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName .length()); } File uploadedFile = new File(serviceDir, fileNameOnly); item.write(uploadedFile); req.setAttribute("status", "success"); req.setAttribute("filename", fileNameOnly); } } } } catch (Exception e) { req.setAttribute("status", "failure"); req.setAttribute("cause", e.getMessage()); } } renderView("upload.jsp", req, res); } protected void processLogin(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String username = req.getParameter("userName"); String password = req.getParameter("password"); if ((username == null) || (password == null) || username.trim().length() == 0 || password.trim().length() == 0) { req.setAttribute("errorMessage", "Invalid auth credentials!"); renderView(LOGIN_JSP_NAME, req, res); return; } String adminUserName = (String) configContext.getAxisConfiguration().getParameter( Constants.USER_NAME).getValue(); String adminPassword = (String) configContext.getAxisConfiguration().getParameter( Constants.PASSWORD).getValue(); if (username.equals(adminUserName) && password.equals(adminPassword)) { req.getSession().setAttribute(Constants.LOGGED, "Yes"); renderView(ADMIN_JSP_NAME, req, res); } else { req.setAttribute("errorMessage", "Invalid auth credentials!"); renderView(LOGIN_JSP_NAME, req, res); } } protected void processEditServicePara(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String serviceName = req.getParameter("axisService"); if (req.getParameter("changePara") != null) { AxisService service = configContext.getAxisConfiguration().getService(serviceName); if (service != null) { ArrayList service_para = service.getParameters(); for (int i = 0; i < service_para.size(); i++) { Parameter parameter = (Parameter) service_para.get(i); String para = req.getParameter(serviceName + "_" + parameter.getName()); service.addParameter(new Parameter(parameter.getName(), para)); } for (Iterator iterator = service.getOperations(); iterator.hasNext();) { AxisOperation axisOperation = (AxisOperation) iterator.next(); String op_name = axisOperation.getName().getLocalPart(); ArrayList operation_para = axisOperation.getParameters(); for (int i = 0; i < operation_para.size(); i++) { Parameter parameter = (Parameter) operation_para.get(i); String para = req.getParameter(op_name + "_" + parameter.getName()); axisOperation.addParameter(new Parameter(parameter.getName(), para)); } } } res.setContentType("text/html"); req.setAttribute("status", "Parameters Changed Successfully."); req.getSession().removeAttribute(Constants.SERVICE); } else { AxisService serviceTemp = configContext.getAxisConfiguration().getServiceForActivation(serviceName); if (serviceTemp.isActive()) { if (serviceName != null) { req.getSession().setAttribute(Constants.SERVICE, configContext.getAxisConfiguration().getService( serviceName)); } } else { req.setAttribute("status", "Service " + serviceName + " is not an active service" + ". \n Only parameters of active services can be edited."); } } renderView(SERVICE_PARA_EDIT_JSP_NAME, req, res); } protected void processEngagingGlobally(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap modules = configContext.getAxisConfiguration().getModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); String moduleName = req.getParameter("modules"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); if (moduleName != null) { try { configContext.getAxisConfiguration().engageModule(moduleName); req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName + " module engaged globally successfully"); } catch (AxisFault axisFault) { req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage()); } } req.getSession().setAttribute("modules", null); renderView(ENGAGING_MODULE_GLOBALLY_JSP_NAME, req, res); } protected void processListOperations(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap modules = configContext.getAxisConfiguration().getModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); String moduleName = req.getParameter("modules"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); req.getSession().setAttribute("modules", null); String serviceName = req.getParameter("axisService"); if (serviceName != null) { req.getSession().setAttribute("service", serviceName); } else { serviceName = (String) req.getSession().getAttribute("service"); } req.getSession().setAttribute( Constants.OPERATION_MAP, configContext.getAxisConfiguration().getService(serviceName).getOperations()); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); String operationName = req.getParameter("axisOperation"); if ((serviceName != null) && (moduleName != null) && (operationName != null)) { try { AxisOperation od = configContext.getAxisConfiguration().getService( serviceName).getOperation(new QName(operationName)); od.engageModule( configContext.getAxisConfiguration().getModule(moduleName)); req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName + " module engaged to the operation successfully"); } catch (AxisFault axisFault) { req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage()); } } req.getSession().setAttribute("operation", null); renderView(ENGAGE_TO_OPERATION_JSP_NAME, req, res); } protected void processEngageToService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap modules = configContext.getAxisConfiguration().getModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); populateSessionInformation(req); String moduleName = req.getParameter("modules"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); req.getSession().setAttribute("modules", null); String serviceName = req.getParameter("axisService"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); if ((serviceName != null) && (moduleName != null)) { try { configContext.getAxisConfiguration().getService(serviceName).engageModule( configContext.getAxisConfiguration().getModule(moduleName)); req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName + " module engaged to the service successfully"); } catch (AxisFault axisFault) { req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage()); } } req.getSession().setAttribute("axisService", null); renderView(ENGAGING_MODULE_TO_SERVICE_JSP_NAME, req, res); } protected void processEngageToServiceGroup(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap modules = configContext.getAxisConfiguration().getModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); Iterator services = configContext.getAxisConfiguration().getServiceGroups(); req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, services); String moduleName = req.getParameter("modules"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); req.getSession().setAttribute("modules", null); String serviceName = req.getParameter("axisService"); req.getSession().setAttribute(Constants.ENGAGE_STATUS, null); if ((serviceName != null) && (moduleName != null)) { configContext.getAxisConfiguration().getServiceGroup(serviceName).engageModule( configContext.getAxisConfiguration().getModule(moduleName)); req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName + " module engaged to the service group successfully"); } req.getSession().setAttribute("axisService", null); renderView(ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME, req, res); } protected void processLogout(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.getSession().invalidate(); renderView("index.jsp", req, res); } protected void processviewServiceGroupConetxt(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String type = req.getParameter("TYPE"); String sgID = req.getParameter("ID"); ServiceGroupContext sgContext = configContext.getServiceGroupContext(sgID); req.getSession().setAttribute("ServiceGroupContext",sgContext); req.getSession().setAttribute("TYPE",type); req.getSession().setAttribute("ConfigurationContext",configContext); renderView("viewServiceGroupContext.jsp", req, res); } protected void processviewServiceContext(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String type = req.getParameter("TYPE"); String sgID = req.getParameter("PID"); String ID = req.getParameter("ID"); ServiceGroupContext sgContext = configContext.getServiceGroupContext(sgID); if (sgContext != null) { AxisService service = sgContext.getDescription().getService(ID); ServiceContext serviceContext = sgContext.getServiceContext(service); req.setAttribute("ServiceContext",serviceContext); req.setAttribute("TYPE",type); } else { req.setAttribute("ServiceContext",null); req.setAttribute("TYPE",type); } renderView("viewServiceContext.jsp", req, res); } protected void processSelectServiceParaEdit(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { populateSessionInformation(req); req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "SERVICE_PARAMETER"); renderView(SELECT_SERVICE_JSP_NAME, req, res); } protected void processListOperation(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { populateSessionInformation(req); req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "MODULE"); renderView(SELECT_SERVICE_JSP_NAME, req, res); } protected void processActivateService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { if (req.getParameter("submit") != null) { String serviceName = req.getParameter("axisService"); String turnon = req.getParameter("turnon"); if (serviceName != null) { if (turnon != null) { configContext.getAxisConfiguration().startService(serviceName); } } } populateSessionInformation(req); renderView(ACTIVATE_SERVICE_JSP_NAME, req, res); } protected void processDeactivateService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { if (req.getParameter("submit") != null) { String serviceName = req.getParameter("axisService"); String turnoff = req.getParameter("turnoff"); if (serviceName != null) { if (turnoff != null) { configContext.getAxisConfiguration().stopService(serviceName); } populateSessionInformation(req); } } else { populateSessionInformation(req); } renderView(IN_ACTIVATE_SERVICE_JSP_NAME, req, res); } protected void processViewGlobalHandlers(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.getSession().setAttribute(Constants.GLOBAL_HANDLERS, configContext.getAxisConfiguration()); renderView(VIEW_GLOBAL_HANDLERS_JSP_NAME, req, res); } protected void processViewServiceHandlers(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String service = req.getParameter("axisService"); if (service != null) { req.getSession().setAttribute(Constants.SERVICE_HANDLERS, configContext.getAxisConfiguration().getService(service)); } renderView(VIEW_SERVICE_HANDLERS_JSP_NAME, req, res); } protected void processListPhases(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { PhasesInfo info = configContext.getAxisConfiguration().getPhasesInfo(); req.getSession().setAttribute(Constants.PHASE_LIST, info); renderView(LIST_PHASES_JSP_NAME, req, res); } protected void processListServiceGroups(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { Iterator serviceGroups = configContext.getAxisConfiguration().getServiceGroups(); populateSessionInformation(req); req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, serviceGroups); renderView(LIST_SERVICE_GROUP_JSP, req, res); } protected void processListService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { populateSessionInformation(req); req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP, configContext.getAxisConfiguration().getFaultyServices()); renderView(LIST_SERVICES_JSP_NAME, req, res); } protected void processListSingleService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.getSession().setAttribute(Constants.IS_FAULTY, ""); //Clearing out any old values. String serviceName = req.getParameter("serviceName"); if (serviceName != null) { AxisService service = configContext.getAxisConfiguration().getService(serviceName); req.getSession().setAttribute(Constants.SINGLE_SERVICE, service); } renderView(LIST_SINGLE_SERVICES_JSP_NAME, req, res); } protected void processListContexts(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.getSession().setAttribute(Constants.CONFIG_CONTEXT, configContext); renderView("ViewContexts.jsp", req, res); } protected void processglobalModules(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { Collection modules = configContext.getAxisConfiguration().getEngagedModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); renderView(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME, req, res); } protected void processListModules(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap modules = configContext.getAxisConfiguration().getModules(); req.getSession().setAttribute(Constants.MODULE_MAP, modules); req.getSession().setAttribute(Constants.ERROR_MODULE_MAP, configContext.getAxisConfiguration().getFaultyModules()); renderView(LIST_AVAILABLE_MODULES_JSP_NAME, req, res); } protected void processdisengageModule(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String type = req.getParameter("type"); String serviceName = req.getParameter("serviceName"); String moduleName = req.getParameter("module"); AxisConfiguration axisConfiguration = configContext.getAxisConfiguration(); AxisService service = axisConfiguration.getService(serviceName); AxisModule module = axisConfiguration.getModule(moduleName); if (type.equals("operation")) { if (service.isEngaged(module.getName()) || axisConfiguration.isEngaged(module.getName())) { req.getSession().setAttribute("status", "Can not disengage module " + moduleName + ". This module is engaged at a higher level."); } else { String opName = req.getParameter("operation"); AxisOperation op = service.getOperation(new QName(opName)); op.disengageModule(module); req.getSession() .setAttribute("status", "Module " + moduleName + " was disengaged from " + "operation " + opName + " in service " + serviceName + "."); } } else { if (axisConfiguration.isEngaged(module.getName())) { req.getSession() .setAttribute("status", "Can not disengage module " + moduleName + ". " + "This module is engaged at a higher level."); } else { service.disengageModule(axisConfiguration.getModule(moduleName)); req.getSession() .setAttribute("status", "Module " + moduleName + " was disengaged from" + " service " + serviceName + "."); } } renderView("disengage.jsp", req, res); } protected void processSelectService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { populateSessionInformation(req); req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "VIEW"); renderView(SELECT_SERVICE_JSP_NAME, req, res); } private boolean authorizationRequired (HttpServletRequest httpServletRequest) { return httpServletRequest.getSession().getAttribute(Constants.LOGGED) == null && !httpServletRequest.getRequestURI().endsWith("login"); } private boolean axisSecurityEnabled () { Parameter parameter = configContext.getAxisConfiguration() .getParameter(Constants.ADMIN_SECURITY_DISABLED); return parameter == null || !"true".equals(parameter.getValue()); } } ./src/org/apache/axis2/transport/http/HTTPTransportReceiver.java0000664000175000017500000001521711767656530024077 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; /** * Class HTTPTransportReceiver */ public class HTTPTransportReceiver { public static Map getGetRequestParameters(String requestURI) { Map map = new HashMap(); if (requestURI == null || "".equals(requestURI)) { return map; } char[] chars = requestURI.toCharArray(); final int NOT_BEGUN = 1500; final int INSIDE_NAME = 1501; final int INSIDE_VALUE = 1502; int state = NOT_BEGUN; StringBuffer name = new StringBuffer(); StringBuffer value = new StringBuffer(); for (int index = 0; index < chars.length; index++) { if (state == NOT_BEGUN) { if (chars[index] == '?') { state = INSIDE_NAME; } } else if (state == INSIDE_NAME) { if (chars[index] == '=') { state = INSIDE_VALUE; } else { name.append(chars[index]); } } else if (state == INSIDE_VALUE) { if (chars[index] == ',') { state = INSIDE_NAME; map.put(name.toString(), value.toString()); name.delete(0, name.length()); value.delete(0, value.length()); } else { value.append(chars[index]); } } } if (name.length() + value.length() > 0) { map.put(name.toString(), value.toString()); } return map; } /** * Returns the HTML text for the list of services deployed. * This can be delegated to another Class as well * where it will handle more options of GET messages. * * @return Returns String. */ public static String getServicesHTML(ConfigurationContext configurationContext) { String temp = ""; Map services = configurationContext.getAxisConfiguration().getServices(); Hashtable erroneousServices = configurationContext.getAxisConfiguration().getFaultyServices(); boolean status = false; if ((services != null) && !services.isEmpty()) { status = true; Collection serviceCollection = services.values(); temp += "

    " + "Deployed services" + "

    "; for (Iterator it = serviceCollection.iterator(); it.hasNext();) { AxisService axisService = (AxisService) it.next(); Iterator iterator = axisService.getOperations(); temp += "

    " + axisService.getName() + "

    "; if (iterator.hasNext()) { temp += "Available operations
      "; for (; iterator.hasNext();) { AxisOperation axisOperation = (AxisOperation) iterator.next(); temp += "
    • " + axisOperation.getName().getLocalPart() + "
    • "; } temp += "
    "; } else { temp += "No operations specified for this service"; } } } if ((erroneousServices != null) && !erroneousServices.isEmpty()) { temp += "

    Faulty Services

    "; status = true; Enumeration faultyservices = erroneousServices.keys(); while (faultyservices.hasMoreElements()) { String faultyserviceName = (String) faultyservices.nextElement(); temp += "

    " + faultyserviceName + "

    "; } } if (!status) { temp = "

    There are no services deployed

    "; } temp = "Axis2: Services" + "" + temp + ""; return temp; } public static String printServiceHTML(String serviceName, ConfigurationContext configurationContext) { String temp = ""; try { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); AxisService axisService = axisConfig.getService(serviceName); Iterator iterator = axisService.getOperations(); temp += "

    " + axisService.getName() + "

    "; temp += "wsdl
    "; temp += "Service Description : " + axisService.getServiceDescription() + "

    "; if (iterator.hasNext()) { temp += "Available operations
      "; for (; iterator.hasNext();) { AxisOperation axisOperation = (AxisOperation) iterator.next(); temp += "
    • " + axisOperation.getName().getLocalPart() + "
    • "; } temp += "
    "; } else { temp += "No operations specified for this service"; } temp = "Axis2: Services" + "" + temp + ""; } catch (AxisFault axisFault) { temp = "Service has a fualt" + "" + "

    " + axisFault.getMessage() + "

    "; } return temp; } } ./src/org/apache/axis2/transport/http/SimpleHTTPServer.java0000664000175000017500000003224211767656530023033 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.server.HttpFactory; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.axis2.transport.http.server.SessionManager; import org.apache.axis2.transport.http.server.SimpleHttpServer; import org.apache.axis2.util.OptionsParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.net.SocketException; import java.util.Iterator; /** * This is a simple implementation of an HTTP server for processing * SOAP requests via Apache's xml-axis2. * It can be used with no configuration other than the port to listen on, or it can * be configured in detail with an HttpFactory. */ public class SimpleHTTPServer implements TransportListener { private static final Log log = LogFactory.getLog(SimpleHTTPServer.class); /** * Embedded commons http core based server */ SimpleHttpServer embedded = null; private String localAddress; int port = -1; public static int DEFAULT_PORT = 8080; private String hostAddress = null; protected ConfigurationContext configurationContext; protected HttpFactory httpFactory; private SessionManager sessionManager; public SimpleHTTPServer() { } /** * Create a SimpleHTTPServer using default HttpFactory settings */ public SimpleHTTPServer(ConfigurationContext configurationContext, int port) throws AxisFault { this(new HttpFactory(configurationContext, port)); } /** * Create a configured SimpleHTTPServer */ public SimpleHTTPServer(HttpFactory httpFactory) throws AxisFault { this.httpFactory = httpFactory; this.configurationContext = httpFactory.getConfigurationContext(); this.port = httpFactory.getPort(); TransportInDescription httpDescription = new TransportInDescription(Constants.TRANSPORT_HTTP); httpDescription.setReceiver(this); httpFactory.getListenerManager().addListener(httpDescription, true); sessionManager = new SessionManager(); } /** * init method in TransportListener * * @param axisConf * @param transprtIn * @throws AxisFault */ public void init(ConfigurationContext axisConf, TransportInDescription transprtIn) throws AxisFault { try { this.configurationContext = axisConf; Parameter param = transprtIn.getParameter(PARAM_PORT); if (param != null) { this.port = Integer.parseInt((String) param.getValue()); } if (httpFactory == null) { httpFactory = new HttpFactory(configurationContext, port); } param = transprtIn.getParameter(HOST_ADDRESS); if (param != null) { hostAddress = ((String) param.getValue()).trim(); } else { hostAddress = httpFactory.getHostAddress(); } } catch (Exception e1) { throw AxisFault.makeFault(e1); } } /** * Method main * * @param args * @throws Exception */ public static void main(String[] args) throws Exception { int port = DEFAULT_PORT; OptionsParser optionsParser = new OptionsParser(args); args = optionsParser.getRemainingArgs(); // first check if we should print usage if ((optionsParser.isFlagSet('?') > 0) || (optionsParser.isFlagSet('h') > 0) || args == null || args.length == 0 || args.length > 3) { printUsage(); } String paramPort = optionsParser.isValueSet('p'); if (paramPort != null) { port = Integer.parseInt(paramPort); } boolean startAllTransports = "all".equals(optionsParser.isValueSet('t')); String repository = optionsParser.isValueSet('r'); if (repository == null) { args = optionsParser.getRemainingArgs(); if (args != null && args[0] != null && !args[0].equals("")) { repository = args[0]; } else { printUsage(); } } System.out.println("[SimpleHTTPServer] Starting"); System.out.println("[SimpleHTTPServer] Using the Axis2 Repository " + new File(repository).getAbsolutePath()); System.out.println("[SimpleHTTPServer] Listening on port " + port); try { ConfigurationContext configctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem(repository, null); SimpleHTTPServer receiver = new SimpleHTTPServer(configctx, port); Runtime.getRuntime().addShutdownHook(new ShutdownThread(receiver)); receiver.start(); ListenerManager listenerManager = configctx .getListenerManager(); TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_HTTP); trsIn.setReceiver(receiver); if (listenerManager == null) { listenerManager = new ListenerManager(); listenerManager.init(configctx); } listenerManager.addListener(trsIn, true); // should all transports be started? specified as "-t all" if (startAllTransports) { Iterator iter = configctx.getAxisConfiguration(). getTransportsIn().keySet().iterator(); while (iter.hasNext()) { QName trp = (QName) iter.next(); if (!new QName(Constants.TRANSPORT_HTTP).equals(trp)) { trsIn = (TransportInDescription) configctx.getAxisConfiguration().getTransportsIn().get(trp); listenerManager.addListener(trsIn, false); } } } System.out.println("[SimpleHTTPServer] Started"); } catch (Throwable t) { log.fatal("Error starting SimpleHTTPServer", t); System.out.println("[SimpleHTTPServer] Shutting down"); } } public static void printUsage() { System.out.println("Usage: SimpleHTTPServer [options] -r "); System.out.println(" Opts: -? this message"); System.out.println(); System.out.println(" -p port :to listen on (default is 8080)"); System.out.println( " -t all :to start all transports defined in the axis2 configuration"); System.exit(1); } /** * Start this server as a NON-daemon. */ public void start() throws AxisFault { try { embedded = new SimpleHttpServer(httpFactory, port); embedded.init(); embedded.start(); } catch (IOException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } } /** * Stop this server. Can be called safely if the system is already stopped, * or if it was never started. * This will interrupt any pending accept(). */ public void stop() { System.out.println("[SimpleHTTPServer] Stop called"); if (embedded != null) { try { embedded.destroy(); } catch (Exception e) { log.error(e.getMessage(), e); } } } /** * replyToEPR * If the user has given host address paramter then it gets the high priority and * ERP will be creatd using that * N:B - hostAddress should be a complete url (http://www.myApp.com/ws) * * @param serviceName * @param ip * @return an EndpointReference * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String) */ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { //if host address is present if (hostAddress != null) { if (embedded != null) { String endpointRefernce = hostAddress ; if(configurationContext.getServiceContextPath().startsWith("/")){ endpointRefernce = endpointRefernce + configurationContext.getServiceContextPath() + "/" + serviceName; } else { endpointRefernce = endpointRefernce + '/' + configurationContext.getServiceContextPath() + "/" + serviceName; } return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")}; } else { throw new AxisFault("Unable to generate EPR for the transport : http"); } } //if the host address is not present String ipAddress; if (ip != null) { ipAddress = ip; } else { try { if(localAddress==null){ localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration()); } if (localAddress == null) { ipAddress = "127.0.0.1"; } else { ipAddress = localAddress; } } catch (SocketException e) { throw AxisFault.makeFault(e); } } if (embedded != null) { String endpointRefernce = "http://" + ipAddress + ":" + embedded.getPort() ; if(configurationContext.getServiceContextPath().startsWith("/")){ endpointRefernce = endpointRefernce + configurationContext.getServiceContextPath() + "/" + serviceName; } else { endpointRefernce = endpointRefernce + '/' + configurationContext.getServiceContextPath() + "/" + serviceName; } return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")}; } else { throw new AxisFault("Unable to generate EPR for the transport : http"); } } /** * Getter for httpFactory */ public HttpFactory getHttpFactory() { return httpFactory; } /** * Method getConfigurationContext * * @return the system context */ public ConfigurationContext getConfigurationContext() { return configurationContext; } /** * replyToEPR * If the user has given host address paramter then it gets the high priority and * ERP will be creatd using that * N:B - hostAddress should be a complte url (http://www.myApp.com/ws) * * @param serviceName * @param ip * @return an EndpointReference * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String) */ public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return getEPRsForService(serviceName, ip)[0]; } /** * Checks if this HTTP server instance is running. * * @return true/false */ public boolean isRunning() { if (embedded == null) { return false; } return embedded.isRunning(); } static class ShutdownThread extends Thread { private SimpleHTTPServer server = null; public ShutdownThread(SimpleHTTPServer server) { super(); this.server = server; } public void run() { System.out.println("[SimpleHTTPServer] Shutting down"); server.stop(); System.out.println("[SimpleHTTPServer] Shutdown complete"); } } public SessionContext getSessionContext(MessageContext messageContext) { String sessionKey = (String) messageContext.getProperty(HTTPConstants.COOKIE_STRING); return this.sessionManager.getSessionContext(sessionKey); } public void destroy() { this.configurationContext = null; } } ./src/org/apache/axis2/transport/http/XFormURLEncodedFormatter.java0000664000175000017500000001077511767656530024506 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.http.util.URLTemplatingUtil; import org.apache.axis2.util.JavaUtils; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.util.Iterator; /** * Formates the request message as application/x-www-form-urlencoded */ public class XFormURLEncodedFormatter implements MessageFormatter { public byte[] getBytes(MessageContext messageContext, OMOutputFormat format) throws AxisFault { OMElement omElement = messageContext.getEnvelope().getBody().getFirstElement(); if (omElement != null) { Iterator it = omElement.getChildElements(); String paraString = ""; while (it.hasNext()) { OMElement ele1 = (OMElement) it.next(); String parameter; parameter = ele1.getLocalName() + "=" + ele1.getText(); paraString = "".equals(paraString) ? parameter : (paraString + "&" + parameter); } return paraString.getBytes(); } return new byte[0]; } public void writeTo(MessageContext messageContext, OMOutputFormat format, OutputStream outputStream, boolean preserve) throws AxisFault { try { outputStream.write(getBytes(messageContext, format)); } catch (IOException e) { throw new AxisFault("An error occured while writing the request"); } } public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction) { String encoding = format.getCharSetEncoding(); String contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM; if (encoding != null) { contentType += "; charset=" + encoding; } // if soap action is there (can be there is soap response MEP is used) add it. if ((soapAction != null) && !"".equals(soapAction.trim()) && !"\"\"".equals(soapAction.trim())) { contentType = contentType + ";action=\"" + soapAction + "\";"; } return contentType; } public URL getTargetAddress(MessageContext messageContext, OMOutputFormat format, URL targetURL) throws AxisFault { // Check whether there is a template in the URL, if so we have to replace then with data // values and create a new target URL. targetURL = URLTemplatingUtil.getTemplatedURL(targetURL, messageContext, true); String ignoreUncited = (String) messageContext.getProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED); // Need to have this check here cause if (ignoreUncited == null || !JavaUtils.isTrueExplicitly(ignoreUncited)) { String httpMethod = (String) messageContext.getProperty(Constants.Configuration.HTTP_METHOD); if (Constants.Configuration.HTTP_METHOD_GET.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_DELETE.equals(httpMethod)) { targetURL = URLTemplatingUtil.appendQueryParameters(messageContext, targetURL); } } else { messageContext.getEnvelope().getBody().getFirstElement().detach(); } return targetURL; } public String formatSOAPAction(MessageContext messageContext, OMOutputFormat format, String soapAction) { return soapAction; } } ./src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java0000664000175000017500000004356611767656530025117 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.OutTransportInfo; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.server.AxisHttpResponseImpl; import org.apache.axis2.util.JavaUtils; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.FactoryConfigurationError; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.zip.GZIPOutputStream; public class CommonsHTTPTransportSender extends AbstractHandler implements TransportSender { protected static final String PROXY_HOST_NAME = "proxy_host"; protected static final String PROXY_PORT = "proxy_port"; int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT; /** * proxydiscription */ protected TransportOutDescription proxyOutSetting = null; private static final Log log = LogFactory .getLog(CommonsHTTPTransportSender.class); protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11; private boolean chunked = false; int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT; public void cleanup(MessageContext msgContext) throws AxisFault { HttpMethod httpMethod = (HttpMethod) msgContext .getProperty(HTTPConstants.HTTP_METHOD); if (httpMethod != null) { httpMethod.releaseConnection(); } } public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { // HTTP/1.0 or // HTTP/1.1 is // checked Parameter version = transportOut .getParameter(HTTPConstants.PROTOCOL_VERSION); if (version != null) { if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) { httpVersion = HTTPConstants.HEADER_PROTOCOL_11; Parameter transferEncoding = transportOut .getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING); if ((transferEncoding != null) && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED .equals(transferEncoding.getValue())) { chunked = true; } } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version .getValue())) { httpVersion = HTTPConstants.HEADER_PROTOCOL_10; } else { throw new AxisFault("Parameter " + HTTPConstants.PROTOCOL_VERSION + " Can have values only HTTP/1.0 or HTTP/1.1"); } } // Get the timeout values from the configuration try { Parameter tempSoTimeoutParam = transportOut .getParameter(HTTPConstants.SO_TIMEOUT); Parameter tempConnTimeoutParam = transportOut .getParameter(HTTPConstants.CONNECTION_TIMEOUT); if (tempSoTimeoutParam != null) { soTimeout = Integer.parseInt((String) tempSoTimeoutParam .getValue()); } if (tempConnTimeoutParam != null) { connectionTimeout = Integer .parseInt((String) tempConnTimeoutParam.getValue()); } } catch (NumberFormatException nfe) { // If there's a problem log it and use the default values log.error("Invalid timeout value format: not a number", nfe); } } public void stop() { // Any code that , need to invoke when sender stop } public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { try { OMOutputFormat format = new OMOutputFormat(); // if (!msgContext.isDoingMTOM()) msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext)); format.setSOAP11(msgContext.isSOAP11()); format.setDoOptimize(msgContext.isDoingMTOM()); format.setDoingSWA(msgContext.isDoingSwA()); format.setCharSetEncoding(HTTPTransportUtils .getCharSetEncoding(msgContext)); Object mimeBoundaryProperty = msgContext .getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty); } TransportOutDescription transportOut = msgContext.getConfigurationContext(). getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTP); //if a parameter has set been set, we will omit the SOAP action for SOAP 1.2 if (transportOut != null) { if (!msgContext.isSOAP11()) { Parameter param = transportOut.getParameter(HTTPConstants.OMIT_SOAP_12_ACTION); Object parameterValue = null; if (param != null) { parameterValue = param.getValue(); } if (parameterValue != null && JavaUtils.isTrueExplicitly(parameterValue)) { //Check whether user has already overridden this. Object propertyValue = msgContext.getProperty(Constants.Configuration.DISABLE_SOAP_ACTION); if (propertyValue == null || !JavaUtils.isFalseExplicitly(propertyValue)) { msgContext.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean.TRUE); } } } } // Transport URL can be different from the WSA-To. So processing // that now. EndpointReference epr = null; String transportURL = (String) msgContext .getProperty(Constants.Configuration.TRANSPORT_URL); if (transportURL != null) { epr = new EndpointReference(transportURL); } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) { epr = msgContext.getTo(); } // Check for the REST behavior, if you desire rest behavior // put a at the // server.xml/client.xml file // ###################################################### // Change this place to change the wsa:toepr // epr = something // ###################################################### if (epr != null) { if (!epr.hasNoneAddress()) { writeMessageWithCommons(msgContext, epr, format); //TransportUtils.setResponseWritten(msgContext, true); } } else { if (msgContext.getProperty(MessageContext.TRANSPORT_OUT) != null) { sendUsingOutputStream(msgContext, format); TransportUtils.setResponseWritten(msgContext, true); } else { throw new AxisFault("Both the TO and MessageContext.TRANSPORT_OUT property " + "are null, so nowhere to send"); } } } catch (FactoryConfigurationError e) { log.debug(e); throw AxisFault.makeFault(e); } catch (IOException e) { log.debug(e); throw AxisFault.makeFault(e); } return InvocationResponse.CONTINUE; } /** * Send a message (which must be a response) via the OutputStream sitting in the * MessageContext TRANSPORT_OUT property. Since this class is used for both requests and * responses, we split the logic - this method always gets called when we're * writing to the HTTP response stream, and sendUsingCommons() is used for requests. * * @param msgContext the active MessageContext * @param format output formatter for our message * @throws AxisFault if a general problem arises */ private void sendUsingOutputStream(MessageContext msgContext, OMOutputFormat format) throws AxisFault { OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); // I Don't think we need this check.. Content type needs to be set in // any case. (thilina) // if (msgContext.isServerSide()) { OutTransportInfo transportInfo = (OutTransportInfo) msgContext .getProperty(Constants.OUT_TRANSPORT_INFO); if (transportInfo == null) throw new AxisFault("No transport info in MessageContext"); ServletBasedOutTransportInfo servletBasedOutTransportInfo = null; if (transportInfo instanceof ServletBasedOutTransportInfo) { servletBasedOutTransportInfo = (ServletBasedOutTransportInfo) transportInfo; // if sending a fault, set HTTP status code to 500 if (msgContext.isFault()) { servletBasedOutTransportInfo.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } Object customHeaders = msgContext.getProperty(HTTPConstants.HTTP_HEADERS); if (customHeaders != null) { if (customHeaders instanceof List) { Iterator iter = ((List) customHeaders).iterator(); while (iter.hasNext()) { Header header = (Header) iter.next(); if (header != null) { servletBasedOutTransportInfo .addHeader(header.getName(), header.getValue()); } } } else if (customHeaders instanceof Map) { Iterator iter = ((Map) customHeaders).entrySet().iterator(); while (iter.hasNext()) { Map.Entry header = (Map.Entry) iter.next(); if (header != null) { servletBasedOutTransportInfo .addHeader((String) header.getKey(), (String) header.getValue()); } } } } } else if (transportInfo instanceof AxisHttpResponseImpl) { Object customHeaders = msgContext.getProperty(HTTPConstants.HTTP_HEADERS); if (customHeaders != null) { if (customHeaders instanceof List) { Iterator iter = ((List) customHeaders).iterator(); while (iter.hasNext()) { Header header = (Header) iter.next(); if (header != null) { ((AxisHttpResponseImpl) transportInfo) .addHeader(header.getName(), header.getValue()); } } } else if (customHeaders instanceof Map) { Iterator iter = ((Map) customHeaders).entrySet().iterator(); while (iter.hasNext()) { Map.Entry header = (Map.Entry) iter.next(); if (header != null) { ((AxisHttpResponseImpl) transportInfo) .addHeader((String) header.getKey(), (String) header.getValue()); } } } } } format.setAutoCloseWriter(true); MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext); if (messageFormatter == null) throw new AxisFault("No MessageFormatter in MessageContext"); // Once we get to this point, exceptions should NOT be turned into faults and sent, // because we're already sending! So catch everything and log it, but don't pass // upwards. try { transportInfo.setContentType( messageFormatter.getContentType(msgContext, format, findSOAPAction(msgContext))); Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE); if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) { if (servletBasedOutTransportInfo != null) servletBasedOutTransportInfo.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING, HTTPConstants.COMPRESSION_GZIP); try { out = new GZIPOutputStream(out); out.write(messageFormatter.getBytes(msgContext, format)); ((GZIPOutputStream) out).finish(); out.flush(); } catch (IOException e) { throw new AxisFault("Could not compress response"); } } else { messageFormatter.writeTo(msgContext, format, out, false); } } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); throw axisFault; } } private void writeMessageWithCommons(MessageContext messageContext, EndpointReference toEPR, OMOutputFormat format) throws AxisFault { try { URL url = new URL(toEPR.getAddress()); // select the Message Sender depending on the REST status AbstractHTTPSender sender; sender = new HTTPSender(); if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) { chunked = JavaUtils.isTrueExplicitly(messageContext .getProperty(HTTPConstants.CHUNKED)); } if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) { httpVersion = (String) messageContext .getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION); } // Following order needed to be preserved because, // HTTP/1.0 does not support chunk encoding sender.setChunked(chunked); sender.setHttpVersion(httpVersion); sender.setFormat(format); sender.send(messageContext, url, findSOAPAction(messageContext)); } catch (MalformedURLException e) { log.debug(e); throw AxisFault.makeFault(e); } catch (HttpException e) { log.debug(e); throw AxisFault.makeFault(e); } catch (IOException e) { log.debug(e); throw AxisFault.makeFault(e); } } private static String findSOAPAction(MessageContext messageContext) { String soapActionString = null; Parameter parameter = messageContext.getTransportOut().getParameter(HTTPConstants.OMIT_SOAP_12_ACTION); if (parameter != null && JavaUtils.isTrueExplicitly(parameter.getValue()) && !messageContext.isSOAP11()) { return "\"\""; } Object disableSoapAction = messageContext.getOptions().getProperty( Constants.Configuration.DISABLE_SOAP_ACTION); if (!JavaUtils.isTrueExplicitly(disableSoapAction)) { // first try to get the SOAP action from message context soapActionString = messageContext.getSoapAction(); if ((soapActionString == null) || (soapActionString.length() == 0)) { // now let's try to get WSA action soapActionString = messageContext.getWSAAction(); if (messageContext.getAxisOperation() != null && ((soapActionString == null) || (soapActionString .length() == 0))) { // last option is to get it from the axis operation soapActionString = messageContext.getAxisOperation() .getSoapAction(); } } } //Since action is optional for SOAP 1.2 we can return null here. if (soapActionString == null && messageContext.isSOAP11()) { soapActionString = "\"\""; } return soapActionString; } } ./src/org/apache/axis2/transport/http/HTTPTransportUtils.java0000664000175000017500000004213211767656530023427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory; import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.engine.Handler.InvocationResponse; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Utils; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Iterator; import java.util.Map; import java.util.zip.GZIPInputStream; public class HTTPTransportUtils { /** * @deprecated This was used only by the now deprecated processHTTPGetRequest() method. */ public static SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl, Map map, ConfigurationContext configCtx) throws AxisFault { String[] values = Utils.parseRequestURLForServiceAndOperation(requestUrl, configCtx.getServiceContextPath()); if (values == null) { return new SOAP11Factory().getDefaultEnvelope(); } if ((values[1] != null) && (values[0] != null)) { String srvice = values[0]; AxisService service = configCtx.getAxisConfiguration().getService(srvice); if (service == null) { throw new AxisFault("service not found: " + srvice); } String operation = values[1]; SOAPFactory soapFactory = new SOAP11Factory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); OMNamespace omNs = soapFactory.createOMNamespace(service.getSchemaTargetNamespace(), service.getSchemaTargetNamespacePrefix()); soapFactory.createOMNamespace(service.getSchemaTargetNamespace(), service.getSchemaTargetNamespacePrefix()); OMElement opElement = soapFactory.createOMElement(operation, omNs); Iterator it = map.keySet().iterator(); while (it.hasNext()) { String name = (String) it.next(); String value = (String) map.get(name); OMElement omEle = soapFactory.createOMElement(name, omNs); omEle.setText(value); opElement.addChild(omEle); } envelope.getBody().addChild(opElement); return envelope; } else { return null; } } /** *

    * Checks whether MTOM needs to be enabled for the message represented by * the msgContext. We check value assigned to the "enableMTOM" property * either using the config files (axis2.xml, services.xml) or * programatically. Programatic configuration is given priority. If the * given value is "optional", MTOM will be enabled only if the incoming * message was an MTOM message. *

    * * @param msgContext * @return true if SwA needs to be enabled */ public static boolean doWriteMTOM(MessageContext msgContext) { boolean enableMTOM; Object enableMTOMObject = null; // First check the whether MTOM is enabled by the configuration // (Eg:Axis2.xml, services.xml) Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_MTOM); if (parameter != null) { enableMTOMObject = parameter.getValue(); } // Check whether the configuration is overridden programatically.. // Priority given to programatically setting of the value Object property = msgContext.getProperty(Constants.Configuration.ENABLE_MTOM); if (property != null) { enableMTOMObject = property; } enableMTOM = JavaUtils.isTrueExplicitly(enableMTOMObject); // Handle the optional value for enableMTOM // If the value for 'enableMTOM' is given as optional and if the request // message was a MTOM message we sent out MTOM if (!enableMTOM && msgContext.isDoingMTOM() && (enableMTOMObject instanceof String)) { if (((String) enableMTOMObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) { enableMTOM = true; } } return enableMTOM; } /** *

    * Checks whether SOAP With Attachments (SwA) needs to be enabled for the * message represented by the msgContext. We check value assigned to the * "enableSwA" property either using the config files (axis2.xml, * services.xml) or programatically. Programatic configuration is given * priority. If the given value is "optional", SwA will be enabled only if * the incoming message was SwA type. *

    * * @param msgContext * @return true if SwA needs to be enabled */ public static boolean doWriteSwA(MessageContext msgContext) { boolean enableSwA; Object enableSwAObject = null; // First check the whether SwA is enabled by the configuration // (Eg:Axis2.xml, services.xml) Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_SWA); if (parameter != null) { enableSwAObject = parameter.getValue(); } // Check whether the configuration is overridden programatically.. // Priority given to programatically setting of the value Object property = msgContext.getProperty(Constants.Configuration.ENABLE_SWA); if (property != null) { enableSwAObject = property; } enableSwA = JavaUtils.isTrueExplicitly(enableSwAObject); // Handle the optional value for enableSwA // If the value for 'enableSwA' is given as optional and if the request // message was a SwA message we sent out SwA if (!enableSwA && msgContext.isDoingSwA() && (enableSwAObject instanceof String)) { if (((String) enableSwAObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) { enableSwA = true; } } return enableSwA; } /** * Utility method to query CharSetEncoding. First look in the * MessageContext. If it's not there look in the OpContext. Use the defualt, * if it's not given in either contexts. * * @param msgContext * @return CharSetEncoding */ public static String getCharSetEncoding(MessageContext msgContext) { String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); if (charSetEnc == null) { OperationContext opctx = msgContext.getOperationContext(); if (opctx != null) { charSetEnc = (String) opctx .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); } /** * If the char set enc is still not found use the default */ if (charSetEnc == null) { charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING; } } return charSetEnc; } /** * @param msgContext - The MessageContext of the Request Message * @param out - The output stream of the response * @param soapAction - SoapAction of the request * @param requestURI - The URL that the request came to * @param configurationContext - The Axis Configuration Context * @param requestParameters - The parameters of the request message * @return - boolean indication whether the operation was succesfull * @throws AxisFault - Thrown in case a fault occurs * @deprecated use RESTUtil.processURLRequest(MessageContext msgContext, OutputStream out, String contentType) instead */ public static boolean processHTTPGetRequest(MessageContext msgContext, OutputStream out, String soapAction, String requestURI, ConfigurationContext configurationContext, Map requestParameters) throws AxisFault { if ((soapAction != null) && soapAction.startsWith("\"") && soapAction.endsWith("\"")) { soapAction = soapAction.substring(1, soapAction.length() - 1); } msgContext.setSoapAction(soapAction); msgContext.setTo(new EndpointReference(requestURI)); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); msgContext.setServerSide(true); SOAPEnvelope envelope = HTTPTransportUtils.createEnvelopeFromGetRequest(requestURI, requestParameters, configurationContext); if (envelope == null) { return false; } else { msgContext.setDoingREST(true); msgContext.setEnvelope(envelope); AxisEngine.receive(msgContext); return true; } } private static final int VERSION_UNKNOWN = 0; private static final int VERSION_SOAP11 = 1; private static final int VERSION_SOAP12 = 2; public static InvocationResponse processHTTPPostRequest(MessageContext msgContext, InputStream in, OutputStream out, String contentType, String soapActionHeader, String requestURI) throws AxisFault { int soapVersion = VERSION_UNKNOWN; try { soapVersion = initializeMessageContext(msgContext, soapActionHeader, requestURI, contentType); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); msgContext.setEnvelope( TransportUtils.createSOAPMessage( msgContext, handleGZip(msgContext, in), contentType)); return AxisEngine.receive(msgContext); } catch (SOAPProcessingException e) { throw AxisFault.makeFault(e); } catch (AxisFault e) { throw e; } catch (IOException e) { throw AxisFault.makeFault(e); } catch (OMException e) { throw AxisFault.makeFault(e); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } finally { if ((msgContext.getEnvelope() == null) && soapVersion != VERSION_SOAP11) { msgContext.setEnvelope(new SOAP12Factory().getDefaultEnvelope()); } } } public static int initializeMessageContext(MessageContext msgContext, String soapActionHeader, String requestURI, String contentType) { int soapVersion = VERSION_UNKNOWN; // remove the starting and trailing " from the SOAP Action if ((soapActionHeader != null) && soapActionHeader.length() > 0 && soapActionHeader.charAt(0) == '\"' && soapActionHeader.endsWith("\"")) { soapActionHeader = soapActionHeader.substring(1, soapActionHeader.length() - 1); } // fill up the Message Contexts msgContext.setSoapAction(soapActionHeader); msgContext.setTo(new EndpointReference(requestURI)); msgContext.setServerSide(true); // get the type of char encoding String charSetEnc = BuilderUtil.getCharSetEncoding(contentType); if (charSetEnc == null) { charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING; } msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); if (contentType != null) { if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { soapVersion = VERSION_SOAP12; TransportUtils.processContentTypeForAction(contentType, msgContext); } else if (contentType .indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { soapVersion = VERSION_SOAP11; } else if (isRESTRequest(contentType)) { // If REST, construct a SOAP11 envelope to hold the rest message and // indicate that this is a REST message. soapVersion = VERSION_SOAP11; msgContext.setDoingREST(true); } if (soapVersion == VERSION_SOAP11) { // TODO Keith : Do we need this anymore // Deployment configuration parameter Parameter enableREST = msgContext .getParameter(Constants.Configuration.ENABLE_REST); if ((soapActionHeader == null) && (enableREST != null)) { if (Constants.VALUE_TRUE.equals(enableREST.getValue())) { // If the content Type is text/xml (BTW which is the // SOAP 1.1 Content type ) and the SOAP Action is // absent it is rest !! msgContext.setDoingREST(true); } } } } return soapVersion; } public static InputStream handleGZip(MessageContext msgContext, InputStream in) throws IOException { Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (headers != null) { if (HTTPConstants.COMPRESSION_GZIP .equals(headers.get(HTTPConstants.HEADER_CONTENT_ENCODING)) || HTTPConstants.COMPRESSION_GZIP.equals(headers.get( HTTPConstants.HEADER_CONTENT_ENCODING_LOWERCASE))) { in = new GZIPInputStream(in); } } return in; } public static boolean isDoingREST(MessageContext msgContext) { boolean enableREST = false; // check whether isDoingRest is already true in the message context if (msgContext.isDoingREST()) { return true; } Object enableRESTProperty = msgContext.getProperty(Constants.Configuration.ENABLE_REST); if (enableRESTProperty != null) { enableREST = JavaUtils.isTrueExplicitly(enableRESTProperty); } msgContext.setDoingREST(enableREST); return enableREST; } /** * This will match for content types that will be regarded as REST in WSDL2.0. * This contains, * 1. application/xml * 2. application/x-www-form-urlencoded * 3. multipart/form-data *

    * If the request doesnot contain a content type; this will return true. * * @param contentType * @return Boolean */ public static boolean isRESTRequest(String contentType) { if (contentType == null) { return false; } return (contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1); } } ./src/org/apache/axis2/transport/http/AxisServlet.java0000664000175000017500000010054511767656530022166 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.deployment.WarBasedAxisConfigurator; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.engine.Handler.InvocationResponse; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.axis2.transport.http.util.RESTUtil; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.net.SocketException; import java.util.Map; /** * Class AxisServlet */ public class AxisServlet extends HttpServlet implements TransportListener { private static final Log log = LogFactory.getLog(AxisServlet.class); public static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT"; public static final String SESSION_ID = "SessionId"; protected transient ConfigurationContext configContext; protected transient AxisConfiguration axisConfiguration; protected transient ServletConfig servletConfig; protected transient ListingAgent agent; protected transient String contextRoot = null; protected boolean disableREST = false; private static final String LIST_SERVICES_SUFFIX = "/services/listServices"; private static final String LIST_FAULTY_SERVICES_SUFFIX = "/services/ListFaultyServices"; private boolean closeReader = true; private static final int BUFFER_SIZE = 1024 * 8; private boolean initCalled = false; /** * Implementaion of POST interface * * @param request * @param response * @throws ServletException * @throws IOException */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //set the initial buffer for a larger value try { response.setBufferSize(BUFFER_SIZE); } catch (Throwable t){ log.info("Old Servlet API :" + t); } initContextRoot(request); MessageContext msgContext; OutputStream out = response.getOutputStream(); String contentType = request.getContentType(); if (!HTTPTransportUtils.isRESTRequest(contentType)) { msgContext = createMessageContext(request, response); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType); try { // adding ServletContext into msgContext; String url; try { url = request.getRequestURL().toString(); } catch (Throwable t){ log.info("Old Servlet API (fallback to HttpServletRequest.getRequestURI) :" + t); url = request.getRequestURI(); } InvocationResponse pi = HTTPTransportUtils. processHTTPPostRequest(msgContext, new BufferedInputStream(request.getInputStream()), new BufferedOutputStream(out), contentType, request.getHeader(HTTPConstants.HEADER_SOAP_ACTION), url); Boolean holdResponse = (Boolean) msgContext.getProperty(RequestResponseTransport.HOLD_RESPONSE); if (pi.equals(InvocationResponse.SUSPEND) || (holdResponse != null && Boolean.TRUE.equals(holdResponse))) { ((RequestResponseTransport) msgContext .getProperty(RequestResponseTransport.TRANSPORT_CONTROL)) .awaitResponse(); } response.setContentType("text/xml; charset=" + msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING)); // if data has not been sent back and this is not a signal response if (!TransportUtils.isResponseWritten(msgContext) && (((RequestResponseTransport) msgContext.getProperty( RequestResponseTransport.TRANSPORT_CONTROL)). getStatus() != RequestResponseTransport. RequestResponseTransportStatus.SIGNALLED)) { response.setStatus(HttpServletResponse.SC_ACCEPTED); } } catch (AxisFault e) { setResponseState(msgContext, response); log.debug(e); if (msgContext != null) { processAxisFault(msgContext, response, out, e); } else { throw new ServletException(e); } } catch (Throwable t) { log.error(t.getMessage(), t); try { // If the fault is not going along the back channel we should be 202ing if (AddressingHelper.isFaultRedirected(msgContext)) { response.setStatus(HttpServletResponse.SC_ACCEPTED); } else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext .getProperty(Constants.AXIS_BINDING_OPERATION); if (axisBindingOperation != null) { AxisBindingMessage axisBindingMessage = axisBindingOperation.getFault( (String) msgContext.getProperty(Constants.FAULT_NAME)); if(axisBindingMessage != null){ Integer code = (Integer) axisBindingMessage .getProperty(WSDL2Constants.ATTR_WHTTP_CODE); if (code != null) { response.setStatus(code.intValue()); } } } } handleFault(msgContext, out, new AxisFault(t.toString(), t)); } catch (AxisFault e2) { log.info(e2); throw new ServletException(e2); } } finally { closeStaxBuilder(msgContext); TransportUtils.deleteAttachments(msgContext); } } else { if (!disableREST) { new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_POST, request, response) .processXMLRequest(); } else { showRestDisabledErrorMessage(response); } } } /** * Implementation for GET interface * * @param request * @param response * @throws ServletException * @throws IOException */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { initContextRoot(request); // this method is also used to serve for the listServices request. String requestURI = request.getRequestURI(); String query = request.getQueryString(); // There can be three different request coming to this. // 1. wsdl, wsdl2 and xsd requests // 2. list services requests // 3. REST requests. if ((query != null) && (query.indexOf("wsdl2") >= 0 || query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 || query.indexOf("policy") >= 0)) { // handling meta data exchange stuff agent.initTransportListener(request); agent.processListService(request, response); } else if (requestURI.endsWith(".xsd") || requestURI.endsWith(".wsdl")) { agent.processExplicitSchemaAndWSDL(request, response); } else if (requestURI.endsWith(LIST_SERVICES_SUFFIX) || requestURI.endsWith(LIST_FAULTY_SERVICES_SUFFIX)) { // handling list services request try { agent.handle(request, response); } catch (Exception e) { throw new ServletException(e); } } else if (!disableREST) { new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_GET, request, response) .processURLRequest(); } else { showRestDisabledErrorMessage(response); } } /** * Implementation of DELETE interface * * @param request * @param response * @throws ServletException * @throws IOException */ protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { initContextRoot(request); // this method is also used to serve for the listServices request. if (!disableREST) { new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_DELETE, request, response) .processURLRequest(); } else { showRestDisabledErrorMessage(response); } } /** * Implementation of PUT interface * * @param request * @param response * @throws ServletException * @throws IOException */ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { initContextRoot(request); // this method is also used to serve for the listServices request. if (!disableREST) { new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_PUT, request, response) .processXMLRequest(); } else { showRestDisabledErrorMessage(response); } } /** * Private method that deals with disabling of REST support. * * @param response * @throws IOException */ protected void showRestDisabledErrorMessage(HttpServletResponse response) throws IOException { PrintWriter writer = new PrintWriter(response.getOutputStream()); writer.println("

    Please enable REST support in WEB-INF/conf/axis2.xml " + "and WEB-INF/web.xml

    "); writer.flush(); response.setStatus(HttpServletResponse.SC_ACCEPTED); } /** * Close the builders. * * @param messageContext * @throws ServletException */ private void closeStaxBuilder(MessageContext messageContext) throws ServletException { if (closeReader && messageContext != null) { try { SOAPEnvelope envelope = messageContext.getEnvelope(); if(envelope != null) { StAXBuilder builder = (StAXBuilder) envelope.getBuilder(); if (builder != null) { builder.close(); } } } catch (Exception e) { log.debug(e.toString(), e); } } } /** * Processing for faults * * @param msgContext * @param res * @param out * @param e */ private void processAxisFault(MessageContext msgContext, HttpServletResponse res, OutputStream out, AxisFault e) { try { // If the fault is not going along the back channel we should be 202ing if (AddressingHelper.isFaultRedirected(msgContext)) { res.setStatus(HttpServletResponse.SC_ACCEPTED); } else { String status = (String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE); if (status == null) { res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } else { res.setStatus(Integer.parseInt(status)); } AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext .getProperty(Constants.AXIS_BINDING_OPERATION); if (axisBindingOperation != null) { AxisBindingMessage fault = axisBindingOperation .getFault((String) msgContext.getProperty(Constants.FAULT_NAME)); if (fault != null) { Integer code = (Integer) fault.getProperty(WSDL2Constants.ATTR_WHTTP_CODE); if (code != null) { res.setStatus(code.intValue()); } } } } handleFault(msgContext, out, e); } catch (AxisFault e2) { log.info(e2); } } protected void handleFault(MessageContext msgContext, OutputStream out, AxisFault e) throws AxisFault { msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e); // SOAP 1.2 specification mentions that we should send HTTP code 400 in a fault if the // fault code Sender HttpServletResponse response = (HttpServletResponse) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE); if (response != null) { //TODO : Check for SOAP 1.2! SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode(); OMElement valueElement = null; if (code != null) { valueElement = code.getFirstChildWithName(new QName( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)); } if (valueElement != null) { if (SOAP12Constants.FAULT_CODE_SENDER.equals(valueElement.getTextAsQName().getLocalPart()) && !msgContext.isDoingREST()) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } } } AxisEngine.sendFault(faultContext); } /** * Main init method * * @param config * @throws ServletException */ public void init(ServletConfig config) throws ServletException { // prevent this method from being called more than once per instance initCalled = true; super.init(config); try { this.servletConfig = config; ServletContext servletContext = servletConfig.getServletContext(); this.configContext = (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT); if(configContext == null){ configContext = initConfigContext(config); config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext); } axisConfiguration = configContext.getAxisConfiguration(); ListenerManager listenerManager = new ListenerManager(); listenerManager.init(configContext); TransportInDescription transportInDescription = new TransportInDescription( Constants.TRANSPORT_HTTP); transportInDescription.setReceiver(this); listenerManager.addListener(transportInDescription, true); listenerManager.start(); ListenerManager.defaultConfigurationContext = configContext; agent = new ListingAgent(configContext); initParams(); } catch (Exception e) { throw new ServletException(e); } } /** * distroy the ConfigurationContext */ public void destroy() { //stoping listner manager try { if (configContext != null) { configContext.terminate(); } } catch (AxisFault axisFault) { log.info(axisFault.getMessage()); } try { super.destroy(); } catch (Exception e) { log.info(e.getMessage()); } } /** * Initializes the Axis2 parameters. */ protected void initParams() { Parameter parameter; // do we need to completely disable REST support parameter = axisConfiguration.getParameter(Constants.Configuration.DISABLE_REST); if (parameter != null) { disableREST = !JavaUtils.isFalseExplicitly(parameter.getValue()); } // Should we close the reader(s) parameter = axisConfiguration.getParameter("axis2.close.reader"); if (parameter != null) { closeReader = JavaUtils.isTrueExplicitly(parameter.getValue()); } } /** * Convenient method to re-initialize the ConfigurationContext * * @throws ServletException */ public void init() throws ServletException { if (this.servletConfig != null && !initCalled) { init(this.servletConfig); } } /** * Initialize the Axis configuration context * * @param config Servlet configuration * @return ConfigurationContext * @throws ServletException */ protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException { try { ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContext(new WarBasedAxisConfigurator(config)); configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE); return configContext; } catch (Exception e) { log.info(e); throw new ServletException(e); } } /** * Set the context root if it is not set already. * * @param req */ public void initContextRoot(HttpServletRequest req) { if (contextRoot != null && contextRoot.trim().length() != 0) { return; } String contextPath = null; // Support older servlet API's try { contextPath = req.getContextPath(); } catch (Throwable t) { log.info("Old Servlet API (Fallback to HttpServletRequest.getServletPath) :" + t); contextPath = req.getServletPath(); } //handling ROOT scenario, for servlets in the default (root) context, this method returns "" if (contextPath != null && contextPath.length() == 0) { contextPath = "/"; } this.contextRoot = contextPath; configContext.setContextRoot(contextRoot); } /** * Get all transport headers. * * @param req * @return Map */ protected Map getTransportHeaders(HttpServletRequest req) { return new TransportHeaders(req); } public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return getEPRsForService(serviceName, ip)[0]; } public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { //RUNNING_PORT String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT); if (port == null) { port = "8080"; } if (ip == null) { try { ip = HttpUtils.getIpAddress(axisConfiguration); if (ip == null) { ip = "localhost"; } } catch (SocketException e) { throw AxisFault.makeFault(e); } } String endpointRefernce = "http://" + ip + ":" + port; if (configContext.getServiceContextPath().startsWith("/")) { endpointRefernce = endpointRefernce + configContext.getServiceContextPath() + "/" + serviceName; } else { endpointRefernce = endpointRefernce + '/' + configContext.getServiceContextPath() + "/" + serviceName; } EndpointReference endpoint = new EndpointReference(endpointRefernce + "/"); return new EndpointReference[]{endpoint}; } /** * init(); start() and stop() wouldn't do anything. * * @param axisConf * @param transprtIn * @throws AxisFault */ public void init(ConfigurationContext axisConf, TransportInDescription transprtIn) throws AxisFault { } public void start() throws AxisFault { } public void stop() throws AxisFault { } /** * @param request * @param response * @param invocationType : If invocationType=true; then this will be used in SOAP message * invocation. If invocationType=false; then this will be used in REST message invocation. * @return MessageContext * @throws IOException */ protected MessageContext createMessageContext(HttpServletRequest request, HttpServletResponse response, boolean invocationType) throws IOException { MessageContext msgContext = configContext.createMessageContext(); String requestURI = request.getRequestURI(); String trsPrefix = null; int sepindex = -1; // Support older servlet API's try { trsPrefix = request.getRequestURL().toString(); } catch (Throwable t){ log.info("Old Servlet API (Fallback to HttpServletRequest.getRequestURI) :" + t); trsPrefix = request.getRequestURI(); } sepindex = trsPrefix.indexOf(':'); if (sepindex > -1) { trsPrefix = trsPrefix.substring(0, sepindex); msgContext.setIncomingTransportName(trsPrefix); } else { msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP); trsPrefix = Constants.TRANSPORT_HTTP; } TransportInDescription transportIn = axisConfiguration.getTransportIn(msgContext.getIncomingTransportName()); //set the default output description. This will be http TransportOutDescription transportOut = axisConfiguration.getTransportOut(trsPrefix); if (transportOut == null) { // if the req coming via https but we do not have a https sender transportOut = axisConfiguration.getTransportOut(Constants.TRANSPORT_HTTP); } msgContext.setTransportIn(transportIn); msgContext.setTransportOut(transportOut); msgContext.setServerSide(true); if (!invocationType) { String query = request.getQueryString(); if (query != null) { requestURI = requestURI + "?" + query; } } msgContext.setTo(new EndpointReference(requestURI)); msgContext.setFrom(new EndpointReference(request.getRemoteAddr())); msgContext.setProperty(MessageContext.REMOTE_ADDR, request.getRemoteAddr()); msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new ServletBasedOutTransportInfo(response)); // set the transport Headers msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request)); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, response); try { ServletContext context = getServletContext(); if(context != null) { msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context); } } catch (Exception e){ log.debug(e.getMessage(), e); } //setting the RequestResponseTransport object msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, new ServletRequestResponseTransport(response)); return msgContext; } /** * This method assumes, that the created MessageContext will be used in only SOAP invocation. * * @param req * @param resp * @return MessageContext * @throws IOException */ protected MessageContext createMessageContext(HttpServletRequest req, HttpServletResponse resp) throws IOException { return createMessageContext(req, resp, true); } /** * Transport session management. * * @param messageContext * @return SessionContext */ public SessionContext getSessionContext(MessageContext messageContext) { HttpServletRequest req = (HttpServletRequest) messageContext.getProperty( HTTPConstants.MC_HTTP_SERVLETREQUEST); SessionContext sessionContext = (SessionContext) req.getSession(true).getAttribute( Constants.SESSION_CONTEXT_PROPERTY); String sessionId = req.getSession().getId(); if (sessionContext == null) { sessionContext = new SessionContext(null); sessionContext.setCookieID(sessionId); req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY, sessionContext); } messageContext.setSessionContext(sessionContext); messageContext.setProperty(SESSION_ID, sessionId); return sessionContext; } protected class ServletRequestResponseTransport implements RequestResponseTransport { private HttpServletResponse response; private boolean responseWritten = false; private CountDownLatch responseReadySignal = new CountDownLatch(1); // The initial status must be WAITING, as the main servlet will do some other // work after setting this RequestResponseTransport up, and we don't want to miss // signals that come in before this thread gets to the awaitResponse call. private RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING; AxisFault faultToBeThrownOut = null; ServletRequestResponseTransport(HttpServletResponse response) { this.response = response; } public void acknowledgeMessage(MessageContext msgContext) throws AxisFault { status = RequestResponseTransportStatus.ACKED; responseReadySignal.countDown(); } public void awaitResponse() throws InterruptedException, AxisFault { log.debug("Blocking servlet thread -- awaiting response"); responseReadySignal.await(); if (faultToBeThrownOut != null) { throw faultToBeThrownOut; } } public void signalResponseReady() { log.debug("Signalling response available"); status = RequestResponseTransportStatus.SIGNALLED; responseReadySignal.countDown(); } public RequestResponseTransportStatus getStatus() { return status; } public void signalFaultReady(AxisFault fault) { faultToBeThrownOut = fault; signalResponseReady(); } public boolean isResponseWritten() { return responseWritten; } public void setResponseWritten(boolean responseWritten) { this.responseWritten = responseWritten; } } private void setResponseState(MessageContext messageContext, HttpServletResponse response) { String state = (String) messageContext.getProperty(Constants.HTTP_RESPONSE_STATE); if (state != null) { int stateInt = Integer.parseInt(state); if (stateInt == HttpServletResponse.SC_UNAUTHORIZED) { // Unauthorized String realm = (String) messageContext.getProperty(Constants.HTTP_BASIC_AUTH_REALM); response.addHeader("WWW-Authenticate", "basic realm=\"" + realm + "\""); } } } /** * Ues in processing REST related Requests. * This is the helper Class use in processing of doGet, doPut , doDelete and doPost. */ protected class RestRequestProcessor { protected MessageContext messageContext; private HttpServletRequest request; private HttpServletResponse response; public RestRequestProcessor(String httpMethodString, HttpServletRequest request, HttpServletResponse response) throws IOException { this.request = request; this.response = response; messageContext = createMessageContext(this.request, this.response, false); messageContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD, httpMethodString); } public void processXMLRequest() throws IOException, ServletException { try { RESTUtil.processXMLRequest(messageContext, request.getInputStream(), response.getOutputStream(), request.getContentType()); this.checkResponseWritten(); } catch (AxisFault axisFault) { processFault(axisFault); } closeStaxBuilder(messageContext); } public void processURLRequest() throws IOException, ServletException { try { RESTUtil.processURLRequest(messageContext, response.getOutputStream(), request.getContentType()); this.checkResponseWritten(); } catch (AxisFault e) { setResponseState(messageContext, response); processFault(e); } closeStaxBuilder(messageContext); } private void checkResponseWritten() { if (!TransportUtils.isResponseWritten(messageContext)) { response.setStatus(HttpServletResponse.SC_ACCEPTED); } } private void processFault(AxisFault e) throws ServletException, IOException { log.debug(e); if (messageContext != null) { processAxisFault(messageContext, response, response.getOutputStream(), e); } else { throw new ServletException(e); } } } } ./src/org/apache/axis2/transport/http/AxisAdminServlet.java0000664000175000017500000000455011767656530023136 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * */ public class AxisAdminServlet extends AxisServlet { protected transient AdminAgent agent; protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res); } protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath()); agent.handle(req, resp); } catch (Exception e) { throw new ServletException(e); } } public void init(ServletConfig config) throws ServletException { super.init(config); ServletContext servletContext = config.getServletContext(); this.configContext = (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT); servletContext.setAttribute(this.getClass().getName(), this); agent = new AdminAgent(configContext); this.servletConfig = config; } public void init() throws ServletException { if (this.servletConfig != null) { init(this.servletConfig); } } } ./src/org/apache/axis2/transport/http/ProxyConfiguration.java0000664000175000017500000004333711767656530023573 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NTCredentials; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import javax.xml.namespace.QName; import java.net.URL; import java.util.StringTokenizer; /** * The purpose of this class is to configure the proxy auth regardles of the protocol. * Proxy will be set only for HTTP connection */ public class ProxyConfiguration { protected String proxyHost; protected String nonProxyHosts; protected int proxyPort = -1; //If port is not set, default is set to -1 protected String proxyUser; protected String proxyPassword; protected static final String HTTP_PROXY_HOST = "http.proxyHost"; protected static final String HTTP_PROXY_PORT = "http.proxyPort"; protected static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts"; protected static final String ATTR_PROXY = "Proxy"; protected static final String PROXY_HOST_ELEMENT = "ProxyHost"; protected static final String PROXY_PORT_ELEMENT = "ProxyPort"; protected static final String PROXY_USER_ELEMENT = "ProxyUser"; protected static final String PROXY_PASSWORD_ELEMENT = "ProxyPassword"; public void configure(MessageContext messageContext, HttpClient httpClient, HostConfiguration config) throws AxisFault { // // // example.org // 5678 // EXAMPLE\saminda // ppp // // Credentials proxyCred = null; //Getting configuration values from Axis2.xml Parameter param = messageContext.getConfigurationContext().getAxisConfiguration() .getParameter(ATTR_PROXY); if (param != null) { OMElement configurationEle = param.getParameterElement().getFirstElement(); if (configurationEle == null) { throw new AxisFault( ProxyConfiguration.class.getName() + " Configuration element is missing"); } OMElement proxyHostEle = configurationEle.getFirstChildWithName(new QName(PROXY_HOST_ELEMENT)); OMElement proxyPortEle = configurationEle.getFirstChildWithName(new QName(PROXY_PORT_ELEMENT)); OMElement proxyUserEle = configurationEle.getFirstChildWithName(new QName(PROXY_USER_ELEMENT)); OMElement proxyPasswordEle = configurationEle.getFirstChildWithName(new QName(PROXY_PASSWORD_ELEMENT)); if (proxyHostEle == null) { throw new AxisFault( ProxyConfiguration.class.getName() + " ProxyHost element is missing"); } String text = proxyHostEle.getText(); if (text == null) { throw new AxisFault( ProxyConfiguration.class.getName() + " ProxyHost's value is missing"); } this.setProxyHost(text); if (proxyPortEle != null) { this.setProxyPort(Integer.parseInt(proxyPortEle.getText())); } if (proxyUserEle != null) { this.setProxyUser(proxyUserEle.getText()); } if (proxyPasswordEle != null) { this.setProxyPassword(proxyPasswordEle.getText()); } if (this.getProxyUser() == null && this.getProxyUser() == null) { proxyCred = new UsernamePasswordCredentials("", ""); } else { proxyCred = new UsernamePasswordCredentials(this.getProxyUser(), this.getProxyPassword()); } // if the username is in the form "DOMAIN\\user" // then use NTCredentials instead. if (this.getProxyUser() != null) { int domainIndex = this.getProxyUser().indexOf("\\"); if (domainIndex > 0) { String domain = this.getProxyUser().substring(0, domainIndex); if (this.getProxyUser().length() > domainIndex + 1) { String user = this.getProxyUser().substring(domainIndex + 1); proxyCred = new NTCredentials(user, this.getProxyPassword(), this.getProxyHost(), domain); } } } } // Overide the property setting in runtime. HttpTransportProperties.ProxyProperties proxyProperties = (HttpTransportProperties.ProxyProperties) messageContext .getProperty(HTTPConstants.PROXY); if (proxyProperties != null) { String host = proxyProperties.getProxyHostName(); if (host == null || host.length() == 0) { throw new AxisFault(ProxyConfiguration.class.getName() + " Proxy host is not available. Host is a MUST parameter"); } else { this.setProxyHost(host); } this.setProxyPort(proxyProperties.getProxyPort()); //Setting credentials String userName = proxyProperties.getUserName(); String password = proxyProperties.getPassWord(); String domain = proxyProperties.getDomain(); if (userName == null && password == null) { proxyCred = new UsernamePasswordCredentials("", ""); } else { proxyCred = new UsernamePasswordCredentials(userName, password); } if (userName != null && password != null && domain != null) { proxyCred = new NTCredentials(userName, password, host, domain); } } //Using Java Networking Properties String host = System.getProperty(HTTP_PROXY_HOST); if (host != null) { this.setProxyHost(host); proxyCred = new UsernamePasswordCredentials("",""); } String port = System.getProperty(HTTP_PROXY_PORT); if (port != null) { this.setProxyPort(Integer.parseInt(port)); } if (proxyCred == null) { throw new AxisFault(ProxyConfiguration.class.getName() + " Minimum proxy credentials are not set"); } httpClient.getState().setProxyCredentials(AuthScope.ANY, proxyCred); config.setProxy(this.getProxyHost(), this.getProxyPort()); } /** * Check first if the proxy is configured or active. * If yes this will return true. This is not a deep check * * @param messageContext * @return boolean */ public static boolean isProxyEnabled(MessageContext messageContext, URL targetURL) throws AxisFault { boolean state = false; Parameter param = messageContext.getConfigurationContext().getAxisConfiguration() .getParameter(ATTR_PROXY); //If configuration is over ridden Object obj = messageContext.getProperty(HTTPConstants.PROXY); //From Java Networking Properties String sp = System.getProperty(HTTP_PROXY_HOST); if (param != null || obj != null || sp != null) { state = true; } boolean isNonProxyHost = validateNonProxyHosts(targetURL.getHost()); return state && !isNonProxyHost; } /** * Validates for names that shouldn't be listered as proxies. * The http.nonProxyHosts can be set to specify the hosts which should be * connected to directly (not through the proxy server). * The value of the http.nonProxyHosts property can be a list of hosts, * each separated by a |; it can also take a regular expression for matches; * for example: *.sfbay.sun.com would match any fully qualified hostname in the sfbay domain. * * For more information refer to : http://java.sun.com/features/2002/11/hilevel_network.html * * false : validation fail : User can use the proxy * true : validation pass ; User can't use the proxy * * @return boolean */ public static boolean validateNonProxyHosts(String host) { //From system property http.nonProxyHosts String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS); return isHostInNonProxyList(host, nonProxyHosts); } /** * Check if the specified host is in the list of non proxy hosts. * * @param host host name * @param nonProxyHosts string containing the list of non proxy hosts * * @return true/false */ public static boolean isHostInNonProxyList(String host, String nonProxyHosts) { if ((nonProxyHosts == null) || (host == null)) { return false; } /* * The http.nonProxyHosts system property is a list enclosed in * double quotes with items separated by a vertical bar. */ StringTokenizer tokenizer = new StringTokenizer(nonProxyHosts, "|\""); while (tokenizer.hasMoreTokens()) { String pattern = tokenizer.nextToken(); if (match(pattern, host, false)) { return true; } } return false; } /** * Matches a string against a pattern. The pattern contains two special * characters: * '*' which means zero or more characters, * * @param pattern the (non-null) pattern to match against * @param str the (non-null) string that must be matched against the * pattern * @param isCaseSensitive * * @return true when the string matches against the pattern, * false otherwise. */ protected static boolean match(String pattern, String str, boolean isCaseSensitive) { char[] patArr = pattern.toCharArray(); char[] strArr = str.toCharArray(); int patIdxStart = 0; int patIdxEnd = patArr.length - 1; int strIdxStart = 0; int strIdxEnd = strArr.length - 1; char ch; boolean containsStar = false; for (int i = 0; i < patArr.length; i++) { if (patArr[i] == '*') { containsStar = true; break; } } if (!containsStar) { // No '*'s, so we make a shortcut if (patIdxEnd != strIdxEnd) { return false; // Pattern and string do not have the same size } for (int i = 0; i <= patIdxEnd; i++) { ch = patArr[i]; if (isCaseSensitive && (ch != strArr[i])) { return false; // Character mismatch } if (!isCaseSensitive && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[i]))) { return false; // Character mismatch } } return true; // String matches against pattern } if (patIdxEnd == 0) { return true; // Pattern contains only '*', which matches anything } // Process characters before first star while ((ch = patArr[patIdxStart]) != '*' && (strIdxStart <= strIdxEnd)) { if (isCaseSensitive && (ch != strArr[strIdxStart])) { return false; // Character mismatch } if (!isCaseSensitive && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart]))) { return false; // Character mismatch } patIdxStart++; strIdxStart++; } if (strIdxStart > strIdxEnd) { // All characters in the string are used. Check if only '*'s are // left in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } // Process characters after last star while ((ch = patArr[patIdxEnd]) != '*' && (strIdxStart <= strIdxEnd)) { if (isCaseSensitive && (ch != strArr[strIdxEnd])) { return false; // Character mismatch } if (!isCaseSensitive && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd]))) { return false; // Character mismatch } patIdxEnd--; strIdxEnd--; } if (strIdxStart > strIdxEnd) { // All characters in the string are used. Check if only '*'s are // left in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } // process pattern between stars. padIdxStart and patIdxEnd point // always to a '*'. while ((patIdxStart != patIdxEnd) && (strIdxStart <= strIdxEnd)) { int patIdxTmp = -1; for (int i = patIdxStart + 1; i <= patIdxEnd; i++) { if (patArr[i] == '*') { patIdxTmp = i; break; } } if (patIdxTmp == patIdxStart + 1) { // Two stars next to each other, skip the first one. patIdxStart++; continue; } // Find the pattern between padIdxStart & padIdxTmp in str between // strIdxStart & strIdxEnd int patLength = (patIdxTmp - patIdxStart - 1); int strLength = (strIdxEnd - strIdxStart + 1); int foundIdx = -1; strLoop: for (int i = 0; i <= strLength - patLength; i++) { for (int j = 0; j < patLength; j++) { ch = patArr[patIdxStart + j + 1]; if (isCaseSensitive && (ch != strArr[strIdxStart + i + j])) { continue strLoop; } if (!isCaseSensitive && (Character .toUpperCase(ch) != Character .toUpperCase(strArr[strIdxStart + i + j]))) { continue strLoop; } } foundIdx = strIdxStart + i; break; } if (foundIdx == -1) { return false; } patIdxStart = patIdxTmp; strIdxStart = foundIdx + patLength; } // All characters in the string are used. Check if only '*'s are left // in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } /** * Retrun proxy host * * @return String */ public String getProxyHost() { return proxyHost; } /** * set proxy host * * @param proxyHost */ public void setProxyHost(String proxyHost) { this.proxyHost = proxyHost; } /** * retrun proxy port * * @return String */ public int getProxyPort() { return proxyPort; } /** * set proxy port * * @param proxyPort */ public void setProxyPort(int proxyPort) { this.proxyPort = proxyPort; } /** * return proxy user. Proxy user can be user/domain or user * * @return String */ public String getProxyUser() { return proxyUser; } /** * get proxy user * * @param proxyUser */ public void setProxyUser(String proxyUser) { this.proxyUser = proxyUser; } /** * set password * * @return String */ public String getProxyPassword() { return proxyPassword; } /** * get password * * @param proxyPassword */ public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; } } ./src/org/apache/axis2/transport/http/ListingAgent.java0000664000175000017500000004463311767656530022312 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.util.ExternalPolicySerializer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import org.apache.neethi.PolicyRegistry; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.List; public class ListingAgent extends AbstractAgent { private static final Log log = LogFactory.getLog(ListingAgent.class); private static final String LIST_MULTIPLE_SERVICE_JSP_NAME = "listServices.jsp"; private static final String LIST_SINGLE_SERVICE_JSP_NAME = "listSingleService.jsp"; private static final String LIST_FAULTY_SERVICES_JSP_NAME = "listFaultyService.jsp"; public static final String RUNNING_PORT = "RUNNING_PORT"; public ListingAgent(ConfigurationContext aConfigContext) { super(aConfigContext); } private void addTransportListener(String schema, int port) { try { TransportInDescription trsIn = configContext.getAxisConfiguration().getTransportIn(schema); if (trsIn == null) { trsIn = new TransportInDescription(schema); CustomListener httspReceiver = new CustomListener(port, schema); httspReceiver.init(configContext, trsIn); trsIn.setReceiver(httspReceiver); configContext.getListenerManager().addListener(trsIn, true); } } catch (AxisFault axisFault) { // } } public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { initTransportListener(httpServletRequest); String query = httpServletRequest.getQueryString(); if (query != null) { if (query.indexOf("wsdl2") > 0 || query.indexOf("wsdl") > 0 || query.indexOf("xsd") > 0 || query.indexOf("policy") > 0) { processListService(httpServletRequest, httpServletResponse); } else { super.handle(httpServletRequest, httpServletResponse); } } else { super.handle(httpServletRequest, httpServletResponse); } } protected void initTransportListener(HttpServletRequest httpServletRequest) { // httpServletRequest.getLocalPort() , giving me a build error so I had to use the followin String filePart; try { filePart = httpServletRequest.getRequestURL().toString(); } catch (Throwable t){ log.info("Old Servlet API (fallback to HttpServletRequest.getRequestURI) :" + t); filePart = httpServletRequest.getRequestURI(); } int ipindex = filePart.indexOf("//"); String ip; if (ipindex >= 0) { ip = filePart.substring(ipindex + 2, filePart.length()); int seperatorIndex = ip.indexOf(":"); int slashIndex = ip.indexOf("/"); String portstr; if (seperatorIndex >= 0) { portstr = ip.substring(seperatorIndex + 1, slashIndex); } else { portstr = "80"; } try { addTransportListener(httpServletRequest.getScheme(), Integer.parseInt(portstr)); } catch (NumberFormatException e) { log.debug(e.toString(), e); } } } protected void processListFaultyServices(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String serviceName = req.getParameter("serviceName"); if (serviceName != null) { AxisService service = configContext.getAxisConfiguration().getService(serviceName); try { req.getSession().setAttribute(Constants.SINGLE_SERVICE, service); } catch (Throwable t) { log.info("Old Servlet API :" + t); } } renderView(LIST_FAULTY_SERVICES_JSP_NAME, req, res); } protected void processIndex(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { processListServices(httpServletRequest, httpServletResponse); } private String extractHostAndPort(String filePart, boolean isHttp) { int ipindex = filePart.indexOf("//"); String ip = null; if (ipindex >= 0) { ip = filePart.substring(ipindex + 2, filePart.length()); int seperatorIndex = ip.indexOf(":"); int slashIndex = ip.indexOf("/"); String port; if (seperatorIndex >= 0) { port = ip.substring(seperatorIndex + 1, slashIndex); ip = ip.substring(0, seperatorIndex); } else { ip = ip.substring(0, slashIndex); port = "80"; } if (isHttp) { configContext.setProperty(RUNNING_PORT, port); } } return ip; } public void processExplicitSchemaAndWSDL(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap services = configContext.getAxisConfiguration().getServices(); String filePart = req.getRequestURL().toString(); String schema = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length()); if ((services != null) && !services.isEmpty()) { Iterator i = services.values().iterator(); while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = service.getClassLoader().getResourceAsStream("META-INF/" + schema); if (stream != null) { OutputStream out = res.getOutputStream(); res.setContentType("text/xml"); copy(stream, out); out.flush(); out.close(); return; } } } } /** * Copies the input stream to the output stream * * @param stream the InputStream * @param ostream the OutputStream */ public static void copy(InputStream stream, OutputStream ostream) throws IOException { int nextValue = stream.read(); while (-1 != nextValue) { ostream.write(nextValue); nextValue = stream.read(); } } public String extractServiceName(String urlString) { int n = urlString.indexOf(configContext.getServiceContextPath()); if (n != -1) { String serviceName = urlString.substring(n + configContext.getServiceContextPath().length(), urlString.length()); if (serviceName.length() > 0) { if(serviceName.charAt(0)=='/'){ serviceName = serviceName.substring(1); } return serviceName; } } return urlString.substring(urlString.lastIndexOf("/") + 1, urlString.length()); } public void processListService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String url; try { url = req.getRequestURL().toString(); } catch (Throwable t) { log.info("Old Servlet API (Fallback to HttpServletRequest.getRequestURI) :" + t); url = req.getRequestURI(); } String serviceName = extractServiceName(url); HashMap services = configContext.getAxisConfiguration().getServices(); String query = req.getQueryString(); int wsdl2 = query.indexOf("wsdl2"); int wsdl = query.indexOf("wsdl"); int xsd = query.indexOf("xsd"); int policy = query.indexOf("policy"); if ((services != null) && !services.isEmpty()) { Object serviceObj = services.get(serviceName); if (serviceObj != null) { boolean isHttp = "http".equals(req.getScheme()); if (wsdl2 >= 0) { res.setContentType("text/xml"); String ip = extractHostAndPort(url, isHttp); String wsdlName = req.getParameter("wsdl2"); if (wsdlName != null && wsdlName.length()>0) { InputStream in = ((AxisService) serviceObj).getClassLoader() .getResourceAsStream(DeploymentConstants.META_INF + "/" + wsdlName); if (in != null) { OutputStream out = res.getOutputStream(); out.write(IOUtils.getStreamAsByteArray(in)); out.flush(); out.close(); } else { res.sendError(HttpServletResponse.SC_NOT_FOUND); } } else { OutputStream out = res.getOutputStream(); ((AxisService) serviceObj) .printWSDL2(out, ip); out.flush(); out.close(); } return; } else if (wsdl >= 0) { OutputStream out = res.getOutputStream(); res.setContentType("text/xml"); String ip = extractHostAndPort(url, isHttp); String wsdlName = req.getParameter("wsdl"); if (wsdlName != null && wsdlName.length()>0) { AxisService axisServce = (AxisService) serviceObj; axisServce.printUserWSDL(out, wsdlName); out.flush(); out.close(); } else { ((AxisService) serviceObj).printWSDL(out, ip); out.flush(); out.close(); } return; } else if (xsd >= 0) { res.setContentType("text/xml"); int ret = ((AxisService) serviceObj).printXSD(res.getOutputStream(), req.getParameter("xsd")); if (ret == 0) { //multiple schemas are present and the user specified //no name - in this case we cannot possibly pump a schema //so redirect to the service root res.sendRedirect(""); } else if (ret == -1) { res.sendError(HttpServletResponse.SC_NOT_FOUND); } return; } else if (policy >= 0) { ExternalPolicySerializer serializer = new ExternalPolicySerializer(); serializer.setAssertionsToFilter(configContext .getAxisConfiguration().getLocalPolicyAssertions()); // check whether Id is set String idParam = req.getParameter("id"); if (idParam != null) { // Id is set Policy targetPolicy = findPolicy(idParam, (AxisService) serviceObj); if (targetPolicy != null) { XMLStreamWriter writer; try { OutputStream out = res.getOutputStream(); writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(out); res.setContentType("application/wspolicy+xml"); targetPolicy.serialize(writer); writer.flush(); } catch (XMLStreamException e) { throw new ServletException( "Error occured when serializing the Policy", e); } catch (FactoryConfigurationError e) { throw new ServletException( "Error occured when serializing the Policy", e); } } else { OutputStream out = res.getOutputStream(); res.setContentType("text/html"); String outStr = "No policy found for id=" + idParam + ""; out.write(outStr.getBytes()); } } else { PolicyInclude policyInclude = ((AxisService) serviceObj).getPolicyInclude(); Policy effecPolicy = policyInclude.getEffectivePolicy(); if (effecPolicy != null) { XMLStreamWriter writer; try { OutputStream out = res.getOutputStream(); writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(out); res.setContentType("application/wspolicy+xml"); effecPolicy.serialize(writer); writer.flush(); } catch (XMLStreamException e) { throw new ServletException( "Error occured when serializing the Policy", e); } catch (FactoryConfigurationError e) { throw new ServletException( "Error occured when serializing the Policy", e); } } else { OutputStream out = res.getOutputStream(); res.setContentType("text/html"); String outStr = "No effective policy for " + serviceName + " servcie"; out.write(outStr.getBytes()); } } return; } else { try { req.getSession().setAttribute(Constants.SINGLE_SERVICE, serviceObj); } catch (Throwable t) { log.info("Old Servlet API :" + t); } } } else { try { req.getSession().setAttribute(Constants.SINGLE_SERVICE, null); } catch (Throwable t){ log.info("Old Servlet API :" + t); } res.sendError(HttpServletResponse.SC_NOT_FOUND, url); } } renderView(LIST_SINGLE_SERVICE_JSP_NAME, req, res); } protected void processListServices(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { populateSessionInformation(req); try { req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP, configContext.getAxisConfiguration().getFaultyServices()); } catch (Throwable t){ log.info("Old Servlet API :" + t); } renderView(LIST_MULTIPLE_SERVICE_JSP_NAME, req, res); } private Policy findPolicy(String id, AxisDescription des) { List policyElements = des.getPolicyInclude().getPolicyElements(); PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry(); Object policyComponent; Policy policy = registry.lookup(id); if (policy != null) { return policy; } for (Iterator iterator = policyElements.iterator(); iterator.hasNext();) { policyComponent = iterator.next(); if (policyComponent instanceof Policy) { // policy found for the id if (id.equals(((Policy) policyComponent).getId())) { return (Policy) policyComponent; } } } AxisDescription child; for (Iterator iterator = des.getChildren(); iterator.hasNext();) { child = (AxisDescription) iterator.next(); policy = findPolicy(id, child); if (policy != null) { return policy; } } return null; } } ./src/org/apache/axis2/transport/http/SOAPMessageFormatter.java0000664000175000017500000002315111767656530023645 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.MIMEOutputUtils; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.http.util.URLTemplatingUtil; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.StringWriter; import java.net.URL; public class SOAPMessageFormatter implements MessageFormatter { private static final Log log = LogFactory.getLog(SOAPMessageFormatter.class); public void writeTo(MessageContext msgCtxt, OMOutputFormat format, OutputStream out, boolean preserve) throws AxisFault { if (log.isDebugEnabled()) { log.debug("start writeTo()"); log.debug(" preserve=" + preserve); log.debug(" isOptimized=" + format.isOptimized()); log.debug(" isDoingSWA=" + format.isDoingSWA()); } OMElement element = msgCtxt.getEnvelope(); int optimizedThreshold = Utils.getMtomThreshold(msgCtxt); if(optimizedThreshold > 0){ if(log.isDebugEnabled()){ log.debug("Setting MTOM optimized Threshold Value on OMOutputFormat"); } format.setOptimizedThreshold(optimizedThreshold); } try { if (!(format.isOptimized()) & format.isDoingSWA()) { StringWriter bufferedSOAPBody = new StringWriter(); if (preserve) { element.serialize(bufferedSOAPBody, format); } else { element.serializeAndConsume(bufferedSOAPBody, format); } writeSwAMessage(msgCtxt, bufferedSOAPBody, out, format); } else { if (preserve) { element.serialize(out, format); } else { element.serializeAndConsume(out, format); } } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } finally { if (log.isDebugEnabled()) { log.debug("end writeTo()"); } } } public byte[] getBytes(MessageContext msgCtxt, OMOutputFormat format) throws AxisFault { if (log.isDebugEnabled()) { log.debug("start getBytes()"); log.debug(" isOptimized=" + format.isOptimized()); log.debug(" isDoingSWA=" + format.isDoingSWA()); } OMElement element = msgCtxt.getEnvelope(); try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); if (!format.isOptimized()) { if (format.isDoingSWA()) { // Why are we creating a new OMOutputFormat OMOutputFormat format2 = new OMOutputFormat(); format2.setCharSetEncoding(format.getCharSetEncoding()); StringWriter bufferedSOAPBody = new StringWriter(); element.serializeAndConsume(bufferedSOAPBody, format2); writeSwAMessage(msgCtxt, bufferedSOAPBody, bytesOut, format); } else { element.serializeAndConsume(bytesOut, format); } return bytesOut.toByteArray(); } else { element.serializeAndConsume(bytesOut, format); return bytesOut.toByteArray(); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } finally { if (log.isDebugEnabled()) { log.debug("end getBytes()"); } } } public String getContentType(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (log.isDebugEnabled()) { log.debug("contentType from the OMOutputFormat =" + contentType); } if (encoding != null && contentType != null && contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED)==-1) { contentType += "; charset=" + encoding; } // action header is not mandated in SOAP 1.2. So putting it, if // available if (!msgCtxt.isSOAP11() && (soapActionString != null) && !"".equals(soapActionString.trim()) && !"\"\"".equals(soapActionString.trim())) { contentType = contentType + "; action=\"" + soapActionString+ "\""; } // This is a quick safety catch. Prior versions of SOAPFormatter // placed a ';' at the end of the content-type. Many vendors ignore this // last ';'. However it is not legal and some vendors report an error. // To increase interoperability, the ';' is stripped off. contentType = contentType.trim(); if (contentType.lastIndexOf(";") == (contentType.length()-1)) { contentType = contentType.substring(0, contentType.length()-1); } if (log.isDebugEnabled()) { log.debug("contentType returned =" + contentType); } return contentType; } public String formatSOAPAction(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { // if SOAP 1.2 we attach the soap action to the content-type // No need to set it as a header. if (msgCtxt.isSOAP11()) { if ("".equals(soapActionString)) { return "\"\""; } else { if (soapActionString != null && !soapActionString.startsWith("\"")) { // SOAPAction string must be a quoted string soapActionString = "\"" + soapActionString + "\""; } return soapActionString; } } return null; } public URL getTargetAddress(MessageContext msgCtxt, OMOutputFormat format, URL targetURL) throws AxisFault { // Check whether there is a template in the URL, if so we have to replace then with data // values and create a new target URL. targetURL = URLTemplatingUtil.getTemplatedURL(targetURL, msgCtxt, false); return targetURL; } private void writeSwAMessage(MessageContext msgCtxt, StringWriter bufferedSOAPBody, OutputStream outputStream, OMOutputFormat format) { if (log.isDebugEnabled()) { log.debug("start writeSwAMessage()"); } Object property = msgCtxt .getProperty(Constants.Configuration.MM7_COMPATIBLE); boolean MM7CompatMode = false; if (property != null) { MM7CompatMode = JavaUtils.isTrueExplicitly(property); } if (!MM7CompatMode) { MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody, outputStream, msgCtxt.getAttachmentMap(), format); } else { String innerBoundary; String partCID; Object innerBoundaryProperty = msgCtxt .getProperty(Constants.Configuration.MM7_INNER_BOUNDARY); if (innerBoundaryProperty != null) { innerBoundary = (String) innerBoundaryProperty; } else { innerBoundary = "innerBoundary" + UUIDGenerator.getUUID().replace(':', '_'); } Object partCIDProperty = msgCtxt .getProperty(Constants.Configuration.MM7_PART_CID); if (partCIDProperty != null) { partCID = (String) partCIDProperty; } else { partCID = "innerCID" + UUIDGenerator.getUUID().replace(':', '_'); } MIMEOutputUtils.writeMM7Message(bufferedSOAPBody, outputStream, msgCtxt.getAttachmentMap(), format, partCID, innerBoundary); } if (log.isDebugEnabled()) { log.debug("end writeSwAMessage()"); } } } ./src/org/apache/axis2/transport/http/HttpTransportProperties.java0000664000175000017500000001535511767656530024632 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.auth.AuthPolicy; import org.apache.commons.httpclient.auth.AuthScope; import java.util.List; import java.util.Properties; /** * Utility bean for setting transport properties in runtime. */ public class HttpTransportProperties { protected boolean chunked; protected HttpVersion httpVersion; protected String protocol; public HttpTransportProperties() { } public boolean getChunked() { return chunked; } public HttpVersion getHttpVersion() { return httpVersion; } public String getProtocol() { return protocol; } public void setChunked(boolean chunked) { this.chunked = chunked; } public void setHttpVersion(HttpVersion httpVerion) { this.httpVersion = httpVerion; } public void setProtocol(String protocol) { this.protocol = protocol; } public static class ProxyProperties { protected int proxyPort = -1; protected String domain = null; protected String passWord = null; protected String proxyHostName = null; protected String userName = null; public ProxyProperties() { } public String getDomain() { return domain; } public String getPassWord() { return passWord; } public String getProxyHostName() { return proxyHostName; } public int getProxyPort() { return proxyPort; } public String getUserName() { return userName; } public void setDomain(String domain) { this.domain = domain; } public void setPassWord(String passWord) { this.passWord = passWord; } public void setProxyName(String proxyHostName) { this.proxyHostName = proxyHostName; } public void setProxyPort(int proxyPort) { this.proxyPort = proxyPort; } public void setUserName(String userName) { this.userName = userName; } } /* This class is responsible for holding all the necessary information needed for NTML, Digest and Basic Authentication. Authentication itself is handled by httpclient. User doesn't need to warry about what authentication mechanism it uses. Axis2 uses httpclinet's default authentication patterns. */ public static class Authenticator { /*host that needed to be authenticated with*/ private String host; /*port of the host that needed to be authenticated with*/ private int port = AuthScope.ANY_PORT; /*Realm for authentication scope*/ private String realm = AuthScope.ANY_REALM; /*Domain needed by NTCredentials for NT Domain*/ private String domain; /*User for authenticate*/ private String username; /*Password of the user for authenticate*/ private String password; /* Switch to use preemptive authentication or not*/ private boolean preemptive = false; /* if Authentication scheme needs retry just turn on the following flag */ private boolean allowedRetry = false; /* Changing the priorty or adding a custom AuthPolicy*/ private List authSchemes; /* Default Auth Schems*/ public static final String NTLM = AuthPolicy.NTLM; public static final String DIGEST = AuthPolicy.DIGEST; public static final String BASIC = AuthPolicy.BASIC; public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getRealm() { return realm; } public void setRealm(String realm) { this.realm = realm; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void setPreemptiveAuthentication(boolean preemptive) { this.preemptive = preemptive; } public boolean getPreemptiveAuthentication() { return this.preemptive; } public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain; } public void setAuthSchemes(List authSchemes) { this.authSchemes = authSchemes; } public List getAuthSchemes() { return this.authSchemes; } public void setAllowedRetry(boolean allowedRetry) { this.allowedRetry = allowedRetry; } public boolean isAllowedRetry() { return this.allowedRetry; } } /** * @deprecated org.apache.axis2.transport.http.HttpTransportProperties.MailProperties has been * deprecated and user are encourage the use of java.util.Properties instead. */ public static class MailProperties { final Properties mailProperties = new Properties(); private String password; public void addProperty(String key, String value) { mailProperties.put(key, value); } public void deleteProperty(String key) { mailProperties.remove(key); } public Properties getProperties() { return mailProperties; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } } ./src/org/apache/axis2/transport/http/HTTPWorkerFactory.java0000664000175000017500000000217711767656530023220 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.transport.http.server.Worker; import org.apache.axis2.transport.http.server.WorkerFactory; public class HTTPWorkerFactory implements WorkerFactory { public HTTPWorkerFactory() { super(); } public Worker newWorker() { return new HTTPWorker(); } } ./src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java0000664000175000017500000000272411767656530025521 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.transport.OutTransportInfo; import javax.servlet.http.HttpServletResponse; public class ServletBasedOutTransportInfo implements OutTransportInfo { private HttpServletResponse response; public ServletBasedOutTransportInfo(HttpServletResponse response) { this.response = response; } public void setContentType(String contentType) { response.setContentType(contentType); } public void addHeader(String headerName, String headerValue) { response.addHeader(headerName, headerValue); } public void setStatus(int status) { response.setStatus(status); } } ./src/org/apache/axis2/transport/http/RESTRequestEntity.java0000664000175000017500000001122011767656530023227 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.commons.httpclient.methods.RequestEntity; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; public class RESTRequestEntity implements RequestEntity { private byte[] bytes; private String charSetEnc; private boolean chunked; private OMElement element; private MessageContext msgCtxt; private String soapActionString; private OMOutputFormat format; public RESTRequestEntity(OMElement element, boolean chunked, MessageContext msgCtxt, String charSetEncoding, String soapActionString, OMOutputFormat format) { this.element = element; this.chunked = chunked; this.msgCtxt = msgCtxt; this.charSetEnc = charSetEncoding; this.soapActionString = soapActionString; this.format = format; } private void handleOMOutput(OutputStream out, boolean doingMTOM) throws XMLStreamException { format.setDoOptimize(doingMTOM); element.serializeAndConsume(out, format); } public byte[] writeBytes() throws AxisFault { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); if (!format.isOptimized()) { OMOutputFormat format2 = new OMOutputFormat(); format2.setCharSetEncoding(charSetEnc); element.serializeAndConsume(bytesOut, format2); return bytesOut.toByteArray(); } else { format.setCharSetEncoding(charSetEnc); format.setDoOptimize(true); element.serializeAndConsume(bytesOut, format); return bytesOut.toByteArray(); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } } public void writeRequest(OutputStream out) throws IOException { try { if (chunked) { this.handleOMOutput(out, format.isDoingSWA()); } else { if (bytes == null) { bytes = writeBytes(); } out.write(bytes); } out.flush(); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } } public long getContentLength() { try { if (chunked) { return -1; } else { if (bytes == null) { bytes = writeBytes(); } return bytes.length; } } catch (AxisFault e) { return -1; } } public String getContentType() { String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (encoding != null) { contentType += "; charset=" + encoding; } // action header is not mandated in SOAP 1.2. So putting it, if available if (!msgCtxt.isSOAP11() && (soapActionString != null) && !"".equals(soapActionString.trim()) && !"\"\"".equals(soapActionString.trim())) { contentType = contentType + ";action=\"" + soapActionString + "\";"; } return contentType; } public boolean isRepeatable() { return true; } } ./src/org/apache/axis2/transport/http/AxisRequestEntity.java0000664000175000017500000000764711767656530023400 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.util.JavaUtils; import org.apache.commons.httpclient.methods.RequestEntity; import javax.xml.stream.FactoryConfigurationError; import java.io.IOException; import java.io.OutputStream; import java.util.zip.GZIPOutputStream; /** * This Request Entity is used by the HTTPCommonsTransportSender. This wraps the * Axis2 message formatter object. */ public class AxisRequestEntity implements RequestEntity { private MessageFormatter messageFormatter; private boolean chunked = false; private MessageContext messageContext; private byte[] bytes; private boolean isAllowedRetry; private OMOutputFormat format; private String soapAction; /** * Method calls to this request entity are delegated to the following Axis2 * message formatter object. * * @param messageFormatter */ public AxisRequestEntity(MessageFormatter messageFormatter, MessageContext msgContext, OMOutputFormat format, String soapAction, boolean chunked, boolean isAllowedRetry) { this.messageFormatter = messageFormatter; this.messageContext = msgContext; this.chunked = chunked; this.isAllowedRetry = isAllowedRetry; this.format = format; this.soapAction = soapAction; } public boolean isRepeatable() { // All Axis2 request entity implementations were returning this true // So we return true as defualt return true; } public void writeRequest(OutputStream outStream) throws IOException { Object gzip = messageContext.getOptions().getProperty(HTTPConstants.MC_GZIP_REQUEST); if (gzip != null && JavaUtils.isTrueExplicitly(gzip) && chunked) { outStream = new GZIPOutputStream(outStream); } try { if (chunked) { messageFormatter.writeTo(messageContext, format, outStream, isAllowedRetry); } else { if (bytes == null) { bytes = messageFormatter.getBytes(messageContext, format); } outStream.write(bytes); } if (outStream instanceof GZIPOutputStream) { ((GZIPOutputStream) outStream).finish(); } outStream.flush(); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } } public long getContentLength() { if (chunked) { return -1; } if (bytes == null) { try { bytes = messageFormatter.getBytes(messageContext, format); } catch (AxisFault e) { return -1; } } return bytes.length; } public String getContentType() { return messageFormatter.getContentType(messageContext, format, soapAction); } } ./src/org/apache/axis2/transport/http/MultipartFormDataFormatter.java0000664000175000017500000001767011767656530025206 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.http.util.ComplexPart; import org.apache.axis2.transport.http.util.URLTemplatingUtil; import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.methods.multipart.StringPart; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; /** * Formates the request message as multipart/form-data. An example of this serialization is shown * below which was extracted from the Web Services Description Language (WSDL) Version 2.0 Part 2: Adjuncts *

    * The following instance data of an input message: *

    * * * Fréjus * France * * @@@@-@@-@@ * *

    * with the following operation element *

    * *

    * will serialize the message as follow: *

    * Content-Type: multipart/form-data; boundary=AaB03x * Content-Length: xxx *

    * --AaB03x * Content-Disposition: form-data; name="town" * Content-Type: application/xml *

    * * Fréjus * France * * --AaB03x * Content-Disposition: form-data; name="date" * Content-Type: text/plain; charset=utf-8 * * @@@@-@@-@@ --AaB03x-- */ public class MultipartFormDataFormatter implements MessageFormatter { /** * @return a byte array of the message formatted according to the given * message format. */ public byte[] getBytes(MessageContext messageContext, OMOutputFormat format) throws AxisFault { OMElement omElement = messageContext.getEnvelope().getBody().getFirstElement(); Part[] parts = createMultipatFormDataRequest(omElement); if (parts.length > 0) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); try { // This is accessing a class of Commons-FlieUpload Part.sendParts(bytesOut, parts, format.getMimeBoundary().getBytes()); } catch (IOException e) { throw AxisFault.makeFault(e); } return bytesOut.toByteArray(); } return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. } /** * To support deffered writing transports as in http chunking.. Axis2 was * doing this for some time.. *

    * Preserve flag can be used to preserve the envelope for later use. This is * usefull when implementing authentication machnisms like NTLM. * * @param outputStream * @param preserve : * do not consume the OM when this is set.. */ public void writeTo(MessageContext messageContext, OMOutputFormat format, OutputStream outputStream, boolean preserve) throws AxisFault { try { byte[] b = getBytes(messageContext, format); if (b != null && b.length > 0) { outputStream.write(b); } else { outputStream.flush(); } } catch (IOException e) { throw new AxisFault("An error occured while writing the request"); } } /** * Different message formats can set their own content types * Eg: JSONFormatter can set the content type as application/json * * @param messageContext * @param format * @param soapAction */ public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction) { String contentType = HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA; String encoding = format.getCharSetEncoding(); if (encoding != null) { contentType += "; charset=" + encoding; } contentType = contentType + "; " + "boundary=" + format.getMimeBoundary(); return contentType; } /** * Some message formats may want to alter the target url. * * @return the target URL */ public URL getTargetAddress(MessageContext messageContext, OMOutputFormat format, URL targetURL) throws AxisFault { // Check whether there is a template in the URL, if so we have to replace then with data // values and create a new target URL. targetURL = URLTemplatingUtil.getTemplatedURL(targetURL, messageContext, false); return targetURL; } /** * @return this only if you want set a transport header for SOAP Action */ public String formatSOAPAction(MessageContext messageContext, OMOutputFormat format, String soapAction) { return soapAction; } /** * @param dataOut * @return */ private Part[] createMultipatFormDataRequest(OMElement dataOut) { ArrayList parts = new ArrayList(); if (dataOut != null) { Iterator iter1 = dataOut.getChildElements(); OMFactory omFactory = OMAbstractFactory.getOMFactory(); while (iter1.hasNext()) { OMElement ele = (OMElement) iter1.next(); Iterator iter2 = ele.getChildElements(); // check whether the element is a complex type if (iter2.hasNext()) { OMElement omElement = omFactory.createOMElement(ele.getQName().getLocalPart(), null); omElement.addChild( processComplexType(omElement, ele.getChildElements(), omFactory)); parts.add(new ComplexPart(ele.getQName().getLocalPart(), omElement.toString())); } else { parts.add(new StringPart(ele.getQName().getLocalPart(), ele.getText())); } } } Part[] partsArray = new Part[parts.size()]; return (Part[]) parts.toArray(partsArray); } /** * @param parent * @param iter * @param omFactory * @return */ private OMElement processComplexType(OMElement parent, Iterator iter, OMFactory omFactory) { OMElement omElement = null; while (iter.hasNext()) { OMElement ele = (OMElement) iter.next(); omElement = omFactory.createOMElement(ele.getQName().getLocalPart(), null); Iterator iter2 = ele.getChildElements(); if (iter2.hasNext()) { parent.addChild(processComplexType(omElement, ele.getChildElements(), omFactory)); } else { omElement = omFactory.createOMElement(ele.getQName().getLocalPart(), null); omElement.setText(ele.getText()); parent.addChild(omElement); } } return omElement; } } ./src/org/apache/axis2/transport/http/server/0000775000175000017500000000000011767656530020353 5ustar brianbrian./src/org/apache/axis2/transport/http/server/AxisHttpService.java0000664000175000017500000003610711767656530024312 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.Header; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpResponseFactory; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.MethodNotSupportedException; import org.apache.http.ProtocolException; import org.apache.http.ProtocolVersion; import org.apache.http.RequestLine; import org.apache.http.UnsupportedHttpVersionException; import org.apache.http.params.DefaultedHttpParams; import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpProcessor; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.SocketException; import java.util.HashMap; import java.util.Iterator; /** * This class is an extension of the default HTTP service responsible for * maintaining and populating the {@link MessageContext} for incoming Axis * requests. */ public class AxisHttpService { private static final Log LOG = LogFactory.getLog(AxisHttpService.class); private final HttpProcessor httpProcessor; private final ConnectionReuseStrategy connStrategy; private final HttpResponseFactory responseFactory; private final ConfigurationContext configurationContext; private final Worker worker; private HttpParams params; public AxisHttpService( final HttpProcessor httpProcessor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final ConfigurationContext configurationContext, final Worker worker) { super(); if (httpProcessor == null) { throw new IllegalArgumentException("HTTP processor may not be null"); } if (connStrategy == null) { throw new IllegalArgumentException("Connection strategy may not be null"); } if (responseFactory == null) { throw new IllegalArgumentException("Response factory may not be null"); } if (worker == null) { throw new IllegalArgumentException("Worker may not be null"); } if (configurationContext == null) { throw new IllegalArgumentException("Configuration context may not be null"); } this.httpProcessor = httpProcessor; this.connStrategy = connStrategy; this.responseFactory = responseFactory; this.configurationContext = configurationContext; this.worker = worker; } public HttpParams getParams() { return this.params; } public void setParams(final HttpParams params) { this.params = params; } public void handleRequest(final AxisHttpConnection conn, final HttpContext context) throws IOException, HttpException { MessageContext msgContext = configurationContext.createMessageContext(); msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP); if (conn != null) { msgContext.setProperty(MessageContext.REMOTE_ADDR, conn.getRemoteAddress().getHostAddress()); msgContext.setProperty(MessageContext.TRANSPORT_ADDR, conn.getLocalAddress().getHostAddress()); if (LOG.isDebugEnabled()) { LOG.debug("Remote address of the connection : " + conn.getRemoteAddress().getHostAddress()); } } HttpResponse response; try { HttpRequest request = conn.receiveRequest(); RequestLine requestLine = request.getRequestLine(); if (requestLine != null) { msgContext.setProperty(HTTPConstants.HTTP_METHOD, requestLine.getMethod()); } request.setParams( new DefaultedHttpParams(request.getParams(), this.params)); ProtocolVersion ver = request.getRequestLine().getProtocolVersion(); if (!ver.lessEquals(HttpVersion.HTTP_1_1)) { // Downgrade protocol version if greater than HTTP/1.1 ver = HttpVersion.HTTP_1_1; } response = this.responseFactory.newHttpResponse (ver, HttpStatus.SC_OK, context); response.setParams( new DefaultedHttpParams(response.getParams(), this.params)); if (request instanceof HttpEntityEnclosingRequest) { if (((HttpEntityEnclosingRequest) request).expectContinue()) { HttpResponse ack = this.responseFactory.newHttpResponse (ver, HttpStatus.SC_CONTINUE, context); ack.setParams( new DefaultedHttpParams(ack.getParams(), this.params)); conn.sendResponse(ack); conn.flush(); } } // Create Axis request and response objects AxisHttpRequestImpl axisreq = new AxisHttpRequestImpl( conn, request, this.httpProcessor, context); AxisHttpResponseImpl axisres = new AxisHttpResponseImpl( conn, response, this.httpProcessor, context); // Prepare HTTP request axisreq.prepare(); // Run the service doService(axisreq, axisres, context, msgContext); // Make sure the request content is fully consumed InputStream instream = conn.getInputStream(); if (instream != null) { instream.close(); } // Commit response if not committed if (!axisres.isCommitted()) { axisres.commit(); } // Make sure the response content is properly terminated OutputStream outstream = conn.getOutputStream(); if (outstream != null) { outstream.close(); } } catch (HttpException ex) { response = this.responseFactory.newHttpResponse (HttpVersion.HTTP_1_0, HttpStatus.SC_INTERNAL_SERVER_ERROR, context); response.setParams( new DefaultedHttpParams(response.getParams(), this.params)); handleException(ex, response); this.httpProcessor.process(response, context); conn.sendResponse(response); } conn.flush(); if (!this.connStrategy.keepAlive(response, context)) { conn.close(); } else { conn.reset(); } } protected void handleException(final HttpException ex, final HttpResponse response) { if (ex instanceof MethodNotSupportedException) { response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED); } else if (ex instanceof UnsupportedHttpVersionException) { response.setStatusCode(HttpStatus.SC_HTTP_VERSION_NOT_SUPPORTED); } else if (ex instanceof ProtocolException) { response.setStatusCode(HttpStatus.SC_BAD_REQUEST); } else { response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); } } protected void doService( final AxisHttpRequest request, final AxisHttpResponse response, final HttpContext context, final MessageContext msgContext) throws HttpException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("Request method: " + request.getMethod()); LOG.debug("Target URI: " + request.getRequestURI()); } try { TransportOutDescription transportOut = this.configurationContext.getAxisConfiguration() .getTransportOut(Constants.TRANSPORT_HTTP); TransportInDescription transportIn = this.configurationContext.getAxisConfiguration() .getTransportIn(Constants.TRANSPORT_HTTP); String sessionKey = (String) context.getAttribute(HTTPConstants.COOKIE_STRING); msgContext.setTransportIn(transportIn); msgContext.setTransportOut(transportOut); msgContext.setServerSide(true); msgContext.setProperty(HTTPConstants.COOKIE_STRING, sessionKey); msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, request.getRequestURI()); // set the transport Headers HashMap headerMap = new HashMap(); for (Iterator it = request.headerIterator(); it.hasNext();) { Header header = (Header) it.next(); headerMap.put(header.getName(), header.getValue()); } msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headerMap); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, request.getContentType()); msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream()); msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, response); msgContext.setTo(new EndpointReference(request.getRequestURI())); msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, new SimpleHTTPRequestResponseTransport()); this.worker.service(request, response, msgContext); } catch (SocketException ex) { // Socket is unreliable. throw ex; } catch (HttpException ex) { // HTTP protocol violation. Transport is unreliable throw ex; } catch (Throwable e) { msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream()); msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, response); MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e); // If the fault is not going along the back channel we should be 202ing if (AddressingHelper.isFaultRedirected(msgContext)) { response.setStatus(HttpStatus.SC_ACCEPTED); } else { String state = (String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE); if (state != null) { int stateInt = Integer.parseInt(state); response.setStatus(stateInt); if (stateInt == HttpServletResponse.SC_UNAUTHORIZED) { // Unauthorized String realm = (String) msgContext.getProperty(Constants.HTTP_BASIC_AUTH_REALM); response.addHeader("WWW-Authenticate", "basic realm=\"" + realm + "\""); } } else { if (e instanceof AxisFault) { response.sendError(getStatusFromAxisFault((AxisFault)e), e.getMessage()); } else { response.sendError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Internal server error"); } } } AxisEngine.sendFault(faultContext); } } public int getStatusFromAxisFault(AxisFault fault) { QName faultCode = fault.getFaultCode(); if (SOAP12Constants.QNAME_SENDER_FAULTCODE.equals(faultCode) || SOAP11Constants.QNAME_SENDER_FAULTCODE.equals(faultCode)) { return HttpServletResponse.SC_BAD_REQUEST; } return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } class SimpleHTTPRequestResponseTransport implements RequestResponseTransport { private CountDownLatch responseReadySignal = new CountDownLatch(1); RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING; AxisFault faultToBeThrownOut = null; private boolean responseWritten = false; public void acknowledgeMessage(MessageContext msgContext) throws AxisFault { //TODO: Once the core HTTP API allows us to return an ack before unwinding, then the should be fixed status = RequestResponseTransportStatus.ACKED; responseReadySignal.countDown(); } public void awaitResponse() throws InterruptedException, AxisFault { responseReadySignal.await(); if (faultToBeThrownOut != null) { throw faultToBeThrownOut; } } public void signalResponseReady() { status = RequestResponseTransportStatus.SIGNALLED; responseReadySignal.countDown(); } public RequestResponseTransportStatus getStatus() { return status; } public void signalFaultReady(AxisFault fault) { faultToBeThrownOut = fault; signalResponseReady(); } public boolean isResponseWritten() { return responseWritten; } public void setResponseWritten(boolean responseWritten) { this.responseWritten = responseWritten; } } } ./src/org/apache/axis2/transport/http/server/IOProcessorCallback.java0000664000175000017500000000165211767656530025046 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; public interface IOProcessorCallback { void completed(IOProcessor processor); } ./src/org/apache/axis2/transport/http/server/HttpFactory.java0000664000175000017500000004145211767656530023473 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.transport.http.HTTPWorkerFactory; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.HttpResponseFactory; import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.impl.DefaultHttpResponseFactory; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.ResponseConnControl; import org.apache.http.protocol.ResponseContent; import org.apache.http.protocol.ResponseDate; import org.apache.http.protocol.ResponseServer; import java.io.IOException; /** * Factory used to configure and create the various instances required in http transports. * Either configure this class in axis2.xml, or in code via the setters, or subclass it and specialize some factory methods to gain more control. */ public class HttpFactory { /** * Name of axis2.xml port parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_PORT = "port"; /** * Name of axis2.xml hostname parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_HOST_ADDRESS = "hostname"; /** * Name of axis2.xml originServer parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_ORIGIN_SERVER = "originServer"; /** * Name of axis2.xml requestTimeout parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_REQUEST_SOCKET_TIMEOUT = "requestTimeout"; /** * Name of axis2.xml requestTcpNoDelay parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_REQUEST_TCP_NO_DELAY = "requestTcpNoDelay"; /** * Name of axis2.xml requestCoreThreadPoolSize parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE = "requestCoreThreadPoolSize"; /** * Name of axis2.xml requestMaxThreadPoolSize parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_REQUEST_MAX_THREAD_POOL_SIZE = "requestMaxThreadPoolSize"; /** * Name of axis2.xml threadKeepAliveTime parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_THREAD_KEEP_ALIVE_TIME = "threadKeepAliveTime"; /** * Name of axis2.xml threadKeepAliveTimeUnit parameter for SimpleHTTPServer configuration */ public static final String PARAMETER_THREAD_KEEP_ALIVE_TIME_UNIT = "threadKeepAliveTimeUnit"; private ConfigurationContext configurationContext; private TransportInDescription httpConfiguration; private int port; private String hostAddress; private String originServer; private int requestSocketTimeout; private boolean requestTcpNoDelay; private int requestCoreThreadPoolSize; private int requestMaxThreadPoolSize; private long threadKeepAliveTime; private TimeUnit threadKeepAliveTimeUnit; private WorkerFactory requestWorkerFactory = null; /** * Create and configure a new HttpFactory */ public HttpFactory(ConfigurationContext configurationContext) throws AxisFault { this.configurationContext = configurationContext; httpConfiguration = configurationContext.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_HTTP); port = getIntParam(PARAMETER_PORT, 6060); hostAddress = getStringParam(PARAMETER_HOST_ADDRESS, null); originServer = getStringParam(PARAMETER_ORIGIN_SERVER, "Simple-Server/1.1"); requestSocketTimeout = getIntParam(PARAMETER_REQUEST_SOCKET_TIMEOUT, 20000); requestTcpNoDelay = getBooleanParam(PARAMETER_REQUEST_TCP_NO_DELAY, true); requestCoreThreadPoolSize = getIntParam(PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE, 100); requestMaxThreadPoolSize = getIntParam(PARAMETER_REQUEST_MAX_THREAD_POOL_SIZE, 150); threadKeepAliveTime = getLongParam(PARAMETER_THREAD_KEEP_ALIVE_TIME, 180L); threadKeepAliveTimeUnit = getTimeUnitParam(PARAMETER_THREAD_KEEP_ALIVE_TIME_UNIT, TimeUnit.SECONDS); } /** * Create and configure a new HttpFactory */ public HttpFactory(ConfigurationContext configurationContext, int port) throws AxisFault { this(configurationContext); this.port = port; } /** * Create and configure a new HttpFactory */ public HttpFactory(ConfigurationContext configurationContext, int port, WorkerFactory requestWorkerFactory) throws AxisFault { this(configurationContext, port); this.requestWorkerFactory = requestWorkerFactory; } private int getIntParam(String name, int def) { String config = getStringParam(name, null); if (config != null) { return Integer.parseInt(config); } else { return def; } } private long getLongParam(String name, long def) { String config = getStringParam(name, null); if (config != null) { return Long.parseLong(config); } else { return def; } } private boolean getBooleanParam(String name, boolean def) throws AxisFault { String config = getStringParam(name, null); if (config != null) { if (config.equals("yes") || config.equals("true")) { return true; } else if (config.equals("no") || config.equals("false")) { return false; } else { throw new AxisFault("Boolean value must be yes, true, no or false for parameter " + name + ": " + config); } } return def; } private TimeUnit getTimeUnitParam(String name, TimeUnit def) throws AxisFault { String config = getStringParam(name, null); if (config != null) { try { return (TimeUnit) TimeUnit.class.getField(config).get(null); } catch (Exception e) { throw AxisFault.makeFault(e); } } return def; } private String getStringParam(String name, String def) { Parameter param = httpConfiguration.getParameter(name); if (param != null) { // assert param.getParameterType() == Parameter.TEXT_PARAMETER; String config = (String) param.getValue(); if (config != null) { return config; } } return def; } /** * Return the configured listener manager or create and configure one with configurationContext */ public ListenerManager getListenerManager() { ListenerManager lm = configurationContext.getListenerManager(); if (lm == null) { lm = new ListenerManager(); lm.init(configurationContext); } return lm; } /** * Create the executor used to launch the single requestConnectionListener */ public ExecutorService newListenerExecutor(int port) { return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new DefaultThreadFactory( new ThreadGroup("Listener thread group"), "HttpListener-" + this.port)); } /** * Create the listener for request connections */ public IOProcessor newRequestConnectionListener( int port, final HttpConnectionManager manager, final HttpParams params) throws IOException { return new DefaultConnectionListener( port, manager, new DefaultConnectionListenerFailureHandler(), params); } /** * Create and set the parameters applied to incoming request connections */ public HttpParams newRequestConnectionParams() { HttpParams params = new BasicHttpParams(); params .setIntParameter(HttpConnectionParams.SO_TIMEOUT, requestSocketTimeout) .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, requestTcpNoDelay) .setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 4000) .setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 500) .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024) .setParameter(HttpProtocolParams.ORIGIN_SERVER, originServer); return params; } /** * Create the connection manager used to launch request threads */ public HttpConnectionManager newRequestConnectionManager(ExecutorService requestExecutor, WorkerFactory workerFactory, HttpParams params) { return new DefaultHttpConnectionManager(configurationContext, requestExecutor, workerFactory, params); } /** * Create the executor use the manage request processing threads */ public ExecutorService newRequestExecutor(int port) { return new ThreadPoolExecutor(requestCoreThreadPoolSize, requestMaxThreadPoolSize, threadKeepAliveTime, threadKeepAliveTimeUnit, newRequestBlockingQueue(), new DefaultThreadFactory( new ThreadGroup("Connection thread group"), "HttpConnection-" + port)); } /** * Create the queue used to hold incoming requests when requestCoreThreadPoolSize threads are busy. * Default is an unbounded queue. */ public BlockingQueue newRequestBlockingQueue() { return new LinkedBlockingQueue(); } /** * Create the factory for request workers */ public WorkerFactory newRequestWorkerFactory() { if (requestWorkerFactory != null) { return requestWorkerFactory; } else { return new HTTPWorkerFactory(); } } public HttpProcessor newHttpProcessor() { BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new RequestSessionCookie()); httpProcessor.addInterceptor(new ResponseDate()); httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); httpProcessor.addInterceptor(new ResponseSessionCookie()); return httpProcessor; } public ConnectionReuseStrategy newConnStrategy() { return new DefaultConnectionReuseStrategy(); } public HttpResponseFactory newResponseFactory() { return new DefaultHttpResponseFactory(); } // ***** // Getters and Setters // ***** /** * Getter for configurationContext */ public ConfigurationContext getConfigurationContext() { return configurationContext; } /** * Getter for httpConfiguration */ public TransportInDescription getHttpConfiguration() { return httpConfiguration; } /** * Getter for port * return the port on which to listen for http connections (default = 6060) */ public int getPort() { return port; } /** * Setter for port */ public void setPort(int port) { this.port = port; } /** * Getter for hostAddress * * @return the host address (or name) to be use in reply-to endpoint references, or null if not specified (default = null) */ public String getHostAddress() { return hostAddress; } /** * Setter for hostAddress */ public void setHostAddress(String hostAddress) { this.hostAddress = hostAddress; } /** * Getter for originServer * * @return the Server header string for outgoing messages (default "Simple-Server/1.1") */ public String getOriginServer() { return originServer; } /** * Setter for originServer */ public void setOriginServer(String originServer) { this.originServer = originServer; } /** * Getter for requestSocketTimeout * * @return the maximum time in millis to wait for data on a request socket (default 20000) */ public int getRequestSocketTimeout() { return requestSocketTimeout; } /** * Setter for requestSocketTimeout */ public void setRequestSocketTimeout(int requestSocketTimeout) { this.requestSocketTimeout = requestSocketTimeout; } /** * Getter for requestTcpNoDelay * return false iff Nagle's algorithm should be used to conserve bandwidth by minimizing segments * at the cost of latency and performance (default true, i.e. maximize performance at * the cost of bandwidth) */ public boolean getRequestTcpNoDelay() { return requestTcpNoDelay; } /** * Setter for requestTcpNoDelay */ public void setRequestTcpNoDelay(boolean requestTcpNoDelay) { this.requestTcpNoDelay = requestTcpNoDelay; } /** * Getter for RequestCoreThreadPoolSize * * @return the size of the thread pool use to process requests assuming there is adequate queue space (default 25) */ public int getRequestCoreThreadPoolSize() { return requestCoreThreadPoolSize; } /** * Setter for RequestCoreThreadPoolSize */ public void setRequestCoreThreadPoolSize(int requestCoreThreadPoolSize) { this.requestCoreThreadPoolSize = requestCoreThreadPoolSize; } /** * Getter for requestMaxThreadPoolSize * * @return the maximum size of the thread pool used to process requests if the queue fills up (default 150). * Since the default queue is unbounded this parameter is meaningless unless you override newRequestBlockingQueue() */ public int getRequestMaxThreadPoolSize() { return requestMaxThreadPoolSize; } /** * Setter for requestMaxThreadPoolSize */ public void setRequestMaxThreadPoolSize(int requestMaxThreadPoolSize) { this.requestMaxThreadPoolSize = requestMaxThreadPoolSize; } /** * Getter for threadKeepAliveTime * * @return how long a request processing thread in excess of the core pool size will be kept alive it if is inactive * (default with threadKeepAliveTimeUnit to 180 seconds) */ public long getThreadKeepAliveTime() { return threadKeepAliveTime; } /** * Setter for threadKeepAliveTime */ public void setThreadKeepAliveTime(long threadKeepAliveTime) { this.threadKeepAliveTime = threadKeepAliveTime; } /** * Getter for threadKeepAliveTimeUnit * return the time unit for threadKeepAliveTime (default SECONDS) */ public TimeUnit getThreadKeepAliveTimeUnit() { return threadKeepAliveTimeUnit; } /** * Setter for threadKeepAliveTimeUnit */ public void setThreadKeepAliveTimeUnit(TimeUnit threadKeepAliveTimeUnit) { this.threadKeepAliveTimeUnit = threadKeepAliveTimeUnit; } } ./src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java0000664000175000017500000001612611767656530026763 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.HttpResponseFactory; import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.impl.DefaultHttpResponseFactory; import org.apache.http.params.HttpParams; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.ResponseConnControl; import org.apache.http.protocol.ResponseContent; import org.apache.http.protocol.ResponseDate; import org.apache.http.protocol.ResponseServer; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class DefaultHttpConnectionManager implements HttpConnectionManager { private static Log LOG = LogFactory.getLog(DefaultHttpConnectionManager.class); private final ConfigurationContext configurationContext; /** The thread pool used to execute processors. */ private final Executor executor; private final WorkerFactory workerfactory; private final HttpParams params; /** The list of processors. */ // XXX: is this list really needed? private final List processors; private HttpFactory httpFactory = null; public DefaultHttpConnectionManager(final ConfigurationContext configurationContext, final Executor executor, final WorkerFactory workerfactory, final HttpParams params) { super(); if (configurationContext == null) { throw new IllegalArgumentException("Configuration context may not be null"); } if (executor == null) { throw new IllegalArgumentException("Executor may not be null"); } if (workerfactory == null) { throw new IllegalArgumentException("Worker factory may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.configurationContext = configurationContext; this.executor = executor; this.workerfactory = workerfactory; this.params = params; this.processors = new LinkedList(); } public DefaultHttpConnectionManager( final ConfigurationContext configurationContext, final Executor executor, final WorkerFactory workerfactory, final HttpParams params, final HttpFactory httpFactory) { this(configurationContext, executor, workerfactory, params); this.httpFactory = httpFactory; } /** * Removes the destroyed processors. * * @see IOProcessor#destroy() */ //XXX: is this method really needed? Processors are removed as soon as they complete private synchronized void cleanup() { for (Iterator i = this.processors.iterator(); i.hasNext();) { IOProcessor processor = (IOProcessor) i.next(); if (processor.isDestroyed()) { i.remove(); } } } /** * Adds the specified {@linkplain IOProcessor} to the list of processors in * progress. * * @param processor The processor to add. * @throws NullPointerException If processor is null. */ private synchronized void addProcessor(final IOProcessor processor) { if (processor == null) { throw new NullPointerException("The processor can't be null"); } this.processors.add(processor); } /** * Removes the specified {@linkplain IOProcessor} from the list of * processors. * * @param processor The processor to remove. * @throws NullPointerException If processor is null. */ synchronized void removeProcessor(final IOProcessor processor) throws NullPointerException { if (processor == null) { throw new NullPointerException("The processor can't be null"); } this.processors.remove(processor); } public void process(final AxisHttpConnection conn) { if (conn == null) { throw new IllegalArgumentException("HTTP connection may not be null"); } // Evict destroyed processors cleanup(); // Assemble new Axis HTTP service HttpProcessor httpProcessor; ConnectionReuseStrategy connStrategy; HttpResponseFactory responseFactory; if (httpFactory != null) { httpProcessor = httpFactory.newHttpProcessor(); connStrategy = httpFactory.newConnStrategy(); responseFactory = httpFactory.newResponseFactory(); } else { BasicHttpProcessor p = new BasicHttpProcessor(); p.addInterceptor(new RequestSessionCookie()); p.addInterceptor(new ResponseDate()); p.addInterceptor(new ResponseServer()); p.addInterceptor(new ResponseContent()); p.addInterceptor(new ResponseConnControl()); p.addInterceptor(new ResponseSessionCookie()); httpProcessor = p; connStrategy = new DefaultConnectionReuseStrategy(); responseFactory = new DefaultHttpResponseFactory(); } AxisHttpService httpService = new AxisHttpService(httpProcessor, connStrategy, responseFactory, this.configurationContext, this.workerfactory.newWorker()); httpService.setParams(this.params); // Create I/O processor to execute HTTP service IOProcessorCallback callback = new IOProcessorCallback() { public void completed(final IOProcessor processor) { removeProcessor(processor); if (LOG.isDebugEnabled()) { LOG.debug(processor + " terminated"); } } }; IOProcessor processor = new HttpServiceProcessor(httpService, conn, callback); addProcessor(processor); this.executor.execute(processor); } public synchronized void shutdown() { for (int i = 0; i < this.processors.size(); i++) { IOProcessor processor = (IOProcessor) this.processors.get(i); processor.destroy(); } this.processors.clear(); } } ./src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java0000664000175000017500000002232611767656530025631 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HeaderIterator; import org.apache.http.HttpConnectionMetrics; import org.apache.http.HttpEntity; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpVersion; import org.apache.http.ProtocolVersion; import org.apache.http.entity.ContentLengthStrategy; import org.apache.http.impl.DefaultHttpRequestFactory; import org.apache.http.impl.entity.StrictContentLengthStrategy; import org.apache.http.impl.io.ChunkedInputStream; import org.apache.http.impl.io.ChunkedOutputStream; import org.apache.http.impl.io.ContentLengthInputStream; import org.apache.http.impl.io.ContentLengthOutputStream; import org.apache.http.impl.io.HttpRequestParser; import org.apache.http.impl.io.HttpResponseWriter; import org.apache.http.impl.io.IdentityInputStream; import org.apache.http.impl.io.IdentityOutputStream; import org.apache.http.impl.io.SocketInputBuffer; import org.apache.http.impl.io.SocketOutputBuffer; import org.apache.http.io.HttpMessageParser; import org.apache.http.io.HttpMessageWriter; import org.apache.http.io.SessionInputBuffer; import org.apache.http.io.SessionOutputBuffer; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; public class AxisHttpConnectionImpl implements AxisHttpConnection { private static final Log HEADERLOG = LogFactory.getLog("org.apache.axis2.transport.http.server.wire"); private final Socket socket; private final SessionOutputBuffer outbuffer; private final SessionInputBuffer inbuffer; private final HttpMessageParser requestParser; private final HttpMessageWriter responseWriter; private final ContentLengthStrategy contentLenStrategy; private OutputStream out = null; private InputStream in = null; public AxisHttpConnectionImpl(final Socket socket, final HttpParams params) throws IOException { super(); if (socket == null) { throw new IllegalArgumentException("Socket may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params)); socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params)); int linger = HttpConnectionParams.getLinger(params); if (linger >= 0) { socket.setSoLinger(linger > 0, linger); } int buffersize = HttpConnectionParams.getSocketBufferSize(params); this.socket = socket; this.outbuffer = new SocketOutputBuffer(socket, buffersize, params); this.inbuffer = new SocketInputBuffer(socket, buffersize, params); this.contentLenStrategy = new StrictContentLengthStrategy(); this.requestParser = new HttpRequestParser( this.inbuffer, null, new DefaultHttpRequestFactory(), params); this.responseWriter = new HttpResponseWriter( this.outbuffer, null, params); } public void close() throws IOException { this.outbuffer.flush(); try { this.socket.shutdownOutput(); } catch (IOException ignore) { } try { this.socket.shutdownInput(); } catch (IOException ignore) { } this.socket.close(); } public boolean isOpen() { return !this.socket.isClosed(); } public boolean isStale() { try { this.inbuffer.isDataAvailable(1); return false; } catch (IOException ex) { return true; } } public void shutdown() throws IOException { Socket tmpsocket = this.socket; if (tmpsocket != null) { tmpsocket.close(); } } public HttpRequest receiveRequest() throws HttpException, IOException { HttpRequest request = (HttpRequest) this.requestParser.parse(); if (HEADERLOG.isDebugEnabled()) { HEADERLOG.debug(">> " + request.getRequestLine().toString()); for (HeaderIterator it = request.headerIterator(); it.hasNext(); ) { HEADERLOG.debug(">> " + it.nextHeader().toString()); } } // Prepare input stream this.in = null; if (request instanceof HttpEntityEnclosingRequest) { long len = this.contentLenStrategy.determineLength(request); if (len == ContentLengthStrategy.CHUNKED) { this.in = new ChunkedInputStream(this.inbuffer); } else if (len == ContentLengthStrategy.IDENTITY) { this.in = new IdentityInputStream(this.inbuffer); } else { this.in = new ContentLengthInputStream(inbuffer, len); } } return request; } public void sendResponse(final HttpResponse response) throws HttpException, IOException { if (response == null) { throw new IllegalArgumentException("HTTP response may not be null"); } if (HEADERLOG.isDebugEnabled()) { HEADERLOG.debug("<< " + response.getStatusLine().toString()); for (HeaderIterator it = response.headerIterator(); it.hasNext(); ) { HEADERLOG.debug("<< " + it.nextHeader().toString()); } } this.responseWriter.write(response); // Prepare output stream this.out = null; ProtocolVersion ver = response.getStatusLine().getProtocolVersion(); HttpEntity entity = response.getEntity(); if (entity != null) { long len = entity.getContentLength(); if (entity.isChunked() && ver.greaterEquals(HttpVersion.HTTP_1_1)) { this.out = new ChunkedOutputStream(this.outbuffer); } else if (len >= 0) { this.out = new ContentLengthOutputStream(this.outbuffer, len); } else { this.out = new IdentityOutputStream(this.outbuffer); } } else { this.outbuffer.flush(); } } public InputStream getInputStream() { return this.in; } public OutputStream getOutputStream() { return this.out; } public void flush() throws IOException { if (this.out != null) { this.out.flush(); } else { this.outbuffer.flush(); } } public void reset() throws IOException { if (this.in != null) { this.in.close(); this.in = null; } if (this.out != null) { this.out.flush(); this.out.close(); this.out = null; } } public int getSocketTimeout() { try { return this.socket.getSoTimeout(); } catch (SocketException ex) { return -1; } } public void setSocketTimeout(int timeout) { try { this.socket.setSoTimeout(timeout); } catch (SocketException ex) { } } public InetAddress getLocalAddress() { if (this.socket != null) { return this.socket.getLocalAddress(); } else { return null; } } public int getLocalPort() { if (this.socket != null) { return this.socket.getLocalPort(); } else { return -1; } } public InetAddress getRemoteAddress() { if (this.socket != null) { return this.socket.getInetAddress(); } else { return null; } } public int getRemotePort() { if (this.socket != null) { return this.socket.getPort(); } else { return -1; } } public HttpConnectionMetrics getMetrics() { return null; } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("["); if (isOpen()) { buffer.append(this.socket.getInetAddress()); } else { buffer.append("closed"); } buffer.append("]"); return buffer.toString(); } } ./src/org/apache/axis2/transport/http/server/DefaultConnectionListener.java0000664000175000017500000001022511767656530026330 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.params.HttpParams; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class DefaultConnectionListener implements IOProcessor { private static Log LOG = LogFactory.getLog(DefaultConnectionListener.class); private volatile boolean destroyed = false; private final int port; private final HttpConnectionManager connmanager; private final ConnectionListenerFailureHandler failureHandler; private final HttpParams params; private ServerSocket serversocket = null; /** * Use this constructor to provide a custom ConnectionListenerFailureHandler, e.g. by subclassing DefaultConnectionListenerFailureHandler */ public DefaultConnectionListener( int port, final HttpConnectionManager connmanager, final ConnectionListenerFailureHandler failureHandler, final HttpParams params) throws IOException { super(); if (connmanager == null) { throw new IllegalArgumentException("Connection manager may not be null"); } if (failureHandler == null) { throw new IllegalArgumentException("Failure handler may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.port = port; this.connmanager = connmanager; this.failureHandler = failureHandler; this.params = params; } public void run() { try { while (!Thread.interrupted()) { try { if (serversocket == null || serversocket.isClosed()) { serversocket = new ServerSocket(port); serversocket.setReuseAddress(true); if (LOG.isInfoEnabled()) { LOG.info("Listening on port " + this.serversocket.getLocalPort()); } } LOG.debug("Waiting for incoming HTTP connection"); Socket socket = this.serversocket.accept(); if (LOG.isDebugEnabled()) { LOG.debug("Incoming HTTP connection from " + socket.getRemoteSocketAddress()); } AxisHttpConnection conn = new AxisHttpConnectionImpl(socket, this.params); this.connmanager.process(conn); } catch (Throwable ex) { if (Thread.interrupted()) { break; } if (!failureHandler.failed(this, ex)) { break; } } } } finally { destroy(); } } public void close() throws IOException { if (this.serversocket != null) { this.serversocket.close(); } } public void destroy() { this.destroyed = true; try { close(); } catch (IOException ex) { if (LOG.isWarnEnabled()) { LOG.warn("I/O error closing listener", ex); } } } public boolean isDestroyed() { return this.destroyed; } } ./src/org/apache/axis2/transport/http/server/ConnectionListenerFailureHandler.java0000664000175000017500000000333111767656530027631 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; public interface ConnectionListenerFailureHandler { /** * The associated connection listener IOProcessor has failed * * @param connectionListener the associated connection listener * @param cause cause of failure * @return true if the listener should attempt to re-establish itself, false if it should terminate. */ public boolean failed(IOProcessor connectionListener, Throwable cause); /** * The associated connection listener IOProcessor is terminating abnormally * * @param connectionListener the associated connection listener * @param message explanation of termination * @param cause last exception that is causing termination */ public void notifyAbnormalTermination(IOProcessor connectionListener, String message, Throwable cause); } ./src/org/apache/axis2/transport/http/server/SimpleHttpServer.java0000664000175000017500000001036711767656530024505 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.params.HttpParams; import java.io.IOException; /** * A simple, but configurable and extensible HTTP server. */ public class SimpleHttpServer { private static Log LOG = LogFactory.getLog(SimpleHttpServer.class); private static final int SHUTDOWN_GRACE_PERIOD = 3000; // ms private HttpFactory httpFactory; private final int port; private final HttpParams params; private final WorkerFactory workerFactory; private IOProcessor listener = null; private ExecutorService listenerExecutor = null; private HttpConnectionManager connmanager = null; private ExecutorService requestExecutor = null; public SimpleHttpServer(ConfigurationContext configurationContext, WorkerFactory workerFactory, int port) throws IOException { this(new HttpFactory(configurationContext, port, workerFactory), port); } public SimpleHttpServer(HttpFactory httpFactory, int port) throws IOException { this.httpFactory = httpFactory; this.port = port; this.workerFactory = httpFactory.newRequestWorkerFactory(); this.params = httpFactory.newRequestConnectionParams(); this.params.setIntParameter(AxisParams.LISTENER_PORT, port); } public void init() throws IOException { requestExecutor = httpFactory.newRequestExecutor(port); connmanager = httpFactory.newRequestConnectionManager(requestExecutor, workerFactory, params); listenerExecutor = httpFactory.newListenerExecutor(port); listener = httpFactory.newRequestConnectionListener(port, connmanager, params); } public void destroy() throws IOException, InterruptedException { // Attempt to terminate the listener nicely LOG.info("Shut down connection listener"); this.listenerExecutor.shutdownNow(); this.listener.destroy(); this.listenerExecutor.awaitTermination(SHUTDOWN_GRACE_PERIOD, TimeUnit.MILLISECONDS); if (!this.listenerExecutor.isTerminated()) { // Terminate the listener forcibly LOG.info("Force shut down connection listener"); this.listener.destroy(); // Leave it up to the garbage collector to clean up the mess this.listener = null; } // Attempt to terminate the active processors nicely LOG.info("Shut down HTTP processors"); this.requestExecutor.shutdownNow(); this.requestExecutor.awaitTermination(SHUTDOWN_GRACE_PERIOD, TimeUnit.MILLISECONDS); if (!this.requestExecutor.isTerminated()) { // Terminate the active processors forcibly LOG.info("Force shut down HTTP processors"); this.connmanager.shutdown(); // Leave it up to the garbage collector to clean up the mess this.connmanager = null; } LOG.info("HTTP protocol handler shut down"); } public void start() { this.listenerExecutor.execute(this.listener); } public boolean isRunning() { return this.listenerExecutor != null && !this.listenerExecutor.isShutdown(); } public int getPort() { return this.port; } } ./src/org/apache/axis2/transport/http/server/ResponseSessionCookie.java0000664000175000017500000000650411767656530025517 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import org.apache.http.HttpResponseInterceptor; import org.apache.http.message.BufferedHeader; import org.apache.http.protocol.HttpContext; import org.apache.http.util.CharArrayBuffer; import java.io.IOException; public class ResponseSessionCookie implements HttpResponseInterceptor { public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { if (response == null) { throw new IllegalArgumentException("HTTP response may not be null"); } if (context == null) { throw new IllegalArgumentException("HTTP context may not be null"); } String sessionCookie = null; MessageContext msgctx = (MessageContext) context.getAttribute(AxisParams.MESSAGE_CONTEXT); if (msgctx != null) { sessionCookie = (String) msgctx.getProperty(HTTPConstants.COOKIE_STRING); } if (sessionCookie == null) { sessionCookie = (String) context.getAttribute(HTTPConstants.COOKIE_STRING); } if (sessionCookie != null) { // Generate Netscape style cookie header CharArrayBuffer buffer1 = new CharArrayBuffer(sessionCookie.length() + 40); buffer1.append(HTTPConstants.HEADER_SET_COOKIE); buffer1.append(": "); buffer1.append(Constants.SESSION_COOKIE_JSESSIONID); buffer1.append("="); buffer1.append(sessionCookie); response.addHeader(new BufferedHeader(buffer1)); // Generate RFC2965 cookie2 header CharArrayBuffer buffer2 = new CharArrayBuffer(sessionCookie.length() + 50); buffer2.append(HTTPConstants.HEADER_SET_COOKIE2); buffer2.append(": "); buffer2.append(Constants.SESSION_COOKIE_JSESSIONID); buffer2.append("="); buffer2.append(sessionCookie); buffer2.append("; "); int port = response.getParams().getIntParameter(AxisParams.LISTENER_PORT, 0); if (port > 0) { buffer2.append("Port=\""); buffer2.append(Integer.toString(port)); buffer2.append("\"; "); } buffer2.append("Version=1"); response.addHeader(new BufferedHeader(buffer2)); } } } ./src/org/apache/axis2/transport/http/server/SessionManager.java0000664000175000017500000000632711767656530024144 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.engine.DependencyManager; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class SessionManager { private final Map sessionmap; public SessionManager() { super(); this.sessionmap = new HashMap(); } public synchronized SessionContext getSessionContext(String sessionKey) { SessionContext sessionContext = null; if (sessionKey != null && sessionKey.length() != 0) { sessionContext = (SessionContext) this.sessionmap.get(sessionKey); } if (sessionContext == null) { sessionKey = UUIDGenerator.getUUID(); sessionContext = new SessionContext(null); sessionContext.setCookieID(sessionKey); this.sessionmap.put(sessionKey, sessionContext); } sessionContext.touch(); cleanupServiceGroupContexts(); return sessionContext; } private void cleanupServiceGroupContexts() { long currentTime = System.currentTimeMillis(); for (Iterator it = this.sessionmap.keySet().iterator(); it.hasNext();) { String cookieID = (String) it.next(); SessionContext sessionContext = (SessionContext) this.sessionmap.get(cookieID); if ((currentTime - sessionContext.getLastTouchedTime()) > sessionContext.sessionContextTimeoutInterval) { it.remove(); Iterator serviceGroupContext = sessionContext.getServiceGroupContext(); if (serviceGroupContext != null) { while (serviceGroupContext.hasNext()) { ServiceGroupContext groupContext = (ServiceGroupContext) serviceGroupContext.next(); cleanupServiceContexts(groupContext); } } } } } private void cleanupServiceContexts(final ServiceGroupContext serviceGroupContext) { for (Iterator it = serviceGroupContext.getServiceContexts(); it.hasNext();) { ServiceContext serviceContext = (ServiceContext) it.next(); DependencyManager.destroyServiceObject(serviceContext); } } } ./src/org/apache/axis2/transport/http/server/IOProcessor.java0000664000175000017500000000177311767656530023435 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import java.io.IOException; public interface IOProcessor extends Runnable { void close() throws IOException; boolean isDestroyed(); void destroy(); } ./src/org/apache/axis2/transport/http/server/AxisHttpConnection.java0000664000175000017500000000304311767656530025002 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.http.HttpConnection; import org.apache.http.HttpException; import org.apache.http.HttpInetConnection; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public interface AxisHttpConnection extends HttpConnection, HttpInetConnection { HttpRequest receiveRequest() throws HttpException, IOException; InputStream getInputStream(); void sendResponse(HttpResponse response) throws HttpException, IOException; OutputStream getOutputStream(); void flush() throws IOException; void reset() throws IOException; } ./src/org/apache/axis2/transport/http/server/AxisParams.java0000664000175000017500000000204311767656530023265 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; public class AxisParams { private AxisParams() { } public static final String LISTENER_PORT = "axis.listener.port"; public static final String MESSAGE_CONTEXT = "axis.message.context"; } ./src/org/apache/axis2/transport/http/server/HttpConnectionManager.java0000664000175000017500000000170611767656530025454 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; public interface HttpConnectionManager { void process(AxisHttpConnection incoming); void shutdown(); } ./src/org/apache/axis2/transport/http/server/AxisHttpRequest.java0000664000175000017500000000212711767656530024335 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.http.HttpMessage; import java.io.InputStream; public interface AxisHttpRequest extends HttpMessage { String getMethod(); String getRequestURI(); String getContentType(); InputStream getInputStream(); } ./src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java0000664000175000017500000001157011767656530025161 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.http.Header; import org.apache.http.HeaderIterator; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.ProtocolVersion; import org.apache.http.params.HttpParams; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpProcessor; import java.io.IOException; import java.io.InputStream; public class AxisHttpRequestImpl implements AxisHttpRequest { private final HttpRequest request; private final AxisHttpConnection conn; private final HttpProcessor httpproc; private final HttpContext context; public AxisHttpRequestImpl( final AxisHttpConnection conn, final HttpRequest request, final HttpProcessor httpproc, final HttpContext context) { super(); if (conn == null) { throw new IllegalArgumentException("HTTP connection may not be null"); } if (request == null) { throw new IllegalArgumentException("HTTP request may not be null"); } if (httpproc == null) { throw new IllegalArgumentException("HTTP processor may not be null"); } if (context == null) { throw new IllegalArgumentException("HTTP context may not be null"); } this.request = request; this.conn = conn; this.httpproc = httpproc; this.context = context; } public void prepare() throws IOException, HttpException { this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn); this.context.setAttribute(ExecutionContext.HTTP_REQUEST, this.request); this.httpproc.process(this.request, this.context); } public String getMethod() { return this.request.getRequestLine().getMethod(); } public String getRequestURI() { return this.request.getRequestLine().getUri(); } public ProtocolVersion getProtocolVersion() { return this.request.getRequestLine().getProtocolVersion(); } public String getContentType() { Header header = this.request.getFirstHeader(HTTP.CONTENT_TYPE); if (header != null) { return header.getValue(); } else { return null; } } public InputStream getInputStream() { return this.conn.getInputStream(); } public void addHeader(final Header header) { this.request.addHeader(header); } public void addHeader(final String name, final String value) { this.request.addHeader(name, value); } public boolean containsHeader(final String name) { return this.request.containsHeader(name); } public Header[] getAllHeaders() { return this.request.getAllHeaders(); } public Header getFirstHeader(final String name) { return this.request.getFirstHeader(name); } public Header[] getHeaders(String name) { return this.request.getHeaders(name); } public Header getLastHeader(final String name) { return this.request.getLastHeader(name); } public HeaderIterator headerIterator() { return this.request.headerIterator(); } public HeaderIterator headerIterator(final String name) { return this.request.headerIterator(name); } public void removeHeader(final Header header) { this.request.removeHeader(header); } public void removeHeaders(final String name) { this.request.removeHeaders(name); } public void setHeader(final Header header) { this.request.setHeader(header); } public void setHeader(final String name, final String value) { this.request.setHeader(name, value); } public void setHeaders(Header[] headers) { this.request.setHeaders(headers); } public HttpParams getParams() { return this.request.getParams(); } public void setParams(final HttpParams params) { this.request.setParams(params); } } ./src/org/apache/axis2/transport/http/server/HttpUtils.java0000664000175000017500000000722011767656530023157 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.http.Header; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; public class HttpUtils { private HttpUtils() { } public static String getSoapAction(final AxisHttpRequest request) { if (request == null) { return null; } Header header = request.getFirstHeader(HTTPConstants.HEADER_SOAP_ACTION); if (header != null) { return header.getValue(); } else { return null; } } /** * Returns the ip address to be used for the replyto epr * CAUTION: * This will go through all the available network interfaces and will try to return an ip address. * First this will try to get the first IP which is not loopback address (127.0.0.1). If none is found * then this will return this will return 127.0.0.1. * This will not consider IPv6 addresses. *

    * TODO: * - Improve this logic to genaralize it a bit more * - Obtain the ip to be used here from the Call API * * @return Returns String. * @throws SocketException */ public static String getIpAddress() throws SocketException { Enumeration e = NetworkInterface.getNetworkInterfaces(); String address = "127.0.0.1"; while (e.hasMoreElements()) { NetworkInterface netface = (NetworkInterface) e.nextElement(); Enumeration addresses = netface.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress ip = (InetAddress) addresses.nextElement(); if (!ip.isLoopbackAddress() && isIP(ip.getHostAddress())) { return ip.getHostAddress(); } } } return address; } /** * First check whether the hostname parameter is there in AxisConfiguration (axis2.xml) , * if it is there then this will retun that as the host name , o.w will return the IP address. */ public static String getIpAddress(AxisConfiguration axisConfiguration) throws SocketException { if(axisConfiguration!=null){ Parameter param = axisConfiguration.getParameter(TransportListener.HOST_ADDRESS); if (param != null) { String hostAddress = ((String) param.getValue()).trim(); if(hostAddress!=null){ return hostAddress; } } } return getIpAddress(); } private static boolean isIP(String hostAddress) { return hostAddress.split("[.]").length == 4; } } ./src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java0000664000175000017500000001214011767656530025354 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.ConnectionClosedException; import org.apache.http.HttpException; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import java.io.IOException; import java.net.SocketException; import java.net.SocketTimeoutException; /** * I/O processor intended to process requests and fill in responses. */ public class HttpServiceProcessor implements IOProcessor { private static final Log LOG = LogFactory.getLog(HttpServiceProcessor.class); /** Counter used to create unique IDs. */ private static AtomicLong counter = new AtomicLong(0L); private AtomicBoolean terminated; private final AxisHttpService httpservice; private final AxisHttpConnection conn; private final IOProcessorCallback callback; /** * Unique identifier used by {@linkplain #equals(Object)} and * {@linkplain #hashCode()}. *

    * This field is needed to allow the equals method to work properly when this * HttpServiceProcessor has to be removed from the list of processors. * * @see DefaultHttpConnectionManager */ private final long id; public HttpServiceProcessor(final AxisHttpService httpservice, final AxisHttpConnection conn, final IOProcessorCallback callback) { super(); this.httpservice = httpservice; this.conn = conn; this.callback = callback; this.terminated = new AtomicBoolean(false); id = counter.incrementAndGet(); } public void run() { LOG.debug("New connection thread"); HttpContext context = new BasicHttpContext(null); try { while (! Thread.interrupted() && ! isDestroyed() && this.conn.isOpen()) { this.httpservice.handleRequest(this.conn, context); } } catch (ConnectionClosedException ex) { LOG.debug("Client closed connection"); } catch (IOException ex) { if (ex instanceof SocketTimeoutException) { LOG.debug(ex.getMessage()); } else if (ex instanceof SocketException) { LOG.debug(ex.getMessage()); } else { LOG.warn(ex.getMessage(), ex); } } catch (HttpException ex) { if (LOG.isWarnEnabled()) { LOG.warn("HTTP protocol error: " + ex.getMessage()); } } finally { destroy(); if (this.callback == null) { throw new NullPointerException("The callback object can't be null"); } this.callback.completed(this); } } public void close() throws IOException { this.conn.close(); } public void destroy() { if (this.terminated.compareAndSet(false, true)) { try { // this.conn.shutdown(); close(); } catch (IOException ex) { LOG.debug("I/O error shutting down connection"); } } } public boolean isDestroyed() { return this.terminated.get(); } // -------------------------------------------------- Methods from Object /** * Returns the unique ID of this HttpServiceProcessor. * * @return The unique ID of this HttpServiceProcessor. */ public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + (int) (id ^ (id >>> 32)); return result; } /** * Indicates whether some other object is "equal to" this one. * * @return true if this HttpServiceProcessor refere to the same * object as obj or they have the same {@linkplain #id}, false otherwise. */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final HttpServiceProcessor other = (HttpServiceProcessor) obj; if (id != other.id) return false; return true; } } ./src/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.java0000664000175000017500000001014211767656530031134 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Default hander for failures in connection listener IOProcessors. * Supports configuration of number retries, delay per retry, and uptime interval considered a success (resets number retries to zero). */ public class DefaultConnectionListenerFailureHandler implements ConnectionListenerFailureHandler { private static final Log LOG = LogFactory.getLog(DefaultConnectionListenerFailureHandler.class); protected int retryDelay; protected int successInterval; protected int maxRetries; private long lastFailure; private long lastFirstFailure; private int numRetries; /** * Create a new DefaultConnectionListenerFailureHandler with default settings. * retryDelay is 1 second, successInterval is 60 seconds, maxRetries is 10 */ public DefaultConnectionListenerFailureHandler() { this(1000, 60000, 10); } /** * Create a new DefaultConnectionListenerFailureHandler * * @param retryDelay millis to wait before retrying * @param successInterval millis after which an initial or retry attempt will be deemed a success, resetting retry count to 0 * @param maxRetries maximum number of retries allowed without a success, after which the listener will terminate */ public DefaultConnectionListenerFailureHandler(int retryDelay, int successInterval, int maxRetries) { this.retryDelay = retryDelay; this.successInterval = successInterval; this.maxRetries = maxRetries; this.lastFailure = this.lastFirstFailure = Long.MIN_VALUE; this.numRetries = 0; } /** * Default behavior is to log a warning and attempt retry per constructor config, eventually failing with a logged error and notification. * May subclass and override this method to change the behavior. */ public boolean failed(IOProcessor connectionListener, Throwable cause) { long now = System.currentTimeMillis(); if (now > lastFailure + successInterval) { numRetries = 0; lastFirstFailure = now; } lastFailure = now; if (numRetries >= maxRetries) { notifyAbnormalTermination( connectionListener, "Terminating connection listener " + connectionListener + " after " + numRetries + "retries in " + (now - lastFirstFailure) / 1000 + " seconds.", cause); return false; } else { numRetries++; if (LOG.isWarnEnabled()) { LOG.warn("Attempt number " + numRetries + " of " + maxRetries + " to reestalish connection listener " + connectionListener + " due to failure ", cause); } return true; } } /** * Default bevarior is to log the error. * May subclass and override this method to change behavior. */ public void notifyAbnormalTermination(IOProcessor connectionListener, String message, Throwable cause) { LOG.error(message, cause); } } ./src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java0000664000175000017500000001642211767656530025330 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axis2.transport.OutTransportInfo; import org.apache.http.Header; import org.apache.http.HeaderIterator; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.params.HttpParams; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpProcessor; import java.io.IOException; import java.io.OutputStream; public class AxisHttpResponseImpl implements AxisHttpResponse, OutTransportInfo { private final HttpResponse response; private final AxisHttpConnection conn; private final HttpProcessor httpproc; private final HttpContext context; private AutoCommitOutputStream outstream; private String contentType; private volatile boolean commited; public AxisHttpResponseImpl( final AxisHttpConnection conn, final HttpResponse response, final HttpProcessor httpproc, final HttpContext context) { super(); if (response == null) { throw new IllegalArgumentException("HTTP response may not be null"); } if (conn == null) { throw new IllegalArgumentException("HTTP connection may not be null"); } if (httpproc == null) { throw new IllegalArgumentException("HTTP processor may not be null"); } if (context == null) { throw new IllegalArgumentException("HTTP context may not be null"); } this.response = response; this.conn = conn; this.httpproc = httpproc; this.context = context; } private void assertNotCommitted() { if (this.commited) { throw new IllegalStateException("Response already committed"); } } public boolean isCommitted() { return this.commited; } public void commit() throws IOException, HttpException { if (this.commited) { return; } this.commited = true; this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn); this.context.setAttribute(ExecutionContext.HTTP_RESPONSE, this.response); BasicHttpEntity entity = new BasicHttpEntity(); entity.setChunked(true); entity.setContentType(this.contentType); this.response.setEntity(entity); this.httpproc.process(this.response, this.context); this.conn.sendResponse(this.response); } public OutputStream getOutputStream() { if (this.outstream == null) { this.outstream = new AutoCommitOutputStream(); } return this.outstream; } public void sendError(int sc, final String msg) { assertNotCommitted(); ProtocolVersion ver = this.response.getProtocolVersion(); this.response.setStatusLine(ver, sc, msg); } public void sendError(int sc) { assertNotCommitted(); this.response.setStatusCode(sc); } public void setStatus(int sc) { assertNotCommitted(); this.response.setStatusCode(sc); } public void setContentType(final String contentType) { assertNotCommitted(); this.contentType = contentType; } public ProtocolVersion getProtocolVersion() { return this.response.getProtocolVersion(); } public void addHeader(final Header header) { assertNotCommitted(); this.response.addHeader(header); } public void addHeader(final String name, final String value) { assertNotCommitted(); this.response.addHeader(name, value); } public boolean containsHeader(final String name) { return this.response.containsHeader(name); } public Header[] getAllHeaders() { return this.response.getAllHeaders(); } public Header getFirstHeader(final String name) { return this.response.getFirstHeader(name); } public Header[] getHeaders(String name) { return this.response.getHeaders(name); } public Header getLastHeader(final String name) { return this.response.getLastHeader(name); } public HeaderIterator headerIterator() { return this.response.headerIterator(); } public HeaderIterator headerIterator(String name) { return this.response.headerIterator(name); } public void removeHeader(final Header header) { assertNotCommitted(); this.response.removeHeader(header); } public void removeHeaders(final String name) { assertNotCommitted(); this.response.removeHeaders(name); } public void setHeader(final Header header) { assertNotCommitted(); this.response.setHeader(header); } public void setHeader(final String name, final String value) { assertNotCommitted(); this.response.setHeader(name, value); } public void setHeaders(Header[] headers) { assertNotCommitted(); this.response.setHeaders(headers); } public HttpParams getParams() { return this.response.getParams(); } public void setParams(final HttpParams params) { this.response.setParams(params); } class AutoCommitOutputStream extends OutputStream { private OutputStream out; public AutoCommitOutputStream() { super(); } private void ensureCommitted() throws IOException { try { commit(); } catch (HttpException ex) { throw (IOException) new IOException().initCause(ex); } if (this.out == null) { this.out = conn.getOutputStream(); } } public void close() throws IOException { ensureCommitted(); this.out.close(); } public void write(final byte[] b, int off, int len) throws IOException { ensureCommitted(); this.out.write(b, off, len); } public void write(final byte[] b) throws IOException { ensureCommitted(); this.out.write(b); } public void write(int b) throws IOException { ensureCommitted(); this.out.write(b); } public void flush() throws IOException { ensureCommitted(); this.out.flush(); } } } ./src/org/apache/axis2/transport/http/server/DefaultThreadFactory.java0000664000175000017500000000334311767656530025265 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class DefaultThreadFactory implements ThreadFactory { final ThreadGroup group; final AtomicInteger count; final String namePrefix; public DefaultThreadFactory(final ThreadGroup group, final String namePrefix) { super(); this.count = new AtomicInteger(1); this.group = group; this.namePrefix = namePrefix; } public Thread newThread(final Runnable runnable) { StringBuffer buffer = new StringBuffer(); buffer.append(this.namePrefix); buffer.append('-'); buffer.append(this.count.getAndIncrement()); Thread t = new Thread(group, runnable, buffer.toString(), 0); t.setDaemon(false); t.setPriority(Thread.NORM_PRIORITY); return t; } } ./src/org/apache/axis2/transport/http/server/Worker.java0000664000175000017500000000216511767656530022473 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axis2.context.MessageContext; import org.apache.http.HttpException; import java.io.IOException; public interface Worker { void service(AxisHttpRequest request, AxisHttpResponse response, MessageContext msgContext) throws HttpException, IOException; } ./src/org/apache/axis2/transport/http/server/AxisHttpResponse.java0000664000175000017500000000222411767656530024501 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.http.HttpMessage; import java.io.OutputStream; public interface AxisHttpResponse extends HttpMessage { void setStatus(int sc); void sendError(int sc, String msg); void sendError(int sc); void setContentType(String contentType); OutputStream getOutputStream(); } ./src/org/apache/axis2/transport/http/server/RequestSessionCookie.java0000664000175000017500000000445411767656530025353 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; import org.apache.axis2.Constants; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.protocol.HttpContext; import java.io.IOException; public class RequestSessionCookie implements HttpRequestInterceptor { public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { if (request == null) { throw new IllegalArgumentException("HTTP request may not be null"); } if (context == null) { throw new IllegalArgumentException("HTTP context may not be null"); } String sessionCookie = null; Header[] headers = request.getHeaders(HTTPConstants.HEADER_COOKIE); for (int i = 0; i < headers.length; i++) { HeaderElement[] elements = headers[i].getElements(); for (int e = 0; e < elements.length; e++) { HeaderElement element = elements[e]; if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) { sessionCookie = element.getValue(); } } } context.setAttribute(HTTPConstants.COOKIE_STRING, sessionCookie); } } ./src/org/apache/axis2/transport/http/server/WorkerFactory.java0000664000175000017500000000162111767656530024017 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http.server; public interface WorkerFactory { Worker newWorker(); } ./src/org/apache/axis2/transport/http/AbstractAgent.java0000664000175000017500000001456411767656530022444 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.http; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; /** * The AbstractAgent acts as a simple dispatcher for http requests. * It delegates incoming requests to processXyz methods while Xyz * is the part of the request uri past last /. */ public class AbstractAgent { protected static final String DEFAULT_INDEX_JSP = "index.jsp"; private static final String METHOD_PREFIX = "process"; private static final Log log = LogFactory.getLog(AbstractAgent.class); protected transient Map operationCache = new HashMap(); protected transient ConfigurationContext configContext; public AbstractAgent(ConfigurationContext aConfigContext) { configContext = aConfigContext; preloadMethods(); } public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { String requestURI = httpServletRequest.getRequestURI(); String operation; int i = requestURI.lastIndexOf('/'); if (i < 0) { processUnknown(httpServletRequest, httpServletResponse); return; } else if (i == requestURI.length() - 1) { processIndex(httpServletRequest, httpServletResponse); return; } else { operation = requestURI.substring(i + 1); } Method method = (Method) operationCache.get(operation.toLowerCase()); if (method != null) { try { method.invoke(this, new Object[]{httpServletRequest, httpServletResponse}); } catch (Exception e) { log.warn("Error dispatching request " + requestURI, e); httpServletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { processUnknown(httpServletRequest, httpServletResponse); } } /** * Callback method for index page. Forwards to {@link DEFAULT_INDEX_JSP} by default. * * @param httpServletRequest The incoming request. * @param httpServletResponse The outgoing response. */ protected void processIndex(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { renderView(DEFAULT_INDEX_JSP, httpServletRequest, httpServletResponse); } /** * Callback method for unknown/unsupported requests. Returns HTTP Status 404 by default. * * @param httpServletRequest The incoming request. * @param httpServletResponse The outgoing response. */ protected void processUnknown(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { httpServletResponse .sendError(HttpServletResponse.SC_NOT_FOUND, httpServletRequest.getRequestURI()); } protected void renderView(String jspName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { httpServletResponse.setContentType("text/html"); try { httpServletRequest.getRequestDispatcher(Constants.AXIS_WEB_CONTENT_ROOT + jspName) .include(httpServletRequest, httpServletResponse); } catch (Throwable t) { log.info("Old Servlet API :" + t); } } private void preloadMethods() { Class clazz = getClass(); while (clazz != null && !clazz.equals(Object.class)) { examineMethods(clazz.getDeclaredMethods()); clazz = clazz.getSuperclass(); } } private void examineMethods(Method[] aDeclaredMethods) { for (int i = 0; i < aDeclaredMethods.length; i++) { Method method = aDeclaredMethods[i]; Class[] parameterTypes = method.getParameterTypes(); if ( (Modifier.isProtected(method.getModifiers()) || Modifier.isPublic(method.getModifiers())) && method.getName().startsWith(METHOD_PREFIX) && parameterTypes.length == 2 && parameterTypes[0].equals(HttpServletRequest.class) && parameterTypes[1].equals(HttpServletResponse.class)) { String key = method.getName().substring(METHOD_PREFIX.length()).toLowerCase(); // ensure we don't overwrite existing method with superclass method if (!operationCache.containsKey(key)) { operationCache.put(key, method); } } } } protected void populateSessionInformation(HttpServletRequest req) { HashMap services = configContext.getAxisConfiguration().getServices(); try { req.getSession().setAttribute(Constants.SERVICE_MAP, services); req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath()); } catch (Throwable t){ log.info("Old Servlet API :" + t); } } } ./src/org/apache/axis2/transport/TransportListener.java0000664000175000017500000000441311767656530022435 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.TransportInDescription; /** * Class TransportListener */ public interface TransportListener { String PARAM_PORT = "port"; String HOST_ADDRESS = "hostname"; void init(ConfigurationContext axisConf, TransportInDescription transprtIn) throws AxisFault; void start() throws AxisFault; void stop() throws AxisFault; /** * @param serviceName * @param ip * @throws AxisFault * @deprecated Transport listener can expose more than EPRs. So this method should return an array of EPRs. * Deprecating this method for now and please use getEPRsForServices instead. */ EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault; EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault; /** * To get the sessionContext transport dependent manner. So that transport listener * can return its own implementation of session managment * * @param messageContext : MessageContext which has all the relavent data * @return SessionContext */ SessionContext getSessionContext(MessageContext messageContext); void destroy(); } ./src/org/apache/axis2/transport/MessageFormatter.java0000664000175000017500000000655011767656530022207 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import java.io.OutputStream; import java.net.URL; /** *

    * MessageFormatter implementations are used by Axis2 to support serialization * of messages to different message formats. (Eg: JSON). Users can register * MessageFormatter implementations against a message type using the axis2.xml. * Message type for a message can be specified by setting the "messageType" * property in the MessageContext. This can also be given as a parameter in the * service.xml/axis2.xml for a per service based/engine wide configuration. *

    *

    * * * *

    */ public interface MessageFormatter { /** * @return a byte array of the message formatted according to the given * message format. */ public byte[] getBytes(MessageContext messageContext, OMOutputFormat format) throws AxisFault; /** * To support deffered writing transports as in http chunking.. Axis2 was * doing this for some time.. *

    * Preserve flag can be used to preserve the envelope for later use. This is * usefull when implementing authentication machnisms like NTLM. * * @param outputStream * @param preserve : * do not consume the OM when this is set.. */ public void writeTo(MessageContext messageContext, OMOutputFormat format, OutputStream outputStream, boolean preserve) throws AxisFault; /** * Different message formats can set their own content types * Eg: JSONFormatter can set the content type as application/json * * @param messageContext * @param format * @param soapAction */ public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction); /** * Some message formats may want to alter the target url. * * @return the target URL */ public URL getTargetAddress(MessageContext messageContext, OMOutputFormat format, URL targetURL) throws AxisFault; /** * @return this only if you want set a transport header for SOAP Action */ public String formatSOAPAction(MessageContext messageContext, OMOutputFormat format, String soapAction); } ./src/org/apache/axis2/transport/mail/0000775000175000017500000000000011767656530017010 5ustar brianbrian./src/org/apache/axis2/transport/mail/SimpleMailListener.java0000664000175000017500000006062611767656530023427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.util.Utils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.Address; import javax.mail.Flags; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.Part; import javax.mail.URLName; import javax.mail.internet.MimeMessage; import javax.xml.stream.XMLStreamException; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; /** * This is the implementation for Mail Listener in Axis2. It has the full capability * of connecting to a POP3 or IMPA server with SSL or regualar connection. This listener intend * to use as a server in client side as well with the involcation is Async with addressing. */ public class SimpleMailListener implements Runnable, TransportListener { private static final Log log = LogFactory.getLog(SimpleMailListener.class); private ConfigurationContext configurationContext = null; private boolean running = true; /*password and replyTo is Axis2 specific*/ private String user = ""; private String replyTo = ""; /*This hold properties for pop3 or impa server connection*/ private Properties pop3Properties = new Properties(); private final EmailReceiver receiver ; /** * Time has been put from best guest. Let the default be 3 mins. * This value is configuralble from Axis2.xml. Under mail transport listener * simply set the following parameter. * [custom listener interval] */ private int listenerWaitInterval = 1000 * 60 * 3; public SimpleMailListener() { receiver = new EmailReceiver(); } public void init(ConfigurationContext configurationContext, TransportInDescription transportIn) throws AxisFault { this.configurationContext = configurationContext; ArrayList mailParameters = transportIn.getParameters(); String password = ""; String host = ""; String protocol = ""; String port = ""; URLName urlName; for (Iterator iterator = mailParameters.iterator(); iterator.hasNext();) { Parameter param = (Parameter) iterator.next(); String paramKey = param.getName(); String paramValue = Utils.getParameterValue(param); if (paramKey == null || paramValue == null) { String error = Messages.getMessage("canNotBeNull", "Parameter name and value"); log.error(error); throw new AxisFault(error); } pop3Properties.setProperty(paramKey, paramValue); if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_USER)) { user = paramValue; } if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PASSWORD)) { password = paramValue; } if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_HOST)) { host = paramValue; } if (paramKey.equals(org.apache.axis2.transport.mail.Constants.STORE_PROTOCOL)) { protocol = paramValue; } if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PORT)) { port = paramValue; } //Transport specific if (paramKey.equals(org.apache.axis2.transport.mail.Constants.REPLY_TO)) { replyTo = paramValue; } if (paramKey.equals(org.apache.axis2.transport.mail.Constants.LISTENER_INTERVAL)) { listenerWaitInterval = Integer.parseInt(paramValue); } } if (password.length() == 0 || user.length() == 0 || host.length() == 0 || protocol.length() == 0) { String error = SimpleMailListener.class.getName() + " one or more of Password, User, Host and Protocol are null or empty"; log.error(error); throw new AxisFault(error); } if (port.length() == 0) { urlName = new URLName(protocol, host, -1, "", user, password); } else { urlName = new URLName(protocol, host, Integer.parseInt(port), "", user, password); } receiver.setPop3Properties(pop3Properties); receiver.setUrlName(urlName); Object obj = configurationContext. getProperty(org.apache.axis2.transport.mail.Constants.MAPPING_TABLE); if (obj == null) { configurationContext.setProperty( org.apache.axis2.transport.mail.Constants.MAPPING_TABLE, new Hashtable()); } Object callBackTable = configurationContext. getProperty(org.apache.axis2.transport.mail.Constants.CALLBACK_TABLE); if (callBackTable == null) { configurationContext.setProperty( org.apache.axis2.transport.mail.Constants.CALLBACK_TABLE, new Hashtable()); } } public void initFromRuntime(Properties properties, MessageContext msgContext) throws AxisFault { this.configurationContext = msgContext.getConfigurationContext(); String password = ""; String host = ""; String protocol = ""; String port = ""; URLName urlName; pop3Properties.clear(); pop3Properties.putAll(properties); user = properties.getProperty(org.apache.axis2.transport.mail.Constants.POP3_USER); password = properties.getProperty(org.apache.axis2.transport.mail.Constants.POP3_PASSWORD); host = properties.getProperty(org.apache.axis2.transport.mail.Constants.POP3_HOST); protocol = properties.getProperty(org.apache.axis2.transport.mail.Constants.STORE_PROTOCOL); port = properties.getProperty(org.apache.axis2.transport.mail.Constants.POP3_PORT); replyTo = properties.getProperty(org.apache.axis2.transport.mail.Constants.REPLY_TO); String value = properties.getProperty(org.apache.axis2.transport.mail.Constants.LISTENER_INTERVAL); if (value != null) { listenerWaitInterval = Integer.parseInt(value); } if (password.length() == 0 || user.length() == 0 || host.length() == 0 || protocol.length() == 0) { String error = SimpleMailListener.class.getName() + " one or more of Password, User," + " Host and Protocol are null or empty" + "in runtime settings"; log.error(error); throw new AxisFault(error); } if (port == null) { urlName = new URLName(protocol, host, -1, "", user, password); } else { urlName = new URLName(protocol, host, Integer.parseInt(port), "", user, password); } receiver.setPop3Properties(pop3Properties); receiver.setUrlName(urlName); Object obj = configurationContext. getProperty(org.apache.axis2.transport.mail.Constants.MAPPING_TABLE); if (obj == null) { configurationContext.setProperty( org.apache.axis2.transport.mail.Constants.MAPPING_TABLE, new Hashtable()); } Object callBackTable = configurationContext. getProperty(org.apache.axis2.transport.mail.Constants.CALLBACK_TABLE); if (callBackTable == null) { configurationContext.setProperty( org.apache.axis2.transport.mail.Constants.CALLBACK_TABLE, new Hashtable()); } } /** * Server process. */ public static void main(String args[]) throws AxisFault { if (args.length < 2) { log.info("java SimpleMailListener "); printUsage(); } else { String path = args[0]; String axis2xml = args[1]; ConfigurationContext configurationContext; File repo = new File(path); if (repo.exists()) { configurationContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(path, axis2xml); } else { printUsage(); throw new AxisFault("repository not found"); } SimpleMailListener sas = new SimpleMailListener(); TransportInDescription transportIn = configurationContext. getAxisConfiguration().getTransportIn(Constants.TRANSPORT_MAIL); if (transportIn != null) { sas.init(configurationContext, transportIn); log.info("Starting the SimpleMailListener with repository " + new File(args[0]).getAbsolutePath()); sas.start(); } else { log.info( "Startup failed, mail transport not configured, Configure the mail trnasport in the axis2.xml file"); } } } private static void printUsage() { System.out.println("Please provide the repository location and axis2.xml location "); } /** * Accept requests from a given TCP port and send them through the Axis * engine for processing. */ public void run() { // Accept and process requests from the socket if (running) { log.info("Mail listner strated to listen to the address " + user); } while (running) { log.info("Info started polling"); try { synchronized (receiver) { receiver.connect(); Message[] msgs = receiver.receiveMessages(); if ((msgs != null) && (msgs.length > 0)) { log.info(msgs.length + " Message(s) Found"); for (int i = 0; i < msgs.length; i++) { MimeMessage msg = (MimeMessage) msgs[i]; try { MessageContext mc = createMessageContextToMailWorker(msg); msg.setFlag(Flags.Flag.DELETED, true); if(mc==null){ continue; } MailWorker worker = new MailWorker(configurationContext,mc); this.configurationContext.getThreadPool().execute(worker); } catch (Exception e) { log.error("Error in SimpleMailListener - processing mail", e); } finally { // delete mail in any case } } } receiver.disconnect(); } } catch (Exception e) { log.error("Error in SimpleMailListener", e); } finally { try { Thread.sleep(listenerWaitInterval); } catch (InterruptedException e) { log.warn("Error Encountered " + e); } } } } private MessageContext createMessageContextToMailWorker(MimeMessage msg) throws Exception { Object content = msg.getContent(); if(!(content instanceof Multipart)){ return null; } MessageContext msgContext = null; TransportInDescription transportIn = configurationContext.getAxisConfiguration() .getTransportIn(org.apache.axis2.Constants.TRANSPORT_MAIL); TransportOutDescription transportOut = configurationContext.getAxisConfiguration() .getTransportOut(org.apache.axis2.Constants.TRANSPORT_MAIL); if ((transportIn != null) && (transportOut != null)) { // create Message Context msgContext = configurationContext.createMessageContext(); msgContext.setTransportIn(transportIn); msgContext.setTransportOut(transportOut); msgContext.setServerSide(true); msgContext.setProperty(org.apache.axis2.transport.mail.Constants.CONTENT_TYPE, msg.getContentType()); msgContext.setIncomingTransportName(org.apache.axis2.Constants.TRANSPORT_MAIL); MailBasedOutTransportInfo transportInfo = new MailBasedOutTransportInfo(); Address[] mimefroms = msg.getFrom(); if (mimefroms != null && mimefroms.length > 0) { EndpointReference fromEPR = new EndpointReference( org.apache.axis2.transport.mail.Constants.MAILTO + ":" + msg.getFrom()[0].toString()); transportInfo.setFrom(fromEPR); } else { String returnPath = getMailHeader(msg, org.apache.axis2.transport.mail.Constants.RETURN_PATH); returnPath = parseHeaderForLessThan(returnPath); if (returnPath != null) { EndpointReference fromEPR = new EndpointReference( org.apache.axis2.transport.mail.Constants.MAILTO + ":" + returnPath); transportInfo.setFrom(fromEPR); } } // Save Message-Id to set as In-Reply-To on reply String smtpMessageId = msg.getMessageID(); if (smtpMessageId != null) { transportInfo.setInReplyTo(smtpMessageId); } String inReplyTo = getMailHeader(msg, org.apache.axis2.transport.mail.Constants.IN_REPLY_TO); if (inReplyTo != null) { transportInfo.setInReplyTo(inReplyTo); } msgContext.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO, transportInfo); buildSOAPEnvelope(msg, msgContext); if(!fillMessageContextFromAvaiableData(msgContext,inReplyTo)){ return null; } } return msgContext; } private boolean fillMessageContextFromAvaiableData(MessageContext msgContext , String messageID) throws AxisFault{ Hashtable mappingTable = (Hashtable) configurationContext. getProperty(org.apache.axis2.transport.mail.Constants.MAPPING_TABLE); synchronized (mappingTable) { if (mappingTable != null && messageID != null) { String messageConetextId = (String) mappingTable.get(messageID); if (messageConetextId != null) { OperationContext opContext = configurationContext.getOperationContext(messageConetextId); if (opContext != null && !opContext.isComplete()) { AxisOperation axisOp = opContext.getAxisOperation(); //TODO need to handle fault case as well , //TODO need to check whether the message contains fault , if so we need to get the fault message AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); msgContext.setOperationContext(opContext); msgContext.setAxisMessage(inMessage); opContext.addMessageContext(msgContext); msgContext.setServiceContext(opContext.getServiceContext()); } } } } Hashtable callBackTable = (Hashtable) configurationContext.getProperty(org.apache.axis2.transport.mail.Constants.CALLBACK_TABLE); synchronized (callBackTable) { if (messageID != null && callBackTable != null) { SynchronousMailListener listener = (SynchronousMailListener) callBackTable.get(messageID); if (listener != null) { listener.setInMessageContext(msgContext); return false; } } } return true; } private void buildSOAPEnvelope(MimeMessage msg, MessageContext msgContext) throws AxisFault { //TODO we assume for the time being that there is only one attachement and this attachement contains the soap evelope try { Multipart mp = (Multipart) msg.getContent(); if (mp != null) { for (int i = 0, n = mp.getCount(); i < n; i++) { Part part = mp.getBodyPart(i); String disposition = part.getDisposition(); if (disposition != null && disposition.equalsIgnoreCase(Part.ATTACHMENT)) { String soapAction; /* Set the Charactorset Encoding */ String contentType = part.getContentType(); String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType); if (charSetEncoding != null) { msgContext.setProperty( org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); } else { msgContext.setProperty( org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING, MessageContext.DEFAULT_CHAR_SET_ENCODING); } /* SOAP Action */ soapAction = getMailHeaderFromPart(part, org.apache.axis2.transport.mail.Constants.HEADER_SOAP_ACTION); msgContext.setSoapAction(soapAction); String contentDescription = getMailHeaderFromPart(part, "Content-Description"); /* As an input stream - using the getInputStream() method. Any mail-specific encodings are decoded before this stream is returned.*/ if (contentDescription != null) { msgContext.setTo(new EndpointReference(contentDescription)); } if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { TransportUtils .processContentTypeForAction(contentType, msgContext); } else { // According to the mail sepec, mail transport should support only // application/soap+xml; String message = "According to the mail sepec, mail transport " + "should support only application/soap+xml"; log.error(message); throw new AxisFault(message); } String cte = getMailHeaderFromPart(part, "Content-Transfer-Encoding"); if (!(cte != null && cte.equalsIgnoreCase("base64"))) { String message = "Processing of Content-Transfer-Encoding faild."; log.error(message); throw new AxisFault(message); } InputStream inputStream = part.getInputStream(); SOAPEnvelope envelope = TransportUtils .createSOAPMessage(msgContext, inputStream, contentType); msgContext.setEnvelope(envelope); } } } } catch (IOException e) { throw new AxisFault(e.getMessage(),e); } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } catch (XMLStreamException e) { throw new AxisFault(e.getMessage(),e); } } private String getMailHeader(MimeMessage msg, String headerName) throws AxisFault { try { String values[] = msg.getHeader(headerName); if (values != null) { return parseHeaderForQuotes(values[0]); } else { return null; } } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } private String parseHeaderForLessThan(String value) { if (value != null) { if (value.length() > 1 && value.startsWith("<") && value.endsWith(">")) { value = value.substring(1, value.length()-1); } } return value; } private String parseHeaderForQuotes(String value) { if (value != null) { if (value.length() > 1 && value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); } } return value; } private String getMailHeaderFromPart(Part part, String headerName) throws AxisFault { try { String values[] = part.getHeader(headerName); if (values != null) { return parseHeaderForQuotes(values[0]); } else { return null; } } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } /** * Start this listener */ public void start() throws AxisFault { this.configurationContext.getThreadPool().execute(this); } /** * Stop this server. *

    */ public void stop() { running = false; log.info("Stopping the mail listner"); } public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return getEPRsForService(serviceName, ip)[0]; } public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { return new EndpointReference[]{ new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "?" + org.apache.axis2.transport.mail.Constants.X_SERVICE_PATH + "=" + configurationContext.getServiceContextPath() + "/" + serviceName), new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "?" + configurationContext.getServiceContextPath() + "/" + serviceName) }; } public SessionContext getSessionContext(MessageContext messageContext) { return null; } public void destroy() { this.configurationContext = null; } } ./src/org/apache/axis2/transport/mail/MailWorker.java0000664000175000017500000000413711767656530021734 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.util.MessageContextBuilder; public class MailWorker implements Runnable { private ConfigurationContext configContext = null; private MessageContext messageContext; /** * Constructor for MailWorker * */ public MailWorker(ConfigurationContext reg, MessageContext messageContext) { this.configContext = reg; this.messageContext = messageContext; } /** * The main workhorse method. */ public void run() { AxisEngine engine = new AxisEngine(configContext); // create and initialize a message context try { engine.receive(messageContext); } catch (Exception e) { try { if (messageContext != null&&!messageContext.isServerSide()) { MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(messageContext, e); engine.sendFault(faultContext); } } catch (Exception e1) { // Ignore errors that would possibly happen this catch } } } } ./src/org/apache/axis2/transport/mail/MailClient.java0000664000175000017500000001056611767656530021704 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.Authenticator; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Store; import javax.mail.Transport; import javax.mail.internet.MimeMessage; import java.io.IOException; import java.util.Properties; public class MailClient extends Authenticator { public static final int SHOW_MESSAGES = 1; public static final int CLEAR_MESSAGES = 2; public static final int SHOW_AND_CLEAR = SHOW_MESSAGES + CLEAR_MESSAGES; private static final Log log = LogFactory.getLog(MailClient.class); protected PasswordAuthentication authentication; protected String from; protected Session session; public MailClient(String user, String host) { this(user, host, user, false); } public MailClient(String user, String host, String password) { this(user, host, password, false); } public MailClient(String user, String host, String password, boolean debug) { from = user + '@' + host; authentication = new PasswordAuthentication(user, password); Properties props = new Properties(); props.put("mail.user", user); props.put("mail.host", host); props.put("mail.debug", debug ? "true" : "false"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); session = Session.getInstance(props, this); } public int checkInbox(int mode) throws MessagingException, IOException { int numMessages = 0; if (mode == 0) { return 0; } boolean show = (mode & SHOW_MESSAGES) > 0; boolean clear = (mode & CLEAR_MESSAGES) > 0; String action = (show ? "Show" : "") + ((show && clear) ? " and " : "") + (clear ? "Clear" : ""); log.info(action + " INBOX for " + from); Store store = session.getStore(); store.connect(); Folder root = store.getDefaultFolder(); Folder inbox = root.getFolder("inbox"); inbox.open(Folder.READ_WRITE); Message[] msgs = inbox.getMessages(); numMessages = msgs.length; if ((msgs.length == 0) && show) { log.info("No messages in inbox"); } for (int i = 0; i < msgs.length; i++) { MimeMessage msg = (MimeMessage) msgs[i]; if (show) { log.info(" From: " + msg.getFrom()[0]); log.info(" Subject: " + msg.getSubject()); log.info(" Content: " + msg.getContent()); } if (clear) { msg.setFlag(Flags.Flag.DELETED, true); } } inbox.close(true); store.close(); return numMessages; } public void sendMessage(String to, String subject, String content, String soapAction) throws MessagingException { log.info("SENDING message from " + from + " to " + to); MimeMessage msg = new MimeMessage(session); msg.setHeader("transport.mail.soapaction", soapAction); msg.addRecipients(Message.RecipientType.TO, to); msg.setSubject(subject); msg.setText(content); Transport.send(msg); } public PasswordAuthentication getPasswordAuthentication() { return authentication; } } ./src/org/apache/axis2/transport/mail/Constants.java0000664000175000017500000000773411767656530021642 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; public class Constants { public final static String HEADER_SOAP_ACTION = "mail.soapaction"; public final static String FROM_ADDRESS = "mail.smtp.from"; public final static String SMTP_USER = "mail.smtp.user"; public final static String SMTP_PORT = "mail.smtp.port"; public final static String SMTP_HOST = "mail.smtp.host"; public final static String SMTP_USER_PASSWORD = "transport.mail.smtp.password"; public final static String POP3_USER = "mail.pop3.user"; public final static String POP3_PORT = "mail.pop3.port"; public final static String POP3_PASSWORD = "transport.mail.pop3.password"; public final static String POP3_HOST = "mail.pop3.host"; public final static String STORE_PROTOCOL = "mail.store.protocol"; public final static String REPLY_TO = "transport.mail.replyToAddress"; public final static String LISTENER_INTERVAL = "transport.listener.interval"; public final static int SMTP_SERVER_PORT = (1024 + 25); public final static String SERVER_DOMAIN = "localhost"; public final static String RCPT_OK = "250 OK performed command RCPT"; public final static String RCPT_ERROR = "550 Unknown recipient"; public final static int POP_SERVER_PORT = (1024 + 110); public final static String OK = "+OK "; public final static String MAIL_OK = "250 OK performed command MAIL"; public final static String MAIL_ERROR = "550 Error processign MAIL command"; public final static String HELO_REPLY = "250 OK"; public final static String ERR = "-ERR "; public final static String DEFAULT_CONTENT_TYPE = "text/xml"; public final static String DEFAULT_CHAR_SET_ENCODING = "7bit"; public final static String DEFAULT_CHAR_SET = "us-ascii"; public final static String DATA_START_SUCCESS = "354 OK Ready for data"; public final static String DATA_END_SUCCESS = "250 OK finished adding data"; public final static String CONTENT_TYPE = "mail.contenttype"; public final static String CONTENT_LOCAION = "mail.contentlocation"; public final static String COMMAND_UNKNOWN = "550 Unknown command"; public final static String COMMAND_TRANSMISSION_END = "221 Closing SMTP service."; public final static String COMMAND_EXIT = "EXIT"; public final static String USER = "USER"; public final static String STAT = "STAT"; public final static String RSET = "RSET"; public final static String RETR = "RETR"; public final static String QUIT = "QUIT"; public final static String PASS = "PASS"; public final static String NOOP = "NOOP"; public final static String LIST = "LIST"; public final static String DELE = "DELE"; public static final String MAIL_SMTP = "_MAIL_SMTP_"; public static final String MAIL_POP3 = "_MAIL_POP3_"; public static final String X_SERVICE_PATH = "X-Service-Path"; public static final String MAIL_SYNC = "_MAIL_SYNC_"; public static final String IN_REPLY_TO = "In-Reply-To"; public static final String RETURN_PATH = "Return-path"; public static final String MAILTO = "mailto"; public static final String MAPPING_TABLE = "mappingTable"; public static final String CALLBACK_TABLE = "callbackTable"; } ./src/org/apache/axis2/transport/mail/SynchronousMailListener.java0000664000175000017500000001216411767656530024522 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SynchronousMailListener { private static Log log = LogFactory.getLog(SynchronousMailListener.class); private boolean complete = false; //To store out going messageconext private MessageContext outMessageContext; private MessageContext inMessageContext; private long timeoutInMilliseconds = -1; public SynchronousMailListener(MessageContext outMessageContext, long timeoutInMilliseconds) { this.outMessageContext = outMessageContext; this.timeoutInMilliseconds = timeoutInMilliseconds; } public void setInMessageContext(MessageContext inMessageContext) throws AxisFault{ OperationContext operationContext = outMessageContext.getOperationContext(); MessageContext msgCtx = operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if(msgCtx==null){ // try to see whether there is a piggy back message context if (outMessageContext.getProperty(org.apache.axis2.Constants.PIGGYBACK_MESSAGE) != null) { msgCtx = (MessageContext) outMessageContext.getProperty(org.apache.axis2.Constants.PIGGYBACK_MESSAGE); msgCtx.setTransportIn(inMessageContext.getTransportIn()); msgCtx.setTransportOut(inMessageContext.getTransportOut()); msgCtx.setServerSide(false); msgCtx.setProperty(org.apache.axis2.transport.mail.Constants.CONTENT_TYPE, inMessageContext.getProperty(org.apache.axis2.transport.mail.Constants.CONTENT_TYPE)); msgCtx.setIncomingTransportName(org.apache.axis2.Constants.TRANSPORT_MAIL); msgCtx.setEnvelope(inMessageContext.getEnvelope()); } else { inMessageContext.setOperationContext(operationContext); inMessageContext.setServiceContext(outMessageContext.getServiceContext()); if (!operationContext.isComplete()) { operationContext.addMessageContext(inMessageContext); } AxisOperation axisOp = operationContext.getAxisOperation(); //TODO need to handle fault case as well , //TODO need to check whether the message contains fault , if so we need to get the fault message AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); inMessageContext.setAxisMessage(inMessage); inMessageContext.setServerSide(false); } } else { msgCtx.setOperationContext(operationContext); msgCtx.setServiceContext(outMessageContext.getServiceContext()); AxisOperation axisOp = operationContext.getAxisOperation(); AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); msgCtx.setAxisMessage(inMessage); msgCtx.setTransportIn(inMessageContext.getTransportIn()); msgCtx.setTransportOut(inMessageContext.getTransportOut()); msgCtx.setServerSide(false); msgCtx.setProperty(org.apache.axis2.transport.mail.Constants.CONTENT_TYPE, inMessageContext.getProperty(org.apache.axis2.transport.mail.Constants.CONTENT_TYPE)); msgCtx.setIncomingTransportName(org.apache.axis2.Constants.TRANSPORT_MAIL); msgCtx.setEnvelope(inMessageContext.getEnvelope()); } this.inMessageContext = inMessageContext; log.info(" SynchronousMailListener found the required message."); complete = true; } public long getTimeoutInMilliseconds() { return timeoutInMilliseconds; } public void setTimeoutInMilliseconds(long timeoutInMilliseconds) { this.timeoutInMilliseconds = timeoutInMilliseconds; } public boolean isComplete() { return complete; } public MessageContext getInMessageContext() { return inMessageContext; } } ./src/org/apache/axis2/transport/mail/EmailReceiver.java0000664000175000017500000000541111767656530022370 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axis2.AxisFault; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Store; import javax.mail.URLName; import java.util.Properties; public class EmailReceiver { private URLName urlName; private Properties pop3Properties; private Folder folder; /* This store could be either POP3Store or POP3SSLStore */ private Store store; public EmailReceiver() { } public void setUrlName(URLName urlName) { this.urlName = urlName; } public void setPop3Properties(Properties pop3Properties) { this.pop3Properties = pop3Properties; } public void connect() throws AxisFault { try { Session session = Session.getInstance(pop3Properties, null); store = session.getStore(urlName); store.connect(); folder = store.getDefaultFolder(); folder = folder.getFolder("inbox"); } catch (NoSuchProviderException e) { throw new AxisFault(e.getMessage(),e); } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } public void disconnect() throws AxisFault { try { folder.close(true); store.close(); } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } public Message[] receiveMessages() throws AxisFault { try { folder.open(Folder.READ_WRITE); Message[] msgs = folder.getMessages(); if (msgs.length == 0) { return null; } else { return msgs; } } catch (NoSuchProviderException e) { throw new AxisFault(e.getMessage(),e); } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } } ./src/org/apache/axis2/transport/mail/EMailSender.java0000664000175000017500000002663111767656530022013 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.OutOnlyAxisOperation; import org.apache.axis2.description.TransportInDescription; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.CommandMap; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.MailcapCommandMap; import javax.mail.Authenticator; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.Part; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.util.Hashtable; import java.util.Properties; public class EMailSender { private Properties properties; private MessageContext messageContext; private PasswordAuthentication passwordAuthentication; private OutputStream outputStream; private String inReplyTo; private EndpointReference from; private OMOutputFormat format; protected static Log log = LogFactory.getLog(EMailSender.class); static { //Initializing the proper mime types MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap( "application/soap+xml;;x-java-content-handler=com.sun.mail.handlers.text_xml"); CommandMap.setDefaultCommandMap(mc); } public EMailSender() { } public void setMessageContext(MessageContext messageContext) { this.messageContext = messageContext; } public void setProperties(Properties properties) { this.properties = properties; } public OutputStream getOutputStream() { return outputStream; } public void setOutputStream(OutputStream outputStream) { this.outputStream = outputStream; } public void setPasswordAuthentication(PasswordAuthentication passwordAuthentication) { this.passwordAuthentication = passwordAuthentication; } public void send() throws AxisFault { try { Session session = Session.getInstance(properties, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return passwordAuthentication; } }); MimeMessage msg = new MimeMessage(session); // Set date - required by rfc2822 msg.setSentDate(new java.util.Date()); // Set from - required by rfc2822 String from = properties.getProperty("mail.smtp.from"); if( from != null ) { msg.setFrom(new InternetAddress(from)); } EndpointReference epr = null; MailToInfo mailToInfo; if (messageContext.getTo() != null && !messageContext.getTo().hasAnonymousAddress()) { epr = messageContext.getTo(); } if (epr != null) { if (!epr.hasNoneAddress()) { mailToInfo = new MailToInfo(epr); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(mailToInfo.getEmailAddress())); } else { if (from != null) { mailToInfo = new MailToInfo(from); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(mailToInfo.getEmailAddress())); } else { String error = EMailSender.class.getName() + "Couldn't countinue due to" + " FROM addressing is NULL"; log.error(error); throw new AxisFault(error); } } } else { // replyto : from : or reply-path; if (from != null) { mailToInfo = new MailToInfo(from); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(mailToInfo.getEmailAddress())); } else { String error = EMailSender.class.getName() + "Couldn't countinue due to" + " FROM addressing is NULL and EPR is NULL"; log.error(error); throw new AxisFault(error); } } msg.setSubject("__ Axis2/Java Mail Message __"); if (mailToInfo.isxServicePath()) { msg.setHeader(Constants.X_SERVICE_PATH, "\"" + mailToInfo.getContentDescription() + "\""); } if (inReplyTo != null) { msg.setHeader(Constants.IN_REPLY_TO, inReplyTo); } createMailMimeMessage(msg, mailToInfo, format); Transport.send(msg); log.info("Message being send. [Action = ]" + messageContext.getOptions().getAction()); sendReceive(messageContext, msg.getMessageID()); } catch (AddressException e) { throw new AxisFault(e.getMessage(),e); } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } private void createMailMimeMessage(final MimeMessage msg, MailToInfo mailToInfo, OMOutputFormat format) throws MessagingException { // Create the message part BodyPart messageBodyPart = new MimeBase64BodyPart(); messageBodyPart.setText(""); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); DataSource source = null; // Part two is attachment if (outputStream instanceof ByteArrayOutputStream) { source = new ByteArrayDataSource(((ByteArrayOutputStream) outputStream).toByteArray()); } messageBodyPart = new MimeBase64BodyPart(); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setDisposition(Part.ATTACHMENT); messageBodyPart .addHeader("Content-Description", "\"" + mailToInfo.getContentDescription() + "\""); String contentType = format.getContentType() != null ? format.getContentType() : Constants.DEFAULT_CONTENT_TYPE; if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { if (messageContext.getSoapAction() != null) { messageBodyPart.setHeader(Constants.HEADER_SOAP_ACTION, messageContext.getSoapAction()); } } if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { if (messageContext.getSoapAction() != null) { messageBodyPart.setHeader("Content-Type", contentType + "; charset=" + format.getCharSetEncoding() + " ; action=\"" + messageContext.getSoapAction() + "\""); } } else { messageBodyPart.setHeader("Content-Type", contentType + "; charset=" + format.getCharSetEncoding()); } multipart.addBodyPart(messageBodyPart); msg.setContent(multipart); } public void setInReplyTo(String inReplyTo) { this.inReplyTo = inReplyTo; } public void setFrom(EndpointReference from) { this.from = from; } public void setFormat(OMOutputFormat format) { this.format = format; } private void sendReceive(MessageContext msgContext, String msgId) throws AxisFault { storeMessageContext(msgContext, msgId); ConfigurationContext cc = msgContext.getConfigurationContext(); //While sysncmial listner .not complete Options options = msgContext.getOptions(); long outInMilliSeconds = options.getTimeOutInMilliSeconds(); SynchronousMailListener synchronousMailListener = null; //No need to stor the message context if the mep is out-only AxisOperation axisOperation = msgContext.getAxisOperation(); // piggy back message constant is used to pass a piggy back // message context in asnych model if(axisOperation instanceof OutOnlyAxisOperation && (msgContext.getProperty(org.apache.axis2.Constants.PIGGYBACK_MESSAGE) == null)) { return; } if (!options.isUseSeparateListener() && !msgContext.isServerSide()) { if(!cc.getListenerManager().isListenerRunning(Constants.MAILTO)){ TransportInDescription mailTo= cc.getAxisConfiguration().getTransportIn(Constants.MAILTO); if(mailTo==null){ throw new AxisFault("Could not found transport for " +Constants.MAILTO ); } cc.getListenerManager().addListener(mailTo,false); } Hashtable callBackTable = (Hashtable) cc.getProperty(Constants.CALLBACK_TABLE); if(callBackTable!=null){ synchronousMailListener = new SynchronousMailListener(messageContext, outInMilliSeconds); callBackTable.put(msgId,synchronousMailListener); } while(!synchronousMailListener.isComplete()){ try { Thread.sleep(6000); } catch (InterruptedException e) { throw new AxisFault(e.getMessage(),e); } } callBackTable.remove(msgId); } } private void storeMessageContext(MessageContext msgContext, String msgId) { Hashtable mappingTable = (Hashtable) msgContext.getConfigurationContext(). getProperty(Constants.MAPPING_TABLE); if (mappingTable == null) { mappingTable = new Hashtable(); msgContext.setProperty(Constants.MAPPING_TABLE, mappingTable); } if (msgContext.getMessageID() != null) { mappingTable.put(msgId, msgContext.getMessageID()); } } } ./src/org/apache/axis2/transport/mail/MailWorkerManager.java0000664000175000017500000000356711767656530023235 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; /* * */ public class MailWorkerManager { private LinkedBlockingQueue messageQueue; private ExecutorService workerPool; private int poolSize; private ConfigurationContext configurationContext; public MailWorkerManager() { } public MailWorkerManager(ConfigurationContext configurationContext, LinkedBlockingQueue messageQueue, ExecutorService workerPool, int poolSize) { this.messageQueue = messageQueue; this.workerPool = workerPool; this.poolSize = poolSize; this.configurationContext = configurationContext; } public void start() throws AxisFault { for (int i = 0; i < poolSize; i++) { // workerPool.execute(new MailWorker(configurationContext, messageQueue)); } } } ./src/org/apache/axis2/transport/mail/MimeBase64BodyPart.java0000664000175000017500000000232411767656530023155 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; /** * The main purpose of this class is to encode mime body part with * base64 encoding */ public class MimeBase64BodyPart extends MimeBodyPart { protected void updateHeaders() throws MessagingException { super.updateHeaders(); setHeader("Content-Transfer-Encoding", "base64"); } } ./src/org/apache/axis2/transport/mail/MailBasedOutTransportInfo.java0000664000175000017500000000301111767656530024710 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.transport.OutTransportInfo; public class MailBasedOutTransportInfo implements OutTransportInfo { protected String contentType; protected String inReplyTo; protected EndpointReference from; public void setContentType(String contentType) { this.contentType = contentType; } public void setInReplyTo(String messageId) { this.inReplyTo = messageId; } public String getInReplyTo() { return this.inReplyTo; } public EndpointReference getFrom() { return from; } public void setFrom(EndpointReference from) { this.from = from; } } ./src/org/apache/axis2/transport/mail/MailTransportSender.java0000664000175000017500000002474311767656530023625 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.OutTransportInfo; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.axis2.transport.http.HttpTransportProperties; import org.apache.axis2.util.Utils; import javax.mail.PasswordAuthentication; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; /** * 0. For this profile we only care about SOAP 1.2 * 1. There should be no mime text body in this case * 2. The SOAP envelope should be base64 encoded and marked with the following headers * SOAP 1.2 * Content-Type: application/soap+xml; charset=UTF-8 ; action="soap-action-goes-here" * Content-Transfer-Encoding: base64 * Content-Description: "/serviceName" * 3. The content-description is the logical name of the service. It should be quoted. * 4. The subject can be anything. Perhaps something like "SOAP Message" might be useful to people looking at the mail in a normal mail browser. * 5. If there are attachments the there will be a mime multipart. There should only be one part with content-type: application/soap+xml. * 6. The service URL will be created as mailto:paul@wso2.com?X-Service-Path=/axis2/services/MyService * or paul@wso2.com?/axis2/services/MyService *

    *

    * Example without attachments * ======================== * From: rm_client@lenio.dk * To: lenioserver@oiositest.dk * Message-ID: <8868170.01165394158287.JavaMail.hgk@hans-guldager-knudsens-computer.local> * Subject: ANYTHING * MIME-Version: 1.0 * Content-Type: application/soap+xml; charset=UTF-8 ; action="http://rep.oio.dk/oiosi/IMessageHandler/RequestRespondRequest" * Content-Transfer-Encoding: base64 * Content-Description: /my/service/urlpath *

    * PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48c29hcGVudjpFbnZlbG9wZSB4 * Y3VtZW50YXRpb24uPC9EZXNjcmlwdGlvbj48L05vdGlmaWNhdGlvbj48L3NvYXBlbnY6Qm9keT48 * L3NvYXBlbnY6RW52ZWxvcGU+ *

    * ======================== *

    * Example with attachments *

    * ======================== * From: rm_client@lenio.dk * To: lenioserver@oiositest.dk * Message-ID: <8868170.01165394158287.JavaMail.hgk@hans-guldager-knudsens-computer.local> * Subject: ANYTHING * MIME-Version: 1.0 * content-type: multipart/mixed; boundary=--boundary_0_9fdec710-2336-4dc9-8bcd-45f2c06cf605 *

    * ----boundary_0_9fdec710-2336-4dc9-8bcd-45f2c06cf605 * Content-Type: application/soap+xml; charset=UTF-8 ; action="http://rep.oio.dk/oiosi/IMessageHandler/RequestRespondRequest" * Content-Transfer-Encoding: base64 * Content-Description: /my/service/urlpath *

    * PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48c29hcGVudjpFbnZlbG9wZSB4 * Y3VtZW50YXRpb24uPC9EZXNjcmlwdGlvbj48L05vdGlmaWNhdGlvbj48L3NvYXBlbnY6Qm9keT48 * L3NvYXBlbnY6RW52ZWxvcGU+ *

    * ----boundary_0_9fdec710-2336-4dc9-8bcd-45f2c06cf605 * ----boundary_0_9fdec710-2336-4dc9-8bcd-45f2c06cf605 * content-type: application/octet-stream * content-transfer-encoding: base64 *

    * PHM6RW52ZWxvcGUgeG1sbnM6cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMy8wNS9zb2FwLWVu * dmVsb3BlIiB4bWxuczphPSJodHRwOi8vd3d3LnczLm9yZy8yMDA1LzA4L2FkZHJlc3Npbmci * IHhtbG5zOnU9Imh0dHA6Ly9kb2NzLm9hc2lzLW9wZW4ub3JnL3dzcy8yMDA0LzAxL29hc2lz * LTIwMDQwMS13c3Mtd3NzZWN1cml0eS11dGlsaXR5LTEuMC54c2QiPjxzOkhlYWRlcj48YTpB * Y3Rpb24gczptdXN0VW5kZXJzdGFuZD0iMSI+aHR0cDovL3JlcC5vaW8uZGsvb2lvc2kvSU1l * c3NhZ2VIYW5kbGVyL1JlcXVlc3RSZXNwb25kUmVxdWVzdDwvYTpBY3Rpb24+PGE6TWVzc2Fn */ public class MailTransportSender extends AbstractHandler implements TransportSender { /* smtpProperties holds all the parameters needed to Java Mail. This will be filled either from Axis2.xml or from runtime. */ private final java.util.Properties smtpProperties = new java.util.Properties(); private PasswordAuthentication passwordAuthentication; private ByteArrayOutputStream byteArrayOutputStream; private final static String NAME = "MailTransportSender"; public MailTransportSender() { init(new HandlerDescription(NAME)); } public void init(ConfigurationContext configurationContext, TransportOutDescription transportOut) throws AxisFault { ArrayList mailParameters = transportOut.getParameters(); String password = ""; String username = ""; for (Iterator iterator = mailParameters.iterator(); iterator.hasNext();) { Parameter param = (Parameter) iterator.next(); String paramKey = param.getName(); String paramValue = Utils.getParameterValue(param); if (paramKey == null || paramValue == null) { throw new AxisFault(Messages.getMessage("canNotBeNull", "Parameter name and value")); } smtpProperties.setProperty(paramKey, paramValue); if (paramKey.equals(Constants.SMTP_USER)) { username = paramValue; } if (paramKey.equals(Constants.SMTP_USER_PASSWORD)) { password = paramValue; } } passwordAuthentication = new PasswordAuthentication(username, password); } public void cleanup(MessageContext msgContext) throws AxisFault { } private void mailProperties(MessageContext msgContext) { Object obj = msgContext.getProperty(Constants.MAIL_SMTP); if (obj != null) { // Overide the axis2.xml cofiguration setting if (obj instanceof HttpTransportProperties.MailProperties) { HttpTransportProperties.MailProperties props = (HttpTransportProperties.MailProperties) obj; smtpProperties.clear(); smtpProperties.putAll(props.getProperties()); String username = (String) smtpProperties.get(Constants.SMTP_USER); String passwd = props.getPassword(); passwordAuthentication = new PasswordAuthentication(username, passwd); } else if (obj instanceof java.util.Properties) { smtpProperties.clear(); java.util.Properties props = (java.util.Properties) obj; smtpProperties.putAll(props); } } } public void sendMimeMessage(MessageContext msgContext) throws AxisFault { try { // Override with runtime settings mailProperties(msgContext); EMailSender sender = new EMailSender(); sender.setOutputStream(byteArrayOutputStream); sender.setMessageContext(msgContext); sender.setProperties(smtpProperties); sender.setPasswordAuthentication(passwordAuthentication); // In mail char set is what is being used. Charset encoding is not what is expected here. String charSet = (String) msgContext.getProperty( org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING); if (charSet == null) { charSet = MessageContext.DEFAULT_CHAR_SET_ENCODING; } OMOutputFormat format = new OMOutputFormat(); format.setSOAP11(msgContext.isSOAP11()); format.setCharSetEncoding(charSet); // Check if msg is 'In-Reply-To' received message OutTransportInfo transportInfo = (OutTransportInfo) msgContext .getProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO); if (transportInfo != null && transportInfo instanceof MailBasedOutTransportInfo) { MailBasedOutTransportInfo mailTransportInfo = (MailBasedOutTransportInfo) transportInfo; sender.setInReplyTo(mailTransportInfo.getInReplyTo()); sender.setFrom(mailTransportInfo.getFrom()); } sender.setFormat(format); sender.send(); } catch (IOException e) { throw new AxisFault(e.getMessage(),e); } } public void writeMimeMessage(MessageContext msgContext, OutputStream out) throws AxisFault { try { OMOutputFormat format = new OMOutputFormat(); MessageFormatter messageFormatter = TransportUtils .getMessageFormatter(msgContext); format.setDoOptimize(msgContext.isDoingMTOM()); //Set to null so that the code will not fail on 7bit. format.setCharSetEncoding(null); messageFormatter.writeTo(msgContext, format, out, false); out.flush(); } catch (Exception e) { throw new AxisFault(e.getMessage(),e); } } public void stop() { } /** * @param msgContext * @return * @throws AxisFault */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); byteArrayOutputStream = new ByteArrayOutputStream(); writeMimeMessage(msgContext, byteArrayOutputStream); sendMimeMessage(msgContext); return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/transport/mail/server/0000775000175000017500000000000011767656530020316 5ustar brianbrian./src/org/apache/axis2/transport/mail/server/SMTPServer.java0000664000175000017500000000575011767656530023142 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class SMTPServer extends Thread { private static final Log log = LogFactory.getLog(SMTPServer.class); private boolean actAsMailet = false; private boolean running = false; private ConfigurationContext configurationContext; private int port; private ServerSocket ss; private Storage st; public SMTPServer(Storage st, int port) { this.st = st; this.port = port; actAsMailet = false; } public SMTPServer(Storage st, ConfigurationContext configurationContext, int port) { this.st = st; this.configurationContext = configurationContext; this.port = port; actAsMailet = true; } public void run() { runServer(); } public void runServer() { try { synchronized (this) { running = true; ss = new ServerSocket(port); log.info("SMTP Server started on port " + port); } } catch (IOException ex) { log.info(ex.getMessage()); } while (running) { try { // wait for a client Socket socket = ss.accept(); SMTPWorker thread = null; if (actAsMailet) { thread = new SMTPWorker(socket, st, configurationContext); } else { thread = new SMTPWorker(socket, st); } thread.start(); } catch (IOException ex) { if (running) { log.info(ex.getMessage()); } } } } public void stopServer() throws AxisFault { try { synchronized (this) { running = false; ss.close(); ss = null; } } catch (IOException e) { throw new AxisFault(e.getMessage(),e); } } } ./src/org/apache/axis2/transport/mail/server/POP3Server.java0000664000175000017500000000421211767656530023070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class POP3Server extends Thread { private static final Log log = LogFactory.getLog(POP3Server.class); private Storage st = null; private ServerSocket serverSocket; public POP3Server(Storage st, int port) throws AxisFault { this.st = st; try { synchronized (this) { serverSocket = new ServerSocket(port); log.info("Server started on port " + port); } } catch (IOException e) { throw new AxisFault(e.getMessage(),e); } } public void run() { while (true) { try { Socket socket = serverSocket.accept(); POP3Worker thread = new POP3Worker(socket, st); thread.start(); } catch (Exception e) { log.error(e.getMessage(), e); } } } public void stopServer() throws AxisFault { try { synchronized (this) { serverSocket.close(); } } catch (IOException e) { throw new AxisFault(e.getMessage(),e); } } } ./src/org/apache/axis2/transport/mail/server/SMTPWorker.java0000664000175000017500000002076111767656530023144 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.transport.mail.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.internet.MimeMessage; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.Socket; import java.util.ArrayList; import java.util.Properties; public class SMTPWorker extends Thread { private BufferedReader reader = null; private BufferedWriter writer = null; private boolean transmitionEnd = false; private String temp = ""; private Storage st = null; boolean runThread = true; private ArrayList receivers = new ArrayList(); private MimeMessage mail = null; private static final Log log = LogFactory.getLog(SMTPWorker.class); private boolean dataWriting = false; private ConfigurationContext configurationContext = null; private boolean bodyData = false; private boolean actAsMailet = false; public SMTPWorker(Socket socket, Storage st) { doWork(socket, st, null); } public SMTPWorker(Socket socket, Storage st, ConfigurationContext configurationContext) { doWork(socket, st, configurationContext); } private void doWork(Socket socket, Storage st, ConfigurationContext configurationContext) { try { this.st = st; if (configurationContext == null) { actAsMailet = false; } else { this.configurationContext = configurationContext; actAsMailet = true; } // get the streams from the socket and save in instance variables. reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); } catch (IOException ex) { log.info(ex.getMessage()); } } // transmission is over. setting to exit private void exitWorker() throws IOException { reader.close(); writer.close(); runThread = false; } // initializing the client by sending the initial message. private void initializeClient() throws IOException { if (writer != null) { send("220 SMTP Server IS UP"); } } private String processInput(String input) { if (input == null) { return Constants.COMMAND_UNKNOWN; } if ((mail != null) && transmitionEnd) { return Constants.COMMAND_TRANSMISSION_END; } if (input.startsWith("MAIL")) { mail = new MimeMessage(Session.getInstance(new Properties(), new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return null; } })); int start = input.indexOf("<") + 1; int end; if (start <= 0) { start = input.indexOf("FROM:") + 5; end = input.length(); } else { end = input.indexOf(">"); } String from = input.substring(start, end); if ((from != null) && from.trim().length() != 0) { // TODO this is an ugly hack to get the from address in. There // should be a better way to do this. MailAddress mailFrom[] = new MailAddress[1]; mailFrom[0] = new MailAddress(from); try { mail.addFrom(mailFrom); } catch (MessagingException e) { log.info(e.getMessage()); } } return Constants.MAIL_OK; } if (input.startsWith("HELO")) { return Constants.HELO_REPLY; } else if (input.startsWith("RCPT")) { int start = input.indexOf("<") + 1; int end; if (start <= 0) { start = input.indexOf("TO:") + 3; /* * if(!input.endsWith(domain)){ System.out.println("ERROR: wrong * donmain name"); return Constants.RCPT_ERROR; } */ } else { /* * if(!input.endsWith(domain + ">")){ System.out.println("ERROR: * wrong donmain name"); return Constants.RCPT_ERROR; } */ } end = input.indexOf(">"); String toStr = input.substring(start, end); try { mail.addRecipient(Message.RecipientType.TO, new MailAddress(toStr)); receivers.add(toStr); } catch (MessagingException e) { log.info(e.getMessage()); } return Constants.RCPT_OK; } else if (input.equalsIgnoreCase("DATA")) { dataWriting = true; return Constants.DATA_START_SUCCESS; } else if (input.equalsIgnoreCase("QUIT")) { dataWriting = true; transmitionEnd = true; return Constants.COMMAND_TRANSMISSION_END; } else if (input.equals(".")) { dataWriting = false; return Constants.DATA_END_SUCCESS; } else if (input.length() == 0 && !bodyData) { bodyData = true; return null; } else if ((mail != null) && dataWriting) { try { if (bodyData) { temp += input; mail.setContent(temp, "text/xml"); //Since this is for axis2 :-) } else { mail.addHeaderLine(input); } } catch (MessagingException e) { log.info(e.getMessage()); } return null; } else { return Constants.COMMAND_UNKNOWN; } } // running the thread public void run() { try { // do initial transmission. initializeClient(); // analyze all the inputs from client and work accordingly. while (runThread) { String input = null; // get client input input = reader.readLine(); String retString = processInput(input); if (Constants.COMMAND_EXIT.equals(retString)) { exitWorker(); } else { if (retString != null) { send(retString); // Send the reply } if ((mail != null) && transmitionEnd) { exitWorker(); } } } for (int idx = 0; idx < receivers.size(); idx++) { try { MailSorter mSort = null; if (actAsMailet) { mSort = new MailSorter(this.st, this.configurationContext); } else { mSort = new MailSorter(this.st, null); } mSort.sort((String) receivers.get(idx), new MimeMessage(mail)); } catch (MessagingException e1) { log.info(e1.getMessage()); // e1.printStackTrace(); } } // } catch (IOException e) { log.info("ERROR: CLIENT CLOSED THE SOCKET"); } } private void send(String s) throws IOException { writer.write(s); writer.newLine(); writer.flush(); } } ./src/org/apache/axis2/transport/mail/server/MailServer.java0000664000175000017500000001114511767656530023234 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.transport.mail.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MailServer { private static final Log log = LogFactory.getLog(MailServer.class); Storage st = null; public ConfigurationContext configurationContext = null; private POP3Server pop3Server; private SMTPServer smtpServer; public MailServer(int popPort, int smtpPort) throws AxisFault { st = new Storage(); // Start up the two servers and lets have some fun. - CT smtpServer = new SMTPServer(st, smtpPort); smtpServer.start(); pop3Server = new POP3Server(st, popPort); pop3Server.start(); try { log.info("Sleeping for a bit to let the mail server start up."); Thread.sleep(2000); } catch (InterruptedException e1) { log.error(e1.getMessage(), e1); } } public MailServer(ConfigurationContext configurationContext, int popPort, int smtpPort) throws AxisFault { this.configurationContext = configurationContext; st = new Storage(); // Start up the two servers and lets have some fun. - CT smtpServer = new SMTPServer(st, configurationContext, smtpPort); smtpServer.start(); pop3Server = new POP3Server(st, popPort); pop3Server.start(); try { log.info("Sleeping for a bit to let the mail server start up."); Thread.sleep(2000); } catch (InterruptedException e1) { log.error(e1); } } public MailServer(String dir, int popPort, int smtpPort) throws AxisFault { try { configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(dir, null); } catch (Exception e) { log.error(e.getMessage(), e); } try { log.info("Sleeping for a bit to let the engine start up."); Thread.sleep(2000); } catch (InterruptedException e1) { log.error(e1.getMessage(), e1); } st = new Storage(); // Start up the two servers and lets have some fun. - CT smtpServer = new SMTPServer(st, configurationContext, smtpPort); smtpServer.start(); pop3Server = new POP3Server(st, popPort); pop3Server.start(); try { log.info("Sleeping for a bit to let the engine start up."); Thread.sleep(2000); } catch (InterruptedException e1) { log.error(e1.getMessage(), e1); } } public static void main(String args[]) { int smtpPost = Constants.SMTP_SERVER_PORT; int popPort = Constants.POP_SERVER_PORT; if (args.length == 2) { try { smtpPost = Integer.parseInt(args[0]); popPort = Integer.parseInt(args[1]); } catch (NumberFormatException e1) { log.info("Error in parsing the custom ports."); } } else { log.info("Usage MailServer "); log.info("Using 1134 as the SMTP port and 1049 as the POP port"); } try { new MailServer(popPort, smtpPost); } catch (AxisFault e) { log.info(e.getMessage()); } } public void stop() throws AxisFault { smtpServer.stopServer(); pop3Server.stopServer(); try { log.info("Giving some time for the sockets to close."); Thread.sleep(2000); } catch (InterruptedException e1) { log.error(e1.getMessage(), e1); } } } ./src/org/apache/axis2/transport/mail/server/Storage.java0000664000175000017500000000326611767656530022574 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import javax.mail.internet.MimeMessage; import java.util.ArrayList; import java.util.Hashtable; public class Storage { private Hashtable users = new Hashtable(); public Storage() { } public void addMail(String user, MimeMessage mail) { ArrayList curMailBox = null; if (users.containsKey(user)) { curMailBox = (ArrayList) users.get(user); } else { curMailBox = new ArrayList(); users.put(user, curMailBox); } curMailBox.add(mail); } public ArrayList popUserMails(String user) { ArrayList usrMailBox = new ArrayList(); // This will return a emty list when the user has no mails or no mail box. if (users.containsKey(user)) { usrMailBox = (ArrayList) users.get(user); } return usrMailBox; } } ./src/org/apache/axis2/transport/mail/server/SMTPFaultHandler.java0000664000175000017500000000335411767656530024243 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.Handler; import org.apache.axis2.handlers.AbstractHandler; /** * This will handle faults for SMTP case. */ public class SMTPFaultHandler extends AbstractHandler { public Handler.InvocationResponse invoke(MessageContext msgContext) throws AxisFault { return Handler.InvocationResponse.CONTINUE; } public void flowComplete(MessageContext msgContext) { String protocol = msgContext.getIncomingTransportName(); if (protocol == null) { return; } if (protocol.equalsIgnoreCase(Constants.TRANSPORT_MAIL) && msgContext.isServerSide()) { // This will allow the faults to go out. msgContext.setServerSide(false); } } } ./src/org/apache/axis2/transport/mail/server/POP3Worker.java0000664000175000017500000001634111767656530023101 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axis2.transport.mail.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.util.ArrayList; import java.util.StringTokenizer; public class POP3Worker extends Thread { private static final Log log = LogFactory.getLog(POP3Worker.class); boolean doneProcess = false; int numDeleted = 0; // This is a small hack to get the deleting working with the ArrayList. To keep it simple. ArrayList messages = new ArrayList(); private Socket socket; private Storage st; public POP3Worker(Socket socket, Storage st) { this.socket = socket; this.st = st; } private void processInput(String input, PrintWriter printWriter) { byte[] CR_LF_DOT_CR_LF = new byte[]{0x0D, 0x0A, '.', 0x0D, 0x0A}; String user = ""; if (input == null) { this.doneProcess = true; // This should not be happening } else { ArrayList tokens = new ArrayList(); StringTokenizer stk = new StringTokenizer(input); while (stk.hasMoreTokens()) { tokens.add(stk.nextToken()); } if (tokens.get(0).equals(Constants.USER)) { user = (String) tokens.get(1); messages = st.popUserMails(user); printWriter.println(Constants.OK); } else if (tokens.get(0).equals(Constants.PASS)) { printWriter.println(Constants.OK); // Passwords are not checked. } else if (input.equals(Constants.QUIT)) { printWriter.println(Constants.OK + "POP3 server signing off"); doneProcess = true; } else if (input.equals(Constants.STAT)) { printWriter.println(Constants.OK + messages.size() + " 1"); // We take the maildrop size as one. } else if (tokens.get(0).equals(Constants.LIST)) { // scan listing if (tokens.size() > 1) { try { int optArg = Integer.parseInt((String) tokens.get(1)); int messageArrayIndex = optArg - 1; if ((messageArrayIndex < messages.size()) && (messageArrayIndex >= 0)) { // that is OK careful with numbering printWriter.println(Constants.OK + messageArrayIndex + 1 + " 120"); // Mail size of 120 is just some number. } else { printWriter.println(Constants.ERR + "no such message, only " + (messages.size() + 1) + " messages in maildrop"); } } catch (NumberFormatException e) { log.info(e.getMessage()); printWriter.println(Constants.ERR + "problem passing the index. Index submited was " + tokens.get(1)); } } else { printWriter.println(Constants.OK + messages.size()); for (int i = 0; i < messages.size(); i++) { int messageIndex = i + 1; printWriter.println(messageIndex + " 120"); // List out all the messages with a message size octet of 120 } printWriter.println("."); } } else if (tokens.get(0).equals(Constants.RETR)) { String i = (String) tokens.get(1); try { int index = Integer.parseInt(i); printWriter.println(Constants.OK); MimeMessage m = (MimeMessage) messages.get(index - 1); m.writeTo(socket.getOutputStream()); socket.getOutputStream() .write(CR_LF_DOT_CR_LF); // This is a bit of a hack to get it working. Have to find a bette way to handle this. socket.getOutputStream().flush(); } catch (NumberFormatException e) { printWriter.println(Constants.ERR); } catch (IOException e1) { printWriter.println(Constants.ERR); } catch (MessagingException e2) { printWriter.println(Constants.ERR); } } else if (tokens.get(0).equals(Constants.DELE)) { String smIndex = (String) tokens.get(1); try { int mIndex = Integer.parseInt(smIndex) - 1 - numDeleted; // When one mail is deleted the index of the other mails will reduce. Asumed that the delete will occure from bottom up. if ((mIndex >= 0) && (mIndex < messages.size())) { messages.remove(mIndex); numDeleted++; printWriter.println(Constants.OK); } else { printWriter.println(Constants.ERR); } } catch (NumberFormatException e) { printWriter.println(Constants.ERR); } } else if (tokens.get(0).equals(Constants.NOOP) || tokens.get(0).equals(Constants.RSET)) { printWriter.println(Constants.OK); } else { printWriter.println(Constants.ERR); } } } public void run() { try { InputStream inputStream = socket.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true); printWriter.println(Constants.OK + " POP3 server ready"); String s; while (!doneProcess) { s = bufferedReader.readLine(); processInput(s, printWriter); } socket.close(); } catch (Exception e) { log.error(e.getMessage(), e); } } } ./src/org/apache/axis2/transport/mail/server/MailAddress.java0000664000175000017500000000362411767656530023356 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import javax.mail.Address; /** * This is a simple implementation to simplify the usage * of the Addresses. */ public class MailAddress extends Address { private static final long serialVersionUID = 3033256355495000819L; String mailAddy = null; public MailAddress(String mAddy) { this.mailAddy = mAddy; } /** * @see java.lang.Object#hashCode() */ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mailAddy == null) ? 0 : mailAddy.hashCode()); return result; } /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof MailAddress)) return false; final MailAddress other = (MailAddress) obj; if (mailAddy == null) { if (other.mailAddy != null) return false; } else if (!mailAddy.equals(other.mailAddy)) return false; return true; } public String toString() { return this.mailAddy; } public String getType() { return "text/plain"; } } ./src/org/apache/axis2/transport/mail/server/MailSorter.java0000664000175000017500000001515311767656530023247 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail.server; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.transport.mail.Constants; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import java.io.ByteArrayInputStream; import java.util.ArrayList; /** * This class will be used to sort the messages into normal messages and mails * being sent to the Axis engine. If a mail is to be sent to the engine then a * new Axis engine is created using the configuration in the MailServer class * and the receive method is called. */ public class MailSorter { private static final Log log = LogFactory.getLog(MailSorter.class); Storage st = null; private ArrayList sUsers = new ArrayList(); // Special users. They are hard coded for the time being to axis2-server@localhost and axis2-server@127.0.0.1 private ConfigurationContext configurationContext = null; private boolean actAsMailet = false; public MailSorter(Storage st, ConfigurationContext configurationContext) { this.st = st; sUsers.add("axis2-server@localhost"); sUsers.add("axis2-server@127.0.0.1"); if (configurationContext == null) { actAsMailet = false; } else { this.configurationContext = configurationContext; actAsMailet = true; } } public void processMail(ConfigurationContext confContext, MimeMessage mimeMessage) { // create an Axis server AxisEngine engine = new AxisEngine(confContext); MessageContext msgContext = null; // create and initialize a message context try { msgContext = confContext.createMessageContext(); msgContext.setTransportIn(confContext.getAxisConfiguration().getTransportIn( org.apache.axis2.Constants.TRANSPORT_MAIL)); msgContext.setTransportOut(confContext.getAxisConfiguration().getTransportOut( org.apache.axis2.Constants.TRANSPORT_MAIL)); msgContext.setServerSide(true); msgContext.setProperty(Constants.CONTENT_TYPE, mimeMessage.getContentType()); msgContext.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING, mimeMessage.getEncoding()); String soapAction = getMailHeader(Constants.HEADER_SOAP_ACTION, mimeMessage); if (soapAction == null) { soapAction = mimeMessage.getSubject(); } msgContext.setSoapAction(soapAction); msgContext.setIncomingTransportName(org.apache.axis2.Constants.TRANSPORT_MAIL); String serviceURL = mimeMessage.getSubject(); if (serviceURL == null) { serviceURL = ""; } String replyTo = ((InternetAddress) mimeMessage.getReplyTo()[0]).getAddress(); if (replyTo != null) { msgContext.setReplyTo(new EndpointReference(replyTo)); } String recepainets = ((InternetAddress) mimeMessage.getAllRecipients()[0]).getAddress(); if (recepainets != null) { msgContext.setTo(new EndpointReference(recepainets + "/" + serviceURL)); } // add the SOAPEnvelope String message = mimeMessage.getContent().toString(); log.info("message[" + message + "]"); ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes()); String soapNamespaceURI = ""; if (mimeMessage.getContentType().indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; } else if (mimeMessage.getContentType().indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } StAXBuilder builder = BuilderUtil.getSOAPBuilder(bais, soapNamespaceURI); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); msgContext.setEnvelope(envelope); AxisEngine.receive(msgContext); } catch (Exception e) { try { if (msgContext != null) { MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e); engine.sendFault(faultContext); } } catch (Exception e1) { log.error(e.getMessage(), e); } } } public void sort(String user, MimeMessage msg) { if (actAsMailet) { if (sUsers.contains(user)) { processMail(configurationContext, msg); } else { st.addMail(user, msg); } } else { st.addMail(user, msg); } } private String getMailHeader(String headerName, MimeMessage mimeMessage) throws AxisFault { try { String values[] = mimeMessage.getHeader(headerName); if (values != null) { return values[0]; } else { return null; } } catch (MessagingException e) { throw new AxisFault(e.getMessage(),e); } } } ./src/org/apache/axis2/transport/mail/MailToInfo.java0000664000175000017500000000500111767656530021650 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.mail; import org.apache.axis2.addressing.EndpointReference; /* * */ public class MailToInfo { private String emailAddress; private String contentDescription; private boolean xServicePath; public MailToInfo(String eprAddress) { //URl validation according to rfc : http://www.ietf.org/rfc/rfc2368.txt int mailToIndex = eprAddress.indexOf(Constants.MAILTO+":"); if (mailToIndex > -1) { eprAddress = eprAddress.substring(mailToIndex + 7); } int index = eprAddress.indexOf('?'); if (index > -1) { emailAddress = eprAddress.substring(0, index); } else { emailAddress = eprAddress; } if (eprAddress.indexOf(Constants.X_SERVICE_PATH) > -1) { index = eprAddress.indexOf('='); if (index > -1) { xServicePath = true; contentDescription = eprAddress.substring(index + 1); } } else { contentDescription = eprAddress.substring(index + 1); } } public MailToInfo(EndpointReference epr) { this(epr.getAddress()); } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public String getContentDescription() { return contentDescription; } public void setContentDescription(String contentDescription) { this.contentDescription = contentDescription; } public boolean isxServicePath() { return xServicePath; } public void setxServicePath(boolean xServicePath) { this.xServicePath = xServicePath; } } ./src/org/apache/axis2/transport/jms/0000775000175000017500000000000011767656530016657 5ustar brianbrian./src/org/apache/axis2/transport/jms/JMSConstants.java0000664000175000017500000001267111767656530022057 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import org.apache.axis2.Constants; import org.apache.axis2.client.Options; import javax.xml.namespace.QName; public class JMSConstants { /** * The prefix indicating an Axis JMS URL */ public static final String JMS_PREFIX = "jms:/"; /** * The Parameter name indicating a JMS destination for requests */ public static final String DEST_PARAM = "transport.jms.Destination"; /** * The Parameter name indicating the response JMS destination */ public static final String REPLY_PARAM = "transport.jms.ReplyDestination"; /** * The Parameter name indicating the JMS destination type */ public static final String DEST_TYPE_PARAM = "transport.jms.DestinationType"; /** * The Parameter name indicating the JMS destination type */ public static final String DEST_TYPE_TOPIC = "Topic"; /** * The Parameter name indicating the JMS destination type */ public static final String DEST_TYPE_QUEUE = "Queue"; /** * The Parameter name of an Axis2 service, indicating the JMS connection * factory which should be used to listen for messages for it. This is * the local (Axis2) name of the connection factory and not a JNDI name */ public static final String CONFAC_PARAM = "transport.jms.ConnectionFactory"; /** * The Parameter name indicating the JMS connection factory JNDI name */ public static final String CONFAC_JNDI_NAME_PARAM = "transport.jms.ConnectionFactoryJNDIName"; /** * The Parameter name indicating the JMS connection factory username (useful for WebsphereMQ CLIENT connections) * n.b. This is not the actual username, it is the JNDI name of the variable that will hold the username */ public static final String CONFAC_JNDI_NAME_USER = "transport.jms.ConnectionFactoryJNDIUser"; /** * The Parameter name indicating the JMS connection factory password (useful for WebsphereMQ CLIENT connections) * n.b. This is not the actual password, it is the JNDI name of the variable that will hold the password */ public static final String CONFAC_JNDI_NAME_PASS = "transport.jms.ConnectionFactoryJNDIPass"; /** * The Parameter name indicating the operation to dispatch non SOAP/XML messages */ public static final String OPERATION_PARAM = "transport.jms.Operation"; /** * The Parameter name indicating the wrapper element for non SOAP/XML messages */ public static final String WRAPPER_PARAM = "transport.jms.Wrapper"; /** * The default operation name to be used for non SOAP/XML messages * if the operation cannot be determined */ public static final QName DEFAULT_OPERATION = new QName("urn:mediate"); /** * The name of the element which wraps non SOAP/XML content into a SOAP envelope */ public static final QName DEFAULT_WRAPPER = new QName(Constants.AXIS2_NAMESPACE_URI, "jmsMessage"); /** * The local (Axis2) JMS connection factory name of the default connection * factory to be used, if a service does not explicitly state the connection * factory it should be using by a Parameter named JMSConstants.CONFAC_PARAM */ public static final String DEFAULT_CONFAC_NAME = "default"; /** * A MessageContext property or client Option stating the JMS message type */ public static final String JMS_MESSAGE_TYPE = "JMS_MESSAGE_TYPE"; /** * The message type indicating a BytesMessage. See JMS_MESSAGE_TYPE */ public static final String JMS_BYTE_MESSAGE = "JMS_BYTE_MESSAGE"; /** * The message type indicating a TextMessage. See JMS_MESSAGE_TYPE */ public static final String JMS_TEXT_MESSAGE = "JMS_TEXT_MESSAGE"; /** * A MessageContext property or client Option stating the JMS correlation id */ public static final String JMS_COORELATION_ID = "JMS_COORELATION_ID"; /** * A MessageContext property or client Option stating the time to wait for a response JMS message */ public static final String JMS_WAIT_REPLY = "JMS_WAIT_REPLY"; /** * The JMS message property specifying the SOAP Action */ public static final String SOAPACTION = "SOAPAction"; /** * The JMS message property specifying the content type */ public static final String CONTENT_TYPE = "contentType"; /** * The default JMS time out waiting for a reply */ public static final long DEFAULT_JMS_TIMEOUT = Options.DEFAULT_TIMEOUT_MILLISECONDS; public static final String ACTIVEMQ_DYNAMIC_QUEUE = "dynamicQueues/"; public static final String ACTIVEMQ_DYNAMIC_TOPIC = "dynamicTopics/"; } ./src/org/apache/axis2/transport/jms/JMSMessageReceiver.java0000664000175000017500000002362511767656530023155 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.Topic; import javax.naming.Context; import javax.xml.stream.XMLStreamException; import java.io.InputStream; /** * This is the actual receiver which listens for and accepts JMS messages, and * hands them over to be processed by a worker thread. An instance of this * class is created for each JMSConnectionFactory, but all instances may and * will share the same worker thread pool. */ public class JMSMessageReceiver implements MessageListener { private static final Log log = LogFactory.getLog(JMSMessageReceiver.class); /** * The thread pool of workers */ private Executor workerPool = null; /** * The Axis configuration context */ private ConfigurationContext axisConf = null; /** * A reference to the JMS Connection Factory */ private JMSConnectionFactory jmsConFac = null; /** * Create a new JMSMessage receiver * * @param jmsConFac the JMS connection factory associated with * @param workerPool the worker thead pool to be used * @param axisConf the Axis2 configuration */ JMSMessageReceiver(JMSConnectionFactory jmsConFac, Executor workerPool, ConfigurationContext axisConf) { this.jmsConFac = jmsConFac; this.workerPool = workerPool; this.axisConf = axisConf; } /** * Return the Axis configuration * * @return the Axis configuration */ public ConfigurationContext getAxisConf() { return axisConf; } /** * Set the worker thread pool * * @param workerPool the worker thead pool */ public void setWorkerPool(Executor workerPool) { this.workerPool = workerPool; } /** * The entry point on the recepit of each JMS message * * @param message the JMS message received */ public void onMessage(Message message) { // directly create a new worker and delegate processing try { if (log.isDebugEnabled()) { StringBuffer sb = new StringBuffer(); sb.append("Received JMS message to destination : " + message.getJMSDestination()); sb.append("\nMessage ID : " + message.getJMSMessageID()); sb.append("\nCorrelation ID : " + message.getJMSCorrelationID()); sb.append("\nReplyTo ID : " + message.getJMSReplyTo()); log.debug(sb.toString()); } } catch (JMSException e) { e.printStackTrace(); } workerPool.execute(new Worker(message)); } /** * Creates an Axis MessageContext for the received JMS message and * sets up the transports and various properties * * @param message the JMS message * @return the Axis MessageContext */ private MessageContext createMessageContext(Message message) { InputStream in = JMSUtils.getInputStream(message); try { MessageContext msgContext = axisConf.createMessageContext(); // get destination and create correct EPR Destination dest = message.getJMSDestination(); String destinationName = null; if (dest instanceof Queue) { destinationName = ((Queue) dest).getQueueName(); } else if (dest instanceof Topic) { destinationName = ((Topic) dest).getTopicName(); } String serviceName = jmsConFac.getServiceByDestination(destinationName); // hack to get around the crazy Active MQ dynamic queue and topic issues if (serviceName == null) { String provider = (String) jmsConFac.getProperties().get( Context.INITIAL_CONTEXT_FACTORY); if (provider.indexOf("activemq") != -1) { serviceName = jmsConFac.getServiceNameForDestination( ((dest instanceof Queue ? JMSConstants.ACTIVEMQ_DYNAMIC_QUEUE : JMSConstants.ACTIVEMQ_DYNAMIC_TOPIC) + destinationName)); } } if (serviceName != null) { // set to bypass dispatching and handover directly to this service msgContext.setAxisService( axisConf.getAxisConfiguration().getService(serviceName)); } msgContext.setIncomingTransportName(Constants.TRANSPORT_JMS); msgContext.setTransportIn( axisConf.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_JMS)); msgContext.setTransportOut( axisConf.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_JMS)); // the reply is assumed to be on the JMSReplyTo destination, using // the same incoming connection factory JMSOutTransportInfo jmsOutTransportInfo; if ((jmsConFac.getJndiUser() == null) || (jmsConFac.getJndiPass() == null)) jmsOutTransportInfo= new JMSOutTransportInfo(jmsConFac.getConFactory(), message.getJMSReplyTo()); else jmsOutTransportInfo= new JMSOutTransportInfo(jmsConFac.getConFactory(), jmsConFac.getUser(), jmsConFac.getPass(), message.getJMSReplyTo()); msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, jmsOutTransportInfo); msgContext.setServerSide(true); msgContext.setMessageID(message.getJMSMessageID()); Destination replyTo = message.getJMSReplyTo(); String jndiDestinationName = null; if (replyTo == null) { Parameter param = msgContext.getAxisService().getParameter(JMSConstants.REPLY_PARAM); if (param != null && param.getValue() != null) { jndiDestinationName = (String) param.getValue(); } } if (jndiDestinationName != null) { msgContext.setReplyTo(jmsConFac.getEPRForDestination(jndiDestinationName)); } String soapAction = JMSUtils.getProperty(message, JMSConstants.SOAPACTION); if (soapAction != null) { msgContext.setSoapAction(soapAction); } msgContext.setEnvelope( JMSUtils.getSOAPEnvelope(message, msgContext, in)); // set correlation id String correlationId = message.getJMSCorrelationID(); if (correlationId != null && correlationId.length() > 0) { msgContext.setProperty(JMSConstants.JMS_COORELATION_ID, correlationId); msgContext.setRelationships( new RelatesTo[] { new RelatesTo(correlationId) }); } return msgContext; } catch (JMSException e) { handleException("JMS Exception reading the destination name", e); } catch (AxisFault e) { handleException("Axis fault creating the MessageContext", e); } catch (XMLStreamException e) { handleException("Error reading the SOAP envelope", e); } return null; } private void handleException(String msg, Exception e) { log.error(msg, e); throw new AxisJMSException(msg, e); } /** * The actual Runnable Worker implementation which will process the * received JMS messages in the worker thread pool */ class Worker implements Runnable { private Message message = null; Worker(Message message) { this.message = message; } public void run() { MessageContext msgCtx = createMessageContext(message); AxisEngine engine = new AxisEngine(msgCtx.getConfigurationContext()); try { log.debug("Delegating JMS message for processing to the Axis engine"); try { engine.receive(msgCtx); } catch (AxisFault e) { log.debug("Exception occured when receiving the SOAP message", e); if (msgCtx.isServerSide()) { MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgCtx, e); engine.sendFault(faultContext); } } } catch (AxisFault af) { log.error("JMS Worker [" + Thread.currentThread().getName() + "] Encountered an Axis Fault : " + af.getMessage(), af); } } } } ./src/org/apache/axis2/transport/jms/JMSListener.java0000664000175000017500000004714611767656530021675 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.ParameterIncludeImpl; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisEvent; import org.apache.axis2.engine.AxisObserver; import org.apache.axis2.transport.TransportListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.jms.JMSException; import javax.naming.Context; import javax.naming.NamingException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; /** * The JMS Transport listener implementation. A JMS Listner will hold one or * more JMS connection factories, which would be created at initialization * time. This implementation does not support the creation of connection * factories at runtime. This JMS Listener registers with Axis to be notified * of service deployment/undeployment/start and stop, and enables or disables * listening for messages on the destinations as appropriate. *

    * A Service could state the JMS connection factory name and the destination * name for use as Parameters in its services.xml as shown in the example * below. If the connection name was not specified, it will use the connection * factory named "default" (JMSConstants.DEFAULT_CONFAC_NAME) - if such a * factory is defined in the Axis2.xml. If the destination name is not specified * it will default to a JMS queue by the name of the service. If the destination * should be a Topic, it should be created on the JMS implementation, and * specified in the services.xml of the service. *

    * * myTopicConnectionFactory * * dynamicTopics/something.TestTopic */ public class JMSListener implements TransportListener { private static final Log log = LogFactory.getLog(JMSListener.class); /** * The maximum number of threads used for the worker thread pool */ private static final int WORKERS_MAX_THREADS = 100; /** * The keep alive time of an idle worker thread */ private static final long WORKER_KEEP_ALIVE = 60L; /** * The worker thread timeout time unit */ private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS; /** * A Map containing the connection factories managed by this, keyed by name */ private Map connectionFactories = new HashMap(); /** * A Map of service name to the JMS EPR addresses */ private Map serviceNameToEprMap = new HashMap(); /** * The Axis2 Configuration context */ private ConfigurationContext configCtx = null; private ExecutorService workerPool; /** * This is the TransportListener initialization method invoked by Axis2 * * @param axisConf the Axis configuration context * @param transprtIn the TransportIn description */ public void init(ConfigurationContext axisConf, TransportInDescription transprtIn) { // save reference to the configuration context this.configCtx = axisConf; // initialize the defined connection factories initializeConnectionFactories(transprtIn); // if no connection factories are defined, we cannot listen if (connectionFactories.isEmpty()) { log.warn("No JMS connection factories are defined." + "Will not listen for any JMS messages"); return; } // iterate through deployed services and validate connection factory // names, and mark services as faulty where appropriate. Iterator services = axisConf.getAxisConfiguration().getServices().values().iterator(); while (services.hasNext()) { AxisService service = (AxisService) services.next(); if (JMSUtils.isJMSService(service)) { processService(service); } } // register to receive updates on services for lifetime management axisConf.getAxisConfiguration().addObservers(new JMSAxisObserver()); log.info("JMS Transport Receiver (Listener) initialized..."); } /** * Prepare to listen for JMS messages on behalf of this service * * @param service */ private void processService(AxisService service) { JMSConnectionFactory cf = getConnectionFactory(service); if (cf == null) { String msg = "Service " + service.getName() + " does not specify" + "a JMS connection factory or refers to an invalid factory. " + "This service is being marked as faulty and will not be " + "available over the JMS transport"; log.warn(msg); JMSUtils.markServiceAsFaulty( service.getName(), msg, service.getAxisConfiguration()); return; } String destination = JMSUtils.getDestination(service); // compute service EPR and keep for later use serviceNameToEprMap.put(service.getName(), getEPR(cf, destination)); // add the specified or implicit destination of this service // to its connection factory cf.addDestination(destination, service.getName()); } /** * Return the connection factory name for this service. If this service * refers to an invalid factory or defaults to a non-existent default * factory, this returns null * * @param service the AxisService * @return the JMSConnectionFactory to be used, or null if reference is invalid */ private JMSConnectionFactory getConnectionFactory(AxisService service) { Parameter conFacParam = service.getParameter(JMSConstants.CONFAC_PARAM); // validate connection factory name (specified or default) if (conFacParam != null) { String conFac = (String) conFacParam.getValue(); if (connectionFactories.containsKey(conFac)) { return (JMSConnectionFactory) connectionFactories.get(conFac); } else { return null; } } else if (connectionFactories.containsKey(JMSConstants.DEFAULT_CONFAC_NAME)) { return (JMSConnectionFactory) connectionFactories. get(JMSConstants.DEFAULT_CONFAC_NAME); } else { return null; } } /** * Initialize the defined connection factories, parsing the TransportIn * descriptions * * @param transprtIn The Axis2 Transport in for the JMS */ private void initializeConnectionFactories(TransportInDescription transprtIn) { // iterate through all defined connection factories Iterator conFacIter = transprtIn.getParameters().iterator(); while (conFacIter.hasNext()) { Parameter param = (Parameter) conFacIter.next(); JMSConnectionFactory jmsConFactory = new JMSConnectionFactory(param.getName()); ParameterIncludeImpl pi = new ParameterIncludeImpl(); try { pi.deserializeParameters((OMElement) param.getValue()); } catch (AxisFault axisFault) { handleException("Error reading Parameters for JMS connection " + "factory" + jmsConFactory.getName(), axisFault); } // read connection facotry properties Iterator params = pi.getParameters().iterator(); while (params.hasNext()) { Parameter p = (Parameter) params.next(); if (Context.INITIAL_CONTEXT_FACTORY.equals(p.getName())) { jmsConFactory.addProperty( Context.INITIAL_CONTEXT_FACTORY, (String) p.getValue()); } else if (Context.PROVIDER_URL.equals(p.getName())) { jmsConFactory.addProperty( Context.PROVIDER_URL, (String) p.getValue()); } else if (Context.SECURITY_PRINCIPAL.equals(p.getName())) { jmsConFactory.addProperty( Context.SECURITY_PRINCIPAL, (String) p.getValue()); } else if (Context.SECURITY_CREDENTIALS.equals(p.getName())) { jmsConFactory.addProperty( Context.SECURITY_CREDENTIALS, (String) p.getValue()); } else if (JMSConstants.CONFAC_JNDI_NAME_PARAM.equals(p.getName())) { jmsConFactory.setJndiName((String) p.getValue()); } else if (JMSConstants.CONFAC_JNDI_NAME_USER.equals(p.getName())) { jmsConFactory.setJndiUser((String) p.getValue()); } else if (JMSConstants.CONFAC_JNDI_NAME_PASS.equals(p.getName())) { jmsConFactory.setJndiPass((String) p.getValue()); } else if (JMSConstants.DEST_PARAM.equals(p.getName())) { StringTokenizer st = new StringTokenizer((String) p.getValue(), " ,"); while (st.hasMoreTokens()) { jmsConFactory.addDestination(st.nextToken(), null); } } } // connect to the actual connection factory try { jmsConFactory.connect(); connectionFactories.put(jmsConFactory.getName(), jmsConFactory); } catch (NamingException e) { handleException("Error connecting to JMS connection factory : " + jmsConFactory.getJndiName(), e); } } } /** * Get the EPR for the given JMS connection factory and destination * the form of the URL is * jms:/?[=&]* * * @param cf the Axis2 JMS connection factory * @param destination the JNDI name of the destination * @return the EPR as a String */ private static String getEPR(JMSConnectionFactory cf, String destination) { StringBuffer sb = new StringBuffer(); sb.append(JMSConstants.JMS_PREFIX).append(destination); sb.append("?").append(JMSConstants.CONFAC_JNDI_NAME_PARAM). append("=").append(cf.getJndiName()); Iterator props = cf.getProperties().keySet().iterator(); while (props.hasNext()) { String key = (String) props.next(); String value = (String) cf.getProperties().get(key); sb.append("&").append(key).append("=").append(value); } return sb.toString(); } /** * Start this JMS Listener (Transport Listener) * * @throws AxisFault */ public void start() throws AxisFault { // create thread pool of workers workerPool = new ThreadPoolExecutor( 1, WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT, new LinkedBlockingQueue(), new org.apache.axis2.util.threadpool.DefaultThreadFactory( new ThreadGroup("JMS Worker thread group"), "JMSWorker")); Iterator iter = connectionFactories.values().iterator(); while (iter.hasNext()) { JMSConnectionFactory conFac = (JMSConnectionFactory) iter.next(); JMSMessageReceiver msgRcvr = new JMSMessageReceiver(conFac, workerPool, configCtx); try { conFac.listen(msgRcvr); } catch (JMSException e) { handleException("Error starting connection factory : " + conFac.getName(), e); } } } /** * Stop this transport listener and shutdown all of the connection factories */ public void stop() { Iterator iter = connectionFactories.values().iterator(); while (iter.hasNext()) { ((JMSConnectionFactory) iter.next()).stop(); } if (workerPool != null) { workerPool.shutdown(); } } /** * Returns EPRs for the given service and IP. (Picks up precomputed EPR) * * @param serviceName service name * @param ip ignored * @return the EPR for the service * @throws AxisFault not used */ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { //Strip out the operation name if (serviceName.indexOf('/') != -1) { serviceName = serviceName.substring(0, serviceName.indexOf('/')); } String endpointName = (String) serviceNameToEprMap.get(serviceName); if (endpointName == null){ if (serviceName.indexOf(".") != -1){ serviceName = serviceName.substring(0, serviceName.indexOf(".")); endpointName = (String) serviceNameToEprMap.get(serviceName); } } return new EndpointReference[]{new EndpointReference(endpointName)}; } /** * Returns the EPR for the given service and IP. (Picks up precomputed EPR) * * @param serviceName service name * @param ip ignored * @return the EPR for the service * @throws AxisFault not used */ public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return getEPRsForService(serviceName, ip)[0]; } /** * Starts listening for messages on this service * * @param service the AxisService just deployed */ private void startListeningForService(AxisService service) { processService(service); JMSConnectionFactory cf = getConnectionFactory(service); if (cf == null) { String msg = "Service " + service.getName() + " does not specify" + "a JMS connection factory or refers to an invalid factory." + "This service is being marked as faulty and will not be " + "available over the JMS transport"; log.warn(msg); JMSUtils.markServiceAsFaulty( service.getName(), msg, service.getAxisConfiguration()); return; } String destination = JMSUtils.getDestination(service); try { cf.listenOnDestination(destination); log.info("Started listening on destination : " + destination + " for service " + service.getName()); } catch (JMSException e) { handleException( "Could not listen on JMS for service " + service.getName(), e); JMSUtils.markServiceAsFaulty( service.getName(), e.getMessage(), service.getAxisConfiguration()); } } /** * Stops listening for messages for the service undeployed * * @param service the AxisService just undeployed */ private void stopListeningForService(AxisService service) { JMSConnectionFactory cf = getConnectionFactory(service); if (cf == null) { String msg = "Service " + service.getName() + " does not specify" + "a JMS connection factory or refers to an invalid factory." + "This service is being marked as faulty and will not be " + "available over the JMS transport"; log.warn(msg); JMSUtils.markServiceAsFaulty( service.getName(), msg, service.getAxisConfiguration()); return; } // remove from the serviceNameToEprMap serviceNameToEprMap.remove(service.getName()); String destination = JMSUtils.getDestination(service); try { cf.removeDestination(destination); } catch (JMSException e) { handleException( "Error while terminating listening on JMS destination : " + destination, e); } } private void handleException(String msg, Exception e) { log.error(msg, e); throw new AxisJMSException(msg, e); } /** * An AxisObserver which will start listening for newly deployed services, * and stop listening when services are undeployed. */ class JMSAxisObserver implements AxisObserver { // The initilization code will go here public void init(AxisConfiguration axisConfig) { } public void serviceUpdate(AxisEvent event, AxisService service) { if (JMSUtils.isJMSService(service)) { switch (event.getEventType()) { case AxisEvent.SERVICE_DEPLOY : startListeningForService(service); break; case AxisEvent.SERVICE_REMOVE : stopListeningForService(service); break; case AxisEvent.SERVICE_START : startListeningForService(service); break; case AxisEvent.SERVICE_STOP : stopListeningForService(service); break; } } } public void moduleUpdate(AxisEvent event, AxisModule module) { } //-------------------------------------------------------- public void addParameter(Parameter param) throws AxisFault { } public void removeParameter(Parameter param) throws AxisFault { } public void deserializeParameters(OMElement parameterElement) throws AxisFault { } public Parameter getParameter(String name) { return null; } public ArrayList getParameters() { return null; } public boolean isParameterLocked(String parameterName) { return false; } public void serviceGroupUpdate(AxisEvent event, AxisServiceGroup serviceGroup) { } } public ConfigurationContext getConfigurationContext() { return this.configCtx; } public SessionContext getSessionContext(MessageContext messageContext) { return null; } public void destroy() { this.configCtx = null; } } ./src/org/apache/axis2/transport/jms/JMSSender.java0000664000175000017500000003711711767656530021325 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.axis2.transport.http.SOAPMessageFormatter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Hashtable; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; /** * The TransportSender for JMS */ public class JMSSender extends AbstractHandler implements TransportSender { private static final Log log = LogFactory.getLog(JMSSender.class); /** * Performs the actual sending of the JMS message * * @param msgContext the message context to be sent * @throws AxisFault on exception */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { log.debug("JMSSender invoke()"); /* Added due to possible bug in Axis2, MTOM enablement is based on msgContext.isDoingMTOM * However msgContext.isDoingMTOM will always return false unless set programmatically. * HTTP sets this boolean programmatically by looking up whether enableMTOM has been set * in axis2.xml or as an option on the client. */ msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); JMSOutTransportInfo transportInfo = null; String targetAddress = null; // is there a transport url? which may be different from the WS-A To.. targetAddress = (String) msgContext.getProperty( Constants.Configuration.TRANSPORT_URL); if (targetAddress != null) { transportInfo = new JMSOutTransportInfo(targetAddress); } else if (targetAddress == null && msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) { targetAddress = msgContext.getTo().getAddress(); if (!msgContext.getTo().hasNoneAddress()) { transportInfo = new JMSOutTransportInfo(targetAddress); } else { //Don't send the message. return InvocationResponse.CONTINUE; } } else if (msgContext.isServerSide()) { // get the jms ReplyTo transportInfo = (JMSOutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO); } // get the ConnectionFactory to be used for the send ConnectionFactory connectionFac = transportInfo.getConnectionFactory(); Connection con = null; try { String user = transportInfo.getConnectionFactoryUser(); String password = transportInfo.getConnectionFactoryPassword(); if ((user == null) || (password == null)){ // Use the OS username and credentials con = connectionFac.createConnection(); } else{ // use an explicit username and password con = connectionFac.createConnection(user, password); } Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); Message message = createJMSMessage(msgContext, session); // get the JMS destination for the message being sent Destination dest = transportInfo.getDestination(); if (dest == null) { if (targetAddress != null) { // if it does not exist, create it String name = JMSUtils.getDestination(targetAddress); if (log.isDebugEnabled()) { log.debug("Creating JMS Destination : " + name); } try { dest = session.createQueue(name); } catch (JMSException e) { handleException("Error creating destination Queue : " + name, e); } } else { handleException("Cannot send reply to unknown JMS Destination"); } } MessageProducer producer = session.createProducer(dest); Destination replyDest = null; boolean waitForResponse = msgContext.getOperationContext() != null && WSDL2Constants.MEP_URI_OUT_IN.equals( msgContext.getOperationContext().getAxisOperation().getMessageExchangePattern()); if (waitForResponse) { String replyToJNDIName = (String) msgContext.getProperty(JMSConstants.REPLY_PARAM); if (replyToJNDIName != null && replyToJNDIName.length() > 0) { Context context = null; final Hashtable props = JMSUtils.getProperties(targetAddress); try { try { context = (Context) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws NamingException{ return new InitialContext(props); } } ) ; } catch (PrivilegedActionException e) { throw (NamingException) e.getException(); } } catch (NamingException e) { handleException("Could not get the initial context", e); } try { replyDest = (Destination) context.lookup(replyToJNDIName); } catch (NameNotFoundException e) { log.warn("Cannot get or lookup JMS response destination : " + replyToJNDIName + " : " + e.getMessage() + ". Attempting to create a Queue named : " + replyToJNDIName); replyDest = session.createQueue(replyToJNDIName); } catch (NamingException e) { handleException("Cannot get JMS response destination : " + replyToJNDIName + " : ", e); } } else { try { // create temporary queue to receive reply replyDest = session.createTemporaryQueue(); } catch (JMSException e) { handleException("Error creating temporary queue for response"); } } message.setJMSReplyTo(replyDest); if (log.isDebugEnabled()) { log.debug("Expecting a response to JMS Destination : " + (replyDest instanceof Queue ? ((Queue) replyDest).getQueueName() : ((Topic) replyDest).getTopicName())); } } try { log.debug("[" + (msgContext.isServerSide() ? "Server" : "Client") + "]Sending message to destination : " + dest); producer.send(message); producer.close(); } catch (JMSException e) { handleException("Error sending JMS message to destination : " + dest.toString(), e); } if (waitForResponse) { try { // wait for reply MessageConsumer consumer = session.createConsumer(replyDest); long timeout = JMSConstants.DEFAULT_JMS_TIMEOUT; Long waitReply = (Long) msgContext.getProperty(JMSConstants.JMS_WAIT_REPLY); if (waitReply != null) { timeout = waitReply.longValue(); } log.debug("Waiting for a maximum of " + timeout + "ms for a response message to destination : " + replyDest); con.start(); Message reply = consumer.receive(timeout); if (reply != null) { msgContext.setProperty(MessageContext.TRANSPORT_IN, JMSUtils.getInputStream(reply)); } else { log.warn("Did not receive a JMS response within " + timeout + " ms to destination : " + dest); } } catch (JMSException e) { handleException("Error reading response from temporary " + "queue : " + replyDest, e); } } } catch (JMSException e) { handleException("Error preparing to send message to destination", e); } finally { if (con != null) { try { con.close(); // closes all sessions, producers, temp Q's etc } catch (JMSException e) { } // ignore } } return InvocationResponse.CONTINUE; } public void cleanup(MessageContext msgContext) throws AxisFault { // do nothing } public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { // do nothing } public void stop() { // do nothing } /** * Create a JMS Message from the given MessageContext and using the given * session * * @param msgContext the MessageContext * @param session the JMS session * @return a JMS message from the context and session * @throws JMSException on exception */ private Message createJMSMessage(MessageContext msgContext, Session session) throws JMSException { Message message = null; String msgType = getProperty(msgContext, JMSConstants.JMS_MESSAGE_TYPE); OMElement msgElement = msgContext.getEnvelope(); if (msgContext.isDoingREST()) { msgElement = msgContext.getEnvelope().getBody().getFirstElement(); } if (msgType != null && JMSConstants.JMS_BYTE_MESSAGE.equals(msgType)) { message = session.createBytesMessage(); BytesMessage bytesMsg = (BytesMessage) message; ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); /* Added due to possible bug in Axis2, OMOutputFormat's boolean isSOAP11 defaults to true. * This means that if left untouched all JMS byte messages must be SOAP 1.1 * We set the boolean here based on the messageContexts value, which is assertained from * the soap namespace used. This is what HTTP does also. */ format.setSOAP11(msgContext.isSOAP11()); format.setCharSetEncoding( getProperty(msgContext, Constants.Configuration.CHARACTER_SET_ENCODING)); format.setDoOptimize(msgContext.isDoingMTOM()); try { msgElement.serializeAndConsume(baos, format); baos.flush(); } catch (XMLStreamException e) { handleException("XML serialization error creating BytesMessage", e); } catch (IOException e) { handleException("IO Error while creating BytesMessage", e); } bytesMsg.writeBytes(baos.toByteArray()); /* Added due to possible bug in Axis2, the content type is never set for a JMS byte message. This * goes unnoticed when MTOM is not used, as the server can handle the message. However once MTOM * is used a contentType of multipart/related is required. */ bytesMsg.setStringProperty(JMSConstants.CONTENT_TYPE, new SOAPMessageFormatter().getContentType(msgContext, format, null)); } else { message = session.createTextMessage(); // default TextMessage txtMsg = (TextMessage) message; txtMsg.setText(msgElement.toString()); } // set the JMS correlation ID if specified String correlationId = getProperty(msgContext, JMSConstants.JMS_COORELATION_ID); if (correlationId == null && msgContext.getRelatesTo() != null) { correlationId = msgContext.getRelatesTo().getValue(); } if (correlationId != null) { message.setJMSCorrelationID(correlationId); } if (msgContext.isServerSide()) { // set SOAP Action and context type as properties on the JMS message setProperty(message, msgContext, JMSConstants.SOAPACTION); setProperty(message, msgContext, JMSConstants.CONTENT_TYPE); } else { String action = msgContext.getOptions().getAction(); if (action != null) { message.setStringProperty(JMSConstants.SOAPACTION, action); } } return message; } private void setProperty(Message message, MessageContext msgCtx, String key) { String value = getProperty(msgCtx, key); if (value != null) { try { message.setStringProperty(key, value); } catch (JMSException e) { log.warn("Couldn't set message property : " + key + " = " + value, e); } } } private String getProperty(MessageContext mc, String key) { return (String) mc.getProperty(key); } private static void handleException(String s) { log.error(s); throw new AxisJMSException(s); } private static void handleException(String s, Exception e) { log.error(s, e); throw new AxisJMSException(s, e); } } ./src/org/apache/axis2/transport/jms/JMSConnectionFactory.java0000664000175000017500000004656211767656530023540 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import org.apache.axis2.addressing.EndpointReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; /** * Encapsulate a JMS Connection factory definition within an Axis2.xml *

    * More than one JMS connection factory could be defined within an Axis2 XML * specifying the JMSListener as the transportReceiver. *

    * These connection factories are created at the initialization of the * transportReceiver, and any service interested in using any of these could * specify the name of the factory and the destination through Parameters named * JMSConstants.CONFAC_PARAM and JMSConstants.DEST_PARAM as shown below. *

    * myQueueConnectionFactory * TestQueue *

    * If a connection factory is defined by a parameter named * JMSConstants.DEFAULT_CONFAC_NAME in the Axis2 XML, services which does not * explicitly specify a connection factory will be defaulted to it - if it is * defined in the Axis2 configuration. *

    * e.g. * * * org.apache.activemq.jndi.ActiveMQInitialContextFactory * tcp://localhost:61616 * TopicConnectionFactory * myTopicOne, myTopicTwo * * * org.apache.activemq.jndi.ActiveMQInitialContextFactory * tcp://localhost:61616 * QueueConnectionFactory * myQueueOne, myQueueTwo * * * org.apache.activemq.jndi.ActiveMQInitialContextFactory * tcp://localhost:61616 * ConnectionFactory * myDestinationOne, myDestinationTwo * * */ public class JMSConnectionFactory { private static final Log log = LogFactory.getLog(JMSConnectionFactory.class); /** * The name used for the connection factory definition within Axis2 */ private String name = null; /** * The JNDI name of the actual connection factory */ private String jndiName = null; /** * The JNDI name of the actual connection factory username */ private String jndiUser = null; /** * The JNDI name of the actual connection factory password */ private String jndiPass = null; /** * Map of destination JNDI names to service names */ private Map serviceJNDINameMapping = null; /** * Map of destinations to service names */ private Map serviceDestinationMapping = null; /** * The JMS Sessions listening for messages */ private Map jmsSessions = null; /** * Properties of the connection factory */ private Hashtable properties = null; /** * The JNDI Context used */ private Context context = null; /** * The actual ConnectionFactory instance held within */ private ConnectionFactory conFactory = null; /** * The JMS Connection is opened. */ private Connection connection = null; /** * The JMS Message receiver for this connection factory */ private JMSMessageReceiver msgRcvr = null; /** * The actual password for the connection factory after retrieval from JNDI. * If this is not supplied, the OS username will be used by default */ private String user = null; /** * The actual password for the connection factory after retrieval from JNDI. * If this is not supplied, the OS credentials will be used by default */ private String pass = null; /** * Create a JMSConnectionFactory for the given Axis2 name and JNDI name * * @param name the local Axis2 name of the connection factory * @param jndiName the JNDI name of the actual connection factory used */ JMSConnectionFactory(String name, String jndiName) { this.name = name; this.jndiName = jndiName; serviceJNDINameMapping = new HashMap(); serviceDestinationMapping = new HashMap(); properties = new Hashtable(); jmsSessions = new HashMap(); } /** * Create a JMSConnectionFactory for the given Axis2 name * * @param name the local Axis2 name of the connection factory */ JMSConnectionFactory(String name) { this(name, null); } /** * Connect to the actual JMS connection factory specified by the JNDI name * * @throws NamingException if the connection factory cannot be found */ public void connect() throws NamingException { if (context == null) { createInitialContext(); } conFactory = (ConnectionFactory) context.lookup(jndiName); if (jndiUser != null) user = (String ) context.lookup(jndiUser); if (jndiPass != null) pass = (String ) context.lookup(jndiPass); log.debug("Connected to the actual connection factory : " + jndiName); } /** * Creates the initial context using the set properties * * @throws NamingException */ private void createInitialContext() throws NamingException { context = new InitialContext(properties); } /** * Set the JNDI connection factory name * * @param jndiName */ public void setJndiName(String jndiName) { this.jndiName = jndiName; } /** * Get the JNDI name of the actual factory username * * @return the jndi name of the actual connection factory username */ public void setJndiUser(String jndiUser) { this.jndiUser = jndiUser; } /** * Get the JNDI name of the actual factory password * * @return the jndi name of the actual connection factory password */ public void setJndiPass(String jndiPass) { this.jndiPass = jndiPass; } /** * Add a listen destination on this connection factory on behalf of the given service * * @param destinationJndi destination JNDI name * @param serviceName the service to which it belongs */ public void addDestination(String destinationJndi, String serviceName) { serviceJNDINameMapping.put(destinationJndi, serviceName); String destinationName = getDestinationName(destinationJndi); if (destinationName == null) { log.warn("JMS Destination with JNDI name : " + destinationJndi + " does not exist"); Connection con = null; try { if ((jndiUser == null) || (jndiPass == null)){ // Use the OS username and credentials con = conFactory.createConnection(); } else{ // use an explicit username and password con = conFactory.createConnection(user, pass); } Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(destinationJndi); destinationName = queue.getQueueName(); log.warn("JMS Destination with JNDI name : " + destinationJndi + " created"); } catch (JMSException e) { log.error("Unable to create a Destination with JNDI name : " + destinationJndi, e); // mark service as faulty JMSUtils.markServiceAsFaulty( (String) serviceJNDINameMapping.get(destinationJndi), "Error looking up JMS destination : " + destinationJndi, msgRcvr.getAxisConf().getAxisConfiguration()); } finally { if (con != null) { try { con.close(); } catch (JMSException ignore) {} } } } serviceDestinationMapping.put(destinationName, serviceName); log.info("Mapping JNDI name : " + destinationJndi + " and JMS Destination name : " + destinationName + " against service : " + serviceName); } /** * Remove listen destination on this connection factory * * @param destinationJndi the JMS destination to be removed * @throws if an error occurs trying to stop listening for messages before removal */ public void removeDestination(String destinationJndi) throws JMSException { // find and save provider specific Destination name before we delete String providerSpecificDestination = getDestinationName(destinationJndi); stoplistenOnDestination(destinationJndi); serviceJNDINameMapping.remove(destinationJndi); if (providerSpecificDestination != null) { serviceDestinationMapping.remove(providerSpecificDestination); } } /** * Add a property to the connection factory * * @param key * @param value */ public void addProperty(String key, String value) { properties.put(key, value); } /** * Return the name of the connection factory * * @return the Axis2 name of this factory */ public String getName() { return name; } /** * Get the JNDI name of the actual factory * * @return the jndi name of the actual connection factory */ public String getJndiName() { return jndiName; } /** * Get the JNDI name of the actual factory username * * @return the jndi name of the actual connection factory username */ public String getJndiUser() { return jndiUser; } /** * Get the JNDI name of the actual factory password * * @return the jndi name of the actual connection factory password */ public String getJndiPass() { return jndiPass; } /** * This is the real password for the connection factory after the JNDI lookup * * @return the real password for the connection factory after the JNDI lookup */ public String getPass() { return pass; } /** * This is the real username for the connection factory after the JNDI lookup * * @return the eal username for the connection factory after the JNDI lookup */ public String getUser() { return user; } /** * Get the actual underlying connection factory * * @return actual connection factory */ public ConnectionFactory getConFactory() { return conFactory; } /** * Get the list of destinations (JNDI) associated with this connection factory * * @return destinations to service maping */ public Map getDestinations() { return serviceJNDINameMapping; } /** * Get the connection factory properties * * @return properties */ public Hashtable getProperties() { return properties; } /** * Begin listening for messages on the list of destinations associated * with this connection factory. (Called during Axis2 initialization of * the Transport receivers) * * @param msgRcvr the message receiver which will process received messages * @throws JMSException on exceptions */ public void listen(JMSMessageReceiver msgRcvr) throws JMSException { // save a reference to the message receiver this.msgRcvr = msgRcvr; log.debug("Connection factory : " + name + " initializing..."); if (conFactory == null || context == null) { handleException( "Connection factory must be 'connected' before listening"); } else { try { if ((jndiUser == null) || (jndiPass == null)){ // User the OS username and credentials connection = conFactory.createConnection(); } else{ // use an explicit username and password connection = conFactory.createConnection(user, pass); } } catch (JMSException e) { handleException("Error creating a JMS connection using the " + "factory : " + jndiName, e); } } Iterator iter = serviceJNDINameMapping.keySet().iterator(); while (iter.hasNext()) { String destinationJndi = (String) iter.next(); listenOnDestination(destinationJndi); } // start the connection connection.start(); log.info("Connection factory : " + name + " initialized..."); } /** * Listen on the given destination from this connection factory. Used to * start listening on a destination associated with a newly deployed service * * @param destinationJndi the JMS destination to listen on * @throws JMSException on exception */ public void listenOnDestination(String destinationJndi) throws JMSException { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = null; try { Object o = context.lookup(destinationJndi); destination = (Destination) o; } catch (NameNotFoundException e) { log.warn("Cannot find destination : " + destinationJndi + " Creating a Queue with this name"); destination = session.createQueue(destinationJndi); } catch (NamingException e) { log.warn("Error looking up destination : " + destinationJndi, e); // mark service as faulty JMSUtils.markServiceAsFaulty( (String) serviceJNDINameMapping.get(destinationJndi), "Error looking up JMS destination : " + destinationJndi, this.msgRcvr.getAxisConf().getAxisConfiguration()); } MessageConsumer consumer = session.createConsumer(destination); consumer.setMessageListener(this.msgRcvr); jmsSessions.put(destinationJndi, session); } /** * Stop listening on the given destination - for undeployment of services * * @param destinationJndi the JNDI name of the JMS destination * @throws JMSException on exception */ private void stoplistenOnDestination(String destinationJndi) throws JMSException { ((Session) jmsSessions.get(destinationJndi)).close(); } /** * Return the service name using this destination * * @param destination the destination name * @return the service which uses the given destination, or null */ public String getServiceNameForDestination(String destination) { return (String) serviceJNDINameMapping.get(destination); } /** * Close all connections, sessions etc.. and stop this connection factory */ public void stop() { try { connection.close(); } catch (JMSException e) { log.warn("Error shutting down connection factory : " + name, e); } } /** * Return the provider specific Destination name if any for the destination with the given * JNDI name * @param destinationJndi the JNDI name of the destination * @return the provider specific Destination name or null if cannot be found */ public String getDestinationName(String destinationJndi) { try { Destination destination = (Destination) context.lookup(destinationJndi); if (destination != null && destination instanceof Queue) { return ((Queue) destination).getQueueName(); } else if (destination != null && destination instanceof Topic) { return ((Topic) destination).getTopicName(); } } catch (JMSException e) { log.warn("Error reading provider specific JMS destination name for destination " + "with JNDI name : " + destinationJndi, e); } catch (NamingException e) { log.warn("Error looking up destination with JNDI name : " + destinationJndi + " to map its corresponding provider specific Destination name"); } return null; } /** * Return the EPR for the JMS Destination with the given JNDI name and using * this connection factory * @param destination the JNDI name of the JMS Destionation * @return the EPR */ public EndpointReference getEPRForDestination(String destination) { StringBuffer sb = new StringBuffer(); sb.append(JMSConstants.JMS_PREFIX).append(destination); sb.append("?").append(JMSConstants.CONFAC_JNDI_NAME_PARAM). append("=").append(getJndiName()); Iterator props = getProperties().keySet().iterator(); while (props.hasNext()) { String key = (String) props.next(); String value = (String) getProperties().get(key); sb.append("&").append(key).append("=").append(value); } return new EndpointReference(sb.toString()); } public String getServiceByDestination(String destinationName) { return (String) serviceDestinationMapping.get(destinationName); } private void handleException(String msg) throws AxisJMSException { log.error(msg); throw new AxisJMSException(msg); } private void handleException(String msg, Exception e) throws AxisJMSException { log.error(msg, e); throw new AxisJMSException(msg, e); } } ./src/org/apache/axis2/transport/jms/AxisJMSException.java0000664000175000017500000000210411767656530022654 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; public class AxisJMSException extends RuntimeException { AxisJMSException() { super(); } AxisJMSException(String msg) { super(msg); } AxisJMSException(String msg, Exception e) { super(msg, e); } } ./src/org/apache/axis2/transport/jms/README.txt0000664000175000017500000000515611767656530020364 0ustar brianbrianThis is a new JMS (Java Messaging Service) Transport implementation for Apache Axis2. The transport receiver must be configured as follows, with one or more connection factories: Sample axis2.xml ================ org.apache.activemq.jndi.ActiveMQInitialContextFactory tcp://localhost:61616 TopicConnectionFactory org.apache.activemq.jndi.ActiveMQInitialContextFactory tcp://localhost:61616 QueueConnectionFactory org.apache.activemq.jndi.ActiveMQInitialContextFactory tcp://localhost:61616 QueueConnectionFactory If a connection factory named "default" (as shown above) is defined, this would be used for services which does not explicitly specify the connection factory that should be used. The services.xml of a service should indicate the connection factory and the destination name to be associated with. If a destination is not specified, the implementation would create a JMS Queue with the service name. The JMS destination should ideally be created and administered through the JMS provider utilities. Sample services.xml =================== .... jms ... myTopicConnectionFactory dynamicTopics/something.TestTopic Files Making Up This JMS Implementation ======================================= * JMSListener.java * JMSConnectionFactory.java * JMSMessageReceiver.java * JMSOutTransportInfo.java * JMSSender.java * JMSConstants.java * JMSUtils.java * AxisJMSException.java * DefaultThreadFactory.java ./src/org/apache/axis2/transport/jms/JMSUtils.java0000664000175000017500000004342511767656530021204 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.OMTextImpl; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.jms.BytesMessage; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.TextMessage; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.Hashtable; import java.util.List; import java.util.StringTokenizer; public class JMSUtils { private static final Log log = LogFactory.getLog(JMSUtils.class); /** * Should this service be enabled on JMS transport? * * @param service the Axis service * @return true if JMS should be enabled */ public static boolean isJMSService(AxisService service) { boolean process = service.isEnableAllTransports(); if (process) { return true; } else { List transports = service.getExposedTransports(); for (int i = 0; i < transports.size(); i++) { if (Constants.TRANSPORT_JMS.equals(transports.get(i))) { return true; } } } return false; } /** * Get the JMS destination used by this service * * @param service the Axis Service * @return the name of the JMS destination */ public static String getDestination(AxisService service) { Parameter destParam = service.getParameter(JMSConstants.DEST_PARAM); // validate destination String destination = null; if (destParam != null) { destination = (String) destParam.getValue(); } else { destination = service.getName(); } return destination; } /** * Extract connection factory properties from a given URL * * @param url a JMS URL of the form jms:/?[=&]* * @return a Hashtable of extracted properties */ public static Hashtable getProperties(String url) { Hashtable h = new Hashtable(); int propPos = url.indexOf("?"); if (propPos != -1) { StringTokenizer st = new StringTokenizer(url.substring(propPos + 1), "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); int sep = token.indexOf("="); if (sep != -1) { h.put(token.substring(0, sep), token.substring(sep + 1)); } else { continue; // ignore, what else can we do? } } } return h; } /** * Marks the given service as faulty with the given comment * * @param serviceName service name * @param msg comment for being faulty * @param axisCfg configuration context */ public static void markServiceAsFaulty(String serviceName, String msg, AxisConfiguration axisCfg) { if (serviceName != null) { try { AxisService service = axisCfg.getService(serviceName); axisCfg.getFaultyServices().put(service.getName(), msg); } catch (AxisFault axisFault) { log.warn("Error marking service : " + serviceName + " as faulty due to : " + msg, axisFault); } } } /** * Get an InputStream to the message * * @param message the JMS message * @return an InputStream */ public static InputStream getInputStream(Message message) { try { // get the incoming msg content into a byte array if (message instanceof BytesMessage) { byte[] buffer = new byte[8 * 1024]; ByteArrayOutputStream out = new ByteArrayOutputStream(); BytesMessage byteMsg = (BytesMessage) message; for (int bytesRead = byteMsg.readBytes(buffer); bytesRead != -1; bytesRead = byteMsg.readBytes(buffer)) { out.write(buffer, 0, bytesRead); } return new ByteArrayInputStream(out.toByteArray()); } else if (message instanceof TextMessage) { TextMessage txtMsg = (TextMessage) message; String contentType = message.getStringProperty(JMSConstants.CONTENT_TYPE); if (contentType != null) { return new ByteArrayInputStream( txtMsg.getText().getBytes( BuilderUtil.getCharSetEncoding(contentType))); } else { return new ByteArrayInputStream(txtMsg.getText().getBytes()); } } else { handleException("Unsupported JMS message type : " + message.getClass().getName()); } } catch (JMSException e) { handleException("JMS Exception getting InputStream into message", e); } catch (UnsupportedEncodingException e) { handleException("Encoding exception getting InputStream into message", e); } return null; } /** * Get a String property from the JMS message * * @param message JMS message * @param property property name * @return property value */ public static String getProperty(Message message, String property) { try { return message.getStringProperty(property); } catch (JMSException e) { return null; } } /** * Get the context type from the Axis MessageContext * * @param msgCtx message context * @return the content type */ public static String getContentType(MessageContext msgCtx) { OMOutputFormat format = new OMOutputFormat(); String soapActionString = getSOAPAction(msgCtx); String charSetEnc = (String) msgCtx.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING); if (charSetEnc != null) { format.setCharSetEncoding(charSetEnc); } else { OperationContext opctx = msgCtx.getOperationContext(); if (opctx != null) { charSetEnc = (String) opctx.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING); } } // If the char set enc is still not found use the default if (charSetEnc == null) { charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING; } format.setSOAP11(msgCtx.isSOAP11()); format.setCharSetEncoding(charSetEnc); String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (encoding != null) { contentType += "; charset=" + encoding; } // action header is not mandated in SOAP 1.2. So putting it, if available if (!msgCtx.isSOAP11() && soapActionString != null && !"".equals(soapActionString.trim())) { contentType = contentType + ";action=\"" + soapActionString + "\";"; } return contentType; } /** * Get the SOAP Action from the message context * * @param msgCtx the MessageContext * @return the SOAP Action as s String if present, or the WS-Action */ private static String getSOAPAction(MessageContext msgCtx) { String soapActionString = msgCtx.getSoapAction(); if (soapActionString == null || soapActionString.trim().length() == 0) { soapActionString = msgCtx.getWSAAction(); } Object disableSoapAction = msgCtx.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION); if (soapActionString == null || JavaUtils.isTrueExplicitly(disableSoapAction)) { soapActionString = ""; } return soapActionString; } /** * Return the destination name from the given URL * * @param url the URL * @return the destination name */ public static String getDestination(String url) { String tempUrl = url.substring(JMSConstants.JMS_PREFIX.length()); int propPos = tempUrl.indexOf("?"); if (propPos == -1) { return tempUrl; } else { return tempUrl.substring(0, propPos); } } /** * Return a SOAPEnvelope created from the given JMS Message and Axis * MessageContext, and the InputStream into the message * * @param message the JMS Message * @param msgContext the Axis MessageContext * @param in the InputStream into the message * @return SOAPEnvelope for the message * @throws javax.xml.stream.XMLStreamException * */ public static SOAPEnvelope getSOAPEnvelope( Message message, MessageContext msgContext, InputStream in) throws XMLStreamException { SOAPEnvelope envelope = null; StAXBuilder builder = null; String contentType = JMSUtils.getProperty(message, JMSConstants.CONTENT_TYPE); if (contentType != null) { if (contentType.indexOf( HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) > -1) { builder = BuilderUtil.getAttachmentsBuilder( msgContext, in, contentType, true); envelope = (SOAPEnvelope) builder.getDocumentElement(); } else { String charSetEnc = BuilderUtil.getCharSetEncoding(contentType); builder = BuilderUtil.getSOAPBuilder(in, charSetEnc); // Set the encoding scheme in the message context msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); envelope = (SOAPEnvelope) builder.getDocumentElement(); } } // handle pure plain vanilla POX and binary content (non SOAP) if (builder == null) { SOAPFactory soapFactory = new SOAP11Factory(); try { XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader (in, MessageContext.DEFAULT_CHAR_SET_ENCODING); // Set the encoding scheme in the message context msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, MessageContext.DEFAULT_CHAR_SET_ENCODING); builder = new StAXOMBuilder(xmlreader); builder.setOMBuilderFactory(soapFactory); String ns = builder.getDocumentElement().getNamespace().getNamespaceURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns)) { envelope = getEnvelope(in, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns)) { envelope = getEnvelope(in, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else { // this is POX ... mark MC as REST msgContext.setDoingREST(true); envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(builder.getDocumentElement()); } } catch (Exception e) { log.debug("Non SOAP/XML JMS message received"); Parameter operationParam = msgContext.getAxisService(). getParameter(JMSConstants.OPERATION_PARAM); QName operationQName = (operationParam != null ? getQName(operationParam.getValue()) : JMSConstants.DEFAULT_OPERATION); AxisOperation operation = msgContext.getAxisService().getOperation(operationQName); if (operation != null) { msgContext.setAxisOperation(operation); } else { handleException("Cannot find operation : " + operationQName + " on the service " + msgContext.getAxisService()); } Parameter wrapperParam = msgContext.getAxisService(). getParameter(JMSConstants.WRAPPER_PARAM); QName wrapperQName = (wrapperParam != null ? getQName(wrapperParam.getValue()) : JMSConstants.DEFAULT_WRAPPER); OMElement wrapper = soapFactory.createOMElement(wrapperQName, null); try { if (message instanceof TextMessage) { OMTextImpl textData = (OMTextImpl) soapFactory.createOMText( ((TextMessage) message).getText()); wrapper.addChild(textData); } else if (message instanceof BytesMessage) { BytesMessage bm = (BytesMessage) message; byte[] msgBytes = new byte[(int) bm.getBodyLength()]; bm.reset(); bm.readBytes(msgBytes); DataHandler dataHandler = new DataHandler( new ByteArrayDataSource(msgBytes)); OMText textData = soapFactory.createOMText(dataHandler, true); wrapper.addChild(textData); msgContext.setDoingMTOM(true); } else { handleException("Unsupported JMS Message format : " + message.getJMSType()); } envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(wrapper); } catch (JMSException j) { handleException("Error wrapping JMS message into a SOAP envelope ", j); } } } String charEncOfMessage = builder == null ? null : builder.getDocument() == null ? null : builder.getDocument().getCharsetEncoding(); String charEncOfTransport = ((String) msgContext.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING)); if (charEncOfMessage != null && !(charEncOfMessage.trim().length() == 0) && !charEncOfMessage.equalsIgnoreCase(charEncOfTransport)) { handleException( "Character Set Encoding from transport information do not " + "match with character set encoding in the received " + "SOAP message"); } return envelope; } private static SOAPEnvelope getEnvelope(InputStream in, String namespace) throws XMLStreamException { try { in.reset(); } catch (IOException e) { throw new XMLStreamException("Error resetting message input stream", e); } XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader (in, MessageContext.DEFAULT_CHAR_SET_ENCODING); StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, namespace); return (SOAPEnvelope) builder.getDocumentElement(); } private static QName getQName(Object obj) { String value; if (obj instanceof QName) { return (QName) obj; } else { value = obj.toString(); } int open = value.indexOf('{'); int close = value.indexOf('}'); if (close > open && open > -1 && value.length() > close) { return new QName(value.substring(open+1, close-open), value.substring(close+1)); } else { return new QName(value); } } private static void handleException(String s) { log.error(s); throw new AxisJMSException(s); } private static void handleException(String s, Exception e) { log.error(s, e); throw new AxisJMSException(s, e); } } ./src/org/apache/axis2/transport/jms/JMSOutTransportInfo.java0000664000175000017500000001713011767656530023376 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.jms; import org.apache.axis2.transport.OutTransportInfo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException; import java.util.Hashtable; /** * The JMS OutTransportInfo */ public class JMSOutTransportInfo implements OutTransportInfo { private static final Log log = LogFactory.getLog(JMSOutTransportInfo.class); private ConnectionFactory connectionFactory = null; private String connectionFactoryUser = null; private String connectionFactoryPassword = null; private Destination destination = null; private String contentType = null; /** * Creates an instance using the given connection factory and destination * * @param connectionFactory the connection factory * @param dest the destination */ JMSOutTransportInfo(ConnectionFactory connectionFactory, Destination dest) { this.connectionFactory = connectionFactory; this.destination = dest; } /** * Creates an instance using the given connection factory and destination * * @param connectionFactory the connection factory * @param dest the destination */ JMSOutTransportInfo(ConnectionFactory connectionFactory, String connectionFactoryUser, String connectionFactoryPassword, Destination dest) { this.connectionFactory = connectionFactory; this.connectionFactoryUser = connectionFactoryUser; this.connectionFactoryPassword = connectionFactoryPassword; this.destination = dest; } /** * Creates and instance using the given URL * * @param url the URL */ JMSOutTransportInfo(String url) { if (!url.startsWith(JMSConstants.JMS_PREFIX)) { handleException("Invalid JMS URL : " + url + " Must begin with the prefix " + JMSConstants.JMS_PREFIX); } else { Context context = null; Hashtable props = JMSUtils.getProperties(url); try { context = new InitialContext(props); } catch (NamingException e) { handleException("Could not get the initial context", e); } connectionFactory = getConnectionFactory(context, props); connectionFactoryUser = getConnectionFactoryUser(context, props); connectionFactoryPassword = getConnectionFactoryPass(context, props); destination = getDestination(context, url); } } /** * Get the referenced ConnectionFactory using the properties from the context * * @param context the context to use for lookup * @param props the properties which contains the JNDI name of the factory * @return the connection factory */ private ConnectionFactory getConnectionFactory(Context context, Hashtable props) { try { String conFacJndiName = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_PARAM); if (conFacJndiName != null) { return (ConnectionFactory) context.lookup(conFacJndiName); } else { throw new NamingException( "JMS Connection Factory JNDI name cannot be determined from url"); } } catch (NamingException e) { handleException("Cannot get JMS Connection factory with props : " + props, e); } return null; } /** * Get the referenced ConnectionFactory Username (if supplied) using the properties from the context * * @param context the context to use for lookup * @param props the properties which contains the JNDI name of the factory username * @return the connection factory username (or null if one is not in the JNDI tree) */ private String getConnectionFactoryUser(Context context, Hashtable props) { try { String conFacJndiUser = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_USER); if (conFacJndiUser != null) { return (String) context.lookup(conFacJndiUser); } else { return null; } } catch (NamingException e) { handleException("Cannot get JMS Connection factory username with props : " + props, e); } return null; } /** * Get the referenced ConnectionFactory Password (if supplied) using the properties from the context * * @param context the context to use for lookup * @param props the properties which contains the JNDI name of the factory password * @return the connection factory password (or null if one is not in the JNDI tree) */ private String getConnectionFactoryPass(Context context, Hashtable props) { try { String conFacJndiPass = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_PASS); if (conFacJndiPass != null) { return (String) context.lookup(conFacJndiPass); } else { return null; } } catch (NamingException e) { handleException("Cannot get JMS Connection factory password with props : " + props, e); } return null; } /** * Get the JMS destination specified by the given URL from the context * * @param context the Context to lookup * @param url URL * @return the JMS destination, or null if it does not exist */ private Destination getDestination(Context context, String url) { String destinationName = JMSUtils.getDestination(url); try { return (Destination) context.lookup(destinationName); } catch (NameNotFoundException e) { log.warn("Cannot get or lookup JMS destination : " + destinationName + " from url : " + url + " : " + e.getMessage()); } catch (NamingException e) { handleException("Cannot get JMS destination : " + destinationName + " from url : " + url, e); } return null; } private void handleException(String s) { log.error(s); throw new AxisJMSException(s); } private void handleException(String s, Exception e) { log.error(s, e); throw new AxisJMSException(s, e); } public Destination getDestination() { return destination; } public ConnectionFactory getConnectionFactory() { return connectionFactory; } public String getConnectionFactoryPassword() { return connectionFactoryPassword; } public String getConnectionFactoryUser() { return connectionFactoryUser; } public void setContentType(String contentType) { this.contentType = contentType; } } ./src/org/apache/axis2/transport/nhttp/0000775000175000017500000000000011767656530017223 5ustar brianbrian./src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java0000664000175000017500000004607111767656530023335 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.OutTransportInfo; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor; import org.apache.http.nio.NHttpClientConnection; import org.apache.http.nio.NHttpClientHandler; import org.apache.http.nio.reactor.ConnectingIOReactor; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.SessionRequest; import org.apache.http.nio.reactor.SessionRequestCallback; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.HTTP; import javax.net.ssl.SSLContext; import java.io.IOException; import java.io.InterruptedIOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.Map; /** * NIO transport sender for Axis2 based on HttpCore and NIO extensions */ public class HttpCoreNIOSender extends AbstractHandler implements TransportSender { private static final Log log = LogFactory.getLog(HttpCoreNIOSender.class); /** The Axis2 configuration context */ private ConfigurationContext cfgCtx; /** The IOReactor */ private ConnectingIOReactor ioReactor = null; /** The client handler */ private NHttpClientHandler handler = null; /** The session request callback that calls back to the message receiver with errors */ private final SessionRequestCallback sessionRequestCallback = getSessionRequestCallback(); /** The SSL Context to be used */ private SSLContext sslContext = null; /** The SSL session handler that manages hostname verification etc */ // private SSLIOSessionHandler sslIOSessionHandler = null; /** * Initialize the transport sender, and execute reactor in new seperate thread * @param cfgCtx the Axis2 configuration context * @param transportOut the description of the http/s transport from Axis2 configuration * @throws AxisFault thrown on an error */ public void init(ConfigurationContext cfgCtx, TransportOutDescription transportOut) throws AxisFault { this.cfgCtx = cfgCtx; // is this an SSL Sender? sslContext = getSSLContext(transportOut); //sslIOSessionHandler = getSSLIOSessionHandler(transportOut); // start the Sender in a new seperate thread Thread t = new Thread(new Runnable() { public void run() { executeClientEngine(); } }, "HttpCoreNIOSender"); t.start(); log.info((sslContext == null ? "HTTP" : "HTTPS") + " Sender starting"); } /** * Configure and start the IOReactor */ private void executeClientEngine() { HttpParams params = getClientParameters(); try { ioReactor = new DefaultConnectingIOReactor( NHttpConfiguration.getInstance().getClientIOWorkers(), params); } catch (IOException e) { log.error("Error starting the IOReactor", e); } handler = new ClientHandler(cfgCtx, params); IOEventDispatch ioEventDispatch = getEventDispatch( handler, sslContext, /*sslIOSessionHandler,*/ params); try { ioReactor.execute(ioEventDispatch); } catch (InterruptedIOException ex) { log.fatal("Reactor Interrupted"); } catch (IOException e) { log.fatal("Encountered an I/O error: " + e.getMessage(), e); } log.info("Sender Shutdown"); } /** * Return the IOEventDispatch implementation to be used. This is overridden by the * SSL sender * @param handler * @param sslContext * @param params * @return */ protected IOEventDispatch getEventDispatch( NHttpClientHandler handler, SSLContext sslContext, /*SSLIOSessionHandler sslIOSessionHandler,*/ HttpParams params) { return new PlainClientIOEventDispatch(handler, params); } /** * Always return null, as this implementation does not support outgoing SSL * @param transportOut * @return null * @throws AxisFault */ protected SSLContext getSSLContext(TransportOutDescription transportOut) throws AxisFault { return null; } /** * Create the SSL IO Session handler to be used by this listener * @param transportOut * @return always null */ // protected SSLIOSessionHandler getSSLIOSessionHandler(TransportOutDescription transportOut) // throws AxisFault { // return null; // } /** * get HTTP protocol parameters to which the sender must adhere to * @return the applicable HTTP protocol parameters */ private HttpParams getClientParameters() { NHttpConfiguration cfg = NHttpConfiguration.getInstance(); HttpParams params = new BasicHttpParams(); params .setIntParameter(HttpConnectionParams.SO_TIMEOUT, cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000)) .setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT, cfg.getProperty(HttpConnectionParams.CONNECTION_TIMEOUT, 10000)) .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)) .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1) .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1) .setParameter(HttpProtocolParams.USER_AGENT, "Axis2-HttpComponents-NIO"); return params; } /** * transport sender invocation from Axis2 core * @param msgContext message to be sent * @return the invocation response (always InvocationResponse.CONTINUE) * @throws AxisFault on error */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // remove unwanted HTTP headers (if any from the current message) removeUnwantedHeaders(msgContext); EndpointReference epr = Util.getDestinationEPR(msgContext); if (epr != null) { if (!AddressingConstants.Final.WSA_NONE_URI.equals(epr.getAddress())) { sendAsyncRequest(epr, msgContext); } else { handleException("Cannot send message to " + AddressingConstants.Final.WSA_NONE_URI); } } else { if (msgContext.getProperty(Constants.OUT_TRANSPORT_INFO) != null) { if (msgContext.getProperty(Constants.OUT_TRANSPORT_INFO) instanceof ServerWorker) { sendAsyncResponse(msgContext); } else { sendUsingOutputStream(msgContext); } } else { handleException("No valid destination EPR or OutputStream to send message"); } } if (msgContext.getOperationContext() != null) { msgContext.getOperationContext().setProperty( Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); } return InvocationResponse.CONTINUE; } /** * Remove unwanted headers from the http response of outgoing request. These are headers which * should be dictated by the transport and not the user. We remove these as these may get * copied from the request messages * @param msgContext the Axis2 Message context from which these headers should be removed */ private void removeUnwantedHeaders(MessageContext msgContext) { Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (headers != null && !headers.isEmpty()) { headers.remove(HTTP.CONN_DIRECTIVE); headers.remove(HTTP.TRANSFER_ENCODING); headers.remove(HTTP.DATE_HEADER); headers.remove(HTTP.SERVER_HEADER); headers.remove(HTTP.CONTENT_TYPE); headers.remove(HTTP.CONTENT_LEN); headers.remove(HTTP.USER_AGENT); } } /** * Send the request message asynchronously to the given EPR * @param epr the destination EPR for the message * @param msgContext the message being sent * @throws AxisFault on error */ private void sendAsyncRequest(EndpointReference epr, MessageContext msgContext) throws AxisFault { try { URL url = new URL(epr.getAddress()); int port = url.getPort(); if (port == -1) { // use default if ("http".equals(url.getProtocol())) { port = 80; } else if ("https".equals(url.getProtocol())) { port = 443; } } HttpHost httpHost = new HttpHost(url.getHost(), port, url.getProtocol()); Axis2HttpRequest axis2Req = new Axis2HttpRequest(epr, httpHost, msgContext); NHttpClientConnection conn = ConnectionPool.getConnection(url.getHost(), port); if (conn == null) { ioReactor.connect(new InetSocketAddress(url.getHost(), port), null, axis2Req, sessionRequestCallback); log.debug("A new connection established"); } else { ((ClientHandler) handler).submitRequest(conn, axis2Req); log.debug("An existing connection reused"); } axis2Req.streamMessageContents(); } catch (MalformedURLException e) { handleException("Malformed destination EPR : " + epr.getAddress(), e); } catch (IOException e) { handleException("IO Error while submiting request message for sending", e); } } /** * Send the passed in response message, asynchronously * @param msgContext the message context to be sent * @throws AxisFault on error */ private void sendAsyncResponse(MessageContext msgContext) throws AxisFault { // remove unwanted HTTP headers (if any from the current message) removeUnwantedHeaders(msgContext); ServerWorker worker = (ServerWorker) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO); HttpResponse response = worker.getResponse(); OMOutputFormat format = Util.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext); response.setHeader( HTTP.CONTENT_TYPE, messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction())); // return http 500 when a SOAP fault is returned if (msgContext.getEnvelope().hasFault()) { response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); } // if this is a dummy message to handle http 202 case with non-blocking IO // set the status code to 202 and the message body to an empty byte array (see below) if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) && msgContext.getProperty( //org.apache.sandesha2.Sandesha2Constants.MessageContextProperties.SEQUENCE_ID "WSRMSequenceId") == null) { response.setStatusCode(HttpStatus.SC_ACCEPTED); } // set any transport headers Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (transportHeaders != null && !transportHeaders.values().isEmpty()) { Iterator iter = transportHeaders.keySet().iterator(); while (iter.hasNext()) { Object header = iter.next(); Object value = transportHeaders.get(header); if (value != null && header instanceof String && value instanceof String) { response.setHeader((String) header, (String) value); } } } worker.getServiceHandler().commitResponse(worker.getConn(), response); OutputStream out = worker.getOutputStream(); try { if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) && msgContext.getProperty( //Sandesha2Constants.MessageContextProperties.SEQUENCE_ID "WSRMSequenceId") == null) { // see comment above on the reasoning out.write(new byte[0]); } else { messageFormatter.writeTo(msgContext, format, out, true); } out.close(); } catch (IOException e) { handleException("IO Error sending response message", e); } try { worker.getIs().close(); } catch (IOException ignore) {} } private void sendUsingOutputStream(MessageContext msgContext) throws AxisFault { OMOutputFormat format = Util.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext); OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (msgContext.isServerSide()) { OutTransportInfo transportInfo = (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO); if (transportInfo != null) { transportInfo.setContentType( messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction())); } else { throw new AxisFault(Constants.OUT_TRANSPORT_INFO + " has not been set"); } } try { messageFormatter.writeTo(msgContext, format, out, true); out.close(); } catch (IOException e) { handleException("IO Error sending response message", e); } } public void cleanup(MessageContext msgContext) throws AxisFault { // do nothing } public void stop() { try { ioReactor.shutdown(); log.info("Sender shut down"); } catch (IOException e) { log.warn("Error shutting down IOReactor", e); } } /** * Return a SessionRequestCallback which gets notified of a connection failure * or an error during a send operation. This method finds the corresponding * Axis2 message context for the outgoing request, and find the message receiver * and sends a fault message back to the message receiver that is marked as * related to the outgoing request * @return a Session request callback */ private static SessionRequestCallback getSessionRequestCallback() { return new SessionRequestCallback() { public void completed(SessionRequest request) { } public void failed(SessionRequest request) { handleError(request, false); } public void timeout(SessionRequest request) { // In a timeout occurs the exception field is not updated // This means that it will be null (see SessionRequestImpl.timeout()) handleError(request, true); request.cancel(); } public void cancelled(SessionRequest sessionRequest) { } private final void handleError(SessionRequest request, boolean isTimeout) { if (request.getAttachment() != null && request.getAttachment() instanceof Axis2HttpRequest) { Axis2HttpRequest axis2Request = (Axis2HttpRequest) request.getAttachment(); MessageContext mc = axis2Request.getMsgContext(); MessageReceiver mr = mc.getAxisOperation().getMessageReceiver(); try { // this fault is NOT caused by the endpoint while processing. so we have to // inform that this is a sending error (e.g. endpoint failure) and handle it // differently at the message receiver. AxisFault axisFault; if (isTimeout) { // In case of a timeout there is no exception axisFault = new AxisFault("The connection timed out"); } else { Exception exception = request.getException(); axisFault = new AxisFault(exception.toString(), exception); } if (mr == null) { // FIXME: the message receiver is null if the MEP is out-only log.error(axisFault.getMessage()); } else { MessageContext nioFaultMessageContext = MessageContextBuilder.createFaultMessageContext(mc, axisFault); nioFaultMessageContext.setProperty(NhttpConstants.SENDING_FAULT, Boolean.TRUE); mr.receive(nioFaultMessageContext); } } catch (AxisFault af) { log.error("Unable to report back failure to the message receiver", af); } } } }; } // -------------- utility methods ------------- private void handleException(String msg, Exception e) throws AxisFault { log.error(msg, e); throw new AxisFault(msg, e); } private void handleException(String msg) throws AxisFault { log.error(msg); throw new AxisFault(msg); } } ./src/org/apache/axis2/transport/nhttp/LoggingIOSession.java0000664000175000017500000001477211767656530023263 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.reactor.SessionBufferStatus; import java.io.IOException; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.channels.SelectionKey; /** * Decorator class intended to transparently extend an {@link IOSession} * with basic event logging capabilities using Commons Logging. */ public class LoggingIOSession implements IOSession { private static int COUNT = 0; private final Log log; private final IOSession session; private final ByteChannel channel; private final int id; public LoggingIOSession(final IOSession session) { super(); if (session == null) { throw new IllegalArgumentException("I/O session may not be null"); } this.session = session; this.channel = new LoggingByteChannel(); this.id = ++COUNT; this.log = LogFactory.getLog(session.getClass()); } public int getStatus() { return this.session.getStatus(); } public ByteChannel channel() { return this.channel; } public SocketAddress getLocalAddress() { return this.session.getLocalAddress(); } public SocketAddress getRemoteAddress() { return this.session.getRemoteAddress(); } public int getEventMask() { return this.session.getEventMask(); } private static String formatOps(int ops) { StringBuffer buffer = new StringBuffer(6); buffer.append('['); if ((ops & SelectionKey.OP_READ) > 0) { buffer.append('r'); } if ((ops & SelectionKey.OP_WRITE) > 0) { buffer.append('w'); } if ((ops & SelectionKey.OP_ACCEPT) > 0) { buffer.append('a'); } if ((ops & SelectionKey.OP_CONNECT) > 0) { buffer.append('c'); } buffer.append(']'); return buffer.toString(); } public void setEventMask(int ops) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Set event mask " + formatOps(ops)); } this.session.setEventMask(ops); } public void setEvent(int op) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Set event " + formatOps(op)); } this.session.setEvent(op); } public void clearEvent(int op) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Clear event " + formatOps(op)); } this.session.clearEvent(op); } public void close() { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Close"); } this.session.close(); } public boolean isClosed() { return this.session.isClosed(); } public void shutdown() { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Shutdown"); } this.session.shutdown(); } public int getSocketTimeout() { return this.session.getSocketTimeout(); } public void setSocketTimeout(int timeout) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Set timeout " + timeout); } this.session.setSocketTimeout(timeout); } public void setBufferStatus(final SessionBufferStatus status) { this.session.setBufferStatus(status); } public boolean hasBufferedInput() { return this.session.hasBufferedInput(); } public boolean hasBufferedOutput() { return this.session.hasBufferedOutput(); } public Object getAttribute(final String name) { return this.session.getAttribute(name); } public void setAttribute(final String name, final Object obj) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Set attribute " + name); } this.session.setAttribute(name, obj); } public Object removeAttribute(final String name) { if (this.log.isDebugEnabled()) { this.log.debug("I/O session " + this.id + " " + this.session + ": Remove attribute " + name); } return this.session.removeAttribute(name); } class LoggingByteChannel implements ByteChannel { public int read(final ByteBuffer dst) throws IOException { int bytesRead = session.channel().read(dst); if (log.isDebugEnabled()) { log.debug("I/O session " + id + " " + session + ": " + bytesRead + " bytes read"); } return bytesRead; } public int write(final ByteBuffer src) throws IOException { int byteWritten = session.channel().write(src); if (log.isDebugEnabled()) { log.debug("I/O session " + id + " " + session + ": " + byteWritten + " bytes written"); } return byteWritten; } public void close() throws IOException { if (log.isDebugEnabled()) { log.debug("I/O session " + id + " " + session + ": Channel close"); } session.channel().close(); } public boolean isOpen() { return session.channel().isOpen(); } } } ./src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java0000664000175000017500000000654411767656530025213 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.http.impl.DefaultHttpResponseFactory; import org.apache.http.impl.nio.DefaultNHttpClientConnection; import org.apache.http.nio.NHttpClientHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.HeapByteBufferAllocator; import org.apache.http.params.HttpParams; public class PlainClientIOEventDispatch implements IOEventDispatch { private static final String NHTTP_CONN = "AXIS2.NHTTP_CONN"; private final NHttpClientHandler handler; private final HttpParams params; public PlainClientIOEventDispatch(final NHttpClientHandler handler, final HttpParams params) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP client handler may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } // Decorate client handler with logging capabilities this.handler = new LoggingNHttpClientHandler(handler); this.params = params; } public void connected(final IOSession session) { // Decorate I/O session with logging capabilities LoggingNHttpClientConnection conn = new LoggingNHttpClientConnection( new LoggingIOSession(session), new DefaultHttpResponseFactory(), new HeapByteBufferAllocator(), this.params); session.setAttribute(NHTTP_CONN, conn); Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY); this.handler.connected(conn, attachment); } public void disconnected(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); this.handler.closed(conn); } public void inputReady(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); conn.consumeInput(this.handler); } public void outputReady(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); conn.produceOutput(this.handler); } public void timeout(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); this.handler.timeout(conn); } } ./src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java0000664000175000017500000001731611767656530024264 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.impl.nio.reactor.SSLIOSessionHandler; import org.apache.http.nio.NHttpServiceHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.params.HttpParams; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.xml.namespace.QName; import java.io.IOException; import java.net.SocketAddress; import java.net.URL; import java.security.GeneralSecurityException; import java.security.KeyStore; public class HttpCoreNIOSSLListener extends HttpCoreNIOListener { private static final Log log = LogFactory.getLog(HttpCoreNIOSSLListener.class); protected IOEventDispatch getEventDispatch( NHttpServiceHandler handler, SSLContext sslContext, SSLIOSessionHandler sslIOSessionHandler, HttpParams params) { return new SSLServerIOEventDispatch(handler, sslContext, sslIOSessionHandler, params); } /** * Return the EPR prefix for services made available over this transport * @return */ protected String getServiceEPRPrefix(ConfigurationContext cfgCtx, String host, int port) { return "https://" + host + (port == 443 ? "" : ":" + port) + (!cfgCtx.getServiceContextPath().startsWith("/") ? "/" : "") + cfgCtx.getServiceContextPath() + (!cfgCtx.getServiceContextPath().endsWith("/") ? "/" : ""); } /** * Create the SSLContext to be used by this listener * @param transportIn the Axis2 transport description * @return the SSLContext to be used */ protected SSLContext getSSLContext(TransportInDescription transportIn) throws AxisFault { KeyManager[] keymanagers = null; TrustManager[] trustManagers = null; Parameter keyParam = transportIn.getParameter("keystore"); Parameter trustParam = transportIn.getParameter("truststore"); if (keyParam != null) { OMElement ksEle = keyParam.getParameterElement().getFirstElement(); String location = ksEle.getFirstChildWithName(new QName("Location")).getText(); String type = ksEle.getFirstChildWithName(new QName("Type")).getText(); String storePassword = ksEle.getFirstChildWithName(new QName("Password")).getText(); String keyPassword = ksEle.getFirstChildWithName(new QName("KeyPassword")).getText(); try { KeyStore keyStore = KeyStore.getInstance(type); URL url = getClass().getClassLoader().getResource(location); log.debug("Loading Key Store from URL : " + url); keyStore.load(url.openStream(), storePassword.toCharArray()); KeyManagerFactory kmfactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm()); kmfactory.init(keyStore, keyPassword.toCharArray()); keymanagers = kmfactory.getKeyManagers(); } catch (GeneralSecurityException gse) { log.error("Error loading Key store : " + location, gse); throw new AxisFault("Error loading Key store : " + location, gse); } catch (IOException ioe) { log.error("Error opening Key store : " + location, ioe); throw new AxisFault("Error opening Key store : " + location, ioe); } } if (trustParam != null) { OMElement tsEle = trustParam.getParameterElement().getFirstElement(); String location = tsEle.getFirstChildWithName(new QName("Location")).getText(); String type = tsEle.getFirstChildWithName(new QName("Type")).getText(); String storePassword = tsEle.getFirstChildWithName(new QName("Password")).getText(); try { KeyStore trustStore = KeyStore.getInstance(type); URL url = getClass().getClassLoader().getResource(location); log.debug("Loading Trust Key Store from URL : " + url); trustStore.load(url.openStream(), storePassword.toCharArray()); TrustManagerFactory trustManagerfactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerfactory.init(trustStore); trustManagers = trustManagerfactory.getTrustManagers(); } catch (GeneralSecurityException gse) { log.error("Error loading Key store : " + location, gse); throw new AxisFault("Error loading Key store : " + location, gse); } catch (IOException ioe) { log.error("Error opening Key store : " + location, ioe); throw new AxisFault("Error opening Key store : " + location, ioe); } } try { SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(keymanagers, trustManagers, null); return sslcontext; } catch (GeneralSecurityException gse) { log.error("Unable to create SSL context with the given configuration", gse); throw new AxisFault("Unable to create SSL context with the given configuration", gse); } } /** * Create the SSLIOSessionHandler to initialize the SSL session / engine, and request for * client authentication at the following levels, through an Axis2 transport configuration * parameter as follows: * SSLVerifyClient - none, optional, require * * @param transportIn the Axis2 transport configuration * @return the SSLIOSessionHandler to be used * @throws AxisFault if a configuration error occurs */ protected SSLIOSessionHandler getSSLIOSessionHandler(TransportInDescription transportIn) throws AxisFault { final Parameter clientAuth = transportIn.getParameter("SSLVerifyClient"); return new SSLIOSessionHandler() { public void initalize(SSLEngine sslengine, HttpParams params) { if (clientAuth != null) { if ("optional".equals(clientAuth.getValue())) { sslengine.setWantClientAuth(true); } else if ("require".equals(clientAuth.getValue())) { sslengine.setNeedClientAuth(true); } } } public void verify(SocketAddress removeAddress, SSLSession session) throws SSLException {} }; } } ./src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java0000664000175000017500000002007011767656530023706 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.impl.nio.reactor.SSLIOSessionHandler; import org.apache.http.nio.NHttpClientHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.params.HttpParams; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.xml.namespace.QName; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.URL; import java.security.GeneralSecurityException; import java.security.KeyStore; public class HttpCoreNIOSSLSender extends HttpCoreNIOSender{ private static final Log log = LogFactory.getLog(HttpCoreNIOSSLSender.class); protected IOEventDispatch getEventDispatch( NHttpClientHandler handler, SSLContext sslContext, SSLIOSessionHandler sslIOSessionHandler, HttpParams params) { return new SSLClientIOEventDispatch(handler, sslContext, sslIOSessionHandler, params); } /* * * Create the SSLContext to be used by this listener * @param transportOut the Axis2 transport configuration * @return the SSLContext to be used */ protected SSLContext getSSLContext(TransportOutDescription transportOut) throws AxisFault { KeyManager[] keymanagers = null; TrustManager[] trustManagers = null; Parameter keyParam = transportOut.getParameter("keystore"); Parameter trustParam = transportOut.getParameter("truststore"); if (keyParam != null) { OMElement ksEle = keyParam.getParameterElement().getFirstElement(); String location = ksEle.getFirstChildWithName(new QName("Location")).getText(); String type = ksEle.getFirstChildWithName(new QName("Type")).getText(); String storePassword = ksEle.getFirstChildWithName(new QName("Password")).getText(); String keyPassword = ksEle.getFirstChildWithName(new QName("KeyPassword")).getText(); try { KeyStore keyStore = KeyStore.getInstance(type); URL url = getClass().getClassLoader().getResource(location); log.debug("Loading Key Store from URL : " + url); keyStore.load(url.openStream(), storePassword.toCharArray()); KeyManagerFactory kmfactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm()); kmfactory.init(keyStore, keyPassword.toCharArray()); keymanagers = kmfactory.getKeyManagers(); } catch (GeneralSecurityException gse) { log.error("Error loading Key store : " + location, gse); throw new AxisFault("Error loading Key store : " + location, gse); } catch (IOException ioe) { log.error("Error opening Key store : " + location, ioe); throw new AxisFault("Error opening Key store : " + location, ioe); } } if (trustParam != null) { OMElement tsEle = trustParam.getParameterElement().getFirstElement(); String location = tsEle.getFirstChildWithName(new QName("Location")).getText(); String type = tsEle.getFirstChildWithName(new QName("Type")).getText(); String storePassword = tsEle.getFirstChildWithName(new QName("Password")).getText(); try { KeyStore trustStore = KeyStore.getInstance(type); URL url = getClass().getClassLoader().getResource(location); log.debug("Loading Trust Key Store from URL : " + url); trustStore.load(url.openStream(), storePassword.toCharArray()); TrustManagerFactory trustManagerfactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerfactory.init(trustStore); trustManagers = trustManagerfactory.getTrustManagers(); } catch (GeneralSecurityException gse) { log.error("Error loading Key store : " + location, gse); throw new AxisFault("Error loading Key store : " + location, gse); } catch (IOException ioe) { log.error("Error opening Key store : " + location, ioe); throw new AxisFault("Error opening Key store : " + location, ioe); } } try { SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(keymanagers, trustManagers, null); return sslcontext; } catch (GeneralSecurityException gse) { log.error("Unable to create SSL context with the given configuration", gse); throw new AxisFault("Unable to create SSL context with the given configuration", gse); } } /* * * Create the SSLIOSessionHandler to initialize the host name verification at the following * levels, through an Axis2 transport configuration parameter as follows: * HostnameVerifier - Default, DefaultAndLocalhost, Strict, AllowAll * * @param transportOut the Axis2 transport configuration * @return the SSLIOSessionHandler to be used * @throws AxisFault if a configuration error occurs */ protected SSLIOSessionHandler getSSLIOSessionHandler(TransportOutDescription transportOut) throws AxisFault { final Parameter hostnameVerifier = transportOut.getParameter("HostnameVerifier"); return new SSLIOSessionHandler() { public void initalize(SSLEngine sslengine, HttpParams params) { } public void verify(SocketAddress remoteAddress, SSLSession session) throws SSLException { String address = null; if (remoteAddress instanceof InetSocketAddress) { address = ((InetSocketAddress) remoteAddress).getHostName(); } else { address = remoteAddress.toString(); } boolean valid = false; if (hostnameVerifier != null) { if ("Strict".equals(hostnameVerifier.getValue())) { valid = HostnameVerifier.STRICT.verify(address, session); } else if ("AllowAll".equals(hostnameVerifier.getValue())) { valid = HostnameVerifier.ALLOW_ALL.verify(address, session); } else if ("DefaultAndLocalhost".equals(hostnameVerifier.getValue())) { valid = HostnameVerifier.DEFAULT_AND_LOCALHOST.verify(address, session); } } else { valid = HostnameVerifier.DEFAULT.verify(address, session); } if (!valid) { throw new SSLException("Host name verification failed for host : " + address); } } }; } } ./src/org/apache/axis2/transport/nhttp/Util.java0000664000175000017500000000727511767656530021016 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HTTPTransportUtils; public class Util { /** * Get the EPR for the message passed in * @param msgContext the message context * @return the destination EPR */ public static EndpointReference getDestinationEPR(MessageContext msgContext) { // Trasnport URL can be different from the WSA-To String transportURL = (String) msgContext.getProperty( Constants.Configuration.TRANSPORT_URL); if (transportURL != null) { return new EndpointReference(transportURL); } else if ( (msgContext.getTo() != null) && !AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals( msgContext.getTo().getAddress()) && !AddressingConstants.Final.WSA_ANONYMOUS_URL.equals( msgContext.getTo().getAddress())) { return msgContext.getTo(); } return null; } /** * Retirn the OMOutputFormat to be used for the message context passed in * @param msgContext the message context * @return the OMOutputFormat to be used */ public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) { OMOutputFormat format = new OMOutputFormat(); msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext)); format.setSOAP11(msgContext.isSOAP11()); format.setDoOptimize(msgContext.isDoingMTOM()); format.setDoingSWA(msgContext.isDoingSwA()); format.setCharSetEncoding(HTTPTransportUtils.getCharSetEncoding(msgContext)); Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty); } return format; } /** * Get the content type for the message passed in * @param msgContext the message * @return content type of the message */ public static String getContentType(MessageContext msgContext) { Object contentTypeObject = msgContext.getProperty(Constants.Configuration.CONTENT_TYPE); if (contentTypeObject != null) { return (String) contentTypeObject; } else if (msgContext.isDoingREST()) { return HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } else { return getOMOutputFormat(msgContext).getContentType(); } } } ./src/org/apache/axis2/transport/nhttp/util/0000775000175000017500000000000011767656530020200 5ustar brianbrian./src/org/apache/axis2/transport/nhttp/util/WorkerPool.java0000664000175000017500000000163311767656530023151 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp.util; public interface WorkerPool { public void execute(Runnable task); } ./src/org/apache/axis2/transport/nhttp/util/PipeImpl.java0000664000175000017500000000612311767656530022564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.nio.channels.Channels; import java.nio.channels.Pipe; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; /** * Create a Pipe suitable for the runtime platform. The java.nio.channels.Pipe implementation * on Windows uses TCP ports bound to the loopback interface to implement a Pipe. In Linux and * Solaris this is passed to a native method. */ public class PipeImpl { private static final Log log = LogFactory.getLog(PipeImpl.class); private ReadableByteChannel source; private WritableByteChannel sink; private PipedOutputStream pipedOut; protected static boolean useNative; static { // platfom default - Unix - native, Windows - Piped Streams if ("/".equals(File.separator)) { useNative = true; } // has this been overridden? String option = System.getProperty("native_pipes"); if (option != null) { // if an option is specified, use it if ("true".equals(option)) { useNative = true; } else if ("false".equals(option)) { useNative = false; } } if (useNative) { log.info("Using native OS Pipes for event-driven to stream IO bridging"); } else { log.info("Using simulated buffered Pipes for event-driven to stream IO bridging"); } } public PipeImpl() throws IOException { if (useNative) { Pipe pipe = Pipe.open(); source = pipe.source(); sink = pipe.sink(); } else { PipedInputStream pipedIn = new PipedInputStream(); try { pipedOut = new PipedOutputStream(pipedIn); } catch (IOException e) { e.printStackTrace(); } source = Channels.newChannel(pipedIn); sink = Channels.newChannel(pipedOut); } } public ReadableByteChannel source() { return source; } public WritableByteChannel sink() { return sink; } } ./src/org/apache/axis2/transport/nhttp/util/WorkerPoolFactory.java0000664000175000017500000000274211767656530024503 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp.util; /** * Dynamically select util.concurrent implemenation */ public class WorkerPoolFactory { public static WorkerPool getWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId) { // try { // Class.forName("java.util.concurrent.ThreadPoolExecutor"); // return new NativeWorkerPool( // core, max, keepAlive, queueLength, threadGroupName, threadGroupId); // } catch (ClassNotFoundException e) { return new BackportWorkerPool( core, max, keepAlive, queueLength, threadGroupName, threadGroupId); } // } } ./src/org/apache/axis2/transport/nhttp/util/BackportWorkerPool.java0000664000175000017500000000633111767656530024637 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp.util; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Utility class to support the backport util.concurrent in JDK 1.4 and the * native concurrent package in JDK 1.5 or later */ public class BackportWorkerPool implements WorkerPool{ private static final Log log = LogFactory.getLog(BackportWorkerPool.class); Executor executor = null; public BackportWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId) { log.debug("Using backport of the util.concurrent package.."); executor = new ThreadPoolExecutor( core, max, keepAlive, TimeUnit.SECONDS, queueLength == -1 ? new LinkedBlockingQueue() : new LinkedBlockingQueue(queueLength), new BackportThreadFactory(new ThreadGroup(threadGroupName), threadGroupId)); } public void execute(Runnable task) { executor.execute(task); } /** * This is a simple ThreadFactory implementation using java.util.concurrent * Creates threads with the given name prefix */ public class BackportThreadFactory implements ThreadFactory { final ThreadGroup group; final AtomicInteger count; final String namePrefix; public BackportThreadFactory(final ThreadGroup group, final String namePrefix) { super(); this.count = new AtomicInteger(1); this.group = group; this.namePrefix = namePrefix; } public Thread newThread(final Runnable runnable) { StringBuffer buffer = new StringBuffer(); buffer.append(this.namePrefix); buffer.append('-'); buffer.append(this.count.getAndIncrement()); Thread t = new Thread(group, runnable, buffer.toString(), 0); t.setDaemon(false); t.setPriority(Thread.NORM_PRIORITY); return t; } } } ./src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java0000664000175000017500000001553111767656530023272 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.nhttp.util.PipeImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.message.BasicHttpEntityEnclosingRequest; import org.apache.http.protocol.HTTP; import java.io.IOException; import java.io.OutputStream; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.util.Iterator; import java.util.Map; /** * Represents an outgoing Axis2 HTTP/s request. It holds the EPR of the destination, the * Axis2 MessageContext to be sent, an HttpHost object which captures information about the * destination, and a Pipe used to write the message stream to the destination */ public class Axis2HttpRequest { private static final Log log = LogFactory.getLog(Axis2HttpRequest.class); /** the EPR of the destination */ private EndpointReference epr = null; /** the HttpHost that contains the HTTP connection information */ private HttpHost httpHost = null; /** the message context being sent */ private MessageContext msgContext = null; /** the Pipe which facilitates the serialization output to be written to the channel */ private PipeImpl pipe = null; /** The Axis2 MessageFormatter that will ensure proper serialization as per Axis2 semantics */ MessageFormatter messageFormatter = null; /** The OM Output format holder */ OMOutputFormat format = null; public Axis2HttpRequest(EndpointReference epr, HttpHost httpHost, MessageContext msgContext) { this.epr = epr; this.httpHost = httpHost; this.msgContext = msgContext; this.format = Util.getOMOutputFormat(msgContext); try { messageFormatter = TransportUtils.getMessageFormatter(msgContext); } catch (AxisFault axisFault) { log.error("Cannot find a suitable MessageFormatter : " + axisFault.getMessage()); } try { this.pipe = new PipeImpl(); } catch (IOException e) { log.error("Error creating pipe to write message body"); } } public EndpointReference getEpr() { return epr; } public HttpHost getHttpHost() { return httpHost; } public MessageContext getMsgContext() { return msgContext; } /** * Create and return a new HttpPost request to the destination EPR * @return the HttpRequest to be sent out */ public HttpRequest getRequest() throws IOException { HttpEntityEnclosingRequest httpRequest = new BasicHttpEntityEnclosingRequest( "POST", epr.getAddress()); httpRequest.setEntity(new BasicHttpEntity()); // set any transport headers Object o = msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (o != null && o instanceof Map) { Map headers = (Map) o; Iterator iter = headers.keySet().iterator(); while (iter.hasNext()) { Object header = iter.next(); Object value = headers.get(header); if (header instanceof String && value != null && value instanceof String) { httpRequest.setHeader((String) header, (String) value); } } } // if the message is SOAP 11 (for which a SOAPAction is *required*), and // the msg context has a SOAPAction or a WSA-Action (give pref to SOAPAction) // use that over any transport header that may be available String soapAction = msgContext.getSoapAction(); if (soapAction == null) { soapAction = msgContext.getWSAAction(); } if (soapAction == null) { msgContext.getAxisOperation().getSoapAction(); } if (msgContext.isSOAP11() && soapAction != null && soapAction.length() > 0) { Header existingHeader = httpRequest.getFirstHeader(HTTPConstants.HEADER_SOAP_ACTION); if (existingHeader != null) { httpRequest.removeHeader(existingHeader); } httpRequest.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } httpRequest.setHeader( HTTP.CONTENT_TYPE, messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction())); return httpRequest; } /** * Return the source channel of the pipe that bridges the serialized output to the socket * @return source channel to read serialized message contents */ public ReadableByteChannel getSourceChannel() { log.debug("get source channel of the pipe on which the outgoing response is written"); return pipe.source(); } /** * Start streaming the message into the Pipe, so that the contents could be read off the source * channel returned by getSourceChannel() * @throws AxisFault on error */ public void streamMessageContents() throws AxisFault { log.debug("start streaming outgoing http request"); OutputStream out = Channels.newOutputStream(pipe.sink()); messageFormatter.writeTo(msgContext, format, out, true); try { out.flush(); out.close(); } catch (IOException e) { handleException("Error closing outgoing message stream", e); } } // -------------- utility methods ------------- private void handleException(String msg, Exception e) throws AxisFault { log.error(msg, e); throw new AxisFault(msg, e); } } ./src/org/apache/axis2/transport/nhttp/ClientHandler.java0000664000175000017500000004221411767656530022605 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.transport.nhttp.util.PipeImpl; import org.apache.axis2.transport.nhttp.util.WorkerPool; import org.apache.axis2.transport.nhttp.util.WorkerPoolFactory; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.Header; import org.apache.http.HttpConnection; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.nio.ContentDecoder; import org.apache.http.nio.ContentEncoder; import org.apache.http.nio.NHttpClientConnection; import org.apache.http.nio.NHttpClientHandler; import org.apache.http.params.DefaultedHttpParams; import org.apache.http.params.HttpParams; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.RequestConnControl; import org.apache.http.protocol.RequestContent; import org.apache.http.protocol.RequestExpectContinue; import org.apache.http.protocol.RequestTargetHost; import org.apache.http.protocol.RequestUserAgent; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; /** * The client connection handler. An instance of this class is used by each IOReactor, to * process every connection. Hence this class should not store any data related to a single * connection - as this is being shared. */ public class ClientHandler implements NHttpClientHandler { private static final Log log = LogFactory.getLog(ClientHandler.class); /** the HTTP protocol parameters to adhere to for outgoing messages */ private final HttpParams params; /** the HttpProcessor for response messages received */ private final HttpProcessor httpProcessor; /** the connection re-use strategy */ private final ConnectionReuseStrategy connStrategy; /** the Axis2 configuration context */ ConfigurationContext cfgCtx = null; /** the nhttp configuration */ private NHttpConfiguration cfg = null; private WorkerPool workerPool = null; private static final String REQUEST_BUFFER = "request-buffer"; private static final String RESPONSE_BUFFER = "response-buffer"; private static final String OUTGOING_MESSAGE_CONTEXT = "axis2_message_context"; private static final String REQUEST_SOURCE_CHANNEL = "request-source-channel"; private static final String RESPONSE_SINK_CHANNEL = "request-sink-channel"; private static final String CONTENT_TYPE = "Content-Type"; /** * Create an instance of this client connection handler using the Axis2 configuration * context and Http protocol parameters given * @param cfgCtx the Axis2 configuration context * @param params the Http protocol parameters to adhere to */ public ClientHandler(final ConfigurationContext cfgCtx, final HttpParams params) { super(); this.cfgCtx = cfgCtx; this.params = params; this.httpProcessor = getHttpProcessor(); this.connStrategy = new DefaultConnectionReuseStrategy(); this.cfg = NHttpConfiguration.getInstance(); workerPool = WorkerPoolFactory.getWorkerPool( cfg.getClientCoreThreads(), cfg.getClientMaxThreads(), cfg.getClientKeepalive(), cfg.getClientQueueLen(), "Client Worker thread group", "HttpClientWorker"); } public void requestReady(final NHttpClientConnection conn) { // The connection is ready for submission of a new request } /** * Submit a new request over an already established connection, which has been * 'kept alive' * @param conn the connection to use to send the request, which has been kept open * @param axis2Req the new request */ public void submitRequest(final NHttpClientConnection conn, Axis2HttpRequest axis2Req) { try { HttpContext context = conn.getContext(); context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn); context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost()); context.setAttribute(OUTGOING_MESSAGE_CONTEXT, axis2Req.getMsgContext()); context.setAttribute(REQUEST_SOURCE_CHANNEL, axis2Req.getSourceChannel()); HttpRequest request = axis2Req.getRequest(); request.setParams( new DefaultedHttpParams(request.getParams(), this.params)); this.httpProcessor.process(request, context); conn.submitRequest(request); context.setAttribute(ExecutionContext.HTTP_REQUEST, request); } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } catch (HttpException e) { handleException("Unexpected HTTP protocol error: " + e.getMessage(), e, conn); } } /** * Invoked when the destination is connected * @param conn the connection being processed * @param attachment the attachment set previously */ public void connected(final NHttpClientConnection conn, final Object attachment) { try { HttpContext context = conn.getContext(); Axis2HttpRequest axis2Req = (Axis2HttpRequest) attachment; context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn); context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost()); // allocate temporary buffers to process this request context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise())); context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(cfg.getBufferZise())); context.setAttribute(OUTGOING_MESSAGE_CONTEXT, axis2Req.getMsgContext()); context.setAttribute(REQUEST_SOURCE_CHANNEL, axis2Req.getSourceChannel()); HttpRequest request = axis2Req.getRequest(); request.setParams( new DefaultedHttpParams(request.getParams(), this.params)); this.httpProcessor.process(request, context); conn.submitRequest(request); context.setAttribute(ExecutionContext.HTTP_REQUEST, request); } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } catch (HttpException e) { handleException("Unexpected HTTP protocol error: " + e.getMessage(), e, conn); } } public void closed(final NHttpClientConnection conn) { log.trace("Connection closed"); } /** * Handle connection timeouts by shutting down the connections * @param conn the connection being processed */ public void timeout(final NHttpClientConnection conn) { log.debug("Connection Timeout"); shutdownConnection(conn); } /** * Handle Http protocol violations encountered while reading from underlying channels * @param conn the connection being processed * @param e the exception encountered */ public void exception(final NHttpClientConnection conn, final HttpException e) { log.error("HTTP protocol violation : " + e.getMessage()); shutdownConnection(conn); } /** * Handle IO errors while reading or writing to underlying channels * @param conn the connection being processed * @param e the exception encountered */ public void exception(final NHttpClientConnection conn, final IOException e) { log.error("I/O error : " + e.getMessage(), e); shutdownConnection(conn); } /** * Process ready input (i.e. response from remote server) * @param conn connection being processed * @param decoder the content decoder in use */ public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder) { HttpContext context = conn.getContext(); HttpResponse response = conn.getHttpResponse(); WritableByteChannel sink = (WritableByteChannel) context.getAttribute(RESPONSE_SINK_CHANNEL); ByteBuffer inbuf = (ByteBuffer) context.getAttribute(REQUEST_BUFFER); try { while (decoder.read(inbuf) > 0) { inbuf.flip(); sink.write(inbuf); inbuf.compact(); } if (decoder.isCompleted()) { if (sink != null) sink.close(); if (!connStrategy.keepAlive(response, context)) { conn.close(); } else { ConnectionPool.release(conn); } } } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } } /** * Process ready output (i.e. write request to remote server) * @param conn the connection being processed * @param encoder the encoder in use */ public void outputReady(final NHttpClientConnection conn, final ContentEncoder encoder) { HttpContext context = conn.getContext(); ReadableByteChannel source = (ReadableByteChannel) context.getAttribute(REQUEST_SOURCE_CHANNEL); ByteBuffer outbuf = (ByteBuffer) context.getAttribute(RESPONSE_BUFFER); try { int bytesRead = source.read(outbuf); if (bytesRead == -1) { encoder.complete(); } else { outbuf.flip(); encoder.write(outbuf); outbuf.compact(); } if (encoder.isCompleted()) { source.close(); } } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } } /** * Process a response received for the request sent out * @param conn the connection being processed */ public void responseReceived(final NHttpClientConnection conn) { HttpContext context = conn.getContext(); HttpResponse response = conn.getHttpResponse(); switch (response.getStatusLine().getStatusCode()) { case HttpStatus.SC_ACCEPTED : { log.debug("Received a 202 Accepted response"); // create a dummy message with an empty SOAP envelope and a property // NhttpConstants.SC_ACCEPTED set to Boolean.TRUE to indicate this is a // placeholder message for the transport to send a HTTP 202 to the // client. Should / would be ignored by any transport other than // nhttp. For example, JMS would not send a reply message for one-way // operations. MessageContext outMsgCtx = (MessageContext) context.getAttribute(OUTGOING_MESSAGE_CONTEXT); MessageReceiver mr = outMsgCtx.getAxisOperation().getMessageReceiver(); try { MessageContext responseMsgCtx = outMsgCtx.getOperationContext(). getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); if (responseMsgCtx == null) { // to support Sandesha.. however, this means that we received a 202 accepted // for an out-only , for which we do not need a dummy message anyway return; } responseMsgCtx.setServerSide(true); responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST()); responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN, outMsgCtx.getProperty(MessageContext.TRANSPORT_IN)); responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn()); responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut()); responseMsgCtx.setAxisMessage(outMsgCtx.getAxisOperation(). getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext()); responseMsgCtx.setConfigurationContext(outMsgCtx.getConfigurationContext()); responseMsgCtx.setTo(null); responseMsgCtx.setEnvelope( ((SOAPFactory)outMsgCtx.getEnvelope().getOMFactory()).getDefaultEnvelope()); responseMsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE); responseMsgCtx.setProperty(NhttpConstants.SC_ACCEPTED, Boolean.TRUE); mr.receive(responseMsgCtx); } catch (org.apache.axis2.AxisFault af) { log.error("Unable to report back 202 Accepted state to the message receiver", af); } return; } case HttpStatus.SC_INTERNAL_SERVER_ERROR : { Header contentType = response.getFirstHeader(CONTENT_TYPE); if (contentType != null && (contentType.getValue().indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0) || contentType.getValue().indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0) { log.debug("Received an internal server error with a SOAP payload"); processResponse(conn, context, response); return; } log.error("Received an internal server error : " + response.getStatusLine().getReasonPhrase()); return; } case HttpStatus.SC_OK : { processResponse(conn, context, response); } } } /** * Perform processing of the received response though Axis2 * @param conn * @param context * @param response */ private void processResponse(final NHttpClientConnection conn, HttpContext context, HttpResponse response) { try { PipeImpl responsePipe = new PipeImpl(); context.setAttribute(RESPONSE_SINK_CHANNEL, responsePipe.sink()); BasicHttpEntity entity = new BasicHttpEntity(); if (response.getStatusLine().getProtocolVersion().greaterEquals(HttpVersion.HTTP_1_1)) { entity.setChunked(true); } response.setEntity(entity); context.setAttribute(ExecutionContext.HTTP_RESPONSE, response); workerPool.execute( new ClientWorker(cfgCtx, Channels.newInputStream(responsePipe.source()), response, (MessageContext) context.getAttribute(OUTGOING_MESSAGE_CONTEXT))); } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } } // ----------- utility methods ----------- private void handleException(String msg, Exception e, NHttpClientConnection conn) { log.error(msg, e); if (conn != null) { shutdownConnection(conn); } } /** * Shutdown the connection ignoring any IO errors during the process * @param conn the connection to be shutdown */ private void shutdownConnection(final HttpConnection conn) { try { conn.shutdown(); } catch (IOException ignore) {} } /** * Return the HttpProcessor for requests * @return the HttpProcessor that processes requests */ private HttpProcessor getHttpProcessor() { BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new RequestContent()); httpProcessor.addInterceptor(new RequestTargetHost()); httpProcessor.addInterceptor(new RequestConnControl()); httpProcessor.addInterceptor(new RequestUserAgent()); httpProcessor.addInterceptor(new RequestExpectContinue()); return httpProcessor; } } ./src/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.java0000664000175000017500000000474711767656530025625 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponseFactory; import org.apache.http.impl.nio.DefaultNHttpClientConnection; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.ByteBufferAllocator; import org.apache.http.params.HttpParams; import java.io.IOException; public class LoggingNHttpClientConnection extends DefaultNHttpClientConnection { private final Log log; private final Log headerlog; public LoggingNHttpClientConnection( final IOSession session, final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator, final HttpParams params) { super(session, responseFactory, allocator, params); this.log = LogFactory.getLog(DefaultNHttpClientConnection.class); this.headerlog = LogFactory.getLog("org.apache.axis2.transport.nhttp.headers"); } public void submitRequest(final HttpRequest request) throws IOException, HttpException { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + this + ": " + request.getRequestLine().toString()); } super.submitRequest(request); if (this.headerlog.isDebugEnabled()) { this.headerlog.debug(">> " + request.getRequestLine().toString()); Header[] headers = request.getAllHeaders(); for (int i = 0; i < headers.length; i++) { this.headerlog.debug(">> " + headers[i].toString()); } } } }./src/org/apache/axis2/transport/nhttp/NhttpConstants.java0000664000175000017500000000175211767656530023065 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; public class NhttpConstants { public static final String SC_ACCEPTED = "SC_ACCEPTED"; public static final String SENDING_FAULT = "sending_fault"; } ./src/org/apache/axis2/transport/nhttp/ServerHandler.java0000664000175000017500000003207511767656530022641 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.transport.nhttp.util.PipeImpl; import org.apache.axis2.transport.nhttp.util.WorkerPool; import org.apache.axis2.transport.nhttp.util.WorkerPoolFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.ConnectionClosedException; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.HttpConnection; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpResponseFactory; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.ProtocolVersion; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.impl.DefaultHttpResponseFactory; import org.apache.http.nio.ContentDecoder; import org.apache.http.nio.ContentEncoder; import org.apache.http.nio.NHttpServerConnection; import org.apache.http.nio.NHttpServiceHandler; import org.apache.http.params.HttpParams; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.ResponseConnControl; import org.apache.http.protocol.ResponseContent; import org.apache.http.protocol.ResponseDate; import org.apache.http.protocol.ResponseServer; import org.apache.http.util.EncodingUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; /** * The server connection handler. An instance of this class is used by each IOReactor, to * process every connection. Hence this class should not store any data related to a single * connection - as this is being shared. */ public class ServerHandler implements NHttpServiceHandler { private static final Log log = LogFactory.getLog(ServerHandler.class); /** the HTTP protocol parameters to adhere to */ private final HttpParams params; /** the factory to create HTTP responses */ private final HttpResponseFactory responseFactory; /** the HTTP response processor */ private final HttpProcessor httpProcessor; /** the strategy to re-use connections */ private final ConnectionReuseStrategy connStrategy; /** the Axis2 configuration context */ ConfigurationContext cfgCtx = null; /** the nhttp configuration */ private NHttpConfiguration cfg = null; /** is this https? */ private boolean isHttps = false; /** the thread pool to process requests */ private WorkerPool workerPool = null; private static final String REQUEST_SINK_CHANNEL = "request-sink-channel"; private static final String RESPONSE_SOURCE_CHANNEL = "response-source-channel"; private static final String REQUEST_BUFFER = "request-buffer"; private static final String RESPONSE_BUFFER = "response-buffer"; public ServerHandler(final ConfigurationContext cfgCtx, final HttpParams params, final boolean isHttps) { super(); this.cfgCtx = cfgCtx; this.params = params; this.isHttps = isHttps; this.responseFactory = new DefaultHttpResponseFactory(); this.httpProcessor = getHttpProcessor(); this.connStrategy = new DefaultConnectionReuseStrategy(); this.cfg = NHttpConfiguration.getInstance(); this.workerPool = WorkerPoolFactory.getWorkerPool( cfg.getServerCoreThreads(), cfg.getServerMaxThreads(), cfg.getServerKeepalive(), cfg.getServerQueueLen(), "Server Worker thread group", "HttpServerWorker"); } /** * Process a new incoming request * @param conn the connection */ public void requestReceived(final NHttpServerConnection conn) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); context.setAttribute(ExecutionContext.HTTP_REQUEST, request); // allocate temporary buffers to process this request context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise())); context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(cfg.getBufferZise())); try { PipeImpl requestPipe = new PipeImpl(); // the pipe used to process the request PipeImpl responsePipe = new PipeImpl(); // the pipe used to process the response context.setAttribute(REQUEST_SINK_CHANNEL, requestPipe.sink()); context.setAttribute(RESPONSE_SOURCE_CHANNEL, responsePipe.source()); // create the default response to this request ProtocolVersion httpVersion = request.getRequestLine().getProtocolVersion(); HttpResponse response = responseFactory.newHttpResponse( httpVersion, HttpStatus.SC_OK, context); response.setParams(this.params); // create a basic HttpEntity using the source channel of the response pipe BasicHttpEntity entity = new BasicHttpEntity(); entity.setContent(Channels.newInputStream(responsePipe.source())); if (httpVersion.greaterEquals(HttpVersion.HTTP_1_1)) { entity.setChunked(true); } response.setEntity(entity); // hand off processing of the request to a thread off the pool workerPool.execute( new ServerWorker(cfgCtx, conn, isHttps, this, request, Channels.newInputStream(requestPipe.source()), response, Channels.newOutputStream(responsePipe.sink()))); } catch (IOException e) { handleException("Error processing request received for : " + request.getRequestLine().getUri(), e, conn); } catch (Exception e) { handleException("Error processing request received for : " + request.getRequestLine().getUri(), e, conn); } } /** * Process ready input by writing it into the Pipe * @param conn the connection being processed * @param decoder the content decoder in use */ public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) { HttpContext context = conn.getContext(); WritableByteChannel sink = (WritableByteChannel) context.getAttribute(REQUEST_SINK_CHANNEL); ByteBuffer inbuf = (ByteBuffer) context.getAttribute(REQUEST_BUFFER); try { while (decoder.read(inbuf) > 0) { inbuf.flip(); sink.write(inbuf); inbuf.compact(); } if (decoder.isCompleted()) { sink.close(); } } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } } public void responseReady(NHttpServerConnection conn) { // New API method - should not require } /** * Process ready output by writing into the channel * @param conn the connection being processed * @param encoder the content encoder in use */ public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) { HttpContext context = conn.getContext(); HttpResponse response = conn.getHttpResponse(); ReadableByteChannel source = (ReadableByteChannel) context.getAttribute(RESPONSE_SOURCE_CHANNEL); ByteBuffer outbuf = (ByteBuffer) context.getAttribute(RESPONSE_BUFFER); try { int bytesRead = source.read(outbuf); if (bytesRead == -1) { encoder.complete(); } else { outbuf.flip(); encoder.write(outbuf); outbuf.compact(); } if (encoder.isCompleted()) { source.close(); if (!connStrategy.keepAlive(response, context)) { conn.close(); } } } catch (IOException e) { handleException("I/O Error : " + e.getMessage(), e, conn); } } /** * Commit the response to the connection. Processes the response through the configured * HttpProcessor and submits it to be sent out * @param conn the connection being processed * @param response the response to commit over the connection */ public void commitResponse(final NHttpServerConnection conn, final HttpResponse response) { try { httpProcessor.process(response, conn.getContext()); conn.submitResponse(response); } catch (HttpException e) { handleException("Unexpected HTTP protocol error : " + e.getMessage(), e, conn); } catch (IOException e) { handleException("IO error submiting response : " + e.getMessage(), e, conn); } } /** * Handle connection timeouts by shutting down the connections * @param conn the connection being processed */ public void timeout(final NHttpServerConnection conn) { HttpRequest req = (HttpRequest) conn.getContext().getAttribute( ExecutionContext.HTTP_REQUEST); if (req != null) { log.debug("Connection Timeout for request to : " + req.getRequestLine().getUri() + " Probably the keepalive connection was closed"); } else { log.warn("Connection Timeout"); } shutdownConnection(conn); } public void connected(final NHttpServerConnection conn) { log.trace("New incoming connection"); } public void closed(final NHttpServerConnection conn) { log.trace("Connection closed"); } /** * Handle HTTP Protocol violations with an error response * @param conn the connection being processed * @param e the exception encountered */ public void exception(final NHttpServerConnection conn, final HttpException e) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); ProtocolVersion ver = request.getRequestLine().getProtocolVersion(); HttpResponse response = responseFactory.newHttpResponse( ver, HttpStatus.SC_BAD_REQUEST, context); byte[] msg = EncodingUtils.getAsciiBytes("Malformed HTTP request: " + e.getMessage()); ByteArrayEntity entity = new ByteArrayEntity(msg); entity.setContentType("text/plain; charset=US-ASCII"); response.setEntity(entity); commitResponse(conn, response); } /** * Handle IO errors while reading or writing to underlying channels * @param conn the connection being processed * @param e the exception encountered */ public void exception(NHttpServerConnection conn, IOException e) { if (e instanceof ConnectionClosedException || e.getMessage().indexOf("Connection reset by peer") > 0 || e.getMessage().indexOf("forcibly closed") > 0) { log.debug("I/O error (Probably the keepalive connection was closed):" + e.getMessage()); } else { log.error("I/O error: " + e.getMessage()); } shutdownConnection(conn); } // ----------- utility methods ----------- private void handleException(String msg, Exception e, NHttpServerConnection conn) { log.error(msg, e); if (conn != null) { shutdownConnection(conn); } } /** * Shutdown the connection ignoring any IO errors during the process * @param conn the connection to be shutdown */ private void shutdownConnection(final HttpConnection conn) { try { conn.shutdown(); } catch (IOException ignore) {} } /** * Return the HttpProcessor for responses * @return the HttpProcessor that processes HttpResponses of this server */ private HttpProcessor getHttpProcessor() { BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new ResponseDate()); httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); return httpProcessor; } } ./src/org/apache/axis2/transport/nhttp/HostnameVerifier.java0000664000175000017500000005431611767656530023351 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import java.io.IOException; import java.io.InputStream; import java.security.cert.Certificate; import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; import java.util.TreeSet; /** * ************************************************************************ * Copied from the not-yet-commons-ssl project at http://juliusdavies.ca/commons-ssl/ * As the above project is accepted into Apache and its JARs become available in * the Maven 2 repos, we will have to switch to using the JARs instead * ************************************************************************ *

    * Interface for checking if a hostname matches the names stored inside the * server's X.509 certificate. Correctly implements * javax.net.ssl.HostnameVerifier, but that interface is not recommended. * Instead we added several check() methods that take SSLSocket, * or X509Certificate, or ultimately (they all end up calling this one), * String. (It's easier to supply JUnit with Strings instead of mock * SSLSession objects!) *

    Our check() methods throw exceptions if the name is * invalid, whereas javax.net.ssl.HostnameVerifier just returns true/false. *

    * We provide the HostnameVerifier.DEFAULT, HostnameVerifier.STRICT, and * HostnameVerifier.ALLOW_ALL implementations. We also provide the more * specialized HostnameVerifier.DEFAULT_AND_LOCALHOST, as well as * HostnameVerifier.STRICT_IE6. But feel free to define your own * implementations! *

    * Inspired by Sebastian Hauer's original StrictSSLProtocolSocketFactory in the * HttpClient "contrib" repository. */ public interface HostnameVerifier extends javax.net.ssl.HostnameVerifier { boolean verify(String host, SSLSession session); void check(String host, SSLSocket ssl) throws IOException; void check(String host, X509Certificate cert) throws SSLException; void check(String host, String[] cns, String[] subjectAlts) throws SSLException; void check(String[] hosts, SSLSocket ssl) throws IOException; void check(String[] hosts, X509Certificate cert) throws SSLException; /** * Checks to see if the supplied hostname matches any of the supplied CNs * or "DNS" Subject-Alts. Most implementations only look at the first CN, * and ignore any additional CNs. Most implementations do look at all of * the "DNS" Subject-Alts. The CNs or Subject-Alts may contain wildcards * according to RFC 2818. * * @param cns CN fields, in order, as extracted from the X.509 * certificate. * @param subjectAlts Subject-Alt fields of type 2 ("DNS"), as extracted * from the X.509 certificate. * @param hosts The array of hostnames to verify. * @throws SSLException If verification failed. */ void check(String[] hosts, String[] cns, String[] subjectAlts) throws SSLException; /** * The DEFAULT HostnameVerifier works the same way as Curl and Firefox. *

    * The hostname must match either the first CN, or any of the subject-alts. * A wildcard can occur in the CN, and in any of the subject-alts. *

    * The only difference between DEFAULT and STRICT is that a wildcard (such * as "*.foo.com") with DEFAULT matches all subdomains, including * "a.b.foo.com". */ public final static HostnameVerifier DEFAULT = new AbstractVerifier() { public final void check(final String[] hosts, final String[] cns, final String[] subjectAlts) throws SSLException { check(hosts, cns, subjectAlts, false, false); } public final String toString() { return "DEFAULT"; } }; /** * The DEFAULT_AND_LOCALHOST HostnameVerifier works like the DEFAULT * one with one additional relaxation: a host of "localhost", * "localhost.localdomain", "127.0.0.1", "::1" will always pass, no matter * what is in the server's certificate. */ public final static HostnameVerifier DEFAULT_AND_LOCALHOST = new AbstractVerifier() { public final void check(final String[] hosts, final String[] cns, final String[] subjectAlts) throws SSLException { if (isLocalhost(hosts[0])) { return; } check(hosts, cns, subjectAlts, false, false); } public final String toString() { return "DEFAULT_AND_LOCALHOST"; } }; /** * The STRICT HostnameVerifier works the same way as java.net.URL in Sun * Java 1.4, Sun Java 5, Sun Java 6. It's also pretty close to IE6. * This implementation appears to be compliant with RFC 2818 for dealing * with wildcards. *

    * The hostname must match either the first CN, or any of the subject-alts. * A wildcard can occur in the CN, and in any of the subject-alts. The * one divergence from IE6 is how we only check the first CN. IE6 allows * a match against any of the CNs present. We decided to follow in * Sun Java 1.4's footsteps and only check the first CN. *

    * A wildcard such as "*.foo.com" matches only subdomains in the same * level, for example "a.foo.com". It does not match deeper subdomains * such as "a.b.foo.com". */ public final static HostnameVerifier STRICT = new AbstractVerifier() { public final void check(final String[] host, final String[] cns, final String[] subjectAlts) throws SSLException { check(host, cns, subjectAlts, false, true); } public final String toString() { return "STRICT"; } }; /** * The STRICT_IE6 HostnameVerifier works just like the STRICT one with one * minor variation: the hostname can match against any of the CN's in the * server's certificate, not just the first one. This behaviour is * identical to IE6's behaviour. */ public final static HostnameVerifier STRICT_IE6 = new AbstractVerifier() { public final void check(final String[] host, final String[] cns, final String[] subjectAlts) throws SSLException { check(host, cns, subjectAlts, true, true); } public final String toString() { return "STRICT_IE6"; } }; /** * The ALLOW_ALL HostnameVerifier essentially turns hostname verification * off. This implementation is a no-op, and never throws the SSLException. */ public final static HostnameVerifier ALLOW_ALL = new AbstractVerifier() { public final void check(final String[] host, final String[] cns, final String[] subjectAlts) { // Allow everything - so never blowup. } public final String toString() { return "ALLOW_ALL"; } }; abstract class AbstractVerifier implements HostnameVerifier { /** * This contains a list of 2nd-level domains that aren't allowed to * have wildcards when combined with country-codes. * For example: [*.co.uk]. *

    * The [*.co.uk] problem is an interesting one. Should we just hope * that CA's would never foolishly allow such a certificate to happen? * Looks like we're the only implementation guarding against this. * Firefox, Curl, Sun Java 1.4, 5, 6 don't bother with this check. */ private final static String[] BAD_COUNTRY_2LDS = {"ac", "co", "com", "ed", "edu", "go", "gouv", "gov", "info", "lg", "ne", "net", "or", "org"}; private final static String[] LOCALHOSTS = {"::1", "127.0.0.1", "localhost", "localhost.localdomain"}; static { // Just in case developer forgot to manually sort the array. :-) Arrays.sort(BAD_COUNTRY_2LDS); Arrays.sort(LOCALHOSTS); } protected AbstractVerifier() { } /** * The javax.net.ssl.HostnameVerifier contract. * * @param host 'hostname' we used to create our socket * @param session SSLSession with the remote server * @return true if the host matched the one in the certificate. */ public boolean verify(String host, SSLSession session) { try { Certificate[] certs = session.getPeerCertificates(); X509Certificate x509 = (X509Certificate) certs[0]; check(new String[]{host}, x509); return true; } catch (SSLException e) { return false; } } public void check(String host, SSLSocket ssl) throws IOException { check(new String[]{host}, ssl); } public void check(String host, X509Certificate cert) throws SSLException { check(new String[]{host}, cert); } public void check(String host, String[] cns, String[] subjectAlts) throws SSLException { check(new String[]{host}, cns, subjectAlts); } public void check(String host[], SSLSocket ssl) throws IOException { if (host == null) { throw new NullPointerException("host to verify is null"); } SSLSession session = ssl.getSession(); if (session == null) { // In our experience this only happens under IBM 1.4.x when // spurious (unrelated) certificates show up in the server' // chain. Hopefully this will unearth the real problem: InputStream in = ssl.getInputStream(); in.available(); /* If you're looking at the 2 lines of code above because you're running into a problem, you probably have two options: #1. Clean up the certificate chain that your server is presenting (e.g. edit "/etc/apache2/server.crt" or wherever it is your server's certificate chain is defined). OR #2. Upgrade to an IBM 1.5.x or greater JVM, or switch to a non-IBM JVM. */ // If ssl.getInputStream().available() didn't cause an // exception, maybe at least now the session is available? session = ssl.getSession(); if (session == null) { // If it's still null, probably a startHandshake() will // unearth the real problem. ssl.startHandshake(); // Okay, if we still haven't managed to cause an exception, // might as well go for the NPE. Or maybe we're okay now? session = ssl.getSession(); } } Certificate[] certs; try { certs = session.getPeerCertificates(); } catch (SSLPeerUnverifiedException spue) { InputStream in = ssl.getInputStream(); in.available(); // Didn't trigger anything interesting? Okay, just throw // original. throw spue; } X509Certificate x509 = (X509Certificate) certs[0]; check(host, x509); } public void check(String[] host, X509Certificate cert) throws SSLException { String[] cns = Certificates.getCNs(cert); String[] subjectAlts = Certificates.getDNSSubjectAlts(cert); check(host, cns, subjectAlts); } public void check(final String[] hosts, final String[] cns, final String[] subjectAlts, final boolean ie6, final boolean strictWithSubDomains) throws SSLException { // Build up lists of allowed hosts For logging/debugging purposes. StringBuffer buf = new StringBuffer(32); buf.append('<'); for (int i = 0; i < hosts.length; i++) { String h = hosts[i]; h = h != null ? h.trim().toLowerCase() : ""; hosts[i] = h; if (i > 0) { buf.append('/'); } buf.append(h); } buf.append('>'); String hostnames = buf.toString(); // Build the list of names we're going to check. Our DEFAULT and // STRICT implementations of the HostnameVerifier only use the // first CN provided. All other CNs are ignored. // (Firefox, wget, curl, Sun Java 1.4, 5, 6 all work this way). TreeSet names = new TreeSet(); if (cns != null && cns.length > 0 && cns[0] != null) { names.add(cns[0]); if (ie6) { for (int i = 1; i < cns.length; i++) { names.add(cns[i]); } } } if (subjectAlts != null) { for (int i = 0; i < subjectAlts.length; i++) { if (subjectAlts[i] != null) { names.add(subjectAlts[i]); } } } if (names.isEmpty()) { String msg = "Certificate for " + hosts[0] + " doesn't contain CN or DNS subjectAlt"; throw new SSLException(msg); } // StringBuffer for building the error message. buf = new StringBuffer(); boolean match = false; out: for (Iterator it = names.iterator(); it.hasNext();) { // Don't trim the CN, though! String cn = (String) it.next(); cn = cn.toLowerCase(); // Store CN in StringBuffer in case we need to report an error. buf.append(" <"); buf.append(cn); buf.append('>'); if (it.hasNext()) { buf.append(" OR"); } // The CN better have at least two dots if it wants wildcard // action. It also can't be [*.co.uk] or [*.co.jp] or // [*.org.uk], etc... boolean doWildcard = cn.startsWith("*.") && cn.lastIndexOf('.') >= 0 && !isIP4Address(cn) && acceptableCountryWildcard(cn); for (int i = 0; i < hosts.length; i++) { final String hostName = hosts[i].trim().toLowerCase(); if (doWildcard) { match = hostName.endsWith(cn.substring(1)); if (match && strictWithSubDomains) { // If we're in strict mode, then [*.foo.com] is not // allowed to match [a.b.foo.com] match = countDots(hostName) == countDots(cn); } } else { match = hostName.equals(cn); } if (match) { break out; } } } if (!match) { throw new SSLException("hostname in certificate didn't match: " + hostnames + " !=" + buf); } } public static boolean isIP4Address(final String cn) { boolean isIP4 = true; String tld = cn; int x = cn.lastIndexOf('.'); // We only bother analyzing the characters after the final dot // in the name. if (x >= 0 && x + 1 < cn.length()) { tld = cn.substring(x + 1); } for (int i = 0; i < tld.length(); i++) { if (!Character.isDigit(tld.charAt(0))) { isIP4 = false; break; } } return isIP4; } public static boolean acceptableCountryWildcard(final String cn) { int cnLen = cn.length(); if (cnLen >= 7 && cnLen <= 9) { // Look for the '.' in the 3rd-last position: if (cn.charAt(cnLen - 3) == '.') { // Trim off the [*.] and the [.XX]. String s = cn.substring(2, cnLen - 3); // And test against the sorted array of bad 2lds: int x = Arrays.binarySearch(BAD_COUNTRY_2LDS, s); return x < 0; } } return true; } public static boolean isLocalhost(String host) { host = host != null ? host.trim().toLowerCase() : ""; if (host.startsWith("::1")) { int x = host.lastIndexOf('%'); if (x >= 0) { host = host.substring(0, x); } } int x = Arrays.binarySearch(LOCALHOSTS, host); return x >= 0; } /** * Counts the number of dots "." in a string. * * @param s string to count dots from * @return number of dots */ public static int countDots(final String s) { int count = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '.') { count++; } } return count; } } class Certificates { public static String[] getCNs(X509Certificate cert) { LinkedList cnList = new LinkedList(); /* Sebastian Hauer's original StrictSSLProtocolSocketFactory used getName() and had the following comment: Parses a X.500 distinguished name for the value of the "Common Name" field. This is done a bit sloppy right now and should probably be done a bit more according to RFC 2253. I've noticed that toString() seems to do a better job than getName() on these X500Principal objects, so I'm hoping that addresses Sebastian's concern. For example, getName() gives me this: 1.2.840.113549.1.9.1=#16166a756c6975736461766965734063756362632e636f6d whereas toString() gives me this: EMAILADDRESS=juliusdavies@cucbc.com Looks like toString() even works with non-ascii domain names! I tested it with "花子.co.jp" and it worked fine. */ String subjectPrincipal = cert.getSubjectX500Principal().toString(); StringTokenizer st = new StringTokenizer(subjectPrincipal, ","); while (st.hasMoreTokens()) { String tok = st.nextToken(); int x = tok.indexOf("CN="); if (x >= 0) { cnList.add(tok.substring(x + 3)); } } if (!cnList.isEmpty()) { String[] cns = new String[cnList.size()]; cnList.toArray(cns); return cns; } else { return null; } } /** * Extracts the array of SubjectAlt DNS names from an X509Certificate. * Returns null if there aren't any. *

    * Note: Java doesn't appear able to extract international characters * from the SubjectAlts. It can only extract international characters * from the CN field. *

    * (Or maybe the version of OpenSSL I'm using to test isn't storing the * international characters correctly in the SubjectAlts?). * * @param cert X509Certificate * @return Array of SubjectALT DNS names stored in the certificate. */ public static String[] getDNSSubjectAlts(X509Certificate cert) { LinkedList subjectAltList = new LinkedList(); Collection c = null; try { c = cert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { // Should probably log.debug() this? cpe.printStackTrace(); } if (c != null) { Iterator it = c.iterator(); while (it.hasNext()) { List list = (List) it.next(); int type = ((Integer) list.get(0)).intValue(); // If type is 2, then we've got a dNSName if (type == 2) { String s = (String) list.get(1); subjectAltList.add(s); } } } if (!subjectAltList.isEmpty()) { String[] subjectAlts = new String[subjectAltList.size()]; subjectAltList.toArray(subjectAlts); return subjectAlts; } else { return null; } } } } ./src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java0000664000175000017500000001316111767656530024632 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.http.impl.DefaultHttpRequestFactory; import org.apache.http.impl.nio.DefaultNHttpServerConnection; import org.apache.http.impl.nio.reactor.SSLIOSession; import org.apache.http.impl.nio.reactor.SSLIOSessionHandler; import org.apache.http.impl.nio.reactor.SSLMode; import org.apache.http.nio.NHttpServiceHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.HeapByteBufferAllocator; import org.apache.http.params.HttpParams; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import java.io.IOException; public class SSLServerIOEventDispatch implements IOEventDispatch { private static final String NHTTP_CONN = "AXIS2.NHTTP_CONN"; private static final String SSL_SESSION = "AXIS2.SSL_SESSION"; private final NHttpServiceHandler handler; private final SSLContext sslcontext; private final SSLIOSessionHandler sslHandler; private final HttpParams params; public SSLServerIOEventDispatch( final NHttpServiceHandler handler, final SSLContext sslcontext, final SSLIOSessionHandler sslHandler, final HttpParams params) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP service handler may not be null"); } if (sslcontext == null) { throw new IllegalArgumentException("SSL context may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.handler = new LoggingNHttpServiceHandler(handler); this.params = params; this.sslcontext = sslcontext; this.sslHandler = sslHandler; } public SSLServerIOEventDispatch( final NHttpServiceHandler handler, final SSLContext sslcontext, final HttpParams params) { this(handler, sslcontext, null, params); } public void connected(final IOSession session) { SSLIOSession sslSession = new SSLIOSession( session, this.sslcontext, this.sslHandler); LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection( new LoggingIOSession(sslSession), new DefaultHttpRequestFactory(), new HeapByteBufferAllocator(), this.params); session.setAttribute(NHTTP_CONN, conn); session.setAttribute(SSL_SESSION, sslSession); this.handler.connected(conn); try { sslSession.bind(SSLMode.SERVER, this.params); } catch (SSLException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void disconnected(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); this.handler.closed(conn); } public void inputReady(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); try { synchronized (sslSession) { if (sslSession.isAppInputReady()) { conn.consumeInput(this.handler); } sslSession.inboundTransport(); } } catch (IOException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void outputReady(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); try { synchronized (sslSession) { if (sslSession.isAppOutputReady()) { conn.produceOutput(this.handler); } sslSession.outboundTransport(); } } catch (IOException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void timeout(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); this.handler.timeout(conn); synchronized (sslSession) { if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) { // The session failed to terminate cleanly sslSession.shutdown(); } } } } ./src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java0000664000175000017500000001140311767656530025066 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import org.apache.http.nio.ContentDecoder; import org.apache.http.nio.ContentEncoder; import org.apache.http.nio.NHttpClientConnection; import org.apache.http.nio.NHttpClientHandler; import java.io.IOException; /** * Decorator class intended to transparently extend an {@link NHttpClientHandler} * with basic event logging capabilities using Commons Logging. */ public class LoggingNHttpClientHandler implements NHttpClientHandler { private final Log log; private final Log headerlog; private final NHttpClientHandler handler; public LoggingNHttpClientHandler(final NHttpClientHandler handler) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP client handler may not be null"); } this.handler = handler; this.log = LogFactory.getLog(handler.getClass()); this.headerlog = LogFactory.getLog("org.apache.axis2.transport.nhttp.headers"); } public void connected(final NHttpClientConnection conn, final Object attachment) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Connected (" + attachment + ")"); } this.handler.connected(conn, attachment); } public void closed(final NHttpClientConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Closed"); } this.handler.closed(conn); } public void exception(final NHttpClientConnection conn, final IOException ex) { this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex); this.handler.exception(conn, ex); } public void exception(final NHttpClientConnection conn, final HttpException ex) { this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex); this.handler.exception(conn, ex); } public void requestReady(final NHttpClientConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Request ready"); } this.handler.requestReady(conn); } public void outputReady(final NHttpClientConnection conn, final ContentEncoder encoder) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Output ready"); } this.handler.outputReady(conn, encoder); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Content encoder " + encoder); } } public void responseReceived(final NHttpClientConnection conn) { HttpResponse response = conn.getHttpResponse(); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": " + response.getStatusLine()); } this.handler.responseReceived(conn); if (this.headerlog.isDebugEnabled()) { this.headerlog.debug("<< " + response.getStatusLine().toString()); Header[] headers = response.getAllHeaders(); for (int i = 0; i < headers.length; i++) { this.headerlog.debug("<< " + headers[i].toString()); } } } public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Input ready"); } this.handler.inputReady(conn, decoder); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Content decoder " + decoder); } } public void timeout(final NHttpClientConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Timeout"); } this.handler.timeout(conn); } }./src/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.java0000664000175000017500000000475211767656530025651 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequestFactory; import org.apache.http.HttpResponse; import org.apache.http.impl.nio.DefaultNHttpServerConnection; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.ByteBufferAllocator; import org.apache.http.params.HttpParams; import java.io.IOException; public class LoggingNHttpServerConnection extends DefaultNHttpServerConnection { private final Log log; private final Log headerlog; public LoggingNHttpServerConnection( final IOSession session, final HttpRequestFactory requestFactory, final ByteBufferAllocator allocator, final HttpParams params) { super(session, requestFactory, allocator, params); this.log = LogFactory.getLog(DefaultNHttpServerConnection.class); this.headerlog = LogFactory.getLog("org.apache.axis2.transport.nhttp.headers"); } public void submitResponse(final HttpResponse response) throws IOException, HttpException { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + this + ": " + response.getStatusLine().toString()); } super.submitResponse(response); if (this.headerlog.isDebugEnabled()) { this.headerlog.debug("<< " + response.getStatusLine().toString()); Header[] headers = response.getAllHeaders(); for (int i = 0; i < headers.length; i++) { this.headerlog.debug("<< " + headers[i].toString()); } } } }./src/org/apache/axis2/transport/nhttp/ClientWorker.java0000664000175000017500000001641411767656530022504 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.protocol.HTTP; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; /** * Performs processing of the HTTP response received for our outgoing request. An instance of this * class is created to process each unique response. */ public class ClientWorker implements Runnable { private static final Log log = LogFactory.getLog(ClientWorker.class); /** the response message context that would be created */ private MessageContext responseMsgCtx = null; /** the InputStream out of which the response body should be read */ private InputStream in = null; /** the HttpResponse received */ private HttpResponse response = null; /** * Create the thread that would process the response message received for the outgoing message * context sent * @param cfgCtx the Axis2 configuration context * @param in the InputStream to read the body of the response message received * @param outMsgCtx the original outgoing message context (i.e. corresponding request) */ public ClientWorker(ConfigurationContext cfgCtx, InputStream in, HttpResponse response, MessageContext outMsgCtx) { this.in = in; this.response = response; try { responseMsgCtx = outMsgCtx.getOperationContext(). getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); } catch (AxisFault af) { log.error("Error getting IN message context from the operation context", af); return; } // this conditional block is to support Sandesha, as it uses an out-in mep, but without // creating the message context to write the response and adding it into the operation // context, as it may get a 202 accepted or 200. So if the operation is complete ignore // this message, else, create a new message context and handle this if (responseMsgCtx == null && outMsgCtx.getOperationContext().isComplete()) { log.debug("Error getting IN message context from the operation context. " + "Possibly an RM terminate sequence message"); return; } else { if (responseMsgCtx == null) { responseMsgCtx = new MessageContext(); responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext()); } responseMsgCtx.setServerSide(true); responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST()); responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN, outMsgCtx .getProperty(MessageContext.TRANSPORT_IN)); responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn()); responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut()); // set any transport headers received Header[] headers = response.getAllHeaders(); if (headers != null && headers.length > 0) { Map headerMap = new HashMap(); for (int i=0; i 0) { responseMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); } else { responseMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, MessageContext.DEFAULT_CHAR_SET_ENCODING); } // TODO: FIXME: // workaround for Axis2 TransportUtils.createSOAPMessage() issue, where a response // of content type "text/xml" is thought to be REST if !MC.isServerSide(). This // question is still under debate and due to the timelines, I am commiting this // workaround as Axis2 1.2 is about to be released and Synapse 1.0 responseMsgCtx.setServerSide(false); envelope = TransportUtils.createSOAPMessage( responseMsgCtx, in, contentType); responseMsgCtx.setServerSide(true); responseMsgCtx.setEnvelope(envelope); } catch (AxisFault af) { log.error("Fault creating response SOAP envelope", af); return; } catch (XMLStreamException e) { log.error("Error creating response SOAP envelope", e); } try { AxisEngine.receive(responseMsgCtx); } catch (AxisFault af) { log.error("Fault processing response message through Axis2", af); } try { if (in != null) { in.close(); } } catch (IOException ignore) {} } } ./src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java0000664000175000017500000002316711767656530023703 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.transport.TransportListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor; import org.apache.http.impl.nio.reactor.SSLIOSessionHandler; import org.apache.http.nio.NHttpServiceHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.ListeningIOReactor; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import javax.net.ssl.SSLContext; import java.io.IOException; import java.io.InterruptedIOException; import java.net.InetSocketAddress; import java.net.UnknownHostException; /** * NIO transport listener for Axis2 based on HttpCore and NIO extensions */ public class HttpCoreNIOListener implements TransportListener { private static final Log log = LogFactory.getLog(HttpCoreNIOListener.class); /** The Axis2 configuration context */ private ConfigurationContext cfgCtx; /** The IOReactor */ private ListeningIOReactor ioReactor = null; /** The EPR prefix for services available over this transport */ private String serviceEPRPrefix; /** The port to listen on, defaults to 8080 */ private int port = 8080; /** The hostname to use, defaults to localhost */ private String host = "localhost"; /** SSLContext if this listener is a SSL listener */ private SSLContext sslContext = null; /** The SSL session handler that manages client authentication etc */ private SSLIOSessionHandler sslIOSessionHandler = null; /** * configure and start the IO reactor on the specified port * @param port port to start the listener on */ private void startServerEngine(int port) { HttpParams params = getServerParameters(); try { ioReactor = new DefaultListeningIOReactor( NHttpConfiguration.getInstance().getServerIOWorkers(), params); } catch (IOException e) { log.error("Error starting the IOReactor", e); } NHttpServiceHandler handler = new ServerHandler(cfgCtx, params, sslContext != null); IOEventDispatch ioEventDispatch = getEventDispatch( handler, sslContext, sslIOSessionHandler, params); try { ioReactor.listen(new InetSocketAddress(port)); ioReactor.execute(ioEventDispatch); } catch (InterruptedIOException ex) { log.fatal("Reactor Interrupted"); } catch (IOException e) { log.fatal("Encountered an I/O error: " + e.getMessage(), e); } log.info("Listener Shutdown"); } protected IOEventDispatch getEventDispatch( NHttpServiceHandler handler, SSLContext sslContext, SSLIOSessionHandler sslioSessionHandler, HttpParams params) { return new PlainServerIOEventDispatch(handler, params); } /** * get HTTP protocol parameters to which the listener must adhere to * @return the applicable HTTP protocol parameters */ private HttpParams getServerParameters() { HttpParams params = new BasicHttpParams(); NHttpConfiguration cfg = NHttpConfiguration.getInstance(); params .setIntParameter(HttpConnectionParams.SO_TIMEOUT, cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000)) .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)) .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1) .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1) .setParameter(HttpProtocolParams.ORIGIN_SERVER, "Axis2-HttpComponents-NIO"); return params; } /** * Initialize the transport listener, and execute reactor in new seperate thread * @param cfgCtx the Axis2 configuration context * @param transprtIn the description of the http/s transport from Axis2 configuration * @throws AxisFault on error */ public void init(ConfigurationContext cfgCtx, TransportInDescription transprtIn) throws AxisFault { this.cfgCtx = cfgCtx; Parameter param = transprtIn.getParameter(PARAM_PORT); if (param != null) { port = Integer.parseInt((String) param.getValue()); } param = transprtIn.getParameter(HOST_ADDRESS); if (param != null) { host = ((String) param.getValue()).trim(); } else { try { host = java.net.InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { log.warn("Unable to lookup local host name, using 'localhost'"); } } // is this an SSL listener? sslContext = getSSLContext(transprtIn); //sslIOSessionHandler = getSSLIOSessionHandler(transprtIn); serviceEPRPrefix = getServiceEPRPrefix(cfgCtx, host, port); } /** * Return the EPR prefix for services made available over this transport * @return */ protected String getServiceEPRPrefix(ConfigurationContext cfgCtx, String host, int port) { return "http://" + host + (port == 80 ? "" : ":" + port) + (!cfgCtx.getServiceContextPath().startsWith("/") ? "/" : "") + cfgCtx.getServiceContextPath() + (!cfgCtx.getServiceContextPath().endsWith("/") ? "/" : ""); } /** * Create the SSLContext to be used by this listener * @param transportIn * @return always null */ protected SSLContext getSSLContext(TransportInDescription transportIn) throws AxisFault { return null; } /** * Create the SSL IO Session handler to be used by this listener * @param transportIn * @return always null */ // protected SSLIOSessionHandler getSSLIOSessionHandler(TransportInDescription transportIn) // throws AxisFault { // return null; // } /** * Start the transport listener on a new thread * @throws AxisFault */ public void start() throws AxisFault { log.debug("Starting Listener..."); // start the Listener in a new seperate thread Thread t = new Thread(new Runnable() { public void run() { try { startServerEngine(port); } catch (Exception e) { e.printStackTrace(); } } }, "HttpCoreNIOListener"); t.start(); log.info((sslContext == null ? "HTTP" : "HTTPS") + " Listener starting on port : " + port); } /** * Stop the listener * @throws AxisFault on error */ public void stop() throws AxisFault { try { ioReactor.shutdown(); log.info("Listener shut down"); } catch (IOException e) { handleException("Error shutting down IOReactor", e); } } /** * Return the EPR for the given service (implements deprecated method temporarily) */ public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { return new EndpointReference(serviceEPRPrefix + serviceName + "/"); } /** * Return the EPRs for the given service over this transport * @param serviceName name of the service * @param ip IP address * @return the EndpointReferences for this service over the transport * @throws AxisFault on error */ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { EndpointReference[] endpointReferences = new EndpointReference[1]; endpointReferences[0] = new EndpointReference(serviceEPRPrefix + serviceName + "/"); return endpointReferences; } /** * TODO: Return session context from transport, this is an improvement in axis2 1.2 and * is not currently supported * @param messageContext * @return */ public SessionContext getSessionContext(MessageContext messageContext) { return null; } public void destroy() { ioReactor = null; } // -------------- utility methods ------------- private void handleException(String msg, Exception e) throws AxisFault { log.error(msg, e); throw new AxisFault(msg, e); } } ./src/org/apache/axis2/transport/nhttp/ConnectionPool.java0000664000175000017500000000751011767656530023022 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHost; import org.apache.http.nio.NHttpClientConnection; import org.apache.http.protocol.ExecutionContext; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class ConnectionPool { private static final Log log = LogFactory.getLog(ConnectionPool.class); /** A map of available connections for reuse. The key selects the host+port of the * connection and the value contains a List of available connections to destination */ private static Map connMap = Collections.synchronizedMap(new HashMap()); public static NHttpClientConnection getConnection(String host, int port) { String key = host + ":" + Integer.toString(port); List connections = (List) connMap.get(key); if (connections == null || connections.isEmpty()) { if (log.isDebugEnabled()) { log.debug("No connections available for reuse"); } return null; } else { NHttpClientConnection conn = null; synchronized (connections) { while (!connections.isEmpty()) { conn = (NHttpClientConnection) connections.remove(0); if (conn.isOpen()) { if (log.isDebugEnabled()) { log.debug("A connection to host : " + host + " on port : " + port + " is available in the pool, and will be reused"); } return conn; } else { if (log.isDebugEnabled()) { log.debug("closing stale connection"); } try { conn.close(); } catch (IOException ignore) { } } } } return null; } } public static void release(NHttpClientConnection conn) { HttpHost host = (HttpHost) conn.getContext().getAttribute( ExecutionContext.HTTP_TARGET_HOST); String key = host.getHostName() + ":" + Integer.toString(host.getPort()); List connections = (List) connMap.get(key); if (connections == null) { synchronized(connMap) { // use double locking to make sure connections = (List) connMap.get(key); if (connections == null) { connections = Collections.synchronizedList(new LinkedList()); connMap.put(key, connections); } } } connections.add(conn); log.debug("Released a connection to host: " + host.getHostName() + " on port : " + host.getPort() + " to the connection pool of current size : " + connections.size()); } } ./src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java0000664000175000017500000001225011767656530025251 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.nio.ContentDecoder; import org.apache.http.nio.ContentEncoder; import org.apache.http.nio.NHttpServerConnection; import org.apache.http.nio.NHttpServiceHandler; import java.io.IOException; /** * Decorator class intended to transparently extend an {@link NHttpServiceHandler} * with basic event logging capabilities using Commons Logging. */ public class LoggingNHttpServiceHandler implements NHttpServiceHandler { private final Log log; private final Log headerlog; private final NHttpServiceHandler handler; public LoggingNHttpServiceHandler(final NHttpServiceHandler handler) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP service handler may not be null"); } this.handler = handler; this.log = LogFactory.getLog(handler.getClass()); this.headerlog = LogFactory.getLog("org.apache.axis2.transport.nhttp.headers"); } public void connected(final NHttpServerConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Connected"); } this.handler.connected(conn); } public void closed(final NHttpServerConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Closed"); } this.handler.closed(conn); } public void exception(final NHttpServerConnection conn, final IOException ex) { if (ex.getMessage().indexOf("Connection reset") != -1 || ex.getMessage().indexOf("forcibly closed") != -1) { this.log.warn("HTTP connection " + conn + ": " + ex.getMessage()); } else { this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex); } this.handler.exception(conn, ex); } public void exception(final NHttpServerConnection conn, final HttpException ex) { if (ex.getMessage().indexOf("Connection reset") > 0 || ex.getMessage().indexOf("forcibly closed") > 0) { this.log.warn("HTTP connection " + conn + ": " + ex.getMessage()); } else { this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex); } this.handler.exception(conn, ex); } public void requestReceived(final NHttpServerConnection conn) { HttpRequest request = conn.getHttpRequest(); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": " + request.getRequestLine()); } this.handler.requestReceived(conn); if (this.headerlog.isDebugEnabled()) { this.headerlog.debug(">> " + request.getRequestLine().toString()); Header[] headers = request.getAllHeaders(); for (int i = 0; i < headers.length; i++) { this.headerlog.debug(">> " + headers[i].toString()); } } } public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Output ready"); } this.handler.outputReady(conn, encoder); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Content encoder " + encoder); } } public void responseReady(final NHttpServerConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Response ready"); } this.handler.responseReady(conn); } public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Input ready"); } this.handler.inputReady(conn, decoder); if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Content decoder " + decoder); } } public void timeout(final NHttpServerConnection conn) { if (this.log.isDebugEnabled()) { this.log.debug("HTTP connection " + conn + ": Timeout"); } this.handler.timeout(conn); } }./src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java0000664000175000017500000001331111767656530024577 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.http.impl.DefaultHttpResponseFactory; import org.apache.http.impl.nio.DefaultNHttpClientConnection; import org.apache.http.impl.nio.reactor.SSLIOSession; import org.apache.http.impl.nio.reactor.SSLIOSessionHandler; import org.apache.http.impl.nio.reactor.SSLMode; import org.apache.http.nio.NHttpClientHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.HeapByteBufferAllocator; import org.apache.http.params.HttpParams; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import java.io.IOException; public class SSLClientIOEventDispatch implements IOEventDispatch { private static final String NHTTP_CONN = "AXIS2.NHTTP_CONN"; private static final String SSL_SESSION = "AXIS2.SSL_SESSION"; private final NHttpClientHandler handler; private final HttpParams params; private final SSLContext sslcontext; private final SSLIOSessionHandler sslHandler; public SSLClientIOEventDispatch( final NHttpClientHandler handler, final SSLContext sslcontext, final SSLIOSessionHandler sslHandler, final HttpParams params) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP client handler may not be null"); } if (sslcontext == null) { throw new IllegalArgumentException("SSL context may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.handler = new LoggingNHttpClientHandler(handler); this.params = params; this.sslcontext = sslcontext; this.sslHandler = sslHandler; } public SSLClientIOEventDispatch( final NHttpClientHandler handler, final SSLContext sslcontext, final HttpParams params) { this(handler, sslcontext, null, params); } public void connected(final IOSession session) { SSLIOSession sslSession = new SSLIOSession( session, this.sslcontext, this.sslHandler); LoggingNHttpClientConnection conn = new LoggingNHttpClientConnection( new LoggingIOSession(sslSession), new DefaultHttpResponseFactory(), new HeapByteBufferAllocator(), this.params); session.setAttribute(NHTTP_CONN, conn); session.setAttribute(SSL_SESSION, sslSession); Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY); this.handler.connected(conn, attachment); try { sslSession.bind(SSLMode.CLIENT, this.params); } catch (SSLException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void disconnected(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); this.handler.closed(conn); } public void inputReady(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); try { synchronized (sslSession) { while (sslSession.isAppInputReady()) { conn.consumeInput(this.handler); } sslSession.inboundTransport(); } } catch (IOException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void outputReady(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); try { synchronized (sslSession) { if (sslSession.isAppOutputReady()) { conn.produceOutput(this.handler); } sslSession.outboundTransport(); } } catch (IOException ex) { this.handler.exception(conn, ex); sslSession.shutdown(); } } public void timeout(final IOSession session) { DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute( NHTTP_CONN); SSLIOSession sslSession = (SSLIOSession) session.getAttribute( SSL_SESSION); this.handler.timeout(conn); synchronized (sslSession) { if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) { // The session failed to terminate cleanly sslSession.shutdown(); } } } } ./src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java0000664000175000017500000001060711767656530023657 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Properties; /** * Store and manage properties that tune the nhttp transport */ public class NHttpConfiguration { // defaults private static final int WORKERS_CORE_THREADS = 20; private static final int WORKERS_MAX_THREADS = 100; private static final int WORKER_KEEP_ALIVE = 5; private static final int BLOCKING_QUEUE_LENGTH = -1; private static final int IO_WORKER_COUNT = 2; private static final int BUFFER_SIZE = 2048; // server listener private static final String S_T_CORE = "snd_t_core"; private static final String S_T_MAX = "snd_t_max"; private static final String S_T_ALIVE = "snd_alive_sec"; private static final String S_T_QLEN = "snd_qlen"; private static final String S_IO_WORKERS = "snd_io_threads"; // client sender private static final String C_T_CORE = "lst_t_core"; private static final String C_T_MAX = "lst_t_max"; private static final String C_T_ALIVE = "lst_alive_sec"; private static final String C_T_QLEN = "lst_qlen"; private static final String C_IO_WORKERS = "lst_io_threads"; // general private static final String G_BUFFER_SIZE = "nhttp_buffer_size"; private static final Log log = LogFactory.getLog(NHttpConfiguration.class); private static NHttpConfiguration _instance = new NHttpConfiguration(); private Properties props = new Properties(); private NHttpConfiguration() { try { props.load(getClass().getClassLoader().getResourceAsStream("nhttp.properties")); } catch (Exception ignore) {} } public static NHttpConfiguration getInstance() { return _instance; } public int getServerCoreThreads() { return getProperty(S_T_CORE, WORKERS_CORE_THREADS); } public int getServerMaxThreads() { return getProperty(S_T_MAX, WORKERS_MAX_THREADS); } public int getServerKeepalive() { return getProperty(S_T_ALIVE, WORKER_KEEP_ALIVE); } public int getServerQueueLen() { return getProperty(S_T_QLEN, BLOCKING_QUEUE_LENGTH); } public int getServerIOWorkers() { return getProperty(S_IO_WORKERS, IO_WORKER_COUNT); } public int getClientCoreThreads() { return getProperty(C_T_CORE, WORKERS_CORE_THREADS); } public int getClientMaxThreads() { return getProperty(C_T_MAX, WORKERS_MAX_THREADS); } public int getClientKeepalive() { return getProperty(C_T_ALIVE, WORKER_KEEP_ALIVE); } public int getClientQueueLen() { return getProperty(C_T_QLEN, BLOCKING_QUEUE_LENGTH); } public int getClientIOWorkers() { return getProperty(C_IO_WORKERS, IO_WORKER_COUNT); } public int getBufferZise() { return getProperty(G_BUFFER_SIZE, BUFFER_SIZE); } /** * Get properties that tune nhttp transport. Preference to system properties * @param name name of the system/config property * @param def default value to return if the property is not set * @return the value of the property to be used */ public int getProperty(String name, int def) { String val = System.getProperty(name); if (val == null) { val = props.getProperty(name); } if (val != null && Integer.valueOf(val).intValue() > 0) { log.debug("Using nhttp tuning parameter : " + name + " = " + val); return Integer.valueOf(val).intValue(); } return def; } } ./src/org/apache/axis2/transport/nhttp/ServerWorker.java0000664000175000017500000004730211767656530022534 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.axis2.transport.http.HTTPTransportReceiver; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.Header; import org.apache.http.HttpInetConnection; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.nio.NHttpServerConnection; import org.apache.http.protocol.HTTP; import org.apache.ws.commons.schema.XmlSchema; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; /** * Processes an incoming request through Axis2. An instance of this class would be created to * process each unique request */ public class ServerWorker implements Runnable { private static final Log log = LogFactory.getLog(ServerWorker.class); /** the incoming message to be processed */ private MessageContext msgContext = null; /** the Axis2 configuration context */ private ConfigurationContext cfgCtx = null; /** the message handler to be used */ private ServerHandler serverHandler = null; /** the underlying http connection */ private NHttpServerConnection conn = null; /** is this https? */ private boolean isHttps = false; /** the http request */ private HttpRequest request = null; /** the http response message (which the this would be creating) */ private HttpResponse response = null; /** the input stream to read the incoming message body */ private InputStream is = null; /** the output stream to write the response message body */ private OutputStream os = null; private static final String SOAPACTION = "SOAPAction"; private static final String LOCATION = "Location"; private static final String CONTENT_TYPE = "Content-Type"; private static final String TEXT_HTML = "text/html"; private static final String TEXT_XML = "text/xml"; /** * Create a new server side worker to process an incoming message and optionally begin creating * its output. This however does not force the processor to write a response back as the * traditional servlet service() method, but creates the background required to write the * response, if one would be created. * @param cfgCtx the Axis2 configuration context * @param conn the underlying http connection * @param serverHandler the handler of the server side messages * @param request the http request received (might still be in the process of being streamed) * @param is the stream input stream to read the request body * @param response the response to be populated if applicable * @param os the output stream to write the response body if one is applicable */ public ServerWorker(final ConfigurationContext cfgCtx, final NHttpServerConnection conn, final boolean isHttps, final ServerHandler serverHandler, final HttpRequest request, final InputStream is, final HttpResponse response, final OutputStream os) { this.cfgCtx = cfgCtx; this.conn = conn; this.isHttps = isHttps; this.serverHandler = serverHandler; this.request = request; this.response = response; this.is = is; this.os = os; this.msgContext = createMessageContext(request); } /** * Create an Axis2 message context for the given http request. The request may be in the * process of being streamed * @param request the http request to be used to create the corresponding Axis2 message context * @return the Axis2 message context created */ private MessageContext createMessageContext(HttpRequest request) { MessageContext msgContext = new MessageContext(); msgContext.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE); msgContext.setConfigurationContext(cfgCtx); if (isHttps) { msgContext.setTransportOut(cfgCtx.getAxisConfiguration() .getTransportOut("https")); msgContext.setTransportIn(cfgCtx.getAxisConfiguration() .getTransportIn("https")); msgContext.setIncomingTransportName("https"); } else { msgContext.setTransportOut(cfgCtx.getAxisConfiguration() .getTransportOut(Constants.TRANSPORT_HTTP)); msgContext.setTransportIn(cfgCtx.getAxisConfiguration() .getTransportIn(Constants.TRANSPORT_HTTP)); msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP); } msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, this); msgContext.setServiceGroupContextId(UUIDGenerator.getUUID()); msgContext.setServerSide(true); msgContext.setProperty( Constants.Configuration.TRANSPORT_IN_URL, request.getRequestLine().getUri()); Map headers = new HashMap(); Header[] headerArr = request.getAllHeaders(); for (int i = 0; i < headerArr.length; i++) { headers.put(headerArr[i].getName(), headerArr[i].getValue()); } msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headers); // find the remote party IP address and set it to the message context if (conn instanceof HttpInetConnection) { HttpInetConnection inetConn = (HttpInetConnection) conn; InetAddress remoteAddr = inetConn.getRemoteAddress(); if (remoteAddr != null) { msgContext.setProperty(MessageContext.REMOTE_ADDR, remoteAddr.getHostAddress()); } } // this is required to support Sandesha 2 msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, new HttpCoreRequestResponseTransport(msgContext)); return msgContext; } /** * Process the incoming request */ public void run() { String method = request.getRequestLine().getMethod().toUpperCase(); if ("GET".equals(method)) { processGet(); } else if ("POST".equals(method)) { processPost(); } else { handleException("Unsupported method : " + method, null); } if (msgContext != null && msgContext.getOperationContext() != null && !Constants.VALUE_TRUE.equals( msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN)) && !"SKIP".equals( msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN))) { response.setStatusCode(HttpStatus.SC_ACCEPTED); serverHandler.commitResponse(conn, response); // make sure that the output stream is flushed and closed properly try { is.close(); } catch (IOException ignore) {} // make sure that the output stream is flushed and closed properly try { os.flush(); os.close(); } catch (IOException ignore) {} } } /** * */ private void processPost() { try { Header contentType = request.getFirstHeader(HTTP.CONTENT_TYPE); Header soapAction = request.getFirstHeader(SOAPACTION); HTTPTransportUtils.processHTTPPostRequest( msgContext, is, os, (contentType != null ? contentType.getValue() : null), (soapAction != null ? soapAction.getValue() : null), request.getRequestLine().getUri()); } catch (AxisFault e) { handleException("Error processing POST request ", e); } } /** * */ private void processGet() { String uri = request.getRequestLine().getUri(); String contextPath = cfgCtx.getContextRoot(); if (!contextPath.startsWith("/")) { contextPath = "/" + contextPath; } if (!contextPath.endsWith("/")) { contextPath = contextPath + "/"; } String servicePath = cfgCtx.getServiceContextPath(); if (!servicePath.startsWith("/")) { servicePath = "/" + servicePath; } String serviceName = null; if (uri.startsWith(servicePath)) { serviceName = uri.substring(servicePath.length()); if (serviceName.startsWith("/")) { serviceName = serviceName.substring(1); } if (serviceName.indexOf("?") != -1) { serviceName = serviceName.substring(0, serviceName.indexOf("?")); } } Map parameters = new HashMap(); int pos = uri.indexOf("?"); if (pos != -1) { StringTokenizer st = new StringTokenizer(uri.substring(pos+1), "&"); while (st.hasMoreTokens()) { String param = st.nextToken(); pos = param.indexOf("="); if (pos != -1) { parameters.put(param.substring(0, pos), param.substring(pos+1)); } else { parameters.put(param, null); } } } if (uri.equals("/favicon.ico")) { response.setStatusCode(HttpStatus.SC_MOVED_PERMANENTLY); response.addHeader(LOCATION, "http://ws.apache.org/favicon.ico"); serverHandler.commitResponse(conn, response); } else if (!uri.startsWith(servicePath)) { response.setStatusCode(HttpStatus.SC_MOVED_PERMANENTLY); response.addHeader(LOCATION, servicePath + "/"); serverHandler.commitResponse(conn, response); } else if (serviceName != null && parameters.containsKey("wsdl")) { AxisService service = (AxisService) cfgCtx.getAxisConfiguration(). getServices().get(serviceName); if (service != null) { try { response.addHeader(CONTENT_TYPE, TEXT_XML); serverHandler.commitResponse(conn, response); service.printWSDL(os, getIpAddress()); } catch (AxisFault e) { handleException("Axis2 fault writing ?wsdl output", e); return; } catch (SocketException e) { handleException("Error getting ip address for ?wsdl output", e); return; } } } else if (serviceName != null && parameters.containsKey("wsdl2")) { AxisService service = (AxisService) cfgCtx.getAxisConfiguration(). getServices().get(serviceName); if (service != null) { try { response.addHeader(CONTENT_TYPE, TEXT_XML); serverHandler.commitResponse(conn, response); service.printWSDL2(os, getIpAddress()); } catch (AxisFault e) { handleException("Axis2 fault writing ?wsdl2 output", e); return; } catch (SocketException e) { handleException("Axis2 fault writing ?wsdl2 output", e); return; } } } else if (serviceName != null && parameters.containsKey("xsd")) { if (parameters.get("xsd") == null || "".equals(parameters.get("xsd"))) { AxisService service = (AxisService) cfgCtx.getAxisConfiguration() .getServices().get(serviceName); if (service != null) { try { response.addHeader(CONTENT_TYPE, TEXT_XML); serverHandler.commitResponse(conn, response); service.printSchema(os); } catch (AxisFault axisFault) { handleException("Error writing ?xsd output to client", axisFault); return; } } } else { //cater for named xsds - check for the xsd name String schemaName = (String) parameters.get("xsd"); AxisService service = (AxisService) cfgCtx.getAxisConfiguration() .getServices().get(serviceName); if (service != null) { //run the population logic just to be sure service.populateSchemaMappings(); //write out the correct schema Map schemaTable = service.getSchemaMappingTable(); XmlSchema schema = (XmlSchema)schemaTable.get(schemaName); if (schema == null) { int dotIndex = schemaName.indexOf('.'); if (dotIndex > 0) { String schemaKey = schemaName.substring(0,dotIndex); schema = (XmlSchema) schemaTable.get(schemaKey); } } //schema found - write it to the stream if (schema != null) { response.addHeader(CONTENT_TYPE, TEXT_XML); serverHandler.commitResponse(conn, response); schema.write(os); } else { // no schema available by that name - send 404 response.setStatusCode(HttpStatus.SC_NOT_FOUND); } } } } else if (serviceName == null || serviceName.length() == 0) { try { response.addHeader(CONTENT_TYPE, TEXT_HTML); serverHandler.commitResponse(conn, response); os.write(HTTPTransportReceiver.getServicesHTML(cfgCtx).getBytes()); } catch (IOException e) { handleException("Error writing ? output to client", e); } } else { if (parameters.isEmpty()) { AxisService service = (AxisService) cfgCtx.getAxisConfiguration(). getServices().get(serviceName); if (service != null) { try { response.addHeader(CONTENT_TYPE, TEXT_HTML); serverHandler.commitResponse(conn, response); os.write(HTTPTransportReceiver.printServiceHTML(serviceName, cfgCtx).getBytes()); } catch (IOException e) { handleException("Error writing service HTML to client", e); return; } } else { handleException("Invalid service : " + serviceName, null); return; } } else { try { serverHandler.commitResponse(conn, response); HTTPTransportUtils.processHTTPGetRequest( msgContext, os, (request.getFirstHeader(SOAPACTION) != null ? request.getFirstHeader(SOAPACTION).getValue() : null), request.getRequestLine().getUri(), cfgCtx, parameters); } catch (AxisFault axisFault) { handleException("Error processing GET request for: " + request.getRequestLine().getUri(), axisFault); } } } // make sure that the output stream is flushed and closed properly try { os.flush(); os.close(); } catch (IOException ignore) {} } private void handleException(String msg, Exception e) { if (e == null) { log.error(msg); } else { log.error(msg, e); } if (e == null) { e = new Exception(msg); } try { AxisEngine engine = new AxisEngine(cfgCtx); MessageContext faultContext = engine.createFaultMessageContext(msgContext, e); engine.sendFault(faultContext); } catch (Exception ex) { response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); response.addHeader(CONTENT_TYPE, TEXT_XML); serverHandler.commitResponse(conn, response); try { os.write(msg.getBytes()); if (ex != null) { String msg2 = ex.getMessage(); if(msg2 != null) { os.write(msg2.getBytes()); } } } catch (IOException ignore) {} if (conn != null) { try { conn.shutdown(); } catch (IOException ignore) {} } } } public HttpResponse getResponse() { return response; } public OutputStream getOutputStream() { return os; } public InputStream getIs() { return is; } public ServerHandler getServiceHandler() { return serverHandler; } public NHttpServerConnection getConn() { return conn; } /** * Copied from transport.http of Axis2 * * Returns the ip address to be used for the replyto epr * CAUTION: * This will go through all the available network interfaces and will try to return an ip address. * First this will try to get the first IP which is not loopback address (127.0.0.1). If none is found * then this will return this will return 127.0.0.1. * This will not consider IPv6 addresses. *

    * TODO: * - Improve this logic to genaralize it a bit more * - Obtain the ip to be used here from the Call API * * @return Returns String. * @throws java.net.SocketException */ private static String getIpAddress() throws SocketException { Enumeration e = NetworkInterface.getNetworkInterfaces(); String address = "127.0.0.1"; while (e.hasMoreElements()) { NetworkInterface netface = (NetworkInterface) e.nextElement(); Enumeration addresses = netface.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress ip = (InetAddress) addresses.nextElement(); if (!ip.isLoopbackAddress() && isIP(ip.getHostAddress())) { return ip.getHostAddress(); } } } return address; } private static boolean isIP(String hostAddress) { return hostAddress.split("[.]").length == 4; } } ./src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java0000664000175000017500000000576211767656530026635 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This interface is a point of control for Axis2 (and Sandesha2 in particular) to control * the behaviour of a Request-Response transport such as HTTP/s * * For nhttp, this does not make much of a difference, as we are capable of keeping a socket open * and writing to it from a different thread, while letting the initial thread that read the request * go free. However, it seems like Sandesha2 is looking for this interface, and it is not going to * create much of an issue anyway */ public class HttpCoreRequestResponseTransport implements RequestResponseTransport { private static final Log log = LogFactory.getLog(HttpCoreRequestResponseTransport.class); private RequestResponseTransportStatus status = RequestResponseTransportStatus.INITIAL; private MessageContext msgContext = null; private boolean responseWritten = false; HttpCoreRequestResponseTransport(MessageContext msgContext) { this.msgContext = msgContext; } public void acknowledgeMessage(MessageContext msgContext) throws AxisFault { log.debug("Acking one-way request"); status = RequestResponseTransportStatus.ACKED; } public void awaitResponse() throws InterruptedException, AxisFault { log.debug("Returning thread but keeping socket open -- awaiting response"); status = RequestResponseTransportStatus.WAITING; msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, "SKIP"); } public void signalResponseReady() { log.debug("Signal response available"); status = RequestResponseTransportStatus.SIGNALLED; } public RequestResponseTransportStatus getStatus() { return status; } public void signalFaultReady(AxisFault fault) { } public boolean isResponseWritten() { return responseWritten; } public void setResponseWritten(boolean responseWritten) { this.responseWritten = responseWritten; } } ./src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java0000664000175000017500000000640711767656530025241 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.nhttp; import org.apache.http.impl.DefaultHttpRequestFactory; import org.apache.http.impl.nio.DefaultNHttpServerConnection; import org.apache.http.nio.NHttpServiceHandler; import org.apache.http.nio.reactor.IOEventDispatch; import org.apache.http.nio.reactor.IOSession; import org.apache.http.nio.util.HeapByteBufferAllocator; import org.apache.http.params.HttpParams; public class PlainServerIOEventDispatch implements IOEventDispatch { private static final String NHTTP_CONN = "AXIS2.NHTTP_CONN"; private final NHttpServiceHandler handler; private final HttpParams params; public PlainServerIOEventDispatch(final NHttpServiceHandler handler, final HttpParams params) { super(); if (handler == null) { throw new IllegalArgumentException("HTTP service handler may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } // Decorate service handler with logging capabilities this.handler = new LoggingNHttpServiceHandler(handler); this.params = params; } public void connected(final IOSession session) { // Decorate I/O session with logging capabilities LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection( new LoggingIOSession(session), new DefaultHttpRequestFactory(), new HeapByteBufferAllocator(), this.params); session.setAttribute(NHTTP_CONN, conn); this.handler.connected(conn); } public void disconnected(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); this.handler.closed(conn); } public void inputReady(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); conn.consumeInput(this.handler); } public void outputReady(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); conn.produceOutput(this.handler); } public void timeout(final IOSession session) { DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute( NHTTP_CONN); this.handler.timeout(conn); } } ./src/org/apache/axis2/transport/OutTransportInfo.java0000664000175000017500000000165411767656530022237 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; public interface OutTransportInfo { public abstract void setContentType(String contentType); } ./src/org/apache/axis2/transport/local/0000775000175000017500000000000011767656530017160 5ustar brianbrian./src/org/apache/axis2/transport/local/LocalTransportSender.java0000664000175000017500000001041311767656530024132 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.local; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class LocalTransportSender extends AbstractHandler implements TransportSender { protected static final Log log = LogFactory.getLog(LocalTransportSender.class); public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { } public void stop() { } public void cleanup(MessageContext msgContext) throws AxisFault { } /** * Method invoke * * @param msgContext the current MessageContext * @throws AxisFault */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // Check for the REST behaviour, if you desire rest beahaviour // put a at the axis2.xml msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); OutputStream out; EndpointReference epr = msgContext.getTo(); if (log.isDebugEnabled()) { ByteArrayOutputStream os = new ByteArrayOutputStream(); TransportUtils.writeMessage(msgContext, os); log.debug("Sending - " + new String(os.toByteArray())); } if (epr != null) { if (!epr.hasNoneAddress()) { out = new ByteArrayOutputStream(); TransportUtils.writeMessage(msgContext, out); finalizeSendWithToAddress(msgContext, (ByteArrayOutputStream)out); } } else { out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (out != null) { TransportUtils.writeMessage(msgContext, out); } else { throw new AxisFault( "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send"); } } TransportUtils.setResponseWritten(msgContext, true); return InvocationResponse.CONTINUE; } public void finalizeSendWithToAddress(MessageContext msgContext, ByteArrayOutputStream out) throws AxisFault { try { InputStream in = new ByteArrayInputStream(out.toByteArray()); ByteArrayOutputStream response = new ByteArrayOutputStream(); LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(this); localTransportReceiver.processMessage(in, msgContext.getTo(), msgContext.getOptions().getAction(), response); in.close(); out.close(); in = new ByteArrayInputStream(response.toByteArray()); msgContext.setProperty(MessageContext.TRANSPORT_IN, in); } catch (IOException e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/transport/local/LocalResponseTransportOutDescription.java0000664000175000017500000000762011767656530027412 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.local; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.description.Flow; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.Phase; import org.apache.axis2.transport.TransportSender; import java.util.ArrayList; /** * This is wrapper class of TransportOutDescription class. * In Using Axis2 Local Transport, you can't send SOAP Message successively. */ class LocalResponseTransportOutDescription extends TransportOutDescription { private TransportSender sender = null; private TransportOutDescription tOut = null; public LocalResponseTransportOutDescription( TransportOutDescription localTransportSenderDescription) throws AxisFault { super(localTransportSenderDescription.getName()); this.tOut = localTransportSenderDescription; } /** * Method addParameter. * * @param param */ public void addParameter(Parameter param) throws AxisFault { tOut.addParameter(param); } public void removeParameter(Parameter param) throws AxisFault { tOut.removeParameter(param); } public void deserializeParameters(OMElement parameterElement) throws AxisFault { tOut.deserializeParameters(parameterElement); } public Flow getFaultFlow() { return tOut.getFaultFlow(); } public Phase getFaultPhase() { return tOut.getFaultPhase(); } /** * @return Returns String. */ public String getName() { return tOut.getName(); } public Flow getOutFlow() { return tOut.getOutFlow(); } public Phase getOutPhase() { return tOut.getOutPhase(); } /** * Method getParameter. * * @param name * @return Returns Parameter. */ public Parameter getParameter(String name) { return tOut.getParameter(name); } public ArrayList getParameters() { return tOut.getParameters(); } /** * @return Returns TransportSender. */ public TransportSender getSender() { return this.sender; } // to check whether the parameter is locked at any level public boolean isParameterLocked(String parameterName) { return tOut.isParameterLocked(parameterName); } public void setFaultFlow(Flow faultFlow) { tOut.setFaultFlow(faultFlow); } public void setFaultPhase(Phase faultPhase) { tOut.setFaultPhase(faultPhase); } /** * @param name */ public void setName(String name) { tOut.setName(name); } public void setOutFlow(Flow outFlow) { tOut.setOutFlow(outFlow); } public void setOutPhase(Phase outPhase) { tOut.setOutPhase(outPhase); } /** * @param sender */ public void setSender(TransportSender sender) { this.sender = sender; } } ./src/org/apache/axis2/transport/local/LocalResponder.java0000664000175000017500000000762011767656530022744 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.local; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.ByteArrayOutputStream; import java.io.OutputStream; /** * LocalResponder */ public class LocalResponder extends AbstractHandler implements TransportSender { protected static final Log log = LogFactory.getLog(LocalResponder.class); // fixed for Executing LocalTransport in MulthThread. private OutputStream out; public LocalResponder(OutputStream response) { this.out = response; } public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { } public void stop() { } public void cleanup(MessageContext msgContext) throws AxisFault { } /** * Method invoke * * @param msgContext the active MessageContext * @throws AxisFault */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // Check for the REST behaviour, if you desire rest beahaviour // put a at the axis2.xml msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); EndpointReference epr = null; if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) { epr = msgContext.getTo(); } try { if (log.isDebugEnabled()) { ByteArrayOutputStream os = new ByteArrayOutputStream(); TransportUtils.writeMessage(msgContext, os); log.debug("Response - " + new String(os.toByteArray())); } if (epr != null) { if (!epr.hasNoneAddress()) { TransportUtils.writeMessage(msgContext, out); } } else { out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (out != null) { TransportUtils.writeMessage(msgContext, out); } else { throw new AxisFault( "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send"); } } } catch (AxisFault axisFault) { // At this point all we can do is log this error, since it happened while // we were sending the response! log.error("Error sending response", axisFault); } TransportUtils.setResponseWritten(msgContext, true); return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/transport/local/LocalTransportReceiver.java0000664000175000017500000001012311767656530024454 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.local; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.util.MessageContextBuilder; import javax.xml.stream.XMLStreamException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; public class LocalTransportReceiver { public static ConfigurationContext CONFIG_CONTEXT; private ConfigurationContext confContext; public LocalTransportReceiver(ConfigurationContext configContext) { confContext = configContext; } public LocalTransportReceiver(LocalTransportSender sender) { this(CONFIG_CONTEXT); } public void processMessage(InputStream in, EndpointReference to, String action, OutputStream response) throws AxisFault { MessageContext msgCtx = confContext.createMessageContext(); TransportInDescription tIn = confContext.getAxisConfiguration().getTransportIn( Constants.TRANSPORT_LOCAL); TransportOutDescription tOut = confContext.getAxisConfiguration().getTransportOut( Constants.TRANSPORT_LOCAL); // CAUTION : When using Local Transport of Axis2, class LocalTransportReceiver changed the name of LocalTransportSender's class in configContext. // We escaped this problem by the following code. LocalResponseTransportOutDescription localTransportResOut = new LocalResponseTransportOutDescription( tOut); localTransportResOut.setSender(new LocalResponder(response)); try { msgCtx.setTransportIn(tIn); msgCtx.setTransportOut(localTransportResOut); msgCtx.setProperty(MessageContext.TRANSPORT_OUT, response); msgCtx.setTo(to); msgCtx.setWSAAction(action); msgCtx.setServerSide(true); InputStreamReader streamReader = new InputStreamReader(in); OMXMLParserWrapper builder; try { builder = BuilderUtil.getBuilder(streamReader); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); msgCtx.setEnvelope(envelope); AxisEngine.receive(msgCtx); } catch (AxisFault e) { // write the fault back. try { MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgCtx, e); faultContext.setTransportOut(localTransportResOut); faultContext.setProperty(MessageContext.TRANSPORT_OUT, response); AxisEngine.sendFault(faultContext); } catch (AxisFault axisFault) { // can't handle this, so just throw it throw axisFault; } } } } ./src/org/apache/axis2/transport/java/0000775000175000017500000000000011767656530017007 5ustar brianbrian./src/org/apache/axis2/transport/java/JavaTransportSender.java0000664000175000017500000001546011767656530023617 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.java; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.DefaultObjectSupplier; import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.rpc.receivers.RPCUtil; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.wsdl.WSDLConstants; import javax.xml.namespace.QName; import java.lang.reflect.Method; public class JavaTransportSender extends AbstractHandler implements TransportSender { public void cleanup(MessageContext msgContext) throws AxisFault { } public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { } public void stop() { } public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { SOAPEnvelope resultEnvelope = invokeJavaMethod(msgContext); Object responseMCObject = msgContext.getOperationContext().getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (responseMCObject != null) { MessageContext responseMC = (MessageContext) responseMCObject; responseMC.setEnvelope(resultEnvelope); } return InvocationResponse.CONTINUE; } private SOAPEnvelope invokeJavaMethod(MessageContext inMessage) throws AxisFault { Class ImplClass; Object obj; Parameter implementationClass = inMessage.getParameter("className"); if (implementationClass == null) { throw new AxisFault("Service Class Paramater does not find for the service : " + inMessage.getAxisService().getName()); } Object serviceImpleClass = implementationClass.getValue(); try { ImplClass = Class.forName(serviceImpleClass.toString()); obj = ImplClass.newInstance(); } catch (Exception e) { throw new AxisFault("Exception occur while creating [ " + serviceImpleClass + " ]", e); } AxisService service = inMessage.getAxisService(); OMElement methodElement = inMessage.getEnvelope().getBody() .getFirstElement(); String messageNameSpace = inMessage.getAxisService().getTargetNamespace(); String methodName = methodElement.getLocalName(); //Serive impplementation class Method method = null; Method[] methods = ImplClass.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { method = methods[i]; break; } } if (method == null) { throw new AxisFault("method : " + methodName + " : does not find in the service implementation class : " + serviceImpleClass); } //gets the object array from the request OMElement ObjectSupplier obj1 = new DefaultObjectSupplier(); Object[] objectArray = RPCUtil.processRequest(methodElement, method, obj1); //reflective invocation Object resObject ; try { resObject = method.invoke(obj, objectArray); } catch (Exception e) { throw new AxisFault("Error occured while invoking the method [ " + methodName + " ]", e); } SOAPFactory fac = getSOAPFactory(inMessage); OMNamespace ns = fac.createOMNamespace(messageNameSpace, service.getSchemaTargetNamespacePrefix()); SOAPEnvelope envelope = fac.getDefaultEnvelope(); OMElement bodyContent = null; if (resObject == null) { //Send empty body envelope.getBody().addChild(fac.createOMElement("item", ns)); } else if (resObject instanceof Object[]) { QName resName = new QName(service.getSchemaTargetNamespace(), method.getName() + "Response", service.getSchemaTargetNamespacePrefix()); //create the omelement from the response array OMElement bodyChild = RPCUtil.getResponseElement(resName, (Object[]) resObject, false, null); //return type is sent with array size bodyChild.addAttribute("returnType", method.getReturnType().getClass().getName() + ((Object[]) resObject).length, envelope.getBody().getDefaultNamespace()); envelope.getBody().addChild(bodyChild); } else { RPCUtil.processResponse(fac, resObject, bodyContent, ns, envelope, method, false, null); envelope.getBody().getFirstElement().addAttribute("returnType", method.getReturnType().getClass().getName(), envelope.getBody().getDefaultNamespace()); } return envelope; } private SOAPFactory getSOAPFactory(MessageContext msgContext) throws AxisFault { String nsURI = msgContext.getEnvelope().getNamespace().getNamespaceURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP12Factory(); } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP11Factory(); } else { throw new AxisFault(Messages.getMessage("invalidSOAPversion")); } } } ./src/org/apache/axis2/transport/tcp/0000775000175000017500000000000011767656530016654 5ustar brianbrian./src/org/apache/axis2/transport/tcp/TCPServer.java0000664000175000017500000001746511767656530021351 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.tcp; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; /** * Class TCPServer */ public class TCPServer implements Runnable, TransportListener { private int port = 8000; private boolean started = false; private static final Log log = LogFactory.getLog(TCPServer.class); private ConfigurationContext configContext; private ServerSocket serversocket; private String hostAddress = null; private String contextPath; public TCPServer() { } public TCPServer(int port, ConfigurationContext configContext) throws AxisFault { try { this.configContext = configContext; serversocket = new ServerSocket(port); ListenerManager listenerManager = configContext.getListenerManager(); TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_TCP); trsIn.setReceiver(this); if (listenerManager == null) { listenerManager = new ListenerManager(); listenerManager.init(configContext); } listenerManager.addListener(trsIn, true); contextPath = configContext.getServiceContextPath(); } catch (IOException e1) { throw AxisFault.makeFault(e1); } } public TCPServer(int port, String dir) throws AxisFault { this(port, ConfigurationContextFactory.createConfigurationContextFromFileSystem(dir, null)); } public void init(ConfigurationContext axisConf, TransportInDescription transprtIn) throws AxisFault { this.configContext = axisConf; Parameter param = transprtIn.getParameter(PARAM_PORT); if (param != null) { this.port = Integer.parseInt((String) param.getValue()); } param = transprtIn.getParameter(HOST_ADDRESS); if (param != null) { hostAddress = ((String) param.getValue()).trim(); } contextPath = configContext.getServiceContextPath(); } public static void main(String[] args) throws AxisFault, NumberFormatException { if (args.length != 2) { System.out.println("TCPServer repositoryLocation port"); } else { File repository = new File(args[0]); if (!repository.exists()) { System.out.print("Repository file does not exists .. initializing repository"); } TCPServer tcpServer = new TCPServer(Integer.parseInt(args[1]), repository.getAbsolutePath()); System.out.println("[Axis2] Using the Repository " + repository.getAbsolutePath()); System.out.println("[Axis2] Starting the TCP Server on port " + args[1]); tcpServer.start(); Runtime.getRuntime().addShutdownHook(new Thread(tcpServer)); } } public void run() { while (started) { Socket socket = null; try { socket = serversocket.accept(); } catch (java.io.InterruptedIOException iie) { } catch (Exception e) { log.debug(e); break; } if (socket != null) { configContext.getThreadPool().execute(new TCPWorker(configContext, socket)); } } } public synchronized void start() throws AxisFault { if (serversocket == null) { serversocket = openSocket(port); } started = true; this.configContext.getThreadPool().execute(this); } /** * Controls the number of server sockets kept open. */ public ServerSocket openSocket(int port) throws AxisFault { for (int i = 0; i < 5; i++) { try { return new ServerSocket(port + i); } catch (IOException e) { // What I'm gonna do here. Try again. } } throw new AxisFault(Messages.getMessage("failedToOpenSocket")); } /* * (non-Javadoc) * @see org.apache.axis2.transport.TransportListener#stop() */ public void stop() throws AxisFault { try { this.serversocket.close(); started = false; } catch (IOException e) { throw AxisFault.makeFault(e); } } public ConfigurationContext getConfigurationContext() { return this.configContext; } /** * I fthe hostAddress parameter is present in axis2.xml then the EPR will be * created by taking the hostAddres into account * (non-Javadoc) * * @see org.apache.axis2.transport.TransportListener#getEPRForService(String, String) */ public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault { EndpointReference[] epRsForService = getEPRsForService(serviceName, ip); return epRsForService != null ? epRsForService[0] : null; } public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { //if host address is present if (hostAddress != null) { if (serversocket != null) { // todo this has to fix return new EndpointReference[]{ new EndpointReference(hostAddress + "/" + contextPath + serviceName)}; } else { log.debug("Unable to generate EPR for the transport tcp"); return null; } } if (ip == null) { try { ip = HttpUtils.getIpAddress(configContext.getAxisConfiguration()); } catch (SocketException e) { throw AxisFault.makeFault(e); } } if (serversocket != null) { // todo this has to fix return new EndpointReference[]{ new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort()) + "/" + contextPath + "/" + serviceName)}; } else { log.debug("Unable to generate EPR for the transport tcp"); return null; } } public SessionContext getSessionContext(MessageContext messageContext) { return null; } public void destroy() { this.configContext = null; } } ./src/org/apache/axis2/transport/tcp/TCPTransportSender.java0000664000175000017500000001110511767656530023221 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.tcp; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.axis2.util.URL; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.Socket; import java.net.SocketAddress; public class TCPTransportSender extends AbstractHandler implements TransportSender { protected Writer out; private Socket socket; public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault { } public void stop() { } public void cleanup(MessageContext msgContext) throws AxisFault { try { if (socket != null) { socket.close(); socket = null; } } catch (IOException e) { // TODO: Log this? } } /** * Method invoke * * @param msgContext * @throws AxisFault */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // Check for the REST behaviour, if you desire rest beahaviour // put a at the axis2.xml msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext)); OutputStream out; EndpointReference epr = null; if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) { epr = msgContext.getTo(); } if (epr != null) { if (!epr.hasNoneAddress()) { out = openTheConnection(epr, msgContext); TransportUtils.writeMessage(msgContext, out); try { socket.shutdownOutput(); msgContext.setProperty(MessageContext.TRANSPORT_IN, socket.getInputStream()); } catch (IOException e) { throw AxisFault.makeFault(e); } } } else { out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (out != null) { TransportUtils.writeMessage(msgContext, out); } else { throw new AxisFault( "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send"); } } TransportUtils.setResponseWritten(msgContext, true); return InvocationResponse.CONTINUE; } protected OutputStream openTheConnection(EndpointReference toURL, MessageContext msgContext) throws AxisFault { if (toURL != null) { try { URL url = new URL(toURL.getAddress()); SocketAddress add = new InetSocketAddress(url.getHost(), (url.getPort() == -1) ? 80 : url.getPort()); socket = new Socket(); socket.connect(add); return socket.getOutputStream(); } catch (MalformedURLException e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } } else { throw new AxisFault(Messages.getMessage("canNotBeNull", "End point reference")); } } } ./src/org/apache/axis2/transport/tcp/TCPWorker.java0000664000175000017500000001106511767656530021342 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport.tcp; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.Reader; import java.net.Socket; /** * This Class is the work hoarse of the TCP request, this process the incomming SOAP Message. */ public class TCPWorker implements Runnable { private static final Log log = LogFactory.getLog(TCPWorker.class); private ConfigurationContext configurationContext; private Socket socket; public TCPWorker(ConfigurationContext configurationContext, Socket socket) { this.configurationContext = configurationContext; this.socket = socket; } public void run() { MessageContext msgContext = null; try { AxisEngine engine = new AxisEngine(configurationContext); AxisConfiguration axisConf = configurationContext.getAxisConfiguration(); TransportOutDescription transportOut = axisConf.getTransportOut(Constants.TRANSPORT_TCP); TransportInDescription transportIn = axisConf.getTransportIn(Constants.TRANSPORT_TCP); if ((transportOut != null) && (transportIn != null)) { // create the Message Context and fill in the values msgContext = configurationContext.createMessageContext(); msgContext.setIncomingTransportName(Constants.TRANSPORT_TCP); msgContext.setTransportIn(transportIn); msgContext.setTransportOut(transportOut); msgContext.setServerSide(true); OutputStream out = socket.getOutputStream(); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); // create the SOAP Envelope Reader in = new InputStreamReader(socket.getInputStream()); OMXMLParserWrapper builder = BuilderUtil.getBuilder(in); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); msgContext.setEnvelope(envelope); engine.receive(msgContext); } else { throw new AxisFault(Messages.getMessage("unknownTransport", Constants.TRANSPORT_TCP)); } } catch (Throwable e) { log.error(e.getMessage(), e); try { AxisEngine engine = new AxisEngine(configurationContext); if (msgContext != null) { msgContext.setProperty(MessageContext.TRANSPORT_OUT, socket.getOutputStream()); MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e); engine.sendFault(faultContext); } } catch (Exception e1) { log.error(e1.getMessage(), e1); } } finally { if (socket != null) { try { this.socket.close(); } catch (IOException e1) { // Do nothing } } } } } ./src/org/apache/axis2/transport/SimpleAxis2Server.java0000775000175000017500000001025111767656530022262 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.engine.AxisServer; import org.apache.axis2.transport.http.SimpleHTTPServer; import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.util.CommandLineOptionParser; import org.apache.axis2.util.OptionsValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.util.List; import java.util.Map; public class SimpleAxis2Server extends AxisServer { private static final Log log = LogFactory.getLog(SimpleHTTPServer.class); int port = -1; public static int DEFAULT_PORT = 8080; public SimpleAxis2Server ( String repoLocation, String confLocation) throws Exception { super(false); configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(repoLocation, confLocation); } /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { String repoLocation = null; String confLocation = null; CommandLineOptionParser optionsParser = new CommandLineOptionParser(args); List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() { public boolean isInvalid(CommandLineOption option) { String optionType = option.getOptionType(); return !("repo".equalsIgnoreCase(optionType) || "conf" .equalsIgnoreCase(optionType)); } }); if ((invalidOptionsList.size() > 0) || (args.length > 4)) { printUsage(); return; } Map optionsMap = optionsParser.getAllOptions(); CommandLineOption repoOption = (CommandLineOption) optionsMap .get("repo"); CommandLineOption confOption = (CommandLineOption) optionsMap .get("conf"); log.info("[SimpleAxisServer] Starting"); if (repoOption != null) { repoLocation = repoOption.getOptionValue(); log.info("[SimpleAxisServer] Using the Axis2 Repository" + new File(repoLocation).getAbsolutePath()); System.out.println("[SimpleAxisServer] Using the Axis2 Repository" + new File(repoLocation).getAbsolutePath()); } if (confOption != null) { confLocation = confOption.getOptionValue(); System.out .println("[SimpleAxisServer] Using the Axis2 Configuration File" + new File(confLocation).getAbsolutePath()); } try { SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation); server.start(); log.info("[SimpleAxisServer] Started"); System.out.println("[SimpleAxisServer] Started"); } catch (Throwable t) { log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t); System.err.println("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer"); } } public static void printUsage() { System.out.println( "Usage: SimpleAxisServer -repo -conf "); System.out.println(); System.exit(1); } } ./src/org/apache/axis2/transport/TransportUtils.java0000664000175000017500000005562711767656530021765 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.transport; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.attachments.CachedFileDataSource; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.Builder; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.MessageContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.description.Parameter; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.http.ApplicationXMLFormatter; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.SOAPMessageFormatter; import org.apache.axis2.transport.http.XFormURLEncodedFormatter; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataSource; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.File; import java.io.InputStream; import java.io.OutputStream; public class TransportUtils { private static final Log log = LogFactory.getLog(TransportUtils.class); public static SOAPEnvelope createSOAPMessage(MessageContext msgContext) throws AxisFault { try { InputStream inStream = (InputStream) msgContext .getProperty(MessageContext.TRANSPORT_IN); msgContext.setProperty(MessageContext.TRANSPORT_IN, null); // this inputstram is set by the TransportSender represents a two // way transport or a Transport Recevier if (inStream == null) { throw new AxisFault(Messages.getMessage("inputstreamNull")); } String contentType = (String) msgContext .getProperty(Constants.Configuration.CONTENT_TYPE); // get the type of char encoding String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); if (charSetEnc == null && contentType != null) { charSetEnc = BuilderUtil.getCharSetEncoding(contentType); } else if (charSetEnc == null) { charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING; } msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc); return createSOAPMessage(msgContext, inStream, contentType); } catch (Exception e) { throw AxisFault.makeFault(e); } } /** * Objective of this method is to capture the SOAPEnvelope creation logic * and make it a common for all the transports and to in/out flows. * * @param msgContext * @param inStream * @param contentType * @return the SOAPEnvelope * @throws AxisFault * @throws OMException * @throws XMLStreamException * @throws FactoryConfigurationError */ public static SOAPEnvelope createSOAPMessage(MessageContext msgContext, InputStream inStream, String contentType) throws AxisFault, OMException, XMLStreamException, FactoryConfigurationError { OMElement documentElement = createDocumentElement(contentType, msgContext, inStream); return createSOAPEnvelope(documentElement); } public static SOAPEnvelope createSOAPEnvelope(OMElement documentElement) { SOAPEnvelope envelope; // Check whether we have received a SOAPEnvelope or not if (documentElement instanceof SOAPEnvelope) { envelope = (SOAPEnvelope) documentElement; } else { // If it is not a SOAPEnvelope we wrap that with a fake // SOAPEnvelope. SOAPFactory soapFactory = new SOAP11Factory(); envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(documentElement); } return envelope; } public static OMElement createDocumentElement(String contentType, MessageContext msgContext, InputStream inStream) throws AxisFault, XMLStreamException { OMElement documentElement = null; String type = null; if (contentType != null) { int index = contentType.indexOf(';'); if (index > 0) { type = contentType.substring(0, index); } else { type = contentType; } // Some services send REST responces as text/xml. We should convert it to // application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder. // isDoingREST should already be properly set by HTTPTransportUtils.initializeMessageContext if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) { // if (HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) { if (msgContext.isServerSide()) { if (msgContext.getSoapAction() == null) { type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } // } else if (msgContext.isDoingREST() && // !msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) { } else if (!msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) { type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } } Builder builder = BuilderUtil.getBuilderFromSelector(type, msgContext); if (builder != null) { if (log.isDebugEnabled()) { log.debug("createSOAPEnvelope using Builder (" + builder.getClass() + ") selected from type (" + type +")"); } documentElement = builder.processDocument(inStream, contentType, msgContext); } } if (documentElement == null) { if (msgContext.isDoingREST()) { if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using REST."); } StAXBuilder builder = BuilderUtil.getPOXBuilder(inStream, null); documentElement = builder.getDocumentElement(); } else { // FIXME making soap defualt for the moment..might effect the // performance if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using SOAP."); } String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); StAXBuilder builder = BuilderUtil.getSOAPBuilder(inStream, charSetEnc); documentElement = builder.getDocumentElement(); } } return documentElement; } /** * Extracts and returns the character set encoding from the * Content-type header * Example: * Content-Type: text/xml; charset=utf-8 * * @param contentType */ public static String getCharSetEncoding(String contentType) { if (log.isDebugEnabled()) { log.debug("Input contentType (" + contentType + ")"); } int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING); if (index == -1) { // Charset encoding not found in the content-type header // Using the default UTF-8 if (log.isDebugEnabled()) { log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")"); } return MessageContext.DEFAULT_CHAR_SET_ENCODING; } // If there are spaces around the '=' sign int indexOfEq = contentType.indexOf("=", index); // There can be situations where "charset" is not the last parameter of the Content-Type header int indexOfSemiColon = contentType.indexOf(";", indexOfEq); String value; if (indexOfSemiColon > 0) { value = (contentType.substring(indexOfEq + 1, indexOfSemiColon)); } else { value = (contentType.substring(indexOfEq + 1, contentType.length())).trim(); } // There might be "" around the value - if so remove them if (value.indexOf('\"') != -1) { value = value.replaceAll("\"", ""); } value = value.trim(); if (log.isDebugEnabled()) { log.debug("CharSetEncoding from content-type (" + value + ")"); } return value; } public static void writeMessage(MessageContext msgContext, OutputStream out) throws AxisFault { SOAPEnvelope envelope = msgContext.getEnvelope(); OMElement outputMessage = envelope; if ((envelope != null) && msgContext.isDoingREST()) { outputMessage = envelope.getBody().getFirstElement(); } if (outputMessage != null) { try { OMOutputFormat format = new OMOutputFormat(); // Pick the char set encoding from the msgContext String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); format.setDoOptimize(false); format.setDoingSWA(false); format.setCharSetEncoding(charSetEnc); outputMessage.serializeAndConsume(out, format); out.flush(); } catch (Exception e) { throw AxisFault.makeFault(e); } } else { throw new AxisFault(Messages.getMessage("outMessageNull")); } } /** * Initial work for a builder selector which selects the builder for a given message format based on the the content type of the recieved message. * content-type to builder mapping can be specified through the Axis2.xml. * * @param msgContext * @return the builder registered against the given content-type * @throws AxisFault */ public static MessageFormatter getMessageFormatter(MessageContext msgContext) throws AxisFault { MessageFormatter messageFormatter = null; String messageFormatString = getMessageFormatterProperty(msgContext); if (messageFormatString != null) { messageFormatter = msgContext.getConfigurationContext() .getAxisConfiguration().getMessageFormatter(messageFormatString); } if (messageFormatter == null) { // If we are doing rest better default to Application/xml formatter if (msgContext.isDoingREST()) { String httpMethod = (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD); if (Constants.Configuration.HTTP_METHOD_GET.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_DELETE.equals(httpMethod)) { return new XFormURLEncodedFormatter(); } return new ApplicationXMLFormatter(); } else { // Lets default to SOAP formatter //TODO need to improve this to use the stateless nature messageFormatter = new SOAPMessageFormatter(); } } return messageFormatter; } /** * @param contentType The contentType of the incoming message. It may be null * @param defaultSOAPNamespace Usually set the version that is expected. This a fallback if the contentType is unavailable or * does not match our expectations * @return null or the soap namespace. A null indicates that the message will be interpretted as a non-SOAP (i.e. REST) message */ private static String getSOAPNamespaceFromContentType(String contentType, String defaultSOAPNamespace) { String returnNS = defaultSOAPNamespace; // Discriminate using the content Type if (contentType != null) { /* * SOAP11 content-type is "text/xml" * SOAP12 content-type is "application/soap+xml" * * What about other content-types? * * TODO: I'm not fully convinced this method is complete, given the media types * listed in HTTPConstants. Should we assume all application/* is SOAP12? * Should we assume all text/* is SOAP11? * * So, we'll follow this pattern: * 1) find the content-type main setting * 2) if (1) not understood, find the "type=" param * Thilina: I merged (1) & (2) */ if (JavaUtils.indexOfIgnoreCase(contentType, SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { returnNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; } // search for "type=text/xml" else if (JavaUtils.indexOfIgnoreCase(contentType, SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { returnNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } } if (returnNS == null) { if (log.isDebugEnabled()) { log.debug("No content-type or \"type=\" parameter was found in the content-type " + "header and no default was specified, thus defaulting to SOAP 1.1."); } returnNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } if (log.isDebugEnabled()) { log.debug("content-type: " + contentType); log.debug("defaultSOAPNamespace: " + defaultSOAPNamespace); log.debug("Returned namespace: " + returnNS); } return returnNS; } public static void processContentTypeForAction(String contentType, MessageContext msgContext) { //Check for action header and set it in as soapAction in MessageContext int index = contentType.indexOf("action"); if (index > -1) { String transientString = contentType.substring(index, contentType.length()); int equal = transientString.indexOf("="); int firstSemiColon = transientString.indexOf(";"); String soapAction; // This will contain "" in the string if (firstSemiColon > -1) { soapAction = transientString.substring(equal + 1, firstSemiColon); } else { soapAction = transientString.substring(equal + 1, transientString.length()); } if ((soapAction != null) && soapAction.startsWith("\"") && soapAction.endsWith("\"")) { soapAction = soapAction .substring(1, soapAction.length() - 1); } msgContext.setSoapAction(soapAction); } } private static String getMessageFormatterProperty(MessageContext msgContext) { String messageFormatterProperty = null; Object property = msgContext .getProperty(Constants.Configuration.MESSAGE_TYPE); if (property != null) { messageFormatterProperty = (String) property; } if (messageFormatterProperty == null) { Parameter parameter = msgContext .getParameter(Constants.Configuration.MESSAGE_TYPE); if (parameter != null) { messageFormatterProperty = (String) parameter.getValue(); } } return messageFormatterProperty; } /** * This is a helper method to get the response written flag from the RequestResponseTransport * instance. */ public static boolean isResponseWritten(MessageContext messageContext) { RequestResponseTransport reqResTransport = getRequestResponseTransport(messageContext); if (reqResTransport != null) { if (log.isDebugEnabled()) { log.debug("Found RequestResponseTransport returning isResponseWritten()"); } return reqResTransport.isResponseWritten(); } else { if (log.isDebugEnabled()) { log.debug("Did not find RequestResponseTransport returning false from get" + "ResponseWritten()"); } return false; } } /** * This is a helper method to set the response written flag on the RequestResponseTransport * instance. */ public static void setResponseWritten(MessageContext messageContext, boolean responseWritten) { RequestResponseTransport reqResTransport = getRequestResponseTransport(messageContext); if (reqResTransport != null) { if (log.isDebugEnabled()) { log.debug("Found RequestResponseTransport setting response written"); } reqResTransport.setResponseWritten(responseWritten); } else { if (log.isDebugEnabled()) { log.debug("Did not find RequestResponseTransport cannot set response written"); } } } /** * This is an internal helper method to retrieve the RequestResponseTransport instance * from the MessageContext object. The MessageContext may be the response MessageContext so * in that case we will have to retrieve the request MessageContext from the OperationContext. */ private static RequestResponseTransport getRequestResponseTransport(MessageContext messageContext) { try { // If this is the request MessageContext we should find it directly by the getProperty() // method if (messageContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL) != null) { return (RequestResponseTransport) messageContext.getProperty( RequestResponseTransport.TRANSPORT_CONTROL); } // If this is the response MessageContext we need to look for the request MessageContext else if (messageContext.getOperationContext() != null && messageContext.getOperationContext() .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE) != null) { return (RequestResponseTransport) messageContext. getOperationContext().getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE).getProperty( RequestResponseTransport.TRANSPORT_CONTROL); } else { return null; } } catch(AxisFault af) { // probably should not be fatal, so just log the message String msg = Messages.getMessage("getMessageContextError", af.toString()); log.debug(msg); return null; } } /** * Clean up cached attachment file * @param msgContext */ public static void deleteAttachments(MessageContext msgContext) { if (log.isDebugEnabled()) { log.debug("Entering deleteAttachments()"); } Attachments attachments = msgContext.getAttachmentMap(); LifecycleManager lcm = (LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER); if (attachments != null) { String [] keys = attachments.getAllContentIDs(); if (keys != null) { String key = null; File file = null; DataSource dataSource = null; for (int i = 0; i < keys.length; i++) { try { key = keys[i]; dataSource = attachments.getDataHandler(key).getDataSource(); if(dataSource instanceof CachedFileDataSource){ file = ((CachedFileDataSource)dataSource).getFile(); if (log.isDebugEnabled()) { log.debug("Delete cache attachment file: "+file.getName()); } if(lcm!=null){ if(log.isDebugEnabled()){ log.debug("deleting file using lifecyclemanager"); } lcm.delete(file); }else{ file.delete(); } } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Delete cache attachment file failed"+ e.getMessage()); } if (file != null) { if(lcm!=null){ try{ lcm.deleteOnExit(file); }catch(Exception ex){ file.deleteOnExit(); } } else{ file.deleteOnExit(); } } } } } } if (log.isDebugEnabled()) { log.debug("Exiting deleteAttachments()"); } } } ./src/org/apache/axis2/client/0000775000175000017500000000000011767656530015310 5ustar brianbrian./src/org/apache/axis2/client/Stub.java0000664000175000017500000002130511767656530017071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.OutInAxisOperation; import org.apache.axis2.description.OutOnlyAxisOperation; import org.apache.axis2.description.RobustOutOnlyAxisOperation; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.commons.httpclient.Header; import java.util.ArrayList; import java.util.Iterator; /** * Base class for generated client stubs. This defines several client API * (public) methods shared between all types of stubs, along with * some protected methods intended for use by the actual stub * implementation code. The client API method names start with a leading * underscore character to avoid conflicts with actual implementation methods. */ public abstract class Stub { protected AxisService _service; protected ArrayList modules = new ArrayList(); protected ServiceClient _serviceClient; /** * Get service client implementation used by this stub. * * @return service client */ public ServiceClient _getServiceClient() { return _serviceClient; } /** * Set service client implementation used by this stub. Once set, the * service client is owned by this stub and will automatically be removed * from the configuration when use of the stub is done. * * @param _serviceClient */ public void _setServiceClient(ServiceClient _serviceClient) { this._serviceClient = _serviceClient; } /** * Create a SOAP message envelope using the supplied options. * TODO generated stub code should use this method, or similar method taking * an operation client * * @param options * @return generated * @throws SOAPProcessingException */ protected static SOAPEnvelope createEnvelope(Options options) throws SOAPProcessingException { return getFactory(options.getSoapVersionURI()).getDefaultEnvelope(); } /** * Get Axiom factory appropriate to selected SOAP version. * * @param soapVersionURI * @return factory */ protected static SOAPFactory getFactory(String soapVersionURI) { if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) { return OMAbstractFactory.getSOAP11Factory(); } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) { return OMAbstractFactory.getSOAP12Factory(); } else { throw new RuntimeException(Messages .getMessage("unknownsoapversion")); } } /** * Finalize method called by garbage collection. This is overridden to * support cleanup of any associated resources. * * @throws Throwable */ protected void finalize() throws Throwable { super.finalize(); cleanup(); } /** * Cleanup associated resources. This removes the axis service from the * configuration. * * @throws AxisFault */ public void cleanup() throws AxisFault { _service.getAxisConfiguration().removeService(_service.getName()); } /** * sets the epr of the service client to given value * * @param address */ protected void setServiceClientEPR(String address) { EndpointReference toEPRFromServiceClient = _serviceClient.getOptions().getTo(); toEPRFromServiceClient.setAddress(address); } /** * add an http header with name and value to message context * * @param messageContext * @param name * @param value */ protected void addHttpHeader(MessageContext messageContext, String name, String value) { java.lang.Object headersObj = messageContext.getProperty(HTTPConstants.HTTP_HEADERS); if (headersObj == null) { headersObj = new java.util.ArrayList(); } java.util.List headers = (java.util.List) headersObj; Header header = new Header(); header.setName(name); header.setValue(value); headers.add(header); messageContext.setProperty(HTTPConstants.HTTP_HEADERS, headers); } /** * sets the propertykey and propertyValue as a pair to operation client * * @param operationClient * @param propertyKey * @param propertyValue */ protected void addPropertyToOperationClient(OperationClient operationClient, String propertyKey, Object propertyValue) { operationClient.getOptions().setProperty(propertyKey, propertyValue); } protected void addPropertyToOperationClient(OperationClient operationClient, String propertyKey, boolean value) { addPropertyToOperationClient(operationClient, propertyKey, new Boolean(value)); } protected void addPropertyToOperationClient(OperationClient operationClient, String propertyKey, int value) { addPropertyToOperationClient(operationClient, propertyKey, new Integer(value)); } protected void setMustUnderstand(OMElement headerElement, OMNamespace omNamespace) { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMAttribute mustUnderstandAttribute = omFactory.createOMAttribute(SOAP12Constants.ATTR_MUSTUNDERSTAND, omNamespace, "true"); headerElement.addAttribute(mustUnderstandAttribute); } protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand){ SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omElementToadd.getNamespace()); soapHeaderBlock.setMustUnderstand(mustUnderstand); OMNode omNode = null; // add child elements for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();){ omNode = (OMNode) iter.next(); soapHeaderBlock.addChild(omNode); } OMAttribute omatribute = null; // add attributes for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext();){ omatribute = (OMAttribute) iter.next(); soapHeaderBlock.addAttribute(omatribute); } } protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop){ addHeader(omElementToadd,envelop,false); } protected void addAnonymousOperations(){ RobustOutOnlyAxisOperation robustoutoonlyOperation = new RobustOutOnlyAxisOperation(ServiceClient.ANON_ROBUST_OUT_ONLY_OP); _service.addOperation(robustoutoonlyOperation); OutOnlyAxisOperation outOnlyOperation = new OutOnlyAxisOperation(ServiceClient.ANON_OUT_ONLY_OP); _service.addOperation(outOnlyOperation); OutInAxisOperation outInOperation = new OutInAxisOperation(ServiceClient.ANON_OUT_IN_OP); _service.addOperation(outInOperation); } } ./src/org/apache/axis2/client/async/0000775000175000017500000000000011767656530016425 5ustar brianbrian./src/org/apache/axis2/client/async/Callback.java0000664000175000017500000000511111767656530020762 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client.async; /** * Base class for asynchronous client callback handler. The application code * needs to create an instance of this class (actually an instance of a * subclass, since this base class cannot be used directly) and pass it to the * generated startXXX client stub method when initiating an asynchronous * operation. The Axis2 code then calls the appropriate methods of this class * {@link #setComplete(boolean)}, and either {@link #onComplete(AsyncResult)} * or {@link #onError(Exception)} when the operation is completed. * * @deprecated Please use AxisCallback instead, this class is deprecated as of 1.3 */ public abstract class Callback { /** * Field complete */ private boolean complete; /** * Method is invoked by Axis2 once the asynchronous operation has completed * successfully. * * @param result */ public abstract void onComplete(AsyncResult result); /** * Method invoked by Axis2 if the asynchronous operation fails. * * @param e */ public abstract void onError(Exception e); /** * Returns true if the asynchronous operation has completed, false otherwise. Typically this is * used for polling. e.g. * *

         *          while(!callback.isComplete()){
         *             Thread.sleep(1000);
         *          }
         *          do whatever u need to do
         *      
    * * * @return boolean */ public synchronized boolean isComplete() { return complete; } /** * Method invoked by Axis2 to set the completion state of the operation. * * @param complete */ public final synchronized void setComplete(boolean complete) { this.complete = complete; notify(); } } ./src/org/apache/axis2/client/async/AsyncResult.java0000664000175000017500000000415511767656530021551 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client.async; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.context.MessageContext; /** * This class holds the results of an asynchronous invocation. The Axis2 * engine returns an instance of this class via the {@link * Callback#onComplete(AsyncResult)} method when the operation completes * successfully. * * @deprecated please see org.apache.axis2.client.async.AxisCallback. */ public class AsyncResult { /** * Message context that supplies the result information. */ private MessageContext result; /** * Constructor. * * @param result message context providing result information * (null if no response) */ public AsyncResult(MessageContext result) { this.result = result; } /** * Get the SOAP Envelope for the response message. * * @return Envelope (null if none) */ public SOAPEnvelope getResponseEnvelope() { if (result != null) { return result.getEnvelope(); } else { return null; } } /** * Get the complete message context for the response. * * @return context (null if none) */ public MessageContext getResponseMessageContext() { return result; } } ./src/org/apache/axis2/client/async/AxisCallback.java0000664000175000017500000000311611767656530021612 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client.async; import org.apache.axis2.context.MessageContext; public interface AxisCallback { /** * This is called when we receive a message. * * @param msgContext the (response) MessageContext */ void onMessage(MessageContext msgContext); /** * This gets called when a fault message is received. * * @param msgContext the MessageContext containing the fault. */ void onFault(MessageContext msgContext); /** * This gets called ONLY when an internal processing exception occurs. * * @param e the Exception which caused the problem */ void onError(Exception e); /** * This is called at the end of the MEP no matter what happens, quite like a finally block. */ void onComplete(); } ./src/org/apache/axis2/client/OperationClient.java0000664000175000017500000003047411767656530021262 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.ClientUtils; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.TargetResolver; import org.apache.axis2.wsdl.WSDLConstants; import java.util.Iterator; import java.util.Map; /** * An operation client is the way an advanced user interacts with Axis2. Actual * operation clients understand a specific MEP and hence their behavior is * defined by their MEP. To interact with an operation client, you first get one * from a specific AxisOperation. Then you set the messages into it one by one * (whatever is available). Then, when you call execute() the client will * execute what it can at that point. If executing the operation client results * in a new message being created, then if a message receiver is registered with * the client then the message will be delivered to that client. */ public abstract class OperationClient { protected AxisOperation axisOp; protected ServiceContext sc; protected Options options; protected OperationContext oc; protected Callback callback; protected AxisCallback axisCallback; /* * indicates whether the MEP execution has completed (and hence ready for * resetting) */ protected boolean completed; protected OperationClient(AxisOperation axisOp, ServiceContext sc, Options options) { this.axisOp = axisOp; this.sc = sc; this.options = new Options(options); completed = false; oc = sc.createOperationContext(axisOp); } /** * Sets the options that should be used for this particular client. This * resets the entire set of options to use the new options - so you'd lose * any option cascading that may have been set up. * * @param options the options */ public void setOptions(Options options) { this.options = options; } /** * Return the options used by this client. If you want to set a single * option, then the right way is to do getOptions() and set specific * options. * * @return the options, which will never be null. */ public Options getOptions() { return options; } /** * Add a message context to the client for processing. This method must not * process the message - it only records it in the operation client. * Processing only occurs when execute() is called. * * @param messageContext the message context * @throws AxisFault if this is called inappropriately. */ public abstract void addMessageContext(MessageContext messageContext) throws AxisFault; /** * Return a message from the client - will return null if the requested * message is not available. * * @param messageLabel the message label of the desired message context * @return the desired message context or null if its not available. * @throws AxisFault if the message label is invalid */ public abstract MessageContext getMessageContext(String messageLabel) throws AxisFault; /** * Set the callback to be executed when a message comes into the MEP and the * operation client is executed. This is the way the operation client * provides notification that a message has been received by it. Exactly * when its executed and under what conditions is a function of the specific * operation client. * * @param callback the callback to be used when the client decides its time to * use it * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated */ public abstract void setCallback(Callback callback); /** * Set the callback to be executed when a message comes into the MEP and the * operation client is executed. This is the way the operation client * provides notification that a message has been received by it. Exactly * when its executed and under what conditions is a function of the specific * operation client. * * @param callback the callback to be used when the client decides its time to * use it */ public final void setCallback(AxisCallback callback) { axisCallback = callback; } /** * Execute the MEP. This method is final and only serves to set (if appropriate) * the lastOperationContext on the ServiceContext, and then it calls * executeImpl(), which does the actual work. * * @param block Indicates whether execution should block or return ASAP. What * block means is of course a function of the specific operation * client. * @throws AxisFault if something goes wrong during the execution of the operation * client. */ public final void execute(boolean block) throws AxisFault { sc.setLastOperationContext(oc); executeImpl(block); } /** * Execute the MEP. What this does depends on the specific operation client. * The basic idea is to have the operation client execute and do something * with the messages that have been added to it so far. For example, if its * an Out-In MEP, then if the Out message has been set, then executing the * client asks it to send the message and get the In message, possibly using * a different thread. * * @param block Indicates whether execution should block or return ASAP. What * block means is of course a function of the specific operation * client. * @throws AxisFault if something goes wrong during the execution of the operation * client. */ public abstract void executeImpl(boolean block) throws AxisFault; /** * Reset the operation client to a clean status after the MEP has completed. * This is how you can reuse an operation client. NOTE: this does not reset * the options; only the internal state so the client can be used again. * * @throws AxisFault if reset is called before the MEP client has completed an * interaction. */ public void reset() throws AxisFault { if (!completed) { throw new AxisFault(Messages.getMessage("cannotreset")); } oc = null; completed = false; } /** * To close the transport if necessary , can call this method. The main * usage of this method is when client uses two tarnsports for sending and * receiving , and we need to remove entries for waiting calls in the * transport listener queue. * Note : DO NOT call this method if you are not using two transports to * send and receive * * @param msgCtxt : MessageContext# which has all the transport information * @throws AxisFault : throws AxisFault if something goes wrong */ public void complete(MessageContext msgCtxt) throws AxisFault { TransportOutDescription trsout = msgCtxt.getTransportOut(); if (trsout != null) { trsout.getSender().cleanup(msgCtxt); } } /** * To get the operation context of the operation client * * @return OperationContext */ public OperationContext getOperationContext() { return oc; } /** * Create a message ID for the given message context if needed. If user gives an option with * MessageID then just copy that into MessageContext , and with that there can be multiple * message with same MessageID unless user call setOption for each invocation. *

    * If user want to give message ID then the better way is to set the message ID in the option and * call setOption for each invocation then the right thing will happen. *

    * If user does not give a message ID then the new one will be created and set that into Message * Context. * * @param mc the message context whose id is to be set */ protected void setMessageID(MessageContext mc) { // now its the time to put the parameters set by the user in to the // correct places and to the // if there is no message id still, set a new one. String messageId = options.getMessageId(); if (messageId == null || "".equals(messageId)) { messageId = UUIDGenerator.getUUID(); } mc.setMessageID(messageId); } protected void addReferenceParameters(MessageContext msgctx) { EndpointReference to = msgctx.getTo(); if (options.isManageSession() || (options.getParent() != null && options.getParent().isManageSession())) { EndpointReference tepr = sc.getTargetEPR(); if (tepr != null) { Map map = tepr.getAllReferenceParameters(); if (map != null) { Iterator valuse = map.values().iterator(); while (valuse.hasNext()) { Object refparaelement = valuse.next(); if (refparaelement instanceof OMElement) { to.addReferenceParameter((OMElement) refparaelement); } } } } } } /** * prepareMessageContext gets a fresh new MessageContext ready to be sent. * It sets up the necessary properties, transport information, etc. * * @param configurationContext the active ConfigurationContext * @param mc the MessageContext to be configured * @throws AxisFault if there is a problem */ protected void prepareMessageContext(ConfigurationContext configurationContext, MessageContext mc) throws AxisFault { // set options on the message context if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) { mc.setSoapAction(options.getAction()); } mc.setOptions(new Options(options)); mc.setAxisMessage(axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); // do Target Resolution TargetResolver targetResolver = configurationContext.getAxisConfiguration().getTargetResolverChain(); if (targetResolver != null) { targetResolver.resolveTarget(mc); } // if the transport to use for sending is not specified, try to find it // from the URL TransportOutDescription senderTransport = options.getTransportOut(); if (senderTransport == null) { EndpointReference toEPR = (options.getTo() != null) ? options .getTo() : mc.getTo(); senderTransport = ClientUtils.inferOutTransport(configurationContext .getAxisConfiguration(), toEPR, mc); } mc.setTransportOut(senderTransport); if (options.getParent() !=null && options.getParent().isManageSession()) { mc.getOptions().setManageSession(true); } else if (options.isManageSession()) { mc.getOptions().setManageSession(true); } addReferenceParameters(mc); } } ./src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java0000664000175000017500000001417511767656530022753 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.engine.AxisConfiguration; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; public class WSDLBasedPolicyProcessor { private HashMap ns2modules = new HashMap(); public WSDLBasedPolicyProcessor(ConfigurationContext configctx) { AxisConfiguration axisConfiguration = configctx.getAxisConfiguration(); for (Iterator iterator = axisConfiguration.getModules().values() .iterator(); iterator.hasNext();) { AxisModule axisModule = (AxisModule) iterator.next(); String[] namespaces = axisModule.getSupportedPolicyNamespaces(); if (namespaces == null) { continue; } for (int i = 0; i < namespaces.length; i++) { ArrayList moduleList = null; Object obj = ns2modules.get(namespaces[i]); if (obj == null) { moduleList = new ArrayList(5); ns2modules.put(namespaces[i], moduleList); } else { moduleList = (ArrayList) obj; } moduleList.add(axisModule); } } } public void configureServicePolices(AxisService axisService) throws AxisFault { Iterator operations = axisService.getOperations(); while (operations.hasNext()) { AxisOperation axisOp = (AxisOperation) operations.next(); // TODO we support only operation level Policy now configureOperationPolices(axisOp); } } public void configureOperationPolices(AxisOperation op) throws AxisFault { PolicyInclude policyInclude = op.getPolicyInclude(); Policy policy = policyInclude.getEffectivePolicy(); if (policy != null) { policy = (Policy) policy.normalize(policyInclude .getPolicyRegistry(), false); for (Iterator iterator = policy.getAlternatives(); iterator .hasNext();) { List namespaceList = new ArrayList(); Assertion assertion; /* * Fist we compute the set of distinct namespaces of assertions * of this particular policy alternative. */ for (Iterator assertions = ((List) iterator.next()).iterator(); assertions .hasNext();) { assertion = (Assertion) iterator.next(); QName name = assertion.getName(); String namespaceURI = name.getNamespaceURI(); if (!namespaceList.contains(namespaceURI)) { namespaceList.add(namespaceURI); } } /* * Now we compute all the modules that are are involved in * process assertions that belongs to any of the namespaces of * list. */ List modulesToEngage; for (Iterator namespaces = namespaceList.iterator(); iterator .hasNext();) { String namespace = (String) namespaces.next(); modulesToEngage = (List) ns2modules.get(namespace); if (modulesToEngage == null) { /* * If there isn't a single module that is not interested * of assertions that belongs to a particular namespace, * we simply ignore it. */ System.err .println("cannot find any modules to process " + namespace + "type assertions"); // TODO: Log this .. continue; } else { engageModulesToAxisDescription(modulesToEngage, op); } } /* * We only pick the first policy alternative. Other policy * alternatives are ignored. */ break; } } } /** * Engages the list of Modules to the specified AxisDescription. */ private void engageModulesToAxisDescription(List modulesToEngage, AxisDescription axisDescription) throws AxisFault { AxisModule axisModule; String moduleName; for (Iterator iterator = modulesToEngage.iterator(); iterator.hasNext();) { axisModule = (AxisModule) iterator.next(); moduleName = axisModule.getName(); if (!axisDescription.isEngaged(moduleName)) { axisDescription.engageModule(axisModule); (axisModule.getModule()).engageNotify(axisDescription); } } } } ./src/org/apache/axis2/client/Options.java0000664000175000017500000016354011767656530017617 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.MetaDataEntry; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; /** * Holder for operation client options. This is used by the other classes in * this package to configure various aspects of how a client communicates with a * service. It exposes a number of predefined properties as part of the API * (with specific getXXX and setXXX methods), and also allows for arbitrary * named properties to be passed using a properties map with the property name * as the key value. Instances of this class can be chained together for * property inheritance, so that if a property is not set in one instance it * will check its parent for a setting. */ public class Options implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(Options.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled(); private static final String myClassName = "Options"; /** * An ID which can be used to correlate operations on an instance of * this object in the log files */ private String logCorrelationIDString = null; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -8318751890845181507L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; //I am going to set a reply to as customer reply To address , // so that Axis2 does not need to wait for the reply public static String CUSTOM_REPLYTO_ADDRESS = "CUSTOM_REPLYTO_ADDRESS"; public static String CUSTOM_REPLYTO_ADDRESS_TRUE = "true"; /** * Default blocking timeout value. */ public static final int DEFAULT_TIMEOUT_MILLISECONDS = 30 * 1000; /** * @serial parent */ private Options parent; /** * @serial properties */ private Map properties; // ========================================================================== // Parameters that can be set via Options // ========================================================================== private String soapVersionURI; // defaults to // SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; private Boolean isExceptionToBeThrownOnSOAPFault; // defaults to true; private long timeOutInMilliSeconds = -1; // = // DEFAULT_TIMEOUT_MILLISECONDS; private Boolean useSeparateListener; // defaults to false // Addressing specific properties private String action; private EndpointReference faultTo; private EndpointReference from; private TransportListener listener; private TransportInDescription transportIn; private String transportInProtocol; private String messageId; // Array of RelatesTo objects private List relationships; private EndpointReference replyTo; private ArrayList referenceParameters; /** * This is used for sending and receiving messages. */ protected TransportOutDescription transportOut; private EndpointReference to; //To control , session management , default is set to true , if user wants he can set that to true // The operation client will manage session using ServiceGroupID if it is there in the response private boolean manageSession = false; //---------------------------------------------------------------- // MetaData for data to be restored in activate after readExternal //---------------------------------------------------------------- /** * Indicates whether this object has been reconstituted * and needs to have its object references reconciled */ private transient boolean needsToBeReconciled = false; /** * The TransportOutDescription metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaTransportOut = null; /** * The TransportInDescription metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaTransportIn = null; /** * The TransportListener metadata will be used during * activate to match up with an existing object, if possible */ private transient MetaDataEntry metaListener = null; //This property can be used to specify to call the auto transport clean up private transient boolean callTransportCleanup ; private transient String userName; private transient String password; //---------------------------------------------------------------- // end MetaData section //---------------------------------------------------------------- /** * Default constructor */ public Options() { } /** * In normal mode operation, this options will try to fulfil the request * from its values. If that is not possible, this options will request those * information from its parent. * * @param parent */ public Options(Options parent) { this.parent = parent; } /** * Get WS-Addressing Action / SOAP Action string. * * @return action */ public String getAction() { if (action == null && parent != null) { return parent.getAction(); } return action; } /** * Get WS-Addressing FaultTo endpoint reference. * * @return endpoint */ public EndpointReference getFaultTo() { if (faultTo == null && parent != null) { return parent.getFaultTo(); } return faultTo; } /** * Set WS-Addressing From endpoint reference. * * @return endpoint */ public EndpointReference getFrom() { if (from == null && parent != null) { return parent.getFrom(); } return from; } /** * Get listener used for incoming message. * * @return listener */ public TransportListener getListener() { checkActivateWarning("getListener"); if (listener == null && parent != null) { return parent.getListener(); } return listener; } /** * Get transport used for incoming message. * * @return transport information */ public TransportInDescription getTransportIn() { checkActivateWarning("getTransportIn"); if (transportIn == null && parent != null) { return parent.getTransportIn(); } return transportIn; } /** * Get transport protocol used for incoming message. * * @return name protocol name ("http", "tcp", etc.) */ public String getTransportInProtocol() { if (transportInProtocol == null && parent != null) { return parent.getTransportInProtocol(); } return transportInProtocol; } /** * Get WS-Addressing MessageId. * * @return uri string */ public String getMessageId() { if (messageId == null && parent != null) { return parent.getMessageId(); } return messageId; } /** * Get a copy of the general option properties. Because of the way options * are stored this does not include properties with specific get/set * methods, only the general properties identified by a text string. The * returned map merges properties inherited from parent options, if any, to * give a complete set of property definitions as seen by users of this * options instance. The returned copy is not "live", so changes you make to * the copy are not reflected in the actual option settings. However, you * can make the modified values take effect with a call to {@link * #setProperties(Map)}, * * @return copy of general properties */ public Map getProperties() { // make sure that the Options properties exists if (this.properties == null) { this.properties = new HashMap(); } if (parent == null) { return new HashMap(properties); } else { Map props = parent.getProperties(); props.putAll(properties); return props; } } /** * Get named property value. * * @param key * @return the value related to this key. null, if not found. */ public Object getProperty(String key) { Object myPropValue = null; if (this.properties != null) { myPropValue = properties.get(key); } if (myPropValue == null && parent != null) { return parent.getProperty(key); } return myPropValue; } /** * Get WS-Addressing RelatesTo item with a specified type. If there are * multiple RelatesTo items defined with the same type, the one returned * by this method is arbitrary - if you need to handle this case, you can * instead use the {@link #getRelationships()} to retrieve all the items * and check for multiple matches. * * @param type relationship type (URI) * @return item of specified type */ public RelatesTo getRelatesTo(String type) { if (relationships == null && parent != null) { return parent.getRelatesTo(type); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(type)) { return relatesTo; } } return null; } /** * Return a single instance of WS-Addressing RelatesTo that has a relationship * type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply". * If no such instance of RelatesTo can be found then return null. * * @return an instance of {@link RelatesTo} */ public RelatesTo getRelatesTo() { if (relationships == null && parent != null) { return parent.getRelatesTo(); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE) || relationshipType .equals(AddressingConstants.Submission.WSA_DEFAULT_RELATIONSHIP_TYPE)) { return relatesTo; } } return null; } /** * Get all WS-Addressing RelatesTo items. * * @return array of items */ public RelatesTo[] getRelationships() { if (relationships == null && parent != null) { return parent.getRelationships(); } if (relationships == null) { return null; } return (RelatesTo[]) relationships.toArray(new RelatesTo[relationships.size()]); } /** * Set WS-Addressing RelatesTo items. * * @param list */ public void setRelationships(RelatesTo[] list) { if(list == null){ relationships = null; } else{ ArrayList arraylist = new ArrayList(list.length); for(int i = 0 ; i < list.length ; i++){ arraylist.add(list[i]); } relationships = arraylist; } } /** * Get WS-Addressing ReplyTo endpoint reference. * * @return endpoint */ public EndpointReference getReplyTo() { if (replyTo == null && parent != null) { return parent.getReplyTo(); } return replyTo; } /** * Get outbound transport description. * * @return description */ public TransportOutDescription getTransportOut() { checkActivateWarning("getTransportOut"); if (transportOut == null && parent != null) { return parent.getTransportOut(); } return transportOut; } /** * Get SOAP version being used. * * @return version */ public String getSoapVersionURI() { if (soapVersionURI == null && parent != null) { return parent.getSoapVersionURI(); } return soapVersionURI == null ? SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : soapVersionURI; } /** * Gets the wait time after which a client times out in a blocking scenario. * The default is Options#DEFAULT_TIMEOUT_MILLISECONDS * * @return timeOutInMilliSeconds */ public long getTimeOutInMilliSeconds() { if (timeOutInMilliSeconds == -1 && parent != null) { return parent.getTimeOutInMilliSeconds(); } return timeOutInMilliSeconds == -1 ? DEFAULT_TIMEOUT_MILLISECONDS : timeOutInMilliSeconds; } /** * Get WS-Addressing To endpoint reference. * * @return endpoint */ public EndpointReference getTo() { if (to == null && parent != null) { return parent.getTo(); } return to; } /** * If there is a SOAP Fault in the body of the incoming SOAP Message, system * can be configured to throw an exception with the details extracted from * the information from the fault message. This boolean variable will enable * that facility. If this is false, the response message will just be * returned to the application, irrespective of whether it has a Fault or * not. * * @return true if exception to be thrown */ public boolean isExceptionToBeThrownOnSOAPFault() { if (isExceptionToBeThrownOnSOAPFault == null && parent != null) { isExceptionToBeThrownOnSOAPFault = parent.isExceptionToBeThrownOnSOAPFault; } return isExceptionToBeThrownOnSOAPFault == null || isExceptionToBeThrownOnSOAPFault.booleanValue(); } /** * Check whether the two SOAP Messages are be sent over same channel or over * separate channels. Only duplex transports such as http and tcp support a * false value. * * @return separate channel flag */ public boolean isUseSeparateListener() { if (useSeparateListener == null && parent != null) { useSeparateListener = new Boolean(parent.isUseSeparateListener()); } return useSeparateListener != null && useSeparateListener.booleanValue(); } /** * Get parent instance providing default property values. * * @return parent (null if none) */ public Options getParent() { return parent; } /** * Set parent instance providing default property values. * * @param parent (null if none) */ public void setParent(Options parent) { this.parent = parent; } /** * Set WS-Addressing Action / SOAP Action string. * * @param action */ public void setAction(String action) { this.action = action; } /** * If there is a SOAP Fault in the body of the incoming SOAP Message, system * can be configured to throw an exception with the details extracted from * the information from the fault message. This boolean variable will enable * that facility. If this is false, the response message will just be * returned to the application, irrespective of whether it has a Fault or * not. * * @param exceptionToBeThrownOnSOAPFault */ public void setExceptionToBeThrownOnSOAPFault( boolean exceptionToBeThrownOnSOAPFault) { isExceptionToBeThrownOnSOAPFault = Boolean .valueOf(exceptionToBeThrownOnSOAPFault); } /** * Set WS-Addressing FaultTo endpoint reference. * * @param faultTo endpoint */ public void setFaultTo(EndpointReference faultTo) { this.faultTo = faultTo; } /** * Set WS-Addressing From endpoint reference. * * @param from endpoint */ public void setFrom(EndpointReference from) { this.from = from; } /** * Set listener used for incoming message. * * @param listener */ public void setListener(TransportListener listener) { this.listener = listener; } /** * Set transport used for incoming message. * * @param transportIn */ public void setTransportIn(TransportInDescription transportIn) { this.transportIn = transportIn; } /** * Set transport protocol used for incoming message. * * @param transportInProtocol ("http", "tcp", etc.) */ public void setTransportInProtocol(String transportInProtocol) { this.transportInProtocol = transportInProtocol; } /** * Set WS-Addressing MessageId. * * @param messageId URI string */ public void setMessageId(String messageId) { this.messageId = messageId; } /** * Set the general property definitions. Due to the way properties are * stored, this will not effect the values of predefined properties with * specific get/set methods. * * @param properties */ public void setProperties(Map properties) { if (this.properties != properties) { if (DEBUG_ENABLED) { for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext();) { Entry entry = (Entry) iterator.next(); debugPropertySet((String) entry.getKey(), entry.getValue()); } } } this.properties = properties; } /** * General properties you need to pass in to the message context must be set * via this method. This method can only be used for properties which do not * have specific get/set methods. *

    * Here are some of the properties supported in Axis2. *

    *

    *

    Generic Constants

    *
      *

      *

      *

    • org.apache.axis2.Constants.Configuration.TRANSPORT_URL *

      Sometimes you want to send your SOAP message through a node, before it reaches to its destination. This means you want to give transport URL different from the URL of the ultimate destination. A typical example would be wanting to send this SOAP (or REST)message through a transparent proxy or through a message monitoring applet. How can that be done using the ServiceClient API?

      *
           * options.setTo("http://destination.org");
           * options.setProperty(MessageContextConstants.TRANSPORT_URL, "http://myProxy.org");
           * 

      This will send your SOAP message to "http://myProxy.org", but if WS-Addressing is enabled, wsa:To will contain "http://destination.org" as To address.

      *
    • *

      *
    • org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING *

      This will enable user to set the character set encoding scheme to be used when sending the message. Default is set to "UTF-8"

    • *

      *

      *
    • org.apache.axis2.Constants.Configuration.ENABLE_MTOM *

      This will enable/disable MTOM support for outgoing messages.

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *
    *

    *

    WS-Addressing Module Specific Constants

    *
      *

      *

      *
    • org.apache.axis2.addressing.AddressingConstants.WS_ADDRESSING_VERSION *

      This will enable to select one of the two WS-Addressing versions available, if WS-Addressing is engaged.

      *

      Possible values are:

      *
           * org.apache.axis2.addressing.AddressingConstants.Final.WSA_NAMESPACE
           * and
           * org.apache.axis2.addressing.AddressingConstants.Submission.WSA_NAMESPACE
      *
    • *

      *
    • org.apache.axis2.addressing.AddressingConstants.REPLACE_ADDRESSING_HEADERS *

      *

      AddressingOutHandler picks up the addressing information from the message context and set them to the outgoing message. But someone may have already put some addressing headers, before the AddressingOutHandler. This flag will notify the handler whether to override them or not.

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *

      *
    • org.apache.axis2.addressing.AddressingConstants.
      * DISABLE_ADDRESSING_FOR_OUT_MESSAGES
      *

      If WS-Addressing is engaged globally or some how in effect for this particular invocation, this will disable Axis2 from putting WS-Addressing headers in to the out going SOAP message. (Note that Axis2 will not put addressing headers to the outgoing message, irrespective of the above flag, if the incoming message did not contain addressing headers).

      *

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *
    *

    *

    HTTP Constants

    *
      *

      *
    • org.apache.axis2.transport.http.HTTPConstants.CHUNKED *

      This will enable/disable chunking support.

      *

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.NTLM_AUTHENTICATION *

      This enables the user to pass in NTLM authentication information, such as host, port, realm, username, password to be used with HTTP transport sender.

      *

      The value should always be an instance of:

      *
      org.apache.axis2.transport.http.HttpTransportProperties.
           * NTLMAuthentication
      *
    • *

      *

      *
    • org.apache.axis2.transport.http.HTTPConstants.PROXY *

      This enables the user to pass in proxy information, such as proxy host name, port, domain, username, password to be used with HTTP transport sender.

      *

      The value should always be an instance of:

      *
      org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties
      *
    • *

      The value should always be an instance of:

      *
      org.apache.axis2.transport.http.HttpTransportProperties.BasicAuthentication
      * *

      *
    • org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT *

      This enables the user to pass in socket timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.

      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT *

      *

      This enables the user to pass in connection timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.

      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.USER_AGENT *

      This enables the user to set the user agent header in the outgoing HTTP request. Default value is "Axis2"

      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST *

      If set this will GZip your request and send over to the destination. Before doing this, you must make sure that the receiving end supports GZip compressed streams.

      *

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP *

      Whether or not you send a gzip-ped request, you can choose to receive GZIP back from the server using this flag.

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *

      *

      *
    • org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING *

      This enables the user to set the cookie string header in the outgoing HTTP request.

      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION *

      This will set the HTTP protocol version to be used in sending the SOAP requests.

      *

      Possible values are :

      *
           * 

      * HTTP/1.1 - HTTPConstants.HEADER_PROTOCOL_11 * HTTP/1.0 - HTTPConstants.HEADER_PROTOCOL_10 *

      Default is to use HTTP/1.1.

    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS *

      You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with

      *
      org.apache.commons.httpclient.Header

      objects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message.

      *
    • *

      *

      *

    • org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT *

      You might want to use the same HTTPClient instance for multiple invocations. This flag will notify the engine to use the same HTTPClient between invocations.

      *
    • *

      *
    • org.apache.axis2.transport.http.HTTPConstants.CACHED_HTTP_CLIENT *

      If user had requested to re-use an HTTPClient using the above property, this property can be used to set a custom HTTPClient to be re-used.

      *
    • *
    *

    *

    *

    Constants to be used in a REST Invocation

    *
      *

      *
    • org.apache.axis2.transport.http.Constants.Configuration.ENABLE_REST *

      Enabling REST using the above flag will send your request as a REST invocation.

      *

      Possible values are:

      *
      "true"/"false" or Boolean.TRUE/Boolean.FALSE
      *
    • *

      *
    • org.apache.axis2.transport.http.Constants.Configuration.HTTP_METHOD *

      *

      This will help the user to pick the HTTP method to be used during a REST invocation.

      *

      Possible values are :

      *
           * org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET
           * and
           * org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST
           * 

      Default is to use POST method.

    • *

      *
    • org.apache.axis2.transport.http.Constants.Configuration.CONTENT_TYPE *

      This will help the user to pick the content type to be used during a REST
      *

      * invocation.

      *

      Possible values are :

      *
        *
      • application/xml -
        *
        HTTPConstants.MEDIA_TYPE_APPLICATION_XML
      • *
      • application/x-www-form-urlencoded -
        *
        HTTPConstants.MEDIA_TYPE_X_WWW_FORM
      • *
      • text/xml -
        *
        MEDIA_TYPE_TEXT_XML
      • *

        *

      • multipart/related -
        *
        MEDIA_TYPE_MULTIPART_RELATED
      • *
      *
    • *
    * * @param propertyKey * @param property */ public void setProperty(String propertyKey, Object property) { // make sure that the Options properties exists if (this.properties == null) { this.properties = new HashMap(); } properties.put(propertyKey, property); if (DEBUG_ENABLED) { debugPropertySet(propertyKey, property); } } /** * Add WS-Addressing RelatesTo item. * * @param relatesTo */ public void addRelatesTo(RelatesTo relatesTo) { if (relationships == null) { relationships = new ArrayList(5); } relationships.add(relatesTo); } /** * Set WS-Addressing ReplyTo endpoint. * * @param replyTo endpoint */ public void setReplyTo(EndpointReference replyTo) { this.replyTo = replyTo; } /** * Set transport used for outgoing message. * * @param transportOut */ public void setTransportOut(TransportOutDescription transportOut) { this.transportOut = transportOut; } /** * Set transport used for outgoing message. * * @param senderTransport transport name in Axis2 configuration * ("http", "tcp", etc.) * @param axisConfiguration * @throws AxisFault if the transport is not found */ public void setSenderTransport(String senderTransport, AxisConfiguration axisConfiguration) throws AxisFault { this.transportOut = axisConfiguration.getTransportOut(senderTransport); if (senderTransport == null) { throw new AxisFault(Messages.getMessage("unknownTransport", senderTransport)); } } /** * Set the SOAP version to be used. * * @param soapVersionURI * @see org.apache.axis2.namespace.Constants#URI_SOAP11_ENV * @see org.apache.axis2.namespace.Constants#URI_SOAP12_ENV */ public void setSoapVersionURI(String soapVersionURI) { this.soapVersionURI = soapVersionURI; } /** * This is used in blocking scenario. Client will time out after waiting * this amount of time. The default is 2000 and must be provided in * multiples of 100. * * @param timeOutInMilliSeconds */ public void setTimeOutInMilliSeconds(long timeOutInMilliSeconds) { this.timeOutInMilliSeconds = timeOutInMilliSeconds; } /** * Set WS-Addressing To endpoint. * * @param to endpoint */ public void setTo(EndpointReference to) { this.to = to; } /** * Sets transport information to the call. The scenarios supported are as * follows:
    *

    *

         *  [senderTransport, listenerTransport, useSeparateListener]
         *  http, http, true
         *  http, http, false
         *  http, smtp, true
         *  smtp, http, true
         *  smtp, smtp, true
         *  tcp,  tcp,  true
         *  tcp,  tcp,  false
         *  etc.
         * 
    *

    *

    * * @param senderTransport * @param listenerTransport * @param useSeparateListener * @throws AxisFault * @deprecated Use setTransportInProtocol(String) and * useSeparateListener(boolean) instead. You do not need to * setSenderTransportProtocol(String) as sender transport can be * inferred from the to EPR. But still you can * setTransportOut(TransportOutDescription). */ public void setTransportInfo(String senderTransport, String listenerTransport, boolean useSeparateListener) throws AxisFault { // here we check for a legal combination, for and example if the // sendertransport is http and listener // transport is smtp the invocation must using separate transport if (!useSeparateListener) { boolean isTransportsEqual = senderTransport .equals(listenerTransport); boolean isATwoWaytransport = Constants.TRANSPORT_HTTP .equals(senderTransport) || Constants.TRANSPORT_TCP.equals(senderTransport); if ((!isTransportsEqual || !isATwoWaytransport)) { throw new AxisFault(Messages .getMessage("useSeparateListenerLimited", senderTransport, listenerTransport)); } } else { setUseSeparateListener(useSeparateListener); } setTransportInProtocol(listenerTransport); } /** * Used to specify whether the two SOAP Messages are be sent over same * channel or over separate channels. The value of this variable depends on * the transport specified. For e.g., if the transports are different this * is true by default. HTTP transport supports both cases while SMTP * transport supports only two channel case. * * @param useSeparateListener */ public void setUseSeparateListener(boolean useSeparateListener) { this.useSeparateListener = Boolean.valueOf(useSeparateListener); } /** * Add WS-Addressing ReferenceParameter child element. Multiple child * may be used. * TODO Add get method, implement handling. * * @param referenceParameter * @deprecated */ public void addReferenceParameter(OMElement referenceParameter) { if (referenceParameters == null) { referenceParameters = new ArrayList(5); } referenceParameters.add(referenceParameter); } /** * Check if session management is enabled. * * @return true if enabled */ public boolean isManageSession() { return manageSession; } /** * Set session management enabled state. When session management is enabled, * the engine will automatically send session data (such as the service * group id, or HTTP cookies) as part of requests. * * @param manageSession true if enabling sessions */ public void setManageSession(boolean manageSession) { this.manageSession = manageSession; } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

    * NOTE: Transient fields and static fields are not saved. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); String logCorrelationIDString = getLogCorrelationIDString(); // write out contents of this object // NOTES: For each item, where appropriate, // write out the following information, IN ORDER: // the class name // the active or empty flag // the data length, if appropriate // the data //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeLong(timeOutInMilliSeconds); out.writeBoolean(manageSession); // the following objects could be null out.writeObject(isExceptionToBeThrownOnSOAPFault); out.writeObject(useSeparateListener); //--------------------------------------------------------- // various strings //--------------------------------------------------------- // String soapVersionURI out.writeObject(soapVersionURI); // String action out.writeObject(action); // String transportInProtocol out.writeObject(transportInProtocol); // String messageId out.writeObject(messageId); // String object id out.writeObject(logCorrelationIDString); //--------------------------------------------------------- // various objects //--------------------------------------------------------- // Write out the EndpointReference values out.writeObject(faultTo); out.writeObject(from); out.writeObject(replyTo); out.writeObject(to); // TransportListener listener metaListener = null; if (listener != null) { metaListener = new MetaDataEntry(listener.getClass().getName(), null); } out.writeObject(metaListener); // TransportInDescription transportIn metaTransportIn = null; if (transportIn != null) { metaTransportIn = new MetaDataEntry(null, transportIn.getName().toString()); } out.writeObject(metaTransportIn); // TransportOutDescription transportOut metaTransportOut = null; if (transportOut != null) { metaTransportOut = new MetaDataEntry(null, transportOut.getName().toString()); } out.writeObject(metaTransportOut); //--------------------------------------------------------- // collections and lists //--------------------------------------------------------- // List relationships, which is an array of RelatesTo objects out.writeList(relationships); // ArrayList referenceParameters out.writeList(referenceParameters); //--------------------------------------------------------- // properties //--------------------------------------------------------- // HashMap properties out.writeMap(properties); //--------------------------------------------------------- // "nested" //--------------------------------------------------------- out.writeUTF("parent"); out.writeObject(parent); } /** * Restore the contents of the MessageContext that was * previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- timeOutInMilliSeconds = in.readLong(); manageSession = in.readBoolean(); isExceptionToBeThrownOnSOAPFault = (Boolean) in.readObject(); useSeparateListener = (Boolean) in.readObject(); //--------------------------------------------------------- // various strings //--------------------------------------------------------- // String soapVersionURI soapVersionURI = (String) in.readObject(); // String action action = (String) in.readObject(); // String transportInProtocol transportInProtocol = (String) in.readObject(); // String messageId messageId = (String) in.readObject(); // String object id logCorrelationIDString = (String) in.readObject(); // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): reading the input stream for [" + logCorrelationIDString + "]"); } //--------------------------------------------------------- // various objects //--------------------------------------------------------- // EndpointReference faultTo faultTo = (EndpointReference) in.readObject(); // EndpointReference from from = (EndpointReference) in.readObject(); // EndpointReference replyTo replyTo = (EndpointReference) in.readObject(); // EndpointReference to to = (EndpointReference) in.readObject(); // TransportListener listener // is not usable until the meta data has been reconciled listener = null; metaListener = (MetaDataEntry) in.readObject(); // TransportInDescription transportIn // is not usable until the meta data has been reconciled transportIn = null; metaTransportIn = (MetaDataEntry) in.readObject(); // TransportOutDescription transportOut // is not usable until the meta data has been reconciled transportOut = null; metaTransportOut = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // collections and lists //--------------------------------------------------------- // List relationships, which is an array of RelatesTo objects relationships = in.readArrayList(); // ArrayList referenceParameters referenceParameters = in.readArrayList(); //--------------------------------------------------------- // properties //--------------------------------------------------------- // HashMap properties properties = in.readHashMap(); //--------------------------------------------------------- // "nested" //--------------------------------------------------------- // Options parent in.readUTF(); // read marker parent = (Options) in.readObject(); } /** * This method checks to see if additional work needs to be * done in order to complete the object reconstitution. * Some parts of the object restored from the readExternal() * cannot be completed until we have a configurationContext * from the active engine. The configurationContext is used * to help this object to plug back into the engine's * configuration and deployment objects. * * @param cc The configuration context object representing the active configuration */ public void activate(ConfigurationContext cc) { // see if there's any work to do if (!needsToBeReconciled) { // return quick return; } String logCorrelationIDString = getLogCorrelationIDString(); // use the supplied configuration context // get the axis configuration AxisConfiguration axisConfig = cc.getAxisConfiguration(); // We previously saved metaTransportIn; restore it if (metaTransportIn != null) { QName qin = metaTransportIn.getQName(); TransportInDescription tmpIn = null; try { tmpIn = axisConfig.getTransportIn(qin.getLocalPart()); } catch (Exception exin) { // if a fault is thrown, log it and continue log.trace(logCorrelationIDString + "activate(): exception caught when getting the TransportInDescription [" + qin.toString() + "] from the AxisConfiguration [" + exin.getClass().getName() + " : " + exin.getMessage() + "]"); } if (tmpIn != null) { transportIn = tmpIn; } else { log.trace(logCorrelationIDString + "activate(): No TransportInDescription found for [" + qin.toString() + "]"); transportIn = null; } } else { log.trace(logCorrelationIDString + "activate(): No TransportInDescription "); transportIn = null; } // We previously saved metaTransportOut; restore it if (metaTransportOut != null) { QName qout = metaTransportOut.getQName(); TransportOutDescription tmpOut = null; try { tmpOut = axisConfig.getTransportOut(qout.getLocalPart()); } catch (Exception exout) { // if a fault is thrown, log it and continue log.trace(logCorrelationIDString + "activate(): exception caught when getting the TransportOutDescription [" + qout.toString() + "] from the AxisConfiguration [" + exout.getClass().getName() + " : " + exout.getMessage() + "]"); } if (tmpOut != null) { transportOut = tmpOut; } else { log.trace(logCorrelationIDString + "activate(): No TransportOutDescription found for [" + qout.toString() + "]"); transportOut = null; } } else { log.trace(logCorrelationIDString + "activate(): No TransportOutDescription "); transportOut = null; } // We previously saved metaListener; restore it if (metaListener != null) { // see if we can find an existing object String listenerClass = metaListener.getClassName(); log.trace(logCorrelationIDString + "activate(): TransportListener found for [" + listenerClass + "] "); } else { listener = null; log.trace(logCorrelationIDString + "activate(): No TransportListener "); } //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; } /** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. *

    * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). *

    * * @param obj The object to compare with * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(Options obj) { // NOTE: the input object is expected to exist (ie, be non-null) if (this.timeOutInMilliSeconds != obj.getTimeOutInMilliSeconds()) { return false; } if (this.isExceptionToBeThrownOnSOAPFault.booleanValue() != obj.isExceptionToBeThrownOnSOAPFault()) { return false; } if (this.useSeparateListener.booleanValue() != obj.isUseSeparateListener()) { return false; } if (this.manageSession != obj.isManageSession()) { return false; } // -------------------------------------------------------------------- if ((this.soapVersionURI != null) && (obj.getSoapVersionURI() != null)) { if (!this.soapVersionURI.equals(obj.getSoapVersionURI())) { return false; } } else if ((this.soapVersionURI == null) && (obj.getSoapVersionURI() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.action != null) && (obj.getAction() != null)) { if (!this.action.equals(obj.getAction())) { return false; } } else if ((this.action == null) && (obj.getAction() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.transportInProtocol != null) && (obj.getTransportInProtocol() != null)) { if (!this.transportInProtocol.equals(obj.getTransportInProtocol())) { return false; } } else if ((this.transportInProtocol == null) && (obj.getTransportInProtocol() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.messageId != null) && (obj.getMessageId() != null)) { if (!this.messageId.equals(obj.getMessageId())) { return false; } } else if ((this.messageId == null) && (obj.getMessageId() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.faultTo != null) && (obj.getFaultTo() != null)) { if (!this.faultTo.isEquivalent(obj.getFaultTo())) { return false; } } else if ((this.faultTo == null) && (obj.getFaultTo() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.from != null) && (obj.getFrom() != null)) { if (!this.from.isEquivalent(obj.getFrom())) { return false; } } else if ((this.from == null) && (obj.getFrom() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.replyTo != null) && (obj.getReplyTo() != null)) { if (!this.replyTo.isEquivalent(obj.getReplyTo())) { return false; } } else if ((this.replyTo == null) && (obj.getReplyTo() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.to != null) && (obj.getTo() != null)) { if (!this.to.isEquivalent(obj.getTo())) { return false; } } else if ((this.to == null) && (obj.getTo() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- if ((this.properties != null) && (obj.getProperties() != null)) { if (!this.properties.equals(obj.getProperties())) { // This is a strict test. // Returns true if the given object is also a map // and the two maps represent the same mappings. return false; } } else if ((this.properties == null) && (obj.getProperties() == null)) { // continue } else { // mismatch return false; } // -------------------------------------------------------------------- // TODO: consider checking the following objects for equivalency // List relationships; // ArrayList referenceParameters; // TransportListener listener; // TransportInDescription transportIn; // TransportOutDescription transportOut; // TODO: consider checking the parent objects for equivalency return true; } /** * Get the ID associated with this object instance. * * @return A string that can be output to a log file as an identifier * for this object instance. It is suitable for matching related log * entries. */ public String getLogCorrelationIDString() { if (logCorrelationIDString == null) { logCorrelationIDString = myClassName + "@" + UUIDGenerator.getUUID(); } return logCorrelationIDString; } /** * Trace a warning message, if needed, indicating that this * object needs to be activated before accessing certain fields. * * @param methodname The method where the warning occurs */ private void checkActivateWarning(String methodname) { if (needsToBeReconciled) { log.warn(getLogCorrelationIDString() + ":" + methodname + "(): ****WARNING**** " + myClassName + ".activate(configurationContext) needs to be invoked."); } } public boolean isCallTransportCleanup() { return callTransportCleanup; } public void setCallTransportCleanup(boolean callTransportCleanup) { this.callTransportCleanup = callTransportCleanup; } public String getUserName() { if (userName == null && parent != null) { return parent.getUserName(); } return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { if (password == null && parent != null) { return parent.getPassword(); } return password; } public void setPassword(String password) { this.password = password; } /** * Debug for for property key and value. * @param key * @param value */ private void debugPropertySet(String key, Object value) { if (DEBUG_ENABLED) { String className = (value == null) ? "null" : value.getClass().getName(); String classloader = "null"; if(value != null) { ClassLoader cl = Utils.getObjectClassLoader(value); if(cl != null) { classloader = cl.toString(); } } String valueText = (value instanceof String) ? value.toString() : null; String identity = getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)); log.debug("=================="); log.debug(" Property set on object " + identity); log.debug(" Key =" + key); if (valueText != null) { log.debug(" Value =" + valueText); } log.debug(" Value Class = " + className); log.debug(" Value Classloader = " + classloader); if (DEBUG_CALLSTACK_ON_SET) { log.debug( "Call Stack = " + JavaUtils.callStackToString()); } log.debug("=================="); } } } ./src/org/apache/axis2/client/ServiceClient.java0000664000175000017500000010317211767656530020716 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.client; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.OutInAxisOperation; import org.apache.axis2.description.OutOnlyAxisOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.RobustOutOnlyAxisOperation; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.Counter; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.xml.namespace.QName; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; /** * Client access to a service. Each instance of this class is associated with a * particular {@link org.apache.axis2.description.AxisService}, and the methods * support operations using that service. {@link Options} instances are used to * configure various aspects of the service access. */ public class ServiceClient { protected static final Log log = LogFactory.getLog(ServiceClient.class); /** * Base name used for a service created without an existing configuration. */ public static final String ANON_SERVICE = "anonService"; /** Counter used to generate the anonymous service name. */ private static Counter anonServiceCounter = new Counter(); /** * Operation name used for an anonymous out-only operation (meaning we send * a message with no response allowed from the service, equivalent to a WSDL * In-Only operation). */ public static final QName ANON_OUT_ONLY_OP = new QName( "anonOutonlyOp"); /** * Operation name used for an anonymous robust-out-only operation * (meaning we send a message, with the only possible response a fault, * equivalent to a WSDL Robust-In-Only operation). */ public static final QName ANON_ROBUST_OUT_ONLY_OP = new QName( "anonRobustOp"); /** * Operation name used for an anonymous in-out operation (meaning we sent a * message and receive a response, equivalent to a WSDL In-Out operation). */ public static final QName ANON_OUT_IN_OP = new QName("anonOutInOp"); // the meta-data of the service that this client access private AxisService axisService; // the configuration in which my meta-data lives private AxisConfiguration axisConfig; // the configuration context in which I live private ConfigurationContext configContext; // service context for this specific service instance private ServiceContext serviceContext; // client options for this service interaction private Options options = new Options(); // options that must override those of the child operation client also private Options overrideOptions; // list of headers to be sent with the simple APIs private ArrayList headers; //whether we create configctx or not private boolean createConfigCtx; private int hashCode; /** * Create a service client configured to work with a specific AxisService. * If this service is already in the world that's handed in (in the form of * a ConfigurationContext) then I will happily work in it. If not I will * create a small little virtual world and live there. * * @param configContext The configuration context under which this service lives (may * be null, in which case a new local one will be created) * @param axisService The service for which this is the client (may be * null, in which case an anonymous service will be created) * @throws AxisFault if something goes wrong while creating a config context (if * needed) */ public ServiceClient(ConfigurationContext configContext, AxisService axisService) throws AxisFault { configureServiceClient(configContext, axisService); } private void configureServiceClient(ConfigurationContext configContext, AxisService axisService) throws AxisFault { if (configContext == null) { if (ListenerManager.defaultConfigurationContext == null) { configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(null, null); createConfigCtx = true; } else { configContext = ListenerManager.defaultConfigurationContext; } } this.configContext = configContext; hashCode = (int) anonServiceCounter.incrementAndGet(); // Initialize transports ListenerManager transportManager = configContext.getListenerManager(); if (transportManager == null) { transportManager = new ListenerManager(); transportManager.init(this.configContext); } // save the axisConfig and service axisConfig = configContext.getAxisConfiguration(); if (axisService == null) { axisService = createAnonymousService(); } this.axisService = axisService; if (axisConfig.getService(axisService.getName()) == null) { axisService.setClientSide(true); axisConfig.addService(axisService); } else { throw new AxisFault(Messages.getMessage( "twoservicecannothavesamename", axisService.getName())); } AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup(); ServiceGroupContext sgc = configContext.createServiceGroupContext(axisServiceGroup); serviceContext = sgc.getServiceContext(axisService); } /** * This is WSDL4J based constructor to configure the Service Client/ * TODO: make this policy aware * * @param configContext active ConfigurationContext * @param wsdl4jDefinition the WSDL we're going to be using to configure ourselves * @param wsdlServiceName QName of the WSDL service we'd like to access * @param portName name of the WSDL port we'd like to access * @throws AxisFault in case of error */ public ServiceClient(ConfigurationContext configContext, Definition wsdl4jDefinition, QName wsdlServiceName, String portName) throws AxisFault { configureServiceClient(configContext, AxisService.createClientSideAxisService( wsdl4jDefinition, wsdlServiceName, portName, options)); } /** * Create a service client for WSDL service identified by the QName of the * wsdl:service element in a WSDL document. * * @param configContext The configuration context under which this service lives (may * be null, in which case a new local one will be created) * * @param wsdlURL The URL of the WSDL document to read * @param wsdlServiceName The QName of the WSDL service in the WSDL document to create a * client for * @param portName The name of the WSDL 1.1 port to create a client for. May be * null (if WSDL 2.0 is used or if only one port is there). . * @throws AxisFault if something goes wrong while creating a config context (if * needed) */ public ServiceClient(ConfigurationContext configContext, URL wsdlURL, QName wsdlServiceName, String portName) throws AxisFault { configureServiceClient(configContext, AxisService.createClientSideAxisService(wsdlURL, wsdlServiceName, portName, options)); Parameter transportName = axisService.getParameter("TRANSPORT_NAME"); if(transportName != null ) { TransportOutDescription transportOut = configContext.getAxisConfiguration().getTransportOut( transportName.getValue().toString()); if (transportOut == null) { throw new AxisFault("Cannot load transport from binding, either defin in Axis2.config " + "or set it explicitely in ServiceClinet.Options"); } else { options.setTransportOut(transportOut); } } } /** * Create a service client by assuming an anonymous service and any other * necessary information. * * @throws AxisFault in case of error */ public ServiceClient() throws AxisFault { this(null, null); } /** * Create an anonymous axisService with one (anonymous) operation for each * MEP that we support dealing with anonymously using the convenience APIs. * * @return the minted anonymous service */ private AxisService createAnonymousService() { // now add anonymous operations to the axis2 service for use with the // shortcut client API. NOTE: We only add the ones we know we'll use // later in the convenience API; if you use // this constructor then you can't expect any magic! AxisService axisService = new AxisService(ANON_SERVICE + anonServiceCounter.incrementAndGet()); RobustOutOnlyAxisOperation robustoutoonlyOperation = new RobustOutOnlyAxisOperation( ANON_ROBUST_OUT_ONLY_OP); axisService.addOperation(robustoutoonlyOperation); OutOnlyAxisOperation outOnlyOperation = new OutOnlyAxisOperation( ANON_OUT_ONLY_OP); axisService.addOperation(outOnlyOperation); OutInAxisOperation outInOperation = new OutInAxisOperation( ANON_OUT_IN_OP); axisService.addOperation(outInOperation); return axisService; } /** * Returns the AxisConfiguration associated with the client. */ public AxisConfiguration getAxisConfiguration() { synchronized(this.axisConfig) { return axisConfig; } } /** * Return the AxisService this is a client for. This is primarily useful * when the AxisService is created anonymously or from WSDL as otherwise the * user had the AxisService to start with. * * @return the axisService */ public AxisService getAxisService() { return axisService; } /** * Set the basic client configuration related to this service interaction. * * @param options (non-null) */ public void setOptions(Options options) { this.options = options; } /** * Get the basic client configuration from this service interaction. * * @return options */ public Options getOptions() { return options; } /** * Set a client configuration to override the normal options used by an * operation client. Any values set in this configuration will be used for * each client, with the standard values for the client still used for any * values not set in the override configuration. * * @param overrideOptions the Options to use */ public void setOverrideOptions(Options overrideOptions) { this.overrideOptions = overrideOptions; } /** * Get the client configuration used to override the normal options set by * an operation client. * * @return override options */ public Options getOverrideOptions() { return overrideOptions; } /** * Engage a module for this service client. * * @deprecated Please use String version instead * @param moduleName name of the module to engage * @throws AxisFault if something goes wrong */ public void engageModule(QName moduleName) throws AxisFault { engageModule(moduleName.getLocalPart()); } /** * Engage a module for this service client. * * @param moduleName name of the module to engage * @throws AxisFault if something goes wrong */ public void engageModule(String moduleName) throws AxisFault { synchronized (this.axisConfig) { AxisModule module = axisConfig.getModule(moduleName); if (module != null) { axisService.engageModule(module); } else { throw new AxisFault("Unable to engage module : " + moduleName); } } } /** * Disengage a module for this service client * * @deprecated Please use String version instead * @param moduleName name of Module to disengage */ public void disengageModule(QName moduleName) { disengageModule(moduleName.getLocalPart()); } /** * Disengage a module for this service client * * @param moduleName name of Module to disengage */ public void disengageModule(String moduleName) { synchronized (this.axisConfig) { AxisModule module = axisConfig.getModule(moduleName); if (module != null) { try { axisService.disengageModule(module); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } } } } /** * Add an arbitrary XML element as a header to be sent with outgoing * messages. * * @param header header to be sent (non-null) */ public void addHeader(OMElement header) { if (headers == null) { headers = new ArrayList(); } headers.add(header); } /** * Add SOAP Header to be sent with outgoing messages. * * @param header header to be sent (non-null) */ public void addHeader(SOAPHeaderBlock header) { if (headers == null) { headers = new ArrayList(); } headers.add(header); } /** * Remove all headers for outgoing message. */ public void removeHeaders() { if (headers != null) { headers.clear(); } } /** * Add a simple header containing some text to be sent with interactions. * * @param headerName name of header to add * @param headerText text content for header * @throws AxisFault in case of error */ public void addStringHeader(QName headerName, String headerText) throws AxisFault { if (headerName.getNamespaceURI() == null || "".equals(headerName.getNamespaceURI())) { throw new AxisFault( "Failed to add string header, you have to have namespaceURI for the QName"); } OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(headerName, null); omElement.setText(headerText); addHeader(omElement); } /** * Directly invoke an anonymous operation with a Robust In-Only MEP. This * method just sends your supplied XML and possibly receives a fault. For * more control, you can instead create a client for the operation and use * that client to execute the send. * * @param elem XML to send * @throws AxisFault if something goes wrong while sending, or if a fault is * received in response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(OMElement elem) throws AxisFault { sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem); } /** * Directly invoke a named operation with a Robust In-Only MEP. This method * just sends your supplied XML and possibly receives a fault. For more * control, you can instead create a client for the operation and use that * client to execute the send. * * @param operation name of operation to be invoked (non-null) * @param elem XML to send * @throws AxisFault if something goes wrong while sending it or if a fault is * received in response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(QName operation, OMElement elem) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); mepClient.addMessageContext(mc); mepClient.execute(true); } /** * Directly invoke an anonymous operation with an In-Only MEP. This method * just sends your supplied XML without the possibility of any response from * the service (even an error - though you can still get client-side errors * such as "Host not found"). For more control, you can instead create a * client for the operation and use that client to execute the send. * * @param elem XML to send * @throws AxisFault ff something goes wrong trying to send the XML * @see #createClient(QName) */ public void fireAndForget(OMElement elem) throws AxisFault { fireAndForget(ANON_OUT_ONLY_OP, elem); } /** * Directly invoke a named operation with an In-Only MEP. This method just * sends your supplied XML without the possibility of any response from the * service (even an error - though you can still get client-side errors such * as "Host not found"). For more control, you can instead create a client * for the operation and use that client to execute the send. * * @param operation name of operation to be invoked (non-null) * @param elem XML to send * @throws AxisFault if something goes wrong trying to send the XML * @see #createClient(QName) */ public void fireAndForget(QName operation, OMElement elem) throws AxisFault { // look up the appropriate axisop and create the client OperationClient mepClient = createClient(operation); // create a message context and put the payload in there along with any // headers MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); // add the message context there and have it go mepClient.addMessageContext(mc); mepClient.execute(false); } /** * Directly invoke an anonymous operation with an In-Out MEP. This method * sends your supplied XML and receives a response. For more control, you * can instead create a client for the operation and use that client to * execute the exchange. * * @param elem the data to send (becomes the content of SOAP body) * @return response * @throws AxisFault in case of error * @see #createClient(QName) */ public OMElement sendReceive(OMElement elem) throws AxisFault { return sendReceive(ANON_OUT_IN_OP, elem); } /** * Directly invoke a named operationQName with an In-Out MEP. This method sends * your supplied XML and receives a response. For more control, you can * instead create a client for the operationQName and use that client to execute * the exchange. * * @param operationQName name of operationQName to be invoked (non-null) * @param xmlPayload the data to send (becomes the content of SOAP body) * @return response OMElement * @throws AxisFault in case of error */ public OMElement sendReceive(QName operationQName, OMElement xmlPayload) throws AxisFault { MessageContext messageContext = new MessageContext(); fillSOAPEnvelope(messageContext, xmlPayload); OperationClient operationClient = createClient(operationQName); operationClient.addMessageContext(messageContext); operationClient.execute(true); MessageContext response = operationClient .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if(options.isCallTransportCleanup()){ response.getEnvelope().build(); cleanupTransport(); } return response.getEnvelope().getBody().getFirstElement(); } /** * Directly invoke an anonymous operation with an In-Out MEP without waiting * for a response. This method sends your supplied XML with response * notification to your callback handler. For more control, you can instead * create a client for the operation and use that client to execute the * exchange. * * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated */ public void sendReceiveNonBlocking(OMElement elem, Callback callback) throws AxisFault { sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback); } /** * Directly invoke an anonymous operation with an In-Out MEP without waiting * for a response. This method sends your supplied XML with response * notification to your callback handler. For more control, you can instead * create a client for the operation and use that client to execute the * exchange. * * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) */ public void sendReceiveNonBlocking(OMElement elem, AxisCallback callback) throws AxisFault { sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback); } /** * Directly invoke a named operation with an In-Out MEP without waiting for * a response. This method sends your supplied XML with response * notification to your callback handler. For more control, you can instead * create a client for the operation and use that client to execute the * exchange. * * @param operation name of operation to be invoked (non-null) * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated */ public void sendReceiveNonBlocking(QName operation, OMElement elem, Callback callback) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); // here a blocking invocation happens in a new thread, so the // progamming model is non blocking mepClient.setCallback(callback); mepClient.addMessageContext(mc); mepClient.execute(false); } /** * Directly invoke a named operation with an In-Out MEP without waiting for * a response. This method sends your supplied XML with response * notification to your callback handler. For more control, you can instead * create a client for the operation and use that client to execute the * exchange. * * @param operation name of operation to be invoked (non-null) * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) */ public void sendReceiveNonBlocking(QName operation, OMElement elem, AxisCallback callback) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); // here a blocking invocation happens in a new thread, so the // progamming model is non blocking mepClient.setCallback(callback); mepClient.addMessageContext(mc); mepClient.execute(false); } /** * Create an operation client with the appropriate message exchange pattern * (MEP). This method creates a full-function MEP client which can be used * to exchange messages for a specific operation. It configures the * constructed operation client to use the current normal and override * options. This method is used internally, and also by generated client * stub code. * * @param operationQName qualified name of operation (local name is operation * name, namespace URI is just the empty string) * @return client configured to talk to the given operation * @throws AxisFault if the operation is not found */ public OperationClient createClient(QName operationQName) throws AxisFault { AxisOperation axisOperation = axisService.getOperation(operationQName); if (axisOperation == null) { throw new AxisFault(Messages .getMessage("operationnotfound", operationQName.getLocalPart())); } // add the option properties to the service context String key; for (Iterator iter = options.getProperties().keySet().iterator();iter.hasNext();){ key = (String) iter.next(); serviceContext.setProperty(key, options.getProperties().get(key)); } OperationClient operationClient = axisOperation.createClient(serviceContext, options); // if overide options have been set, that means we need to make sure // those options override the options of even the operation client. So, // what we do is switch the parents around to make that work. if (overrideOptions != null) { overrideOptions.setParent(operationClient.getOptions()); operationClient.setOptions(overrideOptions); } return operationClient; } /** * Return the SOAP factory to use depending on what options have been set. * If the SOAP version can not be seen in the options, version 1.1 is the * default. * * @return the SOAP factory * @see Options#setSoapVersionURI(String) */ private SOAPFactory getSOAPFactory() { String soapVersionURI = options.getSoapVersionURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) { return OMAbstractFactory.getSOAP12Factory(); } else { // make the SOAP 1.1 the default SOAP version return OMAbstractFactory.getSOAP11Factory(); } } /** * Prepare a SOAP envelope with the stuff to be sent. * * @param messageContext the message context to be filled * @param xmlPayload the payload content * @throws AxisFault if something goes wrong */ private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload) throws AxisFault { messageContext.setServiceContext(serviceContext); SOAPFactory soapFactory = getSOAPFactory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); } /** * Add all configured headers to a SOAP envelope. * * @param envelope the SOAPEnvelope in which to write the headers */ public void addHeadersToEnvelope(SOAPEnvelope envelope) { if (headers != null) { SOAPHeader soapHeader = envelope.getHeader(); for (int i = 0; i < headers.size(); i++) { soapHeader.addChild((OMElement) headers.get(i)); } } } /** * Get the endpoint reference for this client using a particular transport. * * @param transport transport name (non-null) * @return local endpoint * @throws AxisFault in case of error */ public EndpointReference getMyEPR(String transport) throws AxisFault { return serviceContext.getMyEPR(transport); } /** * Get the endpoint reference for the service. * * @return service endpoint */ public EndpointReference getTargetEPR() { return serviceContext.getTargetEPR(); } /** * Set the endpoint reference for the service. * * @param targetEpr the EPR this ServiceClient should target */ public void setTargetEPR(EndpointReference targetEpr) { serviceContext.setTargetEPR(targetEpr); options.setTo(targetEpr); } /** * Gets the last OperationContext * * @return the last OperationContext that was invoked by this ServiceClient */ public OperationContext getLastOperationContext() { return serviceContext.getLastOperationContext(); } /** * Sets whether or not to cache the last OperationContext * @deprecated * @param cachingOpContext true if we should hold onto the last active OperationContext */ public void setCachingOperationContext(boolean cachingOpContext) { serviceContext.setCachingOperationContext(cachingOpContext); } /** * Get the service context. * * @return context */ public ServiceContext getServiceContext() { return serviceContext; } protected void finalize() throws Throwable { super.finalize(); cleanup(); } /** * Clean up configuration created with this client. Call this method when * you're done using the client, in order to discard any associated * resources. * * @throws AxisFault in case of error */ public void cleanup() throws AxisFault { // if a configuration context was created for this client there'll also // be a service group, so discard that if (!createConfigCtx) { String serviceGroupName = axisService.getAxisServiceGroup().getServiceGroupName(); AxisConfiguration axisConfiguration = configContext.getAxisConfiguration(); AxisServiceGroup asg = axisConfiguration.getServiceGroup(serviceGroupName); if (asg != null) { axisConfiguration.removeServiceGroup(serviceGroupName); } } else { configContext.terminate(); } } public void cleanupTransport() throws AxisFault{ if(getLastOperationContext()!=null){ MessageContext outMessageContext = getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outMessageContext!=null) { outMessageContext.getTransportOut().getSender().cleanup(outMessageContext); } } } /** * Configure the ServiceClient to interact with the Web service described by * the specified AxisService object. * * @param axisService the AxisService that represents the new Web service. * @throws AxisFault if an error occurs while configuring the ServiceClient. */ public void setAxisService(AxisService axisService) throws AxisFault { if (axisService == null) { // AxisFault? throw new IllegalArgumentException("AxisService is null"); } synchronized(this.axisConfig) { axisConfig.removeService(this.axisService.getName()); this.axisService = axisService; axisService.setClientSide(true); axisConfig.addService(axisService); } AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup(); ServiceGroupContext serviceGroupContext = configContext.createServiceGroupContext(axisServiceGroup); this.serviceContext = serviceGroupContext.getServiceContext(axisService); } /** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.hashCode; } /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof ServiceClient)) return false; final ServiceClient other = (ServiceClient) obj; if (hashCode != other.hashCode) return false; return true; } } ./src/org/apache/axis2/context/0000775000175000017500000000000011767656530015516 5ustar brianbrian./src/org/apache/axis2/context/ConfigurationContextFactory.java0000664000175000017500000003260711767656530024075 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.deployment.AxisConfigBuilder; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.deployment.DeploymentEngine; import org.apache.axis2.deployment.FileSystemConfigurator; import org.apache.axis2.deployment.URLBasedAxisConfigurator; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisConfigurator; import org.apache.axis2.engine.DependencyManager; import org.apache.axis2.i18n.Messages; import org.apache.axis2.modules.Module; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.util.Loader; import org.apache.axis2.util.SessionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.InputStream; import java.net.URL; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class ConfigurationContextFactory { protected static final Log log = LogFactory.getLog(ConfigurationContextFactory.class); /** * Creates a AxisConfiguration depending on the user requirement. * First creates an AxisConfigurator object with appropriate parameters. * Depending on the implementation getAxisConfiguration(), gets * the AxisConfiguration and uses it to create the ConfigurationContext. * * @param axisConfigurator : AxisConfigurator * @return Returns ConfigurationContext. * @throws AxisFault : If somthing goes wrong */ public static ConfigurationContext createConfigurationContext( AxisConfigurator axisConfigurator) throws AxisFault { AxisConfiguration axisConfig = axisConfigurator.getAxisConfiguration(); ConfigurationContext configContext = new ConfigurationContext(axisConfig); if (axisConfig.getClusterManager() != null) { configContext.initCluster(); } if (axisConfigurator instanceof DeploymentEngine) { ((DeploymentEngine) axisConfigurator).setConfigContext(configContext); } //To override context path setContextPaths(axisConfig, configContext); init(configContext); axisConfigurator.engageGlobalModules(); axisConfigurator.loadServices(); addModuleService(configContext); // TODO: THIS NEEDS A TEST CASE! initApplicationScopeServices(configContext); axisConfig.setStart(true); return configContext; } private static void initApplicationScopeServices(ConfigurationContext configCtx) throws AxisFault { Iterator serviceGroups = configCtx.getAxisConfiguration().getServiceGroups(); while (serviceGroups.hasNext()) { AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups.next(); String maxScope = SessionUtils.calculateMaxScopeForServiceGroup(axisServiceGroup); if (Constants.SCOPE_APPLICATION.equals(maxScope)) { ServiceGroupContext serviceGroupContext = configCtx.createServiceGroupContext(axisServiceGroup); configCtx.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext); DependencyManager.initService(serviceGroupContext); } } } private static void addModuleService(ConfigurationContext configCtx) throws AxisFault { AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); HashMap modules = axisConfig.getModules(); if (modules != null && modules.size() > 0) { Iterator mpduleItr = modules.values().iterator(); while (mpduleItr.hasNext()) { AxisModule axisModule = (AxisModule) mpduleItr.next(); Utils.deployModuleServices(axisModule, configCtx); } } } private static void setContextPaths(AxisConfiguration axisConfig, ConfigurationContext configContext) { // Checking for context path Parameter servicePath = axisConfig.getParameter(Constants.PARAM_SERVICE_PATH); if (servicePath != null) { String spath = ((String) servicePath.getValue()).trim(); if (spath.length() > 0) { configContext.setServicePath(spath); } } else { configContext.setServicePath(Constants.DEFAULT_SERVICES_PATH); } Parameter contextPath = axisConfig.getParameter(Constants.PARAM_CONTEXT_ROOT); if (contextPath != null) { String cpath = ((String) contextPath.getValue()).trim(); if (cpath.length() > 0) { configContext.setContextRoot(cpath); } } else { configContext.setContextRoot("axis2"); } } /** * To get a ConfigurationContext for given data , and underline implementation * is Axis2 default impl which is file system based deployment model to create * an AxisConfiguration. *

    * Here either or both parameter can be null. So that boil down to following * scenarios and it should note that parameter value should be full path , * you are not allowed to give one relative to other. And these two can be located * in completely different locations. *

      *
    • If none of them are null , then AxisConfiguration will be based on the * value of axis2xml , and the repository will be the value specified by the * path parameter and there will not be any assumptions.
    • *
    • If axis2xml is null , then the repository will be the value specfied by * path parameter and AxisConfiguration will be created using default_axis2.xml
    • *
    • If path parameter is null , then AxisConfiguration will be created using * that axis2.xml. And after creating AxisConfiguration system will try to * find user has specified repository parameter in axis2.xml * (<parameter name="repository">location of the repo</parameter>) , if it * find that then repository will be the value specified by that parameter.
    • *
    • If both are null , then it is simple , AixsConfiguration will be created * using default_axis2.xml and thats it.
    • *
    *

    * Note : rather than passing any parameters you can give them as System * properties. Simple you can add following system properties before * you call this. *

      *
    • axis2.repo : same as path parameter
    • *
    • axis2.xml : same as axis2xml
    • *
    * * @param path : location of the repository * @param axis2xml : location of the axis2.xml (configuration) , you can not give * axis2xml relative to repository. * @return Returns the built ConfigurationContext. * @throws AxisFault in case of problems */ public static ConfigurationContext createConfigurationContextFromFileSystem( String path, String axis2xml) throws AxisFault { return createConfigurationContext(new FileSystemConfigurator(path, axis2xml)); } public static ConfigurationContext createConfigurationContextFromFileSystem(String path) throws AxisFault { return createConfigurationContextFromFileSystem(path, null); } public static ConfigurationContext createConfigurationContextFromURIs( URL axis2xml, URL repositoy) throws AxisFault { return createConfigurationContext(new URLBasedAxisConfigurator(axis2xml, repositoy)); } /** * Initializes modules and creates Transports. * * @param configContext ConfigurationContext */ private static void init(ConfigurationContext configContext) { initModules(configContext); initTransportSenders(configContext); } /** * Initializes the modules. If the module needs to perform some recovery process * it can do so in init and this is different from module.engage(). * * @param context : ConfigurationContext */ private static void initModules(ConfigurationContext context) { AxisConfiguration configuration = context.getAxisConfiguration(); HashMap modules = configuration.getModules(); Collection col = modules.values(); Map faultyModule = new HashMap(); for (Iterator iterator = col.iterator(); iterator.hasNext();) { AxisModule axismodule = (AxisModule) iterator.next(); Module module = axismodule.getModule(); if (module != null) { try { module.init(context, axismodule); } catch (AxisFault axisFault) { log.info(axisFault.getMessage()); faultyModule.put(axismodule, axisFault); } } } //Checking whether we have found any faulty services during the module initilization , // if so we need to mark them as fautyModule and need to remove from the modules list if (faultyModule.size() > 0) { Iterator axisModules = faultyModule.keySet().iterator(); while (axisModules.hasNext()) { AxisModule axisModule = (AxisModule) axisModules.next(); String fileName; if (axisModule.getFileName() != null) { fileName = axisModule.getFileName().toString(); } else { fileName = axisModule.getName(); } configuration.getFaultyModules().put(fileName, faultyModule.get(axisModule)); //removing from original list configuration.removeModule(axisModule.getName(), axisModule.getName()); } } } /** * Initializes TransportSenders and TransportListeners with appropriate configuration information * * @param configContext : ConfigurationContext */ private static void initTransportSenders(ConfigurationContext configContext) { AxisConfiguration axisConf = configContext.getAxisConfiguration(); // Initialize Transport Outs HashMap transportOuts = axisConf.getTransportsOut(); Iterator values = transportOuts.values().iterator(); while (values.hasNext()) { TransportOutDescription transportOut = (TransportOutDescription) values.next(); TransportSender sender = transportOut.getSender(); if (sender != null) { try { sender.init(configContext, transportOut); } catch (AxisFault axisFault) { log.info(Messages.getMessage("transportiniterror", transportOut.getName())); } } } } /** * creates an empty configuration context. * * @return Returns ConfigurationContext. */ public static ConfigurationContext createEmptyConfigurationContext() throws AxisFault { AxisConfiguration axisConfiguration = new AxisConfiguration(); ConfigurationContext configContext = new ConfigurationContext(axisConfiguration); if (axisConfiguration.getClusterManager() != null) { configContext.initCluster(); } setContextPaths(axisConfiguration, configContext); return configContext; } /** * Gets the default configuration context by using Axis2.xml in the classpath * * @return Returns ConfigurationContext. */ public static ConfigurationContext createDefaultConfigurationContext() throws Exception { return createBasicConfigurationContext(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE); } /** * Creates configuration context using resource file found in the classpath. * * @return Returns ConfigurationContext. */ public static ConfigurationContext createBasicConfigurationContext(String resourceName) throws Exception { InputStream in = Loader.getResourceAsStream(resourceName); AxisConfiguration axisConfig = new AxisConfiguration(); AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig, null); builder.populateConfig(); axisConfig.validateSystemPredefinedPhases(); ConfigurationContext configContext = new ConfigurationContext(axisConfig); if (axisConfig.getClusterManager() != null) { configContext.initCluster(); } setContextPaths(axisConfig, configContext); return configContext; } } ./src/org/apache/axis2/context/ServiceContext.java0000664000175000017500000005763411767656530021345 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.externalize.ActivateUtils; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.MetaDataEntry; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Map; /** * Well this is never clearly defined, what it does or the life-cycle. * So do NOT use this as it might not live up to your expectation. */ public class ServiceContext extends AbstractContext implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(ServiceContext.class); private static final String myClassName = "ServiceContext"; /** * An ID which can be used to correlate operations on an instance of * this object in the log files */ private String logCorrelationIDString = null; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = 8265625275015738957L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; public static final String SERVICE_OBJECT = "serviceObject"; private EndpointReference targetEPR; private EndpointReference myEPR; private transient AxisService axisService; // the service group context is the same as the parent private transient ServiceGroupContext serviceGroupContext; private transient ConfigurationContext configContext; /** * Should we cache the last OperationContext? */ private boolean cachingOperationContext; /** * A cache for the last OperationContext */ private transient OperationContext lastOperationContext; //---------------------------------------------------------------- // MetaData for data to be restored in activate after readExternal //---------------------------------------------------------------- /** * Indicates whether the message context has been reconstituted * and needs to have its object references reconciled */ private transient boolean needsToBeReconciled = false; /** * The AxisService metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisService = null; /** * The ServiceGroupContext object will be used during * activate to finish its restoration */ private transient ServiceGroupContext metaParent = null; //---------------------------------------------------------------- // end MetaData section //---------------------------------------------------------------- /** * Public constructor (only here because this class is Externalizable) */ public ServiceContext() { } /** * Constructor (package access, should only be used by ServiceGroupContext) * * @param axisService the AxisService for which to create a context * @param serviceGroupContext the parent ServiceGroupContext */ ServiceContext(AxisService axisService, ServiceGroupContext serviceGroupContext) { super(serviceGroupContext); this.serviceGroupContext = serviceGroupContext; this.axisService = axisService; this.configContext = (ConfigurationContext) parent.getParent(); } public OperationContext createOperationContext(QName name) { AxisOperation axisOp = axisService.getOperation(name); return createOperationContext(axisOp); } public OperationContext createOperationContext(AxisOperation axisOp) { OperationContext ctx = new OperationContext(axisOp, this); configContext.contextCreated(ctx); return ctx; } public AxisService getAxisService() { checkActivateWarning("getAxisService"); return axisService; } public ConfigurationContext getConfigurationContext() { checkActivateWarning("getConfigurationContext"); return configContext; } public ServiceGroupContext getServiceGroupContext() { checkActivateWarning("getServiceGroupContext"); return serviceGroupContext; } /** * To get the ERP for a given service , if the transport is present and not * running then it will add as a listener to ListenerManager , there it will * init that and start the listener , and finally ask the EPR from transport * for a given service * * @param transport : Name of the transport * @return * @throws AxisFault */ public EndpointReference getMyEPR(String transport) throws AxisFault { axisService.isEnableAllTransports(); ConfigurationContext configctx = this.configContext; if (configctx != null) { ListenerManager lm = configctx.getListenerManager(); if (!lm.isListenerRunning(transport)) { TransportInDescription trsin = configctx.getAxisConfiguration().getTransportIn(transport); if (trsin != null) { lm.addListener(trsin, false); } else { throw new AxisFault(Messages.getMessage("transportnotfound", transport)); } } if (!lm.isStopped()) { return lm.getEPRforService(axisService.getName(), null, transport); } } return null; } public EndpointReference getTargetEPR() { return targetEPR; } public void setTargetEPR(EndpointReference targetEPR) { this.targetEPR = targetEPR; } public EndpointReference getMyEPR() { if (myEPR == null) { try { if (ListenerManager.defaultConfigurationContext != null) { ListenerManager listenerManager = ListenerManager.defaultConfigurationContext.getListenerManager(); myEPR = listenerManager.getEPRforService(axisService.getName(), null, null); } } catch (AxisFault axisFault) { // what else I can do myEPR = null; } } return myEPR; } public void setMyEPR(EndpointReference myEPR) { this.myEPR = myEPR; } public OperationContext getLastOperationContext() { return lastOperationContext; } public void setLastOperationContext(OperationContext lastOperationContext) { this.lastOperationContext = lastOperationContext; } public boolean isCachingOperationContext() { return cachingOperationContext; } public void setCachingOperationContext(boolean cacheLastOperationContext) { this.cachingOperationContext = cacheLastOperationContext; } /** * Returns a name associated with this ServiceContext. *

    * Note: this name is from the corresponding * AxisService object. * * @return The name string, or null if no name can be found */ public String getName() { if (axisService != null) { return axisService.getName(); } if (metaAxisService != null) { return metaAxisService.getName(); } return null; } /** * Returns a name associated with the ServiceGroupContext * associated with this ServiceContext. * * @return The name string, or null if no name can be found */ public String getGroupName() { if (serviceGroupContext != null) { return serviceGroupContext.getId(); } if (metaParent != null) { return metaParent.getId(); } return null; } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

    * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeLong(getLastTouchedTime()); out.writeBoolean(cachingOperationContext); out.writeObject(getLogCorrelationIDString()); // EndpointReference targetEPR out.writeObject(targetEPR); // EndpointReference myEPR out.writeObject(myEPR); //--------------------------------------------------------- // properties //--------------------------------------------------------- out.writeMap(getProperties()); //--------------------------------------------------------- // AxisService //--------------------------------------------------------- metaAxisService = null; if (axisService != null) { metaAxisService = new MetaDataEntry(axisService.getClass().getName(), axisService.getName()); } out.writeObject(metaAxisService); //--------------------------------------------------------- // parent //--------------------------------------------------------- out.writeObject(getParent()); } /** * Restore the contents of the object that was previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // set the flag to indicate that the message context is being // reconstituted and will need to have certain object references // to be reconciled with the current engine setup needsToBeReconciled = true; // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } //--------------------------------------------------------- // object level identifiers //--------------------------------------------------------- // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- long time = in.readLong(); setLastTouchedTime(time); cachingOperationContext = in.readBoolean(); logCorrelationIDString = (String) in.readObject(); // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): reading input stream for [" + getLogCorrelationIDString()+ "] "); } // EndpointReference targetEPR targetEPR = (EndpointReference) in.readObject(); // EndpointReference myEPR myEPR = (EndpointReference) in.readObject(); //--------------------------------------------------------- // properties //--------------------------------------------------------- properties = in.readHashMap(); //--------------------------------------------------------- // AxisService //--------------------------------------------------------- // axisService is not usable until the meta data has been reconciled metaAxisService = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // parent //--------------------------------------------------------- // ServiceGroupContext is not usable until it has been activated metaParent = (ServiceGroupContext) in.readObject(); //--------------------------------------------------------- // other //--------------------------------------------------------- // currently not saving this object lastOperationContext = null; //--------------------------------------------------------- // done //--------------------------------------------------------- } /** * This method checks to see if additional work needs to be * done in order to complete the object reconstitution. * Some parts of the object restored from the readExternal() * cannot be completed until we have a configurationContext * from the active engine. The configurationContext is used * to help this object to plug back into the engine's * configuration and deployment objects. * * @param cc The configuration context object representing the active configuration */ public void activate(ConfigurationContext cc) { // see if there's any work to do if (!needsToBeReconciled) { // return quick return; } // use the supplied configuration context configContext = cc; // get the axis configuration AxisConfiguration axisConfig = cc.getAxisConfiguration(); // We previously saved metaAxisService; restore it axisService = null; if (metaAxisService != null) { axisService = ActivateUtils.findService(axisConfig, metaAxisService.getClassName(), metaAxisService.getQNameAsString()); } // the parent ServiceGroupContext object was saved // either use the restored object or sync up with // an existing ServiceGroupContext object if (metaParent != null) { // find out if a copy of the ServiceGroupContext object exists on this // engine where this ServiceContext is being restored/activated // if so, use that object instead of the restored object // in order to make sure that future changes to group-level // properties are preserved for future operations String groupName = metaParent.getId(); ServiceGroupContext existingSGC = cc.getServiceGroupContext(groupName); if (existingSGC == null) { // could not find an existing ServiceGroupContext // use the restored object metaParent.activate(cc); // set parent this.setParent(metaParent); } else { // switch over to the existing object this.setParent(existingSGC); // do a copy of the properties from the restored object // to the existing ServiceContext // Should the copy be a non-destructive one? That is, // if the key already exists in the properties table of the // existing object, should the value be overwritten from the // restored ojbect? For now, the decision is that the state // that has been preserved for a saved context object is // is important to be restored. metaParent.putContextProperties(existingSGC); } } else { // set parent to null this.setParent(metaParent); } // this is another pointer to our parent object serviceGroupContext = (ServiceGroupContext) this.getParent(); if (serviceGroupContext != null) { // add the service context to the table serviceGroupContext.addServiceContext(this); } //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; // make sure this restored object is in the parent's list if (metaParent != null) { // make sure this restored object is in the parent's list metaParent.addServiceContext(this); } } /** * This will do a copy of the properties from this context object * to the properties of the specified context object. * * @param context The ServiceContext object to hold the merged properties * @param doParentProperties Indicates whether to go up the context hierachy * copy the properties at each level */ public void putContextProperties(ServiceContext context, boolean doParentProperties) { if (context != null) { // get the current properties on this context object Map props = getProperties(); // copy them to the specified context object context.mergeProperties(props); if (doParentProperties) { ServiceGroupContext mySGC = null; if (serviceGroupContext != null) { mySGC = serviceGroupContext; } else if (metaParent != null) { mySGC = metaParent; } if (mySGC != null) { ServiceGroupContext sgc = context.getServiceGroupContext(); mySGC.putContextProperties(sgc); } } } } /** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. *

    * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). *

    * * @param ctx * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(ServiceContext ctx) { // NOTE: the input object is expected to exist (ie, be non-null) if (!this.axisService.equals(ctx.getAxisService())) { return false; } EndpointReference targetEPR2 = ctx.getTargetEPR(); if ((this.targetEPR != null) && (targetEPR2 != null)) { if (!this.targetEPR.isEquivalent(targetEPR2)) { return false; } } else if ((this.targetEPR == null) && (targetEPR2 == null)) { // keep going } else { // one of the objects is null return false; } EndpointReference myEPR2 = ctx.getMyEPR(); if ((this.myEPR != null) && (myEPR2 != null)) { if (!this.myEPR.isEquivalent(myEPR2)) { return false; } } else if ((this.myEPR == null) && (myEPR2 == null)) { // keep going } else { // one of the objects is null return false; } // TODO: consider checking the parent objects for equivalency // TODO: consider checking fields from the super class for equivalency return true; } /** * Get the ID associated with this object instance. * * @return A string that can be output to a log file as an identifier * for this object instance. It is suitable for matching related log * entries. */ public String getLogCorrelationIDString() { if (logCorrelationIDString == null) { logCorrelationIDString = myClassName + "@" + UUIDGenerator.getUUID(); } return logCorrelationIDString; } /** * Trace a warning message, if needed, indicating that this * object needs to be activated before accessing certain fields. * * @param methodname The method where the warning occurs */ private void checkActivateWarning(String methodname) { if (needsToBeReconciled) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(getLogCorrelationIDString()+ ":" + methodname + "(): ****WARNING**** " + myClassName + ".activate(configurationContext) needs to be invoked."); } } } public ConfigurationContext getRootContext() { return configContext; } } ./src/org/apache/axis2/context/PropertyDifference.java0000664000175000017500000000313711767656530022164 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import java.io.Serializable; /** * This class holds the difference between two properties which are stored in the * AbstractContext */ public class PropertyDifference implements Serializable { private String key; private Object value; private boolean isRemoved; public PropertyDifference(String key, Object value, boolean isRemoved) { this.key = key; this.value = value; this.isRemoved = isRemoved; } public String getKey() { return key; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public boolean isRemoved() { return isRemoved; } public void setRemoved(boolean removed) { isRemoved = removed; } } ./src/org/apache/axis2/context/MessageContext.java0000664000175000017500000043357211767656530021330 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.Constants.Configuration; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.client.Options; import org.apache.axis2.context.externalize.ActivateUtils; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.MessageExternalizeUtils; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.ModuleConfiguration; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisError; import org.apache.axis2.engine.Handler; import org.apache.axis2.engine.Phase; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.MetaDataEntry; import org.apache.axis2.util.SelfManagedDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import javax.activation.DataHandler; import javax.xml.namespace.QName; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; /** *

    Axis2 states are held in two information models, called description hierarchy * and context hierarchy. Description hierarchy hold deployment configuration * and it's values does not change unless deployment configuration change * occurs where Context hierarchy hold run time information. Both hierarchies * consists four levels, Global, Service Group, Operation and Message. Please * look at "Information Model" section of "Axis2 Architecture Guide" for more * information.

    *

    MessageContext hold run time information about one Message invocation. It * hold reference to OperationContext, ServiceGroupContext, and Configuration * Context tied with current message. For an example if you need accesses to other * messages of the current invocation, you can get to them via OperationContext. * Addition to class attributes define in Message context, message context stores * the information as name value pairs. Those name value pairs,and class attributes * tweak the execution behavior of message context and some of them can be find in * org.apache.axis2.Constants class. (TODO we should provide list of supported * options). You may set them at any level of context hierarchy and they will * affect invocations related to their child elements.

    */ public class MessageContext extends AbstractContext implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(MessageContext.class); /** * @serial An ID which can be used to correlate operations on a single * message in the log files, irrespective of thread switches, persistence, * etc. */ private String logCorrelationID = null; /** * This string will be used to hold a form of the logCorrelationID that * is more suitable for output than its generic form. */ private transient String logCorrelationIDString = null; private static final String myClassName = "MessageContext"; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -7753637088257391858L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * A place to store the current MessageContext */ public static ThreadLocal currentMessageContext = new ThreadLocal(); public static MessageContext getCurrentMessageContext() { return (MessageContext) currentMessageContext.get(); } public static void setCurrentMessageContext(MessageContext ctx) { currentMessageContext.set(ctx); } /** * @serial Options on the message */ protected Options options; public final static int IN_FLOW = 1; public final static int IN_FAULT_FLOW = 3; public final static int OUT_FLOW = 2; public final static int OUT_FAULT_FLOW = 4; public static final String REMOTE_ADDR = "REMOTE_ADDR"; public static final String TRANSPORT_ADDR = "TRANSPORT_ADDR"; public static final String TRANSPORT_HEADERS = "TRANSPORT_HEADERS"; /** * message attachments * NOTE: Serialization of message attachments is handled as part of the * overall message serialization. If this needs to change, then * investigate having the Attachment class implement the * java.io.Externalizable interface. */ public transient Attachments attachments; /** * Field TRANSPORT_OUT */ public static final String TRANSPORT_OUT = "TRANSPORT_OUT"; /** * Field TRANSPORT_IN */ public static final String TRANSPORT_IN = "TRANSPORT_IN"; /** * Field CHARACTER_SET_ENCODING */ public static final String CHARACTER_SET_ENCODING = "CHARACTER_SET_ENCODING"; /** * Field UTF_8. This is the 'utf-8' value for CHARACTER_SET_ENCODING * property. */ public static final String UTF_8 = "UTF-8"; /** * Field UTF_16. This is the 'utf-16' value for CHARACTER_SET_ENCODING * property. */ public static final String UTF_16 = "utf-16"; /** * Field TRANSPORT_SUCCEED */ public static final String TRANSPORT_SUCCEED = "TRANSPORT_SUCCEED"; /** * Field DEFAULT_CHAR_SET_ENCODING. This is the default value for * CHARACTER_SET_ENCODING property. */ public static final String DEFAULT_CHAR_SET_ENCODING = UTF_8; /** * @serial The direction flow in use to figure out which path the message is in * (send or receive) */ public int FLOW = IN_FLOW; /** * To invoke fireAndforget method we have to hand over transport sending logic to a thread * other wise user has to wait till it get transport response (in the case of HTTP its HTTP * 202) */ public static final String TRANSPORT_NON_BLOCKING = "transportNonBlocking"; /** * This property allows someone (e.g. RM) to disable an async callback from * being invoked if a fault occurs during message transmission. If this is * not set, it can be assumed that the fault will be delivered via * Callback.onError(...). */ public static final String DISABLE_ASYNC_CALLBACK_ON_TRANSPORT_ERROR = "disableTransmissionErrorCallback"; /** * @serial processingFault */ private boolean processingFault; /** * @serial paused */ private boolean paused; /** * @serial outputWritten */ public boolean outputWritten; /** * @serial newThreadRequired */ private boolean newThreadRequired; /** * @serial isSOAP11 */ private boolean isSOAP11 = true; /** * @serial The chain of Handlers/Phases for processing this message */ private ArrayList executionChain; /** * @serial The chain of executed Handlers/Phases from processing */ private LinkedList executedPhases; /** * @serial Flag to indicate if we are doing REST */ private boolean doingREST; /** * @serial Flag to indicate if we are doing MTOM */ private boolean doingMTOM; /** * @serial Flag to indicate if we are doing SWA */ private boolean doingSwA; /** * AxisMessage associated with this message context */ private transient AxisMessage axisMessage; /** * AxisOperation associated with this message context */ private transient AxisOperation axisOperation; /** * AxisService */ private transient AxisService axisService; /** * AxisServiceGroup *

    * Note the service group can be set independently of the service * so the service might not match up with this serviceGroup */ private transient AxisServiceGroup axisServiceGroup; /** * ConfigurationContext */ private transient ConfigurationContext configurationContext; /** * @serial Index into the executuion chain of the currently executing handler */ private int currentHandlerIndex; /** * @serial Index into the current Phase of the currently executing handler (if any) */ private int currentPhaseIndex; /** * If we're processing this MC due to flowComplete() being called in the case * of an Exception, this will hold the Exception which caused the problem. */ private Exception failureReason; /** * @serial SOAP envelope */ private SOAPEnvelope envelope; /** * @serial OperationContext */ private OperationContext operationContext; /** * @serial responseWritten */ private boolean responseWritten; /** * @serial serverSide */ private boolean serverSide; /** * @serial ServiceContext */ private ServiceContext serviceContext; /** * @serial service context ID */ private String serviceContextID; /** * @serial service group context */ private ServiceGroupContext serviceGroupContext; /** * @serial Holds a key to retrieve the correct ServiceGroupContext. */ private String serviceGroupContextId; /** * @serial sessionContext */ private SessionContext sessionContext; /** * transport out description */ private transient TransportOutDescription transportOut; /** * transport in description */ private transient TransportInDescription transportIn; /** * @serial incoming transport name */ //The value will be set by the transport receiver and there will be validation for the transport //at the dispatch phase (its post condition) private String incomingTransportName; /* * SelfManagedData will hold message-specific data set by handlers * Note that this list is not explicitly saved by the MessageContext, but * rather through the SelfManagedDataManager interface implemented by handlers */ private transient LinkedHashMap selfManagedDataMap = null; //------------------------------------------------------------------------- // MetaData for data to be restored in activate() after readExternal() //------------------------------------------------------------------------- /** * Indicates whether the message context has been reconstituted * and needs to have its object references reconciled */ private transient boolean needsToBeReconciled = false; /** * selfManagedDataHandlerCount is a count of the number of handlers * that actually saved data during serialization */ private transient int selfManagedDataHandlerCount = 0; /** * SelfManagedData cannot be restored until the configurationContext * is available, so we have to hold the data from readExternal until * activate is called. */ private transient ArrayList selfManagedDataListHolder = null; /** * The ordered list of metadata for handlers/phases * used during re-constitution of the message context */ private transient ArrayList metaExecutionChain = null; /** * The ordered list of metadata for executed phases * used during re-constitution of the message context */ private transient LinkedList metaExecuted = null; /** * Index into the executuion chain of the currently executing handler */ private transient int metaHandlerIndex = 0; /** * Index into the current Phase of the currently executing handler (if any) */ private transient int metaPhaseIndex = 0; /** * The AxisOperation metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisOperation = null; /** * The AxisService metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisService = null; /** * The AxisServiceGroup metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisServiceGroup = null; /** * The TransportOutDescription metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaTransportOut = null; /** * The TransportInDescription metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaTransportIn = null; /** * The AxisMessage metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisMessage = null; /** * Indicates whether this message context has an * AxisMessage object associated with it that needs to * be reconciled */ private transient boolean reconcileAxisMessage = false; /** * Indicates whether the executed phase list * was reset before the restored list has been reconciled */ private transient boolean executedPhasesReset = false; //---------------------------------------------------------------- // end MetaData section //---------------------------------------------------------------- /** * Constructor */ public MessageContext() { super(null); options = new Options(); } /** * Constructor has package access * * @param configContext the associated ConfigurationContext */ MessageContext(ConfigurationContext configContext) { this(); setConfigurationContext(configContext); } public String toString() { return getLogIDString(); } /** * Get a "raw" version of the logCorrelationID. The logCorrelationID * is guaranteed to be unique and may be persisted along with the rest * of the message context. * * @return A string that can be output to a log file as an identifier * for this MessageContext. It is suitable for matching related log * entries. */ public String getLogCorrelationID() { if (logCorrelationID == null) { logCorrelationID = UUIDGenerator.getUUID(); } return logCorrelationID; } /** * Get a formatted version of the logCorrelationID. * * @return A string that can be output to a log file as an identifier * for this MessageContext. It is suitable for matching related log * entries. */ public String getLogIDString() { if (logCorrelationIDString == null) { logCorrelationIDString = "[MessageContext: logID=" + getLogCorrelationID() + "]"; } return logCorrelationIDString; } /** * Pause the execution of the current handler chain */ public void pause() { paused = true; } public AxisOperation getAxisOperation() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getAxisOperation"); } return axisOperation; } public AxisService getAxisService() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getAxisService"); } return axisService; } /* *

    * Note the service group can be set independently of the service * so the service might not match up with this serviceGroup */ public AxisServiceGroup getAxisServiceGroup() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getAxisServiceGroup"); } return axisServiceGroup; } public ConfigurationContext getConfigurationContext() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getConfigurationContext"); } return configurationContext; } public int getCurrentHandlerIndex() { return currentHandlerIndex; } public int getCurrentPhaseIndex() { return currentPhaseIndex; } /** * @return Returns SOAPEnvelope. */ public SOAPEnvelope getEnvelope() { return envelope; } public ArrayList getExecutionChain() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getExecutionChain"); } return executionChain; } /** * Add a Phase to the collection of executed phases for the path. * Phases will be inserted in a LIFO data structure. * * @param phase The phase to add to the list. */ public void addExecutedPhase(Handler phase) { if (executedPhases == null) { executedPhases = new LinkedList(); } executedPhases.addFirst(phase); } /** * Remove the first Phase in the collection of executed phases */ public void removeFirstExecutedPhase() { if (executedPhases != null) { executedPhases.removeFirst(); } } /** * Get an iterator over the executed phase list. * * @return An Iterator over the LIFO data structure. */ public Iterator getExecutedPhases() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getExecutedPhases"); } if (executedPhases == null) { executedPhases = new LinkedList(); } return executedPhases.iterator(); } /** * Reset the list of executed phases. * This is needed because the OutInAxisOperation currently invokes * receive() even when a fault occurs, and we will have already executed * the flowComplete on those before receiveFault() is called. */ public void resetExecutedPhases() { executedPhasesReset = true; executedPhases = new LinkedList(); } /** * @return Returns EndpointReference. */ public EndpointReference getFaultTo() { return options.getFaultTo(); } /** * @return Returns EndpointReference. */ public EndpointReference getFrom() { return options.getFrom(); } /** * @return Returns message id. */ public String getMessageID() { return options.getMessageId(); } /** * Retrieves both module specific configuration parameters as well as other * parameters. The order of search is as follows: *

      *
    1. Search in module configurations inside corresponding operation * description if its there
    2. *
    3. Search in corresponding operation if its there
    4. *
    5. Search in module configurations inside corresponding service * description if its there
    6. *
    7. Next search in Corresponding Service description if its there
    8. *
    9. Next search in module configurations inside axisConfiguration
    10. *
    11. Search in AxisConfiguration for parameters
    12. *
    13. Next get the corresponding module and search for the parameters *
    14. *
    15. Search in HandlerDescription for the parameter
    16. *
    *

    and the way of specifying module configuration is as follows * N/A * * @param key : * Parameter Name * @param moduleName : * Name of the module * @param handler HandlerDescription * @return Parameter Parameter */ public Parameter getModuleParameter(String key, String moduleName, HandlerDescription handler) { Parameter param; ModuleConfiguration moduleConfig; AxisOperation opDesc = getAxisOperation(); if (opDesc != null) { moduleConfig = opDesc.getModuleConfig(moduleName); if (moduleConfig != null) { param = moduleConfig.getParameter(key); if (param != null) { return param; } else { param = opDesc.getParameter(key); if (param != null) { return param; } } } } AxisService axisService = getAxisService(); if (axisService != null) { moduleConfig = axisService.getModuleConfig(moduleName); if (moduleConfig != null) { param = moduleConfig.getParameter(key); if (param != null) { return param; } else { param = axisService.getParameter(key); if (param != null) { return param; } } } } AxisServiceGroup axisServiceDesc = getAxisServiceGroup(); if (axisServiceDesc != null) { moduleConfig = axisServiceDesc.getModuleConfig(moduleName); if (moduleConfig != null) { param = moduleConfig.getParameter(key); if (param != null) { return param; } else { param = axisServiceDesc.getParameter(key); if (param != null) { return param; } } } } AxisConfiguration baseConfig = configurationContext.getAxisConfiguration(); moduleConfig = baseConfig.getModuleConfig(moduleName); if (moduleConfig != null) { param = moduleConfig.getParameter(key); if (param != null) { return param; } else { param = baseConfig.getParameter(key); if (param != null) { return param; } } } AxisModule module = baseConfig.getModule(moduleName); if (module != null) { param = module.getParameter(key); if (param != null) { return param; } } param = handler.getParameter(key); return param; } public OperationContext getOperationContext() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getOperationContext"); } return operationContext; } /** * Retrieves configuration descriptor parameters at any level. The order of * search is as follows: *

      *
    1. Search in operation description if it exists
    2. *
    3. If parameter is not found or if operationContext is null, search in * AxisService
    4. *
    5. If parameter is not found or if axisService is null, search in * AxisConfiguration
    6. *
    * * @param key name of desired parameter * @return Parameter Parameter */ public Parameter getParameter(String key) { if (axisOperation != null) { return axisOperation.getParameter(key); } if (axisService != null) { return axisService.getParameter(key); } if (axisServiceGroup != null) { return axisServiceGroup.getParameter(key); } if (configurationContext != null) { AxisConfiguration baseConfig = configurationContext .getAxisConfiguration(); return baseConfig.getParameter(key); } return null; } /** * Retrieves a property value. The order of search is as follows: search in * my own map and then look at my options. Does not search up the hierarchy. * * @param name name of the property to search for * @return the value of the property, or null if the property is not found */ public Object getLocalProperty(String name) { return getLocalProperty(name, true); } public Object getLocalProperty(String name, boolean searchOptions) { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getProperty"); } // search in my own options Object obj = super.getLocalProperty(name); if (obj != null) { return obj; } if (searchOptions) { obj = options.getProperty(name); if (obj != null) { return obj; } } // tough return null; } /** * Retrieves a property value. The order of search is as follows: search in * my own map and then look in my context hierarchy, and then in options. * Since its possible * that the entire hierarchy is not present, I will start at whatever level * has been set. * * @param name name of the property to search for * @return the value of the property, or null if the property is not found */ public Object getProperty(String name) { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getProperty"); } // search in my own options Object obj = super.getProperty(name); if (obj != null) { return obj; } obj = options.getProperty(name); if (obj != null) { return obj; } // My own context hierarchy may not all be present. So look for whatever // nearest level is present and ask that to find the property. // // If the context is already an ancestor, it was checked during // the super.getProperty call. In such cases, the second check // is not performed. if (operationContext != null) { if (!isAncestor(operationContext)) { obj = operationContext.getProperty(name); } } else if (serviceContext != null) { if (!isAncestor(serviceContext)) { obj = serviceContext.getProperty(name); } } else if (serviceGroupContext != null) { if (!isAncestor(serviceGroupContext)) { obj = serviceGroupContext.getProperty(name); } } else if (configurationContext != null) { if (!isAncestor(configurationContext)) { obj = configurationContext.getProperty(name); } } return obj; } /** * Check if a given property is true. Will return false if the property * does not exist or is not an explicit "true" value. * * @param name name of the property to check * @return true if the property exists and is Boolean.TRUE, "true", 1, etc. */ public boolean isPropertyTrue(String name) { return isPropertyTrue(name, false); } /** * Check if a given property is true. Will return the passed default if the property * does not exist. * * @param name name of the property to check * @param defaultVal the default value if the property doesn't exist * @return true if the property exists and is Boolean.TRUE, "true", 1, etc. */ public boolean isPropertyTrue(String name, boolean defaultVal) { return JavaUtils.isTrueExplicitly(getProperty(name), defaultVal); } /** * Retrieves all property values. The order of search is as follows: search in * my own options and then look in my context hierarchy. Since its possible * that the entire hierarchy is not present, it will start at whatever level * has been set and start there. * The returned map is unmodifiable, so any changes to the properties have * to be done by calling {@link #setProperty(String,Object)}. In addition, * any changes to the properties are not reflected on this map. * * @return An unmodifiable map containing the combination of all available * properties or an empty map. */ public Map getProperties() { final Map resultMap = new HashMap(); // My own context hierarchy may not all be present. So look for whatever // nearest level is present and add the properties // We have to access the contexts in reverse order, in order to allow // a nearer context to overwrite values from a more distant context if (configurationContext != null) { resultMap.putAll(configurationContext.getProperties()); } if (serviceGroupContext != null) { resultMap.putAll(serviceGroupContext.getProperties()); } if (serviceContext != null) { resultMap.putAll(serviceContext.getProperties()); } if (operationContext != null) { resultMap.putAll(operationContext.getProperties()); } // and now add options resultMap.putAll(options.getProperties()); return Collections.unmodifiableMap(resultMap); } /** * @return Returns RelatesTo array. */ public RelatesTo[] getRelationships() { return options.getRelationships(); } /** * Get any RelatesTos of a particular type associated with this MessageContext * TODO: Shouldn't this return a List? * * @param type the relationship type * @return Returns RelatesTo. */ public RelatesTo getRelatesTo(String type) { return options.getRelatesTo(type); } /** * @return Returns RelatesTo. */ public RelatesTo getRelatesTo() { return options.getRelatesTo(); } /** * @return Returns EndpointReference. */ public EndpointReference getReplyTo() { return options.getReplyTo(); } /** * @return Returns ServiceContext. */ public ServiceContext getServiceContext() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getServiceContext"); } return serviceContext; } /** * @return Returns the serviceContextID. */ public String getServiceContextID() { return serviceContextID; } public ServiceGroupContext getServiceGroupContext() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getServiceGroupContext"); } return serviceGroupContext; } public String getServiceGroupContextId() { return serviceGroupContextId; } /** * @return Returns SessionContext. */ public SessionContext getSessionContext() { return sessionContext; } public void setSessionContext(SessionContext sessionContext) { this.sessionContext = sessionContext; } /** * @return Returns soap action. */ public String getSoapAction() { return options.getAction(); } /** * @return Returns EndpointReference. */ public EndpointReference getTo() { return options.getTo(); } /** * @return Returns TransportInDescription. */ public TransportInDescription getTransportIn() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getTransportIn"); } return transportIn; } /** * @return Returns TransportOutDescription. */ public TransportOutDescription getTransportOut() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getTransportOut"); } return transportOut; } public String getWSAAction() { return options.getAction(); } /** * @return Returns boolean. */ public boolean isDoingMTOM() { return doingMTOM; } /** * @return Returns boolean. */ public boolean isDoingREST() { return doingREST; } /** * @return Returns boolean. */ public boolean isDoingSwA() { return doingSwA; } /** * @return Returns boolean. */ public boolean isNewThreadRequired() { return newThreadRequired; } /** * @return Returns boolean. */ public boolean isOutputWritten() { return outputWritten; } /** * @return Returns boolean. */ public boolean isPaused() { return paused; } public void setPaused(boolean paused) { this.paused = paused; } /** * @return Returns boolean. */ public boolean isProcessingFault() { return processingFault; } /** * @return Returns boolean. */ public boolean isResponseWritten() { return responseWritten; } public boolean isSOAP11() { return isSOAP11; } /** * @return Returns boolean. */ public boolean isServerSide() { return serverSide; } public AxisMessage getAxisMessage() { if (reconcileAxisMessage) { if (LoggingControl.debugLoggingAllowed && log.isWarnEnabled()) { log.warn(this.getLogIDString() + ":getAxisMessage(): ****WARNING**** MessageContext.activate(configurationContext) needs to be invoked."); } } return axisMessage; } public void setAxisMessage(AxisMessage axisMessage) { this.axisMessage = axisMessage; } public void setAxisOperation(AxisOperation axisOperation) { this.axisOperation = axisOperation; } public void setAxisService(AxisService axisService) { this.axisService = axisService; if (this.axisService != null) { this.axisServiceGroup = axisService.getAxisServiceGroup(); } else { this.axisServiceGroup = null; } } /* * note setAxisServiceGroup() does not verify that the service is associated with the service group! */ public void setAxisServiceGroup(AxisServiceGroup axisServiceGroup) { // need to set the axis service group object to null when necessary // for example, when extracting the message context object from // the object graph this.axisServiceGroup = axisServiceGroup; } /** * @param context */ public void setConfigurationContext(ConfigurationContext context) { configurationContext = context; } public void setCurrentHandlerIndex(int currentHandlerIndex) { this.currentHandlerIndex = currentHandlerIndex; } public void setCurrentPhaseIndex(int currentPhaseIndex) { this.currentPhaseIndex = currentPhaseIndex; } /** * @param b */ public void setDoingMTOM(boolean b) { doingMTOM = b; } /** * @param b */ public void setDoingREST(boolean b) { doingREST = b; } /** * @param b */ public void setDoingSwA(boolean b) { doingSwA = b; } /** * @param envelope */ public void setEnvelope(SOAPEnvelope envelope) throws AxisFault { this.envelope = envelope; if (this.envelope != null) { String soapNamespaceURI = envelope.getNamespace().getNamespaceURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(soapNamespaceURI)) { isSOAP11 = false; } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(soapNamespaceURI)) { isSOAP11 = true; } else { throw new AxisFault( "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages"); } // Inform the listeners of an attach envelope event if (getAxisService() != null) { getAxisService().attachEnvelopeEvent(this); } } } /** * Set the execution chain of Handler in this MessageContext. Doing this * causes the current handler/phase indexes to reset to 0, since we have new * Handlers to execute (this usually only happens at initialization and when * a fault occurs). * * @param executionChain */ public void setExecutionChain(ArrayList executionChain) { this.executionChain = executionChain; currentHandlerIndex = -1; currentPhaseIndex = 0; } /** * @param reference */ public void setFaultTo(EndpointReference reference) { options.setFaultTo(reference); } /** * @param reference */ public void setFrom(EndpointReference reference) { options.setFrom(reference); } /** * @param messageId */ public void setMessageID(String messageId) { options.setMessageId(messageId); } /** * @param b */ public void setNewThreadRequired(boolean b) { newThreadRequired = b; } /** * @param context The OperationContext */ public void setOperationContext(OperationContext context) { // allow setting the fields to null // useful when extracting the messge context from the object graph operationContext = context; this.setParent(operationContext); if (operationContext != null) { if (serviceContext == null) { setServiceContext(operationContext.getServiceContext()); } else { if (operationContext.getParent() != serviceContext) { throw new AxisError("ServiceContext in OperationContext does not match !"); } } this.setAxisOperation(operationContext.getAxisOperation()); } } /** * @param b */ public void setOutputWritten(boolean b) { outputWritten = b; } /** * @param b */ public void setProcessingFault(boolean b) { processingFault = b; } /** * Add a RelatesTo * * @param reference RelatesTo describing how we relate to another message */ public void addRelatesTo(RelatesTo reference) { options.addRelatesTo(reference); } /** * Set ReplyTo destination * * @param reference the ReplyTo EPR */ public void setReplyTo(EndpointReference reference) { options.setReplyTo(reference); } /** * @param b */ public void setResponseWritten(boolean b) { responseWritten = b; } /** * @param b */ public void setServerSide(boolean b) { serverSide = b; } /** * @param context */ public void setServiceContext(ServiceContext context) { // allow the service context to be set to null // this allows the message context object to be extraced from // the object graph serviceContext = context; if (serviceContext != null) { if ((operationContext != null) && (operationContext.getParent() != context)) { throw new AxisError("ServiceContext and OperationContext.parent do not match!"); } // setting configcontext using configuration context in service context if (configurationContext == null) { // setting configcontext configurationContext = context.getConfigurationContext(); } if (serviceGroupContext == null) { // setting service group context serviceGroupContext = context.getServiceGroupContext(); } AxisService axisService = context.getAxisService(); this.setAxisService(axisService); // Inform the listeners of an attach event if (axisService != null) { axisService.attachServiceContextEvent(serviceContext, this); } } } /** * Sets the service context id. * * @param serviceContextID */ public void setServiceContextID(String serviceContextID) { this.serviceContextID = serviceContextID; } public void setServiceGroupContext(ServiceGroupContext serviceGroupContext) { // allow the service group context to be set to null // this allows the message context object to be extraced from // the object graph this.serviceGroupContext = serviceGroupContext; if (this.serviceGroupContext != null) { this.axisServiceGroup = serviceGroupContext.getDescription(); } } public void setServiceGroupContextId(String serviceGroupContextId) { this.serviceGroupContextId = serviceGroupContextId; } /** * @param soapAction */ public void setSoapAction(String soapAction) { options.setAction(soapAction); } /** * @param to */ public void setTo(EndpointReference to) { options.setTo(to); } /** * @param in */ public void setTransportIn(TransportInDescription in) { this.transportIn = in; } /** * @param out */ public void setTransportOut(TransportOutDescription out) { transportOut = out; } /** * setWSAAction */ public void setWSAAction(String actionURI) { options.setAction(actionURI); } public void setWSAMessageId(String messageID) { options.setMessageId(messageID); } // to get the flow inwhich the execution chain below public int getFLOW() { return FLOW; } public void setFLOW(int FLOW) { this.FLOW = FLOW; } public Options getOptions() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getOptions"); } return options; } /** * Set the options for myself. I make the given options my own options' * parent so that that becomes the default. That allows the user to override * specific options on a given message context and not affect the overall * options. * * @param options the options to set */ public void setOptions(Options options) { this.options.setParent(options); } public String getIncomingTransportName() { return incomingTransportName; } public void setIncomingTransportName(String incomingTransportName) { this.incomingTransportName = incomingTransportName; } public void setRelationships(RelatesTo[] list) { options.setRelationships(list); } public Policy getEffectivePolicy() { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("getEffectivePolicy"); } AxisBindingMessage bindingMessage = (AxisBindingMessage) getProperty(Constants.AXIS_BINDING_MESSAGE); if (bindingMessage != null) { return bindingMessage.getEffectivePolicy(); } else { if (axisMessage != null) { return axisMessage.getEffectivePolicy(); } else { return null; } } } public boolean isEngaged(String moduleName) { if (LoggingControl.debugLoggingAllowed) { checkActivateWarning("isEngaged"); } boolean enegage; if (configurationContext != null) { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); AxisModule module = axisConfig.getModule(moduleName); if (module == null) { return false; } enegage = axisConfig.isEngaged(module); if (enegage) { return true; } if (axisServiceGroup != null) { enegage = axisServiceGroup.isEngaged(module); if (enegage) { return true; } } if (axisService != null) { enegage = axisService.isEngaged(module); if (enegage) { return true; } } if (axisOperation != null) { enegage = axisOperation.isEngaged(module); if (enegage) { return true; } } } return false; } /** * Gets the first child of the envelope, check if it is a soap:Body, which means there is no header. * We do this basically to make sure we don't parse and build the om tree of the whole envelope * looking for the soap header. If this method returns true, there still is no guarantee that there is * a soap:Header present, use getHeader() and also check for null on getHeader() to be absolutely sure. * * @return boolean * @deprecated The bonus you used to get from this is now built in to SOAPEnvelope.getHeader() */ public boolean isHeaderPresent() { // If there's no envelope there can't be a header. if (this.envelope == null) { return false; } return (this.envelope.getHeader() != null); } /** * Setting of the attachments map should be performed at the receipt of a * message only. This method is only meant to be used by the Axis2 * internals. * * @param attachments */ public void setAttachmentMap(Attachments attachments) { this.attachments = attachments; } /** * You can directly access the attachment map of the message context from * here. Returned attachment map can be empty. * * @return attachment */ public Attachments getAttachmentMap() { if (attachments == null) { attachments = new Attachments(); } return attachments; } /** * Adds an attachment to the attachment Map of this message context. This * attachment gets serialised as a MIME attachment when sending the message * if SOAP with Attachments is enabled. * * @param contentID : * will be the content ID of the MIME part (without the "cid:" prefix) * @param dataHandler */ public void addAttachment(String contentID, DataHandler dataHandler) { if (attachments == null) { attachments = new Attachments(); } attachments.addDataHandler(contentID, dataHandler); } /** * Adds an attachment to the attachment Map of this message context. This * attachment gets serialised as a MIME attachment when sending the message * if SOAP with Attachments is enabled. Content ID of the MIME part will be * auto generated by Axis2. * * @param dataHandler * @return the auto generated content ID of the MIME attachment */ public String addAttachment(DataHandler dataHandler) { String contentID = UUIDGenerator.getUUID(); addAttachment(contentID, dataHandler); return contentID; } /** * Access the DataHandler of the attachment contained in the map corresponding to the given * content ID. Returns "NULL" if a attachment cannot be found by the given content ID. * * @param contentID : * Content ID of the MIME attachment (without the "cid:" prefix) * @return Data handler of the attachment */ public DataHandler getAttachment(String contentID) { if (attachments == null) { attachments = new Attachments(); } return attachments.getDataHandler(contentID); } /** * Removes the attachment with the given content ID from the Attachments Map * Do nothing if a attachment cannot be found by the given content ID. * * @param contentID of the attachment (without the "cid:" prefix) */ public void removeAttachment(String contentID) { if (attachments != null) { attachments.removeDataHandler(contentID); } } /* * =============================================================== * SelfManagedData Section * =============================================================== */ /* * character to delimit strings */ private String selfManagedDataDelimiter = "*"; /** * Set up a unique key in the form of *
      *
    1. the class name for the class that owns the key *
    2. delimitor *
    3. the key as a string *
    4. delimitor *
    5. the key's hash code as a string *
    * * @param clazz The class that owns the supplied key * @param key The key * @return A string key */ private String generateSelfManagedDataKey(Class clazz, Object key) { return clazz.getName() + selfManagedDataDelimiter + key.toString() + selfManagedDataDelimiter + Integer.toString(key.hashCode()); } /** * Add a key-value pair of self managed data to the set associated with * this message context. *

    * This is primarily intended to allow handlers to manage their own * message-specific data when the message context is saved/restored. * * @param clazz The class of the caller that owns the key-value pair * @param key The key for this data object * @param value The data object */ public void setSelfManagedData(Class clazz, Object key, Object value) { if (selfManagedDataMap == null) { selfManagedDataMap = new LinkedHashMap(); } // make sure we have a unique key and a delimiter so we can // get the classname and hashcode for serialization/deserialization selfManagedDataMap.put(generateSelfManagedDataKey(clazz, key), value); } /** * Retrieve a value of self managed data previously saved with the specified key. * * @param clazz The class of the caller that owns the key-value pair * @param key The key for the data * @return The data object associated with the key, or NULL if not found */ public Object getSelfManagedData(Class clazz, Object key) { if (selfManagedDataMap != null) { return selfManagedDataMap.get(generateSelfManagedDataKey(clazz, key)); } return null; } /** * Check to see if the key for the self managed data is available * * @param clazz The class of the caller that owns the key-value pair * @param key The key to look for * @return TRUE if the key exists, FALSE otherwise */ public boolean containsSelfManagedDataKey(Class clazz, Object key) { if (selfManagedDataMap == null) { return false; } return selfManagedDataMap.containsKey(generateSelfManagedDataKey(clazz, key)); } /** * Removes the mapping of the specified key if the specified key * has been set for self managed data * * @param clazz The class of the caller that owns the key-value pair * @param key The key of the object to be removed */ public void removeSelfManagedData(Class clazz, Object key) { if (selfManagedDataMap != null) { selfManagedDataMap.remove(generateSelfManagedDataKey(clazz, key)); } } /** * Flatten the phase list into a list of just unique handler instances * * @param list the list of handlers * @param map users should pass null as this is just a holder for the recursion * @return a list of unigue object instances */ private ArrayList flattenPhaseListToHandlers(ArrayList list, LinkedHashMap map) { if (map == null) { map = new LinkedHashMap(); } Iterator it = list.iterator(); while (it.hasNext()) { Handler handler = (Handler) it.next(); String key = null; if (handler != null) { key = handler.getClass().getName() + "@" + handler.hashCode(); } if (handler instanceof Phase) { // add its handlers to the list flattenHandlerList(((Phase) handler).getHandlers(), map); } else { // if the same object is already in the list, // then it won't be in the list multiple times map.put(key, handler); } } if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { Iterator it2 = map.keySet().iterator(); while (it2.hasNext()) { Object key = it2.next(); Handler value = (Handler) map.get(key); String name = value.getName(); log.trace(getLogIDString() + ":flattenPhaseListToHandlers(): key [" + key + "] handler name [" + name + "]"); } } return new ArrayList(map.values()); } /** * Flatten the handler list into just unique handler instances * including phase instances. * * @param list the list of handlers/phases * @param map users should pass null as this is just a holder for the recursion * @return a list of unigue object instances */ private ArrayList flattenHandlerList(List list, LinkedHashMap map) { if (map == null) { map = new LinkedHashMap(); } Iterator it = list.iterator(); while (it.hasNext()) { Handler handler = (Handler) it.next(); String key = null; if (handler != null) { key = handler.getClass().getName() + "@" + handler.hashCode(); } if (handler instanceof Phase) { // put the phase in the list map.put(key, handler); // add its handlers to the list flattenHandlerList(((Phase) handler).getHandlers(), map); } else { // if the same object is already in the list, // then it won't be in the list multiple times map.put(key, handler); } } return new ArrayList(map.values()); } /** * Calls the serializeSelfManagedData() method of each handler that * implements the SelfManagedDataManager interface. * Handlers for this message context are identified via the * executionChain list. * * @param out The output stream */ private void serializeSelfManagedData(ObjectOutput out) { selfManagedDataHandlerCount = 0; try { if ((selfManagedDataMap == null) || (executionChain == null) || (selfManagedDataMap.size() == 0) || (executionChain.size() == 0)) { out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END"); } return; } // let's create a temporary list with the handlers ArrayList flatExecChain = flattenPhaseListToHandlers(executionChain, null); //ArrayList selfManagedDataHolderList = serializeSelfManagedDataHelper(flatExecChain.iterator(), new ArrayList()); ArrayList selfManagedDataHolderList = serializeSelfManagedDataHelper(flatExecChain); if (selfManagedDataHolderList.size() == 0) { out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END"); } return; } out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT); // SelfManagedData can be binary so won't be able to treat it as a // string - need to treat it as a byte [] // how many handlers actually // returned serialized SelfManagedData out.writeInt(selfManagedDataHolderList.size()); for (int i = 0; i < selfManagedDataHolderList.size(); i++) { out.writeObject(selfManagedDataHolderList.get(i)); } } catch (IOException e) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace("MessageContext:serializeSelfManagedData(): Exception [" + e.getClass().getName() + "] description [" + e.getMessage() + "]", e); } } } /** * This is the helper method to do the recursion for serializeSelfManagedData() * * @param handlers * @return ArrayList */ private ArrayList serializeSelfManagedDataHelper(ArrayList handlers) { ArrayList selfManagedDataHolderList = new ArrayList(); Iterator it = handlers.iterator(); try { while (it.hasNext()) { Handler handler = (Handler) it.next(); //if (handler instanceof Phase) //{ // selfManagedDataHolderList = serializeSelfManagedDataHelper(((Phase)handler).getHandlers().iterator(), selfManagedDataHolderList); //} //else if (SelfManagedDataManager.class.isAssignableFrom(handler.getClass())) if (SelfManagedDataManager.class.isAssignableFrom(handler.getClass())) { // only call the handler's serializeSelfManagedData if it implements SelfManagedDataManager if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace( "MessageContext:serializeSelfManagedDataHelper(): calling handler [" + handler.getClass().getName() + "] name [" + handler.getName() + "] serializeSelfManagedData method"); } ByteArrayOutputStream baos_fromHandler = ((SelfManagedDataManager) handler).serializeSelfManagedData(this); if (baos_fromHandler != null) { baos_fromHandler.close(); try { SelfManagedDataHolder selfManagedDataHolder = new SelfManagedDataHolder( handler.getClass().getName(), handler.getName(), baos_fromHandler.toByteArray()); selfManagedDataHolderList.add(selfManagedDataHolder); selfManagedDataHandlerCount++; } catch (Exception exc) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace("MessageContext:serializeSelfManagedData(): exception [" + exc.getClass().getName() + "][" + exc.getMessage() + "] in setting up SelfManagedDataHolder object for [" + handler.getClass().getName() + " / " + handler.getName() + "] ", exc); } } } } } return selfManagedDataHolderList; } catch (Exception ex) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace("MessageContext:serializeSelfManagedData(): exception [" + ex.getClass().getName() + "][" + ex.getMessage() + "]", ex); } return null; } } /** * During deserialization, the executionChain will be * re-constituted before the SelfManagedData is restored. * This means the handler instances are already available. * This method lets us find the handler instance from the * executionChain so we can call each one's * deserializeSelfManagedData method. * * @param it The iterator from the executionChain object * @param classname The class name * @param qNameAsString The QName in string form * @return SelfManagedDataManager handler */ private SelfManagedDataManager deserialize_getHandlerFromExecutionChain(Iterator it, String classname, String qNameAsString) { SelfManagedDataManager handler_toreturn = null; try { while ((it.hasNext()) && (handler_toreturn == null)) { Handler handler = (Handler) it.next(); if (handler instanceof Phase) { handler_toreturn = deserialize_getHandlerFromExecutionChain( ((Phase) handler).getHandlers().iterator(), classname, qNameAsString); } else if ((handler.getClass().getName().equals(classname)) && (handler.getName().equals(qNameAsString))) { handler_toreturn = (SelfManagedDataManager) handler; } } return handler_toreturn; } catch (ClassCastException e) { // Doesn't seem likely to happen, but just in case... // A handler classname in the executionChain matched up with our parameter // classname, but the existing class in the executionChain is a different // implementation than the one we saved during serializeSelfManagedData. // NOTE: the exception gets absorbed! if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace( "MessageContext:deserialize_getHandlerFromExecutionChain(): ClassCastException thrown: " + e.getMessage(), e); } return null; } } /* * We don't need to create new instances of the handlers * since the executionChain is rebuilt after readExternal(). * We just have to find them in the executionChain and * call each handler's deserializeSelfManagedData method. */ private void deserializeSelfManagedData() throws IOException { try { for (int i = 0; (selfManagedDataListHolder != null) && (i < selfManagedDataListHolder.size()); i++) { SelfManagedDataHolder selfManagedDataHolder = (SelfManagedDataHolder) selfManagedDataListHolder.get(i); String classname = selfManagedDataHolder.getClassname(); String qNameAsString = selfManagedDataHolder.getId(); SelfManagedDataManager handler = deserialize_getHandlerFromExecutionChain( executionChain.iterator(), classname, qNameAsString); if (handler == null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":deserializeSelfManagedData(): [" + classname + "] was not found in the executionChain associated with the message context."); } throw new IOException("The class [" + classname + "] was not found in the executionChain associated with the message context."); } ByteArrayInputStream handlerData = new ByteArrayInputStream(selfManagedDataHolder.getData()); // the handler implementing SelfManagedDataManager is responsible for repopulating // the SelfManagedData in the MessageContext (this) if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":deserializeSelfManagedData(): calling handler [" + classname + "] [" + qNameAsString + "] deserializeSelfManagedData method"); } handler.deserializeSelfManagedData(handlerData, this); handler.restoreTransientData(this); } } catch (IOException ioe) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":deserializeSelfManagedData(): IOException thrown: " + ioe.getMessage(), ioe); } throw ioe; } } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this MessageContext instance. *

    * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); String logCorrelationIDString = getLogIDString(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): writing to output stream"); } //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- // the type of execution flow for the message context out.writeInt(FLOW); // various flags out.writeBoolean(processingFault); out.writeBoolean(paused); out.writeBoolean(outputWritten); out.writeBoolean(newThreadRequired); out.writeBoolean(isSOAP11); out.writeBoolean(doingREST); out.writeBoolean(doingMTOM); out.writeBoolean(doingSwA); out.writeBoolean(responseWritten); out.writeBoolean(serverSide); out.writeLong(getLastTouchedTime()); out.writeObject(getLogCorrelationID()); //----------------------------------------------------------------------- // Create and initialize the OMOutputFormat for Message Externalization //----------------------------------------------------------------------- OMOutputFormat outputFormat= new OMOutputFormat(); outputFormat.setSOAP11(isSOAP11); boolean persistOptimized = getPersistOptimized(); if (persistOptimized) { outputFormat.setDoOptimize(true); } String charSetEnc = (String) getProperty(MessageContext.CHARACTER_SET_ENCODING); if (charSetEnc == null) { OperationContext opContext = getOperationContext(); if (opContext != null) { charSetEnc = (String) opContext.getProperty(MessageContext.CHARACTER_SET_ENCODING); } } if (charSetEnc == null) { charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING; } outputFormat.setCharSetEncoding(charSetEnc); // ---------------------------------------------------------- // Externalize the Message // ---------------------------------------------------------- MessageExternalizeUtils.writeExternal(out, this, logCorrelationIDString, outputFormat); // --------------------------------------------------------- // ArrayList executionChain // handler and phase related data //--------------------------------------------------------- // The strategy is to save some metadata about each // member of the list and the order of the list. // Then when the message context is re-constituted, // try to match up with phases and handlers on the // engine. // // Non-null list: // UTF - description string // boolean - active flag // int - current handler index // int - current phase index // int - expected number of entries in the list // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- out.writeUTF("executionChain"); if (executionChain != null && executionChain.size() > 0) { // start writing data to the output stream out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT); out.writeInt(currentHandlerIndex); out.writeInt(currentPhaseIndex); out.writeInt(executionChain.size()); // put the metadata on each member of the list into a buffer // match the current index with the actual saved list int nextIndex = 0; Iterator i = executionChain.iterator(); while (i.hasNext()) { Object obj = i.next(); String objClass = obj.getClass().getName(); // start the meta data entry for this object MetaDataEntry mdEntry = new MetaDataEntry(); mdEntry.setClassName(objClass); // get the correct object-specific name String qnameAsString; if (obj instanceof Phase) { Phase phaseObj = (Phase) obj; qnameAsString = phaseObj.getName(); // add the list of handlers to the meta data setupPhaseList(phaseObj, mdEntry); } else if (obj instanceof Handler) { Handler handlerObj = (Handler) obj; qnameAsString = handlerObj.getName(); } else { // TODO: will there be any other kinds of objects in the execution Chain? qnameAsString = "NULL"; } mdEntry.setQName(qnameAsString); // update the index for the entry in the chain if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): ***BEFORE OBJ WRITE*** executionChain entry class [" + objClass + "] qname [" + qnameAsString + "]"); } out.writeObject(mdEntry); // update the index so that the index // now indicates the next entry that // will be attempted nextIndex++; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): ***AFTER OBJ WRITE*** executionChain entry class [" + objClass + "] qname [" + qnameAsString + "]"); } } // end while entries in execution chain // done with the entries in the execution chain // add the end-of-list marker MetaDataEntry lastEntry = new MetaDataEntry(); lastEntry.setClassName(MetaDataEntry.END_OF_LIST); out.writeObject(lastEntry); nextIndex++; // nextIndex also gives us the number of entries // that were actually saved as opposed to the // number of entries in the executionChain out.writeInt(nextIndex); } else { // general case: handle "null" or "empty" out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): executionChain is NULL"); } } //--------------------------------------------------------- // LinkedList executedPhases //--------------------------------------------------------- // The strategy is to save some metadata about each // member of the list and the order of the list. // Then when the message context is re-constituted, // try to match up with phases and handlers on the // engine. // // Non-null list: // UTF - description string // boolean - active flag // int - expected number of entries in the list // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- out.writeUTF("executedPhases"); if (executedPhases != null && executedPhases.size() > 0) { // start writing data to the output stream out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT); out.writeInt(executedPhases.size()); // put the metadata on each member of the list into a buffer int execNextIndex = 0; Iterator iterator = executedPhases.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); String objClass = obj.getClass().getName(); // start the meta data entry for this object MetaDataEntry mdEntry = new MetaDataEntry(); mdEntry.setClassName(objClass); // get the correct object-specific name String qnameAsString; if (obj instanceof Phase) { Phase inPhaseObj = (Phase) obj; qnameAsString = inPhaseObj.getName(); // add the list of handlers to the meta data setupPhaseList(inPhaseObj, mdEntry); } else if (obj instanceof Handler) { Handler inHandlerObj = (Handler) obj; qnameAsString = inHandlerObj.getName(); } else { // TODO: will there be any other kinds of objects in the list qnameAsString = "NULL"; } mdEntry.setQName(qnameAsString); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): ***BEFORE Executed List OBJ WRITE*** executedPhases entry class [" + objClass + "] qname [" + qnameAsString + "]"); } out.writeObject(mdEntry); // update the index so that the index // now indicates the next entry that // will be attempted execNextIndex++; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): " + "***AFTER Executed List OBJ WRITE*** " + "executedPhases entry class [" + objClass + "] " + "qname [" + qnameAsString + "]"); } } // end while entries in execution chain // done with the entries in the execution chain // add the end-of-list marker MetaDataEntry lastEntry = new MetaDataEntry(); lastEntry.setClassName(MetaDataEntry.END_OF_LIST); out.writeObject(lastEntry); execNextIndex++; // execNextIndex also gives us the number of entries // that were actually saved as opposed to the // number of entries in the executedPhases out.writeInt(execNextIndex); } else { // general case: handle "null" or "empty" out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace( logCorrelationIDString + ":writeExternal(): executedPhases is NULL"); } } //--------------------------------------------------------- // options //--------------------------------------------------------- // before saving the Options, make sure there is a message ID String tmpID = getMessageID(); if (tmpID == null) { // get an id to use when restoring this object tmpID = UUIDGenerator.getUUID(); setMessageID(tmpID); } if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): message ID [" + tmpID + "]"); } out.writeUTF("options"); out.writeObject(options); //--------------------------------------------------------- // operation //--------------------------------------------------------- // axis operation //--------------------------------------------------------- out.writeUTF("axisOperation"); metaAxisOperation = null; if (axisOperation != null) { // TODO: may need to include the meta data for the axis service that is // the parent of the axis operation // make sure the axis operation has a name associated with it QName aoTmpQName = axisOperation.getName(); if (aoTmpQName == null) { aoTmpQName = new QName(ExternalizeConstants.EMPTY_MARKER); axisOperation.setName(aoTmpQName); } metaAxisOperation = new MetaDataEntry(axisOperation.getClass().getName(), axisOperation.getName().toString()); } out.writeObject(metaAxisOperation); //--------------------------------------------------------- // operation context //--------------------------------------------------------- // The OperationContext has pointers to MessageContext objects. // In order to avoid having multiple copies of the object graph // being saved at different points in the serialization, // it is important to isolate this message context object. out.writeUTF("operationContext"); if (operationContext != null) { operationContext.isolateMessageContext(this); } out.writeObject(operationContext); //--------------------------------------------------------- // service //--------------------------------------------------------- // axis service //------------------------- // this is expected to be the parent of the axis operation object out.writeUTF("axisService"); metaAxisService = null; if (axisService != null) { metaAxisService = new MetaDataEntry(axisService.getClass().getName(), axisService.getName()); } out.writeObject(metaAxisService); //------------------------- // serviceContextID string //------------------------- out.writeObject(serviceContextID); //------------------------- // serviceContext //------------------------- // is this the same as the parent of the OperationContext? boolean isParent = false; out.writeUTF("serviceContext"); if (operationContext != null) { ServiceContext opctxParent = operationContext.getServiceContext(); if (serviceContext != null) { if (serviceContext.equals(opctxParent)) { // the ServiceContext is the parent of the OperationContext isParent = true; } } } if (serviceContext == null) { out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); } else { out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT); out.writeBoolean(isParent); // only write out the object if it is not the parent if (!isParent) { out.writeObject(serviceContext); } } //--------------------------------------------------------- // axisServiceGroup //--------------------------------------------------------- out.writeUTF("axisServiceGroup"); metaAxisServiceGroup = null; if (axisServiceGroup != null) { metaAxisServiceGroup = new MetaDataEntry(axisServiceGroup.getClass().getName(), axisServiceGroup.getServiceGroupName()); } out.writeObject(metaAxisServiceGroup); //----------------------------- // serviceGroupContextId string //----------------------------- out.writeObject(serviceGroupContextId); //------------------------- // serviceGroupContext //------------------------- // is this the same as the parent of the ServiceContext? isParent = false; out.writeUTF("serviceGroupContext"); if (serviceContext != null) { ServiceGroupContext srvgrpctxParent = (ServiceGroupContext) serviceContext.getParent(); if (serviceGroupContext != null) { if (serviceGroupContext.equals(srvgrpctxParent)) { // the ServiceGroupContext is the parent of the ServiceContext isParent = true; } } } if (serviceGroupContext == null) { out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT); } else { out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT); out.writeBoolean(isParent); // only write out the object if it is not the parent if (!isParent) { out.writeObject(serviceGroupContext); } } //--------------------------------------------------------- // axis message //--------------------------------------------------------- out.writeUTF("axisMessage"); metaAxisMessage = null; if (axisMessage != null) { // This AxisMessage is expected to belong to the AxisOperation // that has already been recorded for this MessageContext. // If an AxisMessage associated with this Messagecontext is // associated with a different AxisOperation, then more // meta information would need to be saved // make sure the axis message has a name associated with it String amTmpName = axisMessage.getName(); if (amTmpName == null) { amTmpName = ExternalizeConstants.EMPTY_MARKER; axisMessage.setName(amTmpName); } // get the element name if there is one QName amTmpElementQName = axisMessage.getElementQName(); String amTmpElemQNameString = null; if (amTmpElementQName != null) { amTmpElemQNameString = amTmpElementQName.toString(); } metaAxisMessage = new MetaDataEntry(axisMessage.getClass().getName(), axisMessage.getName(), amTmpElemQNameString); } out.writeObject(metaAxisMessage); //--------------------------------------------------------- // configuration context //--------------------------------------------------------- // NOTE: Currently, there does not seem to be any // runtime data important to this message context // in the configuration context. // if so, then need to save that runtime data and reconcile // it with the configuration context on the system when // this message context object is restored //--------------------------------------------------------- // session context //--------------------------------------------------------- out.writeObject(sessionContext); //--------------------------------------------------------- // transport //--------------------------------------------------------- //------------------------------ // incomingTransportName string //------------------------------ out.writeObject(incomingTransportName); // TransportInDescription transportIn metaTransportIn = null; if (transportIn != null) { metaTransportIn = new MetaDataEntry(null, transportIn.getName()); } out.writeObject(metaTransportIn); // TransportOutDescription transportOut metaTransportOut = null; if (transportOut != null) { metaTransportOut = new MetaDataEntry(null, transportOut.getName()); } out.writeObject(metaTransportOut); //--------------------------------------------------------- // properties //--------------------------------------------------------- // Write out the local properties on the MessageContext // Don't write out the properties from other hierarchical layers. // (i.e. don't use getProperties()) out.writeUTF("properties"); // write marker out.writeMap(properties); //--------------------------------------------------------- // special data //--------------------------------------------------------- out.writeUTF("selfManagedData"); serializeSelfManagedData(out); //--------------------------------------------------------- // done //--------------------------------------------------------- if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":writeExternal(): completed writing to output stream for " + logCorrelationIDString); } } /** * @return true if the data should be persisted as optimized attachments */ private boolean getPersistOptimized() { boolean persistOptimized = false; if (attachments != null && attachments.getContentIDList().size() > 1) { persistOptimized = true; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) log.trace(getLogIDString() + ":getPersistOptimized(): attachments present; persist optimized"); } if (!persistOptimized) { Object property = getProperty(Configuration.ENABLE_MTOM); if (property != null && JavaUtils.isTrueExplicitly(property)) { persistOptimized = true; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) log.trace(getLogIDString() + ":getPersistOptimized(): ENBABLE_MTOM is set; persist optimized"); } } if (!persistOptimized) { Object property = getProperty(Configuration.ENABLE_SWA); if (property != null && JavaUtils.isTrueExplicitly(property)) { persistOptimized = true; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) log.trace(getLogIDString() + ":getPersistOptimized(): ENBABLE_SWA is set; persist optimized"); } } if (!persistOptimized && LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) log.trace(getLogIDString() + ":getPersistOptimized(): No attachments or attachment settings; persist non-optimized"); return persistOptimized; } /** * Restore the contents of the MessageContext that was * previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // set the flag to indicate that the message context is being // reconstituted and will need to have certain object references // to be reconciled with the current engine setup needsToBeReconciled = true; // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } //--------------------------------------------------------- // object level identifiers //--------------------------------------------------------- // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- // the type of execution flow for the message context FLOW = in.readInt(); // various flags processingFault = in.readBoolean(); paused = in.readBoolean(); outputWritten = in.readBoolean(); newThreadRequired = in.readBoolean(); isSOAP11 = in.readBoolean(); doingREST = in.readBoolean(); doingMTOM = in.readBoolean(); doingSwA = in.readBoolean(); responseWritten = in.readBoolean(); serverSide = in.readBoolean(); long time = in.readLong(); setLastTouchedTime(time); logCorrelationID = (String) in.readObject(); // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { logCorrelationIDString = "[MessageContext: logID=" + getLogCorrelationID() + "]"; log.trace(myClassName + ":readExternal(): reading the input stream for " + getLogIDString()); } //--------------------------------------------------------- // Message // Read the message and attachments //--------------------------------------------------------- envelope = MessageExternalizeUtils.readExternal(in, this, getLogIDString()); //--------------------------------------------------------- // ArrayList executionChain // handler and phase related data //--------------------------------------------------------- // Restore the metadata about each member of the list // and the order of the list. // This metadata will be used to match up with phases // and handlers on the engine. // // Non-null list: // UTF - description string // boolean - active flag // int - current handler index // int - current phase index // int - expected number of entries in the list // not including the last entry marker // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- // the local chain is not enabled until the // list has been reconstituted executionChain = null; currentHandlerIndex = -1; currentPhaseIndex = 0; metaExecutionChain = null; in.readUTF(); boolean gotChain = in.readBoolean(); if (gotChain == ExternalizeConstants.ACTIVE_OBJECT) { metaHandlerIndex = in.readInt(); metaPhaseIndex = in.readInt(); int expectedNumberEntries = in.readInt(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): execution chain: expected number of entries [" + expectedNumberEntries + "]"); } // setup the list metaExecutionChain = new ArrayList(); // process the objects boolean keepGoing = true; int count = 0; while (keepGoing) { // stop when we get to the end-of-list marker // get the object Object tmpObj = in.readObject(); count++; MetaDataEntry mdObj = (MetaDataEntry) tmpObj; // get the class name, then add it to the list String tmpClassNameStr; String tmpQNameAsStr; if (mdObj != null) { tmpClassNameStr = mdObj.getClassName(); if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) { // this is the last entry keepGoing = false; } else { // add the entry to the meta data list metaExecutionChain.add(mdObj); tmpQNameAsStr = mdObj.getQNameAsString(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { String tmpHasList = mdObj.isListEmpty() ? "no children" : "has children"; if (log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data class [" + tmpClassNameStr + "] qname [" + tmpQNameAsStr + "] index [" + count + "] [" + tmpHasList + "]"); } } } } else { // some error occurred keepGoing = false; } } // end while keep going int adjustedNumberEntries = in.readInt(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): adjusted number of entries ExecutionChain [" + adjustedNumberEntries + "] "); } } if ((metaExecutionChain == null) || (metaExecutionChain.isEmpty())) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data for Execution Chain is NULL"); } } //--------------------------------------------------------- // LinkedList executedPhases //--------------------------------------------------------- // Restore the metadata about each member of the list // and the order of the list. // This metadata will be used to match up with phases // and handlers on the engine. // // Non-null list: // UTF - description string // boolean - active flag // int - expected number of entries in the list // not including the last entry marker // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- // the local chain is not enabled until the // list has been reconstituted executedPhases = null; metaExecuted = null; in.readUTF(); boolean gotInExecList = in.readBoolean(); if (gotInExecList == ExternalizeConstants.ACTIVE_OBJECT) { int expectedNumberInExecList = in.readInt(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): executed phases: expected number of entries [" + expectedNumberInExecList + "]"); } // setup the list metaExecuted = new LinkedList(); // process the objects boolean keepGoing = true; int count = 0; while (keepGoing) { // stop when we get to the end-of-list marker // get the object Object tmpObj = in.readObject(); count++; MetaDataEntry mdObj = (MetaDataEntry) tmpObj; // get the class name, then add it to the list String tmpClassNameStr; String tmpQNameAsStr; String tmpHasList = "no list"; if (mdObj != null) { tmpClassNameStr = mdObj.getClassName(); if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) { // this is the last entry keepGoing = false; } else { // add the entry to the meta data list metaExecuted.add(mdObj); tmpQNameAsStr = mdObj.getQNameAsString(); if (!mdObj.isListEmpty()) { tmpHasList = "has list"; } if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data class [" + tmpClassNameStr + "] qname [" + tmpQNameAsStr + "] index [" + count + "] [" + tmpHasList + "]"); } } } else { // some error occurred keepGoing = false; } } // end while keep going int adjustedNumberInExecList = in.readInt(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): adjusted number of entries executedPhases [" + adjustedNumberInExecList + "] "); } } if ((metaExecuted == null) || (metaExecuted.isEmpty())) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data for executedPhases list is NULL"); } } //--------------------------------------------------------- // options //--------------------------------------------------------- in.readUTF(); // Read marker options = (Options) in.readObject(); if (options != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): restored Options [" + options.getLogCorrelationIDString() + "]"); } } //--------------------------------------------------------- // operation //--------------------------------------------------------- // axisOperation is not usable until the meta data has been reconciled axisOperation = null; in.readUTF(); // Read Marker metaAxisOperation = (MetaDataEntry) in.readObject(); // operation context is not usable until it has been activated // NOTE: expect this to be the parent in.readUTF(); // Read marker operationContext = (OperationContext) in.readObject(); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): restored OperationContext [" + operationContext.getLogCorrelationIDString() + "]"); } } //--------------------------------------------------------- // service //--------------------------------------------------------- // axisService is not usable until the meta data has been reconciled axisService = null; in.readUTF(); // Read marker metaAxisService = (MetaDataEntry) in.readObject(); //------------------------- // serviceContextID string //------------------------- serviceContextID = (String) in.readObject(); //------------------------- // serviceContext //------------------------- in.readUTF(); // Read marker boolean servCtxActive = in.readBoolean(); if (servCtxActive == ExternalizeConstants.EMPTY_OBJECT) { // empty object serviceContext = null; } else { // active object boolean isParent = in.readBoolean(); // there's an object to read in if it is not the parent of the operation context if (!isParent) { serviceContext = (ServiceContext) in.readObject(); } else { // the service context is the parent of the operation context // so get it from the operation context during activate serviceContext = null; } } //--------------------------------------------------------- // serviceGroup //--------------------------------------------------------- // axisServiceGroup is not usable until the meta data has been reconciled axisServiceGroup = null; in.readUTF(); // Read marker metaAxisServiceGroup = (MetaDataEntry) in.readObject(); //----------------------------- // serviceGroupContextId string //----------------------------- serviceGroupContextId = (String) in.readObject(); //----------------------------- // serviceGroupContext //----------------------------- in.readUTF(); boolean servGrpCtxActive = in.readBoolean(); if (servGrpCtxActive == ExternalizeConstants.EMPTY_OBJECT) { // empty object serviceGroupContext = null; } else { // active object boolean isParentSGC = in.readBoolean(); // there's an object to read in if it is not the parent of the service group context if (!isParentSGC) { serviceGroupContext = (ServiceGroupContext) in.readObject(); } else { // the service group context is the parent of the service context // so get it from the service context during activate serviceGroupContext = null; } } //--------------------------------------------------------- // axis message //--------------------------------------------------------- // axisMessage is not usable until the meta data has been reconciled axisMessage = null; in.readUTF(); // Read marker metaAxisMessage = (MetaDataEntry) in.readObject(); reconcileAxisMessage = (metaAxisMessage != null); //--------------------------------------------------------- // configuration context //--------------------------------------------------------- // TODO: check to see if there is any runtime data important to this // message context in the configuration context // if so, then need to restore the saved runtime data and reconcile // it with the configuration context on the system when // this message context object is restored //--------------------------------------------------------- // session context //--------------------------------------------------------- sessionContext = (SessionContext) in.readObject(); //--------------------------------------------------------- // transport //--------------------------------------------------------- //------------------------------ // incomingTransportName string //------------------------------ incomingTransportName = (String) in.readObject(); // TransportInDescription transportIn // is not usable until the meta data has been reconciled transportIn = null; metaTransportIn = (MetaDataEntry) in.readObject(); // TransportOutDescription transportOut // is not usable until the meta data has been reconciled transportOut = null; metaTransportOut = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // properties //--------------------------------------------------------- // read local properties in.readUTF(); // Read marker properties = in.readHashMap(); //--------------------------------------------------------- // special data //--------------------------------------------------------- in.readUTF(); // Read marker boolean gotSelfManagedData = in.readBoolean(); if (gotSelfManagedData == ExternalizeConstants.ACTIVE_OBJECT) { selfManagedDataHandlerCount = in.readInt(); if (selfManagedDataListHolder == null) { selfManagedDataListHolder = new ArrayList(); } else { selfManagedDataListHolder.clear(); } for (int i = 0; i < selfManagedDataHandlerCount; i++) { selfManagedDataListHolder.add(in.readObject()); } } //--------------------------------------------------------- // done //--------------------------------------------------------- // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): message context object created for " + getLogIDString()); } } /** * This method checks to see if additional work needs to be * done in order to complete the object reconstitution. * Some parts of the object restored from the readExternal() * cannot be completed until we have a configurationContext * from the active engine. The configurationContext is used * to help this object to plug back into the engine's * configuration and deployment objects. * * @param cc The configuration context object representing the active configuration */ public void activate(ConfigurationContext cc) { // see if there's any work to do if (!needsToBeReconciled) { // return quick return; } // use the supplied configuration context setConfigurationContext(cc); // get the axis configuration AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); // We previously saved metaAxisService; restore it if (metaAxisService != null) { this.setAxisService(ActivateUtils.findService(axisConfig, metaAxisService.getClassName(), metaAxisService.getQNameAsString())); } // We previously saved metaAxisServiceGroup; restore it if (metaAxisServiceGroup != null) { this.setAxisServiceGroup( ActivateUtils.findServiceGroup(axisConfig, metaAxisServiceGroup.getClassName(), metaAxisServiceGroup.getQNameAsString())); } // We previously saved metaAxisOperation; restore it if (metaAxisOperation != null) { AxisService serv = axisService; if (serv != null) { // TODO: check for the empty name this.setAxisOperation(ActivateUtils.findOperation(serv, metaAxisOperation.getClassName(), metaAxisOperation.getQName())); } else { this.setAxisOperation(ActivateUtils.findOperation(axisConfig, metaAxisOperation.getClassName(), metaAxisOperation.getQName())); } } // We previously saved metaAxisMessage; restore it if (metaAxisMessage != null) { AxisOperation op = axisOperation; if (op != null) { // TODO: check for the empty name this.setAxisMessage(ActivateUtils.findMessage(op, metaAxisMessage.getQNameAsString(), metaAxisMessage.getExtraName())); } } //--------------------------------------------------------------------- // operation context //--------------------------------------------------------------------- // this will do a full hierarchy, so do it first // then we can re-use its objects if (operationContext != null) { operationContext.activate(cc); // this will be set as the parent of the message context // after the other context objects have been activated } //--------------------------------------------------------------------- // service context //--------------------------------------------------------------------- if (serviceContext == null) { // get the parent serviceContext of the operationContext if (operationContext != null) { serviceContext = operationContext.getServiceContext(); } } // if we have a service context, make sure it is usable if (serviceContext != null) { // for some reason, the service context might be set differently from // the operation context parent serviceContext.activate(cc); } //--------------------------------------------------------------------- // service group context //--------------------------------------------------------------------- if (serviceGroupContext == null) { // get the parent serviceGroupContext of the serviceContext if (serviceContext != null) { serviceGroupContext = (ServiceGroupContext) serviceContext.getParent(); } } // if we have a service group context, make sure it is usable if (serviceGroupContext != null) { // for some reason, the service group context might be set differently from // the service context parent serviceGroupContext.activate(cc); } //--------------------------------------------------------------------- // other context-related reconciliation //--------------------------------------------------------------------- this.setParent(operationContext); //--------------------------------------------------------------------- // options //--------------------------------------------------------------------- if (options != null) { options.activate(cc); } String tmpID = getMessageID(); String logCorrelationIDString = getLogIDString(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activate(): message ID [" + tmpID + "] for " + logCorrelationIDString); } //--------------------------------------------------------------------- // transports //--------------------------------------------------------------------- // We previously saved metaTransportIn; restore it if (metaTransportIn != null) { QName qin = metaTransportIn.getQName(); TransportInDescription tmpIn = null; try { tmpIn = axisConfig.getTransportIn(qin.getLocalPart()); } catch (Exception exin) { // if a fault is thrown, log it and continue log.trace(logCorrelationIDString + "activate(): exception caught when getting the TransportInDescription [" + qin.toString() + "] from the AxisConfiguration [" + exin.getClass().getName() + " : " + exin.getMessage() + "]"); } if (tmpIn != null) { transportIn = tmpIn; } else { transportIn = null; } } else { transportIn = null; } // We previously saved metaTransportOut; restore it if (metaTransportOut != null) { // TODO : Check if this should really be a QName? QName qout = metaTransportOut.getQName(); TransportOutDescription tmpOut = null; try { tmpOut = axisConfig.getTransportOut(qout.getLocalPart()); } catch (Exception exout) { // if a fault is thrown, log it and continue if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + "activate(): exception caught when getting the TransportOutDescription [" + qout.toString() + "] from the AxisConfiguration [" + exout.getClass().getName() + " : " + exout.getMessage() + "]"); } } if (tmpOut != null) { transportOut = tmpOut; } else { transportOut = null; } } else { transportOut = null; } //------------------------------------------------------- // reconcile the execution chain //------------------------------------------------------- if (metaExecutionChain != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace( logCorrelationIDString + ":activate(): reconciling the execution chain..."); } currentHandlerIndex = metaHandlerIndex; currentPhaseIndex = metaPhaseIndex; executionChain = restoreHandlerList(metaExecutionChain); try { deserializeSelfManagedData(); } catch (Exception ex) { // log the exception if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activate(): *** WARNING *** deserializing the self managed data encountered Exception [" + ex.getClass().getName() + " : " + ex.getMessage() + "]", ex); } } } //------------------------------------------------------- // reconcile the lists for the executed phases //------------------------------------------------------- if (metaExecuted != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activate(): reconciling the executed chain..."); } if (!(executedPhasesReset)) { executedPhases = restoreExecutedList(executedPhases, metaExecuted); } } if (executedPhases == null) { executedPhases = new LinkedList(); } //------------------------------------------------------- // finish up remaining links //------------------------------------------------------- if (operationContext != null) { operationContext.restoreMessageContext(this); } //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; } /** * This method checks to see if additional work needs to be * done in order to complete the object reconstitution. * Some parts of the object restored from the readExternal() * cannot be completed until we have an object that gives us * a view of the active object graph from the active engine. *

    * NOTE: when activating an object, you only need to call * one of the activate methods (activate() or activateWithOperationContext()) * but not both. * * @param operationCtx The operation context object that is a member of the active object graph */ public void activateWithOperationContext(OperationContext operationCtx) { // see if there's any work to do if (!(needsToBeReconciled)) { // return quick return; } String logCorrelationIDString = getLogIDString(); // trace point if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): BEGIN"); } if (operationCtx == null) { // won't be able to finish if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): *** WARNING *** No active OperationContext object is available."); } return; } //--------------------------------------------------------------------- // locate the objects in the object graph //--------------------------------------------------------------------- ConfigurationContext configCtx = operationCtx.getConfigurationContext(); if (configCtx == null) { // won't be able to finish if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): *** WARNING *** No active ConfigurationContext object is available."); } return; } AxisConfiguration axisCfg = configCtx.getAxisConfiguration(); AxisOperation axisOp = operationCtx.getAxisOperation(); ServiceContext serviceCtx = operationCtx.getServiceContext(); ServiceGroupContext serviceGroupCtx = null; AxisService axisSrv = null; AxisServiceGroup axisSG = null; if (serviceCtx != null) { serviceGroupCtx = serviceCtx.getServiceGroupContext(); axisSrv = serviceCtx.getAxisService(); } if (serviceGroupCtx != null) { axisSG = serviceGroupCtx.getDescription(); } //--------------------------------------------------------------------- // link to the objects in the object graph //--------------------------------------------------------------------- setConfigurationContext(configCtx); setAxisOperation(axisOp); setAxisService(axisSrv); setAxisServiceGroup(axisSG); setServiceGroupContext(serviceGroupCtx); setServiceContext(serviceCtx); setOperationContext(operationCtx); //--------------------------------------------------------------------- // reconcile the remaining objects //--------------------------------------------------------------------- // We previously saved metaAxisMessage; restore it if (metaAxisMessage != null) { if (axisOp != null) { // TODO: check for the empty name this.setAxisMessage(ActivateUtils.findMessage(axisOp, metaAxisMessage.getQNameAsString(), metaAxisMessage.getExtraName())); } } //--------------------------------------------------------------------- // options //--------------------------------------------------------------------- if (options != null) { options.activate(configCtx); } String tmpID = getMessageID(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): message ID [" + tmpID + "]"); } //--------------------------------------------------------------------- // transports //--------------------------------------------------------------------- // We previously saved metaTransportIn; restore it if (metaTransportIn != null) { QName qin = metaTransportIn.getQName(); TransportInDescription tmpIn = null; try { tmpIn = axisCfg.getTransportIn(qin.getLocalPart()); } catch (Exception exin) { // if a fault is thrown, log it and continue if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + "activateWithOperationContext(): exception caught when getting the TransportInDescription [" + qin.toString() + "] from the AxisConfiguration [" + exin.getClass().getName() + " : " + exin.getMessage() + "]"); } } if (tmpIn != null) { transportIn = tmpIn; } else { transportIn = null; } } else { transportIn = null; } // We previously saved metaTransportOut; restore it if (metaTransportOut != null) { QName qout = metaTransportOut.getQName(); TransportOutDescription tmpOut = null; try { tmpOut = axisCfg.getTransportOut(qout.getLocalPart()); } catch (Exception exout) { // if a fault is thrown, log it and continue if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + "activateWithOperationContext(): exception caught when getting the TransportOutDescription [" + qout.toString() + "] from the AxisConfiguration [" + exout.getClass().getName() + " : " + exout.getMessage() + "]"); } } if (tmpOut != null) { transportOut = tmpOut; } else { transportOut = null; } } else { transportOut = null; } //------------------------------------------------------- // reconcile the execution chain //------------------------------------------------------- if (metaExecutionChain != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): reconciling the execution chain..."); } currentHandlerIndex = metaHandlerIndex; currentPhaseIndex = metaPhaseIndex; executionChain = restoreHandlerList(metaExecutionChain); try { deserializeSelfManagedData(); } catch (Exception ex) { // log the exception if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): *** WARNING *** deserializing the self managed data encountered Exception [" + ex.getClass().getName() + " : " + ex.getMessage() + "]", ex); } } } //------------------------------------------------------- // reconcile the lists for the executed phases //------------------------------------------------------- if (metaExecuted != null) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): reconciling the executed chain..."); } if (!(executedPhasesReset)) { executedPhases = restoreExecutedList(executedPhases, metaExecuted); } } if (executedPhases == null) { executedPhases = new LinkedList(); } //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":activateWithOperationContext(): END"); } } /** * @param metaDataEntries ArrayList of MetaDataEntry objects * @return ArrayList of Handlers based on our list of handlers from the reconstituted deserialized list, and the existing handlers in the AxisConfiguration object. May return null. */ private ArrayList restoreHandlerList(ArrayList metaDataEntries) { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); ArrayList existingHandlers = null; // TODO: I'm using clone for the ArrayList returned from axisConfig object. // Does it do a deep clone of the Handlers held there? Does it matter? switch (FLOW) { case IN_FLOW: existingHandlers = (ArrayList) axisConfig.getInFlowPhases().clone(); break; case OUT_FLOW: existingHandlers = (ArrayList) axisConfig.getOutFlowPhases().clone(); break; case IN_FAULT_FLOW: existingHandlers = (ArrayList) axisConfig.getInFaultFlowPhases().clone(); break; case OUT_FAULT_FLOW: existingHandlers = (ArrayList) axisConfig.getOutFaultFlowPhases().clone(); break; } existingHandlers = flattenHandlerList(existingHandlers, null); ArrayList handlerListToReturn = new ArrayList(); for (int i = 0; i < metaDataEntries.size(); i++) { Handler handler = (Handler) ActivateUtils .findHandler(existingHandlers, (MetaDataEntry) metaDataEntries.get(i)); if (handler != null) { handlerListToReturn.add(handler); } } return handlerListToReturn; } /** * Using meta data for phases/handlers, create a linked list of actual * phase/handler objects. The created list is composed of the objects * from the base list at the top of the created list followed by the * restored objects. * * @param base Linked list of phase/handler objects * @param metaDataEntries Linked list of MetaDataEntry objects * @return LinkedList of objects or NULL if none available */ private LinkedList restoreExecutedList(LinkedList base, LinkedList metaDataEntries) { if (metaDataEntries == null) { return base; } // get a list of existing handler/phase objects for the restored objects ArrayList tmpMetaDataList = new ArrayList(metaDataEntries); ArrayList existingList = restoreHandlerList(tmpMetaDataList); if ((existingList == null) || (existingList.isEmpty())) { return base; } // set up a list to return LinkedList returnedList = new LinkedList(); if (base != null) { returnedList.addAll(base); } returnedList.addAll(existingList); return returnedList; } /** * Process the list of handlers from the Phase object * into the appropriate meta data. * * @param phase The Phase object containing a list of handlers * @param mdPhase The meta data object associated with the specified Phase object */ private void setupPhaseList(Phase phase, MetaDataEntry mdPhase) { // get the list from the phase object List handlers = phase.getHandlers(); if (handlers.isEmpty()) { // done, make sure there is no list in the given meta data mdPhase.removeList(); return; } // get the metadata on each member of the list int listSize = handlers.size(); if (listSize > 0) { Iterator i = handlers.iterator(); while (i.hasNext()) { Object obj = i.next(); String objClass = obj.getClass().getName(); // start the meta data entry for this object MetaDataEntry mdEntry = new MetaDataEntry(); mdEntry.setClassName(objClass); // get the correct object-specific name String qnameAsString; if (obj instanceof Phase) { // nested condition, the phase object contains another phase! Phase phaseObj = (Phase) obj; qnameAsString = phaseObj.getName(); // add the list of handlers to the meta data setupPhaseList(phaseObj, mdEntry); } else if (obj instanceof Handler) { Handler handlerObj = (Handler) obj; qnameAsString = handlerObj.getName(); } else { // TODO: will there be any other kinds of objects // in the list? qnameAsString = "NULL"; } mdEntry.setQName(qnameAsString); // done with setting up the meta data for the list entry // so add it to the parent mdPhase.addToList(mdEntry); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(getLogIDString() + ":setupPhaseList(): list entry class [" + objClass + "] qname [" + qnameAsString + "]"); } } // end while entries in list } else { // a list with no entries // done, make sure there is no list in the given meta data mdPhase.removeList(); } } /** * Return a Read-Only copy of this message context * that has been extracted from the object * hierachy. In other words, the message context * copy does not have links to the object graph. *

    * NOTE: The copy shares certain objects with the original. * The intent is to use the copy to read values but not * modify them, especially since the copy is not part * of the normal *Context and Axis* object graph. * * @return A copy of the message context that is not in the object graph */ public MessageContext extractCopyMessageContext() { MessageContext copy = new MessageContext(); String logCorrelationIDString = getLogIDString(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":extractCopyMessageContext(): based on " + logCorrelationIDString + " into copy " + copy.getLogIDString()); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- copy.setFLOW(FLOW); copy.setProcessingFault(processingFault); copy.setPaused(paused); copy.setOutputWritten(outputWritten); copy.setNewThreadRequired(newThreadRequired); copy.setDoingREST(doingREST); copy.setDoingMTOM(doingMTOM); copy.setDoingSwA(doingSwA); copy.setResponseWritten(responseWritten); copy.setServerSide(serverSide); copy.setLastTouchedTime(getLastTouchedTime()); //--------------------------------------------------------- // message //--------------------------------------------------------- try { copy.setEnvelope(envelope); } catch (Exception ex) { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(logCorrelationIDString + ":extractCopyMessageContext(): Exception caught when setting the copy with the envelope", ex); } } copy.setAttachmentMap(attachments); copy.setIsSOAP11Explicit(isSOAP11); //--------------------------------------------------------- // ArrayList executionChain // handler and phase related data //--------------------------------------------------------- copy.setExecutionChain(executionChain); // the setting of the execution chain is actually a reset // so copy the indices after putting in the execution chain copy.setCurrentHandlerIndex(currentHandlerIndex); copy.setCurrentPhaseIndex(currentPhaseIndex); //--------------------------------------------------------- // LinkedList executedPhases //--------------------------------------------------------- copy.setExecutedPhasesExplicit(executedPhases); //--------------------------------------------------------- // options //--------------------------------------------------------- copy.setOptionsExplicit(options); //--------------------------------------------------------- // axis operation //--------------------------------------------------------- copy.setAxisOperation(null); //--------------------------------------------------------- // operation context //--------------------------------------------------------- copy.setOperationContext(null); //--------------------------------------------------------- // axis service //--------------------------------------------------------- copy.setAxisService(null); //------------------------- // serviceContextID string //------------------------- copy.setServiceContextID(serviceContextID); //------------------------- // serviceContext //------------------------- copy.setServiceContext(null); //--------------------------------------------------------- // serviceGroup //--------------------------------------------------------- copy.setServiceGroupContext(null); //----------------------------- // serviceGroupContextId string //----------------------------- copy.setServiceGroupContextId(serviceGroupContextId); //--------------------------------------------------------- // axis message //--------------------------------------------------------- copy.setAxisMessage(axisMessage); //--------------------------------------------------------- // configuration context //--------------------------------------------------------- copy.setConfigurationContext(configurationContext); //--------------------------------------------------------- // session context //--------------------------------------------------------- copy.setSessionContext(sessionContext); //--------------------------------------------------------- // transport //--------------------------------------------------------- //------------------------------ // incomingTransportName string //------------------------------ copy.setIncomingTransportName(incomingTransportName); copy.setTransportIn(transportIn); copy.setTransportOut(transportOut); //--------------------------------------------------------- // properties //--------------------------------------------------------- // Only set the local properties (i.e. don't use getProperties()) copy.setProperties(properties); //--------------------------------------------------------- // special data //--------------------------------------------------------- copy.setSelfManagedDataMapExplicit(selfManagedDataMap); //--------------------------------------------------------- // done //--------------------------------------------------------- return copy; } //------------------------------------------------------------------------ // additional setter methods needed to copy the message context object //------------------------------------------------------------------------ public void setIsSOAP11Explicit(boolean t) { isSOAP11 = t; } public void setExecutedPhasesExplicit(LinkedList inb) { executedPhases = inb; } public void setSelfManagedDataMapExplicit(LinkedHashMap map) { selfManagedDataMap = map; } public void setOptionsExplicit(Options op) { this.options = op; } /** * Trace a warning message, if needed, indicating that this * object needs to be activated before accessing certain fields. * * @param methodname The method where the warning occurs */ private void checkActivateWarning(String methodname) { if (needsToBeReconciled) { if (LoggingControl.debugLoggingAllowed && log.isWarnEnabled()) { log.warn(getLogIDString() + ":" + methodname + "(): ****WARNING**** " + myClassName + ".activate(configurationContext) needs to be invoked."); } } } public ConfigurationContext getRootContext() { return configurationContext; } public boolean isFault() { try { return getEnvelope().hasFault(); } catch (Exception e) { // TODO: What should we be doing here? No envelope certainly seems bad.... return false; } } /** * Obtain the Exception which caused the processing chain to halt. * @return null, or an Exception. */ public Exception getFailureReason() { return failureReason; } /** * Set the failure reason. Only AxisEngine should ever do this. * * @param failureReason an Exception which caused processing to halt. */ public void setFailureReason(Exception failureReason) { this.failureReason = failureReason; } } ./src/org/apache/axis2/context/AbstractContext.java0000664000175000017500000003305311767656530021475 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axis2.AxisFault; import org.apache.axis2.clustering.ClusterManager; import org.apache.axis2.clustering.context.Replicator; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; /** * This is the top most level of the Context hierarchy and is a bag of properties. */ public abstract class AbstractContext { private static final Log log = LogFactory.getLog(AbstractContext.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled(); /** * Property used to indicate copying of properties is needed by context. */ public static final String COPY_PROPERTIES = "CopyProperties"; protected long lastTouchedTime; protected transient AbstractContext parent; protected transient Map properties; private transient Map propertyDifferences; protected AbstractContext(AbstractContext parent) { this.parent = parent; } protected AbstractContext() { } /** * @return Returns the parent of this context. */ public AbstractContext getParent() { return parent; } /** * @param context * @return true if the context is an ancestor */ public boolean isAncestor(AbstractContext context) { if (context == null) { return false; } for (AbstractContext ancestor = getParent(); ancestor != null; ancestor = ancestor.getParent()) { if (ancestor == context) { return true; } } return false; } /** * @return The properties * @deprecated Use {@link #getPropertyNames()}, {@link #getProperty(String)}, * {@link #setProperty(String, Object)} & {@link #removeProperty(String)}instead. */ public Map getProperties() { if (this.properties == null) { this.properties = new HashMap(); } return properties; } /** * An iterator over a collection of String objects, which are the * keys in the properties object. * * @return Iterator over a collection of keys */ public Iterator getPropertyNames() { if (properties == null) { properties = new HashMap(); } return properties.keySet().iterator(); } /** * Retrieves an object given a key. * * @param key - if not found, will return null * @return Returns the property. */ public Object getProperty(String key) { Object obj = properties == null ? null : properties.get(key); if (obj!=null) { // Assume that a property which is read may be updated. // i.e. The object pointed to by 'value' may be modified after it is read addPropertyDifference(key, obj, false); } else if (parent!=null) { obj = parent.getProperty(key); } return obj; } /** * Retrieves an object given a key. Only searches at this level * i.e. getLocalProperty on MessageContext does not look in * the OperationContext properties map if a local result is not * found. * * @param key - if not found, will return null * @return Returns the property. */ public Object getLocalProperty(String key) { Object obj = properties == null ? null : properties.get(key); if ((obj == null) && (parent != null)) { // This is getLocalProperty() don't search the hierarchy. } else { // Assume that a property is which is read may be updated. // i.e. The object pointed to by 'value' may be modified after it is read addPropertyDifference(key, obj, false); } return obj; } /** * Retrieves an object given a key. The retrieved property will not be replicated to * other nodes in the clustered scenario. * * @param key - if not found, will return null * @return Returns the property. */ public Object getPropertyNonReplicable(String key) { Object obj = properties == null ? null : properties.get(key); if ((obj == null) && (parent != null)) { obj = parent.getPropertyNonReplicable(key); } return obj; } /** * Store a property in this context * * @param key * @param value */ public void setProperty(String key, Object value) { if (this.properties == null) { this.properties = new HashMap(); } properties.put(key, value); addPropertyDifference(key, value, false); if (DEBUG_ENABLED) { debugPropertySet(key, value); } } private void addPropertyDifference(String key, Object value, boolean isRemoved) { if (!needPropertyDifferences()) { return; } // Narrowed the synchronization so that we only wait // if a property difference is added. synchronized(this) { // Lazizly create propertyDifferences map if (propertyDifferences == null) { propertyDifferences = new HashMap(); } propertyDifferences.put(key, new PropertyDifference(key, value, isRemoved)); } } /** * @return true if we need to store property differences for this * context in this scenario. */ private boolean needPropertyDifferences() { // Don't store property differences if there are no // cluster members. ConfigurationContext cc = getRootContext(); if (cc == null) { return false; } // Add the property differences only if Context replication is enabled, // and there are members in the cluster ClusterManager clusterManager = cc.getAxisConfiguration().getClusterManager(); if (clusterManager == null || clusterManager.getContextManager() == null) { return false; } return true; } /** * Store a property in this context. * But these properties should not be replicated when Axis2 is clustered. * * @param key * @param value */ public void setNonReplicableProperty(String key, Object value) { if (this.properties == null) { this.properties = new HashMap(); } properties.put(key, value); } /** * Remove a property. Only properties at this level will be removed. * Properties of the parents cannot be removed using this method. * * @param key */ public synchronized void removeProperty(String key) { if(properties == null){ return; } Object value = properties.get(key); if (value != null) { if (properties != null) { properties.remove(key); } addPropertyDifference(key, value, true); } } /** * Remove a property. Only properties at this level will be removed. * Properties of the parents cannot be removed using this method. * The removal of the property will not be replicated when Axis2 is clustered. * * @param key */ public synchronized void removePropertyNonReplicable(String key) { if (properties != null) { properties.remove(key); } } /** * Get the property differences since the last transmission by the clustering * mechanism * * @return The property differences */ public synchronized Map getPropertyDifferences() { if (propertyDifferences == null) { propertyDifferences = new HashMap(); } return propertyDifferences; } /** * Once the clustering mechanism transmits the property differences, * it should call this method to avoid retransmitting stuff that has already * been sent. */ public synchronized void clearPropertyDifferences() { if (propertyDifferences != null) { propertyDifferences.clear(); } } /** * @param context */ public void setParent(AbstractContext context) { parent = context; } /** * This will set the properties to the context. But in setting that one may need to "copy" all * the properties from the source properties to the target properties. To enable this we introduced * a property ({@link #COPY_PROPERTIES}) so that if set to true, this code * will copy the whole thing, without just referencing to the source. * * @param properties */ public void setProperties(Map properties) { if (properties == null) { this.properties = null; } else { Boolean copyProperties = ((Boolean) properties.get(COPY_PROPERTIES)); if ((copyProperties != null) && copyProperties.booleanValue()) { mergeProperties(properties); } else { if (this.properties != properties) { if (DEBUG_ENABLED) { for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext();) { Entry entry = (Entry) iterator.next(); debugPropertySet((String) entry.getKey(), entry.getValue()); } } } this.properties = properties; } } } /** * This will do a copy of the given properties to the current properties * table. * * @param props The table of properties to copy */ public void mergeProperties(Map props) { if (props != null) { if (this.properties == null) { this.properties = new HashMap(); } for (Iterator iterator = props.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); Object value = props.get(key); this.properties.put(key, value); if (DEBUG_ENABLED) { debugPropertySet((String) key, value); } } } } /** * ServiceContext and ServiceGroupContext are not getting automatically garbage collected. And there * is no specific way for some one to go and make it garbage collectible. * So the current solution is to make them time out. So the logic is that, there is a timer task * in each and every service group which will check for the last touched time. And if it has not * been touched for some time, the timer task will remove it from the memory. * The touching logic happens like this. Whenever there is a call to addMessageContext in the operationContext * it will go and update operationCOntext -> serviceContext -> serviceGroupContext. */ protected void touch() { lastTouchedTime = System.currentTimeMillis(); if (parent != null) { parent.touch(); } } public long getLastTouchedTime() { return lastTouchedTime; } public void setLastTouchedTime(long t) { lastTouchedTime = t; } public void flush() throws AxisFault { Replicator.replicate(this); } public abstract ConfigurationContext getRootContext(); /** * Debug for for property key and value. * @param key * @param value */ private void debugPropertySet(String key, Object value) { if (DEBUG_ENABLED) { String className = (value == null) ? "null" : value.getClass().getName(); String classloader = "null"; if(value != null) { ClassLoader cl = Utils.getObjectClassLoader(value); if(cl != null) { classloader = cl.toString(); } } String valueText = (value instanceof String) ? value.toString() : null; String identity = getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)); log.debug("=================="); log.debug(" Property set on object " + identity); log.debug(" Key =" + key); if (valueText != null) { log.debug(" Value =" + valueText); } log.debug(" Value Class = " + className); log.debug(" Value Classloader = " + classloader); if (this.DEBUG_CALLSTACK_ON_SET) { log.debug( "Call Stack = " + JavaUtils.callStackToString()); } log.debug("=================="); } } } ./src/org/apache/axis2/context/SessionContext.java0000664000175000017500000002564211767656530021362 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axis2.AxisFault; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.DependencyManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * All the engine components are stateless across the executions and all the states should be kept in the * Contexts, there are three context Global, Session and Message. */ public class SessionContext extends AbstractContext implements Externalizable, SafeSerializable { /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -1100610673067568556L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; // TODO: investigate whether these collections need to be saved private transient Map serviceContextMap = new HashMap(); private transient Map serviceGroupContextMap = new HashMap(); private String cookieID; private static final Log log = LogFactory.getLog(SessionContext.class); private static final String myClassName = "SessionContext"; // current time out interval is 30 secs. Need to make this configurable public long sessionContextTimeoutInterval = 30 * 1000; /** * @param parent */ public SessionContext(AbstractContext parent) { super(parent); } public SessionContext() { } public void init(AxisConfiguration axisConfiguration) throws AxisFault { } public ServiceContext getServiceContext(AxisService axisService) { return (ServiceContext) serviceContextMap.get(axisService.getName()); } public void addServiceContext(ServiceContext serviceContext) { serviceContextMap.put(serviceContext.getAxisService().getName(), serviceContext); } public void addServiceGroupContext(ServiceGroupContext serviceGroupContext) { String serviceGroupID = serviceGroupContext.getDescription().getServiceGroupName(); serviceGroupContextMap.put(serviceGroupID, serviceGroupContext); } public ServiceGroupContext getServiceGroupContext(String serviceGroupID) { return (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupID); } public String getCookieID() { return cookieID; } public void setCookieID(String cookieID) { this.cookieID = cookieID; } /** * ServiceContext and ServiceGroupContext are not getting automatically garbage collectible. And there * is no specific way for some one to go and make it garbage collectable. * So the current solution is to make them time out. So the logic is that, there is a timer task * in each and every service group which will check for the last touched time. And if it has not * been touched for some time, the timer task will remove it from the memory. * The touching logic happens like this. Whenever there is a call to addMessageContext in the operationContext * it will go and update operationCOntext -> serviceContext -> serviceGroupContext. */ public void touch() { lastTouchedTime = new Date().getTime(); if (parent != null) { parent.touch(); } } public long getLastTouchedTime() { return lastTouchedTime; } public Iterator getServiceGroupContext() { if (serviceGroupContextMap != null) { if (serviceGroupContextMap.isEmpty()) { return null; } return serviceGroupContextMap.values().iterator(); } else { return null; } } protected void finalize() throws Throwable { super.finalize(); if (serviceGroupContextMap != null && !serviceGroupContextMap.isEmpty()) { Iterator valuse = serviceGroupContextMap.values().iterator(); while (valuse.hasNext()) { ServiceGroupContext serviceGroupContext = (ServiceGroupContext) valuse.next(); cleanupServiceContextes(serviceGroupContext); } } } private void cleanupServiceContextes(ServiceGroupContext serviceGroupContext) { Iterator serviceContecxtes = serviceGroupContext.getServiceContexts(); while (serviceContecxtes.hasNext()) { ServiceContext serviceContext = (ServiceContext) serviceContecxtes.next(); DependencyManager.destroyServiceObject(serviceContext); } } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

    * NOTE: Transient fields and static fields are not saved. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // write out contents of this object // NOTES: For each item, where appropriate, // write out the following information, IN ORDER: // the class name // the active or empty flag // the data length, if appropriate // the data //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeLong(getLastTouchedTime()); out.writeLong(sessionContextTimeoutInterval); out.writeObject(cookieID); //--------------------------------------------------------- // properties //--------------------------------------------------------- out.writeMap(getProperties()); //--------------------------------------------------------- // "nested" //--------------------------------------------------------- out.writeObject(parent); } /** * Restore the contents of the MessageContext that was * previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- long time = in.readLong(); setLastTouchedTime(time); sessionContextTimeoutInterval = in.readLong(); cookieID = (String) in.readObject(); //--------------------------------------------------------- // properties //--------------------------------------------------------- properties = in.readHashMap(); //--------------------------------------------------------- // "nested" //--------------------------------------------------------- // parent parent = (AbstractContext) in.readObject(); //--------------------------------------------------------- // done //--------------------------------------------------------- serviceContextMap = new HashMap(); serviceGroupContextMap = new HashMap(); } public ConfigurationContext getRootContext() { // Session Context does not live within the hierarchy return null; } } ./src/org/apache/axis2/context/ConfigurationContext.java0000664000175000017500000010326311767656530022542 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.clustering.ClusterManager; import org.apache.axis2.clustering.ClusteringConstants; import org.apache.axis2.clustering.configuration.ConfigurationManager; import org.apache.axis2.clustering.context.ContextManager; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.DependencyManager; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.threadpool.ThreadFactory; import org.apache.axis2.util.threadpool.ThreadPool; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.security.PrivilegedAction; /** *

    Axis2 states are held in two information models, called description hierarchy * and context hierarchy. Description hierarchy hold deployment configuration * and it's values does not change unless deployment configuration change occurs * where Context hierarchy hold run time information. Both hierarchies consists * four levels, Global, Service Group, Operation and Message. Please look at * "Information Model" section of "Axis2 Architecture Guide" for more information.

    *

    *

    Configuration Context hold Global level run-time information. This allows * same configurations to be used by two Axis2 instances and most Axis2 wide * configurations can changed by setting name value pairs of the configurationContext. * This hold all OperationContexts, ServiceGroups, Sessions, and ListenerManager. */ public class ConfigurationContext extends AbstractContext { private static final Log log = LogFactory.getLog(ConfigurationContext.class); /** * Map containing MessageID to * OperationContext mapping. */ private final ConcurrentHashMap operationContextMap = new ConcurrentHashMap(); private Hashtable serviceGroupContextMap = new Hashtable(); private Hashtable applicationSessionServiceGroupContexts = new Hashtable(); private AxisConfiguration axisConfiguration; private ThreadFactory threadPool; //To keep TransportManager instance private ListenerManager listenerManager; // current time out interval is 30 secs. Need to make this configurable private long serviceGroupContextTimoutInterval = 30 * 1000; //To specify url mapping for services private String contextRoot; private String servicePath; private String cachedServicePath = null; protected List contextListeners; /** * Constructor * @param axisConfiguration - AxisConfiguration for which to create a context */ public ConfigurationContext(AxisConfiguration axisConfiguration) { super(null); this.axisConfiguration = axisConfiguration; initConfigContextTimeout(axisConfiguration); } private void initConfigContextTimeout(AxisConfiguration axisConfiguration) { Parameter parameter = axisConfiguration .getParameter(Constants.Configuration.CONFIG_CONTEXT_TIMOUT_INTERVAL); if (parameter != null) { Object value = parameter.getValue(); if (value != null && value instanceof String) { serviceGroupContextTimoutInterval = Integer.parseInt((String) value); } } } /** * Initializes the ClusterManager for this ConfigurationContext * * @throws AxisFault */ public void initCluster() throws AxisFault { ClusterManager clusterManager = axisConfiguration.getClusterManager(); if (clusterManager != null) { ContextManager contextManager = clusterManager.getContextManager(); if (contextManager != null) { contextManager.setConfigurationContext(this); } ConfigurationManager configManager = clusterManager.getConfigurationManager(); if (configManager != null) { configManager.setConfigurationContext(this); } if (shouldClusterBeInitiated(clusterManager)) { clusterManager.setConfigurationContext(this); clusterManager.init(); } } } private static boolean shouldClusterBeInitiated(ClusterManager clusterManager) { Parameter param = clusterManager.getParameter(ClusteringConstants.AVOID_INITIATION_KEY); return !(param != null && JavaUtils.isTrueExplicitly(param.getValue())); } /** * Inform any listeners of a new context being created * * @param context the just-created subcontext */ void contextCreated(AbstractContext context) { if (contextListeners == null) { return; } for (Iterator iter = contextListeners.iterator(); iter.hasNext();) { ContextListener listener = (ContextListener) iter.next(); listener.contextCreated(context); } } /** * Inform any listeners of a context being removed * * @param context the just-created subcontext */ void contextRemoved(AbstractContext context) { if (contextListeners == null) { return; } for (Iterator iter = contextListeners.iterator(); iter.hasNext();) { ContextListener listener = (ContextListener) iter.next(); listener.contextRemoved(context); } } /** * Register a {@link ContextListener} to be notified of all sub-context events. * * @param contextListener A ContextListener * @see #removeContextListener */ public void addContextListener(ContextListener contextListener) { if (contextListeners == null) { contextListeners = new ArrayList(); } contextListeners.add(contextListener); } /** * Remove an already registered {@link ContextListener} * * @param contextListener A ContextListener * @see #addContextListener */ public void removeContextListener(ContextListener contextListener) { if (contextListeners != null) { contextListeners.remove(contextListener); } } /** * Searches for a ServiceGroupContext in the map with given id as the key. *

         * If(key != null && found)
         * check for a service context for the intended service.
         * if (!found)
         * create one and hook up to ServiceGroupContext
         * else
         * create new ServiceGroupContext with the given key or if key is null with a new key
         * create a new service context for the service
         * 
    * * @param messageContext : MessageContext * @throws AxisFault : If something goes wrong */ public void fillServiceContextAndServiceGroupContext(MessageContext messageContext) throws AxisFault { // by this time service group context id must have a value. Either from transport or from addressing ServiceGroupContext serviceGroupContext; ServiceContext serviceContext = messageContext.getServiceContext(); AxisService axisService = messageContext.getAxisService(); if (serviceContext == null) { String scope = axisService.getScope(); if (Constants.SCOPE_APPLICATION.equals(scope)) { String serviceGroupName = axisService.getAxisServiceGroup().getServiceGroupName(); serviceGroupContext = (ServiceGroupContext) applicationSessionServiceGroupContexts.get( serviceGroupName); if (serviceGroupContext == null) { AxisServiceGroup axisServiceGroup = messageContext.getAxisServiceGroup(); if (axisServiceGroup == null) { axisServiceGroup = axisService.getAxisServiceGroup(); messageContext.setAxisServiceGroup(axisServiceGroup); } ConfigurationContext cfgCtx = messageContext.getConfigurationContext(); serviceGroupContext = cfgCtx.createServiceGroupContext(axisServiceGroup); applicationSessionServiceGroupContexts .put(serviceGroupName, serviceGroupContext); } messageContext.setServiceGroupContext(serviceGroupContext); messageContext.setServiceContext(serviceGroupContext.getServiceContext(axisService)); } else if (Constants.SCOPE_SOAP_SESSION.equals(scope)) { //cleaning the session cleanupServiceGroupContexts(); String serviceGroupContextId = messageContext.getServiceGroupContextId(); if (serviceGroupContextId != null) { serviceGroupContext = getServiceGroupContextFromSoapSessionTable(serviceGroupContextId, messageContext); if (serviceGroupContext == null) { // TODO: Adding this code so that requests to services deployed in soapsession scope will work // TODO: However, soapsession functionality is still broken serviceGroupContext = new ServiceGroupContext(this, axisService.getAxisServiceGroup()); serviceGroupContext.setId(serviceGroupContextId); addServiceGroupContextIntoSoapSessionTable(serviceGroupContext); // throw new AxisFault("Unable to find corresponding context" + // " for the serviceGroupId: " + serviceGroupContextId); } } else { AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup(); serviceGroupContext = createServiceGroupContext(axisServiceGroup); serviceContext = serviceGroupContext.getServiceContext(axisService); // set the serviceGroupContextID serviceGroupContextId = UUIDGenerator.getUUID(); serviceGroupContext.setId(serviceGroupContextId); messageContext.setServiceGroupContextId(serviceGroupContextId); addServiceGroupContextIntoSoapSessionTable(serviceGroupContext); } messageContext.setServiceGroupContext(serviceGroupContext); messageContext.setServiceContext(serviceGroupContext.getServiceContext(axisService)); } else if (Constants.SCOPE_REQUEST.equals(scope)) { AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup(); serviceGroupContext = createServiceGroupContext(axisServiceGroup); messageContext.setServiceGroupContext(serviceGroupContext); serviceContext = serviceGroupContext.getServiceContext(axisService); messageContext.setServiceContext(serviceContext); } } if (messageContext.getOperationContext() != null) { messageContext.getOperationContext().setParent(serviceContext); } } /** * Registers a OperationContext with a given message ID. * If the given message id already has a registered operation context, * no change is made and the method returns false. * * @param messageID * @param mepContext */ public boolean registerOperationContext(String messageID, OperationContext mepContext) { return registerOperationContext(messageID, mepContext, false); } /** * Registers a OperationContext with a given message ID. * If the given message id already has a registered operation context, * no change is made unless the override flag is set. * * @param messageID * @param mepContext * @param override */ public boolean registerOperationContext(String messageID, OperationContext mepContext, boolean override) { if(messageID == null){ if(log.isDebugEnabled()){ log.debug("messageID is null. Returning false"); } return false; } boolean alreadyInMap = false; mepContext.setKey(messageID); if(override){ operationContextMap.put(messageID, mepContext); }else{ Object previous = operationContextMap.putIfAbsent(messageID, mepContext); alreadyInMap = (previous!=null); } if (log.isDebugEnabled()) { log.debug("registerOperationContext ("+override+"): "+ mepContext+" with key: "+messageID); HashMap msgContextMap = mepContext.getMessageContexts(); Iterator msgContextIterator = msgContextMap.values().iterator(); while (msgContextIterator.hasNext()) { MessageContext msgContext = (MessageContext)msgContextIterator.next(); log.debug("msgContext: "+msgContext+" action: "+msgContext.getWSAAction()); } } return (!alreadyInMap || override); } /** * Unregisters the operation context associated with the given messageID * * @param key */ public void unregisterOperationContext(String key) { if(key == null){ if(log.isDebugEnabled()){ log.debug("key is null."); } }else{ OperationContext opCtx = (OperationContext) operationContextMap.remove(key); contextRemoved(opCtx); } } public boolean isAnyOperationContextRegistered(){ return !operationContextMap.isEmpty(); } /** * Adds the given ServiceGroupContext into the SOAP session table * * @param serviceGroupContext ServiceGroup Context to add */ public void addServiceGroupContextIntoSoapSessionTable( ServiceGroupContext serviceGroupContext) { String id = serviceGroupContext.getId(); serviceGroupContextMap.put(id, serviceGroupContext); serviceGroupContext.touch(); serviceGroupContext.setParent(this); // this is the best time to clean up the SGCtxts since are not being used anymore cleanupServiceGroupContexts(); } /** * Adds the given ServiceGroupContext into the Application Scope table * @param serviceGroupContext The Service Group Context to add */ public void addServiceGroupContextIntoApplicationScopeTable (ServiceGroupContext serviceGroupContext) { if (applicationSessionServiceGroupContexts == null) { applicationSessionServiceGroupContexts = new Hashtable(); } applicationSessionServiceGroupContexts.put( serviceGroupContext.getDescription().getServiceGroupName(), serviceGroupContext); } /** * Deploy a service to the embedded AxisConfiguration, and initialize it. * * @param service service to deploy * @throws AxisFault if there's a problem */ public void deployService(AxisService service) throws AxisFault { axisConfiguration.addService(service); if (Constants.SCOPE_APPLICATION.equals(service.getScope())) { ServiceGroupContext sgc = createServiceGroupContext(service.getAxisServiceGroup()); DependencyManager.initService(sgc); } } /** * Returns the AxisConfiguration * @return Returns AxisConfiguration */ public AxisConfiguration getAxisConfiguration() { return axisConfiguration; } /** * Gets a OperationContext given a Message ID. * * @return Returns OperationContext OperationContext * @param id */ public OperationContext getOperationContext(String id) { OperationContext opCtx = (OperationContext) this.operationContextMap.get(id); return opCtx; } /** * Finds the OperationContext given the Operation name, Service Name, and ServiceGroupName * * @param operationName - OperationName to find * @param serviceName - ServiceName to find * @param serviceGroupName - ServiceGroupName to find * @return Returns OperationContext OperationContext */ public OperationContext findOperationContext(String operationName, String serviceName, String serviceGroupName) { if (operationName == null) { return null; } if (serviceName == null) { return null; } // group name is not necessarily a prereq // but if the group name is non-null, then it has to match Iterator it = operationContextMap.values().iterator(); while (it.hasNext()) { OperationContext value = (OperationContext) it.next(); String valueOperationName; String valueServiceName; String valueServiceGroupName; if (value != null) { valueOperationName = value.getOperationName(); valueServiceName = value.getServiceName(); valueServiceGroupName = value.getServiceGroupName(); if ((valueOperationName != null) && (valueOperationName.equals(operationName))) { if ((valueServiceName != null) && (valueServiceName.equals(serviceName))) { if ((valueServiceGroupName != null) && (serviceGroupName != null) && (valueServiceGroupName.equals(serviceGroupName))) { // match return value; } // or, both need to be null if ((valueServiceGroupName == null) && (serviceGroupName == null)) { // match return value; } } } } } // if we got here, we did not find an operation context // that fits the criteria return null; } /** * Create a MessageContext, and notify any registered ContextListener. * * @return a new MessageContext */ public MessageContext createMessageContext() { MessageContext msgCtx = new MessageContext(this); contextCreated(msgCtx); return msgCtx; } /** * Create a ServiceGroupContext for the specified service group, and notify any * registered ContextListener. * * @param serviceGroup an AxisServiceGroup * @return a new ServiceGroupContext */ public ServiceGroupContext createServiceGroupContext(AxisServiceGroup serviceGroup) { ServiceGroupContext sgCtx = new ServiceGroupContext(this, serviceGroup); contextCreated(sgCtx); return sgCtx; } /** * Allows users to resolve the path relative to the root directory. * * @param path * @return */ public File getRealPath(String path) { URL repository = axisConfiguration.getRepository(); if (repository != null) { File repo = new File(repository.getFile()); return new File(repo, path); } return null; } /** * Retrieve the ServiceGroupContext from the SOAP session table * * @param serviceGroupContextId Service Group Context ID to search on * @param msgContext Message Context to search on * @return Returns a ServiceGroupContext * @throws AxisFault if ServiceGroupContext cannot be found */ public ServiceGroupContext getServiceGroupContextFromSoapSessionTable( String serviceGroupContextId, MessageContext msgContext) throws AxisFault { ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupContextId); if (serviceGroupContext != null) { serviceGroupContext.touch(); return serviceGroupContext; } else { throw new AxisFault("Unable to find corresponding context" + " for the serviceGroupId: " + serviceGroupContextId); } } /** * Returns a ServiceGroupContext object associated * with the specified ID from the internal table. * * @param serviceGroupCtxId The ID string associated with the ServiceGroupContext object * @return The ServiceGroupContext object, or null if not found */ public ServiceGroupContext getServiceGroupContext(String serviceGroupCtxId) { if (serviceGroupCtxId == null) { // Hashtables require non-null key-value pairs return null; } ServiceGroupContext serviceGroupContext = null; if (serviceGroupContextMap != null) { serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupCtxId); if (serviceGroupContext != null) { serviceGroupContext.touch(); } else { serviceGroupContext = (ServiceGroupContext) applicationSessionServiceGroupContexts.get(serviceGroupCtxId); if (serviceGroupContext != null) { serviceGroupContext.touch(); } } } return serviceGroupContext; } /** * Gets all service groups in the system. * * @return Returns hashmap of ServiceGroupContexts. */ public String[] getServiceGroupContextIDs() { String[] ids = new String[serviceGroupContextMap.size() + applicationSessionServiceGroupContexts.size()]; int index = 0; for (Iterator iter = serviceGroupContextMap.keySet().iterator(); iter.hasNext();) { ids[index] = (String) iter.next(); index++; } for (Iterator iter = applicationSessionServiceGroupContexts.keySet().iterator(); iter.hasNext();) { ids[index] = (String) iter.next(); index++; } return ids; } /** * @return The ServiceGroupContexts * @deprecated Use {@link #getServiceGroupContextIDs} & {@link #getServiceGroupContext(String)} */ public Hashtable getServiceGroupContexts() { return serviceGroupContextMap; } /** * Returns the thread factory. * * @return Returns configuration specific thread pool */ public ThreadFactory getThreadPool() { if (threadPool == null) { threadPool = new ThreadPool(); } return threadPool; } /** * Set the AxisConfiguration to the specified configuration * * @param configuration */ public void setAxisConfiguration(AxisConfiguration configuration) { axisConfiguration = configuration; } /** * Sets the thread factory. * * @param pool The thread pool * @throws AxisFault If a thread pool has already been set */ public void setThreadPool(ThreadFactory pool) throws AxisFault { if (threadPool == null) { threadPool = pool; } else { throw new AxisFault(Messages.getMessage("threadpoolset")); } } /** * Remove a ServiceGroupContext * * @param serviceGroupContextId The ID of the ServiceGroupContext */ public void removeServiceGroupContext(String serviceGroupContextId) { if (serviceGroupContextMap == null) { return; } ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupContextId); serviceGroupContextMap.remove(serviceGroupContextId); cleanupServiceContexts(serviceGroupContext); } private void cleanupServiceGroupContexts() { if (serviceGroupContextMap == null) { return; } long currentTime = new Date().getTime(); synchronized (serviceGroupContextMap) { for (Iterator sgCtxtMapKeyIter = serviceGroupContextMap.keySet().iterator(); sgCtxtMapKeyIter.hasNext();) { String sgCtxtId = (String) sgCtxtMapKeyIter.next(); ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(sgCtxtId); if ((currentTime - serviceGroupContext.getLastTouchedTime()) > getServiceGroupContextTimoutInterval()) { sgCtxtMapKeyIter.remove(); cleanupServiceContexts(serviceGroupContext); contextRemoved(serviceGroupContext); } } } } /** * Retrieve the ListenerManager * * @return Returns the ListenerManager */ public ListenerManager getListenerManager() { return listenerManager; } /** * Set the TransportManager to the given ListenerManager * * @param listenerManager The ListenerManager for which to set the TransportManager */ public void setTransportManager(ListenerManager listenerManager) { this.listenerManager = listenerManager; } private void cleanupServiceContexts(ServiceGroupContext serviceGroupContext) { if (serviceGroupContext == null) { return; } Iterator serviceContextIter = serviceGroupContext.getServiceContexts(); if (serviceContextIter == null) { return; } while (serviceContextIter.hasNext()) { ServiceContext serviceContext = (ServiceContext) serviceContextIter.next(); DependencyManager.destroyServiceObject(serviceContext); } } /** * Called during shutdown to clean up all Contexts */ public void cleanupContexts() { if ((applicationSessionServiceGroupContexts != null) && (applicationSessionServiceGroupContexts.size() > 0)) { for (Iterator applicationScopeSgs = applicationSessionServiceGroupContexts.values().iterator(); applicationScopeSgs.hasNext();) { ServiceGroupContext serviceGroupContext = (ServiceGroupContext) applicationScopeSgs.next(); cleanupServiceContexts(serviceGroupContext); } applicationSessionServiceGroupContexts.clear(); } if ((serviceGroupContextMap != null) && (serviceGroupContextMap.size() > 0)) { for (Iterator soapSessionSgs = serviceGroupContextMap.values().iterator(); soapSessionSgs.hasNext();) { ServiceGroupContext serviceGroupContext = (ServiceGroupContext) soapSessionSgs.next(); cleanupServiceContexts(serviceGroupContext); } serviceGroupContextMap.clear(); } } /** * Invoked during shutdown to stop the ListenerManager and * perform configuration cleanup * * @throws AxisFault */ public void terminate() throws AxisFault { if (listenerManager != null) { listenerManager.stop(); } axisConfiguration.cleanup(); cleanupTemp(); } /** * This include all the major changes we have done from 1.2 * release to 1.3 release. This will include API changes , class * deprecating etc etc. */ private void cleanupTemp() { File tempFile = (File) axisConfiguration.getParameterValue( Constants.Configuration.ARTIFACTS_TEMP_DIR); if (tempFile == null) { String property = (String) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return System.getProperty("java.io.tmpdir"); } } ); tempFile = new File(property, "_axis2"); } deleteTempFiles(tempFile); } private void deleteTempFiles(final File dir) { Boolean isDir = (Boolean) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return new Boolean(dir.isDirectory()); } } ); if (isDir.booleanValue()) { String[] children = (String[]) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return dir.list(); } } ); for (int i = 0; children != null && i < children.length; i++) { deleteTempFiles(new File(dir, children[i])); } } AccessController.doPrivileged( new PrivilegedAction() { public Object run() { dir.delete(); return null; } } ); } /** * Retrieves the ServiceContext path * * @return path to the ServiceContext */ public String getServiceContextPath() { if (cachedServicePath == null) { cachedServicePath = internalGetServiceContextPath(); } return cachedServicePath; } private String internalGetServiceContextPath() { String ctxRoot = getContextRoot(); String path = "/"; if (ctxRoot != null) { if (!ctxRoot.equals("/")) { path = ctxRoot + "/"; } if (servicePath == null || servicePath.trim().length() == 0) { throw new IllegalArgumentException("service path cannot be null or empty"); } else { path += servicePath.trim(); } } return path; } /** * Retrieves the ServicePath * @return The path to the Service */ public String getServicePath() { if (servicePath == null || servicePath.trim().length() == 0) { throw new IllegalArgumentException("service path cannot be null or empty"); } return servicePath.trim(); } /** * Sets the ServicePath to the given string * @param servicePath The service path for which to set */ public void setServicePath(String servicePath) { this.servicePath = servicePath; } /** * Retrieves the ContextRoot * @return The ContextRoot */ public String getContextRoot() { return contextRoot; } /** * Sets the context root to the given string * @param contextRoot The context root for which to set */ public void setContextRoot(String contextRoot) { if (contextRoot != null) { this.contextRoot = contextRoot.trim(); // Trim before storing away for good hygiene cachedServicePath = internalGetServiceContextPath(); } } /** * This will be used to fetch the serviceGroupContextTimoutInterval from any place available. * * @return long */ public long getServiceGroupContextTimoutInterval() { Integer serviceGroupContextTimoutIntervalParam = (Integer) getProperty(Constants.Configuration.CONFIG_CONTEXT_TIMOUT_INTERVAL); if (serviceGroupContextTimoutIntervalParam != null) { serviceGroupContextTimoutInterval = serviceGroupContextTimoutIntervalParam.intValue(); } return serviceGroupContextTimoutInterval; } /** * Removes the given ServiceGroup from the ServiceGroup context * @param serviceGroup */ public void removeServiceGroupContext(AxisServiceGroup serviceGroup) { if (serviceGroup != null) { Object obj = applicationSessionServiceGroupContexts.get( serviceGroup.getServiceGroupName()); if (obj == null) { ArrayList toBeRemovedList = new ArrayList(); Iterator serviceGroupContexts = serviceGroupContextMap.values().iterator(); while (serviceGroupContexts.hasNext()) { ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceGroupContexts.next(); if (serviceGroupContext.getDescription().equals(serviceGroup)) { toBeRemovedList.add(serviceGroupContext.getId()); } } for (int i = 0; i < toBeRemovedList.size(); i++) { String s = (String) toBeRemovedList.get(i); serviceGroupContextMap.remove(s); } } else { applicationSessionServiceGroupContexts.remove(serviceGroup.getServiceGroupName()); } } } /* (non-Javadoc) * @see org.apache.axis2.context.AbstractContext#getRootContext() */ public ConfigurationContext getRootContext() { return this; } }./src/org/apache/axis2/context/MessageContextConstants.java0000664000175000017500000000260311767656530023210 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; public interface MessageContextConstants { /** * @deprecated please use org.apache.axis2.Constants.Configuration.TRANSPORT_URL * */ public static final String TRANSPORT_URL = "TransportURL"; /** * @deprecated please use org.apache.axis2.transport.http.HTTPConstants.CHUNKED * */ public static final String CHUNKED = "__CHUNKED__"; /** * @deprecated please use org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION * */ public static final String HTTP_PROTOCOL_VERSION = "__HTTP_PROTOCOL_VERSION__"; } ./src/org/apache/axis2/context/ServiceGroupContext.java0000664000175000017500000004337311767656530022355 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.externalize.ActivateUtils; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.MetaDataEntry; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class ServiceGroupContext extends AbstractContext implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(ServiceGroupContext.class); private static final String myClassName = "ServiceGroupContext"; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = 9014471144479928885L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; private transient AxisServiceGroup axisServiceGroup; private String id; private Map serviceContextMap; //---------------------------------------------------------------- // MetaData for data to be restored in activate after readExternal //---------------------------------------------------------------- /** * Indicates whether the message context has been reconstituted * and needs to have its object references reconciled */ private transient boolean needsToBeReconciled = false; /** * The AxisServiceContext metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisServiceGroup = null; //---------------------------------------------------------------- // end MetaData section //---------------------------------------------------------------- // simple constructor public ServiceGroupContext() { super(null); serviceContextMap = new HashMap(); } public ServiceGroupContext(ConfigurationContext parent, AxisServiceGroup axisServiceGroup) { super(parent); this.axisServiceGroup = axisServiceGroup; serviceContextMap = new HashMap(); // initially set the id to the axisServiceGroup if (axisServiceGroup != null) { setId(axisServiceGroup.getServiceGroupName()); } } public AxisServiceGroup getDescription() { checkActivateWarning("getDescription"); return axisServiceGroup; } public String getId() { return id; } /** * Gets a service context. Creates a new one from AxisService. * There is no need to store service context inside serviceGroup * context as well. * * @param service the AxisService for which to get a context * @return Returns ServiceContext. * @throws AxisFault if something goes wrong */ public ServiceContext getServiceContext(AxisService service) throws AxisFault { AxisService axisService = axisServiceGroup.getService(service.getName()); if (axisService == null) { throw new AxisFault(Messages.getMessage("invalidserviceinagroup", service.getName(), axisServiceGroup.getServiceGroupName())); } if (serviceContextMap == null) { serviceContextMap = new HashMap(); } ServiceContext serviceContext = (ServiceContext) serviceContextMap.get(service.getName()); if (serviceContext == null) { serviceContext = new ServiceContext(service, this); getRootContext().contextCreated(serviceContext); serviceContextMap.put(service.getName(), serviceContext); } return serviceContext; } public Iterator getServiceContexts() { if (serviceContextMap == null) { serviceContextMap = new HashMap(); } if (serviceContextMap.isEmpty()) { return null; } return serviceContextMap.values().iterator(); } public void setId(String id) { this.id = id; } /** * Adds the specified service context object to the * lists of service contexts for this service group * context. * * @param srvctx The ServiceContext object to add */ public void addServiceContext(ServiceContext srvctx) { if (srvctx == null) { return; } AxisService axisService = srvctx.getAxisService(); if (axisService == null) { return; } if (serviceContextMap == null) { serviceContextMap = new HashMap(); } serviceContextMap.put(axisService.getName(), srvctx); } /** * Finds the service context object that corresponds * to the specified name from the list * of service contexts for this service group * context. * * @param name The name associated with the ServiceContext * @return The ServiceContext associated with the name, * or null, if none can be found */ public ServiceContext findServiceContext(String name) { if (serviceContextMap == null) { return null; } return (ServiceContext) serviceContextMap.get(name); } /** * Finds the service context object that corresponds * to the specified AxisService from the list * of service contexts for this service group * context. * * @param axisSrv the AxisService whose context we're looking for * @return The ServiceContext associated with the AxisService * or null, if none can be found */ public ServiceContext findServiceContext(AxisService axisSrv) { if (axisSrv == null) { return null; } if (serviceContextMap == null) { return null; } return (ServiceContext) serviceContextMap.get(axisSrv.getName()); } /** * This will do a copy of the properties from this context object * to the properties of the specified context object. * * @param context The ServiceGroupContext object to hold the merged properties */ public void putContextProperties(ServiceGroupContext context) { if (context != null) { // get the current properties on this context object Map props = getProperties(); // copy them to the specified context object context.mergeProperties(props); } } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

    * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // write out contents of this object //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeLong(getLastTouchedTime()); if (id == null) { // generate an ID to use when this object is restored id = UUIDGenerator.getUUID(); } out.writeObject(id); //--------------------------------------------------------- // properties //--------------------------------------------------------- out.writeMap(getProperties()); //--------------------------------------------------------- // AxisServiceGroup //--------------------------------------------------------- metaAxisServiceGroup = null; if (axisServiceGroup != null) { metaAxisServiceGroup = new MetaDataEntry(axisServiceGroup.getClass().getName(), axisServiceGroup.getServiceGroupName()); } out.writeObject(metaAxisServiceGroup); //--------------------------------------------------------- // parent //--------------------------------------------------------- // the parent is the ConfigurationContext object, which // at this time, is not being saved. // instead, we will need to register this ServiceGroupObject // with the existing ConfigurationContext object when // this object is reconstituted } /** * Restore the contents of the object that was previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // set the flag to indicate that the message context is being // reconstituted and will need to have certain object references // to be reconciled with the current engine setup needsToBeReconciled = true; // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- long time = in.readLong(); setLastTouchedTime(time); id = (String) in.readObject(); //--------------------------------------------------------- // properties //--------------------------------------------------------- properties = in.readHashMap(); //--------------------------------------------------------- // AxisServiceGroup //--------------------------------------------------------- // axisServiceGroup is not usable until the meta data has been reconciled axisServiceGroup = null; metaAxisServiceGroup = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // parent //--------------------------------------------------------- // the parent is the ConfigurationContext object, whic // at this time, is not being saved. // instead, we will need to register this ServiceGroupObject // with the existing ConfigurationContext object when // this object is reconstituted //--------------------------------------------------------- // other //--------------------------------------------------------- serviceContextMap = new HashMap(); //--------------------------------------------------------- // done //--------------------------------------------------------- } /** * Some parts of the object restored from the * readExternal deserialization work cannot be completed until * we have a configurationContext. This method checks to see * if additional work needs to be done in order to complete * the object reconstitution. * * @param cc the active ConfigurationContext */ public void activate(ConfigurationContext cc) { // see if there's any work to do if (!needsToBeReconciled) { // return quick return; } // get the axis configuration AxisConfiguration axisConfig = cc.getAxisConfiguration(); // We previously saved metaAxisServiceGroup; restore it if (metaAxisServiceGroup != null) { axisServiceGroup = ActivateUtils.findServiceGroup(axisConfig, metaAxisServiceGroup.getClassName(), metaAxisServiceGroup.getQNameAsString()); } else { axisServiceGroup = null; } // set parent this.setParent(cc); // register with the parent cc.addServiceGroupContextIntoSoapSessionTable(this); //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; } /** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. *

    * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). *

    * * @param ctx The object to compare with * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(ServiceGroupContext ctx) { // NOTE: the input object is expected to exist (ie, be non-null) if (!this.axisServiceGroup.equals(ctx.getDescription())) { return false; } String ctxid = ctx.getId(); if ((this.id != null) && (ctxid != null)) { if (!this.id.equals(ctxid)) { return false; } } else if ((this.id == null) && (ctxid == null)) { // keep going } else { // mismatch return false; } // TODO: consider checking the parent objects for equivalency // TODO: consider checking fields from the super class for equivalency return true; } /** * Trace a warning message, if needed, indicating that this * object needs to be activated before accessing certain fields. * * @param methodname The method where the warning occurs */ private void checkActivateWarning(String methodname) { if (needsToBeReconciled) { log.warn(myClassName + ":" + methodname + "(): ****WARNING**** " + myClassName + ".activate(configurationContext) needs to be invoked."); } } public ConfigurationContext getRootContext() { //parent of the ServiceGroupContext is the ConfigurationContext return (ConfigurationContext) this.getParent(); } } ./src/org/apache/axis2/context/OperationContextFactory.java0000664000175000017500000000404511767656530023221 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.i18n.Messages; import org.apache.axis2.wsdl.WSDLConstants; /** * This is the factory for OperationContext. */ public class OperationContextFactory implements WSDLConstants { public static OperationContext createOperationContext(int mepURI, AxisOperation axisOp, ServiceContext serviceContext) throws AxisFault { if ((WSDLConstants.MEP_CONSTANT_IN_OUT == mepURI) || (WSDLConstants.MEP_CONSTANT_IN_ONLY == mepURI) || (WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI) || (WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY == mepURI) || (WSDLConstants.MEP_CONSTANT_OUT_ONLY == mepURI) || (WSDLConstants.MEP_CONSTANT_OUT_IN == mepURI) || (WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI) || (WSDLConstants.MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI)) { return serviceContext.createOperationContext(axisOp); } else { throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI)); } } } ./src/org/apache/axis2/context/OperationContext.java0000664000175000017500000012001111767656530021661 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.externalize.ActivateUtils; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.MetaDataEntry; import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004_Constants; import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2006Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.HashMap; import java.util.Iterator; import java.util.Set; /** * An OperationContext represents a running "instance" of an operation, which is * represented by an AxisOperation object. This concept is needed to allow * messages to be grouped into operations as in WSDL 2.0-speak operations are * essentially arbitrary message exchange patterns. So as messages are being * exchanged the OperationContext remembers the state of where in the message * exchange pattern it is in. *

    * The base implementation of OperationContext * supports MEPs which have one input message and/or one output message. That * is, it supports the all the MEPs that are in the WSDL 2.0 specification. In * order to support another MEP one must extend this class and register its * creation in the OperationContexFactory. */ public class OperationContext extends AbstractContext implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(OperationContext.class); private static final String myClassName = "OperationContext"; private boolean debugEnabled = log.isDebugEnabled(); /** * An ID which can be used to correlate operations on an instance of * this object in the log files */ private String logCorrelationIDString = null; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -7264782778333554350L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * @serial isComplete flag */ private boolean isComplete; /** * @serial key string */ //The key value of the operationContextMap; private String key; // the AxisOperation of which this is a running instance. The MEP of this // AxisOperation must be one of the 8 predefined ones in WSDL 2.0. private transient AxisOperation axisOperation; /** * the set of message contexts associated with this operation */ private transient HashMap messageContexts; //---------------------------------------------------------------- // MetaData for data to be restored in activate after readExternal //---------------------------------------------------------------- /** * Indicates whether the message context has been reconstituted * and needs to have its object references reconciled */ private transient boolean needsToBeReconciled = false; /** * Suppresses warning messages for activation * when doing internal reconciliation */ private transient boolean suppressWarnings = false; /** * The AxisOperation metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisOperation = null; /** * The AxisService metadata will be used during * activate to match up with an existing object */ private transient MetaDataEntry metaAxisService = null; /** * The ServiceContext metadata will be used during * activate to match up with an existing object */ private transient ServiceContext metaParent = null; /** * This is used to hold information about message context objects * that are in the messageContexts map. This allows message context * objects to be isolated from the object graph so that duplicate * copies of objects are not saved/restored. */ private HashMap metaMessageContextMap = null; /** * This is used to hold temporarily any message context objects * that were isolated from the messageContexts map. */ private transient HashMap isolatedMessageContexts = null; /** * This is used to hold temporarily any message context objects * from the messageContexts map for save/restore activities. */ private transient HashMap workingSet = null; //---------------------------------------------------------------- // end MetaData section //---------------------------------------------------------------- /** * Simple constructor (needed for deserialization, shouldn't be used otherwise!) */ public OperationContext() { super(null); this.messageContexts = new HashMap(); } /** * Constructs a new OperationContext. * * @param axisOperation the AxisOperation whose running instances' state this * OperationContext represents. * @param serviceContext the parent ServiceContext representing any state related to * the set of all operations of the service. */ public OperationContext(AxisOperation axisOperation, ServiceContext serviceContext) { super(serviceContext); this.messageContexts = new HashMap(); this.axisOperation = axisOperation; this.setParent(serviceContext); } /** * When a new message is added to the MEPContext the logic * should be included remove the MEPContext from the table in the * EngineContext. Example: IN_IN_OUT At the second IN * message the MEPContext should be removed from the AxisOperation. * * @param msgContext */ public void addMessageContext(MessageContext msgContext) throws AxisFault { if (axisOperation != null) { axisOperation.addMessageContext(msgContext, this); touch(); } } /** * Removes the pointers to this OperationContext in the * ConfigurationContext's OperationContextMap so that this * OperationContext will eventually get garbage collected * along with the MessageContext's it contains. Note that if * the caller wants to make sure its safe to clean up this OperationContext * he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT * and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP * being complete due to the optional nature of the MEP. */ public void cleanup() { ServiceContext serv = getServiceContext(); if (serv != null) { serv.getConfigurationContext().unregisterOperationContext(key); } } /** * @return Returns the axisOperation. */ public AxisOperation getAxisOperation() { if (needsToBeReconciled && !suppressWarnings && debugEnabled) { log.debug(getLogCorrelationIDString() + ":getAxisOperation(): ****WARNING**** OperationContext.activate(configurationContext) needs to be invoked."); } return axisOperation; } /** * Returns the EngineContext in which the parent ServiceContext lives. * * @return Returns parent ServiceContext's parent EngineContext. */ public ConfigurationContext getConfigurationContext() { if (parent != null) { return ((ServiceContext) parent).getConfigurationContext(); } else { return null; } } /** * @param messageLabel * @return Returns MessageContext. * @throws AxisFault */ public MessageContext getMessageContext(String messageLabel) throws AxisFault { if (messageContexts == null) { return null; } return (MessageContext) messageContexts.get(messageLabel); } /** * Remove the indicated message context. * Example Usage: The exchange is aborted and we need to * undo the work and free resources. * @param label * @throws AxisFault */ public void removeMessageContext(String label) throws AxisFault { MessageContext mc = getMessageContext(label); if (mc != null) { messageContexts.remove(mc); setComplete(false); touch(); } } public HashMap getMessageContexts() { return messageContexts; } /** * Returns the ServiceContext in which this OperationContext lives. * * @return Returns parent ServiceContext. */ public ServiceContext getServiceContext() { return (ServiceContext) parent; } /** * Checks to see if the MEP is complete. i.e. whether all the messages that * are associated with the MEP has arrived and MEP is complete. */ public boolean isComplete() { return isComplete; } public void setComplete(boolean complete) { isComplete = complete; } public void setKey(String key) { this.key = key; } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

    * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeLong(getLastTouchedTime()); out.writeBoolean(isComplete); out.writeObject(key); out.writeObject(logCorrelationIDString); //--------------------------------------------------------- // properties //--------------------------------------------------------- out.writeUTF("properties"); // write marker out.writeMap(getProperties()); //--------------------------------------------------------- // AxisOperation axisOperation //--------------------------------------------------------- out.writeUTF("metaAxisOperation"); // write marker metaAxisOperation = null; if (axisOperation != null) { metaAxisOperation = new MetaDataEntry(axisOperation.getClass().getName(), axisOperation.getName().toString()); } out.writeObject(metaAxisOperation); //--------------------------------------------------------- // AxisOperation axisService //--------------------------------------------------------- // save the meta data for the corresponding axis service to better // match up the axis operation out.writeUTF("metaAxisService"); // write marker metaAxisService = null; AxisService axisService = axisOperation.getAxisService(); if (axisService != null) { metaAxisService = new MetaDataEntry(axisService.getClass().getName(), axisService.getName()); } out.writeObject(metaAxisService); //--------------------------------------------------------- // parent //--------------------------------------------------------- out.writeUTF("parent"); // write marker out.writeObject(this.getServiceContext()); //--------------------------------------------------------- // HashMap messageContexts table //--------------------------------------------------------- // NOTES: The assumption is that the table contains message contexts // that are in the OperationContext hierarchy. To reduce overlap // of object information that is being saved, extract the // message context objects from the hierachy before saving. // When the OperationContext is restored, the "slimmed down" // message context objects are plugged back into the hierachy // using the restored OperationContext as a basis. // first deal with the original messageContexts table HashMap tmpMsgCtxMap = null; if ((messageContexts != null) && (!messageContexts.isEmpty())) { // create a table of the non-isolated message contexts workingSet = new HashMap(); tmpMsgCtxMap = new HashMap(); Set keySet = messageContexts.keySet(); Iterator itKeys = keySet.iterator(); while (itKeys.hasNext()) { // expect the key to be a string String keyObj = (String) itKeys.next(); // get the message context associated with that label MessageContext value = (MessageContext) messageContexts.get(keyObj); boolean addToWorkingSet = true; // check to see if this message context was isolated if (isolatedMessageContexts != null) { if (!isolatedMessageContexts.isEmpty()) { // see if the message context was previously isolated MessageContext valueIsolated = (MessageContext) isolatedMessageContexts.get(keyObj); if (valueIsolated != null) { String idIsol = valueIsolated.getMessageID(); if (idIsol != null) { if (idIsol.equals(value.getMessageID())) { // don't add to working set addToWorkingSet = false; } } } } } if (addToWorkingSet) { // put the meta data entry in the list workingSet.put(keyObj, value); } } // now we have a working set Set keySet2 = workingSet.keySet(); Iterator itKeys2 = keySet2.iterator(); while (itKeys2.hasNext()) { // expect the key to be a string String keyObj2 = (String) itKeys2.next(); // get the message context associated with that label MessageContext mc = (MessageContext) workingSet.get(keyObj2); // construct a copy of the message context // that has been extracted from the object hierarchy MessageContext copyMC = mc.extractCopyMessageContext(); // Don't persist the message of the other message contexts copyMC.setEnvelope(null); // put the modified entry in the list tmpMsgCtxMap.put(keyObj2, copyMC); // trace point if (log.isTraceEnabled()) { log.trace(getLogCorrelationIDString() + ":writeExternal(): getting working set entry key [" + keyObj2 + "] message context ID[" + copyMC.getMessageID() + "]"); } } } out.writeUTF("messagecontexts"); // write marker out.writeMap(tmpMsgCtxMap); out.writeUTF("metaMessageContextMap"); out.writeMap(metaMessageContextMap); //--------------------------------------------------------- // done //--------------------------------------------------------- } /** * Restore the contents of the object that was previously saved. *

    * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // set the flag to indicate that the message context is being // reconstituted and will need to have certain object references // to be reconciled with the current engine setup needsToBeReconciled = true; // trace point log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); //--------------------------------------------------------- // object level identifiers //--------------------------------------------------------- // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- long time = in.readLong(); setLastTouchedTime(time); isComplete = in.readBoolean(); key = (String) in.readObject(); logCorrelationIDString = (String) in.readObject(); // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): reading input stream for [" + getLogCorrelationIDString() + "] "); } //--------------------------------------------------------- // properties //--------------------------------------------------------- in.readUTF(); // read marker properties = in.readHashMap(); //--------------------------------------------------------- // axis operation meta data //--------------------------------------------------------- // axisOperation is not usable until the meta data has been reconciled axisOperation = null; in.readUTF(); // read marker metaAxisOperation = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // axis service meta data //--------------------------------------------------------- // axisService is not usable until the meta data has been reconciled in.readUTF(); // read marker metaAxisService = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // parent //--------------------------------------------------------- // ServiceContext is not usable until it has been activated in.readUTF(); // read marker metaParent = (ServiceContext) in.readObject(); //--------------------------------------------------------- // HashMap messageContexts table //--------------------------------------------------------- // set to empty until this can be activiated messageContexts = new HashMap(); in.readUTF(); // read marker workingSet = in.readHashMap(); in.readUTF(); // read marker metaMessageContextMap = in.readHashMap(); //--------------------------------------------------------- // done //--------------------------------------------------------- } /** * This method checks to see if additional work needs to be * done in order to complete the object reconstitution. * Some parts of the object restored from the readExternal() * cannot be completed until we have a configurationContext * from the active engine. The configurationContext is used * to help this object to plug back into the engine's * configuration and deployment objects. * * @param cc The configuration context object representing the active configuration */ public void activate(ConfigurationContext cc) { // see if there's any work to do if (!needsToBeReconciled) { // return quick return; } // get the axis configuration AxisConfiguration axisConfig = cc.getAxisConfiguration(); // We previously saved metaAxisService; restore it AxisService axisService = null; if (metaAxisService != null) { axisService = ActivateUtils.findService(axisConfig, metaAxisService.getClassName(), metaAxisService.getQNameAsString()); } // We previously saved metaAxisOperation; restore it if (metaAxisOperation != null) { if (axisService != null) { this.axisOperation = ActivateUtils.findOperation(axisService, metaAxisOperation.getClassName(), metaAxisOperation.getQName()); } else { this.axisOperation = ActivateUtils.findOperation(axisConfig, metaAxisOperation.getClassName(), metaAxisOperation.getQName()); } } // the parent ServiceContext object was saved // either use the restored object or sync up with // an existing ServiceContext object if (metaParent != null) { // find out if a copy of the ServiceContext object exists on this // engine where this OperationContext is being restored/activated // if so, use that object instead of the restored object // in order to make sure that future changes to service-level // properties are preserved for future operations String groupName = metaParent.getGroupName(); String serviceName = metaParent.getName(); ServiceContext existingSC = null; // first look for the ServiceContext via the ServiceContextGroup ServiceGroupContext sgc = cc.getServiceGroupContext(groupName); if (sgc != null) { existingSC = sgc.findServiceContext(serviceName); } if (existingSC == null) { // we couldn't find the ServiceContext via the ServiceContextGroup // try via the set of existing operation contexts OperationContext existingOC = cc.findOperationContext(getOperationName(), serviceName, groupName); if (existingOC != null) { existingSC = (ServiceContext) existingOC.getParent(); } } if (existingSC == null) { // could not find an existing ServiceContext // use the restored object metaParent.activate(cc); // set parent this.setParent(metaParent); } else { // switch over to the existing object this.setParent(existingSC); // do a copy of the properties from the restored object // to the existing ServiceContext // Should the copy be a non-destructive one? That is, // if the key already exists in the properties table of the // existing object, should the value be overwritten from the // restored ojbect? For now, the decision is that the state // that has been preserved for a saved context object is // is important to be restored. metaParent.putContextProperties(existingSC, true); } } else { // set parent to null this.setParent(metaParent); } // reseed the operation context map ServiceContext serv = getServiceContext(); ConfigurationContext activeCC; if (serv != null) { activeCC = serv.getConfigurationContext(); } else { activeCC = cc; } if (key != null) { // We only want to (re)register this if it's an outbound message String mepString = getAxisOperation().getMessageExchangePattern(); if (mepString.equals(WSDL20_2006Constants.MEP_URI_OUT_ONLY) || mepString.equals(WSDL20_2004_Constants.MEP_URI_OUT_ONLY) || ((mepString.equals(WSDL20_2006Constants.MEP_URI_OUT_IN) || mepString.equals(WSDL20_2004_Constants.MEP_URI_OUT_IN)) && !isComplete)) { // make sure this OperationContext object is registered in the // list maintained by the ConfigurationContext object boolean registrationSuceeded = activeCC.registerOperationContext(key, this, true); if (!registrationSuceeded) { // trace point if (log.isTraceEnabled()) { log.trace(getLogCorrelationIDString()+ ":activate(): " + "OperationContext key [" + key + "] already exists in ConfigurationContext map. " + "This OperationContext [" + this.toString() + "] was not added to the table."); } } } } //------------------------------------------------------- // update the modified entries in the messageContexts table //------------------------------------------------------- // NOTE: an entry in the metaMessageContextMap must wait // for its corresponding active message context object // to call this operation context object so we don't // need to handle the metaMessagecontextMap table here if ((workingSet != null) && (!workingSet.isEmpty())) { Set keySet = workingSet.keySet(); Iterator itKeys = keySet.iterator(); while (itKeys.hasNext()) { // expect the key to be a string String keyObj = (String) itKeys.next(); // get the message context associated with that label MessageContext value = (MessageContext) workingSet.get((Object) keyObj); // activate that object if (value != null) { // trace point if (log.isTraceEnabled()) { log.trace(getLogCorrelationIDString() + ":activate(): key [" + keyObj + "] message id [" + value.getMessageID() + "]"); } suppressWarnings = true; value.activateWithOperationContext(this); suppressWarnings = false; if (messageContexts == null) { messageContexts = new HashMap(); } } // put the entry in the "real" table // note that the key or the value could be null messageContexts.put(keyObj, value); } } //------------------------------------------------------- // done, reset the flag //------------------------------------------------------- needsToBeReconciled = false; } /** * Isolate the specified message context object * to prepare for serialization. Instead of * saving the entire message context object, * just setup some metadata about the message * context. *

    * Note: this will remove the specified * message context object from the message context * table. * * @param mc The message context object */ public void isolateMessageContext(MessageContext mc) { if (mc == null) { return; } if ((messageContexts == null) || (messageContexts.isEmpty())) { return; } // get the message ID from the message context String messageID = mc.getMessageID(); if (messageID == null) { // can't locate it without identification return; } Iterator it = messageContexts.keySet().iterator(); while (it.hasNext()) { // get the key Object keyObj = it.next(); // get the value associated with that key MessageContext value = (MessageContext) messageContexts.get(keyObj); if (value != null) { String valueID = value.getMessageID(); if ((valueID != null) && valueID.equals(messageID)) { // found the input message context in our table if (metaMessageContextMap == null) { metaMessageContextMap = new HashMap(); } // build a meta data entry // MessageContext class name // MessageContext messageID // key used in the original hashmap that is associated with this MessageContext // note: this is typically something like "In", "Out", "Fault" // MetaDataEntry metaData = new MetaDataEntry(value.getClass().getName(), value.getMessageID(), keyObj.toString()); // put the meta data entry in the list // note that if the entry was already in the list, // this will replace that entry metaMessageContextMap.put(keyObj, metaData); // don't change the original table - there's potentially lots of areas that // grab the table // // now remove the original entry from the messageContexts table // messageContexts.remove(keyObj); // put the original entry in the temporary list if (isolatedMessageContexts == null) { isolatedMessageContexts = new HashMap(); } // note that if the entry was already in the list, // this will replace that entry isolatedMessageContexts.put(keyObj, value); // trace point if (log.isTraceEnabled()) { log.trace(getLogCorrelationIDString() + ":isolateMessageContext(): set up message context id[" + valueID + "] with key [" + keyObj.toString() + "] from messageContexts table to prepare for serialization."); } break; } } } } /** * Restore the specified MessageContext object in the * table used to hold the message contexts associated * with this operation. * * @param msg The message context object */ public void restoreMessageContext(MessageContext msg) { // see if the activation has been done if (needsToBeReconciled) { // nope, need to do the activation first if (debugEnabled) { log.debug(getLogCorrelationIDString() + ":restoreMessageContext(): *** WARNING : need to invoke activate() prior to restoring the MessageContext to the list."); } return; } if (msg == null) { return; } String msgID = msg.getMessageID(); if (msgID == null) { if (debugEnabled) { // can't identify message context log.debug(getLogCorrelationIDString() + ":restoreMessageContext(): *** WARNING : MessageContext does not have a message ID."); } return; } // first check the metaMessageContextMap to see if // the specified message context object matches any // of the metadata entries. if ((metaMessageContextMap != null) && (!metaMessageContextMap.isEmpty())) { Iterator itMeta = metaMessageContextMap.keySet().iterator(); while (itMeta.hasNext()) { String keyM = (String) itMeta.next(); MetaDataEntry valueM = (MetaDataEntry) metaMessageContextMap.get(keyM); String valueM_ID; if (valueM != null) { valueM_ID = valueM.getQNameAsString(); if (msgID.equals(valueM_ID)) { String label = valueM.getExtraName(); if (messageContexts == null) { messageContexts = new HashMap(); } // put the message context into the messageContexts table messageContexts.put(label, msg); // remove the metadata from the metadata table metaMessageContextMap.remove(keyM); if (log.isTraceEnabled()) { log.trace(getLogCorrelationIDString() + ":restoreMessageContext(): restored label [" + label + "] message ID [" + msg.getMessageID() + "]"); } break; } } } } else // see if we can put the msg directly in the messageContexts table if ((messageContexts != null) && (!messageContexts.isEmpty())) { Iterator itList = messageContexts.keySet().iterator(); while (itList.hasNext()) { String key = (String) itList.next(); MessageContext value = (MessageContext) messageContexts.get(key); String valueID; if (value != null) { valueID = value.getMessageID(); if (msgID.equals(valueID)) { // update the entry messageContexts.put(key, msg); } } } } } /** * Get the name associated with the operation. * * @return The name String */ public String getOperationName() { String opName = null; if (axisOperation != null) { QName qname = axisOperation.getName(); if (qname != null) { opName = qname.getLocalPart(); } } return opName; } /** * Get the name associated with the service. * * @return The name String */ public String getServiceName() { String srvName = null; ServiceContext sc = (ServiceContext) getParent(); if (sc == null) { sc = metaParent; } if (sc != null) { srvName = sc.getName(); } return srvName; } /** * Get the name associated with the service group. * * @return The name String */ public String getServiceGroupName() { String srvGroupName = null; ServiceContext sc = (ServiceContext) getParent(); if (sc == null) { sc = metaParent; } if (sc != null) { srvGroupName = sc.getGroupName(); } return srvGroupName; } /** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. *

    * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). *

    * * @param ctx The object to compare with * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(OperationContext ctx) { // NOTE: the input object is expected to exist (ie, be non-null) if (this.isComplete != ctx.isComplete()) { return false; } if (!this.axisOperation.equals(ctx.getAxisOperation())) { return false; } // TODO: consider checking the parent objects for equivalency // TODO: consider checking fields from the super class for equivalency return true; } /** * Get the ID associated with this object instance. * * @return A string that can be output to a log file as an identifier * for this object instance. It is suitable for matching related log * entries. */ public String getLogCorrelationIDString() { if (logCorrelationIDString == null) { logCorrelationIDString = myClassName + "@" + UUIDGenerator.getUUID(); } return logCorrelationIDString; } public ConfigurationContext getRootContext() { return this.getConfigurationContext(); } } ./src/org/apache/axis2/context/SelfManagedDataManager.java0000664000175000017500000000752611767656530022626 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; /** * An interface for use by a message handler to allow * it to save and restore any message-specific data. *

    * A handler can have message-specific data that * needs to be associated the message being processed. * The handler can keep this message-specific data * in the Messagecontext object by adding the * data to the user data table via the * MessageContext method. When the MessageContext * object is saved (for example, to persistent storage), * and restored, this interface SelfManagedDataManager * provides a way for the handler to save and restore * the handler's message-specific data. * * @see MessageContext */ public interface SelfManagedDataManager { /** * This method is invoked when the MessageContext object is being saved. *

    * Implementors are expected to iterate through the data objects they wish * to save and return it in a ByteArrayOutputStream. This data will * later be passed to the implementor's deserializeSelfManagedData method when * the data object is to be restored. *

    * The data being saved may be the data stored by the implementor * in the MessageContext object's SelfManagedData list and may include * additional information such as the implementor's fields. * Note that data stored by the implementor in the MessageContext object's SelfManagedData * list is retrievable by calling the MessageContext.getSelfManagedData() method * for EACH key/value pair. * * @param mc the MessageContext that is being saved * @return The saved data in the output stream. Note that the * format of the data in the output stream is defined * by the implementor. * @throws IOException */ public ByteArrayOutputStream serializeSelfManagedData(MessageContext mc) throws IOException; /** * This method is invoked when the MessageContext object is being restored. *

    * Implementors will receive the data they had previously saved in the * serializeSelfManagedData() method. Implementors are responsible for * reconstituting their message-specific data. * * @param data ByteArrayInputStream consisting of the data that this handler had previously saved * @param mc the MessageContext object being restored * @throws IOException */ public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext mc) throws IOException; /** * This method is invoked when the MessageContext object is being restored and * after the deserializeSelfManagedData() method. *

    * Implementors use this method to re-establish transient message-specific data, * particularly if the implementor did not save any user data in the * serializeSelfManagedData() method. * * @param mc the MessageContext object being restored */ public void restoreTransientData(MessageContext mc); } ./src/org/apache/axis2/context/ContextListener.java0000664000175000017500000000252011767656530021512 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context; /** * A ContextListener gets informed about new context creations & removal of existing contexts. * Register one with a ConfigurationContext and you'll get notifications for every * sub-context creation & removal event. */ public interface ContextListener { /** * A context has been added * * @param context */ void contextCreated(AbstractContext context); /** * A context has been removed * * @param context */ void contextRemoved(AbstractContext context); } ./src/org/apache/axis2/context/externalize/0000775000175000017500000000000011767656530020050 5ustar brianbrian./src/org/apache/axis2/context/externalize/SafeObjectInputStream.java0000664000175000017500000003110011767656530025107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectStreamConstants; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * A SafeObjectInputStream reads data that was written by SafeObjectOutputStream * * @see SafeObjectInput */ public class SafeObjectInputStream implements ObjectInput, ObjectStreamConstants { private static final Log log = LogFactory.getLog(SafeObjectInputStream.class); private static final boolean isDebug = log.isDebugEnabled(); // All data is read from the delegated ObjectInput ObjectInput in = null; final ObjectInput original; // A buffer is used when Object is persisted as bytes private byte[] buffer = null; private static final int BUFFER_MIN_SIZE = 4096; /** * Add the SafeObjectInputStream if necessary * @param in * @return */ public static SafeObjectInputStream install(ObjectInput in) { if (in instanceof SafeObjectInputStream) { return (SafeObjectInputStream) in; } return new SafeObjectInputStream(in); } /** * Intentionally private. Callers should use the install method to add the SafeObjectInputStream * into the stream. * @param in */ private SafeObjectInputStream(ObjectInput in) { original = in; if (log.isDebugEnabled()) { this.in = new DebugObjectInput(original); } else { this.in = original; } } // Delegated Methods public int available() throws IOException { return in.available(); } public void close() throws IOException { in.close(); } public int read() throws IOException { return in.read(); } public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); } public int read(byte[] b) throws IOException { return in.read(b); } public boolean readBoolean() throws IOException { return in.readBoolean(); } public byte readByte() throws IOException { return in.readByte(); } public char readChar() throws IOException { return in.readChar(); } public double readDouble() throws IOException { return in.readDouble(); } public float readFloat() throws IOException { return in.readFloat(); } public void readFully(byte[] b, int off, int len) throws IOException { in.readFully(b, off, len); } public void readFully(byte[] b) throws IOException { in.readFully(b); } public int readInt() throws IOException { return in.readInt(); } public String readLine() throws IOException { return in.readLine(); } public long readLong() throws IOException { return in.readLong(); } public Object readObject() throws ClassNotFoundException, IOException { return readObjectOverride(); } public short readShort() throws IOException { return in.readShort(); } public int readUnsignedByte() throws IOException { return in.readUnsignedByte(); } public int readUnsignedShort() throws IOException { return in.readUnsignedShort(); } public String readUTF() throws IOException { return in.readUTF(); } public long skip(long n) throws IOException { return in.skip(n); } public int skipBytes(int n) throws IOException { return in.skipBytes(n); } // Value Add Methods /** * Read the input stream and place the key/value pairs in a hashmap * @return HashMap or null * @throws IOException * @see SafeObjectOutputStream.writeMap() */ public HashMap readHashMap() throws IOException { HashMap hashMap = new HashMap(); return (HashMap) readMap(hashMap); } /** * Read the input stream and place the key/value pairs in the * indicated Map * @param map input map * @return map or null * @throws IOException * @see SafeObjectOutputStream.writeMap() */ public Map readMap(Map map) throws IOException { boolean isActive = in.readBoolean(); if (!isActive) { return null; } while (in.readBoolean()) { Object key = null; Object value = null; boolean isObjectForm = in.readBoolean(); try { if (isObjectForm) { if (isDebug) { log.debug(" reading using object form"); } // Read the key and value directly key = in.readObject(); value = in.readObject(); } else { if (isDebug) { log.debug(" reading using byte form"); } // Get the byte stream ByteArrayInputStream bais = getByteStream(in); // Now get the real key and value ObjectInputStream tempOIS = createObjectInputStream(bais); key = tempOIS.readObject(); value = tempOIS.readObject(); tempOIS.close(); bais.close(); } // Put the key and value in the map if (isDebug) { log.debug("Read key=" + valueName(key) + " value="+valueName(value)); } map.put(key, value); } catch (ClassNotFoundException e) { // Swallow the error and try to continue log.error(e); } catch (IOException e) { throw e; } catch (Exception e) { throw AxisFault.makeFault(e); } } return map; } /** * Read the input stream and place objects in an ArrayList * @return ArrayList or null * @throws IOException * @see SafeObjectInputStream.writeList() */ public ArrayList readArrayList() throws IOException { List ll = new ArrayList(); return (ArrayList) readList(ll); } /** * Read the input stream and place objects in a LinkedList * @return LinkedList or null * @throws IOException * @see SafeObjectInputStream.writeList() */ public LinkedList readLinkedList() throws IOException { List ll = new LinkedList(); return (LinkedList) readList(ll); } /** * Read hte input stream and place objects in the specified List * @param list List * @return List or null * @throws IOException * @see SafeObjectInputStream.writeList() */ public List readList(List list) throws IOException { boolean isActive = in.readBoolean(); if (!isActive) { return null; } while (in.readBoolean()) { Object value; boolean isObjectForm = in.readBoolean(); try { if (isObjectForm) { if (isDebug) { log.debug(" reading using object form"); } // Read the value directly value = in.readObject(); } else { if (isDebug) { log.debug(" reading using byte form"); } // Get the byte stream ByteArrayInputStream bais = getByteStream(in); // Now get the real key and value ObjectInputStream tempOIS = createObjectInputStream(bais); value = tempOIS.readObject(); tempOIS.close(); bais.close(); } // Put the key and value in the list if (isDebug) { log.debug("Read value="+valueName(value)); } list.add(value); } catch (IOException e) { throw e; } catch (Exception e) { throw AxisFault.makeFault(e); } } return list; } /** * Reads the object using the same format that was written. * * EXPECTED FORMATS * boolean=false * return null Object * * * boolean=true * boolean=true * return Object read from inputStream * * * boolean=true * boolean=false * int=nuber of bytes * bytes * return Object read from bytes * * @return Object or null * @throws IOException * @throws ClassNotFoundException */ private Object readObjectOverride() throws IOException, ClassNotFoundException { boolean isActive = in.readBoolean(); if (!isActive) { if (isDebug) { log.debug("Read object=null"); } return null; } Object obj = null; boolean isObjectForm = in.readBoolean(); if (isObjectForm) { // Read the object directly if (isDebug) { log.debug(" reading using object form"); } obj = in.readObject(); } else { if (isDebug) { log.debug(" reading using byte form"); } // Get the byte stream ByteArrayInputStream bais = getByteStream(in); // Now get the real object ObjectInputStream tempOIS = createObjectInputStream(bais); obj = tempOIS.readObject(); tempOIS.close(); bais.close(); } if (isDebug) { log.debug("Read object=" + valueName(obj)); } return obj; } private String valueName(Object obj) { if (obj == null) { return "null"; } else if (obj instanceof String) { return (String) obj; } else { return "Object of class = " + obj.getClass().getName(); } } /** * Get the byte stream for an object that is written using the * byte format. * EXPECTED format * int (number of bytes) * bytes * * @param in * @return * @throws IOException * @throws ClassNotFoundException */ private ByteArrayInputStream getByteStream(ObjectInput in) throws IOException, ClassNotFoundException { // Read the length int size = in.readInt(); // Fill our temporary buffer if (buffer == null || buffer.length < size) { int allocSize = (size > BUFFER_MIN_SIZE) ? size : BUFFER_MIN_SIZE; buffer = new byte[allocSize]; } in.readFully(buffer, 0, size); // Return a stream backed by the buffer return new ByteArrayInputStream(buffer, 0, size); } private ObjectInputStream createObjectInputStream(InputStream is) throws IOException { // The created ObjectInputStream must use the same class/object resolution // code that is used by the original ObjectInput return new ObjectInputStreamWithCL(is); } } ./src/org/apache/axis2/context/externalize/MessageExternalizeUtils.java0000664000175000017500000004007011767656530025534 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axis2.AxisFault; import org.apache.axis2.builder.BuilderUtil; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.TransportUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamReader; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.OutputStream; /** * Utility to read/write the Message of a MessageContext * Message Object Format. * * * Format := Prolog {DataBlocks} EndBlocks * * Prolog := * NAME (UTF) * REVISION (INT) * ACTIVE (BOOL) * [OPTIMIZED (BOOL)] * [OPTIMIZED_CONTENT_TYPE (UTF)] <--- If OPTIMIZED=TRUE * [CHARSET (UTF)] * [NAMESPACE (UTF)] * * DataBlock := * SIZE (INT >0) * DATA (BYTES) * * EndBlocks * SIZE (INT) {0 indicates end -1 indicates failure} * * * */ public class MessageExternalizeUtils implements ExternalizeConstants { static final Log log = LogFactory.getLog(MessageExternalizeUtils.class); /* * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * Private Constructor. * This class only supports static methods */ private MessageExternalizeUtils() {} /** * Write out the Message * @param out * @param mc * @param correlationIDString * @param outputFormat * @throws IOException */ public static void writeExternal(ObjectOutput out, MessageContext mc, String correlationIDString, OMOutputFormat outputFormat) throws IOException { if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): start"); } SOAPEnvelope envelope = mc.getEnvelope(); if (envelope == null) { // Case: No envelope out.writeUTF("NULL_ENVELOPE"); out.writeInt(revisionID); out.writeBoolean(EMPTY_OBJECT); // Not Active out.writeInt(0); // EndBlocks if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): end: msg is Empty"); } return; } // Write Prolog String msgClass = envelope.getClass().getName(); out.writeUTF(msgClass); out.writeInt(revisionID); out.writeBoolean(ACTIVE_OBJECT); if (outputFormat.isOptimized()) { out.writeBoolean(true); // Write out the contentType. out.writeUTF(outputFormat.getContentType()); } else { out.writeBoolean(false); } out.writeUTF(outputFormat.getCharSetEncoding()); out.writeUTF(envelope.getNamespace().getNamespaceURI()); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized() + "] " + "optimizedContentType " + outputFormat.getContentType() + "] " + "charSetEnc=[" + outputFormat.getCharSetEncoding() + "] " + "namespaceURI=[" + envelope.getNamespace().getNamespaceURI() + "]"); } // Write DataBlocks // MessageOutputStream writes out the DataBlocks in chunks // BufferedOutputStream buffers the data to prevent numerous, small blocks MessageOutputStream mos = new MessageOutputStream(out); BufferedOutputStream bos = new BufferedOutputStream(mos); boolean errorOccurred = false; try { // Write out the message using the same logic as the // transport layer. MessageFormatter msgFormatter = TransportUtils.getMessageFormatter(mc); msgFormatter.writeTo(mc, outputFormat, bos, true); // Preserve the original message } catch (IOException e) { throw e; } catch (Throwable t) { throw AxisFault.makeFault(t); } finally { bos.flush(); bos.close(); } // Write End of Data Blocks if (errorOccurred) { out.writeInt(-1); } else { out.writeInt(0); } if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): end"); } } /** * Read the Message * @param in * @param mc * @param correlationIDString * @return * @throws IOException */ public static SOAPEnvelope readExternal(ObjectInput in, MessageContext mc, String correlationIDString) throws IOException, ClassNotFoundException { if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): start"); } SOAPEnvelope envelope = null; // Read Prolog // Read the class name and object state String name = in.readUTF(); int revision = in.readInt(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): name= " + name + " revision= " + revision); } // make sure the object data is in a revision level we can handle if (revision != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } boolean gotMsg = in.readBoolean(); if (gotMsg != ACTIVE_OBJECT) { if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): end:" + "no message present"); } in.readInt(); // Read end of data blocks return envelope; } // Read optimized, optimized content-type, charset encoding and namespace uri boolean optimized= in.readBoolean(); String optimizedContentType = null; if (optimized) { optimizedContentType = in.readUTF(); } String charSetEnc = in.readUTF(); String namespaceURI = in.readUTF(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): " + "optimized=[" + optimized + "] " + "optimizedContentType=[" + optimizedContentType + "] " + "charSetEnc=[" + charSetEnc + "] " + "namespaceURI=[" + namespaceURI + "]"); } MessageInputStream mis = new MessageInputStream(in); StAXBuilder builder = null; try { if (optimized) { boolean isSOAP = true; builder = BuilderUtil.getAttachmentsBuilder(mc, mis, optimizedContentType, isSOAP); envelope = (SOAPEnvelope) builder.getDocumentElement(); envelope.buildWithAttachments(); } else { XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(mis, charSetEnc); builder = new StAXSOAPModelBuilder(xmlreader, namespaceURI); envelope = (SOAPEnvelope) builder.getDocumentElement(); envelope.build(); } } catch (Exception ex) { // TODO: what to do if can't get the XML stream reader // For now, log the event log.error(correlationIDString + ":readExternal(): Error when deserializing persisted envelope: [" + ex.getClass().getName() + " : " + ex.getLocalizedMessage() + "]", ex); envelope = null; } finally { if (builder != null) { builder.close(); } // Close the message input stream. This will ensure that the // underlying stream is advanced past the message. mis.close(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): end"); } } return envelope; } /** * MessageOutputStream writes DataBlock chunks to the ObjectOutput. */ private static class MessageOutputStream extends OutputStream { ObjectOutput out; boolean isDebug; MessageOutputStream(ObjectOutput out) { this.out = out; isDebug = log.isDebugEnabled(); } public void close() throws IOException { // NOOP: ObjectOutput will be closed externally } public void flush() throws IOException { out.flush(); } /** * Writes a chunk of data to the ObjectOutput */ public void write(byte[] b, int off, int len) throws IOException { if (len > 0) { if (isDebug) { log.debug("Write data chunk with len=" + len); } // Write out the length and the data chunk out.writeInt(len); out.write(b, off, len); } } /** * Writes a chunk of data to the ObjectOutput */ public void write(byte[] b) throws IOException { if (b != null && b.length > 0) { if (isDebug) { log.debug("Write data chunk with size=" + b.length); } // Write out the length and the data chunk out.writeInt(b.length); out.write(b); } } /** * Writes a single byte chunk of data to the ObjectOutput */ public void write(int b) throws IOException { if (isDebug) { log.debug("Write one byte data chunk"); } // Write out the length and the data chunk out.writeInt(1); out.write(b); } } /** * Provides a InputStream interface over ObjectInput. * MessageInputStream controls the reading of the DataBlock chunks * */ private static class MessageInputStream extends InputStream { ObjectInput in; boolean isDebug; int chunkAvail = 0; boolean isEOD = false; /** * Constructor * @param in */ MessageInputStream(ObjectInput in) { this.in = in; isDebug = log.isDebugEnabled(); } /** * Read a single logical byte */ public int read() throws IOException { if (isDebug) { log.debug("invoking read()"); } // Determine how many bytes are left in the current data chunk updateChunkAvail(); int ret = 0; if (isEOD) { ret = -1; } else { chunkAvail--; ret = in.readByte(); } log.debug("returning " + ret); return ret; } /** * Read an array of logical bytes */ public int read(byte[] b, int off, int len) throws IOException { if (isDebug) { log.debug("invoking read with off=" + off + " and len=" + len); } if (isEOD) { if (isDebug) { log.debug("EOD returning -1"); } return -1; } int bytesRead = 0; while ((len >0 && !isEOD)) { // Determine how many bytes are left in the current data chunk updateChunkAvail(); if (!isEOD) { // Read the amount of bytes requested or the number of bytes available in the current chunk int readLength = len < chunkAvail ? len : chunkAvail; int br = in.read(b, off, readLength); if (br < 0) { throw new IOException("End of File encountered"); } // Update state with the number of bytes read off += br; len -= br; chunkAvail -= br; bytesRead += br; } } if (isDebug) { log.debug("bytes read = " + bytesRead); } return bytesRead; } public int read(byte[] b) throws IOException { return read(b, 0, b.length); } public void close() throws IOException { if (isDebug) { log.debug("start close"); } // Keep reading chunks until EOD if (!isEOD) { byte[] tempBuffer = new byte[4 * 1024]; while (!isEOD) { read(tempBuffer); } } if (isDebug) { log.debug("end close"); } } /** * updateChunkAvail updates the chunkAvail field with the * amount of data in the chunk. * @throws IOException */ private void updateChunkAvail() throws IOException { // If there are no more bytes in the current chunk, // read the size of the next datablock if (chunkAvail == 0 && !isEOD) { chunkAvail = in.readInt(); if (isDebug) { log.debug("New DataBlock with size=" + chunkAvail); } if (chunkAvail <= 0) { if (isDebug) { log.debug("End of data"); } isEOD = true; chunkAvail = 0; } } } } } ./src/org/apache/axis2/context/externalize/DebugObjectInput.java0000664000175000017500000001445111767656530024115 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectStreamConstants; /** * DebugObjectInput delegates to an ObjectInput object. * Each method logs in/out trace information. */ public class DebugObjectInput implements ObjectInput, ObjectStreamConstants { private static final Log log = LogFactory.getLog(DebugObjectInput.class); private static final boolean isDebug = log.isDebugEnabled(); ObjectInput oi; // delegate public DebugObjectInput(ObjectInput oi) { super(); this.oi = oi; } public int available() throws IOException { trace("start available()"); int value = oi.available(); trace("end available() =" + value); return value; } public void close() throws IOException { trace("start close()"); oi.close(); trace("end close()"); } public int read() throws IOException { trace("start read()"); int value = oi.read(); trace("end read()=" + value); return value; } public int read(byte[] b, int off, int len) throws IOException { trace("start read(b, off, len) off=" + off + " len="+len); int value = oi.read(b, off, len); trace("end read(b,off,len)=" + value); return value; } public int read(byte[] b) throws IOException { trace("start read(b) b.length=" + b.length); int value = oi.read(b); trace("end read(b)=" + value); return value; } public boolean readBoolean() throws IOException { trace("start readBoolean()"); boolean value = oi.readBoolean(); trace("end readBoolean()=" + value); return value; } public byte readByte() throws IOException { trace("start readByte"); byte value = oi.readByte(); trace("end readByte()=" + value); return value; } public char readChar() throws IOException { trace("start readChar"); char value = oi.readChar(); trace("end readChar()=" + value); return value; } public double readDouble() throws IOException { trace("start readDouble"); double value = oi.readDouble(); trace("end readDouble()=" + value); return value; } public float readFloat() throws IOException { trace("start readFloat"); float value = oi.readFloat(); trace("end readFloat()=" + value); return value; } public void readFully(byte[] b, int off, int len) throws IOException { trace("start readFully(b,off,len) off=" + off + " len="+len); oi.readFully(b, off, len); trace("end readFully(b,off,len)"); } public void readFully(byte[] b) throws IOException { trace("start readFully(b) b.length="+ b.length); oi.readFully(b); trace("end readFully(b)"); } public int readInt() throws IOException { trace("start readInt()"); int value = oi.readInt(); trace("end readInt()="+ value); return value; } public String readLine() throws IOException { trace("start readLine()"); String value = oi.readLine(); trace("end readLine()="+ value); return value; } public long readLong() throws IOException { trace("start readLong()"); long value = oi.readLong(); trace("end readLong()="+ value); return value; } public Object readObject() throws ClassNotFoundException, IOException { trace("start readObject()"); Object value = oi.readObject(); trace("end readObject()="+ valueName(value)); return value; } public short readShort() throws IOException { trace("start readShort()"); short value = oi.readShort(); trace("end readShort()="+ value); return value; } public int readUnsignedByte() throws IOException { trace("start readLong()"); int value = oi.readUnsignedByte(); trace("end readUnsignedByte()="+ value); return value; } public int readUnsignedShort() throws IOException { trace("start readShort()"); int value = oi.readUnsignedShort(); trace("end readShort()="+ value); return value; } public String readUTF() throws IOException { trace("start readUTF()"); String value = oi.readUTF(); trace("end readUTF()="+ value); return value; } public long skip(long n) throws IOException { trace("start skip(n) n="+n); long value = oi.skip(n); trace("end skip(n)="+ value); return value; } public int skipBytes(int n) throws IOException { trace("start skipBytes(n) n="+n); int value = oi.skipBytes(n); trace("end skipBytes(n)="+ value); return value; } public void trace(String str) { if (isDebug) { log.debug(str); } } private String valueName(Object obj) { if (obj == null) { return "null"; } else if (obj instanceof String) { return (String) obj; } else { return "Object of class = " + obj.getClass().getName(); } } } ./src/org/apache/axis2/context/externalize/SafeSerializable.java0000664000175000017500000000221311767656530024116 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import java.io.Serializable; /** * This is a marker interface that indicates that the Object * and all contents of the Object can be serialized safely without * buffering. * * @See SafeObjectOutputStream * */ public interface SafeSerializable extends Serializable { } ./src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java0000664000175000017500000005752211767656530025330 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.ObjectOutputStream.PutField; import java.io.ObjectStreamConstants; import java.io.Serializable; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; /** * A SafeObjectOutputStream provides extra mechanisms to ensure that * objects can be safely serialized to the ObjectOutput. * * If an Object is written to a normal ObjectOutput, the ObjectOutput is left in * an unknown state if a NotSerializableException occurs. * * The SafeObjectOutputStream does some additonal checking to ensure that the Object can * be safely written. If the Object is suspicious, it is first written to a buffer to ensure * that the underlying ObjectOutput is not corrupted. * * In addition, SafeObjectOutputStream provides extra methods to write containers of Objects. * For example the writeMap object will write the key and value pairs that are can be serialized. * * @see SafeObjectInputStream * */ public class SafeObjectOutputStream implements ObjectOutput, ObjectStreamConstants, ExternalizeConstants { private static final Log log = LogFactory.getLog(SafeObjectOutputStream.class); private static final boolean isDebug = log.isDebugEnabled(); // Actual Stream private ObjectOutput out = null; // There are two ways to write out an object, a series of bytes or an Object. // These flags are embedded in the stream so that the reader knows which form was used. private static final boolean FORM_BYTE = false; private static final boolean FORM_OBJECT = true; // Temporary ObjectOutputStream for MyOOS tempOOS = null; // As a way to improve performance and reduce trace logging with // extra exceptions, keep a table of classes that are not serializable // and only log the first time it that the class is encountered in // an NotSerializableException // note that the Hashtable is synchronized by Java so we shouldn't need to // do extra control over access to the table public static final Hashtable notSerializableList = new Hashtable(); /** * Add the SafeOutputStream if necessary. * @param out Current ObjectOutput * @return * @throws IOException */ public static SafeObjectOutputStream install(ObjectOutput out) throws IOException { if (out instanceof SafeObjectOutputStream) { return (SafeObjectOutputStream) out; } return new SafeObjectOutputStream(out); } /** * Intentionally private. * Callers should use the install method to add the SafeObjectOutputStream * into the stream. * @param oo * @throws IOException */ private SafeObjectOutputStream(ObjectOutput oo) throws IOException { if (log.isDebugEnabled()) { this.out = new DebugObjectOutputStream(oo); } else { this.out = oo; } } // START DELEGATE METHODS public void close() throws IOException { if (tempOOS != null) { tempOOS.close(); tempOOS = null; } out.close(); } public void defaultWriteObject() throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).defaultWriteObject(); } } public boolean equals(Object o) { return out.equals(o); } public void flush() throws IOException { out.flush(); } public int hashCode() { return out.hashCode(); } public PutField putFields() throws IOException { if (out instanceof ObjectOutputStream) { return ((ObjectOutputStream)out).putFields(); } else { throw new IOException("This method is not supported."); } } public void reset() throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).reset(); } } public String toString() { return out.toString(); } public void useProtocolVersion(int version) throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).useProtocolVersion(version); } } public void write(byte[] buf, int off, int len) throws IOException { out.write(buf, off, len); } public void write(byte[] buf) throws IOException { out.write(buf); } public void write(int val) throws IOException { out.write(val); } public void writeBoolean(boolean val) throws IOException { out.writeBoolean(val); } public void writeByte(int val) throws IOException { out.writeByte(val); } public void writeBytes(String str) throws IOException { out.writeBytes(str); } public void writeChar(int val) throws IOException { out.writeChar(val); } public void writeChars(String str) throws IOException { out.writeChars(str); } public void writeDouble(double val) throws IOException { out.writeDouble(val); } public void writeFields() throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).writeFields(); } } public void writeFloat(float val) throws IOException { out.writeFloat(val); } public void writeInt(int val) throws IOException { out.writeInt(val); } public void writeLong(long val) throws IOException { out.writeLong(val); } public void writeObject(Object obj) throws IOException { writeObject(obj, false); // Assume object is not safe } public void writeShort(int val) throws IOException { out.writeShort(val); } public void writeUTF(String str) throws IOException { out.writeUTF(str); } // END DELEGATE METHODS /** * Write a map * * FORMAT for null map * EMPTY_OBJECT * * FORMAT for non-empty map * ACTIVE_OBJECT * for each contained key value pair * writePair * EMPTY_OBJECT (indicates end of the list * * @param ll * @return * @throws IOException */ public boolean writeMap(Map map) throws IOException { if (map == null) { out.writeBoolean(EMPTY_OBJECT); return false; } else { out.writeBoolean(ACTIVE_OBJECT); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { final Map.Entry entry = (Entry) it.next(); writePair(entry.getKey(), false, entry.getValue(), false); } // Empty object indicates end of list out.writeBoolean(EMPTY_OBJECT); } return true; } /** * Write a list. * * FORMAT for null list * EMPTY_OBJECT * * FORMAT for non-empty list * ACTIVE_OBJECT * for each contained object * ACTOVE_OBJECT * writeObject * EMPTY_OBJECT (indicates end of the list * * @param ll * @return * @throws IOException */ public boolean writeList(List al) throws IOException { if (al == null) { out.writeBoolean(EMPTY_OBJECT); return false; } else { out.writeBoolean(ACTIVE_OBJECT); Iterator it = al.iterator(); while (it.hasNext()) { Object value = it.next(); writeItem(value, false); } // Empty object indicates end of list out.writeBoolean(EMPTY_OBJECT); } return true; } /** * Writes an object to the stream. * If the object is known (apriori) to be completely serializable it * is "safe". Safe objects are written directly to the stream. * Objects that are not known are to be safe are tested for safety and * only written if they are deemed safe. Unsafe objects are not written. * Note: The java.io.ObjectOutputStream is left in an unrecoverable state * if any object written to it causes a serialization error. So please * use the isSafe parameter wisely * * FORMAT for NULL Object * EMPTY_OBJECT * * FORMAT for non-serializable Object * EMPTY_OBJECT * * FORMAT for safe serializable Object * ACTIVE_OBJECT * FORM_OBJECT * Object * * FORMAT for other serializable Object * ACTIVE_OBJECT * FORM_BYTE * length of bytes * bytes representing the object * * @param obj * @param isSafe true if you know that object can be safely serialized. false if the * object needs to be tested for serialization. * @returns true if written * @throws IOException */ private boolean writeObject(Object obj, boolean isSafe) throws IOException { if (isDebug) { log.debug("Writing object:" + valueName(obj)); } // Shortcut for null objects if (obj == null) { out.writeBoolean(EMPTY_OBJECT); return false; } // Shortcut for non-serializable objects if (!isSafe) { if (!isSerializable(obj)) { out.writeBoolean(EMPTY_OBJECT); return false; } } // If not safe, see if there are characteristics of the Object // that guarantee that it can be safely serialized // (for example Strings are always serializable) if (!isSafe) { isSafe = isSafeSerializable(obj); } if (isSafe) { // Use object form if (isDebug) { log.debug(" write using object form"); } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_OBJECT); out.writeObject(obj); } else { // Fall-back to byte form if (isDebug) { log.debug(" write using byte form"); } MyOOS tempOOS; try { tempOOS = writeTempOOS(obj); } catch (IOException e) { // Put a EMPTY object in the file out.writeBoolean(EMPTY_OBJECT); throw e; } if (tempOOS == null) { out.writeBoolean(EMPTY_OBJECT); return false; } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_BYTE); tempOOS.write(out); resetOnSuccess(); } return true; } /** * Writes pair of objects to the stream. * * If the objects are known (apriori) to be completely serializable they * are "safe". Safe objects are written directly to the stream. * Objects that are not known are to be safe are tested for safety and * only written if they are deemed safe. Unsafe objects are not written. * Note: The java.io.ObjectOutputStream is left in an unrecoverable state * if any object written to it causes a serialization error. So please * use the isSafe parameter wisely * * * FORMAT for non-serializable key/value pair * nothing is written * * FORMAT for safe serializable key/value pair * ACTIVE_OBJECT * FORM_OBJECT * Object * * FORMAT for other serializable key/value pair * ACTIVE_OBJECT * FORM_BYTE * length of bytes * bytes representing the object * * @param obj1 * @param isSafe1 true if you know that object can be safely serialized. false if the * object needs to be tested for serialization. * @param obj2 * @param isSafe2 true if you know that object can be safely serialized. false if the * object needs to be tested for serialization. * @returns true if both are written to the stream * @throws IOException */ public boolean writePair(Object obj1, boolean isSafe1, Object obj2, boolean isSafe2) throws IOException { if (isDebug) { log.debug("Writing key=" + valueName(obj1) + " value="+valueName(obj2)); } // Shortcut for non-serializable objects if ((!isSafe1 && !isSerializable(obj1)) || (!isSafe2 && !isSerializable(obj2))) { return false; } boolean isSafe = (isSafe1 || isSafeSerializable(obj1)) && (isSafe2 || isSafeSerializable(obj2)); if (isSafe) { if (isDebug) { log.debug(" write using object form"); } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_OBJECT); out.writeObject(obj1); out.writeObject(obj2); } else { if (isDebug) { log.debug(" write using byte form"); } MyOOS tempOOS = writeTempOOS(obj1, obj2); if (tempOOS == null) { return false; } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_BYTE); tempOOS.write(out); resetOnSuccess(); } return true; } /** * Writes pair of objects to the stream. * * If the objects are known (apriori) to be completely serializable they * are "safe". Safe objects are written directly to the stream. * Objects that are not known are to be safe are tested for safety and * only written if they are deemed safe. Unsafe objects are not written. * Note: The java.io.ObjectOutputStream is left in an unrecoverable state * if any object written to it causes a serialization error. So please * use the isSafe parameter wisely * * * FORMAT for non-serializable key/value pair * nothing is written * * FORMAT for safe serializable key/value pair * ACTIVE_OBJECT * FORM_OBJECT * Object * * FORMAT for other serializable key/value pair * ACTIVE_OBJECT * FORM_BYTE * length of bytes * bytes representing the object * * @param obj1 * @param isSafe1 true if you know that object can be safely serialized. false if the * object needs to be tested for serialization. * @param obj2 * @param isSafe2 true if you know that object can be safely serialized. false if the * object needs to be tested for serialization. * @returns true if both are written to the stream * @throws IOException */ public boolean writeItem(Object obj, boolean isSafe) throws IOException { if (isDebug) { log.debug("Writing obj=" + valueName(obj)); } // Shortcut for non-serializable objects if (!isSafe && !isSerializable(obj)) { return false; } isSafe = (isSafe || isSafeSerializable(obj)); if (isSafe) { if (isDebug) { log.debug(" write using object form"); } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_OBJECT); out.writeObject(obj); } else { if (isDebug) { log.debug(" write using byte form"); } MyOOS tempOOS; try { tempOOS = writeTempOOS(obj); } catch (RuntimeException e) { return false; } if (tempOOS == null) { return false; } out.writeBoolean(ACTIVE_OBJECT); out.writeBoolean(FORM_BYTE); tempOOS.write(out); resetOnSuccess(); } return true; } /** * Does a quick check of the implemented interfaces to ensure that this * object is serializable * @return true if the object is marked as Serializable */ private static boolean isSerializable(Object obj) { boolean isSerializable = (obj == null) || obj instanceof Serializable; if (!isSerializable) { markNotSerializable(obj); } return isSerializable; } /** * Does a quick check of the implemented class is safe to serialize without * buffering. * @return true if the object is marked as safe. */ private static boolean isSafeSerializable(Object obj) { boolean isSafeSerializable = (obj == null) || obj instanceof SafeSerializable || obj instanceof String || obj instanceof Integer || obj instanceof Boolean || obj instanceof Long; return isSafeSerializable; } /** * Write the object to a temporary ObjectOutput * @param obj * @return ObjectOutput if successful */ private MyOOS writeTempOOS(Object obj) throws IOException { MyOOS oos = null; try { oos = getTempOOS(); oos.writeObject(obj); oos.flush(); } catch (NotSerializableException nse2) { markNotSerializable(obj); if (oos != null) { resetOnFailure(); oos = null; } throw nse2; } catch (IOException e) { if (oos != null) { resetOnFailure(); oos = null; } throw e; } catch (RuntimeException e) { if (oos != null) { resetOnFailure(); oos = null; } throw e; } return oos; } /** * Write the objects to a temporary ObjectOutput * @param obj1 * @param obj2 * @return ObjectOutput if successful */ private MyOOS writeTempOOS(Object obj1, Object obj2) throws IOException { MyOOS oos = null; boolean first = true; try { oos = getTempOOS(); oos.writeObject(obj1); first = false; oos.writeObject(obj2); oos.flush(); } catch (NotSerializableException nse2) { // This is okay and expected in some cases. // Log the error and continue markNotSerializable((first) ? obj1 :obj2); if (oos != null) { resetOnFailure(); oos = null; } } catch (IOException e) { if (oos != null) { resetOnFailure(); oos = null; } throw e; } catch (RuntimeException e) { if (oos != null) { resetOnFailure(); oos = null; } throw e; } return oos; } /** * Get or create a temporary ObjectOutputStream * @return MyOOS * @throws IOException */ private MyOOS getTempOOS() throws IOException { if (tempOOS == null) { tempOOS = new MyOOS(new MyBAOS()); } return tempOOS; } /** * If a failure occurs, reset the temporary ObjectOutputStream */ private void resetOnFailure() throws IOException { if (tempOOS != null) { tempOOS.close(); tempOOS = null; // The ObjectOutput is in an unknown state and thus discarded } } /** * Reset the temporary ObjectOutputStream * @throws IOException */ private void resetOnSuccess() throws IOException { tempOOS.reset(); } private static void markNotSerializable(Object obj) { if (!isDebug) { return; } if (obj != null) { String name = obj.getClass().getName(); Object value = notSerializableList.get(name); if (value == null) { notSerializableList.put(name, name); if (log.isTraceEnabled()) { log.trace("***NotSerializableException*** [" + name + "]"); } } } } private String valueName(Object obj) { if (obj == null) { return "null"; } else if (obj instanceof String) { return (String) obj; } else { return "Object of class = " + obj.getClass().getName(); } } /** * MyBAOS is a ByteArrayOutputStream with a few additions. * */ static class MyBAOS extends ByteArrayOutputStream { /** * Return direct access to the buffer without creating a copy of the byte[] * @return buf */ public byte[] getBytes() { return buf; } /** * Reset to a specific index in the buffer * @param count */ public void reset(int count) { this.count = count; } } /** * MyOOS is an ObjectOutputStream with a few performant additions. * */ static class MyOOS extends ObjectOutputStream { MyBAOS baos; int dataOffset; MyOOS(MyBAOS baos) throws IOException { super(baos); super.flush(); this.baos = baos; // Capture the data offset // (the location where data starts..which is after header information) dataOffset = baos.size(); } /** * Override the reset so that we can reset to the data offset. */ public void reset() throws IOException { super.reset(); // Reset the byte stream to the position past the headers baos.reset(dataOffset); } /** * Write the contents of MyOOS to the indicated ObjectOutput. * Note that this direct write avoids any byte[] buffer creation * @param out * @throws IOException */ public void write(ObjectOutput out) throws IOException { out.flush(); // out.writeObject(out.toByteArray()); out.writeInt(baos.size()); out.write(baos.getBytes(),0,baos.size()); } } } ./src/org/apache/axis2/context/externalize/ActivateUtils.java0000664000175000017500000005733511767656530023511 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.Handler; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.util.MetaDataEntry; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; /** * Some Externalize objects must be "activated" after they are read. * Activation normally involves associating the object with objects in the current * runtime. * * ActivateUtils provides activation related utilities */ public class ActivateUtils { private static final Log log = LogFactory.getLog(ActivateUtils.class); /** * Private Constructor * All methods in ActivateUtils are static. */ private ActivateUtils() {} /** * Find the AxisServiceGroup object that matches the criteria *

    * Note the saved service group meta information may not * match up with any of the serviceGroups that * are in the current AxisConfiguration object. * * @param axisConfig The AxisConfiguration object * @param serviceGrpClassName the class name string for the target object * (could be a derived class) * @param serviceGrpName the name associated with the service group * @return the AxisServiceGroup object that matches the criteria */ public static AxisServiceGroup findServiceGroup(AxisConfiguration axisConfig, String serviceGrpClassName, String serviceGrpName) { Iterator its = axisConfig.getServiceGroups(); while (its.hasNext()) { AxisServiceGroup serviceGroup = (AxisServiceGroup) its.next(); String tmpSGClassName = serviceGroup.getClass().getName(); String tmpSGName = serviceGroup.getServiceGroupName(); if (tmpSGClassName.equals(serviceGrpClassName)) { boolean found = false; // the serviceGroupName can be null, so either both the // service group names are null or they match if ((tmpSGName == null) && (serviceGrpName == null)) { found = true; } else if ((tmpSGName != null) && (tmpSGName.equals(serviceGrpName))) { found = true; } if (found) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findServiceGroup(): returning [" + serviceGrpClassName + "] [" + serviceGrpName + "]"); } return serviceGroup; } } } // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findServiceGroup(): [" + serviceGrpClassName + "] [" + serviceGrpName + "] returning [null]"); } return null; } /** * Find the AxisService object that matches the criteria * * @param axisConfig The AxisConfiguration object * @param serviceClassName the class name string for the target object * (could be a derived class) * @param serviceName the name associated with the service * @return the AxisService object that matches the criteria */ public static AxisService findService(AxisConfiguration axisConfig, String serviceClassName, String serviceName) { HashMap services = axisConfig.getServices(); Iterator its = services.values().iterator(); while (its.hasNext()) { AxisService service = (AxisService) its.next(); String tmpServClassName = service.getClass().getName(); String tmpServName = service.getName(); if ((tmpServClassName.equals(serviceClassName)) && (tmpServName.equals(serviceName))) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findService(): returning [" + serviceClassName + "] [" + serviceName + "]"); } return service; } } // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findService(): [" + serviceClassName + "] [" + serviceName + "] returning [null]"); } return null; } /** * Find the AxisOperation object that matches the criteria * * @param axisConfig The AxisConfiguration object * @param opClassName the class name string for the target object * (could be a derived class) * @param opQName the name associated with the operation * @return the AxisOperation object that matches the given criteria */ public static AxisOperation findOperation(AxisConfiguration axisConfig, String opClassName, QName opQName) { HashMap services = axisConfig.getServices(); Iterator its = services.values().iterator(); while (its.hasNext()) { AxisService service = (AxisService) its.next(); Iterator ito = service.getOperations(); while (ito.hasNext()) { AxisOperation operation = (AxisOperation) ito.next(); String tmpOpName = operation.getClass().getName(); QName tmpOpQName = operation.getName(); if ((tmpOpName.equals(opClassName)) && (tmpOpQName.equals(opQName))) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findOperation(axisCfg): returning [" + opClassName + "] [" + opQName.toString() + "]"); } return operation; } } } // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findOperation(axisCfg): [" + opClassName + "] [" + opQName.toString() + "] returning [null]"); } return null; } /** * Find the AxisOperation object that matches the criteria * * @param service The AxisService object * @param opClassName The class name string for the target object * (could be a derived class) * @param opQName the name associated with the operation * @return the AxisOperation object that matches the given criteria */ public static AxisOperation findOperation(AxisService service, String opClassName, QName opQName) { if (service == null) { return null; } Iterator ito = service.getOperations(); while (ito.hasNext()) { AxisOperation operation = (AxisOperation) ito.next(); String tmpOpName = operation.getClass().getName(); QName tmpOpQName = operation.getName(); if ((tmpOpName.equals(opClassName)) && (tmpOpQName.equals(opQName))) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findOperation(service): returning [" + opClassName + "] [" + opQName.toString() + "]"); } return operation; } } // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findOperation(service): [" + opClassName + "] [" + opQName.toString() + "] returning [null]"); } return null; } /** * Find the AxisMessage object that matches the criteria * * @param op The AxisOperation object * @param msgName The name associated with the message * @param msgElementName The name associated with the message element * @return the AxisMessage object that matches the given criteria */ public static AxisMessage findMessage(AxisOperation op, String msgName, String msgElementName) { // Several kinds of AxisMessages can be associated with a particular // AxisOperation. The kinds of AxisMessages that are typically // accessible are associated with "in" and "out". // There are also different kinds of AxisOperations, and each // type of AxisOperation can have its own mix of AxisMessages // depending on the style of message exchange pattern (mep) if (op == null) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findMessage(): [" + msgName + "] [" + msgElementName + "] returning [null] - no AxisOperation"); } return null; } if (msgName == null) { // nothing to match with, expect to match against a name // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findMessage(): [" + msgName + "] [" + msgElementName + "] returning [null] - message name is not set"); } return null; } String tmpName = null; String tmpElementName = null; //------------------------------------- // first try the "out" message //------------------------------------- AxisMessage out = null; try { out = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); } catch (Exception ex) { // just absorb the exception } if (out != null) { tmpName = out.getName(); QName tmpQout = out.getElementQName(); if (tmpQout != null) { tmpElementName = tmpQout.toString(); } } // check the criteria for a match boolean matching = matchMessageNames(tmpName, tmpElementName, msgName, msgElementName); if (matching) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findMessage(): returning OUT message [" + msgName + "] [" + msgElementName + "] "); } return out; } //------------------------------------- // next, try the "in" message //------------------------------------- AxisMessage in = null; try { in = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } catch (Exception ex) { // just absorb the exception } if (in != null) { tmpName = in.getName(); QName tmpQin = in.getElementQName(); if (tmpQin != null) { tmpElementName = tmpQin.toString(); } } else { tmpName = null; tmpElementName = null; } // check the criteria for a match matching = matchMessageNames(tmpName, tmpElementName, msgName, msgElementName); if (matching) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findMessage(): returning IN message [" + msgName + "] [" + msgElementName + "] "); } return in; } // if we got here, then no match was found // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findMessage(): [" + msgName + "] [" + msgElementName + "] returning [null]"); } return null; } /** * Find the Handler object that matches the criteria * * @param existingHandlers The list of existing handlers and phases * @param handlerClassName the class name string for the target object * (could be a derived class) * @return the Handler object that matches the criteria */ public static Object findHandler(ArrayList existingHandlers, MetaDataEntry metaDataEntry) //String handlerClassName) { String title = "ObjectStateUtils:findHandler(): "; String handlerClassName = metaDataEntry.getClassName(); String qNameAsString = metaDataEntry.getQNameAsString(); for (int i = 0; i < existingHandlers.size(); i++) { if (existingHandlers.get(i) != null) { String tmpClassName = existingHandlers.get(i).getClass().getName(); String tmpName = ((Handler) existingHandlers.get(i)).getName().toString(); if ((tmpClassName.equals(handlerClassName)) && (tmpName.equals(qNameAsString))) { // trace point if (log.isTraceEnabled()) { log.trace(title + " [" + handlerClassName + "] name [" + qNameAsString + "] returned"); } return (Handler) (existingHandlers.get(i)); } } } // trace point if (log.isTraceEnabled()) { log.trace(title + " [" + handlerClassName + "] name [" + qNameAsString + "] was not found in the existingHandlers list"); } return null; } /** * Find the TransportListener object that matches the criteria *

    * Note the saved meta information may not * match up with any of the objects that * are in the current AxisConfiguration object. * * @param axisConfig The AxisConfiguration object * @param listenerClassName the class name string for the target object * (could be a derived class) * @return the TransportListener object that matches the criteria */ public static TransportListener findTransportListener(AxisConfiguration axisConfig, String listenerClassName) { // TODO: investigate a better technique to match up with a TransportListener HashMap transportsIn = axisConfig.getTransportsIn(); // get a collection of the values in the map Collection values = transportsIn.values(); Iterator i = values.iterator(); while (i.hasNext()) { TransportInDescription ti = (TransportInDescription) i.next(); TransportListener tl = ti.getReceiver(); String tlClassName = tl.getClass().getName(); if (tlClassName.equals(listenerClassName)) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findTransportListener(): [" + listenerClassName + "] returned"); } return tl; } } // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:findTransportListener(): returning [null]"); } return null; } /** * Compares the two collections to see if they are equivalent. * * @param a1 The first collection * @param a2 The second collection * @param strict Indicates whether strict checking is required. Strict * checking means that the two collections must have the * same elements in the same order. Non-strict checking * means that the two collections must have the same * elements, but the order is not significant. * @return TRUE if the two collections are equivalent * FALSE, otherwise */ public static boolean isEquivalent(ArrayList a1, ArrayList a2, boolean strict) { if ((a1 != null) && (a2 != null)) { // check number of elements in lists int size1 = a1.size(); int size2 = a2.size(); if (size1 != size2) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:isEquivalent(ArrayList,ArrayList): FALSE - size mismatch [" + size1 + "] != [" + size2 + "]"); } return false; } if (strict) { // Strict checking // The lists must contain the same elements in the same order. return (a1.equals(a2)); } else { // Non-strict checking // The lists must contain the same elements but the order is not required. Iterator i1 = a1.iterator(); while (i1.hasNext()) { Object obj1 = i1.next(); if (!a2.contains(obj1)) { // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:isEquivalent(ArrayList,ArrayList): FALSE - mismatch with element [" + obj1.getClass().getName() + "] "); } return false; } } return true; } } else if ((a1 == null) && (a2 == null)) { return true; } else if ((a1 != null) && (a2 == null)) { if (a1.size() == 0) { return true; } return false; } else if ((a1 == null) && (a2 != null)) { if (a2.size() == 0) { return true; } return false; } else { // mismatch // trace point if (log.isTraceEnabled()) { log.trace("ObjectStateUtils:isEquivalent(ArrayList,ArrayList): FALSE - mismatch in lists"); } return false; } } /** * Compares the two collections to see if they are equivalent. * * @param m1 The first collection * @param m2 The second collection * @param strict Indicates whether strict checking is required. Strict * checking means that the two collections must have the * same mappings. Non-strict checking means that the * two collections must have the same keys. In both * cases, the order is not significant. * @return TRUE if the two collections are equivalent * FALSE, otherwise */ public static boolean isEquivalent(Map m1, Map m2, boolean strict) { if ((m1 != null) && (m2 != null)) { if (strict) { // This is a strict test. // Returns true if the given object is also a map and the two Maps // represent the same mappings. return (m1.equals(m2)); } else { int size1 = m1.size(); int size2 = m2.size(); if (size1 != size2) { return false; } // check the keys, ordering is not important between the two maps Iterator it1 = m1.keySet().iterator(); while (it1.hasNext()) { Object key1 = it1.next(); if (m2.containsKey(key1) == false) { return false; } } return true; } } else if ((m1 == null) && (m2 == null)) { return true; } else { // mismatch return false; } } /** * Compares the two collections to see if they are equivalent. * * @param l1 The first collection * @param l2 The second collection * @return TRUE if the two collections are equivalent * FALSE, otherwise */ public static boolean isEquivalent(LinkedList l1, LinkedList l2) { if ((l1 != null) && (l2 != null)) { // This is a strict test. // Returns true if the specified object is also a list, // both lists have the same size, and all corresponding pairs // of elements in the two lists are equal where // they contain the same elements in the same order. return (l1.equals(l2)); } else if ((l1 == null) && (l2 == null)) { return true; } else { // mismatch return false; } } /** * Check the first set of names for a match against * the second set of names. These names are * associated with AxisMessage objects. Message names * are expected to be non-null. Element names could * be either null or non-null. * * @param name1 The name for the first message * @param elementName1 The element name for the first message * @param name2 The name for the second message * @param elementName2 The element name for the second message * @return TRUE if there's a match, * FALSE otherwise */ private static boolean matchMessageNames(String name1, String elementName1, String name2, String elementName2) { // the name for the message must exist if ((name1 != null) && (name2 != null) && (name1.equals(name2))) { // there's a match on the name associated with the message object // element names need to match, including being null if ((elementName1 == null) && (elementName2 == null)) { // there's a match for the nulls return true; } else if ((elementName1 != null) && (elementName2 != null) && (elementName1.equals(elementName2))) { // there's a match for the element names return true; } else { // there's some mismatch return false; } } else { // either a message name is null or the names don't match return false; } } } ./src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java0000664000175000017500000001221611767656530025467 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.ObjectOutput; import java.io.ObjectStreamConstants; /** * DebugObjectOutputStream delegates to an ObjectOutput object. * Each method logs in/out trace information */ public class DebugObjectOutputStream implements ObjectStreamConstants, ObjectOutput { private static final Log log = LogFactory.getLog(DebugObjectOutputStream.class); private static final boolean isDebug = log.isDebugEnabled(); ObjectOutput out; DebugObjectOutputStream(ObjectOutput out) throws IOException { super(); trace("--START DebugOutputStream--"); this.out = out; } public void close() throws IOException { trace("--CLOSE DebugOutputStream--"); out.close(); } public void flush() throws IOException { trace ("start flush()"); out.flush(); trace ("end flush()"); } public void write(byte[] b, int off, int len) throws IOException { trace ("start write(b, off, len) off=" + off + " len=" + len); if (len > 4) { trace (" first four bytes = '" + b[off] + "' '" + b[off+1] + "' '" + b[off+2] + "' '" + b[off+3] + "'"); } out.write(b, off, len); trace ("end write(b, off, len)"); } public void write(byte[] b) throws IOException { trace ("start write(byte) byte=" + b); out.write(b); trace ("end write(b)"); } public void write(int b) throws IOException { trace ("start write(int) int=" + b); out.write(b); trace ("end write(int)"); } public void writeBoolean(boolean v) throws IOException { trace ("start writeBoolean(v) v=" + v); out.writeBoolean(v); trace ("end writeBoolean(v)"); } public void writeByte(int v) throws IOException { trace ("start writeByte(v) v=" + v); out.writeByte(v); trace ("end writeByte(v)"); } public void writeBytes(String s) throws IOException { trace ("start writeBytes(s) s=" + s); out.writeBytes(s); trace ("end writeBytes(s)"); } public void writeChar(int v) throws IOException { trace ("start writeChar(v) v=" + v); out.writeChar(v); trace ("end writeChar(v)"); } public void writeChars(String s) throws IOException { trace ("start writeChars(s) s=" + s); out.writeChars(s); trace ("end writeChars(s)"); } public void writeDouble(double v) throws IOException { trace ("start writeDouble(v) v=" + v); out.writeDouble(v); trace ("end writeDouble(v)"); } public void writeFloat(float v) throws IOException { trace ("start writeFloat(v) v=" + v); out.writeFloat(v); trace ("end writeFloat(v)"); } public void writeInt(int v) throws IOException { trace ("start writeInt(v) v=" + v); out.writeInt(v); trace ("end writeInt(v)"); } public void writeLong(long v) throws IOException { trace ("start writeLong(v) v=" + v); out.writeLong(v); trace ("end writeLong(v)"); } public void writeObject(Object obj) throws IOException { trace ("start writeObject(v) v=" + valueName(obj)); out.writeObject(obj); trace ("end writeObject(v)"); } public void writeShort(int v) throws IOException { trace ("start writeShort(v) v=" + v); out.writeShort(v); trace ("end writeShort(v)"); } public void writeUTF(String str) throws IOException { trace ("start writeUTF(v) v=" + str); out.writeUTF(str); trace ("end writeUTF(v)"); } public void trace(String str) { if (isDebug) { log.debug(str); } } private String valueName(Object obj) { if (obj == null) { return "null"; } else if (obj instanceof String) { return (String) obj; } else { return "Object of class = " + obj.getClass().getName(); } } } ./src/org/apache/axis2/context/externalize/ExternalizeConstants.java0000664000175000017500000000423511767656530025106 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; /** * Common Externalize Constants */ public interface ExternalizeConstants { // Objects are preceeded by a bit indicating if the object is empty or active public static final boolean EMPTY_OBJECT = false; // null object or empty object public static final boolean ACTIVE_OBJECT = true; // otherwise it is an active object // used to indicate the end of a list public static String LAST_ENTRY = "LAST_OBJ"; // used to indicate an "empty" object public static String EMPTY_MARKER = "EMPTY_OBJ"; // message/trace/logging strings public static final String UNSUPPORTED_SUID = "Serialization version ID is not supported."; public static final String UNSUPPORTED_REVID = "Revision ID is not supported."; public static final String OBJ_SAVE_PROBLEM = "The object could not be saved to the output stream. The object may or may not be important for processing the message when it is restored. Look at how the object is to be used during message processing."; public static final String OBJ_RESTORE_PROBLEM = "The object could not be restored from the input stream. The object may or may not be important for processing the message when it is restored. Look at how the object is to be used during message processing."; } ./src/org/apache/axis2/context/externalize/ObjectInputStreamWithCL.java0000664000175000017500000002326211767656530025375 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.context.externalize; import java.io.IOException; import java.io.InputStream; import java.io.ObjectStreamClass; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; import java.util.HashMap; /** * An ObjectInputStream that is constructed with a ClassLoader or ClassResolver. * The default behavior is to use the ContextClassLoader */ public class ObjectInputStreamWithCL extends java.io.ObjectInputStream { /** *

    * This interface is used to resolve OSGi declared serializable classes. *

    */ public interface ClassResolver { /** * Attempt to load the specified class. * * @param className * The classname. * @return The class, or null if not found. */ public Class resolveClass(String className); } private static final HashMap primClasses = new HashMap(8, 1.0F); /** The class resolver */ protected ClassResolver resolver; static { primClasses.put("boolean", boolean.class); primClasses.put("byte", byte.class); primClasses.put("char", char.class); primClasses.put("short", short.class); primClasses.put("int", int.class); primClasses.put("long", long.class); primClasses.put("float", float.class); primClasses.put("double", double.class); primClasses.put("void", void.class); } protected ClassLoader classloader; protected String name; /** * Construct using ContextClassLoader * @param is * @throws IOException */ public ObjectInputStreamWithCL(InputStream is) throws IOException { super(is); classloader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); } /** * Constructor that accepts a ClassLoader * @param is * @param cl * @throws IOException */ public ObjectInputStreamWithCL(InputStream is, ClassLoader cl) throws IOException { super(is); classloader = cl; } /** * Constructor that accepts a ClassResolver * @param is * @param r ClassResolver * @throws IOException */ public ObjectInputStreamWithCL(InputStream is, ClassResolver r) throws IOException { super(is); resolver = r; } /** * Override resolveClass so that we can use our own ClassLoader */ protected Class resolveClass(ObjectStreamClass objStrmClass) throws ClassNotFoundException { return resolveClass(objStrmClass.getName()); } private Class resolveClass(String name) throws ClassNotFoundException { try { this.name = name; return (Class) AccessController.doPrivileged(loadAction); } catch (java.security.PrivilegedActionException pae) { Exception wrapped = pae.getException(); if (wrapped instanceof ClassNotFoundException) throw (ClassNotFoundException) wrapped; throw new ClassNotFoundException(name); } } java.security.PrivilegedExceptionAction loadAction = new java.security.PrivilegedExceptionAction() { public java.lang.Object run() throws Exception { try { Class clazz = null; // If the resolver is set if (resolver != null) { // use the resolver to load the class. clazz = resolver.resolveClass(name); } // if the class is not loadable if (clazz == null) { clazz = loadClass(name, classloader); // d296416 } return clazz; } catch (ClassNotFoundException cnf) { Class c = (Class) primClasses.get(name); if (c != null) { return c; } throw cnf; } } }; // d296416: Use runtime bundle classloader (current) to resolve a class when // the class could not be resolved using the specified classloader. // A serializable class in a bundle should specify via // bundle extension point // that it is deserializable outside the current bundle. // NOTE: Looking up current classloader is only a tactical solution, // and could be deprecated in future. // private java.lang.Class loadClass(final String name, final ClassLoader loader) throws ClassNotFoundException { try { try { return (Class) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws ClassNotFoundException { return Class.forName(name, true, loader); } } ); } catch (PrivilegedActionException e) { throw (ClassNotFoundException) e.getException(); } } catch (ClassNotFoundException cnf) { try { return (Class) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws ClassNotFoundException { return Class.forName(name); } } ); } catch (PrivilegedActionException e) { throw (ClassNotFoundException) e.getException(); } } } /** * Override to provide our own resolution */ protected Class resolveProxyClass(String[] interfaces) throws ClassNotFoundException { if (interfaces.length == 0) { throw new ClassNotFoundException("zero-length interfaces array"); } Class nonPublicClass = null; final Class[] classes = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { classes[i] = resolveClass(interfaces[i]); if ((classes[i].getModifiers() & Modifier.PUBLIC) == 0) { // "if more than one non-public interface class loader is // encountered, an IllegalAccessError is thrown" if (nonPublicClass != null) { throw new IllegalAccessError(nonPublicClass + " and " + classes[i] + " both declared non-public"); } nonPublicClass = classes[i]; } } // The javadocs for this method say: // // "Unless any of the resolved interfaces are non-public, this same // value of loader is also the class loader passed to // Proxy.getProxyClass; if non-public interfaces are present, their // class loader is passed instead" // // Unfortunately, we don't have a single classloader that we can use. // Call getClassLoader() on either the non-public class (if any) or the // first class. proxyClass = nonPublicClass != null ? nonPublicClass : classes[0]; final ClassLoader loader = (ClassLoader) AccessController.doPrivileged(proxyClassLoaderAction); // "If Proxy.getProxyClass throws an IllegalArgumentException, // resolveProxyClass will throw a ClassNotFoundException containing the // IllegalArgumentException." try { return (Class) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Proxy.getProxyClass(loader, classes); } } ); } catch (IllegalArgumentException ex) { throw new ClassNotFoundException(ex.getMessage(), ex); } } private Class proxyClass; PrivilegedAction proxyClassLoaderAction = new PrivilegedAction() { public Object run() { return proxyClass.getClassLoader(); } }; } ./src/org/apache/axis2/description/0000775000175000017500000000000011767656530016355 5ustar brianbrian./src/org/apache/axis2/description/AxisBinding.java0000664000175000017500000002430611767656530021424 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.WSDLSerializationUtil; import org.apache.neethi.Policy; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * An AxisBinding represents a WSDL binding, and contains AxisBindingOperations. */ public class AxisBinding extends AxisDescription { private QName name; private String type; private Map options; private Map faults; public AxisBindingMessage getFault(String name) { return (AxisBindingMessage) faults.get(name); } public void addFault(AxisBindingMessage fault) { this.faults.put(fault.getName(), fault); } public AxisBinding() { options = new HashMap(); faults = new HashMap(); } public void setProperty(String name, Object value) { options.put(name, value); } /** * @param name name of the property to search for * @return the value of the property, or null if the property is not found */ public Object getProperty(String name) { Object obj = options.get(name); if (obj != null) { return obj; } // need this here to guarantee that we dont return a SOAP version for HTTP Bindings if (WSDL2Constants.ATTR_WSOAP_VERSION.equals(name) && WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { return null; } obj = WSDL20DefaultValueHolder.getDefaultValue(name); return obj; } public QName getName() { return name; } public void setName(QName name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Object getKey() { return null; } public void engageModule(AxisModule axisModule) throws AxisFault { throw new UnsupportedOperationException("Sorry we do not support this"); } public boolean isEngaged(String moduleName) { throw new UnsupportedOperationException("axisMessage.isEngaged() is not supported"); } /** * Generate the <binding> element * * @param wsdl the WSDL namespace * @param tns the target namespace * @param wsoap the SOAP namespace * @param whttp the HTTP namespace * @param interfaceName the name of the interface * @param nameSpaceMap the namespaceMap (prefix -> namespaceURI) of the service * @param addressingFlag addressing usage flag (see AddressingConstants) * @param serviceName the name of the service * @return the generated binding element */ public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap, OMNamespace whttp, String interfaceName, Map nameSpaceMap, String addressingFlag, String serviceName, OMNamespace wsaw) { String property; OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement bindingElement; bindingElement = omFactory.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl); bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, this.name.getLocalPart())); bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns.getPrefix() + ":" + interfaceName)); if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) || Constants.URI_SOAP12_HTTP.equals(type)) { // SOAP Binding specific properties bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_SOAP)); property = (String)options.get(WSDL2Constants.ATTR_WSOAP_VERSION); if (property != null) { if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(property)) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_VERSION, wsoap, WSDL2Constants.SOAP_VERSION_1_1)); } else { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_VERSION, wsoap, WSDL2Constants.SOAP_VERSION_1_2)); } } property = (String)options.get(WSDL2Constants.ATTR_WSOAP_PROTOCOL); if (property != null) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_PROTOCOL, wsoap, property)); } property = (String)options.get(WSDL2Constants.ATTR_WSOAP_MEP); if (property != null) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_MEP_DEFAULT, wsoap, property)); } ArrayList soapModules = (ArrayList)options.get(WSDL2Constants.ATTR_WSOAP_MODULE); if (soapModules != null && soapModules.size() > 0) { WSDLSerializationUtil .addSOAPModuleElements(omFactory, soapModules, wsoap, bindingElement); } WSDLSerializationUtil .addWSAddressingToBinding(addressingFlag, omFactory, bindingElement, wsaw); } else if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { // HTTP Binding specific properties property = (String)options.get(WSDL2Constants.ATTR_WHTTP_METHOD); if (property != null) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_METHOD_DEFAULT, whttp, property)); } bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_HTTP)); } // Common Properties property = (String)options.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING); if (property != null) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_CONTENT_ENCODING_DEFAULT, whttp, property)); } property = (String)options.get(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); if (property != null) { bindingElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_QUERY_PARAMETER_SEPERATOR_DEFAULT, whttp, property)); } // Populate Binding faults if (faults != null) { Iterator iterator = faults.values().iterator(); while (iterator.hasNext()) { AxisBindingMessage axisBindingFault = (AxisBindingMessage)iterator.next(); OMElement omElement = axisBindingFault.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap); omElement.setLocalName(WSDL2Constants.FAULT_LOCAL_NAME); bindingElement .addChild(omElement); } } // Populate Binding Operations Iterator iterator = this.getChildren(); while (iterator.hasNext()) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation)iterator.next(); bindingElement.addChild(axisBindingOperation.toWSDL20(wsdl, tns, wsoap, whttp, type, nameSpaceMap, serviceName)); } WSDLSerializationUtil.addWSDLDocumentationElement(this, bindingElement, omFactory, wsdl); WSDLSerializationUtil.addPoliciesAsExtensibleElement(this, bindingElement); return bindingElement; } public Policy getEffectivePolicy() { ArrayList policyList = new ArrayList(); policyList.addAll(getPolicyInclude().getAttachedPolicies()); // AxisEndpoint AxisEndpoint axisEndpoint = getAxisEndpoint(); if (axisEndpoint != null) { policyList.addAll(axisEndpoint.getPolicyInclude() .getAttachedPolicies()); } AxisService service = null; if (axisEndpoint != null) { service = axisEndpoint.getAxisService(); } if (service != null) { Policy effectivePolicy = service.getPolicyInclude().getEffectivePolicy(); if (effectivePolicy != null) { policyList.add(effectivePolicy); } } return PolicyUtil.getMergedPolicy(policyList, this); } public AxisEndpoint getAxisEndpoint() { return (AxisEndpoint)parent; } } ./src/org/apache/axis2/description/Flow.java0000664000175000017500000000316411767656530020133 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import java.util.ArrayList; import java.util.List; /** * Class FlowImpl */ public class Flow { /** * Field list */ protected final List list; /** * Constructor FlowImpl */ public Flow() { list = new ArrayList(); } /** * Method addHandler. * * @param handler */ public void addHandler(HandlerDescription handler) { list.add(handler); } /** * Method getHandler. * * @param index * @return Returns HandlerDescription. */ public HandlerDescription getHandler(int index) { return (HandlerDescription) list.get(index); } /** * Method getHandlerCount. * * @return Returns int. */ public int getHandlerCount() { return list.size(); } } ./src/org/apache/axis2/description/AxisModule.java0000664000175000017500000001767011767656530021305 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.modules.Module; import javax.xml.namespace.QName; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; /** *

    This holds the information about a Module.

    *
      *
    1. parameters
    2. *
    3. handlers
    4. *
        *

        Handler are registered once they are available. They are available to all services if axis2.xml * has a module ref="." or available to a single service if services.xml have module ref=".."

        */ public class AxisModule implements ParameterInclude { /** * Field flowInclude */ private final FlowInclude flowInclude = new FlowInclude(); /** * Field parameters */ private final ParameterInclude parameters = new ParameterIncludeImpl(); private Module module; private ClassLoader moduleClassLoader; // To keep the File that module came from private URL fileName; /** * Field name */ private String name; //This is to keep the version number of the module, if the module name is a-b-c-1.3.mar , // then the module version would be 1.3 private String version; // to store module operations , which are suppose to be added to a service if it is engaged to a service private HashMap operations = new HashMap(); private AxisConfiguration parent; /* * to store policies which are valid for any service for which the module is engaged */ private PolicyInclude policyInclude = null; // Small description about the module private String moduleDescription; private String[] supportedPolicyNames; private QName[] localPolicyAssertions; public static final String VERSION_SNAPSHOT = "SNAPSHOT"; public static final String MODULE_SERVICE = "moduleService"; private PolicySubject policySubject = new PolicySubject(); /** * Constructor ModuleDescription. */ public AxisModule() { } /** * Constructor ModuleDescription. * * @param name : Name of the module */ public AxisModule(String name) { this.name = name; } public void addOperation(AxisOperation axisOperation) { operations.put(axisOperation.getName(), axisOperation); } /** * @param param : Parameter to be added */ public void addParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameters.addParameter(param); } } public void removeParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameters.removeParameter(param); } } public void deserializeParameters(OMElement parameterElement) throws AxisFault { this.parameters.deserializeParameters(parameterElement); } /** * @return Returns Flow. */ public Flow getFaultInFlow() { return flowInclude.getFaultInFlow(); } public Flow getFaultOutFlow() { return flowInclude.getFaultOutFlow(); } /** * @return Returns Flow. */ public Flow getInFlow() { return flowInclude.getInFlow(); } /** * @return Returns Module. */ public Module getModule() { return module; } public ClassLoader getModuleClassLoader() { return moduleClassLoader; } /** * Get the name of this Module * @return a String name. */ public String getName() { return name; } public HashMap getOperations() { return operations; } /** * @return Returns Flow. */ public Flow getOutFlow() { return flowInclude.getOutFlow(); } /** * @return Returns Parameter. */ public Parameter getParameter(String name) { return parameters.getParameter(name); } public ArrayList getParameters() { return parameters.getParameters(); } public AxisConfiguration getParent() { return parent; } // to check whether a given parameter is locked public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean loscked = false; if (this.parent != null) { loscked = this.parent.isParameterLocked(parameterName); } if (loscked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } } /** * @param faultFlow : Arryalist of handlerDescriptions */ public void setFaultInFlow(Flow faultFlow) { flowInclude.setFaultInFlow(faultFlow); } /** * @param faultFlow : Arryalist of HandlerDescriptions */ public void setFaultOutFlow(Flow faultFlow) { flowInclude.setFaultOutFlow(faultFlow); } public void setInFlow(Flow inFlow) { flowInclude.setInFlow(inFlow); } /** * @param module : AxisModule */ public void setModule(Module module) { this.module = module; } public void setModuleClassLoader(ClassLoader moduleClassLoader) { this.moduleClassLoader = moduleClassLoader; } /** * @param name : Setting name of the module */ public void setName(String name) { this.name = name; } public void setOutFlow(Flow outFlow) { flowInclude.setOutFlow(outFlow); } public void setParent(AxisConfiguration parent) { this.parent = parent; } public void setPolicyInclude(PolicyInclude policyInclude) { this.policyInclude = policyInclude; } public PolicyInclude getPolicyInclude() { if (policyInclude == null) { policyInclude = new PolicyInclude(); } return policyInclude; } public PolicySubject getPolicySubject() { return policySubject; } public String getModuleDescription() { return moduleDescription; } public void setModuleDescription(String moduleDescription) { this.moduleDescription = moduleDescription; } public String[] getSupportedPolicyNamespaces() { return supportedPolicyNames; } public void setSupportedPolicyNamespaces(String[] supportedPolicyNamespaces) { this.supportedPolicyNames = supportedPolicyNamespaces; } public QName[] getLocalPolicyAssertions() { return localPolicyAssertions; } public void setLocalPolicyAssertions(QName[] localPolicyAssertions) { this.localPolicyAssertions = localPolicyAssertions; } public URL getFileName() { return fileName; } public void setFileName(URL fileName) { this.fileName = fileName; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } } ./src/org/apache/axis2/description/HandlerDescription.java0000664000175000017500000001175711767656530023014 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.Handler; import org.apache.axis2.i18n.Messages; import java.util.ArrayList; /** * Represents the deployment information about the handler */ public class HandlerDescription implements ParameterInclude { /** * Field className */ private String className; private Handler handler; private String name; private final ParameterInclude parameterInclude; private ParameterInclude parent; private PhaseRule rules; /** * Constructor HandlerDescription. */ public HandlerDescription() { this.parameterInclude = new ParameterIncludeImpl(); this.rules = new PhaseRule(); } /** * Constructor HandlerDescription. * * @param name name of handler */ public HandlerDescription(String name) { this(); this.name = name; } /** * Add a Parameter * * @param param the Parameter to associate with this HandlerDescription */ public void addParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameterInclude.addParameter(param); } } public void removeParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameterInclude.removeParameter(param); } } public void deserializeParameters(OMElement parameterElement) throws AxisFault { this.parameterInclude.deserializeParameters(parameterElement); } /** * Method getClassName. * * @return Returns String. */ public String getClassName() { return className; } /** * @return Returns Handler. */ public Handler getHandler() { return handler; } /** * @return Returns QName. */ public String getName() { return name; } /** * Get a named Parameter * * @param name name of Parameter to search * @return a Parameter, which may come from us or from some parent up the tree, or null. */ public Parameter getParameter(String name) { Parameter parameter = parameterInclude.getParameter(name); if (parameter == null && parent != null) { return parent.getParameter(name); } else { return parameter; } } public ArrayList getParameters() { return parameterInclude.getParameters(); } public ParameterInclude getParent() { return parent; } /** * Method getRules. * * @return Returns PhaseRule. */ public PhaseRule getRules() { return rules; } // to check whether the parameter is locked at any level public boolean isParameterLocked(String parameterName) { if (parent != null) { if (parent.isParameterLocked(parameterName)) { return true; } } return parameterInclude.isParameterLocked(parameterName); } /** * Method setClassName. * * @param className the class name of the Handler class */ public void setClassName(String className) { this.className = className; } /** * Explicitly set the Handler object * * @param handler a Handler instance, which will be deployed wherever this HandlerDescription is */ public void setHandler(Handler handler) { this.handler = handler; this.className = handler.getClass().getName(); } /** * Set the name * * @param name the desired name */ public void setName(String name) { this.name = name; } public void setParent(ParameterInclude parent) { this.parent = parent; } /** * Set the deployment rules for this HandlerDescription * * @param rules a PhaseRule object */ public void setRules(PhaseRule rules) { this.rules = rules; } } ./src/org/apache/axis2/description/InOnlyAxisOperation.java0000664000175000017500000001126011767656530023136 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.i18n.Messages; import org.apache.axis2.wsdl.WSDLConstants; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; public class InOnlyAxisOperation extends AxisOperation { private AxisMessage inFaultMessage; // private AxisMessage inMessage; private AxisMessage outFaultMessage; // this is just to store the chain , we don't use it private ArrayList outPhase; public InOnlyAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); createMessage(); setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY); } public InOnlyAxisOperation(QName name) { super(name); createMessage(); setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY); } public void addMessage(AxisMessage message, String label) { if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) { // inMessage = message; addChild("inMessage", message); } else { throw new UnsupportedOperationException("Not yet implemented"); } } public void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { if (!opContext.isComplete()) { opContext.getMessageContexts().put(MESSAGE_LABEL_IN_VALUE, msgContext); opContext.setComplete(true); } else { throw new AxisFault(Messages.getMessage("mepcompleted")); } } public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { HashMap mep = opContext.getMessageContexts(); MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE); if (faultMessageCtxt != null) { throw new AxisFault(Messages.getMessage("mepcompleted")); } else { mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext); opContext.setComplete(true); opContext.cleanup(); } } private void createMessage() { AxisMessage inMessage = new AxisMessage(); inMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN); inMessage.setParent(this); inFaultMessage = new AxisMessage(); inFaultMessage.setParent(this); outFaultMessage = new AxisMessage(); outFaultMessage.setParent(this); outPhase = new ArrayList(); addChild("inMessage", inMessage); } public AxisMessage getMessage(String label) { if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) { return (AxisMessage) getChild("inMessage"); } else { throw new UnsupportedOperationException(Messages.getMessage("invalidacess")); } } public ArrayList getPhasesInFaultFlow() { return inFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFaultFlow() { return outFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFlow() { return outPhase; } public ArrayList getRemainingPhasesInFlow() { return ((AxisMessage) getChild("inMessage")).getMessageFlow(); } public void setPhasesInFaultFlow(ArrayList list) { inFaultMessage.setMessageFlow(list); } public void setPhasesOutFaultFlow(ArrayList list) { outFaultMessage.setMessageFlow(list); } public void setPhasesOutFlow(ArrayList list) { outPhase = list; } public void setRemainingPhasesInFlow(ArrayList list) { ((AxisMessage) getChild("inMessage")).setMessageFlow(list); } } ./src/org/apache/axis2/description/ParameterIncludeImpl.java0000664000175000017500000002573511767656530023302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; /** * Class ParameterIncludeImpl */ public class ParameterIncludeImpl implements ParameterInclude, Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(ParameterIncludeImpl.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled(); private static final String myClassName = "ParameterIncludeImpl"; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = 8153736719090126891L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * Field parmeters */ protected final HashMap parameters; /** * Constructor ParameterIncludeImpl. */ public ParameterIncludeImpl() { parameters = new HashMap(); } /** * Method addParameter * * @param param */ public void addParameter(Parameter param) { if (param != null) { parameters.put(param.getName(), param); if (DEBUG_ENABLED) { this.debugParameterAdd(param); } } } public void removeParameter(Parameter param) throws AxisFault { parameters.remove(param.getName()); } /** * Since at runtime it parameters may be modified * to get the original state this method can be used * * @param parameters OMElement * @throws AxisFault */ public void deserializeParameters(OMElement parameters) throws AxisFault { Iterator iterator = parameters.getChildrenWithName(new QName(DeploymentConstants.TAG_PARAMETER)); while (iterator.hasNext()) { // this is to check whether some one has locked the parmeter at the top level OMElement parameterElement = (OMElement) iterator.next(); Parameter parameter = new Parameter(); // setting parameterElement parameter.setParameterElement(parameterElement); // setting parameter Name OMAttribute paraName = parameterElement.getAttribute(new QName(DeploymentConstants.ATTRIBUTE_NAME)); parameter.setName(paraName.getAttributeValue()); // setting parameter Value (the child element of the parameter) OMElement paraValue = parameterElement.getFirstElement(); if (paraValue != null) { parameter.setValue(parameterElement); parameter.setParameterType(Parameter.OM_PARAMETER); } else { String paratextValue = parameterElement.getText(); parameter.setValue(paratextValue); parameter.setParameterType(Parameter.TEXT_PARAMETER); } // setting locking attribute OMAttribute paraLocked = parameterElement.getAttribute(new QName(DeploymentConstants.ATTRIBUTE_LOCKED)); if (paraLocked != null) { String lockedValue = paraLocked.getAttributeValue(); if ("true".equals(lockedValue)) { parameter.setLocked(true); } else { parameter.setLocked(false); } } addParameter(parameter); } } /** * Method getParameter. * * @param name * @return Returns parameter. */ public Parameter getParameter(String name) { return (Parameter) parameters.get(name); } public ArrayList getParameters() { Collection col = parameters.values(); ArrayList para_list = new ArrayList(); for (Iterator iterator = col.iterator(); iterator.hasNext();) { Parameter parameter = (Parameter) iterator.next(); para_list.add(parameter); } return para_list; } // to check whether the parameter is locked at any level public boolean isParameterLocked(String parameterName) { return false; } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

        * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // write out contents of this object //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // collection of parameters //--------------------------------------------------------- out.writeMap(parameters); } /** * Restore the contents of the object that was previously saved. *

        * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // collection of parameters //--------------------------------------------------------- in.readMap(parameters); //--------------------------------------------------------- // done //--------------------------------------------------------- } /** * Debug for for property key and value. * @param key * @param value */ private void debugParameterAdd(Parameter parameter) { if (DEBUG_ENABLED) { String key = parameter.getName(); Object value = parameter.getValue(); String className = (value == null) ? "null" : value.getClass().getName(); String classloader = "null"; if(value != null) { ClassLoader cl = Utils.getObjectClassLoader(value); if(cl != null) { classloader = cl.toString(); } } String valueText = (value instanceof String) ? value.toString() : null; String identity = getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)); log.debug("=================="); log.debug(" Parameter add on object " + identity); log.debug(" Key =" + key); if (valueText != null) { log.debug(" Value =" + valueText); } log.debug(" Value Class = " + className); log.debug(" Value Classloader = " + classloader); if (this.DEBUG_CALLSTACK_ON_SET) { log.debug( "Call Stack = " + JavaUtils.callStackToString()); } log.debug("=================="); } } } ./src/org/apache/axis2/description/TransportOutDescription.java0000664000175000017500000000757311767656530024124 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.Phase; import org.apache.axis2.phaseresolver.PhaseMetadata; import org.apache.axis2.transport.TransportSender; import java.util.ArrayList; /** * Represents a transport deployed in AXis2 */ public class TransportOutDescription implements ParameterInclude { /** * Field flowInclude */ private Flow faultFlow; private Phase faultPhase; /** * Field name */ protected String name; /** * Field outFlow */ private Flow outFlow; private Phase outPhase; /** * Field paramInclude */ protected final ParameterInclude paramInclude; protected TransportSender sender; /** * Constructor AxisTransport. * * @param name */ public TransportOutDescription(String name) { paramInclude = new ParameterIncludeImpl(); this.name = name; outPhase = new Phase(PhaseMetadata.TRANSPORT_PHASE); faultPhase = new Phase(PhaseMetadata.TRANSPORT_PHASE); } /** * Method addParameter. * * @param param */ public void addParameter(Parameter param) throws AxisFault { paramInclude.addParameter(param); } public void removeParameter(Parameter param) throws AxisFault { paramInclude.removeParameter(param); } public void deserializeParameters(OMElement parameterElement) throws AxisFault { this.paramInclude.deserializeParameters(parameterElement); } public Flow getFaultFlow() { return faultFlow; } public Phase getFaultPhase() { return faultPhase; } /** * @return Returns QName. */ public String getName() { return name; } public Flow getOutFlow() { return outFlow; } public Phase getOutPhase() { return outPhase; } /** * Method getParameter. * * @param name * @return Returns Parameter. */ public Parameter getParameter(String name) { return paramInclude.getParameter(name); } public ArrayList getParameters() { return paramInclude.getParameters(); } /** * @return Returns TransportSender. */ public TransportSender getSender() { return sender; } // to check whether the parameter is locked at any level public boolean isParameterLocked(String parameterName) { return paramInclude.isParameterLocked(parameterName); } public void setFaultFlow(Flow faultFlow) { this.faultFlow = faultFlow; } public void setFaultPhase(Phase faultPhase) { this.faultPhase = faultPhase; } /** * @param name */ public void setName(String name) { this.name = name; } public void setOutFlow(Flow outFlow) { this.outFlow = outFlow; } public void setOutPhase(Phase outPhase) { this.outPhase = outPhase; } /** * @param sender */ public void setSender(TransportSender sender) { this.sender = sender; } } ./src/org/apache/axis2/description/AxisOperation.java0000664000175000017500000004703711767656530022020 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisError; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.phaseresolver.PhaseResolver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Set; import java.util.LinkedHashMap; public abstract class AxisOperation extends AxisDescription implements WSDLConstants { public static final String STYLE_RPC = "rpc"; public static final String STYLE_MSG = "msg"; public static final String STYLE_DOC = "doc"; private static final Log log = LogFactory.getLog(AxisOperation.class); /** * message exchange pattern */ private int mep = WSDLConstants.MEP_CONSTANT_INVALID; // to hide control operation , operation which added by RM like module private boolean controlOperation = false; private String style = STYLE_DOC; // to store mepURL private String mepURI; private MessageReceiver messageReceiver; private HashMap moduleConfigmap; // To store deploy-time module refs private ArrayList modulerefs; private ArrayList faultMessages; private QName name; private ArrayList wsamappingList; private String outputAction; private LinkedHashMap faultActions = new LinkedHashMap(); private String soapAction; /** * constructor */ public AxisOperation() { mepURI = WSDL2Constants.MEP_URI_IN_OUT; modulerefs = new ArrayList(); moduleConfigmap = new HashMap(); faultMessages = new ArrayList(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); } public AxisOperation(QName name) { this(); this.setName(name); } public abstract void addMessage(AxisMessage message, String label); /** * Adds a message context into an operation context. Depending on MEPs, this * method has to be overridden. * Depending on the MEP operation description know how to fill the message context map * in operationContext. * As an example, if the MEP is IN-OUT then depending on messagable operation description * should know how to keep them in correct locations. * * @param msgContext MessageContext * @param opContext OperationContext * @throws AxisFault AxisFault */ public abstract void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault; public abstract void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault; public void addModule(String moduleName) { modulerefs.add(moduleName); } /** * Adds module configuration, if there is moduleConfig tag in operation. * * @param moduleConfiguration */ public void addModuleConfig(ModuleConfiguration moduleConfiguration) { moduleConfigmap.put(moduleConfiguration.getModuleName(), moduleConfiguration); } /** * This is called when a module is engaged on this operation. Handle operation-specific * tasks. * * @param axisModule AxisModule * @param engager * @throws AxisFault */ public final void onEngage(AxisModule axisModule, AxisDescription engager) throws AxisFault { // Am I the source of this engagement? boolean selfEngaged = (engager == this); // If I'm not, the operations will already have been added by someone above, so don't // do it again. if (selfEngaged) { AxisService service = getAxisService(); if (service != null) { service.addModuleOperations(axisModule); } } AxisConfiguration axisConfig = getAxisConfiguration(); PhaseResolver phaseResolver = new PhaseResolver(axisConfig); phaseResolver.engageModuleToOperation(this, axisModule); } protected void onDisengage(AxisModule module) { AxisService service = getAxisService(); if (service == null) return; AxisConfiguration axisConfiguration = service.getAxisConfiguration(); PhaseResolver phaseResolver = new PhaseResolver(axisConfiguration); if (!service.isEngaged(module.getName()) && (axisConfiguration != null && !axisConfiguration.isEngaged(module.getName()))) { phaseResolver.disengageModuleFromGlobalChains(module); } phaseResolver.disengageModuleFromOperationChain(module, this); //removing operations added at the time of module engagemnt HashMap moduleOperations = module.getOperations(); if (moduleOperations != null) { Iterator moduleOperations_itr = moduleOperations.values().iterator(); while (moduleOperations_itr.hasNext()) { AxisOperation operation = (AxisOperation) moduleOperations_itr.next(); service.removeOperation(operation.getName()); } } } /** * To remove module from engage module list * * @param module module to remove * @deprecated please use disengageModule(), this method will disappear after 1.3 */ public void removeFromEngagedModuleList(AxisModule module) { try { disengageModule(module); } catch (AxisFault axisFault) { // Can't do much here... log.error(axisFault.getMessage(), axisFault); } } /** * Gets a copy from module operation. * * @param axisOperation * @return Returns AxisOperation. * @throws AxisFault */ private AxisOperation copyOperation(AxisOperation axisOperation) throws AxisFault { AxisOperation operation = AxisOperationFactory .getOperationDescription(axisOperation.getMessageExchangePattern()); operation.setMessageReceiver(axisOperation.getMessageReceiver()); operation.setName(axisOperation.getName()); Iterator parameters = axisOperation.getParameters().iterator(); while (parameters.hasNext()) { Parameter parameter = (Parameter) parameters.next(); operation.addParameter(parameter); } operation.setWsamappingList(axisOperation.getWSAMappingList()); operation.setOutputAction(axisOperation.getOutputAction()); String[] faultActionNames = axisOperation.getFaultActionNames(); for (int i = 0; i < faultActionNames.length; i++) { operation.addFaultAction(faultActionNames[i], axisOperation.getFaultAction(faultActionNames[i])); } operation.setRemainingPhasesInFlow(axisOperation.getRemainingPhasesInFlow()); operation.setPhasesInFaultFlow(axisOperation.getPhasesInFaultFlow()); operation.setPhasesOutFaultFlow(axisOperation.getPhasesOutFaultFlow()); operation.setPhasesOutFlow(axisOperation.getPhasesOutFlow()); return operation; } /** * Returns as existing OperationContext related to this message if one exists. * * @param msgContext * @return Returns OperationContext. * @throws AxisFault */ public OperationContext findForExistingOperationContext(MessageContext msgContext) throws AxisFault { OperationContext operationContext; if ((operationContext = msgContext.getOperationContext()) != null) { return operationContext; } // If this message is not related to another one, or it is but not one emitted // from the same operation, don't further look for an operation context or fault. if (null != msgContext.getRelatesTo()) { // So this message may be part of an ongoing MEP ConfigurationContext configContext = msgContext.getConfigurationContext(); operationContext = configContext.getOperationContext(msgContext.getRelatesTo().getValue()); if (null == operationContext && log.isDebugEnabled()) { log.debug(msgContext.getLogIDString() + " Cannot correlate inbound message RelatesTo value [" + msgContext.getRelatesTo() + "] to in-progree MEP"); } } return operationContext; } /** * Finds a MEPContext for an incoming message. An incoming message can be * of two states. *

        * 1)This is a new incoming message of a given MEP. 2)This message is a * part of an MEP which has already begun. *

        * The method is special cased for the two MEPs *

        * #IN_ONLY #IN_OUT *

        * for two reasons. First reason is the wide usage and the second being that * the need for the MEPContext to be saved for further incoming messages. *

        * In the event that MEP of this operation is different from the two MEPs * defaulted above the decision of creating a new or this message relates * to a MEP which already in business is decided by looking at the WSA * Relates TO of the incoming message. * * @param msgContext */ public OperationContext findOperationContext(MessageContext msgContext, ServiceContext serviceContext) throws AxisFault { OperationContext operationContext; if (null == msgContext.getRelatesTo()) { // Its a new incoming message so get the factory to create a new // one operationContext = serviceContext.createOperationContext(this); } else { // So this message is part of an ongoing MEP ConfigurationContext configContext = msgContext.getConfigurationContext(); operationContext = configContext.getOperationContext(msgContext.getRelatesTo().getValue()); if (null == operationContext) { throw new AxisFault(Messages.getMessage("cannotCorrelateMsg", this.name.toString(), msgContext.getRelatesTo().getValue())); } } return operationContext; } public void registerOperationContext(MessageContext msgContext, OperationContext operationContext) throws AxisFault { msgContext.setAxisOperation(this); msgContext.getConfigurationContext().registerOperationContext(msgContext.getMessageID(), operationContext); operationContext.addMessageContext(msgContext); msgContext.setOperationContext(operationContext); if (operationContext.isComplete()) { operationContext.cleanup(); } } public void registerMessageContext(MessageContext msgContext, OperationContext operationContext) throws AxisFault { msgContext.setAxisOperation(this); operationContext.addMessageContext(msgContext); msgContext.setOperationContext(operationContext); if (operationContext.isComplete()) { operationContext.cleanup(); } } /** * Maps the String URI of the Message exchange pattern to a integer. * Further, in the first lookup, it will cache the looked * up value so that the subsequent method calls are extremely efficient. */ public int getAxisSpecificMEPConstant() { if (this.mep != WSDLConstants.MEP_CONSTANT_INVALID) { return this.mep; } int temp = WSDLConstants.MEP_CONSTANT_INVALID; if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_IN_OUT; } else if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_IN_ONLY; } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT; } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_OUT_IN; } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_OUT_ONLY; } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN; } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY; } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)) { temp = WSDLConstants.MEP_CONSTANT_ROBUST_OUT_ONLY; } if (temp == WSDLConstants.MEP_CONSTANT_INVALID) { throw new AxisError(Messages.getMessage("mepmappingerror")); } this.mep = temp; return this.mep; } /* * (non-Javadoc) * * @see org.apache.axis2.description.AxisService#getEngadgedModules() */ public abstract AxisMessage getMessage(String label); public String getMessageExchangePattern() { return mepURI; } public MessageReceiver getMessageReceiver() { return messageReceiver; } public ModuleConfiguration getModuleConfig(String moduleName) { return (ModuleConfiguration) moduleConfigmap.get(moduleName); } public ArrayList getModuleRefs() { return modulerefs; } public QName getName() { return name; } public abstract ArrayList getPhasesInFaultFlow(); public abstract ArrayList getPhasesOutFaultFlow(); public abstract ArrayList getPhasesOutFlow(); public abstract ArrayList getRemainingPhasesInFlow(); public String getStyle() { return style; } public ArrayList getWSAMappingList() { return wsamappingList; } public boolean isControlOperation() { return controlOperation; } // to check whether a given parameter is locked public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean locked = false; if (getParent() != null) { locked = getParent().isParameterLocked(parameterName); } if (locked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } } public void setControlOperation(boolean controlOperation) { this.controlOperation = controlOperation; } public void setMessageExchangePattern(String mepURI) { this.mepURI = mepURI; } public void setMessageReceiver(MessageReceiver messageReceiver) { this.messageReceiver = messageReceiver; } public void setName(QName name) { this.name = name; } public abstract void setPhasesInFaultFlow(ArrayList list); public abstract void setPhasesOutFaultFlow(ArrayList list); public abstract void setPhasesOutFlow(ArrayList list); public abstract void setRemainingPhasesInFlow(ArrayList list); public void setStyle(String style) { if (!"".equals(style)) { this.style = style; } } public void setWsamappingList(ArrayList wsamappingList) { this.wsamappingList = wsamappingList; } /** * */ public OperationClient createClient(ServiceContext sc, Options options) { throw new UnsupportedOperationException( Messages.getMessage("mepnotyetimplemented", mepURI)); } public Object getKey() { return this.name; } public ArrayList getFaultMessages() { return faultMessages; } public void setFaultMessages(AxisMessage faultMessage) { faultMessage.setParent(this); faultMessages.add(faultMessage); if(getFaultAction(faultMessage.getName())==null){ addFaultAction(faultMessage.getName(),"urn:" + name.getLocalPart() + faultMessage.getName()); } } public void setSoapAction(String soapAction) { this.soapAction = soapAction; } /* * Convenience method to access the WS-A Input Action per the * WS-A spec. Effectively use the soapAction if available else * use the first entry in the WSA Mapping list. * * Use getSoapAction when you want to get the soap action and this * when you want to get the wsa input action. */ public String getInputAction() { String result = null; if(soapAction != null && !"".equals(soapAction)){ result = soapAction; }else{ if(wsamappingList != null && !wsamappingList.isEmpty()){ result = (String)wsamappingList.get(0); } } return result; } public String getOutputAction() { return outputAction; } public void setOutputAction(String act) { outputAction = act; } public void addFaultAction(String faultName, String action) { faultActions.put(faultName, action); } public void removeFaultAction(String faultName) { faultActions.remove(faultName); } public String getFaultAction(String faultName) { return (String) faultActions.get(faultName); } public String[] getFaultActionNames() { Set keys = faultActions.keySet(); String[] faultActionNames = new String[keys.size()]; faultActionNames = (String[]) keys.toArray(faultActionNames); return faultActionNames; } public String getFaultAction() { String result = null; Iterator iter = faultActions.values().iterator(); if (iter.hasNext()) { result = (String) iter.next(); } return result; } /** * All childerns of a AxisOperation must be Messages. So we just return it. * @return */ public Iterator getMessages(){ return getChildren(); } /** * Typesafe access to parent service * * @return the AxisService which contains this AxisOperation */ public AxisService getAxisService() { return (AxisService)getParent(); } public String getSoapAction() { return soapAction; } } ./src/org/apache/axis2/description/InOutAxisOperation.java0000664000175000017500000000427511767656530022774 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.i18n.Messages; import javax.xml.namespace.QName; import java.util.HashMap; public class InOutAxisOperation extends TwoChannelAxisOperation { public InOutAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); } public InOutAxisOperation(QName name) { super(name); } public void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { HashMap mep = opContext.getMessageContexts(); MessageContext inMsgContext = (MessageContext) mep.get(MESSAGE_LABEL_IN_VALUE); MessageContext outmsgContext = (MessageContext) mep.get(MESSAGE_LABEL_OUT_VALUE); if ((inMsgContext != null) && (outmsgContext != null)) { throw new AxisFault(Messages.getMessage("mepcompleted")); } if (inMsgContext == null) { mep.put(MESSAGE_LABEL_IN_VALUE, msgContext); } else { mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext); opContext.setComplete(true); opContext.cleanup(); } } } ./src/org/apache/axis2/description/AxisDescription.java0000664000175000017500000004321011767656530022330 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.modules.Module; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Utils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; import javax.xml.stream.XMLStreamException; import java.io.StringWriter; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; public abstract class AxisDescription implements ParameterInclude, DescriptionConstants { protected AxisDescription parent = null; private ParameterInclude parameterInclude; private PolicyInclude policyInclude = null; private PolicySubject policySubject = null; private Map children; protected Map engagedModules; /** List of ParameterObservers who want to be notified of changes */ protected List parameterObservers = null; private OMFactory omFactory = OMAbstractFactory.getOMFactory(); // Holds the documentation details for each element private OMNode documentation; // creating a logger instance private static Log log = LogFactory.getLog(AxisDescription.class); public AxisDescription() { parameterInclude = new ParameterIncludeImpl(); children = new ConcurrentHashMap(); policySubject = new PolicySubject(); } public void addParameterObserver(ParameterObserver observer) { if (parameterObservers == null) parameterObservers = new ArrayList(); parameterObservers.add(observer); } public void removeParameterObserver(ParameterObserver observer) { if (parameterObservers != null) { parameterObservers.remove(observer); } } public void addParameter(Parameter param) throws AxisFault { if (param == null) { return; } if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } parameterInclude.addParameter(param); // Tell anyone who wants to know if (parameterObservers != null) { for (Iterator i = parameterObservers.iterator(); i.hasNext();) { ParameterObserver observer = (ParameterObserver) i.next(); observer.parameterChanged(param.getName(), param.getValue()); } } } public void addParameter(String name, Object value) throws AxisFault { addParameter(new Parameter(name, value)); } public void removeParameter(Parameter param) throws AxisFault { parameterInclude.removeParameter(param); } public void deserializeParameters(OMElement parameterElement) throws AxisFault { parameterInclude.deserializeParameters(parameterElement); } /** * If the parameter found in the current decription then the paremeter will * be writable else it will be read only * * @param name * @return */ public Parameter getParameter(String name) { Parameter parameter = parameterInclude.getParameter(name); if (parameter != null) { parameter.setEditable(true); return parameter; } if (parent != null) { parameter = parent.getParameter(name); if (parameter != null) { parameter.setEditable(false); } return parameter; } return null; } public Object getParameterValue(String name) { Parameter param = getParameter(name); if (param == null) { return null; } return param.getValue(); } public boolean isParameterTrue(String name) { Parameter param = getParameter(name); return param != null && JavaUtils.isTrue(param.getValue()); } public ArrayList getParameters() { return parameterInclude.getParameters(); } public boolean isParameterLocked(String parameterName) { if (this.parent != null && this.parent.isParameterLocked(parameterName)) { return true; } Parameter parameter = getParameter(parameterName); return parameter != null && parameter.isLocked(); } public String getDocumentation() { if (documentation != null) { if (documentation.getType() == OMNode.TEXT_NODE) { return ((OMText) documentation).getText(); } else { StringWriter writer = new StringWriter(); documentation.build(); try { documentation.serialize(writer); } catch (XMLStreamException e) { log.error(e); } writer.flush(); return writer.toString(); } } return null; } public OMNode getDocumentationNode() { return documentation; } public void setDocumentation(OMNode documentation) { this.documentation = documentation; } public void setDocumentation(String documentation) { if (!"".equals(documentation)) { this.documentation = omFactory.createOMText(documentation); } } public void setParent(AxisDescription parent) { this.parent = parent; } public AxisDescription getParent() { return parent; } /** * @see org.apache.axis2.description.AxisDescription#setPolicyInclude(PolicyInclude) * @deprecated As of release 1.4, if you want to access the policy cache of * a particular AxisDescription object use * {@line #getPolicySubject()} instead. * * @param policyInclude */ public void setPolicyInclude(PolicyInclude policyInclude) { this.policyInclude = policyInclude; } /** * @see org.apache.axis2.description.AxisDescription#getPolicySubject() * @deprecated As of release 1.4, replaced by {@link #getPolicySubject()} */ public PolicyInclude getPolicyInclude() { if (policyInclude == null) { policyInclude = new PolicyInclude(this); } return policyInclude; } // NOTE - These are NOT typesafe! public void addChild(AxisDescription child) { if (child.getKey() == null) { // FIXME: Several classes that extend AxisDescription pass null in their getKey method. // throw new IllegalArgumentException("Please specify a key in the child"); } else { children.put(child.getKey(), child); } } public void addChild(Object key, AxisDescription child) { children.put(key, child); } public Iterator getChildren() { return children.values().iterator(); } public AxisDescription getChild(Object key) { if(key == null) { // FIXME: Why are folks sending in null? return null; } return (AxisDescription) children.get(key); } public void removeChild(Object key) { children.remove(key); } /** * This method sets the policy as the default of this AxisDescription * instance. Further more this method does the followings.

        (1) Engage * whatever modules necessary to execute new the effective policy of this * AxisDescription instance. (2) Disengage whatever modules that are not * necessary to execute the new effective policy of this AxisDescription * instance. (3) Check whether each module can execute the new effective * policy of this AxisDescription instance. (4) If not throw an AxisFault to * notify the user. (5) Else notify each module about the new effective * policy. * * @param policy * the new policy of this AxisDescription instance. The effective * policy is the merge of this argument with effective policy of * parent of this AxisDescription. * @throws AxisFault * if any module is unable to execute the effective policy of * this AxisDescription instance successfully or no module to * execute some portion (one or more PrimtiveAssertions ) of * that effective policy. */ public void applyPolicy(Policy policy) throws AxisFault { // sets AxisDescription policy getPolicySubject().clear(); getPolicySubject().attachPolicy(policy); /* * now we try to engage appropriate modules based on the merged policy * of axis description object and the corresponding axis binding * description object. */ applyPolicy(); } /** * Applies the policies on the Description Hierarchy recursively. * * @throws AxisFault * an error occurred applying the policy */ public void applyPolicy() throws AxisFault { AxisConfiguration configuration = getAxisConfiguration(); if (configuration == null) { return; } Policy applicablePolicy = getApplicablePolicy(this); if (applicablePolicy != null) { engageModulesForPolicy(this, applicablePolicy, configuration); } for (Iterator children = getChildren(); children.hasNext();) { AxisDescription child = (AxisDescription) children.next(); child.applyPolicy(); } } private boolean canSupportAssertion(Assertion assertion, List moduleList) { AxisModule axisModule; Module module; for (Iterator iterator = moduleList.iterator(); iterator.hasNext();) { axisModule = (AxisModule) iterator.next(); // FIXME is this step really needed ?? // Shouldn't axisMoudle.getModule always return not-null value ?? module = axisModule.getModule(); if (!(module == null || module.canSupportAssertion(assertion))) { log.debug(axisModule.getName() + " says it can't support " + assertion.getName()); return false; } } return true; } private void engageModulesForPolicy(AxisDescription axisDescription, Policy policy, AxisConfiguration axisConfiguration) throws AxisFault { /* * for the moment we consider policies with only one alternative. If the * policy contains multiple alternatives only the first alternative will * be considered. */ Iterator iterator = policy.getAlternatives(); if (!iterator.hasNext()) { throw new AxisFault( "Policy doesn't contain any policy alternatives"); } List assertionList = (List) iterator.next(); Assertion assertion; String namespaceURI; List moduleList; List namespaceList = new ArrayList(); List modulesToEngage = new ArrayList(); for (Iterator assertions = assertionList.iterator(); assertions .hasNext();) { assertion = (Assertion) assertions.next(); namespaceURI = assertion.getName().getNamespaceURI(); moduleList = axisConfiguration .getModulesForPolicyNamesapce(namespaceURI); if (moduleList == null) { log.debug("can't find any module to process " + assertion.getName() + " type assertions"); continue; } if (!canSupportAssertion(assertion, moduleList)) { throw new AxisFault("atleast one module can't support " + assertion.getName()); } if (!namespaceList.contains(namespaceURI)) { namespaceList.add(namespaceURI); modulesToEngage.addAll(moduleList); } } engageModulesToAxisDescription(modulesToEngage, this); } private void engageModulesToAxisDescription(List moduleList, AxisDescription description) throws AxisFault { AxisModule axisModule; Module module; for (Iterator iterator = moduleList.iterator(); iterator.hasNext();) { axisModule = (AxisModule) iterator.next(); // FIXME is this step really needed ?? // Shouldn't axisMoudle.getModule always return not-null value ?? module = axisModule.getModule(); if (!(module == null || description.isEngaged(axisModule.getName()))) { // engages the module to AxisDescription description.engageModule(axisModule); // notifies the module about the engagement axisModule.getModule().engageNotify(description); } } } public AxisConfiguration getAxisConfiguration() { if (this instanceof AxisConfiguration) { return (AxisConfiguration) this; } if (this.parent != null) { return this.parent.getAxisConfiguration(); } return null; } public abstract Object getKey(); /** * Engage a Module at this level * * @param axisModule * the Module to engage * @throws AxisFault * if there's a problem engaging */ public void engageModule(AxisModule axisModule) throws AxisFault { engageModule(axisModule, this); } /** * Engage a Module at this level, keeping track of which level the engage was originally * called from. This is meant for internal use only. * * @param axisModule module to engage * @param source the AxisDescription which originally called engageModule() * @throws AxisFault if there's a problem engaging */ public void engageModule(AxisModule axisModule, AxisDescription source) throws AxisFault { if (engagedModules == null) engagedModules = new ConcurrentHashMap(); String moduleName = axisModule.getName(); for (Iterator iterator = engagedModules.values().iterator(); iterator.hasNext();) { AxisModule tempAxisModule = ((AxisModule) iterator.next()); String tempModuleName = tempAxisModule.getName(); if (moduleName.equals(tempModuleName)) { String existing = tempAxisModule.getVersion(); if (!Utils.checkVersion(axisModule.getVersion(), existing)) { throw new AxisFault(Messages.getMessage("mismatchedModuleVersions", getClass().getName(), moduleName, existing)); } } } // Let the Module know it's being engaged. If it's not happy about it, it can throw. Module module = axisModule.getModule(); if (module != null) { module.engageNotify(this); } // If we have anything specific to do, let that happen onEngage(axisModule, source); engagedModules.put(Utils.getModuleName(axisModule.getName(), axisModule.getVersion()), axisModule); } protected void onEngage(AxisModule module, AxisDescription engager) throws AxisFault { // Default version does nothing, feel free to override } static Collection NULL_MODULES = new ArrayList(0); public Collection getEngagedModules() { return engagedModules == null ? NULL_MODULES : engagedModules.values(); } /** * Check if a given module is engaged at this level. * * @param moduleName * module to investigate. * @return true if engaged, false if not. TODO: Handle versions? * isEngaged("addressing") should be true even for versioned * modulename... */ public boolean isEngaged(String moduleName) { return engagedModules != null && engagedModules.keySet().contains(moduleName); } public boolean isEngaged(AxisModule axisModule) { String id = Utils.getModuleName(axisModule.getName(), axisModule .getVersion()); return engagedModules != null && engagedModules.keySet().contains(id); } public void disengageModule(AxisModule module) throws AxisFault { if (module == null || engagedModules == null) return; // String id = Utils.getModuleName(module.getName(), // module.getVersion()); if (isEngaged(module)) { onDisengage(module); engagedModules.remove(Utils.getModuleName(module.getName(), module .getVersion())); } } protected void onDisengage(AxisModule module) throws AxisFault { // Base version does nothing } private Policy getApplicablePolicy(AxisDescription axisDescription) { if (axisDescription instanceof AxisMessage) { AxisMessage axisMessage = (AxisMessage) axisDescription; AxisOperation axisOperation = axisMessage.getAxisOperation(); if (axisOperation != null) { AxisService axisService = (AxisService) axisOperation .getAxisService(); if (axisService != null) { if (axisService.getEndpointName() != null) { AxisEndpoint axisEndpoint = axisService .getEndpoint(axisService.getEndpointName()); if (axisEndpoint != null) { AxisBinding axisBinding = axisEndpoint.getBinding(); AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBinding .getChild(axisOperation.getName()); String direction = axisMessage.getDirection(); AxisBindingMessage axisBindingMessage = null; if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN .equals(direction) && WSDLUtil .isInputPresentForMEP(axisOperation .getMessageExchangePattern())) { axisBindingMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE); return axisBindingMessage.getEffectivePolicy(); } else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT .equals(direction) && WSDLUtil .isOutputPresentForMEP(axisOperation .getMessageExchangePattern())) { axisBindingMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); return axisBindingMessage.getEffectivePolicy(); } } } } } return ((AxisMessage) axisDescription).getEffectivePolicy(); } return null; } public PolicySubject getPolicySubject() { return policySubject; } } ./src/org/apache/axis2/description/FlowInclude.java0000664000175000017500000000411111767656530021430 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; /** * Class FlowIncludeImpl */ public class FlowInclude { /** * Field fault */ private Flow In_fault; private Flow Out_fault; /** * Field in */ private Flow in; /** * Field out */ private Flow out; /** * Method getFaultInFlow. * * @return Returns Flow. */ public Flow getFaultInFlow() { return In_fault; } public Flow getFaultOutFlow() { return this.Out_fault; } /** * Method getInFlow. * * @return Returns Flow. */ public Flow getInFlow() { return in; } /** * Method getOutFlow. * * @return Returns Flow. */ public Flow getOutFlow() { return out; } /** * Method setFaultInFlow. * * @param flow */ public void setFaultInFlow(Flow flow) { this.In_fault = flow; } public void setFaultOutFlow(Flow faultFlow) { this.Out_fault = faultFlow; } /** * Method setInFlow. * * @param flow */ public void setInFlow(Flow flow) { this.in = flow; } /** * Method setOutFlow. * * @param flow */ public void setOutFlow(Flow flow) { this.out = flow; } } ./src/org/apache/axis2/description/OutInAxisOperation.java0000664000175000017500000005553511767656530023001 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.client.async.AsyncResult; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.CallbackReceiver; import org.apache.axis2.util.Utils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.util.HashMap; public class OutInAxisOperation extends TwoChannelAxisOperation { private static final Log log = LogFactory.getLog(OutInAxisOperation.class); public OutInAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_IN); } public OutInAxisOperation(QName name) { super(name); setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_IN); } public void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { HashMap mep = opContext.getMessageContexts(); MessageContext immsgContext = (MessageContext) mep .get(MESSAGE_LABEL_IN_VALUE); MessageContext outmsgContext = (MessageContext) mep .get(MESSAGE_LABEL_OUT_VALUE); if ((immsgContext != null) && (outmsgContext != null)) { throw new AxisFault(Messages.getMessage("mepcompleted")); } if (outmsgContext == null) { mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext); } else { mep.put(MESSAGE_LABEL_IN_VALUE, msgContext); opContext.setComplete(true); opContext.cleanup(); } } /** * Returns a MEP client for an Out-IN operation. This client can be used to * interact with a server which is offering an In-Out operation. To use the * client, you must call addMessageContext() with a message context and then * call execute() to execute the client. * * @param sc The service context for this client to live within. Cannot be * null. * @param options Options to use as defaults for this client. If any options are * set specifically on the client then those override options * here. */ public OperationClient createClient(ServiceContext sc, Options options) { return new OutInAxisOperationClient(this, sc, options); } } /** * MEP client for moi. */ class OutInAxisOperationClient extends OperationClient { private static Log log = LogFactory.getLog(OutInAxisOperationClient.class); OutInAxisOperationClient(OutInAxisOperation axisOp, ServiceContext sc, Options options) { super(axisOp, sc, options); } /** * Adds message context to operation context, so that it will handle the * logic correctly if the OperationContext is null then new one will be * created, and Operation Context will become null when some one calls reset(). * * @param msgContext the MessageContext to add * @throws AxisFault */ public void addMessageContext(MessageContext msgContext) throws AxisFault { msgContext.setServiceContext(sc); if (msgContext.getMessageID() == null) { setMessageID(msgContext); } axisOp.registerOperationContext(msgContext, oc); } /** * Returns the message context for a given message label. * * @param messageLabel : * label of the message and that can be either "Out" or "In" and * nothing else * @return Returns MessageContext. * @throws AxisFault */ public MessageContext getMessageContext(String messageLabel) throws AxisFault { return oc.getMessageContext(messageLabel); } public void setCallback(Callback callback) { this.callback = callback; } /** * Executes the MEP. What this does depends on the specific MEP client. The * basic idea is to have the MEP client execute and do something with the * messages that have been added to it so far. For example, if its an Out-In * MEP, then if the Out message has been set, then executing the client asks * it to send the message and get the In message, possibly using a different * thread. * * @param block Indicates whether execution should block or return ASAP. What * block means is of course a function of the specific MEP * client. IGNORED BY THIS MEP CLIENT. * @throws AxisFault if something goes wrong during the execution of the MEP. */ public void executeImpl(boolean block) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Entry: OutInAxisOperationClient::execute, " + block); } if (completed) { throw new AxisFault(Messages.getMessage("mepiscomplted")); } ConfigurationContext cc = sc.getConfigurationContext(); // copy interesting info from options to message context. MessageContext mc = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (mc == null) { throw new AxisFault(Messages.getMessage("outmsgctxnull")); } prepareMessageContext(cc, mc); if (options.getTransportIn() == null && mc.getTransportIn() == null) { mc.setTransportIn(ClientUtils.inferInTransport(cc .getAxisConfiguration(), options, mc)); } else if (mc.getTransportIn() == null) { mc.setTransportIn(options.getTransportIn()); } /** * If a module has set the USE_ASYNC_OPERATIONS option then we override the behaviour * for sync calls, and effectively USE_CUSTOM_LISTENER too. However we leave real * async calls alone. */ boolean useAsync = false; if (!mc.getOptions().isUseSeparateListener()) { Boolean useAsyncOption = (Boolean) mc.getProperty(Constants.Configuration.USE_ASYNC_OPERATIONS); if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: useAsyncOption " + useAsyncOption); if (useAsyncOption != null) { useAsync = useAsyncOption.booleanValue(); } } EndpointReference replyTo = mc.getReplyTo(); if (replyTo != null) { if (replyTo.hasNoneAddress()) { throw new AxisFault( replyTo.getAddress() + "" + " can not be used with OutInAxisOperationClient , user either " + "fireAndForget or sendRobust)"); } else if (replyTo.isWSAddressingAnonymous() && replyTo.getAllReferenceParameters() != null) { mc.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS, Boolean.TRUE); } String customReplyTo = (String)options.getProperty(Options.CUSTOM_REPLYTO_ADDRESS); if ( ! (Options.CUSTOM_REPLYTO_ADDRESS_TRUE.equals(customReplyTo))) { if (!replyTo.hasAnonymousAddress()){ useAsync = true; } } } if (useAsync || mc.getOptions().isUseSeparateListener()) { sendAsync(useAsync, mc); } else { if (block) { // Send the SOAP Message and receive a response send(mc); completed = true; } else { sc.getConfigurationContext().getThreadPool().execute( new NonBlockingInvocationWorker(callback, mc, axisCallback)); } } } private void sendAsync(boolean useAsync, MessageContext mc) throws AxisFault { if (log.isDebugEnabled()) { log.debug("useAsync=" + useAsync + ", seperateListener=" + mc.getOptions().isUseSeparateListener()); } /** * We are following the async path. If the user hasn't set a callback object then we must * block until the whole MEP is complete, as they have no other way to get their reply message. */ // THREADSAFE issue: Multiple threads could be trying to initialize the callback receiver // so it is synchronized. It is not done within the else clause to avoid the // double-checked lock antipattern. CallbackReceiver callbackReceiver; synchronized (axisOp) { if (axisOp.getMessageReceiver() != null && axisOp.getMessageReceiver() instanceof CallbackReceiver) { callbackReceiver = (CallbackReceiver) axisOp.getMessageReceiver(); } else { if (log.isDebugEnabled()) { log.debug("Creating new callback receiver"); } callbackReceiver = new CallbackReceiver(); axisOp.setMessageReceiver(callbackReceiver); if (log.isDebugEnabled()) log.debug("OutInAxisOperation: callbackReceiver " + callbackReceiver + " : " + axisOp); } } SyncCallBack internalCallback = null; if (callback != null) { callbackReceiver.addCallback(mc.getMessageID(), callback); if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating callback"); } else if (axisCallback != null) { callbackReceiver.addCallback(mc.getMessageID(), axisCallback); if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating axis callback"); } else { if (log.isDebugEnabled()) { log.debug("Creating internal callback"); } internalCallback = new SyncCallBack(); callbackReceiver.addCallback(mc.getMessageID(), internalCallback); if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating internal callback"); } /** * If USE_CUSTOM_LISTENER is set to 'true' the replyTo value will not be replaced and Axis2 will not * start its internal listner. Some other enntity (e.g. a module) should take care of obtaining the * response message. */ Boolean useCustomListener = (Boolean) options.getProperty(Constants.Configuration.USE_CUSTOM_LISTENER); if (useAsync) { useCustomListener = Boolean.TRUE; } if (useCustomListener == null || !useCustomListener.booleanValue()) { EndpointReference replyTo = mc.getReplyTo(); if (replyTo == null || replyTo.hasAnonymousAddress()){ EndpointReference replyToFromTransport = mc.getConfigurationContext().getListenerManager(). getEPRforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), mc .getTransportIn().getName()); if (replyTo == null) { mc.setReplyTo(replyToFromTransport); } else { replyTo.setAddress(replyToFromTransport.getAddress()); } } } //if we don't do this , this guy will wait till it gets HTTP 202 in the HTTP case mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE); mc.getConfigurationContext().registerOperationContext(mc.getMessageID(), oc); AxisEngine.send(mc); if (internalCallback != null) { internalCallback.waitForCompletion(options.getTimeOutInMilliSeconds()); // process the result of the invocation if (internalCallback.envelope == null) { if (internalCallback.error == null) { log.error("Callback had neither error nor response"); } if (options.isExceptionToBeThrownOnSOAPFault()) { throw AxisFault.makeFault(internalCallback.error); } } } } /** * When synchronous send() gets back a response MessageContext, this is the workhorse * method which processes it. * * @param responseMessageContext the active response MessageContext * @throws AxisFault if something went wrong */ protected void handleResponse(MessageContext responseMessageContext) throws AxisFault{ // Options object reused above so soapAction needs to be removed so // that soapAction+wsa:Action on response don't conflict responseMessageContext.setSoapAction(null); if (responseMessageContext.getEnvelope() == null) { // If request is REST we assume the responseMessageContext is REST, so // set the variable /* * old code here was using the outbound message context to set the inbound SOAP namespace, * as such and passing it to TransportUtils.createSOAPMessage * * msgctx.getEnvelope().getNamespace().getNamespaceURI() * * However, the SOAP1.2 spec, appendix A indicates that if a SOAP1.2 message is sent to a SOAP1.1 * endpoint, we will get a SOAP1.1 (fault) message response. We need another way to set * the inbound SOAP version. Best way to do this is to trust the content type and let * createSOAPMessage take care of figuring out what the SOAP namespace is. */ SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(responseMessageContext); if (resenvelope != null) { responseMessageContext.setEnvelope(resenvelope); } else { throw new AxisFault(Messages .getMessage("blockingInvocationExpectsResponse")); } } SOAPEnvelope resenvelope = responseMessageContext.getEnvelope(); if (resenvelope != null) { AxisEngine.receive(responseMessageContext); if (responseMessageContext.getReplyTo() != null) { sc.setTargetEPR(responseMessageContext.getReplyTo()); } if (resenvelope.hasFault()||responseMessageContext.isProcessingFault()) { if (options.isExceptionToBeThrownOnSOAPFault()) { // does the SOAPFault has a detail element for Excpetion throw Utils.getInboundFaultFromMessageContext(responseMessageContext); } } } } /** * Synchronously send the request and receive a response. This relies on the transport * correctly connecting the response InputStream! * * @param msgContext the request MessageContext to send. * @return Returns MessageContext. * @throws AxisFault Sends the message using a two way transport and waits for a response */ protected MessageContext send(MessageContext msgContext) throws AxisFault { // create the responseMessageContext MessageContext responseMessageContext = msgContext.getConfigurationContext().createMessageContext(); responseMessageContext.setServerSide(false); responseMessageContext.setOperationContext(msgContext.getOperationContext()); responseMessageContext.setOptions(new Options(options)); responseMessageContext.setMessageID(msgContext.getMessageID()); addMessageContext(responseMessageContext); responseMessageContext.setServiceContext(msgContext.getServiceContext()); responseMessageContext.setAxisMessage( axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); //sending the message AxisEngine.send(msgContext); responseMessageContext.setDoingREST(msgContext.isDoingREST()); // Copy RESPONSE properties which the transport set onto the request message context when it processed // the incoming response recieved in reply to an outgoing request. responseMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS, msgContext.getProperty(MessageContext.TRANSPORT_HEADERS)); responseMessageContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE)); responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgContext .getProperty(MessageContext.TRANSPORT_IN)); responseMessageContext.setTransportIn(msgContext.getTransportIn()); responseMessageContext.setTransportOut(msgContext.getTransportOut()); handleResponse(responseMessageContext); return responseMessageContext; } /** * This class is the workhorse for a non-blocking invocation that uses a two * way transport. */ private class NonBlockingInvocationWorker implements Runnable { private Callback callback; private MessageContext msgctx; private AxisCallback axisCallback; public NonBlockingInvocationWorker(Callback callback, MessageContext msgctx , AxisCallback axisCallback) { this.callback = callback; this.msgctx = msgctx; this.axisCallback =axisCallback; } public void run() { try { // send the request and wait for response MessageContext response = send(msgctx); // call the callback if (response != null) { SOAPEnvelope resenvelope = response.getEnvelope(); if (resenvelope.hasFault()) { SOAPBody body = resenvelope.getBody(); // If a fault was found, create an AxisFault with a MessageContext so that // other programming models can deserialize the fault to an alternative form. AxisFault fault = new AxisFault(body.getFault(), response); if (callback != null) { callback.onError(fault); } else { axisCallback.onError(fault); } } else { if (callback != null) { AsyncResult asyncResult = new AsyncResult(response); callback.onComplete(asyncResult); } else { axisCallback.onMessage(response); } } } } catch (Exception e) { if (callback != null) { callback.onError(e); } else { axisCallback.onError(e); } } finally { if (callback != null) { callback.setComplete(true); } } } } /** * This class acts as a callback that allows users to wait on the result. */ private class SyncCallBack implements AxisCallback { boolean complete; boolean receivedFault; public boolean waitForCompletion(long timeout) throws AxisFault { synchronized (this) { try { if (complete) return !receivedFault; wait(timeout); if (!complete) { // We timed out! throw new AxisFault( Messages.getMessage("responseTimeOut")); } } catch (InterruptedException e) { // Something interrupted our wait! error = e; } } if (error != null) throw AxisFault.makeFault(error); return !receivedFault; } /** * This is called when we receive a message. * * @param msgContext the (response) MessageContext */ public void onMessage(MessageContext msgContext) { // Transport input stream gets closed after calling setComplete // method. Have to build the whole envelope including the // attachments at this stage. Data might get lost if the input // stream gets closed before building the whole envelope. this.envelope = msgContext.getEnvelope(); this.envelope.buildWithAttachments(); } /** * This gets called when a fault message is received. * * @param msgContext the MessageContext containing the fault. */ public void onFault(MessageContext msgContext) { error =Utils.getInboundFaultFromMessageContext(msgContext); } /** * This is called at the end of the MEP no matter what happens, quite like a * finally block. */ public synchronized void onComplete() { complete = true; notify(); } private SOAPEnvelope envelope; private Exception error; public void onError(Exception e) { if (log.isDebugEnabled()) { log.debug("Entry: OutInAxisOperationClient$SyncCallBack::onError, " + e); } error = e; if (log.isDebugEnabled()) { log.debug("Exit: OutInAxisOperationClient$SyncCallBack::onError"); } } } } ./src/org/apache/axis2/description/PolicyInclude.java0000664000175000017500000003265411767656530021775 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.util.AxisPolicyLocator; import org.apache.axis2.util.PolicyUtil; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyReference; import org.apache.neethi.PolicyRegistry; import org.apache.neethi.PolicyRegistryImpl; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; public class PolicyInclude { public static final int ANON_POLICY = 100; public static final int AXIS_POLICY = 1; public static final int AXIS_MODULE_POLICY = 2; public static final int AXIS_MODULE_OPERATION_POLICY = 17; public static final int AXIS_SERVICE_POLICY = 3; public static final int AXIS_OPERATION_POLICY = 4; public static final int AXIS_MESSAGE_POLICY = 5; public static final int SERVICE_POLICY = 6; public static final int PORT_POLICY = 7; public static final int PORT_TYPE_POLICY = 8; public static final int BINDING_POLICY = 9; public static final int OPERATION_POLICY = 10; public static final int BINDING_OPERATION_POLICY = 11; public static final int INPUT_POLICY = 12; public static final int OUTPUT_POLICY = 13; public static final int BINDING_INPUT_POLICY = 14; public static final int BINDING_OUTPUT_POLICY = 15; public static final int MESSAGE_POLICY = 16; private Policy policy = null; private Policy effectivePolicy = null; private PolicyRegistry reg; private AxisDescription description; private Hashtable wrapperElements = new Hashtable(); public PolicyInclude() { reg = new PolicyRegistryImpl(); } public PolicyInclude(AxisDescription axisDescription) { if (axisDescription.getParent() != null) { PolicyInclude parentPolicyInclude = axisDescription.getParent().getPolicyInclude(); reg = new PolicyRegistryImpl(parentPolicyInclude.getPolicyRegistry()); } else { reg = new PolicyRegistryImpl(); } setDescription(axisDescription); } public void setPolicyRegistry(PolicyRegistry reg) { this.reg = reg; } public PolicyRegistry getPolicyRegistry() { return reg; } /** * @param policy * @see org.apache.axis2.description.PolicySubject#attachPolicy(Policy) * @see org.apache.axis2.description.PolicySubject#clear() * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #attachPolicy(Policy)} Use * {@link PolicySubject #clear()} beforehand effective policy of * {@link AxisDescription} has to be set as the argument. * */ public void setPolicy(Policy policy) { wrapperElements.clear(); if (policy.getName() == null && policy.getId() == null) { policy.setId(UUIDGenerator.getUUID()); } Wrapper wrapper = new Wrapper(PolicyInclude.ANON_POLICY, policy); if (policy.getName() != null) { wrapperElements.put(policy.getName(), wrapper); } else { wrapperElements.put(policy.getId(), wrapper); } if (description != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(policy); } } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #updatePolicy(Policy)}. */ public void updatePolicy(Policy policy) { String key; if ((key = policy.getName()) == null && (key = policy.getId()) == null) { // TODO throw more meaningful exception .. throw new RuntimeException("policy doesn't have a name or an id "); } Wrapper wrapper = (Wrapper) wrapperElements.get(key); wrapper.value = policy; if (description != null) { description.getPolicySubject().updatePolicy(policy); } } /** * @deprecated As of 1.4 release. You can't override a policies that * applicable for the current policy scope via * {@link PolicyInclude #setEffectivePolicy(Policy)}. In case * you need to make a policy the only policy that is within the * policy cache of an {@link AxisDescription} please use * {@link PolicySubject #clear()} and * {@link PolicySubject #attachPolicy(Policy)} accordingly. * */ public void setEffectivePolicy(Policy effectivePolicy) { this.effectivePolicy = effectivePolicy; if (description != null && effectivePolicy != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(effectivePolicy); } } public void setDescription(AxisDescription description) { this.description = description; } public AxisDescription getDescription() { return description; } private PolicyInclude getParent() { if (description != null && description.getParent() != null) { return description.getParent().getPolicyInclude(); } return null; } private void calculatePolicy() { Policy result = null; Iterator iterator = wrapperElements.values().iterator(); while (iterator.hasNext()) { Object policyElement = ((Wrapper) iterator.next()).getValue(); Policy p; if (policyElement instanceof PolicyReference) { AxisPolicyLocator locator = new AxisPolicyLocator(description); p = (Policy) ((PolicyReference) policyElement) .normalize(locator, false); } else if (policyElement instanceof Policy) { p = (Policy) policyElement; } else { // TODO AxisFault? throw new RuntimeException(); } result = (result == null) ? (Policy) p : (Policy) result.merge(p); } this.policy = result; } private void calculateEffectivePolicy() { Policy result; if (getParent() != null) { Policy parentPolicy = getParent().getEffectivePolicy(); if (parentPolicy == null) { result = getPolicy(); } else { if (getPolicy() != null) { result = (Policy) parentPolicy.merge(getPolicy()); } else { result = parentPolicy; } } } else { result = getPolicy(); } setEffectivePolicy(result); } /** * @deprecated As of 1.4 release. If you need to calculate merged policy of * all policies that are in the policy cache of * {@link AxisDescription}, use * {@link PolicySubject #getAttachedPolicyComponents() and {@link org.PolicyUtil #getMergedPolicy(List, AxisDescription)}} */ public Policy getPolicy() { if (description != null) { ArrayList policyList = new ArrayList(description.getPolicySubject() .getAttachedPolicyComponents()); return PolicyUtil.getMergedPolicy(policyList, description); } calculatePolicy(); return policy; } /** * @deprecated As of 1.4 release. Use * {@link AxisMessage #getEffectivePolicy()} or * {@link AxisBindingMessage #getEffectivePolicy()} when * applicable. */ public Policy getEffectivePolicy() { if (description != null) { if (description instanceof AxisMessage) { return ((AxisMessage) description).getEffectivePolicy(); } else if (description instanceof AxisBindingMessage) { return ((AxisBindingMessage) description).getEffectivePolicy(); } } calculateEffectivePolicy(); return effectivePolicy; } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #getAttachedPolicyComponents()} */ public ArrayList getPolicyElements() { if (description != null) { return new ArrayList(description.getPolicySubject() .getAttachedPolicyComponents()); } ArrayList policyElementsList = new ArrayList(); Iterator policyElementIterator = wrapperElements.values().iterator(); while (policyElementIterator.hasNext()) { policyElementsList .add(((Wrapper) policyElementIterator.next()).getValue()); } return policyElementsList; } /** * @deprecated As of 1.4 release. The policy element type is no longer * required since we maintain a complete binding description * hierarchy for the static description the service. Hence use * {@link PolicySubject #getAttachedPolicyComponents()} on * appropriate description object. */ public ArrayList getPolicyElements(int type) { ArrayList policyElementList = new ArrayList(); Iterator wrapperElementIterator = wrapperElements.values().iterator(); Wrapper wrapper; while (wrapperElementIterator.hasNext()) { wrapper = (Wrapper) wrapperElementIterator.next(); if (wrapper.getType() == type) { policyElementList.add(wrapper.getValue()); } } return policyElementList; } /** * @deprecated As of 1.4 release. Use ServiceData.xml or Axis2 DataLocators * to configure policies that are stored separately. */ public void registerPolicy(String key, Policy policy) { reg.register(key, policy); } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #getAttachedPolicyComponent(String)} */ public Policy getPolicy(String key) { if (description != null) { PolicyComponent result = description.getPolicySubject() .getAttachedPolicyComponent(key); if (result != null && result instanceof Policy) { return (Policy) result; } } return reg.lookup(key); } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #attachPolicy(Policy)} */ public void addPolicyElement(int type, Policy policy) { String key; if ((key = policy.getName()) == null && (key = policy.getId()) == null) { policy.setId(UUIDGenerator.getUUID()); } key = (policy.getName() != null) ? policy.getName() : policy.getId(); Wrapper wrapper = new Wrapper(type, policy); wrapperElements.put(key, wrapper); reg.register(key, policy); if (description != null) { description.getPolicySubject().attachPolicy(policy); } } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #attachPolicyReference(PolicyReference)} */ public void addPolicyRefElement(int type, PolicyReference policyReference) { Wrapper wrapper = new Wrapper(type, policyReference); wrapperElements.put(policyReference.getURI(), wrapper); if (description != null) { description.getPolicySubject().attachPolicyReference( policyReference); } } class Wrapper { private int type; private Object value; Wrapper(int type, Object value) { setType(type); setValue(value); } void setType(int type) { this.type = type; } int getType() { return type; } void setValue(Object value) { this.value = value; } Object getValue() { return value; } } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #detachPolicyComponent(String)} */ public void removePolicyElement(String policyURI) { wrapperElements.remove(policyURI); reg.remove(policyURI); if (description != null) { description.getPolicySubject().detachPolicyComponent(policyURI); } } /** * @deprecated As of 1.4 release, replaced by {@link PolicySubject #clear()} */ public void removeAllPolicyElements() { wrapperElements.clear(); if (description != null) { description.getPolicySubject().clear(); } } /** * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #getAttachedPolicyComponents()} */ public List getAttachedPolicies() { if (description != null) { return new ArrayList(description.getPolicySubject() .getAttachedPolicyComponents()); } ArrayList arrayList = new ArrayList(); for (Iterator iterator = wrapperElements.values().iterator(); iterator.hasNext();) { arrayList.add(((Wrapper) iterator.next()).value); } return arrayList; } } ./src/org/apache/axis2/description/WSDL20ToAllAxisServicesBuilder.java0000664000175000017500000001115111767656530024726 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.woden.WSDLException; import org.apache.woden.wsdl20.Service; import java.io.InputStream; import java.util.ArrayList; import java.util.List; /** * Extends the WSDL20ToAxisServiceBuilder class to provide functionality to return * multiple AxisService objects; one for each endpoint on each service in the WSDL 2.0 file. */ public class WSDL20ToAllAxisServicesBuilder extends WSDL20ToAxisServiceBuilder { protected static final Log log = LogFactory.getLog(WSDL20ToAllAxisServicesBuilder.class); private ArrayList axisServices = null; /** * Class constructor. * * @param in - Contains the wsdl 2.0 file */ public WSDL20ToAllAxisServicesBuilder(InputStream in) { super(in, null, null); axisServices = new ArrayList(); // create an empty ArrayList } public WSDL20ToAllAxisServicesBuilder(String wsdlUri, String endpointName) throws WSDLException { super(wsdlUri, null, endpointName); axisServices = new ArrayList(); // create an empty ArrayList } /** * Public method to access the wsdl 2.0 file and create a List of AxisService objects. * For each endpoint on each service in the wsdl, an AxisService object is created and * added to the List. The name of the AxisService is changed from the service name * to the the following: #. Note that the endpoint name * is not unique to a wsdl 2.0 file. Multiple services in the file may have endpoints * with the same name. Therefore the name of the AxisService needs to be a combination * of service/endpoint name to be unique to the wsdl. * * @return A List containing one AxisService object for each port in the wsdl file. * The name of the AxisService is modified to uniquely represent the service/endpoint * pair. The format of the name is "#" * @throws AxisFault */ public List populateAllServices() throws AxisFault { try { if (log.isDebugEnabled()) { log.debug("Entry: populateAllServices"); } setup(); // setup contains code with gathers non-service specific info // from the WSDL. This only needs to be done once per WSDL. if (description == null) { if (log.isDebugEnabled()) { log.debug("Exit: populateAllServices. wsdl description is null!"); } return null; // can't go any further without the wsdl } Service[] services = description.getServices(); for (int i = 0; i < services.length; i++) { Service service = services[i]; // set the serviceName on the parent to setup call to populateService serviceName = service.getName(); this.axisService = new AxisService(); AxisService retAxisService = populateService(); if (retAxisService != null) { axisServices.add(retAxisService); } // end if axisService was returned } // end for all ports of a service if (log.isDebugEnabled()) { log.debug("Exit: populateAllServices."); } return axisServices; } catch (AxisFault e) { throw e; // just rethrow any AxisFaults } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("populateAllServices caught Exception. Converting to AxisFault. " + e.toString()); } throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/description/ParameterInclude.java0000664000175000017500000000331211767656530022443 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import java.util.ArrayList; /** * Interface ParameterInclude */ public interface ParameterInclude { /** * Method addParameter. * * @param param */ public void addParameter(Parameter param) throws AxisFault; public void removeParameter(Parameter param) throws AxisFault; public void deserializeParameters(OMElement parameterElement) throws AxisFault; /** * Method getParameter. * * @param name * @return Returns Parameter. */ public Parameter getParameter(String name); /** * Gets all the parameters in a given description. * * @return Returns ArrayList. */ ArrayList getParameters(); /** * Checks whether the parameter is locked at any level. */ boolean isParameterLocked(String parameterName); } ./src/org/apache/axis2/description/DescriptionConstants.java0000664000175000017500000000516211767656530023404 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; public interface DescriptionConstants { /** * Field EXECUTION_CHAIN_KEY */ public static final String EXECUTION_CHAIN_KEY = "EXECUTION_CHAIN_KEY"; /** * Field EXECUTION_OUT_CHAIN_KEY */ public static final String EXECUTION_OUT_CHAIN_KEY = "EXECUTION_OUT_CHAIN_KEY"; /** * Field EXECUTION_FAULT_CHAIN_KEY */ public static final String EXECUTION_FAULT_CHAIN_KEY = "EXECUTION_FAULT_CHAIN_KEY"; /** * Field MODULEREF_KEY */ public static final String MODULEREF_KEY = "MODULEREF_KEY"; /** * Field OPERATION_KEY */ public static final String OPERATION_KEY = "OPERATION_KEY"; /** * Field MESSAGE_RECEIVER_KEY */ public static final String MESSAGE_RECEIVER_KEY = "PROVIDER_KEY"; /** * Field CONTEXTPATH_KEY */ public static final String CONTEXTPATH_KEY = "CONTEXTPATH_KEY"; /** * Field CLASSLOADER_KEY */ public static final String CLASSLOADER_KEY = "CLASSLOADER_KEY"; /** * Field STYLE_KEY */ public static final String STYLE_KEY = "STYLE_KEY"; /** * Field SERVICE_CLASS_NAME */ public static final String SERVICE_CLASS_NAME = "SERVICE_CLASS_NAME"; /** * Field PHASES_KEY */ public static final String PHASES_KEY = "PHASES_KEY"; /** * Field PARAMETER_KEY */ public static final String PARAMETER_KEY = "PARAMETER_KEY"; public static final String OUT_FAULTFLOW_KEY = "OUT_FAULTFLOW_KEY"; /** * Field OUTFLOW_KEY */ public static final String OUTFLOW_KEY = "OUTFLOW_KEY"; /** * Field IN_FAULTFLOW_KEY */ public static final String IN_FAULTFLOW_KEY = "IN_FAULTFLOW_KEY"; /** * Field INFLOW_KEY */ public static final String INFLOW_KEY = "INFLOW_KEY"; } ./src/org/apache/axis2/description/TwoChannelAxisOperation.java0000664000175000017500000001126211767656530023772 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.i18n.Messages; import org.apache.axis2.wsdl.WSDLConstants; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; /** * This class is to keep common methods and properties in InOut and OutIn axisOperation */ public abstract class TwoChannelAxisOperation extends AxisOperation { protected AxisMessage inFaultMessage; protected AxisMessage outFaultMessage; protected AxisMessage inMessage; protected AxisMessage outMessage; public TwoChannelAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); createMessages(); } public TwoChannelAxisOperation(QName name) { super(name); createMessages(); } private void createMessages() { inMessage = new AxisMessage(); inMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN); inMessage.setParent(this); addChild("inMessage", inMessage); inFaultMessage = new AxisMessage(); inFaultMessage.setParent(this); outFaultMessage = new AxisMessage(); outFaultMessage.setParent(this); outMessage = new AxisMessage(); outMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT); outMessage.setParent(this); addChild("outMessage", outMessage); } public void addMessage(AxisMessage message, String label) { if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) { addChild("outMessage", message); } else if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) { addChild("inMessage", message); } else if (WSDLConstants.MESSAGE_LABEL_FAULT_VALUE.equals(label)) { addChild("faultMessage", message); } else { throw new UnsupportedOperationException("Not yet implemented"); } } public AxisMessage getMessage(String label) { if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) { return (AxisMessage) getChild("outMessage"); } else if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) { return (AxisMessage) getChild("inMessage"); } else { throw new UnsupportedOperationException("Not yet implemented"); } } public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { HashMap mep = opContext.getMessageContexts(); MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE); if (faultMessageCtxt != null) { throw new AxisFault(Messages.getMessage("mepcompleted")); } else { mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext); opContext.setComplete(true); opContext.cleanup(); } } public ArrayList getPhasesInFaultFlow() { return inFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFaultFlow() { return outFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFlow() { return outMessage.getMessageFlow(); } public ArrayList getRemainingPhasesInFlow() { return inMessage.getMessageFlow(); } public void setPhasesInFaultFlow(ArrayList list) { inFaultMessage.setMessageFlow(list); } public void setPhasesOutFaultFlow(ArrayList list) { outFaultMessage.setMessageFlow(list); } public void setPhasesOutFlow(ArrayList list) { outMessage.setMessageFlow(list); } public void setRemainingPhasesInFlow(ArrayList list) { inMessage.setMessageFlow(list); } } ./src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java0000664000175000017500000001250511767656530024732 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.wsdl.Service; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Extends the WSDL11ToAxisServiceBuilder class to provide functionality to return * multiple AxisService objects; one for each port on each service in the WSDL 1.1 file. */ public class WSDL11ToAllAxisServicesBuilder extends WSDL11ToAxisServiceBuilder { protected static final Log log = LogFactory.getLog(WSDL11ToAllAxisServicesBuilder.class); public static final String WSDL_SERVICE_QNAME = "WSDL_SERVICE_QNAME"; public static final String WSDL_PORT = "WSDL_PORT"; private ArrayList axisServices = null; /** * Class constructor. * * @param in - Contains the wsdl 1.1 file */ public WSDL11ToAllAxisServicesBuilder(InputStream in) { super(in); axisServices = new ArrayList(); // create an empty ArrayList } public WSDL11ToAllAxisServicesBuilder(Definition def) { super(def, null, null); axisServices = new ArrayList(); // create an empty ArrayList } public WSDL11ToAllAxisServicesBuilder(Definition def, String portName) { super(def, null, portName); axisServices = new ArrayList(); // create an empty ArrayList } /** * Public method to access the wsdl 1.1 file and create a List of AxisService objects. * For each port on each service in the wsdl, an AxisService object is created and * added to the List. The name of the AxisService is changed from the service name * to the port name, since port names are unique to the wsdl. * * @return A List containing one AxisService object for each port in the wsdl file. * The name of the AxisService is modified from the service name to the port name. * @throws AxisFault */ public List populateAllServices() throws AxisFault { try { if (log.isDebugEnabled()) { log.debug("Entry: populateAllServices"); } setup(); // setup contains code with gathers non-service specific info // from the WSDL. This only needs to be done once per WSDL. if (wsdl4jDefinition == null) { if (log.isDebugEnabled()) { log.debug("Exit: populateAllServices. wsdl definition is null!"); } return null; // can't go any further without the wsdl } if (wsdl4jDefinition.getServices().size() > 0) { Iterator wsdlServIter = wsdl4jDefinition.getServices().values().iterator(); if (wsdl4jDefinition.getServices().size() > 1){ // let the wsdlToservice builder to decide the port to generate binding portName = null; } while (wsdlServIter.hasNext()) { Service service = (Service) wsdlServIter.next(); // set the serviceName on the parent to setup call to populateService serviceName = service.getQName(); this.axisService = new AxisService(); // now that serviceName and portName are set, call up to the // parent class to populate this service. AxisService retAxisService = populateService(); if (retAxisService != null) { axisServices.add(retAxisService); } // reset the port name if it had set when moving to next service portName = null; } } else { throw new AxisFault("No service was not found in the WSDL at " + wsdl4jDefinition.getDocumentBaseURI() + " with targetnamespace " + wsdl4jDefinition.getTargetNamespace()); } if (log.isDebugEnabled()) { log.debug("Exit: populateAllServices."); } return axisServices; } catch (AxisFault e) { throw e; // just rethrow any AxisFaults } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("populateAllServices caught Exception. Converting to AxisFault. " + e.toString()); } throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/description/OutOnlyAxisOperation.java0000664000175000017500000002376111767656530023350 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingConstants.Final; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.i18n.Messages; import org.apache.axis2.wsdl.WSDLConstants; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; public class OutOnlyAxisOperation extends AxisOperation { private AxisMessage inFaultMessage; // just to keep the inflow , there won't be any usage private ArrayList inPhases; private AxisMessage outFaultMessage; private AxisMessage outMessage; public OutOnlyAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); createMessage(); setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_ONLY); } public OutOnlyAxisOperation(QName name) { super(name); createMessage(); setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_ONLY); } public void addMessage(AxisMessage message, String label) { if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) { outMessage = message; } else { throw new UnsupportedOperationException("Not yet implemented"); } } public void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { if (!opContext.isComplete()) { opContext.getMessageContexts().put(MESSAGE_LABEL_OUT_VALUE, msgContext); opContext.setComplete(true); } else { throw new AxisFault(Messages.getMessage("mepcompleted")); } } public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault { HashMap mep = opContext.getMessageContexts(); MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE); if (faultMessageCtxt != null) { throw new AxisFault(Messages.getMessage("mepcompleted")); } else { mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext); opContext.setComplete(true); opContext.cleanup(); } } private void createMessage() { outMessage = new AxisMessage(); outMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT); outMessage.setParent(this); inFaultMessage = new AxisMessage(); inFaultMessage.setParent(this); outFaultMessage = new AxisMessage(); outFaultMessage.setParent(this); inPhases = new ArrayList(); } public AxisMessage getMessage(String label) { if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) { return outMessage; } else { throw new UnsupportedOperationException("Not yet implemented"); } } public ArrayList getPhasesInFaultFlow() { return inFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFaultFlow() { return outFaultMessage.getMessageFlow(); } public ArrayList getPhasesOutFlow() { return outMessage.getMessageFlow(); } public ArrayList getRemainingPhasesInFlow() { return inPhases; } public void setPhasesInFaultFlow(ArrayList list) { inFaultMessage.setMessageFlow(list); } public void setPhasesOutFaultFlow(ArrayList list) { outFaultMessage.setMessageFlow(list); } public void setPhasesOutFlow(ArrayList list) { outMessage.setMessageFlow(list); } public void setRemainingPhasesInFlow(ArrayList list) { inPhases = list; } /** * Returns a MEP client for an Out-only operation. This client can be used to * interact with a server which is offering an In-only operation. To use the * client, you must call addMessageContext() with a message context and then * call execute() to execute the client. Note that the execute method's * block parameter is ignored by this client and also the setMessageReceiver * method cannot be used. * * @param sc The service context for this client to live within. Cannot be * null. * @param options Options to use as defaults for this client. If any options are * set specifically on the client then those override options * here. */ public OperationClient createClient(ServiceContext sc, Options options) { return new OutOnlyAxisOperationClient(this, sc, options); } } /** * MEP client for moi. */ class OutOnlyAxisOperationClient extends OperationClient { private MessageContext mc; OutOnlyAxisOperationClient(OutOnlyAxisOperation axisOp, ServiceContext sc, Options options) { super(axisOp, sc, options); } /** * Adds a message context to the client for processing. This method must not * process the message - it only records it in the MEP client. Processing * only occurs when execute() is called. * * @param mc the message context * @throws AxisFault if this is called inappropriately. */ public void addMessageContext(MessageContext mc) throws AxisFault { if (this.mc != null) { throw new AxisFault(Messages.getMessage("cannotaddmsgctx")); } this.mc = mc; if (mc.getMessageID() == null) { setMessageID(mc); } mc.setServiceContext(sc); axisOp.registerOperationContext(mc, oc); this.completed = false; } /** * Returns a message from the client - will return null if the requested * message is not available. * * @param messageLabel the message label of the desired message context * @return Returns the desired message context or null if its not available. * @throws AxisFault if the message label is invalid */ public MessageContext getMessageContext(String messageLabel) throws AxisFault { if (messageLabel.equals(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)) { return mc; } throw new AxisFault(Messages.getMessage("unknownMsgLabel", messageLabel)); } /** * Sets the message receiver to be executed when a message comes into the MEP * and the MEP is executed. This is the way the MEP client provides * notification that a message has been received by it. Exactly when its * executed and under what conditions is a function of the specific MEP * client. */ public void setCallback(Callback callback) { throw new UnsupportedOperationException( "This feature is not supported by this MEP"); } /** * Executes the MEP. What this does depends on the specific MEP client. The * basic idea is to have the MEP client execute and do something with the * messages that have been added to it so far. For example, if its an Out-In * MEP, then if the Out message has been set, then executing the client asks * it to send the message and get the In message, possibly using a different * thread. * * @param block Indicates whether execution should block or return ASAP. What * block means is of course a function of the specific MEP * client. IGNORED BY THIS MEP CLIENT. * @throws AxisFault if something goes wrong during the execution of the MEP. */ public void executeImpl(boolean block) throws AxisFault { if (completed) { throw new AxisFault(Messages.getMessage("mepiscomplted")); } ConfigurationContext cc = sc.getConfigurationContext(); prepareMessageContext(cc, mc); //As this is an out-only MEP we explicitly add a more sensible default for //the replyTo, if required. We also need to ensure that if the replyTo EPR //has an anonymous address and reference parameters that it gets flowed //across the wire. EndpointReference epr = mc.getReplyTo(); if (epr == null) { mc.setReplyTo(new EndpointReference(Final.WSA_NONE_URI)); } else if (epr.isWSAddressingAnonymous() && epr.getAllReferenceParameters() != null) { mc.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS, Boolean.TRUE); } // create the operation context for myself OperationContext oc = sc.createOperationContext(axisOp); oc.addMessageContext(mc); // ship it out if (!block) { mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE); } AxisEngine.send(mc); // all done completed = true; } } ./src/org/apache/axis2/description/TransportInDescription.java0000664000175000017500000000766611767656530023726 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.Phase; import org.apache.axis2.phaseresolver.PhaseMetadata; import org.apache.axis2.transport.TransportListener; import java.util.ArrayList; /** * Represents an incoming transport deployed in Axis2. */ public class TransportInDescription implements ParameterInclude { /** * Field flowInclude */ private Flow faultFlow; // Stores handler Fault in inFlow private Phase faultPhase; /** * Field flowInclude */ private Flow inFlow; // to store handler in inFlow private Phase inPhase; /** * Field name */ protected String name; /** * Field paramInclude */ protected final ParameterInclude paramInclude; protected TransportListener receiver; public TransportInDescription(String name) { paramInclude = new ParameterIncludeImpl(); this.name = name; inPhase = new Phase(PhaseMetadata.TRANSPORT_PHASE); faultPhase = new Phase(PhaseMetadata.TRANSPORT_PHASE); } /** * Method addParameter. * * @param param */ public void addParameter(Parameter param) throws AxisFault { paramInclude.addParameter(param); } public void removeParameter(Parameter param) throws AxisFault { paramInclude.removeParameter(param); } public void deserializeParameters(OMElement parameterElement) throws AxisFault { this.paramInclude.deserializeParameters(parameterElement); } public Flow getFaultFlow() { return faultFlow; } public Phase getFaultPhase() { return faultPhase; } public Flow getInFlow() { return inFlow; } public Phase getInPhase() { return inPhase; } /** * Get Transport name as a QName * @return Returns QName. */ public String getName() { return name; } /** * Method getParameter. * * @param name * @return Returns Parameter. */ public Parameter getParameter(String name) { return paramInclude.getParameter(name); } public ArrayList getParameters() { return paramInclude.getParameters(); } /** * @return Returns TransportListener. */ public TransportListener getReceiver() { return receiver; } // to check whether the parameter is locked at any level public boolean isParameterLocked(String parameterName) { return paramInclude.isParameterLocked(parameterName); } public void setFaultFlow(Flow faultFlow) { this.faultFlow = faultFlow; } public void setFaultPhase(Phase faultPhase) { this.faultPhase = faultPhase; } public void setInFlow(Flow inFlow) { this.inFlow = inFlow; } public void setInPhase(Phase inPhase) { this.inPhase = inPhase; } /** * @param name */ public void setName(String name) { this.name = name; } /** * @param receiver */ public void setReceiver(TransportListener receiver) { this.receiver = receiver; } } ./src/org/apache/axis2/description/AxisService.java0000664000175000017500000027325511767656530021463 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.dataretrieval.AxisDataLocator; import org.apache.axis2.dataretrieval.AxisDataLocatorImpl; import org.apache.axis2.dataretrieval.DRConstants; import org.apache.axis2.dataretrieval.Data; import org.apache.axis2.dataretrieval.DataRetrievalException; import org.apache.axis2.dataretrieval.DataRetrievalRequest; import org.apache.axis2.dataretrieval.LocatorType; import org.apache.axis2.dataretrieval.OutputForm; import org.apache.axis2.dataretrieval.SchemaSupplier; import org.apache.axis2.dataretrieval.WSDLSupplier; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.deployment.util.ExcludeInfo; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator; import org.apache.axis2.description.java2wsdl.DocLitBareSchemaGenerator; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.description.java2wsdl.SchemaGenerator; import org.apache.axis2.description.java2wsdl.TypeTable; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.DefaultObjectSupplier; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.engine.ServiceLifeCycle; import org.apache.axis2.i18n.Messages; import org.apache.axis2.phaseresolver.PhaseResolver; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.axis2.util.Loader; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.XMLPrettyPrinter; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaExternal; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.codehaus.jam.JMethod; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.Port; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.WSDLException; import javax.wsdl.extensions.http.HTTPAddress; import javax.wsdl.extensions.schema.Schema; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap12.SOAP12Address; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import javax.wsdl.xml.WSDLWriter; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.SocketException; import java.net.URL; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; /** * Class AxisService */ public class AxisService extends AxisDescription { // //////////////////////////////////////////////////////////////// // Standard Parameter names /** * If this param is true, and the service has exactly one AxisOperation, * normal operation dispatch (via URI/soapAction/etc) will not be necessary, * and we'll just default to funneling all messages to that op. This is * useful for passthrough/ESB/embedded applications. */ public static final String SUPPORT_SINGLE_OP = "supportSingleOperation"; // //////////////////////////////////////////////////////////////// public static final String IMPORT_TAG = "import"; public static final String INCLUDE_TAG = "include"; public static final String SCHEMA_LOCATION = "schemaLocation"; private Map endpointMap = new HashMap(); /* * This is a map between the QName of the element of a message specified in * the WSDL and an Operation. It enables SOAP Body-based dispatching for * doc-literal bindings. */ private Map messageElementQNameToOperationMap = new HashMap(); private int nsCount = 0; private static final Log log = LogFactory.getLog(AxisService.class); private URL fileName; // Maps httpLocations to corresponding operations. Used to dispatch rest // messages. private HashMap httpLocationDispatcherMap = null; // A map of (String alias, AxisOperation operation). The aliases might // include: SOAPAction, // WS-Addressing action, the operation name, the AxisInputMessage name. See: // - invalidOperationsAliases // - mapActionToOperatoin() // - getOperationByAction() // REVIEW: This really should be seperate maps for the different types of // aliases so they don't // conflict with each other. For example, so that an identical operation // name and soap action // on different operatoins don't cause a collision; the following can't be // routed because // "foo" is not unique across different operations: // operation 1: action = foo, name = bar // operation 2: action = bar, name = foo private HashMap operationsAliasesMap = null; // Collection of aliases that are invalid for this service because they are // duplicated across // multiple operations under this service. private List invalidOperationsAliases = null; // private HashMap operations = new HashMap(); // to store module ref at deploy time parsing private ArrayList moduleRefs = null; // to keep the time that last update time of the service private long lastupdate; private HashMap moduleConfigmap; private String name; private ClassLoader serviceClassLoader; // to keep the XMLScheam getting either from WSDL or java2wsdl private ArrayList schemaList; // private XmlSchema schema; // wsdl is there for this service or not (in side META-INF) private boolean wsdlFound = false; // to store the scope of the service private String scope; // to store default message receivers private HashMap messageReceivers; // to set the handler chain available in phase info private boolean useDefaultChains = true; // to keep the status of the service , since service can stop at the run // time private boolean active = true; private boolean elementFormDefault = true; // to keep the service target name space private String targetNamespace = Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE; private String targetNamespacePrefix = Java2WSDLConstants.TARGETNAMESPACE_PREFIX; // to store the target namespace for the schema private String schematargetNamespace;// = Java2WSDLConstants.AXIS2_XSD; private String schematargetNamespacePrefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX; private boolean enableAllTransports = true; private List exposedTransports = new ArrayList(); // To keep reference to ServiceLifeCycle instance , if the user has // specified in services.xml private ServiceLifeCycle serviceLifeCycle; /** * Keeps track whether the schema locations are adjusted */ private boolean schemaLocationsAdjusted = false; private boolean wsdlImportLocationAdjusted = false; /** * A table that keeps a mapping of unique xsd names (Strings) against the * schema objects. This is populated in the first instance the schemas are * asked for and then used to serve the subsequent requests */ private Map schemaMappingTable = null; /** * counter variable for naming the schemas */ private int count = 0; /** * A custom schema Name prefix. if set this will be used to modify the * schema names */ private String customSchemaNamePrefix = null; /** * A custom schema name suffix. will be attached to the schema file name * when the files are uniquely named. A good place to add a file extension * if needed */ private String customSchemaNameSuffix = null; // /////////////////////////////////////// // WSDL related stuff //////////////////// // ////////////////////////////////////// /** Map of prefix -> namespaceURI */ private NamespaceMap namespaceMap; private String soapNsUri; private String endpointName; private String endpointURL; private List importedNamespaces; private boolean clientSide = false; // To keep a ref to ObjectSupplier instance private ObjectSupplier objectSupplier; // package to namespace mapping private Map p2nMap; // to keep the exclude property details private ExcludeInfo excludeInfo; private TypeTable typeTable; // Data Locators for WS-Mex Support private HashMap dataLocators; private HashMap dataLocatorClassNames; private AxisDataLocatorImpl defaultDataLocator; // Define search sequence for datalocator based on Data Locator types. LocatorType[] availableDataLocatorTypes = new LocatorType[] { LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL, LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL, LocatorType.DEFAULT_AXIS }; // name of the binding used : use in codegeneration private String bindingName; // List of MessageContextListeners that listen for events on the MessageContext private ArrayList messageContextListeners = new ArrayList(); // names list keep to preserve the parameter order private List operationsNameList; private String[] eprs; private boolean customWsdl = false; private HashMap policyMap = new HashMap(); private HashMap epMap = null; public AxisEndpoint getEndpoint(String key) { return (AxisEndpoint) endpointMap.get(key); } public void addEndpoint(String key, AxisEndpoint axisEndpoint) { this.endpointMap.put(key, axisEndpoint); } /** * @deprecated Use AddressingHelper.getAddressingRequirementParemeterValue */ public String getWSAddressingFlag() { return AddressingHelper.getAddressingRequirementParemeterValue(this); } /** * @deprecated Use AddressingHelper.setAddressingRequirementParemeterValue */ public void setWSAddressingFlag(String ar) { AddressingHelper.setAddressingRequirementParemeterValue(this, ar); } public boolean isSchemaLocationsAdjusted() { return schemaLocationsAdjusted; } public void setSchemaLocationsAdjusted(boolean schemaLocationsAdjusted) { this.schemaLocationsAdjusted = schemaLocationsAdjusted; } public Map getSchemaMappingTable() { return schemaMappingTable; } public void setSchemaMappingTable(Map schemaMappingTable) { this.schemaMappingTable = schemaMappingTable; } public String getCustomSchemaNamePrefix() { return customSchemaNamePrefix; } public void setCustomSchemaNamePrefix(String customSchemaNamePrefix) { this.customSchemaNamePrefix = customSchemaNamePrefix; } public String getCustomSchemaNameSuffix() { return customSchemaNameSuffix; } public void setCustomSchemaNameSuffix(String customSchemaNameSuffix) { this.customSchemaNameSuffix = customSchemaNameSuffix; } /** * Constructor AxisService. */ public AxisService() { super(); this.operationsAliasesMap = new HashMap(); this.invalidOperationsAliases = new ArrayList(); moduleConfigmap = new HashMap(); // by default service scope is for the request scope = Constants.SCOPE_REQUEST; httpLocationDispatcherMap = new HashMap(); messageReceivers = new HashMap(); moduleRefs = new ArrayList(); schemaList = new ArrayList(); serviceClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); objectSupplier = new DefaultObjectSupplier(); dataLocators = new HashMap(); dataLocatorClassNames = new HashMap(); } /** * @return name of the port type * @deprecated use AxisService#getEndpointName() instead. */ public String getPortTypeName() { return endpointName; } /** * @param portTypeName * @deprecated use AxisService#setEndpointName() instead */ public void setPortTypeName(String portTypeName) { this.endpointName = portTypeName; } public String getBindingName() { return bindingName; } public void setBindingName(String bindingName) { this.bindingName = bindingName; } /** * get the SOAPVersion */ public String getSoapNsUri() { return soapNsUri; } public void setSoapNsUri(String soapNsUri) { this.soapNsUri = soapNsUri; } /** * get the endpointName */ public String getEndpointName() { return endpointName; } public void setEndpointName(String endpoint) { this.endpointName = endpoint; } /** * Constructor AxisService. */ public AxisService(String name) { this(); this.name = name; } public void addMessageReceiver(String mepURI, MessageReceiver messageReceiver) { if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_IN_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY, messageReceiver); } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_ONLY .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_ONLY .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_OUT_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_ONLY, messageReceiver); } else if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OUT .equals(mepURI)) { messageReceivers .put(WSDL2Constants.MEP_URI_IN_OUT, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OUT, messageReceiver); } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OPTIONAL_OUT .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT, messageReceiver); messageReceivers .put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OPTIONAL_OUT, messageReceiver); } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_IN .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_IN .equals(mepURI)) { messageReceivers .put(WSDL2Constants.MEP_URI_OUT_IN, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_IN, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_IN, messageReceiver); } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_OPTIONAL_IN .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN, messageReceiver); messageReceivers .put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_OPTIONAL_IN, messageReceiver); } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY, messageReceiver); messageReceivers .put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY, messageReceiver); } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY .equals(mepURI) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY .equals(mepURI)) { messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY, messageReceiver); messageReceivers.put( WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY, messageReceiver); } else { messageReceivers.put(mepURI, messageReceiver); } } public MessageReceiver getMessageReceiver(String mepURL) { return (MessageReceiver) messageReceivers.get(mepURL); } /** * Adds module configuration , if there is moduleConfig tag in service. * * @param moduleConfiguration */ public void addModuleConfig(ModuleConfiguration moduleConfiguration) { moduleConfigmap.put(moduleConfiguration.getModuleName(), moduleConfiguration); } /** * Add any control operations defined by a Module to this service. * * @param module * the AxisModule which has just been engaged * @throws AxisFault * if a problem occurs */ void addModuleOperations(AxisModule module) throws AxisFault { HashMap map = module.getOperations(); Collection col = map.values(); PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration()); for (Iterator iterator = col.iterator(); iterator.hasNext();) { AxisOperation axisOperation = copyOperation((AxisOperation) iterator .next()); if (this.getOperation(axisOperation.getName()) == null) { ArrayList wsamappings = axisOperation.getWSAMappingList(); if (wsamappings != null) { for (int j = 0, size = wsamappings.size(); j < size; j++) { String mapping = (String) wsamappings.get(j); mapActionToOperation(mapping, axisOperation); } } // If we've set the "expose" parameter for this operation, it's // normal (non- // control) and therefore it will appear in generated WSDL. If // we haven't, // it's a control operation and will be ignored at WSDL-gen // time. if (axisOperation .isParameterTrue(DeploymentConstants.TAG_EXPOSE)) { axisOperation.setControlOperation(false); } else { axisOperation.setControlOperation(true); } phaseResolver.engageModuleToOperation(axisOperation, module); this.addOperation(axisOperation); Utils.addModuleBindingOperation(this, axisOperation); } } } public void addModuleref(String moduleref) { moduleRefs.add(moduleref); } /* * (non-Javadoc) * * @see org.apache.axis2.description.AxisService#addOperation(org.apache.axis2.description.AxisOperation) */ /** * Method addOperation. * * @param axisOperation */ public void addOperation(AxisOperation axisOperation) { axisOperation.setParent(this); Iterator modules = getEngagedModules().iterator(); while (modules.hasNext()) { AxisModule module = (AxisModule) modules.next(); try { axisOperation.engageModule(module); } catch (AxisFault axisFault) { log.info(Messages.getMessage("modulealredyengagetoservice", module.getName())); } } if (axisOperation.getMessageReceiver() == null) { axisOperation.setMessageReceiver(loadDefaultMessageReceiver( axisOperation.getMessageExchangePattern(), this)); } if (axisOperation.getInputAction() == null) { axisOperation.setSoapAction("urn:" + axisOperation.getName().getLocalPart()); } if (axisOperation.getOutputAction() == null) { axisOperation.setOutputAction("urn:" + axisOperation.getName().getLocalPart() + Java2WSDLConstants.RESPONSE); } addChild(axisOperation); String operationName = axisOperation.getName().getLocalPart(); /* * Some times name of the operation can be different from the name of * the first child of the SOAPBody. This will put the correct mapping * associating that name with the operation. This will be useful * especially for the SOAPBodyBasedDispatcher */ Iterator axisMessageIter = axisOperation.getChildren(); while (axisMessageIter.hasNext()) { AxisMessage axisMessage = (AxisMessage) axisMessageIter.next(); String messageName = axisMessage.getName(); if (messageName != null && !messageName.equals(operationName)) { mapActionToOperation(messageName, axisOperation); } } mapActionToOperation(operationName, axisOperation); String action = axisOperation.getInputAction(); if (action.length() > 0) { mapActionToOperation(action, axisOperation); } ArrayList wsamappings = axisOperation.getWSAMappingList(); if (wsamappings != null) { for (int j = 0, size = wsamappings.size(); j < size; j++) { String mapping = (String) wsamappings.get(j); mapActionToOperation(mapping, axisOperation); } } if (axisOperation.getMessageReceiver() == null) { axisOperation.setMessageReceiver(loadDefaultMessageReceiver( axisOperation.getMessageExchangePattern(), this)); } } private MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) { MessageReceiver messageReceiver; if (mepURL == null) { mepURL = WSDL2Constants.MEP_URI_IN_OUT; } if (service != null) { messageReceiver = service.getMessageReceiver(mepURL); if (messageReceiver != null) { return messageReceiver; } } if (getAxisConfiguration() != null) { return getAxisConfiguration().getMessageReceiver(mepURL); } return null; } /** * Gets a copy from module operation. * * @param axisOperation * @return Returns AxisOperation. * @throws AxisFault */ private AxisOperation copyOperation(AxisOperation axisOperation) throws AxisFault { AxisOperation operation = AxisOperationFactory .getOperationDescription(axisOperation .getMessageExchangePattern()); operation.setMessageReceiver(axisOperation.getMessageReceiver()); operation.setName(axisOperation.getName()); Iterator parameters = axisOperation.getParameters().iterator(); while (parameters.hasNext()) { Parameter parameter = (Parameter) parameters.next(); operation.addParameter(parameter); } PolicyInclude policyInclude = new PolicyInclude(operation); PolicyInclude axisOperationPolicyInclude = axisOperation .getPolicyInclude(); if (axisOperationPolicyInclude != null) { Policy policy = axisOperationPolicyInclude.getPolicy(); if (policy != null) { policyInclude.setPolicy(axisOperationPolicyInclude.getPolicy()); } } operation.setPolicyInclude(policyInclude); operation.setWsamappingList(axisOperation.getWSAMappingList()); operation.setRemainingPhasesInFlow(axisOperation .getRemainingPhasesInFlow()); operation.setPhasesInFaultFlow(axisOperation.getPhasesInFaultFlow()); operation.setPhasesOutFaultFlow(axisOperation.getPhasesOutFaultFlow()); operation.setPhasesOutFlow(axisOperation.getPhasesOutFlow()); operation.setOutputAction(axisOperation.getOutputAction()); String[] faultActionNames = axisOperation.getFaultActionNames(); for (int i = 0; i < faultActionNames.length; i++) { operation.addFaultAction(faultActionNames[i], axisOperation .getFaultAction(faultActionNames[i])); } return operation; } /* * (non-Javadoc) * * @see org.apache.axis2.description.AxisService#addToengagedModules(javax.xml.namespace.QName) */ /** * Engages a module. It is required to use this method. * * @param axisModule * @param engager */ public void onEngage(AxisModule axisModule, AxisDescription engager) throws AxisFault { // adding module operations addModuleOperations(axisModule); Iterator operations = getOperations(); while (operations.hasNext()) { AxisOperation axisOperation = (AxisOperation) operations.next(); axisOperation.engageModule(axisModule, engager); } } /** * Maps an alias (such as a SOAPAction, WSA action, or an operation name) to * the given AxisOperation. This is used by dispatching (both SOAPAction- * and WSAddressing- based dispatching) to figure out which operation a * given message is for. Some notes on restrictions of "action" - A null or * empty action will be ignored - An action that is a duplicate and * references an idential operation is allowed - An acton that is a * duplicate and references a different operation is NOT allowed. In this * case, the action for the original operation is removed from the alias * table, thus removing the ability to route based on this action. This is * necessary to prevent mis-directing incoming message to the wrong * operation based on SOAPAction. * * Note that an alias could be a SOAPAction, WS-Addressing Action, the * operation name, or some other alias. * * @see #getOperationByAction(String) * * @param action * the alias key * @param axisOperation * the operation to map to */ public void mapActionToOperation(String action, AxisOperation axisOperation) { if (action == null || "".equals(action)) { if (log.isDebugEnabled()) { log .debug("mapActionToOperation: A null or empty action cannot be used to map to an operation."); } return; } if (log.isDebugEnabled()) { log .debug("mapActionToOperation: Mapping Action to Operation: action: " + action + "; operation: " + axisOperation + "named: " + axisOperation.getName()); } // First check if this action has already been flagged as invalid // because it is a duplicate. if (invalidOperationsAliases.contains(action)) { // This SOAPAction has already been determined to be invalid; log a // message // and do not add it to the operation alias map. if (log.isDebugEnabled()) { log .debug("mapActionToOperation: The action: " + action + " can not be used for operation: " + axisOperation + " with operation name: " + axisOperation.getName() + " because that SOAPAction is not unique for this service."); } return; } // Check if the action is currently mapping to an operation. AxisOperation currentlyMappedOperation = getOperationByAction(action); if (currentlyMappedOperation != null) { if (currentlyMappedOperation == axisOperation) { // This maps to the same operation, then it is already in the // alias table, so // just silently ignore this mapping request. if (log.isDebugEnabled()) { log .debug("mapActionToOperation: This operation is already mapped to this action: " + action + "; AxisOperation: " + currentlyMappedOperation + " named: " + currentlyMappedOperation.getName()); } } else { // This action is already mapped, but it is to a different // operation. Remove // the action mapping from the alias table and add it to the // list of invalid mappings operationsAliasesMap.remove(action); invalidOperationsAliases.add(action); if (log.isDebugEnabled()) { log .debug("mapActionToOperation: The action is already mapped to a different " + "operation. The mapping of the action to any operations will be " + "removed. Action: " + action + "; original operation: " + currentlyMappedOperation + " named " + currentlyMappedOperation.getName() + "; new operation: " + axisOperation + " named " + axisOperation.getName()); } } } else { operationsAliasesMap.put(action, axisOperation); // Adding operation name to the mapping table // operationsAliasesMap.put(axisOperation.getName().getLocalPart(), // axisOperation); } } /** * Maps an constant string in the whttp:location to the given operation. * This is used by RequestURIOperationDispatcher based dispatching to figure * out which operation it is that a given message is for. * * @param string * the constant drawn from whttp:location * @param axisOperation * the operation to map to */ public void addHttpLocationDispatcherString(String string, AxisOperation axisOperation) { httpLocationDispatcherMap.put(string, axisOperation); } public void printSchema(OutputStream out) throws AxisFault { for (int i = 0; i < schemaList.size(); i++) { XmlSchema schema = addNameSpaces(i); schema.write(out); } } public XmlSchema getSchema(int index) { return addNameSpaces(index); } /** * Release the list of schema objects.

        In some environments, this can * provide significant relief of memory consumption in the java heap, as * long as the need for the schema list has completed. */ public void releaseSchemaList() { if (schemaList != null) { // release the schema list schemaList.clear(); } if (log.isDebugEnabled()) { log.debug("releaseSchemaList: schema list has been released."); } } private XmlSchema addNameSpaces(int i) { XmlSchema schema = (XmlSchema) schemaList.get(i); NamespaceMap map = (NamespaceMap) namespaceMap.clone(); NamespacePrefixList namespaceContext = schema.getNamespaceContext(); String prefixes[] = namespaceContext.getDeclaredPrefixes(); for (int j = 0; j < prefixes.length; j++) { String prefix = prefixes[j]; map.add(prefix, namespaceContext.getNamespaceURI(prefix)); } schema.setNamespaceContext(map); return schema; } public void setEPRs(String[] eprs) { this.eprs = eprs; } public String[] getEPRs() throws AxisFault { if (eprs != null && eprs.length != 0) { return eprs; } eprs = calculateEPRs(); return eprs; } private String[] calculateEPRs() { try { String requestIP = HttpUtils.getIpAddress(getAxisConfiguration()); return calculateEPRs(requestIP); } catch (SocketException e) { log.error("Cannot get local IP address", e); } return new String[0]; } private String[] calculateEPRs(String requestIP) { AxisConfiguration axisConfig = getAxisConfiguration(); if (axisConfig == null) { return null; } ArrayList eprList = new ArrayList(); if (enableAllTransports) { for (Iterator transports = axisConfig.getTransportsIn().values() .iterator(); transports.hasNext();) { TransportInDescription transportIn = (TransportInDescription) transports .next(); TransportListener listener = transportIn.getReceiver(); if (listener != null) { try { EndpointReference[] eprsForService = listener .getEPRsForService(this.name, requestIP); if (eprsForService != null) { for (int i = 0; i < eprsForService.length; i++) { EndpointReference endpointReference = eprsForService[i]; if (endpointReference != null) { String address = endpointReference .getAddress(); if (address != null) { eprList.add(address); } } } } } catch (AxisFault axisFault) { log.warn(axisFault.getMessage()); } } } } else { List trs = this.exposedTransports; for (int i = 0; i < trs.size(); i++) { String trsName = (String) trs.get(i); TransportInDescription transportIn = axisConfig .getTransportIn(trsName); if (transportIn != null) { TransportListener listener = transportIn.getReceiver(); if (listener != null) { try { EndpointReference[] eprsForService = listener .getEPRsForService(this.name, requestIP); if (eprsForService != null) { for (int j = 0; j < eprsForService.length; j++) { EndpointReference endpointReference = eprsForService[j]; if (endpointReference != null) { String address = endpointReference .getAddress(); if (address != null) { eprList.add(address); } } } } } catch (AxisFault axisFault) { log.warn(axisFault.getMessage()); } } } } } eprs = (String[]) eprList.toArray(new String[eprList.size()]); return eprs; } private void printDefinitionObject(Definition definition, OutputStream out, String requestIP) throws AxisFault, WSDLException { if (isModifyUserWSDLPortAddress()) { setPortAddress(definition, requestIP); } if (!wsdlImportLocationAdjusted) { changeImportAndIncludeLocations(definition); wsdlImportLocationAdjusted = true; } WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); writer.writeWSDL(definition, out); } public void printUserWSDL(OutputStream out, String wsdlName) throws AxisFault { Definition definition = null; // first find the correct wsdl definition Parameter wsdlParameter = getParameter(WSDLConstants.WSDL_4_J_DEFINITION); if (wsdlParameter != null) { definition = (Definition) wsdlParameter.getValue(); } if (definition != null) { try { printDefinitionObject(getWSDLDefinition(definition, wsdlName), out, null); } catch (WSDLException e) { throw AxisFault.makeFault(e); } } else { printWSDLError(out); } } /** * find the defintion object for given name * * @param parentDefinition * @param name * @return wsdl definition */ private Definition getWSDLDefinition(Definition parentDefinition, String name) { if (name == null) return parentDefinition; Definition importedDefinition = null; Iterator iter = parentDefinition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); if (wsdlImport.getLocationURI().endsWith(name)) { importedDefinition = wsdlImport.getDefinition(); break; } else { importedDefinition = getWSDLDefinition(wsdlImport .getDefinition(), name); } if (importedDefinition != null) { break; } } if (importedDefinition != null) { break; } } return importedDefinition; } /** * this procesdue recursively adjust the wsdl imports locations and the * schmea import and include locations. * * @param definition */ private void changeImportAndIncludeLocations(Definition definition) { // adjust the schema locations in types section Types types = definition.getTypes(); if (types != null) { List extensibilityElements = types.getExtensibilityElements(); Object extensibilityElement = null; Schema schema = null; for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) { extensibilityElement = iter.next(); if (extensibilityElement instanceof Schema) { schema = (Schema) extensibilityElement; changeLocations(schema.getElement()); } } } Iterator iter = definition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; String originalImprotString = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); originalImprotString = wsdlImport.getLocationURI(); if (originalImprotString.indexOf("://") == -1 && originalImprotString.indexOf("?wsdl=") == -1){ wsdlImport.setLocationURI(this.name + "?wsdl=" + originalImprotString); } changeImportAndIncludeLocations(wsdlImport.getDefinition()); } } } /** * change the schema Location in the elemment * * @param element */ private void changeLocations(Element element) { NodeList nodeList = element.getChildNodes(); String tagName; for (int i = 0; i < nodeList.getLength(); i++) { tagName = nodeList.item(i).getLocalName(); if (IMPORT_TAG.equals(tagName) || INCLUDE_TAG.equals(tagName)) { processImport(nodeList.item(i)); } } } private void updateSchemaLocation(XmlSchema schema) { XmlSchemaObjectCollection includes = schema.getIncludes(); for (int j = 0; j < includes.getCount(); j++) { Object item = includes.getItem(j); if (item instanceof XmlSchemaExternal) { XmlSchemaExternal xmlSchemaExternal = (XmlSchemaExternal) item; XmlSchema s = xmlSchemaExternal.getSchema(); updateSchemaLocation(s, xmlSchemaExternal); } } } private void updateSchemaLocation(XmlSchema s, XmlSchemaExternal xmlSchemaExternal) { if (s != null) { String schemaLocation = xmlSchemaExternal.getSchemaLocation(); if (schemaLocation.indexOf("://") == -1 && schemaLocation.indexOf("?xsd=") == -1) { String newscheamlocation = this.name + "?xsd=" + schemaLocation; xmlSchemaExternal.setSchemaLocation(newscheamlocation); } } } private void processImport(Node importNode) { NamedNodeMap nodeMap = importNode.getAttributes(); Node attribute; String attributeValue; for (int i = 0; i < nodeMap.getLength(); i++) { attribute = nodeMap.item(i); if (attribute.getNodeName().equals("schemaLocation")) { attributeValue = attribute.getNodeValue(); if (attributeValue.indexOf("://") == -1 && attributeValue.indexOf("?xsd=") == -1) { attribute.setNodeValue(this.name + "?xsd=" + attributeValue); } } } } /** * Produces a XSD for this AxisService and prints it to the specified * OutputStream. * * @param out * destination stream. * @param xsd * schema name * @return -1 implies not found, 0 implies redirect to root, 1 implies * found/printed a schema * @throws IOException */ public int printXSD(OutputStream out, String xsd) throws IOException { // If we find a SchemaSupplier, use that SchemaSupplier supplier = (SchemaSupplier) getParameterValue("SchemaSupplier"); if (supplier != null) { XmlSchema schema = supplier.getSchema(this, xsd); if (schema != null) { updateSchemaLocation(schema); schema.write(new OutputStreamWriter(out, "UTF8")); out.flush(); out.close(); return 1; } } // call the populator populateSchemaMappings(); Map schemaMappingtable = getSchemaMappingTable(); ArrayList schemas = getSchema(); // a name is present - try to pump the requested schema if (!"".equals(xsd)) { XmlSchema schema = (XmlSchema) schemaMappingtable.get(xsd); if (schema == null) { int dotIndex = xsd.indexOf('.'); if (dotIndex > 0) { String schemaKey = xsd.substring(0, dotIndex); schema = (XmlSchema) schemaMappingtable.get(schemaKey); } } if (schema != null) { // schema is there - pump it outs schema.write(new OutputStreamWriter(out, "UTF8")); out.flush(); out.close(); } else { InputStream in = getClassLoader().getResourceAsStream( DeploymentConstants.META_INF + "/" + xsd); if (in != null) { out.write(IOUtils.getStreamAsByteArray(in)); out.flush(); out.close(); } else { // Can't find the schema return -1; } } } else if (schemas.size() > 1) { // multiple schemas are present and the user specified // no name - in this case we cannot possibly pump a schema // so redirect to the service root return 0; } else { // user specified no name and there is only one schema // so pump that out ArrayList list = getSchema(); if (list.size() > 0) { XmlSchema schema = getSchema(0); if (schema != null) { schema.write(new OutputStreamWriter(out, "UTF8")); out.flush(); out.close(); } } else { String xsdNotFound = "" + "Unable to access schema for this service" + ""; out.write(xsdNotFound.getBytes()); out.flush(); out.close(); } } return 1; } /** * Produces a WSDL for this AxisService and prints it to the specified * OutputStream. * * @param out * destination stream. The WSDL will be sent here. * @param requestIP * the hostname the WSDL request was directed at. This should be * the address that appears in the generated WSDL. * @throws AxisFault * if an error occurs */ public void printWSDL(OutputStream out, String requestIP) throws AxisFault { // If we're looking for pre-existing WSDL, use that. if (isUseUserWSDL()) { printUserWSDL(out, null); return; } // If we find a WSDLSupplier, use that WSDLSupplier supplier = (WSDLSupplier) getParameterValue("WSDLSupplier"); if (supplier != null) { try { Definition definition = supplier.getWSDL(this); if (definition != null) { changeImportAndIncludeLocations(definition); printDefinitionObject(getWSDLDefinition(definition, null), out, requestIP); } } catch (Exception e) { printWSDLError(out, e); } return; } // Otherwise, generate WSDL ourselves String[] eprArray = requestIP == null ? new String[] { this.endpointName } : calculateEPRs(requestIP); getWSDL(out, eprArray); } /** * Print the WSDL with a default URL. This will be called only during * codegen time. * * @param out * @throws AxisFault */ public void printWSDL(OutputStream out) throws AxisFault { printWSDL(out, null); } private void setPortAddress(Definition definition, String requestIP) throws AxisFault { Iterator serviceItr = definition.getServices().values().iterator(); while (serviceItr.hasNext()) { Service serviceElement = (Service) serviceItr.next(); Iterator portItr = serviceElement.getPorts().values().iterator(); while (portItr.hasNext()) { Port port = (Port) portItr.next(); List list = port.getExtensibilityElements(); for (int i = 0; i < list.size(); i++) { Object extensibilityEle = list.get(i); if (extensibilityEle instanceof SOAPAddress) { SOAPAddress soapAddress = (SOAPAddress) extensibilityEle; String existingAddress = soapAddress.getLocationURI(); if (existingAddress == null || existingAddress .equals("REPLACE_WITH_ACTUAL_URL")) { ((SOAPAddress) extensibilityEle) .setLocationURI(getEPRs()[0]); } else { if (requestIP == null) { ((SOAPAddress) extensibilityEle) .setLocationURI(getLocationURI( getEPRs(), existingAddress)); } else { ((SOAPAddress) extensibilityEle) .setLocationURI(getLocationURI( calculateEPRs(requestIP), existingAddress)); } } } else if (extensibilityEle instanceof SOAP12Address) { SOAP12Address soapAddress = (SOAP12Address) extensibilityEle; String exsistingAddress = soapAddress.getLocationURI(); if (requestIP == null) { ((SOAP12Address) extensibilityEle) .setLocationURI(getLocationURI(getEPRs(), exsistingAddress)); } else { ((SOAP12Address) extensibilityEle) .setLocationURI(getLocationURI( calculateEPRs(requestIP), exsistingAddress)); } } else if (extensibilityEle instanceof HTTPAddress) { HTTPAddress httpAddress = (HTTPAddress) extensibilityEle; String exsistingAddress = httpAddress.getLocationURI(); if (requestIP == null) { ((HTTPAddress) extensibilityEle) .setLocationURI(getLocationURI(getEPRs(), exsistingAddress)); } else { ((HTTPAddress) extensibilityEle) .setLocationURI(getLocationURI( calculateEPRs(requestIP), exsistingAddress)); } } // TODO : change the Endpoint refrence addess as well. } } } } /** * this method returns the new IP address corresponding to the already * existing ip * * @param eprs * @param epr * @return corresponding Ip address */ private String getLocationURI(String[] eprs, String epr) throws AxisFault { String returnIP = null; if (epr != null) { if (epr.indexOf(":") > -1) { String existingProtocol = epr.substring(0, epr.indexOf(":")) .trim(); String eprProtocol; for (int i = 0; i < eprs.length; i++) { eprProtocol = eprs[i].substring(0, eprs[i].indexOf(":")) .trim(); if (eprProtocol.equals(existingProtocol)) { returnIP = eprs[i]; break; } } if (returnIP != null) { return returnIP; } else { throw new AxisFault( "Server does not have an epr for the wsdl epr==>" + epr); } } else { throw new AxisFault("invalid epr is given epr ==> " + epr); } } else { throw new AxisFault("No epr is given in the wsdl port"); } } private void getWSDL(OutputStream out, String[] serviceURL) throws AxisFault { // Retrieve WSDL using the same data retrieval path for GetMetadata // request. DataRetrievalRequest request = new DataRetrievalRequest(); request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL); request.putOutputForm(OutputForm.INLINE_FORM); MessageContext context = new MessageContext(); context.setAxisService(this); context.setTo(new EndpointReference(serviceURL[0])); Data[] result = getData(request, context); OMElement wsdlElement; if (result != null && result.length > 0) { wsdlElement = (OMElement) (result[0].getData()); try { XMLPrettyPrinter.prettify(wsdlElement, out); out.flush(); out.close(); } catch (Exception e) { throw AxisFault.makeFault(e); } } } private void printWSDLError(OutputStream out) throws AxisFault { printWSDLError(out, null); } private void printWSDLError(OutputStream out, Exception e) throws AxisFault { try { String wsdlntfound = "" + "Unable to generate WSDL 1.1 for this service" + "If you wish Axis2 to automatically generate the WSDL 1.1, then please +" + "set useOriginalwsdl as false in your services.xml"; out.write(wsdlntfound.getBytes()); if (e != null) { PrintWriter pw = new PrintWriter(out); e.printStackTrace(pw); pw.flush(); } out.write("".getBytes()); out.flush(); out.close(); } catch (IOException ex) { throw AxisFault.makeFault(ex); } } /** * Print the WSDL2.0 with a default URL. This will be called only during * codegen time. * * @param out * @throws AxisFault */ public void printWSDL2(OutputStream out) throws AxisFault { printWSDL2(out, null); } public void printWSDL2(OutputStream out, String requestIP) throws AxisFault { AxisService2WSDL20 axisService2WSDL2 = new AxisService2WSDL20(this); try { if (requestIP != null) { axisService2WSDL2.setEPRs(calculateEPRs(requestIP)); } OMElement wsdlElement = axisService2WSDL2.generateOM(); wsdlElement.serialize(out); out.flush(); out.close(); } catch (Exception e) { throw AxisFault.makeFault(e); } } /** * Gets the description about the service which is specified in * services.xml. * * @return Returns String. * @deprecated Use getDocumentation() instead */ public String getServiceDescription() { return getDocumentation(); } /** * Method getClassLoader. * * @return Returns ClassLoader. */ public ClassLoader getClassLoader() { return this.serviceClassLoader; } /** * Gets the control operation which are added by module like RM. */ public ArrayList getControlOperations() { Iterator op_itr = getOperations(); ArrayList operationList = new ArrayList(); while (op_itr.hasNext()) { AxisOperation operation = (AxisOperation) op_itr.next(); if (operation.isControlOperation()) { operationList.add(operation); } } return operationList; } public URL getFileName() { return fileName; } /** * @deprecated please use getLastUpdate * @return */ public long getLastupdate() { return lastupdate; } public long getLastUpdate() { return lastupdate; } public ModuleConfiguration getModuleConfig(String moduleName) { return (ModuleConfiguration) moduleConfigmap.get(moduleName); } public ArrayList getModules() { return moduleRefs; } public String getName() { return name; } /** * Method getOperation. * * @param operationName * @return Returns AxisOperation. */ public AxisOperation getOperation(QName operationName) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("Get operation for " + operationName); AxisOperation axisOperation = (AxisOperation) getChild(operationName); if (axisOperation == null) { axisOperation = (AxisOperation) getChild(new QName( getTargetNamespace(), operationName.getLocalPart())); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("Target namespace: " + getTargetNamespace()); } if (axisOperation == null) { axisOperation = (AxisOperation) operationsAliasesMap .get(operationName.getLocalPart()); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("Operations aliases map: " + operationsAliasesMap); } //The operation may be associated with a namespace other than the //target namespace, e.g. if the operation is from an imported wsdl. if (axisOperation == null) { List namespaces = getImportedNamespaces(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("Imported namespaces: " + namespaces); if (namespaces != null) { Iterator iterator = namespaces.iterator(); while (iterator.hasNext()) { String namespace = (String) iterator.next(); axisOperation = (AxisOperation) getChild(new QName( namespace, operationName.getLocalPart())); if (axisOperation != null) break; } } } if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("Found axis operation: " + axisOperation); return axisOperation; } /** * Returns the AxisOperation which has been mapped to the given alias. * * @see #mapActionToOperation(String, AxisOperation) * * @param action * the alias key * @return Returns the corresponding AxisOperation or null if it isn't * found. */ public AxisOperation getOperationByAction(String action) { return (AxisOperation) operationsAliasesMap.get(action); } /** * Returns the operation given a SOAP Action. This method should be called * if only one Endpoint is defined for this Service. If more than one * Endpoint exists, one of them will be picked. If more than one Operation * is found with the given SOAP Action; null will be returned. If no * particular Operation is found with the given SOAP Action; null will be * returned. If the action is in the list of invaliad aliases, which means * it did not uniquely identify an operation, a null will be returned. * * @param soapAction * SOAP Action defined for the particular Operation * @return Returns an AxisOperation if a unique Operation can be found with * the given SOAP Action otherwise will return null. */ public AxisOperation getOperationBySOAPAction(String soapAction) { // Check for illegal soapActions if ((soapAction == null) || soapAction.length() == 0) { if (log.isDebugEnabled()) { log.debug("getOperationBySOAPAction: " + soapAction + " is null or ''. Returning null."); } return null; } // If the action maps to an alais that is not unique, then it can't be // used to map to // an operation. if (invalidOperationsAliases.contains(soapAction)) { if (log.isDebugEnabled()) { log.debug("getOperationBySOAPAction: " + soapAction + " is an invalid operation alias. Returning null."); } return null; } // Get the operation from the action->operation map AxisOperation operation = (AxisOperation) operationsAliasesMap .get(soapAction); if (operation != null) { if (log.isDebugEnabled()) { log.debug("getOperationBySOAPAction: Operation (" + operation + "," + operation.getName() + ") for soapAction: " + soapAction + " found in action map."); } return operation; } // The final fallback is to check the operations for a matching name. Iterator children = getChildren(); // I could not find any spec statement that explicitly forbids using a // short name in the SOAPAction header or wsa:Action element, // so I believe this to be valid. There may be customers using the // shortname as the SOAPAction in their client code that would // also require this support. while (children.hasNext() && (operation == null)) { AxisOperation op = (AxisOperation) children.next(); if (op.getName().getLocalPart().equals(soapAction)) { operation = op; } } if (operation != null) { if (log.isDebugEnabled()) { log.debug("getOperationBySOAPAction: Operation (" + operation + "," + operation.getName() + ") for soapAction: " + soapAction + " found as child."); } } return operation; } /** * Method getOperations. * * @return Returns HashMap */ public Iterator getOperations() { return getChildren(); } /* * (non-Javadoc) * * @see org.apache.axis2.description.ParameterInclude#getParameter(java.lang.String) */ /** * Gets only the published operations. */ public ArrayList getPublishedOperations() { Iterator op_itr = getOperations(); ArrayList operationList = new ArrayList(); while (op_itr.hasNext()) { AxisOperation operation = (AxisOperation) op_itr.next(); if (!operation.isControlOperation()) { operationList.add(operation); } } return operationList; } /** * Sets the description about the service which is specified in services.xml * * @param documentation * @deprecated Use setDocumentation() instead */ public void setServiceDescription(String documentation) { setDocumentation(documentation); } /** * Method setClassLoader. * * @param classLoader */ public void setClassLoader(ClassLoader classLoader) { this.serviceClassLoader = classLoader; } public void setFileName(URL fileName) { this.fileName = fileName; } /** * Sets the current time as last update time of the service. * @deprecated please use setLastUpdate */ public void setLastupdate() { lastupdate = new Date().getTime(); } /** * Sets the current time as last update time of the service. */ public void setLastUpdate() { lastupdate = new Date().getTime(); } public void setName(String name) { this.name = name; } public ArrayList getSchema() { return schemaList; } public void addSchema(XmlSchema schema) { if (schema != null) { schemaList.add(schema); if (schema.getTargetNamespace() != null) { addSchemaNameSpace(schema); } } } public void addSchema(Collection schemas) { Iterator iterator = schemas.iterator(); while (iterator.hasNext()) { XmlSchema schema = (XmlSchema) iterator.next(); schemaList.add(schema); addSchemaNameSpace(schema); } } public boolean isWsdlFound() { return wsdlFound; } public void setWsdlFound(boolean wsdlFound) { this.wsdlFound = wsdlFound; } public String getScope() { return scope; } /** * @param scope - * Available scopes : Constants.SCOPE_APPLICATION * Constants.SCOPE_TRANSPORT_SESSION Constants.SCOPE_SOAP_SESSION * Constants.SCOPE_REQUEST.equals */ public void setScope(String scope) { if (Constants.SCOPE_APPLICATION.equals(scope) || Constants.SCOPE_TRANSPORT_SESSION.equals(scope) || Constants.SCOPE_SOAP_SESSION.equals(scope) || Constants.SCOPE_REQUEST.equals(scope)) { this.scope = scope; } } public boolean isUseDefaultChains() { return useDefaultChains; } public void setUseDefaultChains(boolean useDefaultChains) { this.useDefaultChains = useDefaultChains; } public Object getKey() { return this.name; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } /** * @deprecated please use getSchemaTargetNamespace * @return */ public String getSchematargetNamespace() { return schematargetNamespace; } public String getSchemaTargetNamespace() { return schematargetNamespace; } public void setSchemaTargetNamespace(String schematargetNamespace) { this.schematargetNamespace = schematargetNamespace; } public String getSchemaTargetNamespacePrefix() { return schematargetNamespacePrefix; } /** * @deprecated please use setSchemaTargetNamespacePrefix * @param schematargetNamespacePrefix */ public void setSchematargetNamespacePrefix( String schematargetNamespacePrefix) { this.schematargetNamespacePrefix = schematargetNamespacePrefix; } public void setSchemaTargetNamespacePrefix( String schematargetNamespacePrefix) { this.schematargetNamespacePrefix = schematargetNamespacePrefix; } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } public String getTargetNamespacePrefix() { return targetNamespacePrefix; } public void setTargetNamespacePrefix(String targetNamespacePrefix) { this.targetNamespacePrefix = targetNamespacePrefix; } public XmlSchemaElement getSchemaElement(QName elementQName) { XmlSchemaElement element; for (int i = 0; i < schemaList.size(); i++) { XmlSchema schema = (XmlSchema) schemaList.get(i); if (schema != null) { element = schema.getElementByName(elementQName); if (element != null) { return element; } } } return null; } public boolean isEnableAllTransports() { return enableAllTransports; } /** * To eneble service to be expose in all the transport * * @param enableAllTransports */ public void setEnableAllTransports(boolean enableAllTransports) { this.enableAllTransports = enableAllTransports; eprs = calculateEPRs(); } public List getExposedTransports() { return this.exposedTransports; } public void setExposedTransports(List transports) { enableAllTransports = false; this.exposedTransports = transports; eprs = null; // Do not remove this. We need to force EPR // recalculation. } public void addExposedTransport(String transport) { enableAllTransports = false; if (!this.exposedTransports.contains(transport)) { this.exposedTransports.add(transport); try { eprs = calculateEPRs(); } catch (Exception e) { eprs = null; } } } public void removeExposedTransport(String transport) { enableAllTransports = false; this.exposedTransports.remove(transport); try { eprs = calculateEPRs(); } catch (Exception e) { eprs = null; } } public boolean isExposedTransport(String transport) { return exposedTransports.contains(transport); } public void onDisengage(AxisModule module) throws AxisFault { removeModuleOperations(module); for (Iterator operations = getChildren(); operations.hasNext();) { AxisOperation axisOperation = (AxisOperation) operations.next(); axisOperation.disengageModule(module); } AxisConfiguration config = getAxisConfiguration(); if (!config.isEngaged(module.getName())) { PhaseResolver phaseResolver = new PhaseResolver(config); phaseResolver.disengageModuleFromGlobalChains(module); } } /** * Remove any operations which were added by a given module. * * @param module * the module in question */ private void removeModuleOperations(AxisModule module) { HashMap moduleOperations = module.getOperations(); if (moduleOperations != null) { for (Iterator modOpsIter = moduleOperations.values().iterator(); modOpsIter .hasNext();) { AxisOperation operation = (AxisOperation) modOpsIter.next(); removeOperation(operation.getName()); } } } // ####################################################################################### // APIs to create AxisService // /** * To create a AxisService for a given WSDL and the created client is most * suitable for client side invocation not for server side invocation. Since * all the soap action and wsa action is added to operations * * @param wsdlURL * location of the WSDL * @param wsdlServiceName * name of the service to be invoke , if it is null then the * first one will be selected if there are more than one * @param portName * name of the port , if there are more than one , if it is null * then the first one in the iterator will be selected * @param options * Service client options, to set the target EPR * @return AxisService , the created service will be return */ public static AxisService createClientSideAxisService(URL wsdlURL, QName wsdlServiceName, String portName, Options options) throws AxisFault { try { InputStream in = wsdlURL.openConnection().getInputStream(); Document doc = XMLUtils.newDocument(in); WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); reader.setFeature("javax.wsdl.importDocuments", true); Definition wsdlDefinition = reader.readWSDL(getBaseURI(wsdlURL .toString()), doc); if (wsdlDefinition != null) { wsdlDefinition.setDocumentBaseURI(getDocumentURI(wsdlURL .toString())); } return createClientSideAxisService(wsdlDefinition, wsdlServiceName, portName, options); } catch (IOException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } catch (ParserConfigurationException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } catch (SAXException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } catch (WSDLException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } } private static String getBaseURI(String currentURI) { try { File file = new File(currentURI); if (file.exists()) { return file.getCanonicalFile().getParentFile().toURI() .toString(); } String uriFragment = currentURI.substring(0, currentURI .lastIndexOf("/")); return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); } catch (IOException e) { return null; } } private static String getDocumentURI(String currentURI) { try { File file = new File(currentURI); return file.getCanonicalFile().toURI().toString(); } catch (IOException e) { return null; } } public static AxisService createClientSideAxisService( Definition wsdlDefinition, QName wsdlServiceName, String portName, Options options) throws AxisFault { WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder( wsdlDefinition, wsdlServiceName, portName); serviceBuilder.setServerSide(false); AxisService axisService = serviceBuilder.populateService(); AxisEndpoint axisEndpoint = (AxisEndpoint) axisService.getEndpoints() .get(axisService.getEndpointName()); options.setTo(new EndpointReference(axisEndpoint.getEndpointURL())); if (axisEndpoint != null) { options.setSoapVersionURI((String) axisEndpoint.getBinding() .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION)); } return axisService; } /** * To create an AxisService using given service impl class name first * generate schema corresponding to the given java class , next for each * methods AxisOperation will be created. If the method is in-out it will * uses RPCMessageReceiver else RPCInOnlyMessageReceiver

        Note : Inorder * to work this properly RPCMessageReceiver should be available in the class * path otherewise operation can not continue * * @param implClass * Service implementation class * @param axisConfig * Current AxisConfiguration * @return return created AxisSrevice the creted service , it can either be * null or valid service */ public static AxisService createService(String implClass, AxisConfiguration axisConfig) throws AxisFault { try { HashMap messageReciverMap = new HashMap(); Class inOnlyMessageReceiver = Loader .loadClass("org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"); MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver .newInstance(); messageReciverMap.put(WSDL2Constants.MEP_URI_IN_ONLY, messageReceiver); Class inoutMessageReceiver = Loader .loadClass("org.apache.axis2.rpc.receivers.RPCMessageReceiver"); MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver .newInstance(); messageReciverMap.put(WSDL2Constants.MEP_URI_IN_OUT, inOutmessageReceiver); messageReciverMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, inOutmessageReceiver); return createService(implClass, axisConfig, messageReciverMap, null, null, axisConfig.getSystemClassLoader()); } catch (Exception e) { throw AxisFault.makeFault(e); } } /** * messageReceiverClassMap will hold the MessageReceivers for given meps. * Key will be the mep and value will be the instance of the MessageReceiver * class. Ex: Map mrMap = new HashMap(); * mrMap.put("http://www.w3.org/2004/08/wsdl/in-only", * RPCInOnlyMessageReceiver.class.newInstance()); * mrMap.put("http://www.w3.org/2004/08/wsdl/in-out", * RPCMessageReceiver.class.newInstance()); * * @param implClass * @param axisConfiguration * @param messageReceiverClassMap * @param targetNamespace * @param schemaNamespace * @throws AxisFault */ public static AxisService createService(String implClass, AxisConfiguration axisConfiguration, Map messageReceiverClassMap, String targetNamespace, String schemaNamespace, ClassLoader loader) throws AxisFault { int index = implClass.lastIndexOf("."); String serviceName; if (index > 0) { serviceName = implClass.substring(index + 1, implClass.length()); } else { serviceName = implClass; } SchemaGenerator schemaGenerator; ArrayList excludeOpeartion = new ArrayList(); AxisService service = new AxisService(); service.setParent(axisConfiguration); service.setName(serviceName); try { Parameter generateBare = service .getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER); if (generateBare != null && "true".equals(generateBare.getValue())) { schemaGenerator = new DocLitBareSchemaGenerator(loader, implClass, schemaNamespace, Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX, service); } else { schemaGenerator = new DefaultSchemaGenerator(loader, implClass, schemaNamespace, Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX, service); } schemaGenerator .setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED); Utils.addExcludeMethods(excludeOpeartion); schemaGenerator.setExcludeMethods(excludeOpeartion); } catch (Exception e) { throw AxisFault.makeFault(e); } return createService(implClass, serviceName, axisConfiguration, messageReceiverClassMap, targetNamespace, loader, schemaGenerator, service); } /** * messageReceiverClassMap will hold the MessageReceivers for given meps. * Key will be the mep and value will be the instance of the MessageReceiver * class. Ex: Map mrMap = new HashMap(); * mrMap.put("http://www.w3.org/2004/08/wsdl/in-only", * RPCInOnlyMessageReceiver.class.newInstance()); * mrMap.put("http://www.w3.org/2004/08/wsdl/in-out", * RPCMessageReceiver.class.newInstance()); * * @param implClass * @param axisConfiguration * @param messageReceiverClassMap * @param targetNamespace * @throws AxisFault */ public static AxisService createService(String implClass, String serviceName, AxisConfiguration axisConfiguration, Map messageReceiverClassMap, String targetNamespace, ClassLoader loader, SchemaGenerator schemaGenerator, AxisService axisService) throws AxisFault { Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass); OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, implClass, false); parameter.setParameterElement(paraElement); axisService.setUseDefaultChains(false); axisService.addParameter(parameter); axisService.setName(serviceName); axisService.setClassLoader(loader); NamespaceMap map = new NamespaceMap(); map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX, Java2WSDLConstants.AXIS2_XSD); map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX, Java2WSDLConstants.URI_2001_SCHEMA_XSD); axisService.setNamespaceMap(map); Utils.processBeanPropertyExclude(axisService); axisService.setElementFormDefault(false); try { axisService.addSchema(schemaGenerator.generateSchema()); } catch (Exception e) { throw AxisFault.makeFault(e); } axisService.setSchemaTargetNamespace(schemaGenerator .getSchemaTargetNameSpace()); axisService.setTypeTable(schemaGenerator.getTypeTable()); if (targetNamespace == null) { targetNamespace = schemaGenerator.getSchemaTargetNameSpace(); } if (targetNamespace != null && !"".equals(targetNamespace)) { axisService.setTargetNamespace(targetNamespace); } JMethod[] method = schemaGenerator.getMethods(); PhasesInfo pinfo = axisConfiguration.getPhasesInfo(); for (int i = 0; i < method.length; i++) { JMethod jmethod = method[i]; AxisOperation operation = axisService.getOperation(new QName( jmethod.getSimpleName())); String mep = operation.getMessageExchangePattern(); MessageReceiver mr; if (messageReceiverClassMap != null) { if (messageReceiverClassMap.get(mep) != null) { Object obj = messageReceiverClassMap.get(mep); if (obj instanceof MessageReceiver) { mr = (MessageReceiver) obj; operation.setMessageReceiver(mr); } else { log .error("Object is not an instance of MessageReceiver, thus, default MessageReceiver has been set"); mr = axisConfiguration.getMessageReceiver(operation .getMessageExchangePattern()); operation.setMessageReceiver(mr); } } else { log .error("Required MessageReceiver couldn't be found, thus, default MessageReceiver has been used"); mr = axisConfiguration.getMessageReceiver(operation .getMessageExchangePattern()); operation.setMessageReceiver(mr); } } else { log .error("MessageRecevierClassMap couldn't be found, thus, default MessageReceiver has been used"); mr = axisConfiguration.getMessageReceiver(operation .getMessageExchangePattern()); operation.setMessageReceiver(mr); } pinfo.setOperationPhases(operation); axisService.addOperation(operation); } String endpointName = axisService.getEndpointName(); if ((endpointName == null || endpointName.length() == 0) && axisService.getAxisConfiguration() != null) { Utils.addEndpointsToService(axisService, axisService.getAxisConfiguration()); } return axisService; } public void removeOperation(QName opName) { AxisOperation operation = getOperation(opName); if (operation != null) { removeChild(opName); ArrayList mappingList = operation.getWSAMappingList(); if (mappingList != null) { for (int i = 0; i < mappingList.size(); i++) { String actionMapping = (String) mappingList.get(i); operationsAliasesMap.remove(actionMapping); } } operationsAliasesMap.remove(operation.getName().getLocalPart()); } } /** * Get the namespace map for this service. * * @return a Map of prefix (String) to namespace URI (String) * @deprecated please use getNamespaceMap() */ public Map getNameSpacesMap() { return namespaceMap; } /** * Get the namespace map for this service. * * @return a Map of prefix (String) to namespace URI (String) */ public Map getNamespaceMap() { return namespaceMap; } /** * Get the namespaces associated with imported WSDLs * * @return a List of namespace URIs (String) */ public List getImportedNamespaces() { return importedNamespaces; } /** * Set the namespaces associated with imported WSDLs * * @param importedNamespaces */ public void setImportedNamespaces(List importedNamespaces) { this.importedNamespaces = importedNamespaces; } /** * @deprecated please use setNamespaceMap * @param nameSpacesMap */ public void setNameSpacesMap(NamespaceMap nameSpacesMap) { this.namespaceMap = nameSpacesMap; } public void setNamespaceMap(NamespaceMap namespaceMap) { this.namespaceMap = namespaceMap; } private void addSchemaNameSpace(XmlSchema schema) { String targetNameSpace = schema.getTargetNamespace(); String prefix = schema.getNamespaceContext().getPrefix(targetNameSpace); if (namespaceMap == null) { namespaceMap = new NamespaceMap(); } if (!namespaceMap.values().contains(targetNameSpace)) { // i.e this target namespace not exists in the namesapce map // find a non exists prefix to add this target namesapce while ((prefix == null) || namespaceMap.keySet().contains(prefix)) { prefix = "ns" + nsCount++; } namespaceMap.put(prefix, targetNameSpace); } } public Map populateSchemaMappings() { // when calling from other than codegen. i.e from deployment // engine we don't have to override the absolute http locations. return populateSchemaMappings(false); } /** * runs the schema mappings if it has not been run previously it is best * that this logic be in the axis service since one can call the axis * service to populate the schema mappings */ public Map populateSchemaMappings(boolean overrideAbsoluteAddress) { // populate the axis service with the necessary schema references ArrayList schema = this.schemaList; Map changedSchemaLocations = null; if (!this.schemaLocationsAdjusted) { Hashtable nameTable = new Hashtable(); Hashtable sourceURIToNewLocationMap = new Hashtable(); // calculate unique names for the schemas calculateSchemaNames(schema, nameTable, sourceURIToNewLocationMap, overrideAbsoluteAddress); // adjust the schema locations as per the calculated names changedSchemaLocations = adjustSchemaNames(schema, nameTable, sourceURIToNewLocationMap); // reverse the nametable so that there is a mapping from the // name to the schemaObject setSchemaMappingTable(swapMappingTable(nameTable)); setSchemaLocationsAdjusted(true); } return changedSchemaLocations; } /** * run 1 -calcualte unique names * * @param schemas */ private void calculateSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap, boolean overrideAbsoluteAddress) { // first traversal - fill the hashtable for (int i = 0; i < schemas.size(); i++) { XmlSchema schema = (XmlSchema) schemas.get(i); XmlSchemaObjectCollection includes = schema.getIncludes(); for (int j = 0; j < includes.getCount(); j++) { Object item = includes.getItem(j); XmlSchema s; if (item instanceof XmlSchemaExternal) { XmlSchemaExternal externalSchema = (XmlSchemaExternal) item; s = externalSchema.getSchema(); if (s != null && getScheamLocationWithDot( sourceURIToNewLocationMap, s) == null) { // insert the name into the table insertIntoNameTable(nameTable, s, sourceURIToNewLocationMap, overrideAbsoluteAddress); // recursively call the same procedure calculateSchemaNames(Arrays .asList(new XmlSchema[] { s }), nameTable, sourceURIToNewLocationMap, overrideAbsoluteAddress); } } } } } /** * A quick private sub routine to insert the names * * @param nameTable * @param s */ private void insertIntoNameTable(Hashtable nameTable, XmlSchema s, Hashtable sourceURIToNewLocationMap, boolean overrideAbsoluteAddress) { String sourceURI = s.getSourceURI(); // check whether the sourece uri is an absolute one and are // we allowed to override it. // if the absolute uri overriding is not allowed the use the // original sourceURI as new one if (sourceURI.startsWith("http") && !overrideAbsoluteAddress) { nameTable.put(s, sourceURI); sourceURIToNewLocationMap.put(sourceURI, sourceURI); } else { String newURI = sourceURI.substring(sourceURI.lastIndexOf('/') + 1); if (newURI.endsWith(".xsd")) { // remove the .xsd extention newURI = newURI.substring(0, newURI.lastIndexOf(".")); } else { newURI = "xsd" + count++; } newURI = customSchemaNameSuffix != null ? newURI + customSchemaNameSuffix : newURI; // make it unique while (nameTable.containsValue(newURI)) { newURI = newURI + count++; } nameTable.put(s, newURI); sourceURIToNewLocationMap.put(sourceURI, newURI); } } /** * Run 2 - adjust the names */ private Map adjustSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap) { Hashtable importedSchemas = new Hashtable(); // process the schemas in the main schema list for (int i = 0; i < schemas.size(); i++) { adjustSchemaName((XmlSchema) schemas.get(i), nameTable, importedSchemas, sourceURIToNewLocationMap); } // process all the rest in the name table Enumeration nameTableKeys = nameTable.keys(); while (nameTableKeys.hasMoreElements()) { adjustSchemaName((XmlSchema) nameTableKeys.nextElement(), nameTable, importedSchemas, sourceURIToNewLocationMap); } return importedSchemas; } /** * Adjust a single schema * * @param parentSchema * @param nameTable */ private void adjustSchemaName(XmlSchema parentSchema, Hashtable nameTable, Hashtable importedScheams, Hashtable sourceURIToNewLocationMap) { XmlSchemaObjectCollection includes = parentSchema.getIncludes(); for (int j = 0; j < includes.getCount(); j++) { Object item = includes.getItem(j); if (item instanceof XmlSchemaExternal) { XmlSchemaExternal xmlSchemaExternal = (XmlSchemaExternal) item; XmlSchema s = xmlSchemaExternal.getSchema(); adjustSchemaLocation(s, xmlSchemaExternal, nameTable, importedScheams, sourceURIToNewLocationMap); } } } /** * Adjusts a given schema location * * @param s * @param xmlSchemaExternal * @param nameTable */ private void adjustSchemaLocation(XmlSchema s, XmlSchemaExternal xmlSchemaExternal, Hashtable nameTable, Hashtable importedScheams, Hashtable sourceURIToNewLocationMap) { if (s != null) { String schemaLocation = xmlSchemaExternal.getSchemaLocation(); if (schemaLocation.indexOf("://") == -1) { String newscheamlocation = customSchemaNamePrefix == null ? // use the default mode (getName() + "?xsd=" + getScheamLocationWithDot( sourceURIToNewLocationMap, s)) : // custom prefix is present - add the custom prefix (customSchemaNamePrefix + getScheamLocationWithDot( sourceURIToNewLocationMap, s)); xmlSchemaExternal.setSchemaLocation(newscheamlocation); importedScheams.put(schemaLocation, newscheamlocation); } } } private Object getScheamLocationWithDot( Hashtable sourceURIToNewLocationMap, XmlSchema s) { String o = (String) sourceURIToNewLocationMap.get(s.getSourceURI()); if (o != null && o.indexOf(".") < 0) { return o + ".xsd"; } return o; } /** * Swap the key,value pairs * * @param originalTable */ private Map swapMappingTable(Map originalTable) { HashMap swappedTable = new HashMap(originalTable.size()); Iterator keys = originalTable.keySet().iterator(); Object key; while (keys.hasNext()) { key = keys.next(); swappedTable.put(originalTable.get(key), key); } return swappedTable; } public boolean isClientSide() { return clientSide; } public void setClientSide(boolean clientSide) { this.clientSide = clientSide; } public boolean isElementFormDefault() { return elementFormDefault; } public void setElementFormDefault(boolean elementFormDefault) { this.elementFormDefault = elementFormDefault; } /** * User can set a parameter in services.xml saying he want to show the * original wsdl that he put into META-INF once someone ask for ?wsdl so if * you want to use your own wsdl then add following parameter into * services.xml true */ public boolean isUseUserWSDL() { Parameter parameter = getParameter("useOriginalwsdl"); if (parameter != null) { String value = (String) parameter.getValue(); if ("true".equals(value)) { return true; } } return false; } /** * By default the port address in user WSDLs is modified, set the following * parameter to override this behaviour false */ public boolean isModifyUserWSDLPortAddress() { Parameter parameter = getParameter("modifyUserWSDLPortAddress"); if (parameter != null) { String value = (String) parameter.getValue(); if ("false".equals(value)) { return false; } } return true; } public ServiceLifeCycle getServiceLifeCycle() { return serviceLifeCycle; } public void setServiceLifeCycle(ServiceLifeCycle serviceLifeCycle) { this.serviceLifeCycle = serviceLifeCycle; } public Map getP2nMap() { return p2nMap; } public void setP2nMap(Map p2nMap) { this.p2nMap = p2nMap; } public ObjectSupplier getObjectSupplier() { return objectSupplier; } public void setObjectSupplier(ObjectSupplier objectSupplier) { this.objectSupplier = objectSupplier; } public TypeTable getTypeTable() { return typeTable; } public void setTypeTable(TypeTable typeTable) { this.typeTable = typeTable; } /** * Find a data locator from the available data locators (both configured and * default ones) to retrieve Metadata or data specified in the request. * * @param request * an {@link DataRetrievalRequest} object * @param msgContext * message context * @return array of {@link Data} object for the request. * @throws AxisFault */ public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws AxisFault { Data[] data; String dialect = request.getDialect(); AxisDataLocator dataLocator = null; int nextDataLocatorIndex = 0; int totalLocators = availableDataLocatorTypes.length; for (int i = 0; i < totalLocators; i++) { dataLocator = getDataLocator(availableDataLocatorTypes[i], dialect); if (dataLocator != null) { nextDataLocatorIndex = i + 1; break; } } if (dataLocator == null) { return null; } data = dataLocator.getData(request, msgContext); // Null means Data Locator not understood request. Automatically find // Data Locator in the hierarchy to process the request. if (data == null) { if (nextDataLocatorIndex < totalLocators) { data = bubbleupDataLocators(nextDataLocatorIndex, request, msgContext); } } return data; } /* * To search the next Data Locator from the available Data Locators that * understood the data retrieval request. */ private Data[] bubbleupDataLocators(int nextIndex, DataRetrievalRequest request, MessageContext msgContext) throws AxisFault { Data[] data = null; if (nextIndex < availableDataLocatorTypes.length) { AxisDataLocator dataLocator = getDataLocator( availableDataLocatorTypes[nextIndex], request.getDialect()); nextIndex++; if (dataLocator != null) { data = dataLocator.getData(request, msgContext); if (data == null) { data = bubbleupDataLocators(nextIndex, request, msgContext); } else { return data; } } else { data = bubbleupDataLocators(nextIndex, request, msgContext); } } return data; } /** * Save data Locator configured at service level for this Axis Service * * @param dialect- * an absolute URI represents the Dialect i.e. WSDL, Policy, * Schema or "ServiceLevel" for non-dialect service level data * locator. * @param dataLocatorClassName - * class name of the Data Locator configured to support data * retrieval for the specified dialect. */ public void addDataLocatorClassNames(String dialect, String dataLocatorClassName) { dataLocatorClassNames.put(dialect, dataLocatorClassName); } /* * Get data locator instance based on the LocatorType and dialect. */ public AxisDataLocator getDataLocator(LocatorType locatorType, String dialect) throws AxisFault { AxisDataLocator locator; if (locatorType == LocatorType.SERVICE_DIALECT) { locator = getServiceDataLocator(dialect); } else if (locatorType == LocatorType.SERVICE_LEVEL) { locator = getServiceDataLocator(DRConstants.SERVICE_LEVEL); } else if (locatorType == LocatorType.GLOBAL_DIALECT) { locator = getGlobalDataLocator(dialect); } else if (locatorType == LocatorType.GLOBAL_LEVEL) { locator = getGlobalDataLocator(DRConstants.GLOBAL_LEVEL); } else if (locatorType == LocatorType.DEFAULT_AXIS) { locator = getDefaultDataLocator(); } else { locator = getDefaultDataLocator(); } return locator; } // Return default Axis2 Data Locator private AxisDataLocator getDefaultDataLocator() throws DataRetrievalException { if (defaultDataLocator == null) { defaultDataLocator = new AxisDataLocatorImpl(this); } defaultDataLocator.loadServiceData(); return defaultDataLocator; } /* * Checks if service level data locator configured for specified dialect. * Returns an instance of the data locator if exists, and null otherwise. */ private AxisDataLocator getServiceDataLocator(String dialect) throws AxisFault { AxisDataLocator locator; locator = (AxisDataLocator) dataLocators.get(dialect); if (locator == null) { String className = (String) dataLocatorClassNames.get(dialect); if (className != null) { locator = loadDataLocator(className); dataLocators.put(dialect, locator); } } return locator; } /* * Checks if global level data locator configured for specified dialect. * @param dialect- an absolute URI represents the Dialect i.e. WSDL, Policy, * Schema or "GlobalLevel" for non-dialect Global level data locator. * Returns an instance of the data locator if exists, and null otherwise. */ public AxisDataLocator getGlobalDataLocator(String dialect) throws AxisFault { AxisConfiguration axisConfig = getAxisConfiguration(); AxisDataLocator locator = null; if (axisConfig != null) { locator = axisConfig.getDataLocator(dialect); if (locator == null) { String className = axisConfig.getDataLocatorClassName(dialect); if (className != null) { locator = loadDataLocator(className); axisConfig.addDataLocator(dialect, locator); } } } return locator; } protected AxisDataLocator loadDataLocator(String className) throws AxisFault { AxisDataLocator locator; try { Class dataLocator; dataLocator = Class.forName(className, true, serviceClassLoader); locator = (AxisDataLocator) dataLocator.newInstance(); } catch (ClassNotFoundException e) { throw AxisFault.makeFault(e); } catch (IllegalAccessException e) { throw AxisFault.makeFault(e); } catch (InstantiationException e) { throw AxisFault.makeFault(e); } return locator; } /** * Set the map of WSDL message element QNames to AxisOperations for this * service. This map is used during SOAP Body-based routing for * document/literal bare services to match the first child element of the * SOAP Body element to an operation. (Routing for RPC and document/literal * wrapped services occurs via the operationsAliasesMap.)

        From section * 4.7.6 of the WS-I BP 1.1: the "operation signature" is "the fully * qualified name of the child element of SOAP body of the SOAP input * message described by an operation in a WSDL binding," and thus this map * must be from a QName to an operation. * * @param messageElementQNameToOperationMap * The map from WSDL message element QNames to AxisOperations. */ public void setMessageElementQNameToOperationMap( Map messageElementQNameToOperationMap) { this.messageElementQNameToOperationMap = messageElementQNameToOperationMap; } /** * Look up an AxisOperation for this service based off of an element QName * from a WSDL message element. * * @param messageElementQName * The QName to search for. * @return The AxisOperation registered to the QName or null if no match was * found. * @see #setMessageElementQNameToOperationMap(Map) */ public AxisOperation getOperationByMessageElementQName( QName messageElementQName) { return (AxisOperation) messageElementQNameToOperationMap .get(messageElementQName); } /** * Add an entry to the map between element QNames in WSDL messages and * AxisOperations for this service. * * @param messageElementQName * The QName of the element on the input message that maps to the * given operation. * @param operation * The AxisOperation to be mapped to. * @see #setMessageElementQNameToOperationMap(Map) */ public void addMessageElementQNameToOperationMapping( QName messageElementQName, AxisOperation operation) { // when setting an operation we have to set it only if the // messegeElementQName does not // exists in the map. // does exists means there are two or more operations which has the same // input element (in doc/literal // this is possible. In this case better to set it as null without // giving // a random operation. if (messageElementQNameToOperationMap.containsKey(messageElementQName) && messageElementQNameToOperationMap.get(messageElementQName) != operation) { messageElementQNameToOperationMap.put(messageElementQName, null); } else { messageElementQNameToOperationMap.put(messageElementQName, operation); } } // @deprecated - use getEndpointURL in axisEndpoint public String getEndpointURL() { return endpointURL; } // @deprecated - use setEndpointURL in axisEndpoint public void setEndpointURL(String endpointURL) { this.endpointURL = endpointURL; } // TODO : Explain what goes in this map! public Map getEndpoints() { return endpointMap; } public boolean isCustomWsdl() { return customWsdl; } public void setCustomWsdl(boolean customWsdl) { this.customWsdl = customWsdl; } public List getOperationsNameList() { return operationsNameList; } public void setOperationsNameList(List operationsNameList) { this.operationsNameList = operationsNameList; } public AxisServiceGroup getAxisServiceGroup() { return (AxisServiceGroup) parent; } public void setParent(AxisServiceGroup parent) { this.parent = parent; } public String toString() { return getName(); } public ExcludeInfo getExcludeInfo() { return excludeInfo; } public void setExcludeInfo(ExcludeInfo excludeInfo) { this.excludeInfo = excludeInfo; } public void registerPolicy(String key, Policy policy) { policyMap.put(key, policy); } public Policy lookupPolicy(String key) { return (Policy) policyMap.get(key); } /** * Add a ServiceContextListener * @param scl */ public void addMessageContextListener(MessageContextListener scl) { synchronized (messageContextListeners) { messageContextListeners.add(scl); } } /** * Remove a ServiceContextListener * @param scl */ public void removeMessageContextListener(MessageContextListener scl) { synchronized (messageContextListeners) { messageContextListeners.remove(scl); } } /** * @param cls Class of ServiceContextListener * @return true if ServiceContextLister is in the list */ public boolean hasMessageContextListener(Class cls) { synchronized (messageContextListeners) { for (int i=0; i namespace) * @param serviceName * the name of the service * @return The generated binding element */ public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap, OMNamespace whttp, String type, Map namespaceMap, String serviceName) { String property; OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement bindingOpElement = omFactory.createOMElement( WSDL2Constants.OPERATION_LOCAL_NAME, wsdl); bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + this.name.getLocalPart())); if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) || Constants.URI_SOAP12_HTTP.equals(type)) { // SOAP Binding specific properties property = (String) this.options .get(WSDL2Constants.ATTR_WSOAP_ACTION); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_ACTION, wsoap, property)); } ArrayList soapModules = (ArrayList) this.options .get(WSDL2Constants.ATTR_WSOAP_MODULE); if (soapModules != null && soapModules.size() > 0) { WSDLSerializationUtil.addSOAPModuleElements(omFactory, soapModules, wsoap, bindingOpElement); } property = (String) this.options.get(WSDL2Constants.ATTR_WSOAP_MEP); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_MEP, wsoap, property)); } } else if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { // HTTP Binding specific properties property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_INPUT_SERIALIZATION, whttp, property)); } property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_OUTPUT_SERIALIZATION, whttp, property)); } property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_FAULT_SERIALIZATION); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_FAULT_SERIALIZATION, whttp, property)); } Boolean ignoreUncited = (Boolean) this.options .get(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED); if (ignoreUncited != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_IGNORE_UNCITED, whttp, ignoreUncited.toString())); } property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_METHOD); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_METHOD, whttp, property)); } } // Common properties property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_LOCATION); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_LOCATION, whttp, property)); } property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING); if (property != null) { bindingOpElement .addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_CONTENT_ENCODING, whttp, property)); } property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); if (property != null) { bindingOpElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_QUERY_PARAMETER_SEPERATOR, whttp, property)); } // Add the input element AxisBindingMessage inMessage = (AxisBindingMessage) this .getChild(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN); if (inMessage != null) { bindingOpElement.addChild(inMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap)); } // Add the output element AxisBindingMessage outMessage = (AxisBindingMessage) this .getChild(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT); if (outMessage != null) { bindingOpElement.addChild(outMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap)); } // Add any fault elements if (faults != null && faults.size() > 0) { Collection faultValues = faults.values(); Iterator iterator = faultValues.iterator(); while (iterator.hasNext()) { AxisBindingMessage faultMessage = (AxisBindingMessage) iterator .next(); bindingOpElement.addChild(faultMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap)); } } WSDLSerializationUtil.addWSDLDocumentationElement(this, bindingOpElement, omFactory, wsdl); WSDLSerializationUtil.addPoliciesAsExtensibleElement(this, bindingOpElement); return bindingOpElement; } public Policy getEffectivePolicy() { ArrayList policyList = new ArrayList(); PolicyInclude policyInclude; // AxisBindingOperation policies policyInclude = getPolicyInclude(); policyList.addAll(policyInclude.getAttachedPolicies()); // AxisBinding AxisBinding axisBinding = getAxisBinding(); if (axisBinding != null) { policyList.addAll(axisBinding.getPolicyInclude() .getAttachedPolicies()); } // AxisEndpoint AxisEndpoint axisEndpoint = null; if (axisBinding != null) { axisEndpoint = axisBinding.getAxisEndpoint(); } if (axisEndpoint != null) { policyList.addAll(axisEndpoint.getPolicyInclude() .getAttachedPolicies()); } // AxisOperation Policy axisOperationPolicy = axisOperation.getPolicyInclude() .getEffectivePolicy(); if (axisOperationPolicy != null) { policyList.add(axisOperationPolicy); } return PolicyUtil.getMergedPolicy(policyList, this); } public AxisBinding getAxisBinding() { return (AxisBinding) parent; } } ./src/org/apache/axis2/description/WSDL20DefaultValueHolder.java0000664000175000017500000000440011767656530023571 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.wsdl.WSDLConstants; import java.util.HashMap; import java.util.Map; public class WSDL20DefaultValueHolder { private static Map defaultValuesMap = new HashMap(); public static final String WHTTP_METHOD_WSDLX_SAFE = "whttp:methodWSDLsafe"; public static final String WHTTP_METHOD_WSDLX_NOTSAFE = "whttp:methodWSDLNotsafe"; public static final String ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT = "&"; static { defaultValuesMap.put(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); defaultValuesMap.put(WSDL2Constants.ATTR_WSOAP_ACTION, "\\\"\\\""); defaultValuesMap.put(WHTTP_METHOD_WSDLX_SAFE, org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET); defaultValuesMap.put(WHTTP_METHOD_WSDLX_SAFE, org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST); defaultValuesMap.put(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT); defaultValuesMap.put(WSDLConstants.WSDL_1_1_STYLE, WSDLConstants.STYLE_DOC); defaultValuesMap.put(WSDL2Constants.ATTR_WSOAP_MEP,WSDL2Constants.MEP_URI_IN_OUT); } public static String getDefaultValue(String name) { return (String) defaultValuesMap.get(name); } } ./src/org/apache/axis2/description/AxisServiceGroup.java0000664000175000017500000001525611767656530022473 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisEvent; import org.apache.axis2.i18n.Messages; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; public class AxisServiceGroup extends AxisDescription { //to check whether user has put WWW dir or not private boolean foundWebResources; // to store module ref at deploy time parsing private ArrayList modulesList = new ArrayList(); // to store modeule configuration info private HashMap moduleConfigmap; // class loader private ClassLoader serviceGroupClassLoader; // to keep name of the service group private String serviceGroupName; public AxisServiceGroup() { moduleConfigmap = new HashMap(); } public AxisServiceGroup(AxisConfiguration axisDescription) { this(); setParent(axisDescription); } /** * Adds module configuration, if there is moduleConfig tag in service. * * @param moduleConfiguration the ModuleConfiguration to add */ public void addModuleConfig(ModuleConfiguration moduleConfiguration) { if (moduleConfigmap == null) { moduleConfigmap = new HashMap(); } moduleConfigmap.put(moduleConfiguration.getModuleName(), moduleConfiguration); } public void addModuleref(String moduleref) { modulesList.add(moduleref); } public void addService(AxisService service) throws AxisFault { if (service == null) { return; } if (serviceGroupName == null) { // setup a temporary name based on the first service under this group serviceGroupName = service.getName(); } service.setParent(this); AxisConfiguration axisConfig = getAxisConfiguration(); if (axisConfig != null) { for (Iterator iterator = getEngagedModules().iterator(); iterator.hasNext();) { Object o = iterator.next(); AxisModule axisModule; if (o instanceof AxisModule) { axisModule = (AxisModule) o; } else if (o instanceof String) { //Should this be checked String moduleName = (String) o; axisModule = axisConfig.getModule(moduleName); if (axisModule == null) { throw new AxisFault(Messages.getMessage("modulenotavailble", moduleName)); } } else { throw new AxisFault(Messages.getMessage("modulenotavailble")); } service.engageModule(axisModule); } } service.setLastUpdate(); addChild(service); if (axisConfig != null) { axisConfig.addToAllServicesMap(service); } } /** * * @param service * @throws Exception * @deprecated please use addService() instead */ public void addToGroup(AxisService service) throws Exception { addService(service); } /** * When a module gets engaged on a ServiceGroup, we have to engage it for each Service. * * @param module the newly-engaged AxisModule * @param engager * @throws AxisFault if there is a problem */ protected void onEngage(AxisModule module, AxisDescription engager) throws AxisFault { for (Iterator serviceIter = getServices(); serviceIter.hasNext();) { AxisService axisService = (AxisService) serviceIter.next(); axisService.engageModule(module, engager); } } public void onDisengage(AxisModule module) throws AxisFault { for (Iterator serviceIter = getServices(); serviceIter.hasNext();) { AxisService axisService = (AxisService) serviceIter.next(); axisService.disengageModule(module); } } public void removeService(String name) throws AxisFault { AxisService service = getService(name); if (service != null) { getAxisConfiguration().notifyObservers(AxisEvent.SERVICE_REMOVE, service); } removeChild(name); } public ModuleConfiguration getModuleConfig(String moduleName) { return (ModuleConfiguration) moduleConfigmap.get(moduleName); } public ArrayList getModuleRefs() { return modulesList; } public AxisService getService(String name) throws AxisFault { return (AxisService) getChild(name); } public ClassLoader getServiceGroupClassLoader() { return serviceGroupClassLoader; } public String getServiceGroupName() { // Note: if the serviceGroupName is not set, then this could be null. // If the serviceGroupName has not been set and a service is added to this group, // then the serviceGroupName will default to the name of the first service return serviceGroupName; } public Iterator getServices() { return getChildren(); } public void setAxisDescription(AxisConfiguration axisDescription) { setParent(axisDescription); } public void setServiceGroupClassLoader(ClassLoader serviceGroupClassLoader) { this.serviceGroupClassLoader = serviceGroupClassLoader; } public void setServiceGroupName(String serviceGroupName) { this.serviceGroupName = serviceGroupName; } public Object getKey() { // Note: if the serviceGroupName is not set, then this could be null. // If the serviceGroupName has not been set and a service is added to this group, // then the serviceGroupName will default to the name of the first service return this.serviceGroupName; } public boolean isFoundWebResources() { return foundWebResources; } public void setFoundWebResources(boolean foundWebResources) { this.foundWebResources = foundWebResources; } } ./src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java0000664000175000017500000002245311767656530023757 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.namespace.Constants; import org.apache.neethi.PolicyRegistry; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.apache.ws.commons.schema.resolver.URIResolver; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public abstract class WSDLToAxisServiceBuilder { protected static final String XMLSCHEMA_NAMESPACE_URI = Constants.URI_2001_SCHEMA_XSD; protected static final String XMLSCHEMA_NAMESPACE_PREFIX = "xs"; protected static final String XML_SCHEMA_LOCAL_NAME = "schema"; protected static final String XML_SCHEMA_SEQUENCE_LOCAL_NAME = "sequence"; protected static final String XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME = "complexType"; protected static final String XML_SCHEMA_ELEMENT_LOCAL_NAME = "element"; protected static final String XML_SCHEMA_IMPORT_LOCAL_NAME = "import"; protected static final String XSD_NAME = "name"; protected static final String XSD_TARGETNAMESPACE = "targetNamespace"; protected static final String XMLNS_AXIS2WRAPPED = "xmlns:axis2wrapped"; protected static final String AXIS2WRAPPED = "axis2wrapped"; protected static final String XSD_TYPE = "type"; protected static final String XSD_REF = "ref"; protected static int nsCount = 0; protected Map resolvedRpcWrappedElementMap = new HashMap(); protected static final String XSD_ELEMENT_FORM_DEFAULT = "elementFormDefault"; protected static final String XSD_UNQUALIFIED = "unqualified"; protected InputStream in; protected AxisService axisService; protected PolicyRegistry registry; protected AxisConfiguration axisConfig; protected QName serviceName; protected boolean isServerSide = true; protected String style = null; private URIResolver customResolver; private String baseUri = null; protected static final String TYPES = "Types"; // keeping whether builder is used in codegen or not protected boolean isCodegen; protected WSDLToAxisServiceBuilder() { } public WSDLToAxisServiceBuilder(InputStream in, QName serviceName) { this.in = in; this.serviceName = serviceName; this.axisService = new AxisService(); setPolicyRegistryFromService(axisService); } public WSDLToAxisServiceBuilder(InputStream in, AxisService axisService) { this.in = in; this.axisService = axisService; setPolicyRegistryFromService(axisService); } /** * Sets a custom xmlschema URI resolver * * @param customResolver a URIResolver to use when working with schemas */ public void setCustomResolver(URIResolver customResolver) { this.customResolver = customResolver; } public boolean isServerSide() { return isServerSide; } public void setServerSide(boolean serverSide) { isServerSide = serverSide; } protected void setPolicyRegistryFromService(AxisService axisService) { PolicyInclude policyInclude = axisService.getPolicyInclude(); this.registry = policyInclude.getPolicyRegistry(); } protected XmlSchema getXMLSchema(Element element, String baseUri) { XmlSchemaCollection schemaCollection = new XmlSchemaCollection(); if (baseUri != null) { schemaCollection.setBaseUri(baseUri); } if (customResolver != null) { schemaCollection.setSchemaResolver(customResolver); } return schemaCollection.read(element); } /** * Find the XML schema prefix * * @return the active schema prefix, or the default schema prefix if not declared */ protected String findSchemaPrefix() { String xsdPrefix = null; Map declaredNameSpaces = axisService.getNamespaceMap(); if (declaredNameSpaces.containsValue(XMLSCHEMA_NAMESPACE_URI)) { //loop and find the prefix Iterator it = declaredNameSpaces.keySet().iterator(); String key; while (it.hasNext()) { key = (String) it.next(); if (XMLSCHEMA_NAMESPACE_URI.equals(declaredNameSpaces.get(key))) { xsdPrefix = key; break; } } } else { xsdPrefix = XMLSCHEMA_NAMESPACE_PREFIX; //default prefix } return xsdPrefix; } public abstract AxisService populateService() throws AxisFault; /** * Utility method that returns a DOM Builder * * @return a namespace-aware DOM DocumentBuilder */ protected DocumentBuilder getDOMDocumentBuilder() { DocumentBuilder documentBuilder; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } return documentBuilder; } /** * Get a temporary namespace prefix. NOT threadsafe. * * @return a new namespace prefix of the form "nsX" */ protected String getTemporaryNamespacePrefix() { return "ns" + nsCount++; } /** * Gets the URI associated with the base document * for the WSDL definition. Note that this URI * is for the base document, not the imports. * * @return The URI as a String */ public String getBaseUri() { return baseUri; } /** * Sets the URI associated with the base document * for the WSDL definition. Note that this URI * is for the base document, not the imports. * * @param baseUri The URI as a String */ public void setBaseUri(String baseUri) { this.baseUri = baseUri; } public boolean isCodegen() { return isCodegen; } public void setCodegen(boolean codegen) { isCodegen = codegen; } public QName getServiceName() { return serviceName; } public void setServiceName(QName serviceName) { this.serviceName = serviceName; } /** * Get a string containing the stack of the current location * * @return String */ protected static String stackToString() { return stackToString(new RuntimeException()); } /** * Get a string containing the stack of the specified exception * * @param e * @return */ protected static String stackToString(Throwable e) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); // Jump past the throwable text = text.substring(text.indexOf("at")); text = replace(text, "at ", "DEBUG_FRAME = "); return text; } /** * replace: Like String.replace except that the old new items are strings. * * @param name string * @param oldT old text to replace * @param newT new text to use * @return replacement string */ protected static final String replace(String name, String oldT, String newT) { if (name == null) return ""; // Create a string buffer that is twice initial length. // This is a good starting point. StringBuffer sb = new StringBuffer(name.length() * 2); int len = oldT.length(); try { int start = 0; int i = name.indexOf(oldT, start); while (i >= 0) { sb.append(name.substring(start, i)); sb.append(newT); start = i + len; i = name.indexOf(oldT, start); } if (start < name.length()) sb.append(name.substring(start)); } catch (NullPointerException e) { } return new String(sb); } public void useAxisConfiguration(AxisConfiguration axisConfig) { this.axisConfig = axisConfig; } } ./src/org/apache/axis2/description/WSDL2Constants.java0000664000175000017500000001641611767656530021760 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; public interface WSDL2Constants { String WSDL_NAMESPACE = "http://www.w3.org/ns/wsdl"; String DEFAULT_WSDL_NAMESPACE_PREFIX = "wsdl2"; String DESCRIPTION = "description"; String URI_WSDL2_SOAP = "http://www.w3.org/ns/wsdl/soap"; String URI_WSDL2_HTTP = "http://www.w3.org/ns/wsdl/http"; String URI_WSDL2_EXTENSIONS = "http://www.w3.org/ns/wsdl-extensions"; String URI_WSDL2_RPC = "http://www.w3.org/ns/wsdl/rpc"; String SOAP_PREFIX = "wsoap"; String HTTP_PREFIX = "whttp"; String WSDL_EXTENTION_PREFIX = "wsdlx"; String WSDL_RPC_PREFIX = "wrpc"; String SOAP_ENV_PREFIX = "soap"; String DEFAULT_TARGET_NAMESPACE_PREFIX = "axis2"; String DOCUMENTATION = "documentation"; String DEFAULT_SOAP11_ENDPOINT_NAME = "SOAP11Endpoint"; String DEFAULT_SOAP12_ENDPOINT_NAME = "SOAP12Endpoint"; String DEFAULT_HTTP_ENDPOINT_NAME = "HTTPEndpoint"; String DEFAULT_HTTPS_PREFIX = "Secure"; String DEFAULT_INTERFACE_NAME = "ServiceInterface"; String TYPES_LOCAL_NALE = "types"; String INTERFACE_LOCAL_NAME = "interface"; String INTERFACE_PREFIX = "Interface"; String OPERATION_LOCAL_NAME = "operation"; String ATTRIBUTE_NAME = "name"; String TARGET_NAMESPACE= "targetNamespace"; String ATTRIBUTE_REF = "ref"; String ATTRIBUTE_LOCATION = "location"; String ATTRIBUTE_CONTENT_ENCODING_DEFAULT = "contentEncodingDefault"; String ATTRIBUTE_CONTENT_ENCODING = "contentEncoding"; String ATTRIBUTE_QUERY_PARAMETER_SEPERATOR = "queryParameterSeparator"; String ATTRIBUTE_QUERY_PARAMETER_SEPERATOR_DEFAULT = "queryParameterSeparatorDefault"; String ATTRIBUTE_ACTION = "action"; String ATTRIBUTE_MEP = "mep"; String ATTRIBUTE_MEP_DEFAULT = "mepDefault"; String ATTRIBUTE_METHOD = "method"; String ATTRIBUTE_METHOD_DEFAULT = "methodDefault"; String ATTRIBUTE_MODULE = "module"; String ATTRIBUTE_IGNORE_UNCITED = "ignoreUncited"; String ATTRIBUTE_INPUT_SERIALIZATION = "inputSerialization"; String ATTRIBUTE_OUTPUT_SERIALIZATION = "outputSerialization"; String ATTRIBUTE_FAULT_SERIALIZATION = "faultSerialization"; String ATTRIBUTE_CODE = "code"; String ATTRIBUTE_SUBCODES = "subcodes"; String ATTRIBUTE_HEADER = "header"; String ATTRIBUTE_TYPE = "type"; String ATTRIBUTE_REQUIRED = "required"; String ATTRIBUTE_MUST_UNDERSTAND = "mustUnderstand"; String ATTRIBUTE_VERSION = "version"; String ATTRIBUTE_PROTOCOL = "protocol"; String ATTRIBUTE_SAFE = "safe"; String ATTRIBUTE_ADDRESS = "address"; String ATTRIBUTE_AUTHENTICATION_TYPE = "authenticationType"; String ATTRIBUTE_AUTHENTICATION_REALM = "authenticationRealm"; String ATTRIBUTE_STYLE = "style"; String ATTRIBUTE_SIGNATURE = "signature"; String OPERATION_STYLE = "operationStyle"; String IN_PUT_LOCAL_NAME = "input"; String OUT_PUT_LOCAL_NAME = "output"; String OUT_FAULT_LOCAL_NAME = "outfault"; String IN_FAULT_LOCAL_NAME = "infault"; String FAULT_LOCAL_NAME = "fault"; String ATTRIBUTE_NAME_PATTERN = "pattern"; String MESSAGE_LABEL = "messageLabel"; String ATTRIBUTE_ELEMENT = "element"; String BINDING_LOCAL_NAME = "binding"; String ENDPOINT_LOCAL_NAME = "endpoint"; String SOAP_BINDING_PREFIX = "SOAPBinding"; String HTTP_PROTOCAL = "http://www.w3.org/2003/05/soap/bindings/HTTP"; String SERVICE_LOCAL_NAME = "service"; String URI_WSOAP_MEP = "http://www.w3.org/2003/05/soap/mep/soap-response/"; String ATTR_WSOAP_PROTOCOL = "wsoap:protocol"; String ATTR_WSOAP_VERSION = "wsoap:version"; String ATTR_WSOAP_CODE = "wsoap:code"; String ATTR_WSOAP_MEP = "wsoap:mep"; String ATTR_WSOAP_MODULE = "wsoap:module"; String ATTR_WSOAP_SUBCODES = "wsoap:subcodes"; String ATTR_WSOAP_HEADER = "wsoap:header"; String ATTR_WSOAP_ACTION = "wsoap:action"; String ATTR_WSOAP_ADDRESS = "wsoap:address"; String ATTR_WHTTP_CONTENT_ENCODING = "whttp:contentEncoding"; String ATTR_WHTTP_LOCATION = "whttp:location"; String ATTR_WHTTP_HEADER = "whttp:header"; String ATTR_WHTTP_METHOD = "whttp:method"; String ATTR_WHTTP_CODE = "whttp:code"; String ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR = "whttp:queryParameterSeparator"; String ATTR_WHTTP_IGNORE_UNCITED = "whttp:ignoreUncited"; String ATTR_WHTTP_INPUT_SERIALIZATION = "whttp:inputSerialization"; String ATTR_WHTTP_OUTPUT_SERIALIZATION = "whttp:outputSerialization"; String ATTR_WHTTP_FAULT_SERIALIZATION = "whttp:faultSerialization"; String ATTR_WHTTP_AUTHENTICATION_TYPE = "whttp:authenticationType"; String ATTR_WHTTP_AUTHENTICATION_REALM = "whttp:authenticationRealm"; String ATTR_WSDLX_SAFE = "wsdlx:safe"; String ATTR_WRPC_SIGNATURE = "wrpc:signature"; String SOAP_VERSION_1_1 = "1.1"; String SOAP_VERSION_1_2 = "1.2"; String MESSAGE_LABEL_IN = "In"; String MESSAGE_LABEL_OUT = "Out"; String RPC_IN = "#in"; String RPC_RETURN = "#return"; String RPC_INOUT = "#inout"; String HTTP_LOCATION_TABLE = "HTTPLocationTable"; // This was taken from thye resolution of CR117 (WSDL 2.0 working group) // http://www.w3.org/2002/ws/desc/5/cr-issues/issues.html?view=normal#CR117 // http://lists.w3.org/Archives/Public/www-ws-desc/2007Feb/0039.html String LEGAL_CHARACTERS_IN_URL = "-._~!$&()*+,;=:@?/%"; String LEGAL_CHARACTERS_IN_PATH = "-._~!$'()*+,;=:@"; String LEGAL_CHARACTERS_IN_QUERY = "-._~!$'()*+,;=:@/?"; String TEMPLATE_ENCODE_ESCAPING_CHARACTER = "!"; public String MEP_URI_IN_ONLY = "http://www.w3.org/ns/wsdl/in-only"; public String MEP_URI_ROBUST_IN_ONLY = "http://www.w3.org/ns/wsdl/robust-in-only"; public String MEP_URI_IN_OUT = "http://www.w3.org/ns/wsdl/in-out"; public String MEP_URI_IN_OPTIONAL_OUT = "http://www.w3.org/ns/wsdl/in-opt-out"; public String MEP_URI_OUT_ONLY = "http://www.w3.org/ns/wsdl/out-only"; public String MEP_URI_ROBUST_OUT_ONLY = "http://www.w3.org/ns/wsdl/robust-out-only"; public String MEP_URI_OUT_IN = "http://www.w3.org/ns/wsdl/out-in"; public String MEP_URI_OUT_OPTIONAL_IN = "http://www.w3.org/ns/wsdl/out-opt-in"; public String STYLE_IRI = "http://www.w3.org/ns/wsdl/style/iri"; public String STYLE_RPC = "http://www.w3.org/ns/wsdl/style/rpc"; public String STYLE_MULTIPART = "http://www.w3.org/ns/wsdl/style/multipart"; public String NMTOKEN_ANY = "#any"; public String NMTOKEN_NONE = "#none"; public String NMTOKEN_OTHER = "#other"; public String NMTOKEN_ELEMENT = "#element"; } ./src/org/apache/axis2/description/AxisOperationFactory.java0000664000175000017500000001351111767656530023336 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.axis2.i18n.Messages; import org.apache.axis2.wsdl.WSDLConstants; public class AxisOperationFactory implements WSDLConstants { public static AxisOperation getAxisOperation(int mepURI) throws AxisFault { AxisOperation abOpdesc; switch (mepURI) { case WSDLConstants.MEP_CONSTANT_IN_ONLY : { abOpdesc = new InOnlyAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY); break; } case WSDLConstants.MEP_CONSTANT_OUT_ONLY : { abOpdesc = new OutOnlyAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_ONLY); break; } case WSDLConstants.MEP_CONSTANT_IN_OUT : { abOpdesc = new InOutAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT); break; } case WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT : { abOpdesc = new InOutAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT); break; } case WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY : { abOpdesc = new InOnlyAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY); break; } case WSDLConstants.MEP_CONSTANT_OUT_IN : { abOpdesc = new OutInAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_IN); break; } case WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN : { abOpdesc = new OutInAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN); break; } case WSDLConstants.MEP_CONSTANT_ROBUST_OUT_ONLY : { abOpdesc = new RobustOutOnlyAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY); break; } default : { throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI)); } } return abOpdesc; } //FIXME add in the latest MEP URIs AND needs to double check on about the mep we had in 2004 public static AxisOperation getOperationDescription(String mepURI) throws AxisFault { AxisOperation abOpdesc; if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI) || WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_IN_ONLY.equals(mepURI)) { abOpdesc = new InOnlyAxisOperation(); } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI) || WSDL20_2006Constants.MEP_URI_OUT_ONLY.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_OUT_ONLY.equals(mepURI)) { abOpdesc = new OutOnlyAxisOperation(); } else if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI) || WSDL20_2006Constants.MEP_URI_IN_OUT.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_IN_OUT.equals(mepURI)) { abOpdesc = new InOutAxisOperation(); } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI) || WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)) { abOpdesc = new InOutAxisOperation(); } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI) || WSDL20_2006Constants.MEP_URI_OUT_IN.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_OUT_IN.equals(mepURI)) { abOpdesc = new OutInAxisOperation(); } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI) || WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI)) { abOpdesc = new OutInAxisOperation(); } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI) || WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)) { abOpdesc = new OutInAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY); } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI) || WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI) || WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)) { abOpdesc = new InOnlyAxisOperation(); abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY); } else { throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI)); } return abOpdesc; } } ./src/org/apache/axis2/description/Parameter.java0000664000175000017500000003015711767656530021146 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import java.io.ByteArrayInputStream; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** * Class Parameter */ public class Parameter implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(Parameter.class); private static final String myClassName = "Parameter"; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -6601664200673063531L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * Field ANY_PARAMETER */ public final static int ANY_PARAMETER = 0; /** * Field TEXT_PARAMETER */ public final static int TEXT_PARAMETER = 1; /** * Field OM_PARAMETER */ public final static int OM_PARAMETER = 2; /** * Field type */ private int type = TEXT_PARAMETER; /** * Field locked */ private boolean locked; /** * Field name */ private String name; /** * to store the parameter element * * org.apache.axis2.sample.echo.EchoImpl */ private OMElement parameterElement; /** * Field value */ private Object value; private boolean _transient; // Indicates that the parameter is transient (not persisted) //To check whether the parameter is editable or not , // if the value is false then no one can call setvalue // TODO // Currently the editable field is not persisted. This seems like a problem. private boolean editable = true; /** * Constructor. */ public Parameter() { } /** * Constructor from name and value. * * @param name * @param value */ public Parameter(String name, Object value) { this.name = name; this.value = value; parseValueForType(this.value); } /** * Method getName. * * @return Returns String. */ public String getName() { return name; } public OMElement getParameterElement() { return this.parameterElement; } /** * Method getParameterType. * * @return Returns int. */ public int getParameterType() { return type; } /** * Method getValue. * * @return Returns Object. */ public Object getValue() { return value; } /** * Method isLocked. * * @return Returns boolean. */ public boolean isLocked() { return locked; } /** * Method setLocked. * * @param value */ public void setLocked(boolean value) { locked = value; } /** * Method setName. * * @param name */ public void setName(String name) { this.name = name; } public void setParameterElement(OMElement element) { this.parameterElement = element; } public void setParameterType(int type) { this.type = type; } /** * Method setValue. * * @param value */ public void setValue(Object value) { if(!editable) { log.debug("Parameter " + getName() + " can not be edit"); return; } parseValueForType(value); this.value = value; } /** * The purpose of this method is to pars the injected value for its type. * Type will be set using setParameterType. * @param value */ private void parseValueForType(Object value) { if (value instanceof String) { setParameterType(TEXT_PARAMETER); } else if (value instanceof OMElement) { setParameterType(OM_PARAMETER); } else { setParameterType(ANY_PARAMETER); } } public String toString() { return "Parameter : " + name + "=" + value; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Parameter) { return ((Parameter) obj).name.equals(name); } return false; } public int hashCode() { return name.hashCode(); } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

        * NOTE: Transient fields and static fields are not saved. * Also, objects that represent "static" data are * not saved, except for enough information to be * able to find matching objects when the message * context is re-constituted. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // Don't write out transient parameters if (this.isTransient()) { return; } // write out contents of this object //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // simple fields //--------------------------------------------------------- out.writeInt(type); out.writeBoolean(locked); out.writeObject(name); //--------------------------------------------------------- // object fields //--------------------------------------------------------- // TODO: investigate serializing the OMElement more efficiently // This currently will basically serialize the given OMElement // to a String but will build the OMTree in the memory String tmp = null; if (parameterElement != null) { tmp = parameterElement.toString(); } out.writeObject(tmp); // parameterElement out.writeObject(value); } /** * Restore the contents of the object that was previously saved. *

        * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // trace point if (log.isTraceEnabled()) { log.trace(myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // simple fields //--------------------------------------------------------- type = in.readInt(); locked = in.readBoolean(); name = (String) in.readObject(); //--------------------------------------------------------- // object fields //--------------------------------------------------------- // TODO: investigate serializing the OMElement more efficiently // This currently will basically serialize the given OMElement // to a String but will build the OMTree in the memory // treat as an object, don't do UTF String tmp = (String) in.readObject(); // convert to an OMElement if (tmp != null) { try { ByteArrayInputStream bais = new ByteArrayInputStream(tmp.getBytes()); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(bais); // TODO: the StAXOMBuilder is an impl class - is there a better mechanism rather than an impl class ? StAXOMBuilder builder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); OMElement docElement = builder.getDocumentElement(); if (docElement != null) { parameterElement = docElement; } else { // TODO: error handling if can't create an OMElement parameterElement = null; } } catch (Exception exc) { // TODO: error handling if can't create an OMElement parameterElement = null; } } else { parameterElement = null; } // TODO: error handling if this can't be serialized value = in.readObject(); //--------------------------------------------------------- // done //--------------------------------------------------------- } public void setEditable(boolean editable) { this.editable = editable; } public boolean isTransient() { return _transient; } public void setTransient(boolean _transient) { this._transient = _transient; } } ./src/org/apache/axis2/description/AxisMessage.java0000664000175000017500000002363211767656530021437 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.phaseresolver.PhaseResolver; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.neethi.Policy; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; /** * This class represents the messages in WSDL. There can be message element in services.xml * which are represented by this class. */ public class AxisMessage extends AxisDescription { private ArrayList handlerChain; private String name; private ArrayList soapHeaders; //to keep data in WSDL message reference and to keep the Java2WSDL data // such as SchemaElementName , direction etc. private QName elementQname; private String direction; private String messagePartName; // To store deploy-time module refs private ArrayList modulerefs; private String partName = Java2WSDLConstants.PARAMETERS; // private PolicyInclude policyInclude; //To chcek whether the message is wrapped or unwrapped private boolean wrapped = true; private Policy effectivePolicy = null; private Date lastPolicyCalcuatedTime = null; public String getMessagePartName() { return messagePartName; } public void setMessagePartName(String messagePartName) { this.messagePartName = messagePartName; } public AxisMessage() { soapHeaders = new ArrayList(); handlerChain = new ArrayList(); modulerefs = new ArrayList(); } public ArrayList getMessageFlow() { return handlerChain; } public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean locked = false; if (getParent() != null) { locked = getParent().isParameterLocked(parameterName); } if (locked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } } public void setMessageFlow(ArrayList operationFlow) { this.handlerChain = operationFlow; } public String getDirection() { return direction; } public void setDirection(String direction) { this.direction = direction; } public QName getElementQName() { return this.elementQname; } public void setElementQName(QName element) { this.elementQname = element; } public Object getKey() { return this.elementQname; } public XmlSchemaElement getSchemaElement() { XmlSchemaElement xmlSchemaElement = null; AxisService service = getAxisOperation().getAxisService(); ArrayList schemas = service.getSchema(); for (Iterator schemaIter = schemas.iterator(); schemaIter.hasNext();){ xmlSchemaElement = getSchemaElement((XmlSchema) schemaIter.next()); if (xmlSchemaElement != null){ break; } } return xmlSchemaElement; } private XmlSchemaElement getSchemaElement(XmlSchema schema) { XmlSchemaElement xmlSchemaElement = null; if (schema != null) { xmlSchemaElement = schema.getElementByName(this.elementQname); if (xmlSchemaElement == null) { // try to find in an import or an include XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator includesIter = includes.getIterator(); Object object; while (includesIter.hasNext()) { object = includesIter.next(); if (object instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (object instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (xmlSchemaElement != null){ break; } } } } } return xmlSchemaElement; } public String getName() { return name; } public void setName(String name) { this.name = name; } /** * This will return a list of WSDLExtensibilityAttribute */ public List getExtensibilityAttributes() { // TODO : Deepal implement this properly. // the list should contain list of WSDLExtensibilityAttribute return new ArrayList(0); } public void addSoapHeader(SOAPHeaderMessage soapHeaderMessage) { soapHeaders.add(soapHeaderMessage); } public ArrayList getSoapHeaders () { return soapHeaders; } /** * We do not support adding module operations when engaging a module to an AxisMessage * * @param axisModule AxisModule to engage * @param engager * @throws AxisFault something went wrong */ public void onEngage(AxisModule axisModule, AxisDescription engager) throws AxisFault { PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration()); phaseResolver.engageModuleToMessage(this, axisModule); } public ArrayList getModulerefs() { return modulerefs; } public void addModuleRefs(String moduleName) { modulerefs.add(moduleName); } public AxisOperation getAxisOperation(){ return (AxisOperation)parent; } public String getPartName() { return partName; } public void setPartName(String partName) { this.partName = partName; } public boolean isWrapped() { return wrapped; } public void setWrapped(boolean wrapped) { this.wrapped = wrapped; } public Policy getEffectivePolicy() { if (lastPolicyCalcuatedTime == null || isPolicyUpdated()) { effectivePolicy = calculateEffectivePolicy(); } return effectivePolicy; } public Policy calculateEffectivePolicy() { PolicySubject policySubject = null; ArrayList policyList = new ArrayList(); // AxisMessage policySubject = getPolicySubject(); policyList.addAll(policySubject.getAttachedPolicyComponents()); // AxisOperation AxisOperation axisOperation = getAxisOperation(); if (axisOperation != null) { policyList.addAll(axisOperation.getPolicySubject() .getAttachedPolicyComponents()); } // AxisService AxisService axisService = (axisOperation == null) ? null : axisOperation.getAxisService(); if (axisService != null) { policyList.addAll(axisService.getPolicySubject() .getAttachedPolicyComponents()); } // AxisConfiguration AxisConfiguration axisConfiguration = (axisService == null) ? null : axisService.getAxisConfiguration(); if (axisConfiguration != null) { policyList.addAll(axisConfiguration.getPolicySubject() .getAttachedPolicyComponents()); } Policy result = PolicyUtil.getMergedPolicy(policyList, axisService); lastPolicyCalcuatedTime = new Date(); return result; } public boolean isPolicyUpdated() { // AxisMessage if (getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisOperation AxisOperation axisOperation = (AxisOperation) parent; if (axisOperation != null && axisOperation.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisService AxisService axisService = (axisOperation == null) ? null : axisOperation.getAxisService(); if (axisService != null && axisService.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisConfiguration AxisConfiguration axisConfiguration = (axisService == null) ? null : axisService.getAxisConfiguration(); if (axisConfiguration != null && axisConfiguration.getPolicySubject().getLastUpdatedTime() .after(lastPolicyCalcuatedTime)) { return true; } return false; } } ./src/org/apache/axis2/description/ParameterObserver.java0000664000175000017500000000167711767656530022663 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; public interface ParameterObserver { void parameterChanged(String name, Object value); } ./src/org/apache/axis2/description/AxisService2WSDL20.java0000664000175000017500000011472311767656530022373 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.ExternalPolicySerializer; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.PolicyLocator; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.WSDLSerializationUtil; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyReference; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.apache.ws.commons.schema.XmlSchemaType; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayInputStream; import java.io.StringWriter; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; public class AxisService2WSDL20 implements WSDL2Constants { private AxisService axisService; private String serviceName; private String[] eprs = null; private OMNamespace wsaw; private HashMap policiesInDescription = new HashMap(); private ExternalPolicySerializer filter = null; public AxisService2WSDL20(AxisService service) { this.axisService = service; this.serviceName = service.getName(); } public AxisService2WSDL20(AxisService service, String serviceName) { this.axisService = service; this.serviceName = serviceName; } /** * Generates a WSDL 2.0 document for this web service * @return The WSDL2 document element * @throws Exception - Thrown in case an exception occurs */ public OMElement generateOM() throws Exception { Map nameSpacesMap = axisService.getNamespaceMap(); OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMNamespace wsdl; // filter = new ExternalPolicySerializer(); AxisConfiguration axisConfiguration = axisService .getAxisConfiguration(); if (axisConfiguration != null) { filter.setAssertionsToFilter(axisConfiguration .getLocalPolicyAssertions()); } // if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.WSDL_NAMESPACE)) { wsdl = omFactory .createOMNamespace(WSDL2Constants.WSDL_NAMESPACE, WSDLSerializationUtil.getPrefix( WSDL2Constants.WSDL_NAMESPACE, nameSpacesMap)); } else { wsdl = omFactory .createOMNamespace(WSDL2Constants.WSDL_NAMESPACE, WSDL2Constants.DEFAULT_WSDL_NAMESPACE_PREFIX); } OMElement descriptionElement = omFactory.createOMElement(WSDL2Constants.DESCRIPTION, wsdl); // Declare all the defined namespaces in the document WSDLSerializationUtil.populateNamespaces(descriptionElement, nameSpacesMap); descriptionElement.declareNamespace(axisService.getTargetNamespace(), axisService.getTargetNamespacePrefix()); wsaw = descriptionElement.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE, "wsaw"); // Need to add the targetnamespace as an attribute according to the wsdl 2.0 spec OMAttribute targetNamespace = omFactory .createOMAttribute(WSDL2Constants.TARGET_NAMESPACE, null, axisService.getTargetNamespace()); descriptionElement.addAttribute(targetNamespace); // Check whether the required namespaces are already in namespaceMap, if they are not // present declare them. OMNamespace wsoap; OMNamespace whttp; OMNamespace wsdlx; OMNamespace wrpc; OMNamespace tns = omFactory .createOMNamespace(axisService.getTargetNamespace(), axisService.getTargetNamespacePrefix()); if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_SOAP)) { wsoap = omFactory .createOMNamespace(WSDL2Constants.URI_WSDL2_SOAP, WSDLSerializationUtil.getPrefix( WSDL2Constants.URI_WSDL2_SOAP, nameSpacesMap)); } else { wsoap = descriptionElement .declareNamespace(WSDL2Constants.URI_WSDL2_SOAP, WSDL2Constants.SOAP_PREFIX); } if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_HTTP)) { whttp = omFactory .createOMNamespace(WSDL2Constants.URI_WSDL2_HTTP, WSDLSerializationUtil.getPrefix( WSDL2Constants.URI_WSDL2_HTTP, nameSpacesMap)); } else { whttp = descriptionElement .declareNamespace(WSDL2Constants.URI_WSDL2_HTTP, WSDL2Constants.HTTP_PREFIX); } if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_EXTENSIONS)) { wsdlx = omFactory .createOMNamespace(WSDL2Constants.URI_WSDL2_EXTENSIONS, WSDLSerializationUtil.getPrefix( WSDL2Constants.URI_WSDL2_EXTENSIONS, nameSpacesMap)); } else { wsdlx = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_EXTENSIONS, WSDL2Constants.WSDL_EXTENTION_PREFIX); } if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_RPC)) { wrpc = omFactory .createOMNamespace(WSDL2Constants.URI_WSDL2_RPC, WSDLSerializationUtil.getPrefix( WSDL2Constants.URI_WSDL2_RPC, nameSpacesMap)); } else { wrpc = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_RPC, WSDL2Constants.WSDL_RPC_PREFIX); } // Add the documentation element WSDLSerializationUtil .addWSDLDocumentationElement(axisService, descriptionElement, omFactory, wsdl); // Add types element OMElement typesElement = omFactory.createOMElement(WSDL2Constants.TYPES_LOCAL_NALE, wsdl); axisService.populateSchemaMappings(); ArrayList schemas = axisService.getSchema(); for (int i = 0; i < schemas.size(); i++) { StringWriter writer = new StringWriter(); XmlSchema schema = axisService.getSchema(i); if (!org.apache.axis2.namespace.Constants.URI_2001_SCHEMA_XSD .equals(schema.getTargetNamespace())) { schema.write(writer); String schemaString = writer.toString(); if (!"".equals(schemaString)) { try { typesElement.addChild( XMLUtils.toOM(new ByteArrayInputStream(schemaString.getBytes()))); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } } } descriptionElement.addChild(typesElement); Parameter parameter = axisService.getParameter(WSDL2Constants.INTERFACE_LOCAL_NAME); String interfaceName; if (parameter != null) { interfaceName = (String) parameter.getValue(); } else { interfaceName = WSDL2Constants.DEFAULT_INTERFACE_NAME; } // Add the interface element descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, wrpc, omFactory, interfaceName)); // axis2.xml indicated no HTTP binding? boolean disableREST = false; Parameter disableRESTParameter = axisService.getParameter(Constants.Configuration.DISABLE_REST); if (disableRESTParameter != null && JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { disableREST = true; } // axis2.xml indicated no SOAP 1.2 binding? boolean disableSOAP12 = false; Parameter disableSOAP12Parameter = axisService.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP12); if (disableSOAP12Parameter != null && JavaUtils.isTrueExplicitly(disableSOAP12Parameter.getValue())) { disableSOAP12 = true; } // Check whether the axisService has any endpoints. If they exists serialize them else // generate default endpoint elements. Set bindings = new HashSet(); Map endpointMap = axisService.getEndpoints(); if (endpointMap != null && endpointMap.size() > 0) { OMElement serviceElement = getServiceElement(wsdl, tns, omFactory, interfaceName); Iterator iterator = endpointMap.values().iterator(); while (iterator.hasNext()) { // With the new binding hierachy in place we need to do some extra checking here. // If a service has both http and https listners up we should show two separate eprs // If the service was deployed with a WSDL and it had two endpoints for http and // https then we have two endpoints populated so we should serialize them instead // of updating the endpoints. AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next(); /* * Some transports might not be active at runtime. */ if (!axisEndpoint.isActive()) { continue; } AxisBinding axisBinding = axisEndpoint.getBinding(); String type = axisBinding.getType(); // If HTTP binding is disabled, do not add. if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { if (disableREST) { continue; } } // If SOAP 1.2 binding is disabled, do not add. String propertySOAPVersion = (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(propertySOAPVersion)) { if (disableSOAP12) { continue; } } bindings.add(axisBinding); OMElement endpointElement = axisEndpoint.toWSDL20(wsdl, tns, whttp); boolean endpointAlreadyAdded = false; Iterator endpointsAdded = serviceElement.getChildren(); while (endpointsAdded.hasNext()) { OMElement endpoint = (OMElement) endpointsAdded.next(); // Checking whether a endpoint with the same binding and address exists. if (endpoint.getAttribute(new QName(WSDL2Constants.BINDING_LOCAL_NAME)) .getAttributeValue().equals(endpointElement.getAttribute( new QName(WSDL2Constants.BINDING_LOCAL_NAME)).getAttributeValue()) && endpoint .getAttribute(new QName(WSDL2Constants.ATTRIBUTE_ADDRESS)) .getAttributeValue().equals(endpointElement.getAttribute( new QName(WSDL2Constants.ATTRIBUTE_ADDRESS)).getAttributeValue())) { endpointAlreadyAdded = true; } } if (!endpointAlreadyAdded) { // addPolicyAsExtensibleElement(axisEndpoint, endpointElement); serviceElement.addChild(endpointElement); } } Iterator iter = bindings.iterator(); while (iter.hasNext()) { AxisBinding binding = (AxisBinding) iter.next(); OMElement bindingElement = binding.toWSDL20(wsdl, tns, wsoap, whttp, interfaceName, axisService.getNamespaceMap(), AddressingHelper.getAddressingRequirementParemeterValue(axisService), serviceName,wsaw); descriptionElement .addChild(bindingElement); } descriptionElement.addChild(serviceElement); } else { // There are no andpoints defined hence generate default bindings and endpoints descriptionElement.addChild( WSDLSerializationUtil.generateSOAP11Binding(omFactory, axisService, wsdl, wsoap, tns, serviceName)); if (!disableSOAP12) { descriptionElement.addChild( WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap, tns, serviceName)); } if (!disableREST) { descriptionElement.addChild( WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl, whttp, tns, serviceName)); } descriptionElement .addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns, axisService, disableREST, disableSOAP12, eprs, serviceName)); } ArrayList policies = new ArrayList(policiesInDescription.values()); addPoliciesToDescriptionElement(policies, descriptionElement); return descriptionElement; } /** * Generates the interface element for the service * * @param wsdl The WSDL namespace * @param tns The target namespace * @param wsdlx The WSDL extensions namespace * @param fac The active OMFactory * @param interfaceName The name of the interface * @return The generated interface element * @throws FactoryConfigurationError * @throws XMLStreamException */ private OMElement getInterfaceElement(OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx, OMNamespace wrpc, OMFactory fac, String interfaceName) throws URISyntaxException, AxisFault, XMLStreamException, FactoryConfigurationError { OMElement interfaceElement = fac.createOMElement(WSDL2Constants.INTERFACE_LOCAL_NAME, wsdl); interfaceElement.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, interfaceName)); addPolicyAsExtensibleElement(axisService, interfaceElement); Iterator iterator = axisService.getOperations(); ArrayList interfaceOperations = new ArrayList(); ArrayList interfaceFaults = new ArrayList(); int i = 0; while (iterator.hasNext()) { AxisOperation axisOperation = (AxisOperation) iterator.next(); if (axisOperation.isControlOperation()) { continue; } interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl, tns, wsdlx, wrpc)); i++; Iterator faultsIterator = axisOperation.getFaultMessages().iterator(); while (faultsIterator.hasNext()) { AxisMessage faultMessage = (AxisMessage) faultsIterator.next(); String name = faultMessage.getName(); if (!interfaceFaults.contains(name)) { OMElement faultElement = fac.createOMElement(WSDL2Constants.FAULT_LOCAL_NAME, wsdl); faultElement.addAttribute( fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, name)); faultElement.addAttribute(fac.createOMAttribute( WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil .getElementName(faultMessage, axisService.getNamespaceMap()))); interfaceFaults.add(name); interfaceElement.addChild(faultElement); } } } for (i = 0; i < interfaceOperations.size(); i++) { interfaceElement.addChild((OMNode) interfaceOperations.get(i)); } return interfaceElement; } /** * Generates the service element for the service * * @param wsdl the WSDL namespace * @param tns the target namespace * @param omFactory the active OMFactory * @param interfaceName the name of the interface * @return the generated service element */ private OMElement getServiceElement(OMNamespace wsdl, OMNamespace tns, OMFactory omFactory, String interfaceName) { OMElement serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl); serviceElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, serviceName)); serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns.getPrefix() + ":" + interfaceName)); return serviceElement; } /** * Generates the interface Operation element. As with the binding operations we dont need to * ask AxisMessage to serialize its message cause AxisMessage does not have specific properties * as bindings. * * @param axisOperation the operation to write * @param wsdl the WSDL namespace * @param tns the target namespace * @param wsdlx the WSDL extentions namespace (WSDL 2.0) * @return the generated <operation> element * @throws FactoryConfigurationError * @throws XMLStreamException */ public OMElement generateInterfaceOperationElement(AxisOperation axisOperation, OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx, OMNamespace wrpc) throws URISyntaxException, AxisFault, XMLStreamException, FactoryConfigurationError { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement axisOperationElement = omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl); WSDLSerializationUtil .addWSDLDocumentationElement(axisOperation, axisOperationElement, omFactory, wsdl); axisOperationElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, axisOperation .getName().getLocalPart())); addPolicyAsExtensibleElement(axisOperation, axisOperationElement); URI[] opStyle = (URI[]) axisOperation.getParameterValue(WSDL2Constants.OPERATION_STYLE); if (opStyle == null) { opStyle = checkStyle(axisOperation); Parameter opStyleParameter = new Parameter(); opStyleParameter.setName(WSDL2Constants.OPERATION_STYLE); opStyleParameter.setValue(opStyle); axisOperation.addParameter(opStyleParameter); } if (opStyle != null && opStyle.length > 0) { String style = opStyle[0].toString(); for (int i = 1; i < opStyle.length; i++) { URI uri = opStyle[i]; style = style + " " + uri; } axisOperationElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_STYLE, null, style)); if (style.indexOf(WSDL2Constants.STYLE_RPC) >= 0) { axisOperationElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_SIGNATURE, wrpc, (String) axisOperation.getParameterValue( WSDL2Constants.ATTR_WRPC_SIGNATURE))); } } axisOperationElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME_PATTERN, null, axisOperation.getMessageExchangePattern())); Parameter param = axisOperation.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE); if (param != null) { axisOperationElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_SAFE, wsdlx, (param.getValue()).toString())); } AxisService axisService = axisOperation.getAxisService(); Map nameSpaceMap = axisService.getNamespaceMap(); // Add the input element AxisMessage inMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_IN_MESSAGE); if (inMessage != null) { OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME, wsdl); inMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap))); WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, axisOperation.getInputAction(),wsaw); WSDLSerializationUtil.addWSDLDocumentationElement(inMessage, inMessageElement, omFactory, wsdl); axisOperationElement.addChild(inMessageElement); } // Add the output element AxisMessage outMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_OUT_MESSAGE); if (outMessage != null) { OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME, wsdl); outMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap))); WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, axisOperation.getOutputAction(),wsaw); WSDLSerializationUtil.addWSDLDocumentationElement(outMessage, outMessageElement, omFactory, wsdl); axisOperationElement.addChild(outMessageElement); } // Add the fault element ArrayList faults = axisOperation.getFaultMessages(); if (faults != null) { Iterator iterator = faults.iterator(); while (iterator.hasNext()) { AxisMessage faultMessage = (AxisMessage) iterator.next(); OMElement faultElement; if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(faultMessage.getDirection())) { faultElement = omFactory.createOMElement(WSDL2Constants.IN_FAULT_LOCAL_NAME, wsdl); } else { faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME, wsdl); } faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + faultMessage.getName())); WSDLSerializationUtil.addWSAWActionAttribute(faultElement, axisOperation.getFaultAction( faultMessage.getName()), wsaw); WSDLSerializationUtil .addWSDLDocumentationElement(faultMessage, faultElement, omFactory, wsdl); axisOperationElement.addChild(faultElement); } } return axisOperationElement; } public void setEPRs(String[] eprs) { this.eprs = eprs; } /** * This function checks the schema and returns the WSDL 2.0 styles that it conform to. * It checks for RPC, IRI and Multipart styles. * For full details on the rules please refer http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#styles * @param axisOperation - The axisOperation that needs to be checked * @return String [] - An array of styles that the operation adheres to. */ private URI [] checkStyle(AxisOperation axisOperation) throws URISyntaxException, AxisFault { boolean isRPC = true; boolean isMultipart = true; boolean isIRI = true; ArrayList styles = new ArrayList(3); String mep = axisOperation.getMessageExchangePattern(); if (!(WSDL2Constants.MEP_URI_IN_ONLY.equals(mep) || WSDL2Constants.MEP_URI_IN_OUT.equals(mep))) { isRPC = false; } QName inMessageElementQname; Map inMessageElementDetails = new LinkedHashMap(); AxisMessage inMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN); if (inMessage != null) { QName qName = inMessage.getElementQName(); if (qName == null || Constants.XSD_ANY.equals(qName)) { return new URI [0]; } XmlSchemaElement schemaElement = inMessage.getSchemaElement(); if (schemaElement != null) { if (!axisOperation.getName().getLocalPart().equals(schemaElement.getName())) { return new URI [0]; } inMessageElementQname = schemaElement.getQName(); XmlSchemaType type = schemaElement.getSchemaType(); if (type != null && type instanceof XmlSchemaComplexType){ XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; XmlSchemaParticle particle = complexType.getParticle(); if (particle != null && particle instanceof XmlSchemaSequence){ XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; XmlSchemaObjectCollection schemaObjectCollection = xmlSchemaSequence.getItems(); if (schemaObjectCollection != null) { Iterator iterator = schemaObjectCollection.getIterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (!(next instanceof XmlSchemaElement)) { return new URI [0]; } XmlSchemaElement innerElement = (XmlSchemaElement) next; if (innerElement.getRefName() != null) { return new URI [0]; } if (innerElement.getMinOccurs() != 1 || innerElement.getMaxOccurs() != 1) { isMultipart = false; } XmlSchemaType schemaType = innerElement.getSchemaType(); QName innerElementQName = innerElement.getSchemaTypeName(); if (schemaType instanceof XmlSchemaSimpleType) { if (Constants.XSD_QNAME.equals(innerElementQName) || Constants.XSD_NOTATION.equals(innerElementQName) || Constants.XSD_HEXBIN.equals(innerElementQName) || Constants.XSD_BASE64.equals(innerElementQName)) { isIRI = false; } } else { isIRI = false; } if (Constants.XSD_ANY.equals(innerElementQName) && iterator.hasNext()) { isRPC = false; } String name = innerElement.getName(); if (inMessageElementDetails.get(name) != null) { isRPC = false; isMultipart = false; } inMessageElementDetails.put(name, innerElementQName); } } } else { return new URI [0]; } } else { return new URI [0]; } } else { return new URI [0]; } } else { return new URI [0]; } AxisMessage outMessage = null; Map outMessageElementDetails = new LinkedHashMap(); if (isRPC && !WSDL2Constants.MEP_URI_IN_ONLY.equals(mep)) { outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT); QName qName = outMessage.getElementQName(); if (qName == null && Constants.XSD_ANY.equals(qName)) { isRPC = false; } XmlSchemaElement schemaElement = outMessage.getSchemaElement(); if (schemaElement != null) { if (!(axisOperation.getName().getLocalPart() + Java2WSDLConstants.RESPONSE) .equals(schemaElement.getName())) { isRPC = false; } if (!schemaElement.getQName().getNamespaceURI() .equals(inMessageElementQname.getNamespaceURI())) { isRPC = false; } XmlSchemaType type = schemaElement.getSchemaType(); if (type != null && type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; XmlSchemaParticle particle = complexType.getParticle(); if (particle != null && particle instanceof XmlSchemaSequence) { XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; XmlSchemaObjectCollection schemaObjectCollection = xmlSchemaSequence.getItems(); if (schemaObjectCollection != null) { Iterator iterator = schemaObjectCollection.getIterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (!(next instanceof XmlSchemaElement)) { isRPC = false; } XmlSchemaElement innerElement = (XmlSchemaElement) next; QName schemaTypeName = innerElement.getSchemaTypeName(); String name = innerElement.getName(); if (innerElement.getRefName() != null) { isRPC = false; } if (outMessageElementDetails.get(name) != null) { isRPC = false; } QName inMessageElementType = (QName) inMessageElementDetails.get(name); if (inMessageElementType != null && inMessageElementType != schemaTypeName) { isRPC = false; } outMessageElementDetails.put(name, schemaTypeName); } } } else { isRPC = false; } } else { isRPC = false; } } else { isRPC = false; } } int count = 0; if (isRPC) { styles.add(new URI(WSDL2Constants.STYLE_RPC)); axisOperation.addParameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, generateRPCSignature( inMessageElementDetails, outMessageElementDetails)); count ++; } if (isIRI) { styles.add(new URI(WSDL2Constants.STYLE_IRI)); count ++; } if (isMultipart) { styles.add(new URI(WSDL2Constants.STYLE_MULTIPART)); count ++; } return (URI[]) styles.toArray(new URI[count]); } private String generateRPCSignature(Map inMessageElementDetails, Map outMessageElementDetails) { String in = ""; String out = ""; String inOut = ""; Set inElementSet = inMessageElementDetails.keySet(); Set outElementSet = outMessageElementDetails.keySet(); Iterator inElementIterator = inElementSet.iterator(); while (inElementIterator.hasNext()) { String inElementName = (String) inElementIterator.next(); if (outElementSet.contains(inElementName)) { inOut = inOut + inElementName + " " + WSDL2Constants.RPC_INOUT + " "; outElementSet.remove(inElementName); } else { in = in + inElementName + " " + WSDL2Constants.RPC_IN + " "; } } Iterator outElementIterator = outElementSet.iterator(); while (outElementIterator.hasNext()) { String outElementName = (String) outElementIterator.next(); out = out + outElementName + " " + WSDL2Constants.RPC_RETURN + " "; } return in + out + inOut; } private void addPolicyAsExtensibleElement(AxisDescription axisDescription, OMElement descriptionElement) throws XMLStreamException, FactoryConfigurationError, AxisFault { PolicySubject policySubject = axisDescription.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents(); for (Iterator iterator = attachPolicyComponents.iterator(); iterator .hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { PolicyReference policyReference = PolicyUtil .createPolicyReference((Policy) policyElement); OMElement policyRefElement = PolicyUtil .getPolicyComponentAsOMElement( (PolicyComponent) policyReference, filter); OMNode firstChildElem = descriptionElement.getFirstElement(); if (firstChildElem == null) { descriptionElement.addChild(policyRefElement); } else { firstChildElem.insertSiblingBefore(policyRefElement); } String key = ((PolicyReference) policyReference).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } policiesInDescription.put(key, (Policy) policyElement); } else if (policyElement instanceof PolicyReference) { OMElement child = PolicyUtil .getPolicyComponentAsOMElement((PolicyComponent) policyElement); OMElement firstChildElem = descriptionElement.getFirstElement(); if (firstChildElem == null) { descriptionElement.addChild(child); } else { firstChildElem.insertSiblingBefore(child); } String key = ((PolicyReference) policyElement).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } PolicyLocator locator = new PolicyLocator(axisService); Policy p = locator.lookup(key); if (p == null) { throw new AxisFault("Policy not found for uri : " + key); } policiesInDescription.put(key, p); } } } private void addPoliciesToDescriptionElement(List policies, OMElement descriptionElement) throws XMLStreamException, FactoryConfigurationError { for (int i = 0; i < policies.size(); i++) { Policy policy = (Policy) policies.get(i); OMElement policyElement = PolicyUtil.getPolicyComponentAsOMElement( policy, filter); OMNode firstChild = descriptionElement.getFirstOMChild(); if (firstChild != null) { firstChild.insertSiblingBefore(policyElement); } else { descriptionElement.addChild(policyElement); } } } }./src/org/apache/axis2/description/AxisEndpoint.java0000664000175000017500000001503411767656530021630 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.server.HttpUtils; import org.apache.axis2.util.WSDLSerializationUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.net.SocketException; import java.util.HashMap; import java.util.Map; public class AxisEndpoint extends AxisDescription { private static final Log logger = LogFactory.getLog(AxisEndpoint.class); // The name of the endpoint private String name; // The binding reffered to by the endpoint private AxisBinding binding; // The address of the endpoint private String endpointURL; // The alias used for the endpoint private String alias; private Map options; private String transportInDescName; public String getEndpointURL() { if (endpointURL == null) { endpointURL = calculateEndpointURL(); } return endpointURL; } public void setEndpointURL(String endpointURL) { this.endpointURL = endpointURL; } public AxisEndpoint() { options = new HashMap(); } public void setProperty(String name, Object value) { options.put(name, value); } /** * @param name * name of the property to search for * @return the value of the property, or null if the property is not found */ public Object getProperty(String name) { Object obj = options.get(name); if (obj != null) { return obj; } return null; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getName() { return name; } public void setName(String name) { this.name = name; } public AxisBinding getBinding() { return binding; } public void setBinding(AxisBinding binding) { this.binding = binding; } public Object getKey() { // ToDO return null; // To change body of implemented methods use File | // Settings | File Templates. } public void engageModule(AxisModule axisModule) throws AxisFault { throw new UnsupportedOperationException("Sorry we do not support this"); } public boolean isEngaged(String moduleName) { throw new UnsupportedOperationException( "axisMessage.isEngaged() is not supported"); } public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace whttp) { String property; OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement endpointElement = omFactory.createOMElement( WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); endpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME, null, name)); endpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + getBinding().getName().getLocalPart())); endpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_ADDRESS, null, getEndpointURL())); Object authenticationScheme = this.options .get(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_TYPE); if (authenticationScheme != null) { endpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_AUTHENTICATION_TYPE, whttp, authenticationScheme.toString())); } property = (String) options .get(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_REALM); if (property != null) { endpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_AUTHENTICATION_REALM, whttp, property)); } WSDLSerializationUtil.addWSDLDocumentationElement(this, endpointElement, omFactory, wsdl); WSDLSerializationUtil.addPoliciesAsExtensibleElement(this, endpointElement); return endpointElement; } public AxisService getAxisService() { return (AxisService) parent; } public void setParent(AxisService service) { parent = service; } public void setTransportInDescription(String transportInDescName) { this.transportInDescName = transportInDescName; } public String getTransportInDescription() { return transportInDescName; } private String calculateEndpointURL() { if (transportInDescName != null && parent != null) { AxisConfiguration axisConfiguration = getAxisConfiguration(); if (axisConfiguration != null) { try { String serviceName = ((AxisService) parent).getName(); TransportInDescription in = axisConfiguration .getTransportIn(transportInDescName); TransportListener listener = in.getReceiver(); String ip = HttpUtils.getIpAddress(axisConfiguration); // we should pass [serviceName].[endpointName] instead of // [endpointName] String sDOTe = serviceName + "." + name; EndpointReference[] eprsForService = listener .getEPRsForService(sDOTe, ip); // we consider only the first address return by the listener if (eprsForService != null && eprsForService.length > 0) { return eprsForService[0].getAddress(); } } catch (SocketException e) { logger.warn(e.getMessage(), e); } catch (AxisFault e) { logger.warn(e.getMessage(), e); } } } return null; } public boolean isActive() { if (transportInDescName != null && parent != null) { AxisConfiguration axisConfiguration = getAxisConfiguration(); if (axisConfiguration != null) { AxisService service = (AxisService) parent; if (service.isEnableAllTransports()) { return axisConfiguration.getTransportsIn().containsKey( transportInDescName); } else { return service.getExposedTransports().contains( transportInDescName); } } } return false; } } ./src/org/apache/axis2/description/AxisService2WSDL11.java0000664000175000017500000013213511767656530022370 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.namespace.Constants; import org.apache.axis2.util.ExternalPolicySerializer; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.PolicyLocator; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.WSDLSerializationUtil; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyReference; import org.apache.neethi.PolicyRegistry; import org.apache.ws.commons.schema.XmlSchema; import javax.xml.namespace.QName; import java.io.StringReader; import java.io.StringWriter; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; public class AxisService2WSDL11 implements Java2WSDLConstants { private AxisService axisService; private String serviceName; private String[] serviceEndpointURLs; private String targetNamespace; private OMElement definition; private OMNamespace soap; private OMNamespace soap12; private OMNamespace http; private OMNamespace mime; private OMNamespace tns; private OMNamespace wsdl; private OMNamespace wsaw; private String style = DOCUMENT; private String use = LITERAL; private HashMap policiesInDefinitions; private ExternalPolicySerializer serializer; private HashMap messagesMap; public AxisService2WSDL11(AxisService service) throws Exception { this.axisService = service; this.serviceName = service.getName(); init(); } private void init() throws AxisFault { // the EPR list of AxisService contains REST EPRs as well. Those REST // EPRs will be used to generated HTTPBinding // and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 // bindings. Let's first initialize those set of // EPRs now to be used later, especially when we generate the WSDL. serviceEndpointURLs = axisService.getEPRs(); if (serviceEndpointURLs == null) { Map endpointMap = axisService.getEndpoints(); if (endpointMap.size() > 0) { Iterator endpointItr = endpointMap.values().iterator(); if (endpointItr.hasNext()) { AxisEndpoint endpoint = (AxisEndpoint) endpointItr.next(); serviceEndpointURLs = new String[] { endpoint .getEndpointURL() }; } } else { serviceEndpointURLs = new String[] { axisService .getEndpointName() }; } } this.targetNamespace = axisService.getTargetNamespace(); serializer = new ExternalPolicySerializer(); // CHECKME check whether service.getAxisConfiguration() return null ??? AxisConfiguration configuration = axisService.getAxisConfiguration(); if (configuration != null) { serializer.setAssertionsToFilter(configuration .getLocalPolicyAssertions()); } } public AxisService2WSDL11(AxisService service, String serviceName) throws Exception { this.axisService = service; this.serviceName = serviceName; init(); } public OMElement generateOM() throws Exception { OMFactory fac = OMAbstractFactory.getOMFactory(); wsdl = fac.createOMNamespace(WSDL_NAMESPACE, DEFAULT_WSDL_NAMESPACE_PREFIX); OMElement ele = fac.createOMElement("definitions", wsdl); setDefinitionElement(ele); policiesInDefinitions = new HashMap(); Map namespaceMap = axisService.getNamespaceMap(); if (namespaceMap == null) namespaceMap = new HashMap(); WSDLSerializationUtil.populateNamespaces(ele, namespaceMap); soap = ele.declareNamespace(URI_WSDL11_SOAP, SOAP11_PREFIX); soap12 = ele.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX); http = ele.declareNamespace(HTTP_NAMESPACE, HTTP_PREFIX); mime = ele.declareNamespace(MIME_NAMESPACE, MIME_PREFIX); wsaw = ele.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE, "wsaw"); String prefix = WSDLSerializationUtil.getPrefix(axisService .getTargetNamespace(), namespaceMap); if (prefix == null || "".equals(prefix)) { prefix = DEFAULT_TARGET_NAMESPACE_PREFIX; } namespaceMap.put(prefix, axisService.getTargetNamespace()); tns = ele.declareNamespace(axisService.getTargetNamespace(), prefix); // axis2.xml indicated no HTTP binding? boolean disableREST = false; Parameter disableRESTParameter = axisService .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST); if (disableRESTParameter != null && JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { disableREST = true; } // axis2.xml indicated no SOAP 1.2 binding? boolean disableSOAP12 = false; Parameter disableSOAP12Parameter = axisService .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP12); if (disableSOAP12Parameter != null && JavaUtils .isTrueExplicitly(disableSOAP12Parameter.getValue())) { disableSOAP12 = true; } // adding documentation element // <b>NEW!</b> This method accepts an ISBN // string and returns <b>Amazon.co.uk</b> Sales Rank for // that book. WSDLSerializationUtil.addWSDLDocumentationElement(axisService, ele, fac, wsdl); ele.addAttribute("targetNamespace", axisService.getTargetNamespace(), null); OMElement wsdlTypes = fac.createOMElement("types", wsdl); ele.addChild(wsdlTypes); // populate the schema mappings axisService.populateSchemaMappings(); ArrayList schemas = axisService.getSchema(); for (int i = 0; i < schemas.size(); i++) { StringWriter writer = new StringWriter(); // XmlSchema schema = (XmlSchema) schemas.get(i); XmlSchema schema = axisService.getSchema(i); String targetNamespace = schema.getTargetNamespace(); if (!Constants.NS_URI_XML.equals(targetNamespace)) { schema.write(writer); String schemaString = writer.toString(); if (!"".equals(schemaString)) { wsdlTypes.addChild(XMLUtils.toOM(new StringReader( schemaString))); } } } generateMessages(fac, ele); generatePortType(fac, ele); // generateSOAP11Binding(fac, ele); // if (!disableSOAP12) { // generateSOAP12Binding(fac, ele); // } // if (!disableREST) { // generateHTTPBinding(fac, ele); // } generateService(fac, ele, disableREST, disableSOAP12); addPoliciesToDefinitionElement(policiesInDefinitions.values() .iterator(), definition); return ele; } private void generateMessages(OMFactory fac, OMElement defintions) { HashSet faultMessageNames = new HashSet(); messagesMap = new HashMap(); Iterator operations = axisService.getOperations(); while (operations.hasNext()) { AxisOperation axisOperation = (AxisOperation) operations.next(); if (axisOperation.isControlOperation()) { continue; } String MEP = axisOperation.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage inaxisMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (inaxisMessage != null) { writeMessage(inaxisMessage, fac, defintions); generateHeaderMessages(inaxisMessage, fac, defintions); } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage outAxisMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outAxisMessage != null) { writeMessage(outAxisMessage, fac, defintions); generateHeaderMessages(outAxisMessage, fac, defintions); } } // generate fault Messages ArrayList faultyMessages = axisOperation.getFaultMessages(); if (faultyMessages != null) { for (int i = 0; i < faultyMessages.size(); i++) { AxisMessage axisMessage = (AxisMessage) faultyMessages .get(i); String name = axisMessage.getName(); if (faultMessageNames.add(name)) { writeMessage(axisMessage, fac, defintions); generateHeaderMessages(axisMessage, fac, defintions); } } } } } private void generateHeaderMessages(AxisMessage axismessage, OMFactory fac, OMElement defintions) { ArrayList extList = axismessage.getSoapHeaders(); for (int i = 0; i < extList.size(); i++) { SOAPHeaderMessage header = (SOAPHeaderMessage) extList.get(i); OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl); messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage() .getLocalPart(), null); defintions.addChild(messageElement); OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl); messageElement.addChild(messagePart); messagePart.addAttribute(ATTRIBUTE_NAME, header.part(), null); if (header.getElement() == null) { throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME + " is null for " + header.getMessage()); } messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, WSDLSerializationUtil.getPrefix(header.getElement() .getNamespaceURI(), axisService.getNamespaceMap()) + ":" + header.getElement().getLocalPart(), null); } } private void writeMessage(AxisMessage axismessage, OMFactory fac, OMElement defintions) { if (messagesMap.get(axismessage.getName()) == null) { messagesMap.put(axismessage.getName(), axismessage); QName schemaElementName = axismessage.getElementQName(); OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl); messageElement.addAttribute(ATTRIBUTE_NAME, axismessage.getName(), null); defintions.addChild(messageElement); if (schemaElementName != null) { OMElement messagePart = fac.createOMElement( PART_ATTRIBUTE_NAME, wsdl); messageElement.addChild(messagePart); if (axismessage.getMessagePartName() != null) { messagePart.addAttribute(ATTRIBUTE_NAME, axismessage .getMessagePartName(), null); } else { messagePart.addAttribute(ATTRIBUTE_NAME, axismessage .getPartName(), null); } messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, WSDLSerializationUtil.getPrefix(schemaElementName .getNamespaceURI(), axisService .getNamespaceMap()) + ":" + schemaElementName.getLocalPart(), null); } } } /** * Builds the <portType> element in the passed WSDL definition. When * this returns successfully, there will be a new child element under * definitons for the portType. * * @param fac * the active OMFactory * @param defintions * the WSDL <definitions> element * @throws Exception * if there's a problem */ private void generatePortType(OMFactory fac, OMElement defintions) throws Exception { OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl); defintions.addChild(portType); portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX, null); addPolicyAsExtAttribute(axisService, portType, fac); for (Iterator operations = axisService.getOperations(); operations .hasNext();) { AxisOperation axisOperation = (AxisOperation) operations.next(); if (axisOperation.isControlOperation() || axisOperation.getName() == null) { continue; } String operationName = axisOperation.getName().getLocalPart(); OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl); WSDLSerializationUtil.addWSDLDocumentationElement(axisOperation, operation, fac, wsdl); portType.addChild(operation); operation.addAttribute(ATTRIBUTE_NAME, operationName, null); //addPolicyAsExtElement(axisOperation, operation); addPolicyAsExtAttribute(axisOperation, operation, fac); String MEP = axisOperation.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage inaxisMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (inaxisMessage != null) { OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl); WSDLSerializationUtil.addWSDLDocumentationElement( inaxisMessage, input, fac, wsdl); input.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":" + inaxisMessage.getName(), null); //addPolicyAsExtElement(inaxisMessage, input); addPolicyAsExtAttribute(inaxisMessage, input, fac); WSDLSerializationUtil.addWSAWActionAttribute(input, axisOperation.getInputAction(), wsaw); operation.addChild(input); } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage outAxisMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outAxisMessage != null) { OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl); WSDLSerializationUtil.addWSDLDocumentationElement( outAxisMessage, output, fac, wsdl); output.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":" + outAxisMessage.getName(), null); //addPolicyAsExtElement(outAxisMessage, output); addPolicyAsExtAttribute(outAxisMessage, output, fac); WSDLSerializationUtil.addWSAWActionAttribute(output, axisOperation.getOutputAction(), wsaw); operation.addChild(output); } } // generate fault Messages ArrayList faultMessages = axisOperation.getFaultMessages(); if (faultMessages != null) { for (int i = 0; i < faultMessages.size(); i++) { AxisMessage faultyMessage = (AxisMessage) faultMessages .get(i); OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl); WSDLSerializationUtil.addWSDLDocumentationElement( faultyMessage, fault, fac, wsdl); fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":" + faultyMessage.getName(), null); fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(), null); WSDLSerializationUtil.addWSAWActionAttribute(fault, axisOperation.getFaultAction(faultyMessage .getName()), wsaw); // TODO add policies for fault messages operation.addChild(fault); } } } } /** * Generate the WSDL <service> element * * @param fac * the active OMFactory * @param defintions * the WSDL <definitions> element under which to put the * service * @param disableREST * if false, generate REST binding, if true, don't * @param disableSOAP12 * if false, generate SOAP 1.2 binding, if true, don't * @throws Exception * if there's a problem */ public void generateService(OMFactory fac, OMElement defintions, boolean disableREST, boolean disableSOAP12) throws Exception { OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl); defintions.addChild(service); service.addAttribute(ATTRIBUTE_NAME, serviceName, null); generateSoap11Port(fac, defintions, service); if (!disableSOAP12) { // generateSOAP12Ports(fac, service); generateSoap12Port(fac, defintions, service); } addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService .getPolicyInclude(), service); // addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService. // getPolicyInclude(), service); if (!disableREST) { // generateHTTPPorts(fac, service); generateHttpPort(fac, definition, service); } } private void writeSoapHeaders(AxisMessage inaxisMessage, OMFactory fac, OMElement input, OMNamespace soapNameSpace) throws Exception { ArrayList extElementList; extElementList = inaxisMessage.getSoapHeaders(); if (extElementList != null) { Iterator elements = extElementList.iterator(); while (elements.hasNext()) { SOAPHeaderMessage soapheader = (SOAPHeaderMessage) elements .next(); addSOAPHeader(fac, input, soapheader, soapNameSpace); } } } private void addExtensionElement(OMFactory fac, OMElement element, String name, String att1Name, String att1Value, String att2Name, String att2Value, OMNamespace soapNameSpace) { OMElement soapbinding = fac.createOMElement(name, soapNameSpace); element.addChild(soapbinding); soapbinding.addAttribute(att1Name, att1Value, null); if (att2Name != null) { soapbinding.addAttribute(att2Name, att2Value, null); } } private void setDefinitionElement(OMElement defintion) { this.definition = defintion; } private void addSOAPHeader(OMFactory fac, OMElement element, SOAPHeaderMessage header, OMNamespace soapNameSpace) { OMElement extElement = fac.createOMElement("header", soapNameSpace); element.addChild(extElement); String use = header.getUse(); if (use != null) { extElement.addAttribute("use", use, null); } if (header.part() != null) { extElement.addAttribute("part", header.part(), null); } if (header.getMessage() != null) { extElement.addAttribute("message", WSDLSerializationUtil.getPrefix( targetNamespace, axisService.getNamespaceMap()) + ":" + header.getMessage().getLocalPart(), null); } } private void addPolicyAsExtElement(int type, PolicyInclude policyInclude, OMElement parentElement) throws Exception { ArrayList elementList = policyInclude.getPolicyElements(type); for (Iterator iterator = elementList.iterator(); iterator.hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { OMElement child = PolicyUtil.getPolicyComponentAsOMElement( (PolicyComponent) policyElement, serializer); OMNode firstChildElem = parentElement.getFirstElement(); // if (firstChildElem == null) { // parentElement.addChild(child); // } else { // firstChildElem.insertSiblingBefore(child); // } // there is a problem with the OM insertSiblingBefore element // with // drops the already exists elements. // since there is no any techical problem of adding policy // elements after other // children temporaliy fix this as it is. // one OM fix this issue we can revert this change. parentElement.addChild(child); } else if (policyElement instanceof PolicyReference) { OMElement child = PolicyUtil .getPolicyComponentAsOMElement((PolicyComponent) policyElement); OMElement firstChildElem = parentElement.getFirstElement(); if (firstChildElem == null) { parentElement.addChild(child); } else { firstChildElem.insertSiblingBefore(child); } PolicyRegistry reg = policyInclude.getPolicyRegistry(); String key = ((PolicyReference) policyElement).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } Policy p = reg.lookup(key); if (p == null) { throw new Exception("Policy not found for uri : " + key); } addPolicyToDefinitionElement(key, p); } } } private void addPoliciesToDefinitionElement(Iterator iterator, OMElement definitionElement) throws Exception { Policy policy; OMElement policyElement; OMNode firstChild; ArrayList keys = new ArrayList(); for (; iterator.hasNext();) { policy = (Policy) iterator.next(); String key = policy.getId(); if (keys.contains(key)) { continue; } keys.add(key); policyElement = PolicyUtil.getPolicyComponentAsOMElement(policy, serializer); firstChild = definition.getFirstOMChild(); if (firstChild != null) { firstChild.insertSiblingBefore(policyElement); } else { definitionElement.addChild(policyElement); } } } private void addPolicyToDefinitionElement(String key, Policy policy) { policiesInDefinitions.put(key, policy); } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getUse() { return use; } public void setUse(String use) { this.use = use; } private void generateSoap11Port(OMFactory fac, OMElement definition, OMElement service) throws Exception { Iterator iterator = axisService.getEndpoints().values().iterator(); AxisEndpoint axisEndpoint = null; AxisBinding axisBinding = null; for (; iterator.hasNext();) { axisEndpoint = (AxisEndpoint) iterator.next(); /* * Some transports might not be active at runtime. */ if (!axisEndpoint.isActive()) { continue; } axisBinding = axisEndpoint.getBinding(); String type = axisBinding.getType(); if (Java2WSDLConstants.TRANSPORT_URI.equals(type) || WSDL2Constants.URI_WSDL2_SOAP.equals(type)) { String version = (String) axisBinding .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(version)) { OMElement port = fac.createOMElement(PORT, wsdl); service.addChild(port); port.addAttribute(ATTRIBUTE_NAME, axisEndpoint.getName(), null); QName qname = axisBinding.getName(); port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":" + qname.getLocalPart(), null); String endpointURL = axisEndpoint.getEndpointURL(); WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, (endpointURL == null) ? "" : endpointURL, soap); addPolicyAsExtElement(axisEndpoint, port); generateSoap11Binding(fac, definition, axisEndpoint .getBinding()); } } } } private void generateSoap12Port(OMFactory fac, OMElement definition, OMElement service) throws Exception { // /////////////////// FIXME ////////////////////////////////////////// Iterator iterator = axisService.getEndpoints().values().iterator(); AxisEndpoint axisEndpoint = null; AxisBinding axisBinding = null; for (; iterator.hasNext();) { axisEndpoint = (AxisEndpoint) iterator.next(); /* * */ if (!axisEndpoint.isActive()) { continue; } axisBinding = axisEndpoint.getBinding(); String type = axisBinding.getType(); if (Java2WSDLConstants.TRANSPORT_URI.equals(type) || WSDL2Constants.URI_WSDL2_SOAP.equals(type)) { String version = (String) axisBinding .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(version)) { OMElement port = fac.createOMElement(PORT, wsdl); service.addChild(port); port.addAttribute(ATTRIBUTE_NAME, axisEndpoint.getName(), null); QName qname = axisBinding.getName(); port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":" + qname.getLocalPart(), null); String endpointURL = axisEndpoint.getEndpointURL(); WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, (endpointURL == null) ? "" : endpointURL, soap12); addPolicyAsExtElement(axisEndpoint, port); generateSoap12Binding(fac, definition, axisEndpoint .getBinding()); } } } } private void generateHttpPort(OMFactory fac, OMElement definition, OMElement service) throws Exception { // /////////////////// FIXME ////////////////////////////////////////// Iterator iterator = axisService.getEndpoints().values().iterator(); AxisEndpoint axisEndpoint = null; AxisBinding axisBinding = null; for (; iterator.hasNext();) { axisEndpoint = (AxisEndpoint) iterator.next(); /* * */ if (!axisEndpoint.isActive()) { continue; } axisBinding = axisEndpoint.getBinding(); String type = axisBinding.getType(); if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { OMElement port = fac.createOMElement(PORT, wsdl); service.addChild(port); port.addAttribute(ATTRIBUTE_NAME, axisEndpoint.getName(), null); QName qname = axisBinding.getName(); port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":" + qname.getLocalPart(), null); OMElement extElement = fac.createOMElement("address", http); String endpointURL = axisEndpoint.getEndpointURL(); extElement.addAttribute("location", (endpointURL == null) ? "" : endpointURL, null); port.addChild(extElement); addPolicyAsExtElement(axisEndpoint, port); generateHttpBinding(fac, definition, axisEndpoint.getBinding()); } } } private void generateSoap11Binding(OMFactory fac, OMElement defintions, AxisBinding axisBinding) throws Exception { if (isAlreadyAdded(axisBinding, defintions)) { return; } OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl); OMElement serviceElement = defintions.getFirstChildWithName(new QName( wsdl.getNamespaceURI(), SERVICE_LOCAL_NAME)); serviceElement.insertSiblingBefore(binding); QName qname = axisBinding.getName(); binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null); binding.addAttribute("type", tns.getPrefix() + ":" + serviceName + PORT_TYPE_SUFFIX, null); // Adding ext elements addPolicyAsExtElement(axisBinding, binding); addExtensionElement(fac, binding, BINDING_LOCAL_NAME, TRANSPORT, TRANSPORT_URI, STYLE, style, soap); // ///////////////////////////////////////////////////////////////////// // Add WS-Addressing UsingAddressing element if appropriate // SHOULD be on the binding element per the specification if (AddressingHelper .getAddressingRequirementParemeterValue(axisService).equals( AddressingConstants.ADDRESSING_OPTIONAL)) { WSDLSerializationUtil.addExtensionElement(fac, binding, AddressingConstants.USING_ADDRESSING, DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true", wsaw); } else if (AddressingHelper.getAddressingRequirementParemeterValue( axisService).equals(AddressingConstants.ADDRESSING_REQUIRED)) { WSDLSerializationUtil.addExtensionElement(fac, binding, AddressingConstants.USING_ADDRESSING, DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true", wsaw); } // ////////////////////////////////////////////////////////////////////// for (Iterator axisBindingOperations = axisBinding.getChildren(); axisBindingOperations .hasNext();) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBindingOperations .next(); AxisOperation axisOperation = axisBindingOperation .getAxisOperation(); if (axisOperation.isControlOperation() || axisOperation.getName() == null) { continue; } String opeartionName = axisOperation.getName().getLocalPart(); OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl); binding.addChild(operation); String soapAction = axisOperation.getSoapAction(); if (soapAction == null) { soapAction = ""; } addPolicyAsExtElement(axisBindingOperation, operation); addExtensionElement(fac, operation, OPERATION_LOCAL_NAME, SOAP_ACTION, soapAction, STYLE, style, soap); // addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY, // axisOperation.getPolicyInclude(), operation); String MEP = axisOperation.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingInMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (axisBindingInMessage != null) { AxisMessage inaxisMessage = axisBindingInMessage .getAxisMessage(); if (inaxisMessage != null) { operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null); OMElement input = fac.createOMElement( IN_PUT_LOCAL_NAME, wsdl); addPolicyAsExtElement(axisBindingInMessage, input); addExtensionElement(fac, input, SOAP_BODY, SOAP_USE, use, null, targetNamespace, soap); // addPolicyAsExtElement(PolicyInclude.BINDING_INPUT_POLICY, // inaxisMessage.getPolicyInclude(), input); operation.addChild(input); writeSoapHeaders(inaxisMessage, fac, input, soap12); } } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingOutMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (axisBindingOutMessage != null) { AxisMessage outAxisMessage = axisBindingOutMessage .getAxisMessage(); if (outAxisMessage != null) { OMElement output = fac.createOMElement( OUT_PUT_LOCAL_NAME, wsdl); addPolicyAsExtElement(axisBindingOutMessage, output); addExtensionElement(fac, output, SOAP_BODY, SOAP_USE, use, null, targetNamespace, soap); // addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY, // outAxisMessage.getPolicyInclude(), output); operation.addChild(output); writeSoapHeaders(outAxisMessage, fac, output, soap12); } } } // generate fault Messages ArrayList faultyMessages = axisBindingOperation.getFaults(); if (faultyMessages != null) { for (int i = 0; i < faultyMessages.size(); i++) { AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage) faultyMessages .get(i); if (bindingFaultyMessage != null) { AxisMessage faultyMessage = bindingFaultyMessage .getAxisMessage(); OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl); addPolicyAsExtElement(bindingFaultyMessage, fault); addExtensionElement(fac, fault, FAULT_LOCAL_NAME, SOAP_USE, use, ATTRIBUTE_NAME, faultyMessage .getName(), soap); fault.addAttribute(ATTRIBUTE_NAME, faultyMessage .getName(), null); // add policies for fault messages operation.addChild(fault); writeSoapHeaders(faultyMessage, fac, fault, soap); } } } } } private void generateSoap12Binding(OMFactory fac, OMElement definitions, AxisBinding axisBinding) throws Exception { if (isAlreadyAdded(axisBinding, definitions)) { return; } OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl); OMElement serviceElement = definitions.getFirstChildWithName(new QName( wsdl.getNamespaceURI(), SERVICE_LOCAL_NAME)); serviceElement.insertSiblingBefore(binding); QName qname = axisBinding.getName(); binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null); binding.addAttribute("type", tns.getPrefix() + ":" + serviceName + PORT_TYPE_SUFFIX, null); // Adding ext elements addPolicyAsExtElement(axisBinding, binding); addExtensionElement(fac, binding, BINDING_LOCAL_NAME, TRANSPORT, TRANSPORT_URI, STYLE, style, soap12); // ///////////////////////////////////////////////////////////////////// // Add WS-Addressing UsingAddressing element if appropriate // SHOULD be on the binding element per the specification if (AddressingHelper .getAddressingRequirementParemeterValue(axisService).equals( AddressingConstants.ADDRESSING_OPTIONAL)) { WSDLSerializationUtil.addExtensionElement(fac, binding, AddressingConstants.USING_ADDRESSING, DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true", wsaw); } else if (AddressingHelper.getAddressingRequirementParemeterValue( axisService).equals(AddressingConstants.ADDRESSING_REQUIRED)) { WSDLSerializationUtil.addExtensionElement(fac, binding, AddressingConstants.USING_ADDRESSING, DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true", wsaw); } // ////////////////////////////////////////////////////////////////////// for (Iterator axisBindingOperations = axisBinding.getChildren(); axisBindingOperations .hasNext();) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBindingOperations .next(); AxisOperation axisOperation = axisBindingOperation .getAxisOperation(); if (axisOperation.isControlOperation() || axisOperation.getName() == null) { continue; } String opeartionName = axisOperation.getName().getLocalPart(); OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl); binding.addChild(operation); String soapAction = axisOperation.getSoapAction(); if (soapAction == null) { soapAction = ""; } addPolicyAsExtElement(axisBindingOperation, operation); addExtensionElement(fac, operation, OPERATION_LOCAL_NAME, SOAP_ACTION, soapAction, STYLE, style, soap12); // addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY, // axisOperation.getPolicyInclude(), operation); String MEP = axisOperation.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingInMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (axisBindingInMessage != null) { AxisMessage inaxisMessage = axisBindingInMessage .getAxisMessage(); if (inaxisMessage != null) { operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null); OMElement input = fac.createOMElement( IN_PUT_LOCAL_NAME, wsdl); addPolicyAsExtElement(axisBindingInMessage, input); addExtensionElement(fac, input, SOAP_BODY, SOAP_USE, use, null, targetNamespace, soap12); operation.addChild(input); writeSoapHeaders(inaxisMessage, fac, input, soap12); } } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingOutMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (axisBindingOutMessage != null) { AxisMessage outAxisMessage = axisBindingOutMessage .getAxisMessage(); if (outAxisMessage != null) { OMElement output = fac.createOMElement( OUT_PUT_LOCAL_NAME, wsdl); addPolicyAsExtElement(axisBindingOutMessage, output); addExtensionElement(fac, output, SOAP_BODY, SOAP_USE, use, null, targetNamespace, soap12); // addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY, // outAxisMessage.getPolicyInclude(), output); operation.addChild(output); writeSoapHeaders(outAxisMessage, fac, output, soap12); } } } // generate fault Messages ArrayList faultyMessages = axisBindingOperation.getFaults(); if (faultyMessages != null) { for (int i = 0; i < faultyMessages.size(); i++) { AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage) faultyMessages .get(i); if (bindingFaultyMessage != null) { AxisMessage faultyMessage = bindingFaultyMessage .getAxisMessage(); OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl); addPolicyAsExtElement(bindingFaultyMessage, fault); addExtensionElement(fac, fault, FAULT_LOCAL_NAME, SOAP_USE, use, ATTRIBUTE_NAME, faultyMessage .getName(), soap12); fault.addAttribute(ATTRIBUTE_NAME, faultyMessage .getName(), null); // add policies for fault messages operation.addChild(fault); writeSoapHeaders(faultyMessage, fac, fault, soap12); } } } } } private void generateHttpBinding(OMFactory fac, OMElement definitions, AxisBinding axisBinding) throws Exception { if (isAlreadyAdded(axisBinding, definitions)) { return; } OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl); OMElement serviceElement = definitions.getFirstChildWithName(new QName( wsdl.getNamespaceURI(), SERVICE_LOCAL_NAME)); serviceElement.insertSiblingBefore(binding); QName qname = axisBinding.getName(); binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null); binding.addAttribute("type", tns.getPrefix() + ":" + serviceName + PORT_TYPE_SUFFIX, null); OMElement httpBinding = fac.createOMElement("binding", http); binding.addChild(httpBinding); httpBinding.addAttribute("verb", "POST", null); for (Iterator axisBindingOperations = axisBinding.getChildren(); axisBindingOperations .hasNext();) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBindingOperations .next(); AxisOperation axisOperation = axisBindingOperation .getAxisOperation(); if (axisOperation.isControlOperation() || axisOperation.getName() == null) { continue; } String opeartionName = axisOperation.getName().getLocalPart(); OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl); binding.addChild(operation); OMElement httpOperation = fac.createOMElement("operation", http); operation.addChild(httpOperation); httpOperation.addAttribute("location", serviceName + "/" + axisOperation.getName().getLocalPart(), null); String MEP = axisOperation.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingInMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (axisBindingInMessage != null) { AxisMessage inaxisMessage = axisBindingInMessage .getAxisMessage(); if (inaxisMessage != null) { operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null); OMElement input = fac.createOMElement( IN_PUT_LOCAL_NAME, wsdl); OMElement inputelement = fac.createOMElement("content", mime); input.addChild(inputelement); inputelement.addAttribute("type", "text/xml", null); inputelement.addAttribute("part", axisOperation .getName().getLocalPart(), null); operation.addChild(input); } } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisBindingMessage axisBindingOutMessage = (AxisBindingMessage) axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (axisBindingOutMessage != null) { AxisMessage outAxisMessage = axisBindingOutMessage .getAxisMessage(); if (outAxisMessage != null) { OMElement output = fac.createOMElement( OUT_PUT_LOCAL_NAME, wsdl); OMElement outElement = fac.createOMElement("content", mime); outElement.addChild(outElement); outElement.addAttribute("type", "text/xml", null); outElement.addAttribute("part", axisOperation.getName() .getLocalPart(), null); output.addChild(outElement); operation.addChild(output); } } } } } private void addPolicyAsExtElement(AxisDescription axisDescription, OMElement wsdlElement) throws Exception { PolicySubject policySubject = axisDescription.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents(); for (Iterator iterator = attachPolicyComponents.iterator(); iterator .hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { PolicyReference policyReference = PolicyUtil .createPolicyReference((Policy) policyElement); OMElement policyRefElement = PolicyUtil .getPolicyComponentAsOMElement( (PolicyComponent) policyReference, serializer); OMNode firstChildElem = wsdlElement.getFirstElement(); if (firstChildElem == null) { wsdlElement.addChild(policyRefElement); } else { firstChildElem.insertSiblingBefore(policyRefElement); } String key = ((PolicyReference) policyReference).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } addPolicyToDefinitionElement(key, (Policy) policyElement); } else if (policyElement instanceof PolicyReference) { OMElement child = PolicyUtil.getPolicyComponentAsOMElement( (PolicyComponent) policyElement, serializer); OMElement firstChildElem = wsdlElement.getFirstElement(); if (firstChildElem == null) { wsdlElement.addChild(child); } else { firstChildElem.insertSiblingBefore(child); } String key = ((PolicyReference) policyElement).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } PolicyLocator locator = new PolicyLocator(axisService); Policy p = locator.lookup(key); if (p == null) { throw new Exception("Policy not found for uri : " + key); } addPolicyToDefinitionElement(key, p); } } } private void addPolicyAsExtAttribute(AxisDescription axisDescription, OMElement element, OMFactory factory) throws Exception { PolicySubject policySubject = axisDescription.getPolicySubject(); ArrayList policyURIs = new ArrayList(); for (Iterator iterator = policySubject.getAttachedPolicyComponents() .iterator(); iterator.hasNext();) { Object policyElement = iterator.next(); String key; if (policyElement instanceof Policy) { Policy p = (Policy) policyElement; if (p.getId() != null) { key = "#" + p.getId(); } else if (p.getName() != null) { key = p.getName(); } else { throw new RuntimeException( "Can't add the Policy as an extensibility attribute since it doesn't have a id or a name attribute"); } policyURIs.add(key); addPolicyToDefinitionElement(key, p); } else { String uri = ((PolicyReference) policyElement).getURI(); PolicyLocator locator = new PolicyLocator(axisService); if (uri.startsWith("#")) { key = uri.substring(uri.indexOf('#') + 1); } else { key = uri; } Policy p = locator.lookup(key); if (p == null) { throw new RuntimeException("Cannot resolve " + uri + " to a Policy"); } addPolicyToDefinitionElement(key, p); } } if (!policyURIs.isEmpty()) { String value = null; /* * We need to create a String that is like 'uri1 uri2 .." to set as * the value of the wsp:PolicyURIs attribute. */ for (Iterator iterator = policyURIs.iterator(); iterator.hasNext();) { String uri = (String) iterator.next(); value = (value == null) ? uri : value + " " + uri; } OMNamespace ns = factory.createOMNamespace( org.apache.neethi.Constants.URI_POLICY_NS, org.apache.neethi.Constants.ATTR_WSP); OMAttribute URIs = factory.createOMAttribute("PolicyURIs", ns, value); element.addAttribute(URIs); } } private boolean isAlreadyAdded(AxisBinding axisBinding, OMElement definitionElement) { QName bindingName = axisBinding.getName(); QName name = new QName("name"); for (Iterator iterator = definitionElement .getChildrenWithName(new QName(wsdl.getNamespaceURI(), BINDING_LOCAL_NAME)); iterator.hasNext();) { OMElement element = (OMElement) iterator.next(); String value = element.getAttributeValue(name); if (bindingName.getLocalPart().equals(value)) { return true; } } return false; } } ./src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java0000664000175000017500000000721711767656530024545 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.transport.TransportUtils; import org.apache.axis2.util.Utils; import javax.xml.namespace.QName; import java.io.InputStream; public class RobustOutOnlyAxisOperation extends OutInAxisOperation { public RobustOutOnlyAxisOperation() { super(); //setup a temporary name QName tmpName = new QName(this.getClass().getName() + "_" + UUIDGenerator.getUUID()); this.setName(tmpName); setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY); } public RobustOutOnlyAxisOperation(QName name) { super(name); setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY); } public OperationClient createClient(ServiceContext sc, Options options) { return new RobustOutOnlyOperationClient(this, sc, options); } class RobustOutOnlyOperationClient extends OutInAxisOperationClient { public RobustOutOnlyOperationClient(OutInAxisOperation axisOp, ServiceContext sc, Options options) { super(axisOp, sc, options); } protected void timeOut() throws AxisFault { //Nothing to worry } /** * If there is a fault then need to handle that * @param responseMessageContext responseMessageContext * @throws AxisFault */ protected void handleResponse(MessageContext responseMessageContext) throws AxisFault { SOAPEnvelope envelope = responseMessageContext.getEnvelope(); if (envelope == null) { // If request is REST we assume the responseMessageContext is REST, so // set the variable InputStream inStream = (InputStream) responseMessageContext. getProperty(MessageContext.TRANSPORT_IN); if (inStream != null) { envelope = TransportUtils.createSOAPMessage( responseMessageContext); responseMessageContext.setEnvelope(envelope); } responseMessageContext.setEnvelope(envelope); } if (envelope != null) { if (envelope.hasFault()|| responseMessageContext.isProcessingFault()) { //receiving a fault AxisEngine.receive(responseMessageContext); throw Utils.getInboundFaultFromMessageContext(responseMessageContext); } } } } } ./src/org/apache/axis2/description/ModuleConfiguration.java0000664000175000017500000000612011767656530023174 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.i18n.Messages; import java.util.ArrayList; /** * This is to store deployment time data , described by * * .... * *

        * Right now this just keeps stores the set of parameters */ public class ModuleConfiguration implements ParameterInclude { private String moduleName; private ParameterInclude parameterInclude; // to keep the pointer to its parent , only to access parameters private ParameterInclude parent; public ModuleConfiguration(String moduleName, ParameterInclude parent) { this.moduleName = moduleName; this.parent = parent; parameterInclude = new ParameterIncludeImpl(); } public void addParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameterInclude.addParameter(param); } } public void removeParameter(Parameter param) throws AxisFault { if (isParameterLocked(param.getName())) { throw new AxisFault(Messages.getMessage("paramterlockedbyparent", param.getName())); } else { parameterInclude.removeParameter(param); } } public void deserializeParameters(OMElement parameterElement) throws AxisFault { this.parameterInclude.deserializeParameters(parameterElement); } public String getModuleName() { return moduleName; } public Parameter getParameter(String name) { return parameterInclude.getParameter(name); } public ArrayList getParameters() { return parameterInclude.getParameters(); } public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean loscked = false; if (parent != null) { loscked = parent.isParameterLocked(parameterName); } if (loscked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } } } ./src/org/apache/axis2/description/java2wsdl/0000775000175000017500000000000011767656530020252 5ustar brianbrian./src/org/apache/axis2/description/java2wsdl/DefaultNamespaceGenerator.java0000664000175000017500000000567011767656530026175 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; /** * This class provides the default implementatoin for mapping java classes to namespaces * */ public class DefaultNamespaceGenerator implements NamespaceGenerator { public static final String HTTP = "http://"; public static final char PACKAGE_CLASS_DELIMITER = '.'; public static final String SCHEMA_NAMESPACE_EXTN = "/xsd"; /* (non-Javadoc) * @see org.apache.axis2.description.java2wsdl.NamespaceGenerator#namespaceFromPackageName(java.lang.String) */ public StringBuffer namespaceFromPackageName(String packageName) { StringBuffer strBuf = new StringBuffer(); int prevIndex = packageName.length(); int currentIndex = packageName.lastIndexOf(PACKAGE_CLASS_DELIMITER); if (currentIndex > 0) { strBuf.append(HTTP); } else if (prevIndex > 0) { strBuf.append(HTTP); strBuf.append(packageName); return strBuf; } else if (currentIndex == -1) { // strBuf.append(HTTP); // strBuf.append(packageName); return strBuf; } while (currentIndex != -1) { strBuf.append(packageName.substring(currentIndex + 1, prevIndex)); prevIndex = currentIndex; currentIndex = packageName.lastIndexOf(PACKAGE_CLASS_DELIMITER, prevIndex - 1); strBuf.append(PACKAGE_CLASS_DELIMITER); if (currentIndex == -1) { strBuf.append(packageName.substring(0, prevIndex)); } } return strBuf; } /* (non-Javadoc) * @see org.apache.axis2.description.java2wsdl.NamespaceGenerator#schemaNamespaceFromPackageName(java.lang.String) */ public StringBuffer schemaNamespaceFromPackageName(String packageName) { if (packageName.length() > 0) { return namespaceFromPackageName(packageName).append(SCHEMA_NAMESPACE_EXTN); } else { StringBuffer buffer = new StringBuffer(); buffer.append(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE); buffer.append(SCHEMA_NAMESPACE_EXTN); return buffer; } } } ./src/org/apache/axis2/description/java2wsdl/TypeTable.java0000664000175000017500000002106211767656530023007 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; import org.apache.axiom.om.OMElement; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Vector; public class TypeTable { private static HashMap simpleTypetoxsd; public static final QName ANY_TYPE = new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"); private HashMap complexTypeMap; public TypeTable() { //complex type table is resetted every time this is //instantiated complexTypeMap = new HashMap(); } /* statically populate the simple type map - this is not likely to * change and we need not populate it over and over */ static{ populateSimpleTypes(); } /* populate the simpletype hashmap */ private static void populateSimpleTypes() { simpleTypetoxsd = new HashMap(); //todo pls use the types from org.apache.ws.commons.schema.constants.Constants simpleTypetoxsd.put("int", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs")); simpleTypetoxsd.put("java.lang.String", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string", "xs")); simpleTypetoxsd.put("boolean", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "boolean", "xs")); simpleTypetoxsd.put("float", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs")); simpleTypetoxsd.put("double", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "double", "xs")); simpleTypetoxsd.put("short", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs")); simpleTypetoxsd.put("long", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs")); simpleTypetoxsd.put("byte", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs")); simpleTypetoxsd.put("char", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string", "xs")); simpleTypetoxsd.put("java.lang.Integer", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs")); simpleTypetoxsd.put("java.lang.Double", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "double", "xs")); simpleTypetoxsd.put("java.lang.Float", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs")); simpleTypetoxsd.put("java.lang.Long", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs")); simpleTypetoxsd.put("java.lang.Character", ANY_TYPE); simpleTypetoxsd.put("java.lang.Boolean", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "boolean", "xs")); simpleTypetoxsd.put("java.lang.Byte", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs")); simpleTypetoxsd.put("java.lang.Short", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs")); simpleTypetoxsd.put("java.util.Date", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs")); simpleTypetoxsd.put("java.util.Calendar", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs")); // SQL date time simpleTypetoxsd.put("java.sql.Date", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs")); simpleTypetoxsd.put("java.sql.Time", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "time", "xs")); simpleTypetoxsd.put("java.sql.Timestamp", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs")); //consider BigDecimal, BigInteger, Day, Duration, Month, MonthDay, //Time, Year, YearMonth as SimpleType as well simpleTypetoxsd.put("java.math.BigDecimal", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "decimal", "xs")); simpleTypetoxsd.put("java.math.BigInteger", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "integer", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.Day", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "gDay", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.Duration", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "duration", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.Month", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "gMonth", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.MonthDay", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "gMonthDay", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.Time", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "time", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.Year", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "gYear", "xs")); simpleTypetoxsd.put("org.apache.axis2.databinding.types.YearMonth", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "gYearMonth", "xs")); simpleTypetoxsd.put("java.lang.Object", ANY_TYPE); // Any types simpleTypetoxsd.put(OMElement.class.getName(), ANY_TYPE); simpleTypetoxsd.put(ArrayList.class.getName(), ANY_TYPE); simpleTypetoxsd.put(Vector.class.getName(), ANY_TYPE); simpleTypetoxsd.put(List.class.getName(), ANY_TYPE); simpleTypetoxsd.put(HashMap.class.getName(), ANY_TYPE); simpleTypetoxsd.put(Hashtable.class.getName(), ANY_TYPE); //byteArrat simpleTypetoxsd.put("base64Binary", new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "base64Binary", "xs")); } /** * Return the schema type QName given the type class name * @param typeName the name of the type * @return the name of the simple type or null if it is not a simple type */ public QName getSimpleSchemaTypeName(String typeName) { QName qName = (QName) simpleTypetoxsd.get(typeName); if(qName == null){ if((typeName.startsWith("java.lang")||typeName.startsWith("javax.")) && !Exception.class.getName().equals(typeName)){ return ANY_TYPE; } } return qName; } /** * Return whether the given type is a simple type or not * @param typeName the name of the type * @return true if the type is a simple type */ public boolean isSimpleType(String typeName) { if (simpleTypetoxsd.keySet().contains(typeName)){ return true; }else if(typeName.startsWith("java.lang")||typeName.startsWith("javax.")){ return true; } return false; } /** * Return the complex type map * @return the map with complex types */ public Map getComplexSchemaMap() { return complexTypeMap; } public void addComplexSchema(String name, QName schemaType) { complexTypeMap.put(name, schemaType); } public QName getComplexSchemaType(String name) { return (QName) complexTypeMap.get(name); } /** * Get the qname for a type * first try the simple types if not try the complex types * @param typeName name of the type * @return the Qname for this type */ public QName getQNamefortheType(String typeName) { QName type = getSimpleSchemaTypeName(typeName); if (type == null) { type = getComplexSchemaType(typeName); } return type; } } ./src/org/apache/axis2/description/java2wsdl/bytecode/0000775000175000017500000000000011767656530022050 5ustar brianbrian./src/org/apache/axis2/description/java2wsdl/bytecode/ParamNameExtractor.java0000664000175000017500000000430611767656530026453 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl.bytecode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** * This class retrieves function parameter names from bytecode built with * debugging symbols. Used as a last resort when creating WSDL. */ public class ParamNameExtractor { private static final Log log = LogFactory.getLog(ParamNameExtractor.class); /** * Retrieves a list of function parameter names from a method. * Returns null if unable to read parameter names (i.e. bytecode not * built with debug). */ public static String[] getParameterNamesFromDebugInfo(Method method) { // Don't worry about it if there are no params. int numParams = method.getParameterTypes().length; if (numParams == 0) return null; // get declaring class Class c = method.getDeclaringClass(); // Don't worry about it if the class is a Java dynamic proxy if (Proxy.isProxyClass(c)) { return null; } try { // get a parameter reader ParamReader pr = new ParamReader(c); // get the parameter names return pr.getParameterNames(method); } catch (IOException e) { // log it and leave return null; } } } ./src/org/apache/axis2/description/java2wsdl/bytecode/ChainedParamReader.java0000664000175000017500000001131211767656530026350 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl.bytecode; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Description: In ParamReader class, user cannot get inherited method parameter * from the class they passed in for performance reasons This class * is walks up the inheritance chain. If the method is not found in * the derived class, search in super class. If not found in the immedidate super * class, search super class's super class, until the root, which is java.lang.Object, * is reached. This is not an eager load since it only start searching the super class * when it is asked to. */ public class ChainedParamReader { private List chain = new ArrayList(); private List clsChain = new ArrayList(); private Map methodToParamMap = new HashMap(); /** * Processes a given class's parameter names. * * @param cls the class which user wants to get parameter info from * @throws IOException */ public ChainedParamReader(Class cls) throws IOException { ParamReader reader = new ParamReader(cls); chain.add(reader); clsChain.add(cls); } //now I need to create deligate methods /** * Returns the names of the declared parameters for the given constructor. * If we cannot determine the names, return null. The returned array will * have one name per parameter. The length of the array will be the same * as the length of the Class[] array returned by Constructor.getParameterTypes(). * * @param ctor * @return Returns array of names, one per parameter, or null */ public String[] getParameterNames(Constructor ctor) { //there is no need for the constructor chaining. return ((ParamReader) chain.get(0)).getParameterNames(ctor); } /** * Returns the names of the declared parameters for the given method. * If cannot determine the names in the current class, search its parent * class until we reach java.lang.Object. If still can not find the method, * returns null. The returned array has one name per parameter. The length * of the array will be the same as the length of the Class[] array * returned by Method.getParameterTypes(). * * @param method * @return String[] Returns array of names, one per parameter, or null */ public String[] getParameterNames(Method method) { //go find the one from the cache first if (methodToParamMap.containsKey(method)) { return (String[]) methodToParamMap.get(method); } String[] ret = null; for (Iterator it = chain.iterator(); it.hasNext();) { ParamReader reader = (ParamReader) it.next(); ret = reader.getParameterNames(method); if (ret != null) { methodToParamMap.put(method, ret); return ret; } } //if we here, it means we need to create new chain. Class cls = (Class) clsChain.get(chain.size() - 1); while (cls != null && cls != java.lang.Object.class && cls.getSuperclass() != null) { Class superClass = cls.getSuperclass(); try { ParamReader _reader = new ParamReader(superClass); chain.add(_reader); clsChain.add(cls); ret = _reader.getParameterNames(method); if (ret != null) { //we found it so just return it. methodToParamMap.put(method, ret); return ret; } } catch (IOException e) { //can not find the super class in the class path, abort here return null; } cls = superClass; } methodToParamMap.put(method, ret); return null; } } ./src/org/apache/axis2/description/java2wsdl/bytecode/ClassReader.java0000664000175000017500000003377511767656530025122 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl.bytecode; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; /** * This is the class file reader for obtaining the parameter names * for declared methods in a class. The class must have debugging * attributes for us to obtain this information.

        *

        * This does not work for inherited methods. To obtain parameter * names for inherited methods, you must use a paramReader for the * class that originally declared the method.

        *

        * don't get tricky, it's the bare minimum. Instances of this class * are not threadsafe -- don't share them.

        */ public class ClassReader extends ByteArrayInputStream { // constants values that appear in java class files, // from jvm spec 2nd ed, section 4.4, pp 103 private static final int CONSTANT_Class = 7; private static final int CONSTANT_Fieldref = 9; private static final int CONSTANT_Methodref = 10; private static final int CONSTANT_InterfaceMethodref = 11; private static final int CONSTANT_String = 8; private static final int CONSTANT_Integer = 3; private static final int CONSTANT_Float = 4; private static final int CONSTANT_Long = 5; private static final int CONSTANT_Double = 6; private static final int CONSTANT_NameAndType = 12; private static final int CONSTANT_Utf8 = 1; /** * the constant pool. constant pool indices in the class file * directly index into this array. The value stored in this array * is the position in the class file where that constant begins. */ private int[] cpoolIndex; private Object[] cpool; private Map attrMethods; /** * Loads the bytecode for a given class, by using the class's defining * classloader and assuming that for a class named P.C, the bytecodes are * in a resource named /P/C.class. * * @param c the class of interest * @return Returns a byte array containing the bytecode * @throws IOException */ protected static byte[] getBytes(Class c) throws IOException { InputStream fin = c.getResourceAsStream('/' + c.getName().replace('.', '/') + ".class"); if (fin == null) { throw new IOException("Unable to load bytecode for class " + c.getName() ); } try { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int actual; do { actual = fin.read(buf); if (actual > 0) { out.write(buf, 0, actual); } } while (actual > 0); return out.toByteArray(); } finally { fin.close(); } } static String classDescriptorToName(String desc) { return desc.replace('/', '.'); } protected static Map findAttributeReaders(Class c) { HashMap map = new HashMap(); Method[] methods = c.getMethods(); for (int i = 0; i < methods.length; i++) { String name = methods[i].getName(); if (name.startsWith("read") && methods[i].getReturnType() == void.class) { map.put(name.substring(4), methods[i]); } } return map; } protected static String getSignature(Member method, Class[] paramTypes) { // compute the method descriptor StringBuffer b = new StringBuffer((method instanceof Method) ? method.getName() : ""); b.append('('); for (int i = 0; i < paramTypes.length; i++) { addDescriptor(b, paramTypes[i]); } b.append(')'); if (method instanceof Method) { addDescriptor(b, ((Method) method).getReturnType()); } else if (method instanceof Constructor) { addDescriptor(b, void.class); } return b.toString(); } private static void addDescriptor(StringBuffer b, Class c) { if (c.isPrimitive()) { if (c == void.class) b.append('V'); else if (c == int.class) b.append('I'); else if (c == boolean.class) b.append('Z'); else if (c == byte.class) b.append('B'); else if (c == short.class) b.append('S'); else if (c == long.class) b.append('J'); else if (c == char.class) b.append('C'); else if (c == float.class) b.append('F'); else if (c == double.class) b.append('D'); } else if (c.isArray()) { b.append('['); addDescriptor(b, c.getComponentType()); } else { b.append('L').append(c.getName().replace('.', '/')).append(';'); } } /** * @return Returns the next unsigned 16 bit value. */ protected final int readShort() { return (read() << 8) | read(); } /** * @return Returns the next signed 32 bit value. */ protected final int readInt() { return (read() << 24) | (read() << 16) | (read() << 8) | read(); } /** * Skips n bytes in the input stream. */ protected void skipFully(int n) throws IOException { while (n > 0) { int c = (int) skip(n); if (c <= 0) throw new EOFException("Error looking for paramter names in bytecode: unexpected end of file"); n -= c; } } protected final Member resolveMethod(int index) throws IOException, ClassNotFoundException, NoSuchMethodException { int oldPos = pos; try { Member m = (Member) cpool[index]; if (m == null) { pos = cpoolIndex[index]; Class owner = resolveClass(readShort()); NameAndType nt = resolveNameAndType(readShort()); String signature = nt.name + nt.type; if (nt.name.equals("")) { Constructor[] ctors = owner.getConstructors(); for (int i = 0; i < ctors.length; i++) { String sig = getSignature(ctors[i], ctors[i].getParameterTypes()); if (sig.equals(signature)) { cpool[index] = m = ctors[i]; return m; } } } else { Method[] methods = owner.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { String sig = getSignature(methods[i], methods[i].getParameterTypes()); if (sig.equals(signature)) { cpool[index] = m = methods[i]; return m; } } } throw new NoSuchMethodException(signature); } return m; } finally { pos = oldPos; } } protected final Field resolveField(int i) throws IOException, ClassNotFoundException, NoSuchFieldException { int oldPos = pos; try { Field f = (Field) cpool[i]; if (f == null) { pos = cpoolIndex[i]; Class owner = resolveClass(readShort()); NameAndType nt = resolveNameAndType(readShort()); cpool[i] = f = owner.getDeclaredField(nt.name); } return f; } finally { pos = oldPos; } } private static class NameAndType { String name; String type; public NameAndType(String name, String type) { this.name = name; this.type = type; } } protected final NameAndType resolveNameAndType(int i) throws IOException { int oldPos = pos; try { NameAndType nt = (NameAndType) cpool[i]; if (nt == null) { pos = cpoolIndex[i]; String name = resolveUtf8(readShort()); String type = resolveUtf8(readShort()); cpool[i] = nt = new NameAndType(name, type); } return nt; } finally { pos = oldPos; } } protected final Class resolveClass(int i) throws IOException, ClassNotFoundException { int oldPos = pos; try { Class c = (Class) cpool[i]; if (c == null) { pos = cpoolIndex[i]; String name = resolveUtf8(readShort()); cpool[i] = c = Class.forName(classDescriptorToName(name)); } return c; } finally { pos = oldPos; } } protected final String resolveUtf8(int i) throws IOException { int oldPos = pos; try { String s = (String) cpool[i]; if (s == null) { pos = cpoolIndex[i]; int len = readShort(); skipFully(len); cpool[i] = s = new String(buf, pos - len, len, "utf-8"); } return s; } finally { pos = oldPos; } } protected final void readCpool() throws IOException { int count = readShort(); // cpool count cpoolIndex = new int[count]; cpool = new Object[count]; for (int i = 1; i < count; i++) { int c = read(); cpoolIndex[i] = super.pos; switch (c) // constant pool tag { case CONSTANT_Fieldref: case CONSTANT_Methodref: case CONSTANT_InterfaceMethodref: case CONSTANT_NameAndType: readShort(); // class index or (12) name index // fall through case CONSTANT_Class: case CONSTANT_String: readShort(); // string index or class index break; case CONSTANT_Long: case CONSTANT_Double: readInt(); // hi-value // see jvm spec section 4.4.5 - double and long cpool // entries occupy two "slots" in the cpool table. i++; // fall through case CONSTANT_Integer: case CONSTANT_Float: readInt(); // value break; case CONSTANT_Utf8: int len = readShort(); skipFully(len); break; default: // corrupt class file throw new IllegalStateException("Error looking for paramter names in bytecode: unexpected bytes in file"); } } } protected final void skipAttributes() throws IOException { int count = readShort(); for (int i = 0; i < count; i++) { readShort(); // name index skipFully(readInt()); } } /** * Reads an attributes array. The elements of a class file that * can contain attributes are: fields, methods, the class itself, * and some other types of attributes. */ protected final void readAttributes() throws IOException { int count = readShort(); for (int i = 0; i < count; i++) { int nameIndex = readShort(); // name index int attrLen = readInt(); int curPos = pos; String attrName = resolveUtf8(nameIndex); Method m = (Method) attrMethods.get(attrName); if (m != null) { try { m.invoke(this, new Object[]{}); } catch (IllegalAccessException e) { pos = curPos; skipFully(attrLen); } catch (InvocationTargetException e) { try { throw e.getTargetException(); } catch (Error ex) { throw ex; } catch (RuntimeException ex) { throw ex; } catch (IOException ex) { throw ex; } catch (Throwable ex) { pos = curPos; skipFully(attrLen); } } } else { // don't care what attribute this is skipFully(attrLen); } } } /** * Reads a code attribute. * * @throws IOException */ public void readCode() throws IOException { readShort(); // max stack readShort(); // max locals skipFully(readInt()); // code skipFully(8 * readShort()); // exception table // read the code attributes (recursive). This is where // we will find the LocalVariableTable attribute. readAttributes(); } protected ClassReader(byte buf[], Map attrMethods) { super(buf); this.attrMethods = attrMethods; } } ./src/org/apache/axis2/description/java2wsdl/bytecode/MethodTable.java0000664000175000017500000000346711767656530025115 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl.bytecode; import java.lang.reflect.Method; import java.util.HashMap; public class MethodTable { private HashMap nameToMethodMap; private ChainedParamReader cpr; public MethodTable(Class cls) throws Exception { cpr = new ChainedParamReader(cls); nameToMethodMap = new HashMap(); loadMethods(cls); } /** * To load all the methods in the given class by Java reflection * * @param cls * @throws Exception */ private void loadMethods(Class cls) throws Exception { Method [] methods = cls.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; nameToMethodMap.put(method.getName(), method); } } public String [] getParameterNames(String methodName) { Method method = (Method) nameToMethodMap.get(methodName); if (method == null) { return null; } return cpr.getParameterNames(method); } } ./src/org/apache/axis2/description/java2wsdl/bytecode/ParamReader.java0000664000175000017500000001664211767656530025107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl.bytecode; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; /** * This is the class file reader for obtaining the parameter names * for declared methods in a class. The class must have debugging * attributes for us to obtain this information.

        *

        * This does not work for inherited methods. To obtain parameter * names for inherited methods, you must use a paramReader for the * class that originally declared the method.

        *

        * don't get tricky, it's the bare minimum. Instances of this class * are not threadsafe -- don't share them.

        */ public class ParamReader extends ClassReader { private String methodName; private Map methods = new HashMap(); private Class[] paramTypes; /** * Processes a class file, given it's class. We'll use the defining * classloader to locate the bytecode. * * @param c * @throws java.io.IOException */ public ParamReader(Class c) throws IOException { this(getBytes(c)); } /** * Processes the given class bytes directly. * * @param b * @throws IOException */ public ParamReader(byte[] b) throws IOException { super(b, findAttributeReaders(ParamReader.class)); // check the magic number if (readInt() != 0xCAFEBABE) { // not a class file! throw new IOException("Error looking for paramter names in bytecode: input does not appear to be a valid class file"); } readShort(); // minor version readShort(); // major version readCpool(); // slurp in the constant pool readShort(); // access flags readShort(); // this class name readShort(); // super class name int count = readShort(); // ifaces count for (int i = 0; i < count; i++) { readShort(); // interface index } count = readShort(); // fields count for (int i = 0; i < count; i++) { readShort(); // access flags readShort(); // name index readShort(); // descriptor index skipAttributes(); // field attributes } count = readShort(); // methods count for (int i = 0; i < count; i++) { readShort(); // access flags int m = readShort(); // name index String name = resolveUtf8(m); int d = readShort(); // descriptor index this.methodName = name + resolveUtf8(d); readAttributes(); // method attributes } } public void readCode() throws IOException { readShort(); // max stack int maxLocals = readShort(); // max locals MethodInfo info = new MethodInfo(maxLocals); if (methods != null && methodName != null) { methods.put(methodName, info); } skipFully(readInt()); // code skipFully(8 * readShort()); // exception table // read the code attributes (recursive). This is where // we will find the LocalVariableTable attribute. readAttributes(); } /** * Returns the names of the declared parameters for the given constructor. * If we cannot determine the names, return null. The returned array will * have one name per parameter. The length of the array will be the same * as the length of the Class[] array returned by Constructor.getParameterTypes(). * * @param ctor * @return Returns String[] array of names, one per parameter, or null */ public String[] getParameterNames(Constructor ctor) { paramTypes = ctor.getParameterTypes(); return getParameterNames(ctor, paramTypes); } /** * Returns the names of the declared parameters for the given method. * If we cannot determine the names, return null. The returned array will * have one name per parameter. The length of the array will be the same * as the length of the Class[] array returned by Method.getParameterTypes(). * * @param method * @return Returns String[] array of names, one per parameter, or null */ public String[] getParameterNames(Method method) { paramTypes = method.getParameterTypes(); return getParameterNames(method, paramTypes); } protected String[] getParameterNames(Member member, Class [] paramTypes) { // look up the names for this method MethodInfo info = (MethodInfo) methods.get(getSignature(member, paramTypes)); // we know all the local variable names, but we only need to return // the names of the parameters. if (info != null) { String[] paramNames = new String[paramTypes.length]; int j = Modifier.isStatic(member.getModifiers()) ? 0 : 1; boolean found = false; // did we find any non-null names for (int i = 0; i < paramNames.length; i++) { if (info.names[j] != null) { found = true; paramNames[i] = info.names[j]; } j++; if (paramTypes[i] == double.class || paramTypes[i] == long.class) { // skip a slot for 64bit params j++; } } if (found) { return paramNames; } else { return null; } } else { return null; } } private static class MethodInfo { String[] names; int maxLocals; public MethodInfo(int maxLocals) { this.maxLocals = maxLocals; names = new String[maxLocals]; } } private MethodInfo getMethodInfo() { MethodInfo info = null; if (methods != null && methodName != null) { info = (MethodInfo) methods.get(methodName); } return info; } /** * This is invoked when a LocalVariableTable attribute is encountered. * * @throws IOException */ public void readLocalVariableTable() throws IOException { int len = readShort(); // table length MethodInfo info = getMethodInfo(); for (int j = 0; j < len; j++) { readShort(); // start pc readShort(); // length int nameIndex = readShort(); // name_index readShort(); // descriptor_index int index = readShort(); // local index if (info != null) { info.names[index] = resolveUtf8(nameIndex); } } } } ./src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java0000664000175000017500000006074511767656530026071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; import org.apache.axis2.AxisFault; import org.apache.axis2.deployment.util.BeanExcludeInfo; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaComplexContent; import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JField; import org.codehaus.jam.JMethod; import org.codehaus.jam.JParameter; import org.codehaus.jam.JProperty; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Set; public class DocLitBareSchemaGenerator extends DefaultSchemaGenerator { private static final Log log = LogFactory.getLog(DocLitBareSchemaGenerator.class); private HashMap processedParameters = new HashMap(); public DocLitBareSchemaGenerator(ClassLoader loader, String className, String schematargetNamespace, String schematargetNamespacePrefix, AxisService service) throws Exception { super(loader, className, schematargetNamespace, schematargetNamespacePrefix, service); } protected JMethod[] processMethods(JMethod[] declaredMethods) throws Exception { ArrayList list = new ArrayList(); //short the elements in the array Arrays.sort(declaredMethods); // since we do not support overload HashMap uniqueMethods = new HashMap(); XmlSchemaComplexType methodSchemaType; XmlSchemaSequence sequence; for (int i = 0; i < declaredMethods.length; i++) { JMethod jMethod = declaredMethods[i]; JAnnotation methodAnnon = jMethod.getAnnotation(AnnotationConstants.WEB_METHOD); if (methodAnnon != null) { if (methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()) { continue; } } String methodName = getSimpleName(jMethod); // no need to think abt this method , since that is system // config method if (excludeMethods.contains(getSimpleName(jMethod))) { continue; } if (uniqueMethods.get(getSimpleName(jMethod)) != null) { log.warn("We don't support method overloading. Ignoring [" + jMethod.getQualifiedName() + "]"); continue; } if (!jMethod.isPublic()) { // no need to generate Schema for non public methods continue; } boolean addToService = false; AxisOperation axisOperation = service.getOperation(new QName(methodName)); if (axisOperation == null) { axisOperation = Utils.getAxisOperationForJmethod(jMethod); if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals( axisOperation.getMessageExchangePattern())){ AxisMessage outMessage = axisOperation.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outMessage !=null ){ outMessage.setName(methodName + RESULT); } } addToService = true; } // Maintain a list of methods we actually work with list.add(jMethod); processException(jMethod,axisOperation); uniqueMethods.put(getSimpleName(jMethod), jMethod); //create the schema type for the method wrapper uniqueMethods.put(getSimpleName(jMethod), jMethod); JParameter[] paras = jMethod.getParameters(); String parameterNames[] = methodTable.getParameterNames(methodName); AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (inMessage != null) { inMessage.setName(methodName + "RequestMessage"); } if (paras.length > 1) { sequence = new XmlSchemaSequence(); methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod)); methodSchemaType.setParticle(sequence); inMessage.setElementQName(typeTable.getQNamefortheType(methodName)); service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(), axisOperation); inMessage.setPartName(methodName); for (int j = 0; j < paras.length; j++) { JParameter methodParameter = paras[j]; if (generateRequestSchema(methodParameter, parameterNames, j, jMethod, sequence)) { break; } } } else if (paras.length == 1) { if (paras[0].getType().isArrayType()) { sequence = new XmlSchemaSequence(); methodSchemaType = createSchemaTypeForMethodPart(methodName); methodSchemaType.setParticle(sequence); JParameter methodParameter = paras[0]; inMessage.setElementQName(typeTable.getQNamefortheType(methodName)); service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(), axisOperation); inMessage.setPartName(methodName); if (generateRequestSchema(methodParameter, parameterNames, 0, jMethod, sequence)) { break; } } else { String parameterName = null; JParameter methodParameter = paras[0]; JAnnotation paramterAnnon = methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM); if (paramterAnnon != null) { parameterName = paramterAnnon.getValue(AnnotationConstants.NAME).asString(); } if (parameterName == null || "".equals(parameterName)) { parameterName = (parameterNames != null && parameterNames[0] != null) ? parameterNames[0] : getSimpleName(methodParameter); } JMethod processMethod = (JMethod) processedParameters.get(parameterName); if (processMethod != null) { throw new AxisFault("Inavalid Java class," + " there are two methods [" + processMethod.getSimpleName() + " and " + jMethod.getSimpleName() + " ]which have the same parameter names"); } else { processedParameters.put(parameterName, jMethod); generateSchemaForType(null, paras[0].getType(), parameterName); inMessage.setElementQName(typeTable.getQNamefortheType(parameterName)); inMessage.setPartName(parameterName); inMessage.setWrapped(false); service.addMessageElementQNameToOperationMapping(typeTable.getQNamefortheType(parameterName), axisOperation); } } } // for its return type JClass returnType = jMethod.getReturnType(); if (!returnType.isVoidType()) { AxisMessage outMessage = axisOperation.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (returnType.isArrayType()) { methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESULT); sequence = new XmlSchemaSequence(); methodSchemaType.setParticle(sequence); JAnnotation returnAnnon = jMethod.getAnnotation(AnnotationConstants.WEB_RESULT); String returnName = "return"; if (returnAnnon != null) { returnName = returnAnnon.getValue(AnnotationConstants.NAME).asString(); if (returnName != null && !"".equals(returnName)) { returnName = "return"; } } if (nonRpcMethods.contains(methodName)) { generateSchemaForType(sequence, null, returnName); } else { generateSchemaForType(sequence, returnType, returnName); } } else { generateSchemaForType(null, returnType, methodName + RESULT); outMessage.setWrapped(false); } outMessage.setElementQName(typeTable.getQNamefortheType(methodName + RESULT)); outMessage.setName(methodName + "ResponseMessage"); outMessage.setPartName(methodName + RESULT); service.addMessageElementQNameToOperationMapping( typeTable.getQNamefortheType(methodName + RESULT), axisOperation); } if (addToService) { service.addOperation(axisOperation); } } return (JMethod[]) list.toArray(new JMethod[list.size()]); } private boolean generateRequestSchema(JParameter methodParameter, String[] parameterNames, int j, JMethod jMethod, XmlSchemaSequence sequence) throws Exception { String parameterName = null; JAnnotation paramterAnnon = methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM); if (paramterAnnon != null) { parameterName = paramterAnnon.getValue(AnnotationConstants.NAME).asString(); } if (parameterName == null || "".equals(parameterName)) { parameterName = (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : getSimpleName(methodParameter); } JClass paraType = methodParameter.getType(); if (nonRpcMethods.contains(getSimpleName(jMethod))) { generateSchemaForType(sequence, null, getSimpleName(jMethod)); return true; } else { generateSchemaForType(sequence, paraType, parameterName); } return false; } private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { boolean isArrayType = false; if (type != null) { isArrayType = type.isArrayType(); } if (isArrayType) { type = type.getArrayComponentType(); } if (AxisFault.class.getName().equals(type)) { return null; } String classTypeName; if (type == null) { classTypeName = "java.lang.Object"; } else { classTypeName = getQualifiedName(type); } if (isArrayType && "byte".equals(classTypeName)) { classTypeName = "base64Binary"; isArrayType = false; } if (isDataHandler(type)) { classTypeName = "base64Binary"; } QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); if (schemaTypeName == null && type != null) { schemaTypeName = generateSchema(type); addContentToMethodSchemaType(sequence, schemaTypeName, partName, isArrayType); String schemaNamespace = resolveSchemaNamespace(getQualifiedName( type.getContainingPackage())); addImport(getXmlSchema(schemaNamespace), schemaTypeName); if(sequence==null){ generateSchemaForSingleElement(schemaTypeName, partName, isArrayType, type); } } else { if (sequence == null) { generateSchemaForSingleElement(schemaTypeName, partName, isArrayType, type); } else { addContentToMethodSchemaType(sequence, schemaTypeName, partName, isArrayType); } } addImport(getXmlSchema(schemaTargetNameSpace), schemaTypeName); return schemaTypeName; } protected void generateSchemaForSingleElement(QName schemaTypeName, String paraName, boolean isArray, JClass javaType) throws Exception { XmlSchemaElement elt1 = new XmlSchemaElement(); elt1.setName(paraName); elt1.setSchemaTypeName(schemaTypeName); elt1.setNillable(true); QName elementName = new QName(schemaTargetNameSpace, paraName, schema_namespace_prefix); elt1.setQName(elementName); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); xmlSchema.getElements().add(elementName, elt1); xmlSchema.getItems().add(elt1); typeTable.addComplexSchema(paraName, elementName); } /** * Generate schema construct for given type * * @param javaType */ private QName generateSchema(JClass javaType) throws Exception { String name = getQualifiedName(javaType); QName schemaTypeName = typeTable.getComplexSchemaType(name); if (schemaTypeName == null) { String simpleName = getSimpleName(javaType); String packageName = getQualifiedName(javaType.getContainingPackage()); String targetNameSpace = resolveSchemaNamespace(packageName); XmlSchema xmlSchema = getXmlSchema(targetNameSpace); String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); if (targetNamespacePrefix == null) { targetNamespacePrefix = generatePrefix(); targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix); } XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaComplexContentExtension complexExtension = new XmlSchemaComplexContentExtension(); XmlSchemaElement eltOuter = new XmlSchemaElement(); schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); eltOuter.setName(simpleName); eltOuter.setQName(schemaTypeName); JClass sup = javaType.getSuperclass(); if ((sup != null) && !("java.lang.Object".compareTo(sup.getQualifiedName()) == 0) && !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0) &&!("java.util".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) { String superClassName = sup.getQualifiedName(); String superclassname = getSimpleName(sup); String tgtNamespace; String tgtNamespacepfx; QName qName = typeTable.getSimpleSchemaTypeName(superClassName); if (qName != null) { tgtNamespace = qName.getNamespaceURI(); tgtNamespacepfx = qName.getPrefix(); } else { tgtNamespace = resolveSchemaNamespace(sup.getContainingPackage().getQualifiedName()); tgtNamespacepfx = (String) targetNamespacePrefixMap.get(tgtNamespace); QName superClassQname = generateSchema(sup); if(superClassQname!=null){ tgtNamespacepfx = superClassQname.getPrefix(); tgtNamespace = superClassQname.getNamespaceURI(); } } if (tgtNamespacepfx == null) { tgtNamespacepfx = generatePrefix(); targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx); } QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx); complexExtension.setBaseTypeName(basetype); complexExtension.setParticle(sequence); XmlSchemaComplexContent contentModel = new XmlSchemaComplexContent(); contentModel.setContent(complexExtension); complexType.setContentModel(contentModel); } else { complexType.setParticle(sequence); } complexType.setName(simpleName); // xmlSchema.getItems().add(eltOuter); xmlSchema.getElements().add(schemaTypeName, eltOuter); eltOuter.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().add(schemaTypeName, complexType); // adding this type to the table typeTable.addComplexSchema(name, eltOuter.getQName()); // adding this type's package to the table, to support inheritance. typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(), eltOuter.getQName()); Set propertiesSet = new HashSet(); Set propertiesNames = new HashSet(); BeanExcludeInfo beanExcludeInfo = null; if (service.getExcludeInfo() !=null) { beanExcludeInfo = service.getExcludeInfo().getBeanExcludeInfoForClass( javaType.getQualifiedName()); } JProperty[] tempProperties = javaType.getDeclaredProperties(); for (int i = 0; i < tempProperties.length; i++) { JProperty tempProperty = tempProperties[i]; String propertyName = getCorrectName(tempProperty.getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)){ propertiesSet.add(tempProperty); } } JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]); Arrays.sort(properties); for (int i = 0; i < properties.length; i++) { JProperty property = properties[i]; boolean isArryType = property.getType().isArrayType(); String propname = getCorrectName(property.getSimpleName()); propertiesNames.add(propname); this.generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getType(), propname, isArryType); } JField[] tempFields = javaType.getDeclaredFields(); HashMap FieldMap = new HashMap(); for (int i = 0; i < tempFields.length; i++) { // create a element for the field only if it is public // and there is no property with the same name if (tempFields[i].isPublic()) { if (tempFields[i].isStatic()) { // We do not need to expose static fields continue; } String propertyName = getCorrectName(tempFields[i].getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)) { // skip field with same name as a property if (!propertiesNames.contains(tempFields[i].getSimpleName())) { FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]); } } } } // remove fields from super classes patch for defect Annogen-21 // getDeclaredFields is incorrectly returning fields of super classes as well // getDeclaredProperties used earlier works correctly JClass supr = javaType.getSuperclass(); while (supr != null && supr.getQualifiedName().compareTo("java.lang.Object") != 0) { JField[] suprFields = supr.getFields(); for (int i = 0; i < suprFields.length; i++) { FieldMap.remove(suprFields[i].getSimpleName()); } supr = supr.getSuperclass(); } // end patch for Annogen -21 JField[] froperties = (JField[]) FieldMap.values().toArray(new JField[0]); Arrays.sort(froperties); for (int i = 0; i < froperties.length; i++) { JField field = froperties[i]; boolean isArryType = field.getType().isArrayType(); this.generateSchemaforFieldsandProperties(xmlSchema, sequence, field.getType(), field.getSimpleName(), isArryType); } } return schemaTypeName; } private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaElement globalElement = new XmlSchemaElement(); globalElement.setSchemaType(complexType); globalElement.setName(localPartName); globalElement.setQName(elementName); xmlSchema.getItems().add(globalElement); xmlSchema.getElements().add(elementName, globalElement); } typeTable.addComplexSchema(localPartName, elementName); return complexType; } protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; } } ./src/org/apache/axis2/description/java2wsdl/Java2WSDLUtils.java0000664000175000017500000001061711767656530023600 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; public class Java2WSDLUtils { public static final String HTTP = "http://"; public static final char PACKAGE_CLASS_DELIMITER = '.'; public static final String SCHEMA_NAMESPACE_EXTN = "/xsd"; private static NamespaceGenerator defaultNsGenerator = new DefaultNamespaceGenerator(); /** * check the entry for a URL. This is a simple check and need to be improved * * @param entry */ public static boolean isURL(String entry) { return entry.startsWith("http://"); } /** * A method to strip the fully qualified className to a simple classname * * @param qualifiedName */ public static String getSimpleClassName(String qualifiedName) { int index = qualifiedName.lastIndexOf("."); if (index > 0) { return qualifiedName.substring(index + 1, qualifiedName.length()); } return qualifiedName; } public static StringBuffer namespaceFromClassName(String className, ClassLoader classLoader) throws Exception { return namespaceFromClassName(className, classLoader, defaultNsGenerator); } public static StringBuffer namespaceFromClassName(String className, ClassLoader classLoader, NamespaceGenerator nsGen) throws Exception { Class clazz = Class.forName(className, true, classLoader); Package pkg = clazz.getPackage(); String name; if (pkg != null) name = pkg.getName(); else name = packageNameFromClass(className); return nsGen.namespaceFromPackageName(name); } public static StringBuffer schemaNamespaceFromClassName(String packageName, ClassLoader loader) throws Exception { return schemaNamespaceFromClassName(packageName, loader, defaultNsGenerator); } public static StringBuffer schemaNamespaceFromClassName(String packageName, ClassLoader loader, NamespaceGenerator nsGen) throws Exception { StringBuffer stringBuffer = namespaceFromClassName(packageName, loader, nsGen); if (stringBuffer.length() == 0) { stringBuffer.append(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE); } // stringBuffer.append(SCHEMA_NAMESPACE_EXTN); return stringBuffer; } public static StringBuffer targetNamespaceFromClassName(String packageName, ClassLoader loader, NamespaceGenerator nsGen) throws Exception { StringBuffer stringBuffer = namespaceFromClassName(packageName, loader, nsGen); if (stringBuffer.length() == 0) { stringBuffer.append(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE); } return stringBuffer; } public static String getPackageName(String className, ClassLoader classLoader) throws Exception { Class clazz = Class.forName(className, true, classLoader); Package pkg = clazz.getPackage(); String name; if (pkg != null) name = pkg.getName(); else name = packageNameFromClass(className); return name; } protected static String packageNameFromClass(String name) { String ret = ""; int lastDot = name.lastIndexOf('.'); if (lastDot != -1) ret = name.substring(0, lastDot); return ret; } } ./src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java0000664000175000017500000001403611767656530024453 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; public interface Java2WSDLConstants { String SOAP11_PREFIX = "soap"; String SOAP12_PREFIX = "soap12"; String DEFAULT_WSDL_NAMESPACE_PREFIX = "wsdl"; String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs"; String DEFAULT_TARGET_NAMESPACE_PREFIX = "axis2"; String TARGETNAMESPACE_PREFIX = "tns"; String SCHEMA_NAMESPACE_PRFIX = "ns"; String FORM_DEFAULT_QUALIFIED = "qualified"; String FORM_DEFAULT_UNQUALIFIED = "unqualified"; String DOC_LIT_BARE_PARAMETER ="doclitBare"; String DEFAULT_TARGET_NAMESPACE = "http://ws.apache.org/axis2"; String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/"; String AXIS2_XSD = "http://org.apache.axis2/xsd"; String URI_WSDL12_SOAP = "http://schemas.xmlsoap.org/wsdl/soap12/"; String URI_WSDL11_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/"; String TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http"; String DEFAULT_LOCATION_URL = "http://localhost:8080/axis2/services/"; String WSAD_NS = "http://www.w3.org/2006/05/addressing/wsdl"; String HTTP_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/http/"; String MIME_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/mime/"; String HTTP_PREFIX = "http"; String MIME_PREFIX = "mime"; String URN_PREFIX = "urn"; String COLON_SEPARATOR = ":"; String BINDING_NAME_SUFFIX = "SOAP11Binding"; String SOAP12BINDING_NAME_SUFFIX = "SOAP12Binding"; String HTTP_BINDING = "HttpBinding"; String PORT_TYPE_SUFFIX = "PortType"; String PORT_NAME_SUFFIX = "Port"; String MESSAGE_LOCAL_NAME = "message"; String ATTRIBUTE_NAME = "name"; String REQUEST_MESSAGE = "RequestMessage"; String RESPONSE_MESSAGE = "ResponseMessage"; String FAULT_MESSAGE = "Message"; String MESSAGE_SUFFIX = "Request"; String REQUEST = "Request"; String RESPONSE = "Response"; String RESULT = "Result"; String PORT_TYPE_LOCAL_NAME = "portType"; String OPERATION_LOCAL_NAME = "operation"; String IN_PUT_LOCAL_NAME = "input"; String OUT_PUT_LOCAL_NAME = "output"; String SERVICE_LOCAL_NAME = "service"; String BINDING_LOCAL_NAME = "binding"; String PORT = "port"; String SOAP12PORT = "SOAP12port"; String SOAP11PORT = "SOAP11port"; String HTTP_PORT = "Httpport"; String PART_ATTRIBUTE_NAME = "part"; String ELEMENT_ATTRIBUTE_NAME = "element"; String FAULT_LOCAL_NAME = "fault"; String SOAP_ADDRESS = "address"; String LOCATION = "location"; String TRANSPORT = "transport"; String STYLE = "style"; String SOAP_ACTION = "soapAction"; String SOAP_BODY = "body"; String SOAP_USE = "use"; String DOCUMENT = "document"; String LITERAL = "literal"; // // Schema XSD Namespaces // String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; String ATTR_FORM_DEFAULT_OPTION = "afd"; String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault"; String CLASSNAME_OPTION = "cn"; String CLASSNAME_OPTION_LONG = "className"; String CLASSPATH_OPTION = "cp"; String CLASSPATH_OPTION_LONG = "classPath"; String DOC_LIT_BARE = "dlb"; String DOC_LIT_BARE_LONG = "doclitbare"; String ELEMENT_FORM_DEFAULT_OPTION = "efd"; String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault"; String EXTRA_CLASSES_DEFAULT_OPTION = "xc"; String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses"; String JAVA_PKG_2_NSMAP_OPTION = "p2n"; String JAVA_PKG_2_NSMAP_OPTION_LONG = "package2Namespace"; String LOCATION_OPTION = "l"; String LOCATION_OPTION_LONG = "location"; String NAMESPACE_GENERATOR_OPTION = "nsg"; String NAMESPACE_GENERATOR_OPTION_LONG = "namespaceGenerator"; String OUTPUT_FILENAME_OPTION = "of"; String OUTPUT_FILENAME_OPTION_LONG = "outputFilename"; String OUTPUT_LOCATION_OPTION = "o"; String OUTPUT_LOCATION_OPTION_LONG = "output"; String SCHEMA_GENERATOR_OPTION = "sg"; String SCHEMA_GENERATOR_OPTION_LONG = "schemaGenerator"; String SCHEMA_TARGET_NAMESPACE_OPTION = "stn"; String SCHEMA_TARGET_NAMESPACE_OPTION_LONG = "schemaTargetnamespace"; String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION = "stp"; String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG = "schemaTargetnamespacePrefix"; String SERVICE_NAME_OPTION = "sn"; String SERVICE_NAME_OPTION_LONG = "serviceName"; String STYLE_OPTION = "st"; String STYLE_OPTION_LONG = "style"; String TARGET_NAMESPACE_OPTION = "tn"; String TARGET_NAMESPACE_OPTION_LONG = "targetNamespace"; String TARGET_NAMESPACE_PREFIX_OPTION = "tp"; String TARGET_NAMESPACE_PREFIX_OPTION_LONG = "targetNamespacePrefix"; String USE_OPTION = "u"; String USE_OPTION_LONG = "use"; String WSDL_VERSION_OPTION = "wv"; String WSDL_VERSION_OPTION_LONG = "wsdl-version"; String CUSTOM_SCHEMA_LOCATION = "csl"; String CUSTOM_SCHEMA_LOCATION_LONG = "custom-schema-location"; String SCHEMA_MAPPING_FILE_LOCATION = "mfl"; String SCHEMA_MAPPING_FILE_LOCATION_LONG = "mapping-file-location"; String AXIS2_NAMESPACE_PREFIX = "ns1"; public static final String SOLE_INPUT = "SOLE_INPUT"; String WSDL_VERSION_2 = "2.0"; String WSDL_VERSION_2_OPTIONAL = "2"; String WSDL_VERSION_1 = "1.1"; String PARAMETERS = "parameters"; } ./src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java0000664000175000017500000000357211767656530024173 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; import org.apache.axis2.description.AxisService; import org.codehaus.jam.JMethod; import java.util.ArrayList; import java.util.Collection; import java.util.Map; public interface SchemaGenerator { void setNsGen(NamespaceGenerator nsGen); Collection generateSchema() throws Exception; TypeTable getTypeTable(); JMethod[] getMethods(); void setExcludeMethods(ArrayList excludeMethods); String getSchemaTargetNameSpace(); void setAttrFormDefault(String attrFormDefault); void setElementFormDefault(String elementFormDefault); void setExtraClasses(ArrayList extraClasses); void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace); void setPkg2nsmap(Map pkg2nsmap); String getTargetNamespace(); void setNonRpcMethods(ArrayList nonRpcMethods); void setAxisService(AxisService service); String getCustomSchemaLocation(); void setCustomSchemaLocation(String customSchemaLocation); String getMappingFileLocation() ; void setMappingFileLocation(String mappingFileLocation) ; } ./src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java0000664000175000017500000000260611767656530025130 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; public interface AnnotationConstants { String WEB_SERVICE = "javax.jws.WebService"; String WEB_METHOD = "javax.jws.WebMethod"; String WEB_PARAM = "javax.jws.WebParam"; String WEB_RESULT = "javax.jws.WebResult"; String WEB_SERVICE_PROVIDER = "javax.xml.ws.WebServiceProvider"; String TARGETNAMESPACE = "targetNamespace"; String NAME = "name"; String SERVICE_NAME = "serviceName"; String EXCLUDE = "exclude"; String ACTION = "action"; String WSDL_LOCATION = "wsdlLocation"; String OPERATION_NAME ="operationName"; } ./src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java0000664000175000017500000013120111767656530025467 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; import org.apache.axis2.AxisFault; import org.apache.axis2.deployment.util.BeanExcludeInfo; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.bytecode.MethodTable; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.apache.ws.commons.schema.XmlSchemaComplexContent; import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaForm; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JComment; import org.codehaus.jam.JField; import org.codehaus.jam.JMethod; import org.codehaus.jam.JPackage; import org.codehaus.jam.JParameter; import org.codehaus.jam.JProperty; import org.codehaus.jam.JamClassIterator; import org.codehaus.jam.JamService; import org.codehaus.jam.JamServiceFactory; import org.codehaus.jam.JamServiceParams; import org.w3c.dom.Document; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Set; public class DefaultSchemaGenerator implements Java2WSDLConstants, SchemaGenerator { private static final Log log = LogFactory.getLog(DefaultSchemaGenerator.class); public static final String NAME_SPACE_PREFIX = "ax2";// axis2 name space private static int prefixCount = 1; protected Map targetNamespacePrefixMap = new Hashtable(); protected Map schemaMap = new Hashtable(); protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); protected ClassLoader classLoader; protected String className; protected TypeTable typeTable = new TypeTable(); // to keep loadded method using JAM protected JMethod methods[]; //to store byte code method using Axis 1.x codes protected MethodTable methodTable; protected String schemaTargetNameSpace; protected String schema_namespace_prefix; protected String attrFormDefault = null; protected String elementFormDefault = null; protected ArrayList excludeMethods = new ArrayList(); protected ArrayList extraClasses = null; protected boolean useWSDLTypesNamespace = false; protected Map pkg2nsmap = null; protected NamespaceGenerator nsGen = null; protected String targetNamespace = null; //to keep the list of operation which uses MR other than RPC MR protected ArrayList nonRpcMethods = new ArrayList(); protected Class serviceClass = null; protected AxisService service; // location of the custom schema , if any protected String customSchemaLocation; // location of the class name to package mapping file // File is simple file with qualifiedClassName:SchemaQName protected String mappingFileLocation; //To check whether we need to generate Schema element for Exception protected boolean generateBaseException ; public NamespaceGenerator getNsGen() throws Exception { if (nsGen == null) { nsGen = new DefaultNamespaceGenerator(); } return nsGen; } public void setNsGen(NamespaceGenerator nsGen) { this.nsGen = nsGen; } public DefaultSchemaGenerator(ClassLoader loader, String className, String schematargetNamespace, String schematargetNamespacePrefix, AxisService service) throws Exception { this.classLoader = loader; this.className = className; this.service = service; serviceClass = Class.forName(className, true, loader); methodTable = new MethodTable(serviceClass); this.targetNamespace = Java2WSDLUtils.targetNamespaceFromClassName( className, loader, getNsGen()).toString(); if (schematargetNamespace != null && schematargetNamespace.trim().length() != 0) { this.schemaTargetNameSpace = schematargetNamespace; } else { this.schemaTargetNameSpace = Java2WSDLUtils.schemaNamespaceFromClassName(className, loader, getNsGen()) .toString(); } if (schematargetNamespacePrefix != null && schematargetNamespacePrefix.trim().length() != 0) { this.schema_namespace_prefix = schematargetNamespacePrefix; } else { this.schema_namespace_prefix = SCHEMA_NAMESPACE_PRFIX; } } //This will locad the custom schema file and add that into the schema map private void loadCustomSchemaFile(){ if (customSchemaLocation != null) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); Document doc = documentBuilderFactory.newDocumentBuilder().parse(new File(customSchemaLocation)); XmlSchema schema = xmlSchemaCollection.read(doc,null); schemaMap.put(schema.getTargetNamespace() ,schema); } catch (Exception e) { log.info(e.getMessage()); } } } /**This will load the mapping file and update the Typetable with the Class name and the Qname * Mapping file look like * org.foo.bar.FooException|http://www.abc.com/soaframework/common/types|ErrorMessage */ private void loadMappingFile(){ if(mappingFileLocation != null){ File file = new File(mappingFileLocation); BufferedReader input = null; try { input = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = input.readLine()) != null) { line = line.trim(); if (line.length() > 0 && line.charAt(0)!='#') { String values [] = line.split("\\|"); if (values != null && values.length >2) { typeTable.addComplexSchema(values[0],new QName(values[1] , values[2])); } } } } catch (IOException ex) { ex.printStackTrace(); } finally { try { if (input != null) { input.close(); } } catch (IOException ex) { ex.printStackTrace(); } } } } /** * Generates schema for all the parameters in method. First generates schema for all different * parameter type and later refers to them. * * @return Returns XmlSchema. * @throws Exception */ public Collection generateSchema() throws Exception { loadCustomSchemaFile(); loadMappingFile(); JamServiceFactory factory = JamServiceFactory.getInstance(); JamServiceParams jam_service_parms = factory.createServiceParams(); //setting the classLoder //it can posible to add the classLoader as well jam_service_parms.addClassLoader(classLoader); jam_service_parms.includeClass(className); for (int count = 0; count < getExtraClasses().size(); ++count) { jam_service_parms.includeClass((String) getExtraClasses().get(count)); } JamService jamService = factory.createService(jam_service_parms); QName extraSchemaTypeName; JamClassIterator jClassIter = jamService.getClasses(); //all most all the time the ittr will have only one class in it while (jClassIter.hasNext()) { JClass jclass = (JClass) jClassIter.next(); if (getActualQualifiedName(jclass).equals(className)) { /** * Schema genertaion done in two stage 1. Load all the methods and * create type for methods parameters (if the parameters are Bean * then it will create Complex types foer those , and if the * parameters are simple type which decribe in SimpleTypeTable * nothing will happen) 2. In the next stage for all the methods * messages and port types will be creteated */ JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE); JComment comment = jclass.getComment(); if (comment !=null) { System.out.println(comment.getText()); } if (annotation != null) { String tns = annotation.getValue(AnnotationConstants.TARGETNAMESPACE).asString(); if (tns != null && !"".equals(tns)) { targetNamespace = tns; schemaTargetNameSpace = tns; } service.setName(Utils.getAnnotatedServiceName(serviceClass,annotation)); } methods = processMethods(jclass.getDeclaredMethods()); } else { //generate the schema type for extra classes extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(getQualifiedName(jclass)); if (extraSchemaTypeName == null) { generateSchema(jclass); } } } return schemaMap.values(); } protected JMethod[] processMethods(JMethod[] declaredMethods) throws Exception { ArrayList list = new ArrayList(); //short the elements in the array Arrays.sort(declaredMethods); // since we do not support overload HashMap uniqueMethods = new HashMap(); XmlSchemaComplexType methodSchemaType; XmlSchemaSequence sequence = null; for (int i = 0; i < declaredMethods.length; i++) { JMethod jMethod = declaredMethods[i]; JAnnotation methodAnnon = jMethod.getAnnotation(AnnotationConstants.WEB_METHOD); if (methodAnnon != null) { if (methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()) { continue; } } String methodName = getSimpleName(jMethod); // no need to think abt this method , since that is system // config method if (excludeMethods.contains(methodName)) { continue; } if (uniqueMethods.get(methodName) != null) { log.warn("We don't support method overloading. Ignoring [" + jMethod.getQualifiedName() + "]"); continue; } if (!jMethod.isPublic()) { // no need to generate Schema for non public methods continue; } boolean addToService = false; AxisOperation axisOperation = service.getOperation(new QName(methodName)); if (axisOperation == null) { axisOperation = Utils.getAxisOperationForJmethod(jMethod); // if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals( // axisOperation.getMessageExchangePattern())){ // AxisMessage outMessage = axisOperation.getMessage( // WSDLConstants.MESSAGE_LABEL_OUT_VALUE); // if (outMessage !=null ){ // outMessage.setName(methodName + RESPONSE); // } // } addToService = true; } // Maintain a list of methods we actually work with list.add(jMethod); processException(jMethod,axisOperation); uniqueMethods.put(methodName, jMethod); JParameter[] paras = jMethod.getParameters(); String parameterNames[] = null; AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (inMessage != null) { inMessage.setName(methodName + Java2WSDLConstants.MESSAGE_SUFFIX); } if (paras.length > 0) { parameterNames = methodTable.getParameterNames(methodName); sequence = new XmlSchemaSequence(); methodSchemaType = createSchemaTypeForMethodPart(methodName); methodSchemaType.setParticle(sequence); inMessage.setElementQName(typeTable.getQNamefortheType(methodName)); service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(), axisOperation); } for (int j = 0; j < paras.length; j++) { JParameter methodParameter = paras[j]; String parameterName = null; JAnnotation paramterAnnon = methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM); if (paramterAnnon != null) { parameterName = paramterAnnon.getValue(AnnotationConstants.NAME).asString(); } if (parameterName == null || "".equals(parameterName)) { parameterName = (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : getSimpleName(methodParameter); } JClass paraType = methodParameter.getType(); if (nonRpcMethods.contains(getSimpleName(jMethod))) { generateSchemaForType(sequence, null, getSimpleName(jMethod)); break; } else { generateSchemaForType(sequence, paraType, parameterName); } } // for its return type JClass returnType = jMethod.getReturnType(); if (!returnType.isVoidType()) { String partQname = methodName + RESPONSE; methodSchemaType = createSchemaTypeForMethodPart(partQname); sequence = new XmlSchemaSequence(); methodSchemaType.setParticle(sequence); JAnnotation returnAnnon = jMethod.getAnnotation(AnnotationConstants.WEB_RESULT); String returnName = "return"; if (returnAnnon != null) { returnName = returnAnnon.getValue(AnnotationConstants.NAME).asString(); if (returnName != null && !"".equals(returnName)) { returnName = "return"; } } if (nonRpcMethods.contains(getSimpleName(jMethod))) { generateSchemaForType(sequence, null, returnName); } else { generateSchemaForType(sequence, returnType, returnName); } AxisMessage outMessage = axisOperation.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE); outMessage.setElementQName(typeTable.getQNamefortheType(partQname)); outMessage.setName(partQname); service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(), axisOperation); } if (addToService) { service.addOperation(axisOperation); } } return (JMethod[]) list.toArray(new JMethod[list.size()]); } /** * This method will generate Schema element for all the excetion types in a given JMethod * - No matter what it will generate Schema element for java.lang.Exception so that for other * exception which extend java.lang.Excetion can use as the base class type */ protected void processException(JMethod jMethod, AxisOperation axisOperation) throws Exception { XmlSchemaComplexType methodSchemaType; XmlSchemaSequence sequence; if (jMethod.getExceptionTypes().length > 0) { if (!generateBaseException) { if (typeTable.getComplexSchemaType(Exception.class.getName()) !=null) { } else { sequence = new XmlSchemaSequence(); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(schemaTargetNameSpace, "Exception", schema_namespace_prefix); XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); complexType.setName("Exception"); xmlSchema.getItems().add(complexType); xmlSchema.getElements().add(elementName, complexType); typeTable.addComplexSchema(Exception.class.getName(), elementName); QName schemaTypeName = TypeTable.ANY_TYPE; addContentToMethodSchemaType(sequence, schemaTypeName, "Exception", false); complexType.setParticle(sequence); } generateBaseException = true; } JClass[] extypes = jMethod.getExceptionTypes(); for (int j = 0; j < extypes.length; j++) { JClass extype = extypes[j]; if (AxisFault.class.getName().equals(extype.getQualifiedName())) { continue; } String partQname = extype.getSimpleName(); methodSchemaType = createSchemaTypeForFault(partQname); QName elementName = new QName(this.schemaTargetNameSpace, partQname, this.schema_namespace_prefix); sequence = new XmlSchemaSequence(); if (Exception.class.getName().equals(extype.getQualifiedName())) { QName schemaTypeName = typeTable.getComplexSchemaType(Exception.class.getName()); addContentToMethodSchemaType(sequence, schemaTypeName, partQname, false); methodSchemaType.setParticle(sequence); typeTable.addComplexSchema(Exception.class.getPackage().getName(), methodSchemaType.getQName()); String schemaNamespace = resolveSchemaNamespace(Exception.class.getPackage().getName()); addImport(getXmlSchema(schemaTargetNameSpace),schemaTypeName ); } else { generateSchemaForType(sequence, extype, extype.getSimpleName()); methodSchemaType.setParticle(sequence); } typeTable.addComplexSchema(partQname,elementName); if (AxisFault.class.getName().equals(extype.getQualifiedName())) { continue; } AxisMessage faultMessage = new AxisMessage(); faultMessage.setName(extype.getSimpleName()); faultMessage.setElementQName(typeTable.getQNamefortheType(partQname)); axisOperation.setFaultMessages(faultMessage); } } } /** * JAM converts the first letter of a field into uppercase, so field "foo" would end up * called "Foo". This method corrects that problem. * * @param wrongName * @return the right name, using english as the locale for case conversion */ public static String getCorrectName(String wrongName) { if (wrongName.length() > 1) { return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH) + wrongName.substring(1, wrongName.length()); } else { return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH); } } /** * Generate schema construct for given type * @param javaType : Class to whcih need to generate Schema * @return : Generated QName */ private QName generateSchema(JClass javaType) throws Exception { String name = getQualifiedName(javaType); QName schemaTypeName = typeTable.getComplexSchemaType(name); if (schemaTypeName == null) { String simpleName = getSimpleName(javaType); String packageName = getQualifiedName(javaType.getContainingPackage()); String targetNameSpace = resolveSchemaNamespace(packageName); XmlSchema xmlSchema = getXmlSchema(targetNameSpace); String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); if (targetNamespacePrefix == null) { targetNamespacePrefix = generatePrefix(); targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix); } XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaComplexContentExtension complexExtension = new XmlSchemaComplexContentExtension(); XmlSchemaElement eltOuter = new XmlSchemaElement(); schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); eltOuter.setName(simpleName); eltOuter.setQName(schemaTypeName); JClass sup = javaType.getSuperclass(); if ((sup != null) && !("java.lang.Object".compareTo(sup.getQualifiedName()) == 0) && !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0) &&!("java.util".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) { String superClassName = sup.getQualifiedName(); String superclassname = getSimpleName(sup); String tgtNamespace; String tgtNamespacepfx; QName qName = typeTable.getSimpleSchemaTypeName(superClassName); if (qName != null) { tgtNamespace = qName.getNamespaceURI(); tgtNamespacepfx = qName.getPrefix(); } else { tgtNamespace = resolveSchemaNamespace(sup.getContainingPackage().getQualifiedName()); tgtNamespacepfx = (String) targetNamespacePrefixMap.get(tgtNamespace); QName superClassQname = generateSchema(sup); if(superClassQname!=null){ tgtNamespacepfx = superClassQname.getPrefix(); tgtNamespace = superClassQname.getNamespaceURI(); } } if (tgtNamespacepfx == null) { tgtNamespacepfx = generatePrefix(); targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx); } //if the parent class package name is differ from the child if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values(). contains(tgtNamespace)) { XmlSchemaImport importElement = new XmlSchemaImport(); importElement.setNamespace(tgtNamespace); xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(),tgtNamespace); } QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx); complexExtension.setBaseTypeName(basetype); complexExtension.setParticle(sequence); XmlSchemaComplexContent contentModel = new XmlSchemaComplexContent(); contentModel.setContent(complexExtension); complexType.setContentModel(contentModel); } else { complexType.setParticle(sequence); } complexType.setName(simpleName); // xmlSchema.getItems().add(eltOuter); xmlSchema.getElements().add(schemaTypeName, eltOuter); eltOuter.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().add(schemaTypeName, complexType); // adding this type to the table typeTable.addComplexSchema(name, eltOuter.getQName()); // adding this type's package to the table, to support inheritance. typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(), eltOuter.getQName()); Set propertiesSet = new HashSet(); Set propertiesNames = new HashSet(); JProperty[] tempProperties = javaType.getDeclaredProperties(); BeanExcludeInfo beanExcludeInfo = null; if (service.getExcludeInfo() !=null) { beanExcludeInfo = service.getExcludeInfo().getBeanExcludeInfoForClass( javaType.getQualifiedName()); } for (int i = 0; i < tempProperties.length; i++) { JProperty tempProperty = tempProperties[i]; String propertyName = getCorrectName(tempProperty.getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)){ propertiesSet.add(tempProperty); } } JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]); Arrays.sort(properties); for (int i = 0; i < properties.length; i++) { JProperty property = properties[i]; boolean isArryType = property.getType().isArrayType(); String propname = getCorrectName(property.getSimpleName()); propertiesNames.add(propname); this.generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getType(), propname, isArryType); } JField[] tempFields = javaType.getDeclaredFields(); HashMap FieldMap = new HashMap(); for (int i = 0; i < tempFields.length; i++) { // create a element for the field only if it is public // and there is no property with the same name if (tempFields[i].isPublic()) { if (tempFields[i].isStatic()){ // We do not need to expose static fields continue; } String propertyName = getCorrectName(tempFields[i].getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)) { // skip field with same name as a property if (!propertiesNames.contains(tempFields[i].getSimpleName())) { FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]); } } } } // remove fields from super classes patch for defect Annogen-21 // getDeclaredFields is incorrectly returning fields of super classes as well // getDeclaredProperties used earlier works correctly JClass supr = javaType.getSuperclass(); while (supr != null && supr.getQualifiedName().compareTo("java.lang.Object") != 0) { JField[] suprFields = supr.getFields(); for (int i = 0; i < suprFields.length; i++) { FieldMap.remove(suprFields[i].getSimpleName()); } supr = supr.getSuperclass(); } // end patch for Annogen -21 JField[] froperties = (JField[]) FieldMap.values().toArray(new JField[0]); Arrays.sort(froperties); for (int i = 0; i < froperties.length; i++) { JField field = froperties[i]; boolean isArryType = field.getType().isArrayType(); this.generateSchemaforFieldsandProperties(xmlSchema, sequence, field.getType(), field.getSimpleName(), isArryType); } } return schemaTypeName; } // moved code common to Fields & properties out of above method protected void generateSchemaforFieldsandProperties(XmlSchema xmlSchema, XmlSchemaSequence sequence, JClass type, String name, boolean isArryType) throws Exception { String propertyName; if (isArryType) { propertyName = getQualifiedName(type.getArrayComponentType()); } else propertyName = getQualifiedName(type); if (isArryType && "byte".equals(propertyName)) { propertyName = "base64Binary"; } if (isDataHandler(type)) { propertyName = "base64Binary"; } if (typeTable.isSimpleType(propertyName)) { XmlSchemaElement elt1 = new XmlSchemaElement(); elt1.setName(name); elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName)); sequence.getItems().add(elt1); if (isArryType && (!propertyName.equals("base64Binary"))) { elt1.setMaxOccurs(Long.MAX_VALUE); } elt1.setMinOccurs(0); if (!type.isPrimitiveType()) { elt1.setNillable(true); } } else { if (isArryType) { generateSchema(type.getArrayComponentType()); } else { generateSchema(type); } XmlSchemaElement elt1 = new XmlSchemaElement(); elt1.setName(name); elt1.setSchemaTypeName(typeTable.getComplexSchemaType(propertyName)); sequence.getItems().add(elt1); if (isArryType) { elt1.setMaxOccurs(Long.MAX_VALUE); } elt1.setMinOccurs(0); elt1.setNillable(true); if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values(). contains(typeTable.getComplexSchemaType(propertyName).getNamespaceURI())) { XmlSchemaImport importElement = new XmlSchemaImport(); importElement.setNamespace( typeTable.getComplexSchemaType(propertyName).getNamespaceURI()); xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), typeTable.getComplexSchemaType(propertyName).getNamespaceURI()); } } } private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { boolean isArrayType = false; if (type != null) { isArrayType = type.isArrayType(); } if (isArrayType) { type = type.getArrayComponentType(); } if (AxisFault.class.getName().equals(type)) { return null; } String classTypeName; if (type == null) { classTypeName = "java.lang.Object"; } else { classTypeName = getQualifiedName(type); } if (isArrayType && "byte".equals(classTypeName)) { classTypeName = "base64Binary"; isArrayType = false; } if (isDataHandler(type)) { classTypeName = "base64Binary"; } QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); if (schemaTypeName == null) { schemaTypeName = generateSchema(type); addContentToMethodSchemaType(sequence, schemaTypeName, partName, isArrayType); String schemaNamespace; schemaNamespace = resolveSchemaNamespace(getQualifiedName(type.getContainingPackage())); addImport(getXmlSchema(schemaNamespace), schemaTypeName); } else { addContentToMethodSchemaType(sequence, schemaTypeName, partName, isArrayType); } addImport(getXmlSchema(schemaTargetNameSpace), schemaTypeName); return schemaTypeName; } protected boolean isDataHandler(JClass clazz){ if(clazz == null ){ return false; } String classType = clazz.getQualifiedName(); if("java.lang.Object".equals(classType)){ return false; } if ("javax.activation.DataHandler".equals(classType)) { return true; } else { JClass supuerClass = clazz.getSuperclass(); if (supuerClass != null) { return isDataHandler(supuerClass); } else { return false; } } } protected void addContentToMethodSchemaType(XmlSchemaSequence sequence, QName schemaTypeName, String paraName, boolean isArray) { XmlSchemaElement elt1 = new XmlSchemaElement(); elt1.setName(paraName); elt1.setSchemaTypeName(schemaTypeName); if (sequence != null) { sequence.getItems().add(elt1); } if (isArray) { elt1.setMaxOccurs(Long.MAX_VALUE); } elt1.setMinOccurs(0); if (!("int".equals(schemaTypeName.getLocalPart()) || "double".equals(schemaTypeName.getLocalPart()) || "long".equals(schemaTypeName.getLocalPart()) || "boolean".equals(schemaTypeName.getLocalPart()) || "short".equals(schemaTypeName.getLocalPart()) || "float".equals(schemaTypeName.getLocalPart()) )) { elt1.setNillable(true); } } private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaElement globalElement = new XmlSchemaElement(); globalElement.setSchemaType(complexType); globalElement.setName(localPartName); globalElement.setQName(elementName); xmlSchema.getItems().add(globalElement); xmlSchema.getElements().add(elementName, globalElement); } typeTable.addComplexSchema(localPartName, elementName); return complexType; } private XmlSchemaComplexType createSchemaTypeForFault(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaElement globalElement = new XmlSchemaElement(); globalElement.setSchemaType(complexType); globalElement.setName(localPartName); globalElement.setQName(elementName); xmlSchema.getItems().add(globalElement); xmlSchema.getElements().add(elementName, globalElement); } return complexType; } protected XmlSchemaComplexType getComplexTypeForElement(XmlSchema xmlSchema, QName name) { Iterator iterator = xmlSchema.getItems().getIterator(); while (iterator.hasNext()) { XmlSchemaObject object = (XmlSchemaObject) iterator.next(); if (object instanceof XmlSchemaElement && ((XmlSchemaElement) object).getQName().equals(name)) { return (XmlSchemaComplexType) ((XmlSchemaElement) object).getSchemaType(); } } return null; } protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; } public TypeTable getTypeTable() { return typeTable; } public JMethod[] getMethods() { return methods; } protected String generatePrefix() { return NAME_SPACE_PREFIX + prefixCount++; } public void setExcludeMethods(ArrayList excludeMethods) { if (excludeMethods == null) excludeMethods = new ArrayList(); this.excludeMethods = excludeMethods; } public String getSchemaTargetNameSpace() { return schemaTargetNameSpace; } protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) { NamespacePrefixList map = xmlSchema.getNamespaceContext(); if (map == null || ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) || schemaTypeName == null){ return; } if (map instanceof NamespaceMap && !((NamespaceMap) map).values(). contains(schemaTypeName.getNamespaceURI())) { XmlSchemaImport importElement = new XmlSchemaImport(); importElement.setNamespace(schemaTypeName.getNamespaceURI()); xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), schemaTypeName.getNamespaceURI()); } } public String getAttrFormDefault() { return attrFormDefault; } public void setAttrFormDefault(String attrFormDefault) { this.attrFormDefault = attrFormDefault; } public String getElementFormDefault() { return elementFormDefault; } public void setElementFormDefault(String elementFormDefault) { this.elementFormDefault = elementFormDefault; } protected XmlSchemaForm getAttrFormDefaultSetting() { if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) { return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); } else { return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); } } protected XmlSchemaForm getElementFormDefaultSetting() { if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) { return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); } else { return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); } } public ArrayList getExtraClasses() { if (extraClasses == null) { extraClasses = new ArrayList(); } return extraClasses; } public void setExtraClasses(ArrayList extraClasses) { this.extraClasses = extraClasses; } protected String resolveSchemaNamespace(String packageName) throws Exception { //if all types must go into the wsdl types schema namespace if (useWSDLTypesNamespace) { //return schemaTargetNameSpace; return (String) pkg2nsmap.get("all"); } else { if (pkg2nsmap != null && !pkg2nsmap.isEmpty()) { //if types should go into namespaces that are mapped against the package name for the type if (pkg2nsmap.get(packageName) != null) { //return that mapping return (String) pkg2nsmap.get(packageName); } else { return getNsGen().schemaNamespaceFromPackageName(packageName).toString(); } } else { // if pkg2nsmap is null and if not default schema ns found for the custom bean return getNsGen().schemaNamespaceFromPackageName(packageName).toString(); } } } public boolean isUseWSDLTypesNamespace() { return useWSDLTypesNamespace; } public void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace) { this.useWSDLTypesNamespace = useWSDLTypesNamespace; } public Map getPkg2nsmap() { return pkg2nsmap; } public void setPkg2nsmap(Map pkg2nsmap) { this.pkg2nsmap = pkg2nsmap; } public String getTargetNamespace() { return targetNamespace; } protected String getSimpleName(JMethod method) { return Utils.getSimpleName(method); } protected String getSimpleName(JClass type) { String name = type.getSimpleName(); if (name.indexOf("$")>0){ name = name.replace('$','_'); } return name; } protected String getSimpleName(JProperty peroperty) { return peroperty.getSimpleName(); } protected String getSimpleName(JParameter parameter) { return parameter.getSimpleName(); } protected String getQualifiedName(JMethod method) { return method.getQualifiedName(); } protected String getActualQualifiedName(JClass type ) { return type.getQualifiedName(); } protected String getQualifiedName(JClass type) { String name = type.getQualifiedName(); if (name.indexOf("$")>0){ name = name.replace('$','_'); } return name; } protected String getQualifiedName(JProperty peroperty) { return peroperty.getQualifiedName(); } protected String getQualifiedName(JParameter parameter) { return parameter.getQualifiedName(); } protected String getQualifiedName(JPackage packagez) { return packagez.getQualifiedName(); } public void setNonRpcMethods(ArrayList nonRpcMethods) { if (nonRpcMethods != null) { this.nonRpcMethods = nonRpcMethods; } } public void setAxisService(AxisService service) { this.service = service; } public String getCustomSchemaLocation() { return customSchemaLocation; } public void setCustomSchemaLocation(String customSchemaLocation) { this.customSchemaLocation = customSchemaLocation; } public String getMappingFileLocation() { return mappingFileLocation; } public void setMappingFileLocation(String mappingFileLocation) { this.mappingFileLocation = mappingFileLocation; } } ./src/org/apache/axis2/description/java2wsdl/NamespaceGenerator.java0000664000175000017500000000235011767656530024660 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description.java2wsdl; /** * This interface must be implemented to provide custom implemtations for, * java package name to namespace mapping. An instance of this class is used by the schema generator * for generation namespaces * */ public interface NamespaceGenerator { public StringBuffer namespaceFromPackageName(String packageName); public StringBuffer schemaNamespaceFromPackageName(String packageName); } ./src/org/apache/axis2/description/MessageContextListener.java0000664000175000017500000000337011767656530023662 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; /** * A MessageContextListener is registered on the AxisService. * When a ServiceContext is attached to the MessageContext, * the attachServiceContextEvent is triggered. * When an Envelope is attached to the MessageContext, * the attachEnvelopeEvent is triggered. * * These two events occur at critical points in the message sending * or receiving. An implementation of the MessageContextListener * may log information, set special properties or trigger events. * * For example the JAXWS module uses a MessageContextListener to * register a JAXBCustomBuilder on the envelope's StAXOMBuilder. */ public interface MessageContextListener { public void attachServiceContextEvent(ServiceContext sc, MessageContext mc); public void attachEnvelopeEvent(MessageContext mc); } ./src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java0000664000175000017500000041406711767656530024127 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import com.ibm.wsdl.util.xml.DOM2Writer; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.EndpointReferenceHelper; import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.util.RESTUtil; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Constants; import org.apache.neethi.Policy; import org.apache.neethi.PolicyReference; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.wsdl.Binding; import javax.wsdl.BindingFault; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.OperationType; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.UnknownExtensibilityElement; import javax.wsdl.extensions.http.HTTPAddress; import javax.wsdl.extensions.http.HTTPBinding; import javax.wsdl.extensions.http.HTTPOperation; import javax.wsdl.extensions.mime.MIMEMultipartRelated; import javax.wsdl.extensions.mime.MIMEPart; import javax.wsdl.extensions.schema.Schema; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap.SOAPBinding; import javax.wsdl.extensions.soap.SOAPBody; import javax.wsdl.extensions.soap.SOAPHeader; import javax.wsdl.extensions.soap.SOAPOperation; import javax.wsdl.extensions.soap12.SOAP12Address; import javax.wsdl.extensions.soap12.SOAP12Binding; import javax.wsdl.extensions.soap12.SOAP12Body; import javax.wsdl.extensions.soap12.SOAP12Header; import javax.wsdl.extensions.soap12.SOAP12Operation; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLLocator; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.Vector; public class WSDL11ToAxisServiceBuilder extends WSDLToAxisServiceBuilder { public static final int COMPONENT_PORT_TYPE = 1; public static final int COMPONENT_MESSAGE = 2; public static final int COMPONENT_BINDING = 3; protected static final Log log = LogFactory .getLog(WSDL11ToAxisServiceBuilder.class); private static final boolean isTraceEnabled = log.isTraceEnabled(); protected String portName; private static final String BINDING = "Binding"; private static final String SERVICE = "Service"; private static final String PORT = "Port"; private static final String PORT_TYPE = "PortType"; private static final String PORT_TYPE_OPERATION = "PortType.Operation"; private static final String PORT_TYPE_OPERATION_INPUT = "PortType.Operation.Input"; private static final String PORT_TYPE_OPERATION_OUTPUT = "PortType.Operation.Output"; private static final String PORT_TYPE_OPERATION_FAULT = "PortType.Operation.Fault"; private static final String BINDING_OPERATION = "Binding.Operation"; private static final String BINDING_OPERATION_INPUT = "Binding.Operation.Input"; private static final String BINDING_OPERATION_OUTPUT = "Binding.Operation.Output"; protected Definition wsdl4jDefinition = null; protected String wsdlBaseDocumentURI = null; private WSDLLocator customWSDLResolver; public static final String RPC_STYLE = "rpc"; public static final String DOCUMENT_STYLE = "document"; public static final String ENCODED_USE = "encoded"; /** * List of BindingOperationEntry objects. * Each object in the list may require a wrapped schema element for * the input/output or both. */ private List wrappableBOEs = new ArrayList(); // used to keep the binding type of the selected binding private String bindingType; public static final String WRAPPED_OUTPUTNAME_SUFFIX = "Response"; public static final String XML_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/"; public static final String NAMESPACE_DECLARATION_PREFIX = "xmlns:"; private static int prefixCounter = 0; public static final String NAMESPACE_URI = "namespace"; public static final String TRAGET_NAMESPACE = "targetNamespace"; public static final String BINDING_TYPE_SOAP = "soap"; public static final String BINDING_TYPE_HTTP = "http"; /** * keep track of whether setup code related to the entire wsdl is complete. * Note that WSDL11ToAllAxisServices will call setup multiple times, so this * field is used to make subsequent calls no-ops. */ private boolean setupComplete = false; private Map schemaMap = null; private static final String JAVAX_WSDL_VERBOSE_MODE_KEY = "javax.wsdl.verbose"; // As bindings are processed add it to this array so that we dont process the same binding twice private Map processedBindings; private boolean isAllPorts; /** * constructor taking in the service name and the port name * * @param in - InputStream for the WSDL * @param serviceName - The service Name * @param portName - The port name */ public WSDL11ToAxisServiceBuilder(InputStream in, QName serviceName, String portName) { super(in, serviceName); this.portName = portName; } /** * @param def - The WSDL4J Definition object * @param serviceName - The service Name * @param portName - The port name */ public WSDL11ToAxisServiceBuilder(Definition def, QName serviceName, String portName) { super(null, serviceName); this.wsdl4jDefinition = def; this.portName = portName; this.isAllPorts = false; } /** * @param def - The WSDL4J Definition object * @param serviceName - The service Name * @param portName - The port name * @param isAllPorts - boolean representing whether to generate code for all ports or not */ public WSDL11ToAxisServiceBuilder(Definition def, QName serviceName, String portName, boolean isAllPorts) { this(def, serviceName, portName); this.isAllPorts = isAllPorts; } /** * @param in * @param service */ public WSDL11ToAxisServiceBuilder(InputStream in, AxisService service) { super(in, service); } /** * @param in */ public WSDL11ToAxisServiceBuilder(InputStream in) { this(in, null, null); } /** * @deprecated * @see setCustomWSDLResolver */ public void setCustomWSLD4JResolver(WSDLLocator customResolver) { setCustomWSDLResolver(customResolver); } /** * sets a custom WSDL locator * * @param customResolver */ public void setCustomWSDLResolver(WSDLLocator customResolver) { this.customWSDLResolver = customResolver; setDocumentBaseUri(this.customWSDLResolver.getBaseURI()); } /** * Sets the URI to the base document associated with the WSDL definition. * This identifies the origin of the Definition and allows the * Definition to be reloaded. Note that this is the URI of the base * document, not the imports. * * @param baseUri */ public void setDocumentBaseUri(String baseUri) { if (wsdl4jDefinition != null) { wsdl4jDefinition.setDocumentBaseURI(baseUri); } wsdlBaseDocumentURI = baseUri; } /** * Gets the URI to the base document associated with the WSDL definition. * This identifies the origin of the Definition and allows the * Definition to be reloaded. Note that this is the URI of the base * document, not the imports. * */ public String getDocumentBaseUri() { return wsdlBaseDocumentURI; } /** * Populates a given service. * * @throws AxisFault */ public AxisService populateService() throws AxisFault { try { setup(); // NOTE: set the axisService with the Parameter for the WSDL // Definition after the rest of the work if (wsdl4jDefinition == null) { return null; } // setting target name space axisService.setTargetNamespace(wsdl4jDefinition.getTargetNamespace()); axisService.setNamespaceMap(new NamespaceMap(wsdl4jDefinition.getNamespaces())); Map importsMap = wsdl4jDefinition.getImports(); if (importsMap != null) { List imports = new ArrayList(importsMap.keySet()); axisService.setImportedNamespaces(imports); } //TODO : find the service also in imported wsdls Service wsdl4jService = findService(wsdl4jDefinition); Binding binding = findBinding(wsdl4jDefinition, wsdl4jService); Definition bindingWSDL = getParentDefinition(wsdl4jDefinition, binding.getQName(), COMPONENT_BINDING, new HashSet()); Definition portTypeWSDL = getParentDefinition(bindingWSDL, binding.getPortType().getQName(), COMPONENT_PORT_TYPE, new HashSet()); PortType portType = portTypeWSDL.getPortType(binding.getPortType().getQName()); if (portType == null) { throw new AxisFault("There is no port type associated with the binding"); } // create new Schema extensions element for wrapping // (if its present) Element[] schemaElements = generateWrapperSchema(schemaMap, binding, portType); processTypes(wsdl4jDefinition, axisService); // add the newly created schemas if (schemaElements != null && schemaElements.length > 0) { for (int i = 0; i < schemaElements.length; i++) { Element schemaElement = schemaElements[i]; if (schemaElement != null) { axisService.addSchema(getXMLSchema(schemaElement, null)); } } } // copy the documentation element content to the description Element documentationElement = wsdl4jDefinition.getDocumentationElement(); addDocumentation(axisService, documentationElement); axisService.setName(wsdl4jService.getQName().getLocalPart()); populateEndpoints(binding, bindingWSDL,wsdl4jService, portType, portTypeWSDL); processPoliciesInDefintion(wsdl4jDefinition); axisService.getPolicyInclude().setPolicyRegistry(registry); // Setting wsdl4jdefintion to the axisService parameter include list, // so if someone needs to use the definition directly, // he can do that by getting the parameter Parameter wsdlDefinitionParameter = new Parameter(); wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION); if (!(wsdl4jDefinition instanceof WSDLDefinitionWrapper)) { AxisConfiguration ac = axisService.getAxisConfiguration(); if (ac == null) { ac = this.axisConfig; } WSDLDefinitionWrapper wrapper = new WSDLDefinitionWrapper(wsdl4jDefinition, ac); wsdlDefinitionParameter.setValue(wrapper); } else { wsdlDefinitionParameter.setValue(wsdl4jDefinition); } axisService.addParameter(wsdlDefinitionParameter); axisService.setWsdlFound(true); axisService.setCustomWsdl(true); return axisService; } catch (WSDLException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } catch (Exception e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } } private void processTypes(Definition wsdlDefinition, AxisService axisService) throws AxisFault { processTypes(wsdlDefinition, axisService, new HashSet()); } private void processTypes(Definition wsdlDefinition, AxisService axisService, Set visitedWSDLs) throws AxisFault { visitedWSDLs.add(wsdlDefinition.getDocumentBaseURI()); // process all the types in all the wsdls Types types = wsdlDefinition.getTypes(); if (types != null) { copyExtensibleElements(types.getExtensibilityElements(), wsdlDefinition, axisService, TYPES); } // process the types in other wsdls Iterator iter = wsdlDefinition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); // process the types recuresiveilt Definition innerDefinition = wsdlImport.getDefinition(); if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())){ processTypes(innerDefinition, axisService, visitedWSDLs); } } } } private void addDocumentation(AxisDescription axisDescription, Element documentationElement) { if ((documentationElement != null) && (documentationElement.getFirstChild() != null)) { Node firstChild = documentationElement.getFirstChild(); String documentation = DOM2Writer.nodeToString(firstChild); if (!"".equals(documentation)) { axisDescription.setDocumentation(documentation); } } } /** * @param binding * @param wsdl4jService must have atlease one port * @throws AxisFault */ private void populateEndpoints(Binding binding, Definition bindingWSDL, Service wsdl4jService, PortType portType, Definition portTypeWSDL) throws AxisFault { Map wsdl4jPorts = wsdl4jService.getPorts(); QName bindingName = binding.getQName(); Port port; AxisEndpoint axisEndpoint = null; processedBindings = new HashMap(); // process the port type for this binding // although we support multiports they must be belongs to same port type and should have the // same soap style populatePortType(portType, portTypeWSDL); Binding currentBinding; Definition currentBindingWSDL = null; for (Iterator iterator = wsdl4jPorts.values().iterator(); iterator.hasNext();) { port = (Port) iterator.next(); // if the user has picked a port then we have to process only that port if ((this.portName == null) || (this.portName.equals(port.getName()))) { // we process the port only if it has the same port type as the selected binding currentBindingWSDL = getParentDefinition(wsdl4jDefinition, port.getBinding().getQName(), COMPONENT_BINDING, new HashSet()); currentBinding = currentBindingWSDL.getBinding(port.getBinding().getQName()); if (currentBinding.getPortType().getQName().equals(binding.getPortType().getQName())) { axisEndpoint = new AxisEndpoint(); axisEndpoint.setName(port.getName()); if (axisService.getEndpointName() == null && bindingName.equals(port.getBinding().getQName())) { populateEndpoint(axisEndpoint, port, currentBinding, bindingWSDL, portType, portTypeWSDL, true); axisService.setEndpointName(axisEndpoint.getName()); axisService.setBindingName(axisEndpoint.getBinding().getName().getLocalPart()); } else { populateEndpoint(axisEndpoint, port, currentBinding, bindingWSDL, portType, portTypeWSDL, false); } axisEndpoint.setParent(axisService); axisService.addEndpoint(port.getName(), axisEndpoint); } } } } /** * setting message qname is a binding dependent process for an example message element depends on the * soap style (rpc or document) and parts elememet of the soap body * On the otherhand we keep only one set of axis operations belongs to a selected port type in axis service * So setting qname refetences done only with the selected binding processing * * @param axisEndpoint * @param wsdl4jPort * @param isSetMessageQNames * @throws AxisFault */ private void populateEndpoint(AxisEndpoint axisEndpoint, Port wsdl4jPort, Binding wsdl4jBinding, Definition bindingWSDL, PortType portType, Definition portTypeWSDL, boolean isSetMessageQNames) throws AxisFault { copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdl4jDefinition, axisEndpoint, BINDING); processEmbeddedEPR(wsdl4jPort.getExtensibilityElements(), axisEndpoint); addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement()); if (processedBindings.containsKey(wsdl4jBinding.getQName())) { axisEndpoint.setBinding( (AxisBinding) processedBindings.get(wsdl4jBinding.getQName())); } else { AxisBinding axisBinding = new AxisBinding(); axisBinding.setName(wsdl4jBinding.getQName()); axisBinding.setParent(axisEndpoint); axisEndpoint.setBinding(axisBinding); axisBinding.setParent(axisEndpoint); populateBinding(axisBinding, wsdl4jBinding, bindingWSDL, portType, portTypeWSDL, isSetMessageQNames); processedBindings.put(wsdl4jBinding.getQName(), axisBinding); } } private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint) { Iterator eelts = extensibilityElements.iterator(); while(eelts.hasNext()){ ExtensibilityElement ee = (ExtensibilityElement)eelts.next(); if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){ try { Element elt = ((UnknownExtensibilityElement)ee).getElement(); OMElement eprOMElement = XMLUtils.toOM(elt); EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement); Map referenceParameters = epr.getAllReferenceParameters(); if(referenceParameters != null){ axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new ArrayList(referenceParameters.values())); } } catch (Exception e) { if(log.isDebugEnabled()){ log.debug("Exception encountered processing embedded wsa:EndpointReference", e); } } } } } private void populatePortType(PortType wsdl4jPortType, Definition portTypeWSDL) throws AxisFault { copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(), axisService, PORT_TYPE); List wsdl4jOperations = wsdl4jPortType.getOperations(); // Added to use in ?wsdl2 as the interface name axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME, wsdl4jPortType.getQName().getLocalPart())); if (wsdl4jOperations.size() < 1) { throw new AxisFault("No operation found in the portType element"); } AxisOperation axisOperation; List operationNames = new ArrayList(); QName opName; Operation wsdl4jOperation; for (Iterator iterator = wsdl4jOperations.iterator(); iterator.hasNext();) { wsdl4jOperation = (Operation) iterator.next(); axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, portTypeWSDL); addDocumentation(axisOperation, wsdl4jOperation.getDocumentationElement()); axisOperation.setParent(axisService); axisService.addChild(axisOperation); operationNames.add(axisOperation.getName()); } // this is used only in codegen to preserve operation order if (isCodegen) { axisService.setOperationsNameList(operationNames); } } private void populateBinding(AxisBinding axisBinding, Binding wsdl4jBinding, Definition bindingWSDL, PortType portType, Definition portTypeWSDL, boolean isSetMessageQNames) throws AxisFault { copyExtensibleElements(wsdl4jBinding.getExtensibilityElements(), bindingWSDL, axisBinding, BINDING); List wsdl4jBidingOperations = wsdl4jBinding.getBindingOperations(); if (wsdl4jBidingOperations.size() < 1) { throw new AxisFault("No operation found for the binding"); } addDocumentation(axisBinding, wsdl4jBinding.getDocumentationElement()); AxisOperation axisOperation; Operation wsdl4jOperation; AxisBindingOperation axisBindingOperation; BindingOperation wsdl4jBindingOperation; Map httpLocationMap = new TreeMap(); String httpLocation = null; for (Iterator iterator = wsdl4jBidingOperations.iterator(); iterator.hasNext();) { axisBindingOperation = new AxisBindingOperation(); wsdl4jBindingOperation = (BindingOperation) iterator.next(); wsdl4jOperation = findOperation(portType, wsdl4jBindingOperation); axisBindingOperation.setName(new QName(bindingWSDL.getTargetNamespace(), wsdl4jBindingOperation.getName())); addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement()); axisOperation = axisService.getOperation(new QName(portTypeWSDL.getTargetNamespace(), wsdl4jOperation.getName())); axisBindingOperation.setAxisOperation(axisOperation); // process ExtensibilityElements of the wsdl4jBinding copyExtensibleElements(wsdl4jBindingOperation.getExtensibilityElements(), wsdl4jDefinition, axisBindingOperation, BINDING_OPERATION); httpLocation = (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION); String httpMethod = (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD); if (httpMethod == null || "".equals(httpMethod)) { httpMethod = HTTPConstants.HEADER_POST; } if (httpLocation != null) { httpLocationMap.put(RESTUtil.getConstantFromHTTPLocation(httpLocation, httpMethod), axisBindingOperation.getAxisOperation()); } BindingInput wsdl4jBindingInput = wsdl4jBindingOperation.getBindingInput(); if (wsdl4jBindingInput != null && WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) { AxisBindingMessage axisBindingInMessage = new AxisBindingMessage(); addDocumentation(axisBindingInMessage, wsdl4jBindingInput.getDocumentationElement()); copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(), wsdl4jDefinition, axisBindingInMessage, BINDING_OPERATION_INPUT); AxisMessage axisInMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); //This is a hack to get AXIS2-2771 working , I had to copy soap headers // from binding message to AxisMessage List soapHeaders = (List) axisBindingInMessage.getProperty( WSDL2Constants.ATTR_WSOAP_HEADER); if (soapHeaders != null) { for (int i = 0; i < soapHeaders.size(); i++) { SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i); axisInMessage.addSoapHeader(headerMessage); } } if (isSetMessageQNames) { BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation); boolean isWrapped = (boe == null) ? false : boe.isWrappedInput(); addQNameReference(axisInMessage, wsdl4jOperation, wsdl4jBindingInput, isWrapped); } axisBindingInMessage.setAxisMessage(axisInMessage); axisBindingInMessage.setName(axisInMessage.getName()); axisBindingInMessage.setDirection(axisInMessage.getDirection()); axisBindingInMessage.setParent(axisBindingOperation); axisBindingOperation .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisBindingInMessage); } BindingOutput wsdl4jBindingOutput = wsdl4jBindingOperation.getBindingOutput(); if (wsdl4jBindingOutput != null && WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())) { AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage(); addDocumentation(axisBindingOutMessage, wsdl4jBindingOutput.getDocumentationElement()); AxisMessage axisOutMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); copyExtensibleElements(wsdl4jBindingOutput.getExtensibilityElements(), wsdl4jDefinition, axisBindingOutMessage, BINDING_OPERATION_OUTPUT); //This is a hack to get AXIS2-2771 working , I had to copy soap headers // from binding message to AxisMessage List soapHeaders = (List) axisBindingOutMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER); if (soapHeaders != null) { for (int i = 0; i < soapHeaders.size(); i++) { SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i); axisOutMessage.addSoapHeader(headerMessage); } } if (isSetMessageQNames) { BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation); boolean isWrapped = (boe == null) ? false : boe.isWrappedOutput(); addQNameReference(axisOutMessage, wsdl4jOperation, wsdl4jBindingOutput, isWrapped); } axisBindingOutMessage.setAxisMessage(axisOutMessage); axisBindingOutMessage.setName(axisOutMessage.getName()); axisBindingOutMessage.setDirection(axisOutMessage.getDirection()); axisBindingOutMessage.setParent(axisBindingOperation); axisBindingOperation .addChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisBindingOutMessage); } Map bindingFaultsMap = wsdl4jBindingOperation.getBindingFaults(); /* process the binding faults */ for (Iterator bindingFaults = bindingFaultsMap.values().iterator(); bindingFaults.hasNext();) { BindingFault bindingFault = (BindingFault) bindingFaults.next(); if (bindingFault.getName() == null) { throw new AxisFault("Binding name is null for the binding fault in " + " binding operation ==> " + wsdl4jBindingOperation.getName()); } else { Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName()); if (wsdl4jFault == null){ throw new AxisFault("Can not find the corresponding fault element in " + "wsdl operation " + wsdl4jOperation.getName() + " for the fault" + " name " + bindingFault.getName()); } else { Message wsdl4jFaultMessge = wsdl4jFault.getMessage(); AxisMessage faultMessage = findFaultMessage( wsdl4jFaultMessge.getQName().getLocalPart(), axisOperation.getFaultMessages()); AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage(); axisBindingFaultMessage.setName(faultMessage.getName()); addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement()); axisBindingFaultMessage.setFault(true); axisBindingFaultMessage.setAxisMessage(faultMessage); axisBindingFaultMessage.setParent(axisBindingOperation); axisBindingOperation.addFault(axisBindingFaultMessage); if (isSetMessageQNames) { addQNameReference(faultMessage, wsdl4jFault.getMessage()); } } } } axisBindingOperation.setParent(axisBinding); axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); } axisBinding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationMap); } /** * contains all code which gathers non-service specific information from the * wsdl.

        After all the setup completes successfully, the setupComplete * field is set so that any subsequent calls to setup() will result in a * no-op. Note that subclass WSDL11ToAllAxisServicesBuilder will call * populateService for each port in the WSDL. Separating the non-service * specific information here allows WSDL11ToAllAxisServicesBuilder to only * do this work 1 time per WSDL, instead of for each port on each service. * * @throws WSDLException if readInTheWSDLFile fails */ protected void setup() throws WSDLException { if (setupComplete) { // already setup, just do nothing and return return; } if (wsdl4jDefinition == null) { wsdl4jDefinition = readInTheWSDLFile(in); } if (wsdl4jDefinition == null) { return; // can't continue without wsdl } // setup the schemaMap this.schemaMap = new HashMap(); populateSchemaMap(wsdl4jDefinition, new HashSet()); setPolicyRegistryFromService(axisService); setupComplete = true; // if any part of setup fails, don't mark // setupComplete } /** * Populate a map of targetNamespace vs DOM schema element This is used to * grab the correct schema element when adding a new element * * @param definition */ private void populateSchemaMap(Definition definition, Set visitedWSDLs) { visitedWSDLs.add(definition.getDocumentBaseURI()); // first process the types in the given wsdl Types types = definition.getTypes(); Object extensibilityElement; if (types != null) { for (Iterator iterator = types.getExtensibilityElements().iterator(); iterator.hasNext();) { extensibilityElement = iterator.next(); if (extensibilityElement instanceof Schema) { Element schemaElement = ((Schema) extensibilityElement).getElement(); schemaMap.put(schemaElement.getAttribute(XSD_TARGETNAMESPACE), schemaElement); } } } // popualte the imports as well Iterator iter = definition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); Definition innerDefinition = wsdlImport.getDefinition(); if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) { populateSchemaMap(innerDefinition, visitedWSDLs); } } } } /** * return the service to process * if user has specified we check whether it exists * else pick a random service and throws an exception if not found any thing * * @param definition * @return service to process * @throws AxisFault */ private Service findService(Definition definition) throws AxisFault { Map services = definition.getServices(); Service service = null; if (serviceName != null) { // i.e if a user has specified a pirticular port service = (Service) services.get(serviceName); if (service == null) { throw new AxisFault("Service " + serviceName + " was not found in the WSDL"); } } else { if (services.size() > 0) { for (Iterator iter = services.values().iterator(); iter.hasNext();) { service = (Service) iter.next(); if (service.getPorts().size() > 0) { //i.e we have found a service with ports break; } } if ((service == null) || (service.getPorts().size() == 0)) { throw new AxisFault("there is no service with ports to pick"); } } else { throw new AxisFault("No service was not found in the WSDL at " + definition.getDocumentBaseURI() + " with targetnamespace " + definition.getTargetNamespace()); } } return service; } /** * Look for the relevant binding! * if user has spcifed a port get it * otherwise find first soap port or pick random one if there is no soap port * * @param dif * @param service service can not be null * @throws AxisFault */ private Binding findBinding(Definition dif, Service service) throws AxisFault { Binding binding = null; Port port = null; copyExtensibleElements(service.getExtensibilityElements(), dif, axisService, SERVICE); if (portName != null) { // i.e if user has specified a service port = service.getPort(portName); if (port == null) { throw new AxisFault("No port found for the given name :" + portName); } } else { Map ports = service.getPorts(); if (ports != null && ports.size() > 0) { // pick the port with the SOAP address as the default port port = findPort(ports); if (port == null) { // a SOAP port was not found - log a warning // and use the first port in the list log.info("A SOAP port was not found - " + "picking a random port!"); port = (Port) ports.values().toArray()[0]; } if (port != null) { // i.e we have find a correct port // this is only use full in codegen time. if (this.isCodegen && !this.isAllPorts) { // if user has not set all option // we have to generate code only for that option. this.portName = port.getName(); } } } } axisService.setName(service.getQName().getLocalPart()); if (port != null) { copyExtensibleElements(port.getExtensibilityElements(), dif, axisService, PORT); Definition parentDefinition = getParentDefinition(dif, port.getBinding().getQName(), COMPONENT_BINDING, new HashSet()); binding = parentDefinition.getBinding(port.getBinding().getQName()); if (binding == null) { binding = port.getBinding(); } } return binding; } /** * Finds a SOAP port given the port map */ private Port findPort(Map ports) { Port port; Port returnPort = null; for (Iterator portsIterator = ports.values().iterator(); portsIterator.hasNext();) { port = (Port) portsIterator.next(); List extensibilityElements = port.getExtensibilityElements(); for (int i = 0; i < extensibilityElements.size(); i++) { Object extElement = extensibilityElements.get(i); if (extElement instanceof SOAP12Address) { // SOAP 1.2 address found - keep this and loop until http address is found returnPort = port; String location = ((SOAP12Address)extElement).getLocationURI().trim(); if ((location != null) && location.startsWith("http:")){ // i.e we have found an http port so return from here break; } } } } if (returnPort != null){ return returnPort; } for (Iterator portsIterator = ports.values().iterator(); portsIterator .hasNext();) { port = (Port) portsIterator.next(); List extensibilityElements = port.getExtensibilityElements(); for (int i = 0; i < extensibilityElements.size(); i++) { Object extElement = extensibilityElements.get(i); if (extElement instanceof SOAPAddress) { // SOAP 1.1 address found - keep this and loop until http address is found returnPort = port; String location = ((SOAPAddress)extElement).getLocationURI().trim(); if ((location != null) && location.startsWith("http:")){ // i.e we have found an http port so return from here break; } } } } if (returnPort != null){ return returnPort; } for (Iterator portsIterator = ports.values().iterator(); portsIterator .hasNext();) { port = (Port) portsIterator.next(); List extensibilityElements = port.getExtensibilityElements(); for (int i = 0; i < extensibilityElements.size(); i++) { Object extElement = extensibilityElements.get(i); if (extElement instanceof HTTPAddress) { // HTTP address found - keep this and loop until http address is found returnPort = port; String location = ((HTTPAddress)extElement).getLocationURI().trim(); if ((location != null) && location.startsWith("http:")){ // i.e we have found an http port so return from here break; } } } } return returnPort; } private Operation findOperation(PortType portType, BindingOperation wsdl4jBindingOperation) { Operation op = wsdl4jBindingOperation.getOperation(); String input = null; if (op != null && op.getInput() != null) { input = op.getInput().getName(); if (":none".equals(input)) { input = null; } } String output = null; if (op != null && op.getOutput() != null) { output = op.getOutput().getName(); if (":none".equals(output)) { output = null; } } Operation op2 = portType.getOperation(op.getName(), input, output); return ((op2 == null) ? op : op2); } /** * Find the fault message relevant to a given name from the fault message * list * * @param name * @param faultMessages */ private AxisMessage findFaultMessage(String name, ArrayList faultMessages) { AxisMessage tempMessage; for (int i = 0; i < faultMessages.size(); i++) { tempMessage = (AxisMessage) faultMessages.get(i); if (name.equals(tempMessage.getName())) { return tempMessage; } } return null; } /** * Add the QName for the binding input * * @param inMessage * @param wsdl4jOperation * @param bindingInput * @param isWrapped - basically whether the operation is soap/rpc or not */ private void addQNameReference(AxisMessage inMessage, Operation wsdl4jOperation, BindingInput bindingInput, boolean isWrapped) { List extensibilityElements = bindingInput.getExtensibilityElements(); Message wsdl4jMessage = wsdl4jOperation.getInput().getMessage(); addQNameReference(inMessage, wsdl4jOperation, isWrapped, extensibilityElements, wsdl4jMessage, wsdl4jOperation.getName()); } /** * Add the QName for the binding output * * @param outMessage * @param wsdl4jOperation * @param isWrapped */ private void addQNameReference(AxisMessage outMessage, Operation wsdl4jOperation, BindingOutput bindingOutput, boolean isWrapped) { if (bindingOutput != null) { List extensibilityElements = bindingOutput.getExtensibilityElements(); if (wsdl4jOperation.getOutput() == null) { return; } Message wsdl4jMessage = wsdl4jOperation.getOutput().getMessage(); addQNameReference(outMessage, wsdl4jOperation, isWrapped, extensibilityElements, wsdl4jMessage, wsdl4jOperation.getName() + WRAPPED_OUTPUTNAME_SUFFIX); } } private void addQNameReference(AxisMessage message, Operation wsdl4jOperation, boolean isWrapped, List extensibilityElements, Message wsdl4jMessage, String rpcOperationName) { if (isWrapped) { // we have already validated and process the qname references // so set it here // The schema for this should be already made ! Find the // QName from // the list and add it - the name for this is just the message.setElementQName((QName) resolvedRpcWrappedElementMap .get(rpcOperationName)); message.getAxisOperation().getAxisService().addMessageElementQNameToOperationMapping( (QName) resolvedRpcWrappedElementMap.get(rpcOperationName), message.getAxisOperation()); } else { // now we are sure this is an document literal type element List bindingPartsList = getPartsListFromSoapBody(extensibilityElements); if (bindingPartsList == null) { // i.e user has not given any part list so we go to message and pick the firest part if // available if ((wsdl4jMessage.getParts() != null) && (wsdl4jMessage.getParts().size() > 0)) { if (wsdl4jMessage.getParts().size() == 1) { Part part = (Part) wsdl4jMessage.getParts().values().iterator().next(); QName elementName = part.getElementName(); if (elementName != null) { message.setElementQName(elementName); message.setMessagePartName(part.getName()); AxisOperation operation = message.getAxisOperation(); AxisService service = operation.getAxisService(); service.addMessageElementQNameToOperationMapping(elementName, operation); } else { throw new WSDLProcessingException( "No element type is defined for message " + wsdl4jMessage.getQName().getLocalPart()); } } else { // user has specified more than one parts with out specifing a part in // soap body throw new WSDLProcessingException("More than one part for message " + wsdl4jMessage.getQName().getLocalPart()); } } else { // this is allowed in the spec in this case element qname is null and nothing is send // in the soap body message.setElementQName(null); } } else { if (bindingPartsList.size() == 0) { // we donot have to set the element qname message.setElementQName(null); } else if (bindingPartsList.size() == 1) { Part part = wsdl4jMessage.getPart((String) bindingPartsList.get(0)); if (part != null) { QName elementName = part.getElementName(); if (elementName != null) { message.setElementQName(elementName); message.setMessagePartName(part.getName()); AxisOperation operation = message.getAxisOperation(); AxisService service = operation.getAxisService(); service.addMessageElementQNameToOperationMapping(elementName, operation); } else { throw new WSDLProcessingException( "No element type is defined for message" + wsdl4jMessage.getQName().getLocalPart()); } } else { throw new WSDLProcessingException("Missing part named " + bindingPartsList.get(0) + " "); } } else { // i.e more than one part specified in this case we have // to send an exception throw new WSDLProcessingException( "More than one element part is not allwed in document literal " + " type binding operation " + wsdl4jOperation.getName()); } } } } /** * Add the QName for the binding output */ private void addQNameReference(AxisMessage faultMessage, Message wsdl4jMessage) throws AxisFault { // for a fault this is trivial - All faults are related directly to a // message by the name and are supposed to have a single part. So it is // a matter of copying the right QName from the message part // get the part Map parts = wsdl4jMessage.getParts(); if (parts == null || parts.size() == 0) { String message = "There are no parts" + " for fault message : " + wsdl4jMessage.getQName(); log.error(message); throw new WSDLProcessingException(message); } Part wsdl4jMessagePart = (Part) parts.values() .toArray()[0]; if (wsdl4jMessagePart == null) { throw new WSDLProcessingException(); } QName name = wsdl4jMessagePart.getElementName(); if (name == null) { String message = "Part '" + wsdl4jMessagePart.getName() + "' of fault message '" + wsdl4jMessage.getQName() + "' must be defined with 'element=QName' and not 'type=QName'"; log.error(message); throw new AxisFault(message); } faultMessage.setMessagePartName(wsdl4jMessagePart.getName()); faultMessage.setElementQName(name); } /** * A util method that returns the SOAP style included in the binding * operation * * @param bindingOp */ private String getSOAPStyle(BindingOperation bindingOp) { List extensibilityElements = bindingOp.getExtensibilityElements(); for (int i = 0; i < extensibilityElements.size(); i++) { Object extElement = extensibilityElements.get(i); if (extElement instanceof SOAPOperation) { return ((SOAPOperation) extElement).getStyle(); } else if (extElement instanceof SOAP12Operation) { return ((SOAP12Operation) extElement).getStyle(); } } return null; } /** * Copy the component from the operation * * @param wsdl4jOperation * @param dif * @throws AxisFault */ private AxisOperation populateOperations(Operation wsdl4jOperation, PortType wsdl4jPortType, Definition dif) throws AxisFault { QName opName = new QName(dif.getTargetNamespace(), wsdl4jOperation.getName()); // Copy Name Attribute AxisOperation axisOperation = axisService.getOperation(opName); if (axisOperation == null) { String MEP = getMEP(wsdl4jOperation); axisOperation = AxisOperationFactory.getOperationDescription(MEP); axisOperation.setName(opName); // setting the PolicyInclude property of the AxisOperation PolicyInclude policyInclude = new PolicyInclude(axisOperation); axisOperation.setPolicyInclude(policyInclude); } copyExtensionAttributes(wsdl4jOperation.getExtensionAttributes(), axisOperation, PORT_TYPE_OPERATION); //copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(), // axisService, PORT_TYPE); Input wsdl4jInputMessage = wsdl4jOperation.getInput(); if (isServerSide) { if (null != wsdl4jInputMessage) { AxisMessage inMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); Message message = wsdl4jInputMessage.getMessage(); if (null != message) { inMessage.setName(message.getQName().getLocalPart()); copyExtensionAttributes(wsdl4jInputMessage.getExtensionAttributes(), inMessage, PORT_TYPE_OPERATION_INPUT); } // Check if the action is already set as we don't want to // override it // with the Default Action Pattern ArrayList inputActions = axisOperation.getWSAMappingList(); String action = null; if (inputActions == null || inputActions.size() == 0) { action = WSDL11ActionHelper .getActionFromInputElement(dif, wsdl4jPortType, wsdl4jOperation, wsdl4jInputMessage); } if (action != null) { if (inputActions == null) { inputActions = new ArrayList(); axisOperation.setWsamappingList(inputActions); } inputActions.add(action); axisService.mapActionToOperation(action, axisOperation); } } // Create an output message and add Output wsdl4jOutputMessage = wsdl4jOperation.getOutput(); if (null != wsdl4jOutputMessage) { AxisMessage outMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); Message message = wsdl4jOutputMessage.getMessage(); if (null != message) { outMessage.setName(message.getQName().getLocalPart()); copyExtensionAttributes(wsdl4jOutputMessage.getExtensionAttributes(), outMessage, PORT_TYPE_OPERATION_OUTPUT); // wsdl:portType -> wsdl:operation -> wsdl:output } // Check if the action is already set as we don't want to // override it // with the Default Action Pattern String action = axisOperation.getOutputAction(); if (action == null) { action = WSDL11ActionHelper.getActionFromOutputElement(dif, wsdl4jPortType, wsdl4jOperation, wsdl4jOutputMessage); } if (action != null) { axisOperation.setOutputAction(action); } } } else { // for the client side we have to do something that is a bit // weird. The in message is actually taken from the output // and the output is taken from the in if (null != wsdl4jInputMessage) { AxisMessage inMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); Message message = wsdl4jInputMessage.getMessage(); if (null != message) { inMessage.setName(message.getQName().getLocalPart()); copyExtensionAttributes(wsdl4jInputMessage.getExtensionAttributes(), inMessage, PORT_TYPE_OPERATION_OUTPUT); } // Check if the action is already set as we don't want to // override it // with the Default Action Pattern String action = axisOperation.getOutputAction(); if (action == null) { action = WSDL11ActionHelper .getActionFromInputElement(dif, wsdl4jPortType, wsdl4jOperation, wsdl4jInputMessage); } if (action != null) { axisOperation.setOutputAction(action); } } // Create an output message and add Output wsdl4jOutputMessage = wsdl4jOperation.getOutput(); if (null != wsdl4jOutputMessage) { AxisMessage outMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); Message message = wsdl4jOutputMessage.getMessage(); if (null != message) { outMessage.setName(message.getQName().getLocalPart()); copyExtensionAttributes(wsdl4jOutputMessage.getExtensionAttributes(), outMessage, PORT_TYPE_OPERATION_INPUT); // wsdl:portType -> wsdl:operation -> wsdl:output } // Check if the action is already set as we don't want to // override it // with the Default Action Pattern ArrayList inputActions = axisOperation.getWSAMappingList(); String action = null; if (inputActions == null || inputActions.size() == 0) { action = WSDL11ActionHelper.getActionFromOutputElement(dif, wsdl4jPortType, wsdl4jOperation, wsdl4jOutputMessage); } if (action != null) { if (inputActions == null) { inputActions = new ArrayList(); axisOperation.setWsamappingList(inputActions); } inputActions.add(action); } } } Map faults = wsdl4jOperation.getFaults(); Iterator faultKeyIterator = faults.keySet().iterator(); while (faultKeyIterator.hasNext()) { Fault fault = (Fault) faults.get(faultKeyIterator.next()); AxisMessage axisFaultMessage = new AxisMessage(); addDocumentation(axisFaultMessage,fault.getDocumentationElement()); Message faultMessage = fault.getMessage(); if (null != faultMessage) { axisFaultMessage .setName(faultMessage.getQName().getLocalPart()); copyExtensibleElements(faultMessage.getExtensibilityElements(), dif, axisFaultMessage, PORT_TYPE_OPERATION_FAULT); } // Check if the action is already set as we don't want to override // it // with the Default Action Pattern String action = axisOperation.getFaultAction(fault.getName()); if (action == null) { action = WSDL11ActionHelper.getActionFromFaultElement(dif, wsdl4jPortType, wsdl4jOperation, fault); } if (action != null) { axisOperation.addFaultAction(fault.getName(), action); } axisOperation.setFaultMessages(axisFaultMessage); } return axisOperation; } /** * Generates a list of wrapper schemas * * @param wsdl4jBinding */ private Element[] generateWrapperSchema(Map schemaMap, Binding wsdl4jBinding, PortType portType) { List schemaElementList = new ArrayList(); // target namespace for this should be the namespace URI for // the porttype String porttypeNamespaceURI = portType.getQName().getNamespaceURI(); // ////////////////////////////////////////////////////////////////////// // if there are any bindings present then we have to process them. we // have to generate a schema per wsdl4jBinding (that is the safest // option). // if not we just resolve to // the good old port type // list, in which case we'll generate a schema per porttype // ////////////////////////////////////////////////////////////////////// // findwrappable operations return either the rpc soap operations or // Http binding operations List wrappableBOEList = findWrappableBindingOperations(wsdl4jBinding); // this method returns all the new schemas created when processing the rpc messages Map newSchemaMap = createSchemaForPorttype(porttypeNamespaceURI, wrappableBOEList, schemaMap); schemaElementList.addAll(newSchemaMap.values()); return (Element[]) schemaElementList .toArray(new Element[schemaElementList.size()]); } /** * Create a schema by looking at the port type * * @param namespaceURI - namespace of the porttype uri. * we use this only if a user has not specified a namespace in soap:body * @param boeListToProcess - List of BindingOperationEntry objects which require wrappering * * @return null if there is no element */ private Map createSchemaForPorttype(String namespaceURI, List boeListToProcess, Map existingSchemaMap) { // this map is used to keep the newly added schemas Map newSchemaMap = new HashMap(); // first of all look at the operations list // we can return immediately if we get the operations list // as empty if (boeListToProcess.isEmpty()) { return newSchemaMap; } // loop through the messages. We'll populate thins map with the relevant // messages // from the operations Map messageQnameToMessageMap = new HashMap(); Map boeToInputMessageMap = new HashMap(); Map boeToOutputMessageMap = new HashMap(); // this contains the required namespace imports. the key in this // map would be the namaspace URI Map namespaceImportsMap = null; // list namespace prefix map. This map will include uri -> prefix Map namespacePrefixMap = null; // ////////////////////////////////////////////////////////////////////////////////////////////////// // First thing is to populate the message map with the messages to // process. // ////////////////////////////////////////////////////////////////////////////////////////////////// // we really need to do this for a single porttype! BindingOperationEntry boe; for (int k = 0; k < boeListToProcess.size(); k++) { boe = (BindingOperationEntry) boeListToProcess.get(k); Input input = boe.getBindingOperation().getOperation().getInput(); Message message; if (input != null) { message = input.getMessage(); messageQnameToMessageMap.put(message.getQName(), message); boeToInputMessageMap.put(boe, message); } Output output = boe.getBindingOperation().getOperation().getOutput(); if (output != null) { message = output.getMessage(); messageQnameToMessageMap.put(message.getQName(), message); boeToOutputMessageMap.put(boe, message); } // we do not want to process fault messages since they can only be used as document type // see basic profile 4.4.2 } // find the xsd prefix String xsdPrefix = findSchemaPrefix(); // DOM document that will be the ultimate creator Document document = getDOMDocumentBuilder().newDocument(); Element elementDeclaration; //loop through the input op map and generate the elements BindingOperationEntry boEntry; for (Iterator boeIter = boeToInputMessageMap.keySet().iterator(); boeIter.hasNext();) { boEntry = (BindingOperationEntry) boeIter.next(); elementDeclaration = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME); elementDeclaration.setAttribute(XSD_NAME, boEntry.getBindingOperation().getName()); //when creating the inner complex type we have to find the parts list from the binding input BindingInput bindingInput = boEntry.getBindingOperation().getBindingInput(); Message message = (Message) boeToInputMessageMap.get(boEntry); if (bindingInput != null) { Collection partsCollection = null; if (BINDING_TYPE_SOAP.equals(this.bindingType)) { // first see the body parts list List bodyPartsList = getPartsListFromSoapBody(bindingInput.getExtensibilityElements()); partsCollection = message.getOrderedParts(bodyPartsList); } else { // i.e http binding partsCollection = message.getParts().values(); } List parameterOrder = boEntry.getBindingOperation().getOperation().getParameterOrdering(); namespaceImportsMap = new HashMap(); namespacePrefixMap = new HashMap(); Node newComplexType = getNewComplextType(document, xsdPrefix, partsCollection, parameterOrder, false, namespaceImportsMap, namespacePrefixMap, boEntry); elementDeclaration.appendChild(newComplexType); String namespaceToUse = namespaceURI; if (BINDING_TYPE_SOAP.equals(this.bindingType)) { String bodyNamespace = getNamespaceFromSoapBody(bindingInput.getExtensibilityElements()); namespaceToUse = bodyNamespace != null ? bodyNamespace : namespaceURI; } if (existingSchemaMap.containsKey(namespaceToUse)) { // i.e this namespace is already exists with the original wsdl schemas addElementToAnExistingSchema((Element) existingSchemaMap.get(namespaceToUse), elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse); } else if (newSchemaMap.containsKey(namespaceToUse)) { // i.e this namespace is with a newly created schema addElementToAnExistingSchema((Element) newSchemaMap.get(namespaceToUse), elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse); } else { // i.e this element namespace has not found yet so // we have to create new schema for it Element newSchema = createNewSchemaWithElement(elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse, document, xsdPrefix); newSchemaMap.put(namespaceToUse, newSchema); } resolvedRpcWrappedElementMap.put(boEntry.getBindingOperation().getName(), new QName( namespaceToUse, boEntry.getBindingOperation().getName(), AXIS2WRAPPED)); } else { throw new WSDLProcessingException( "No binding input is defiend for binding operation ==> " + boEntry.getBindingOperation().getName()); } } // loop through the output to map and generate the elements for (Iterator boeIterator = boeToOutputMessageMap.keySet().iterator(); boeIterator.hasNext();) { boEntry = (BindingOperationEntry) boeIterator.next(); String baseoutputOpName = boEntry.getBindingOperation().getName(); // see basic profile 4.7.19 String outputOpName = baseoutputOpName + WRAPPED_OUTPUTNAME_SUFFIX; elementDeclaration = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME); elementDeclaration.setAttribute(XSD_NAME, outputOpName); BindingOutput bindingOutput = boEntry.getBindingOperation().getBindingOutput(); Message message = (Message) boeToOutputMessageMap.get(boEntry); if (bindingOutput != null) { Collection partsCollection = null; if (BINDING_TYPE_SOAP.equals(this.bindingType)) { // first see the body parts list List bodyPartsList = getPartsListFromSoapBody(bindingOutput.getExtensibilityElements()); partsCollection = message.getOrderedParts(bodyPartsList); } else { // i.e if http binding partsCollection = message.getParts().values(); } List parameterOrder = boEntry.getBindingOperation().getOperation().getParameterOrdering(); // we have to initialize the hash maps always since we add the elements onece we // generate it namespacePrefixMap = new HashMap(); namespaceImportsMap = new HashMap(); Node newComplexType = getNewComplextType(document, xsdPrefix, partsCollection, parameterOrder, true, namespaceImportsMap, namespacePrefixMap, boEntry); elementDeclaration.appendChild(newComplexType); String namespaceToUse = namespaceURI; if (BINDING_TYPE_SOAP.equals(this.bindingType)) { String bodyNamespace = getNamespaceFromSoapBody(bindingOutput.getExtensibilityElements()); namespaceToUse = bodyNamespace != null ? bodyNamespace : namespaceURI; } if (existingSchemaMap.containsKey(namespaceToUse)) { // i.e this namespace is already exists with the original wsdl schemas addElementToAnExistingSchema((Element) existingSchemaMap.get(namespaceToUse), elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse); } else if (newSchemaMap.containsKey(namespaceToUse)) { // i.e this namespace is with a newly created schema addElementToAnExistingSchema((Element) newSchemaMap.get(namespaceToUse), elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse); } else { // i.e this element namespace has not found yet so // we have to create new schema for it Element newSchema = createNewSchemaWithElement(elementDeclaration, namespacePrefixMap, namespaceImportsMap, namespaceToUse, document, xsdPrefix); newSchemaMap.put(namespaceToUse, newSchema); } resolvedRpcWrappedElementMap.put(outputOpName, new QName( namespaceToUse, outputOpName, AXIS2WRAPPED)); } else { throw new WSDLProcessingException( "No binding out put is defined for binding operation ==>" + boEntry.getBindingOperation().getName()); } } return newSchemaMap; } private void addElementToAnExistingSchema(Element schemaElement, Element newElement, Map namespacePrefixMap, Map namespaceImportsMap, String targetNamespace) { Document ownerDocument = schemaElement.getOwnerDocument(); // loop through the namespace declarations first and add them String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap .keySet().toArray(new String[namespacePrefixMap.size()]); for (int i = 0; i < nameSpaceDeclarationArray.length; i++) { String s = nameSpaceDeclarationArray[i]; checkAndAddNamespaceDeclarations(s, namespacePrefixMap, schemaElement); } // add imports - check whether it is the targetnamespace before // adding Element[] namespaceImports = (Element[]) namespaceImportsMap .values().toArray(new Element[namespaceImportsMap.size()]); for (int i = 0; i < namespaceImports.length; i++) { if (!targetNamespace.equals(namespaceImports[i] .getAttribute(NAMESPACE_URI))) { schemaElement.appendChild(ownerDocument.importNode( namespaceImports[i], true)); } } schemaElement.appendChild(ownerDocument.importNode(newElement, true)); } private Element createNewSchemaWithElement(Element newElement, Map namespacePrefixMap, Map namespaceImportsMap, String targetNamespace, Document document, String xsdPrefix) { Element schemaElement = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_LOCAL_NAME); // loop through the namespace declarations first String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap .keySet().toArray(new String[namespacePrefixMap.size()]); for (int i = 0; i < nameSpaceDeclarationArray.length; i++) { String s = nameSpaceDeclarationArray[i]; schemaElement.setAttributeNS(XML_NAMESPACE_URI, NAMESPACE_DECLARATION_PREFIX + namespacePrefixMap.get(s).toString(), s); } if (schemaElement.getAttributeNS(XML_NAMESPACE_URI, xsdPrefix).length() == 0) { schemaElement.setAttributeNS(XML_NAMESPACE_URI, NAMESPACE_DECLARATION_PREFIX + xsdPrefix, XMLSCHEMA_NAMESPACE_URI); } // add the targetNamespace schemaElement.setAttributeNS(XML_NAMESPACE_URI, XMLNS_AXIS2WRAPPED, targetNamespace); schemaElement.setAttribute(XSD_TARGETNAMESPACE, targetNamespace); schemaElement.setAttribute(XSD_ELEMENT_FORM_DEFAULT, XSD_UNQUALIFIED); // add imports Element[] namespaceImports = (Element[]) namespaceImportsMap .values().toArray(new Element[namespaceImportsMap.size()]); for (int i = 0; i < namespaceImports.length; i++) { schemaElement.appendChild(namespaceImports[i]); } schemaElement.appendChild(newElement); return schemaElement; } private List getPartsListFromSoapBody(List extensibilityElements) { List partsList = null; ExtensibilityElement extElement; for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) { extElement = (ExtensibilityElement) iter.next(); if (log.isDebugEnabled()) { log.debug("Extensibility Element type is:" + extElement.getElementType()); log.debug("Extensibility Element class is:" + extElement.getClass().getName()); } // SOAP 1.1 body element found! if (extElement instanceof SOAPBody) { SOAPBody soapBody = (SOAPBody) extElement; partsList = soapBody.getParts(); } else if (extElement instanceof SOAP12Body) { SOAP12Body soapBody = (SOAP12Body) extElement; partsList = soapBody.getParts(); } else if (extElement instanceof MIMEMultipartRelated) { MIMEMultipartRelated minMimeMultipartRelated = (MIMEMultipartRelated) extElement; List mimePartsList = minMimeMultipartRelated.getMIMEParts(); MIMEPart mimePart = null; Object object; List mimePartElements; ExtensibilityElement mimePartExtensibilityElement; for (Iterator mimePartsIter = mimePartsList.iterator(); mimePartsIter.hasNext();) { object = mimePartsIter.next(); if (object instanceof MIMEPart) { mimePart = (MIMEPart) object; mimePartElements = mimePart.getExtensibilityElements(); for (Iterator mimePartElementsIter = mimePartElements.iterator(); mimePartElementsIter.hasNext();) { mimePartExtensibilityElement = (ExtensibilityElement) mimePartElementsIter.next(); if (mimePartExtensibilityElement instanceof SOAPBody) { SOAPBody soapBody = (SOAPBody) mimePartExtensibilityElement; partsList = soapBody.getParts(); } else if (mimePartExtensibilityElement instanceof SOAP12Body) { SOAP12Body soapBody = (SOAP12Body) mimePartExtensibilityElement; partsList = soapBody.getParts(); } } } } } } if (partsList == null) { log.debug("SOAP body parts have not been set. All the parts in the message were added to the message."); } return partsList; } private String getNamespaceFromSoapBody(List extensibilityElements) { ExtensibilityElement extElement; String namespace = null; for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) { extElement = (ExtensibilityElement) iter.next(); // SOAP 1.1 body element found! if (extElement instanceof SOAPBody) { SOAPBody soapBody = (SOAPBody) extElement; namespace = soapBody.getNamespaceURI(); } else if (extElement instanceof SOAP12Body) { SOAP12Body soapBody = (SOAP12Body) extElement; namespace = soapBody.getNamespaceURI(); } } return namespace; } /** * creates a new shema complex element according to the elements sequence difined * this parts list is always for a message refering from the * soap rpc type operation * * @param document * @param xsdPrefix * @param partsCollection - parts to be added * @param parameterOrder - param Order list if it is given * @param isOutMessage * @param namespaceImportsMap * @param namespacePrefixMap * @param boe BindingOperationEntry for this partCollection * @return new element */ private Element getNewComplextType(Document document, String xsdPrefix, Collection partsCollection, List parameterOrder, boolean isOutMessage, Map namespaceImportsMap, Map namespacePrefixMap, BindingOperationEntry boe) { // add the complex type Element newComplexType = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME); Element cmplxTypeSequence = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_SEQUENCE_LOCAL_NAME); Part part; if ((parameterOrder == null) || (parameterOrder.size() == 0)) { // no parameter order then just add the elements in the parts collection for (Iterator partsIter = partsCollection.iterator(); partsIter.hasNext();) { part = (Part) partsIter.next(); // the part name addPartToElement(part, document, xsdPrefix, namespaceImportsMap, namespacePrefixMap, cmplxTypeSequence, isOutMessage, boe); } } else { // i.e an parts order is given // first populate all the parts to a map Map partsMap = new HashMap(); for (Iterator partsIter = partsCollection.iterator(); partsIter.hasNext();) { part = (Part) partsIter.next(); partsMap.put(part.getName(), part); } String partName; for (Iterator paramOrderIter = parameterOrder.iterator(); paramOrderIter.hasNext();) { partName = (String) paramOrderIter.next(); part = (Part) partsMap.get(partName); if (part != null) { addPartToElement(part, document, xsdPrefix, namespaceImportsMap, namespacePrefixMap, cmplxTypeSequence, isOutMessage, boe); partsMap.remove(partName); } } // if this is an output message then we have to set the // return type if exists if (isOutMessage) { if (partsMap.size() > 0) { if (partsMap.size() == 1) { part = (Part) partsMap.values().iterator().next(); // change the name of this part // this is the return type and its name should be result // part.setName("result"); addPartToElement(part, document, xsdPrefix, namespaceImportsMap, namespacePrefixMap, cmplxTypeSequence, isOutMessage, boe); } else { throw new WSDLProcessingException("the parameter order can left atmost" + " one part"); } } } } newComplexType.appendChild(cmplxTypeSequence); return newComplexType; } /** * @param part * @param document * @param xsdPrefix * @param namespaceImportsMap * @param namespacePrefixMap * @param cmplxTypeSequence * @param isOutMessage (true is part is referenced by the output clause) * @param boe BindingOperationEntry that caused the creation of this part. */ private void addPartToElement(Part part, Document document, String xsdPrefix, Map namespaceImportsMap, Map namespacePrefixMap, Element cmplxTypeSequence, boolean isOutMessage, BindingOperationEntry boe) { Element child; String elementName = part.getName(); // the type name QName schemaTypeName = part.getTypeName(); if (schemaTypeName != null) { child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME); // always child attribute should be in no namespace child.setAttribute("form", "unqualified"); String prefix; if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName.getNamespaceURI())) { prefix = xsdPrefix; } else { // this schema is a third party one. So we need to have // an import statement in our generated schema String uri = schemaTypeName.getNamespaceURI(); if (!namespaceImportsMap.containsKey(uri)) { // create Element for namespace import Element namespaceImport = document.createElementNS( XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":" + XML_SCHEMA_IMPORT_LOCAL_NAME); namespaceImport.setAttribute(NAMESPACE_URI, uri); // add this to the map namespaceImportsMap.put(uri, namespaceImport); // we also need to associate this uri with a prefix // and include that prefix // in the schema's namspace declarations. So add // theis particular namespace to the // prefix map as well prefix = getTemporaryNamespacePrefix(); namespacePrefixMap.put(uri, prefix); } else { // this URI should be already in the namspace prefix // map prefix = (String) namespacePrefixMap.get(uri); } } child.setAttribute(XSD_NAME, elementName); child.setAttribute(XSD_TYPE, prefix + ":" + schemaTypeName.getLocalPart()); cmplxTypeSequence.appendChild(child); } else { String bindingOperationName = boe.getBindingOperation().getName(); String partName = part.getName(); if (boe.isRPC()) { // see the basic profile 4.4.1 for rpc-literal. // messages parts can have only types throw new WSDLProcessingException( "The binding operation " + bindingOperationName + " is RPC/literal. " + "The message parts for this operation must use the type " + "attribute as specificed by " + "WS-I Basic Profile specification (4.4.1). Message part, " + partName + ", violates" + "this rule. Please remove the element attribute " + "and use the type attribute."); } else { // The presense of an element means that a wrapper xsd element is not needed. boe.setWrappedOutput(false); if (log.isDebugEnabled()) { log.debug("The binding operation " + bindingOperationName + " references message part " + partName + ". This part does not use the " + "type attribute, so a wrappering element is not added."); } } } } /** * @param prefixMap */ private void checkAndAddNamespaceDeclarations(String namespace, Map prefixMap, Element schemaElement) { // get the attribute for the current namespace String prefix = (String) prefixMap.get(namespace); // A prefix must be found at this point! String existingURL = schemaElement.getAttributeNS(XML_NAMESPACE_URI, NAMESPACE_DECLARATION_PREFIX + prefix); if (existingURL == null || existingURL.length() == 0) { // there is no existing URL by that prefix - declare a new namespace schemaElement.setAttributeNS(XML_NAMESPACE_URI, NAMESPACE_DECLARATION_PREFIX + prefix, namespace); } else if (existingURL.equals(namespace)) { // this namespace declaration is already there with the same prefix // ignore it } else { // there is a different namespace declared in the given prefix // change the prefix in the prefix map to a new one and declare it // create a prefix String generatedPrefix = "ns" + prefixCounter++; while (prefixMap.containsKey(generatedPrefix)) { generatedPrefix = "ns" + prefixCounter++; } schemaElement.setAttributeNS(XML_NAMESPACE_URI, NAMESPACE_DECLARATION_PREFIX + generatedPrefix, namespace); // add to the map prefixMap.put(namespace, generatedPrefix); } } /** * Read the WSDL file given the inputstream for the WSDL source * * @param in * @throws WSDLException */ private Definition readInTheWSDLFile(InputStream in) throws WSDLException { WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); // switch off the verbose mode for all usecases reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false); reader.setFeature("javax.wsdl.importDocuments", true); Definition def; // if the custem resolver is present then use it if (customWSDLResolver != null) { // make sure the wsdl definition has the URI for the base document set def = reader.readWSDL(customWSDLResolver); def.setDocumentBaseURI(customWSDLResolver.getBaseURI()); return def; } else { Document doc; try { doc = XMLUtils.newDocument(in); } catch (ParserConfigurationException e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Error", e); } catch (SAXException e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Parser SAX Error", e); } catch (IOException e) { throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); } // Log when and from where the WSDL is loaded. if (log.isDebugEnabled()) { log.debug("Reading 1.1 WSDL with base uri = " + getBaseUri()); log.debug(" the document base uri = " + getDocumentBaseUri()); log.debug(" the stack at this point is: " + stackToString()); } def = reader.readWSDL(getBaseUri(), doc); def.setDocumentBaseURI(getDocumentBaseUri()); return def; } } /** * Get the Extensible elements form wsdl4jExtensibleElements * Vector if any and copy them to Component *

        Note - SOAP body extensible element will be processed differently * * @param wsdl4jExtensibleElements * @param description where is the ext element (port , portype , biding) * @param wsdl4jDefinition * @param originOfExtensibilityElements - * this will indicate the place this extensibility element came * from. */ private void copyExtensibleElements(List wsdl4jExtensibleElements, Definition wsdl4jDefinition, AxisDescription description, String originOfExtensibilityElements) throws AxisFault { ExtensibilityElement wsdl4jExtensibilityElement; for (Iterator iterator = wsdl4jExtensibleElements.iterator(); iterator.hasNext();) { wsdl4jExtensibilityElement = (ExtensibilityElement) iterator.next(); if (wsdl4jExtensibilityElement instanceof UnknownExtensibilityElement) { UnknownExtensibilityElement unknown = (UnknownExtensibilityElement) (wsdl4jExtensibilityElement); QName type = unknown.getElementType(); // if (WSDLConstants.WSDL11Constants.POLICY.equals(type)) { if (isTraceEnabled) { log.trace("copyExtensibleElements:: PolicyElement found " + unknown); } Policy policy = (Policy) PolicyUtil.getPolicyComponent(unknown.getElement()); description.getPolicySubject().attachPolicy(policy); // int attachmentScope = // getPolicyAttachmentPoint(description, originOfExtensibilityElements); // if (attachmentScope > -1) { // description.getPolicyInclude().addPolicyElement( // attachmentScope, policy); // } // } else if (WSDLConstants.WSDL11Constants.POLICY_REFERENCE .equals(type)) { if (isTraceEnabled) { log.trace("copyExtensibleElements:: PolicyReference found " + unknown); } PolicyReference policyReference = (PolicyReference) PolicyUtil .getPolicyComponent(unknown.getElement()); description.getPolicySubject().attachPolicyReference(policyReference); // int attachmentScope = // getPolicyAttachmentPoint(description, originOfExtensibilityElements); // if (attachmentScope > -1) { // description.getPolicyInclude().addPolicyRefElement( // attachmentScope, policyReference); // } } else if (AddressingConstants.Final.WSAW_USING_ADDRESSING .equals(type) || AddressingConstants.Submission.WSAW_USING_ADDRESSING .equals(unknown.getElementType())) { if (isTraceEnabled) { log.trace("copyExtensibleElements:: wsaw:UsingAddressing found " + unknown); } // FIXME We need to set this the appropriate Axis Description AxisEndpoint or // AxisBinding . if (originOfExtensibilityElements.equals(PORT) || originOfExtensibilityElements.equals(BINDING)) { if (Boolean.TRUE.equals(unknown.getRequired())) { AddressingHelper.setAddressingRequirementParemeterValue(axisService, AddressingConstants.ADDRESSING_REQUIRED); } else { AddressingHelper.setAddressingRequirementParemeterValue(axisService, AddressingConstants.ADDRESSING_OPTIONAL); } } } else if (wsdl4jExtensibilityElement.getElementType() != null && wsdl4jExtensibilityElement.getElementType().getNamespaceURI().equals( org.apache.axis2.namespace.Constants.FORMAT_BINDING)) { Element typeMapping = unknown.getElement(); NodeList typeMaps = typeMapping.getElementsByTagNameNS( org.apache.axis2.namespace.Constants.FORMAT_BINDING, "typeMap"); int count = typeMaps.getLength(); HashMap typeMapper = new HashMap(); for (int index = 0; index < count; index++) { Node node = typeMaps.item(index); NamedNodeMap attributes = node.getAttributes(); Node typeName = attributes.getNamedItem("typeName"); if (typeName != null) { String prefix = getPrefix(typeName.getNodeValue()); if (prefix != null) { String ns = (String) wsdl4jDefinition.getNamespaces().get(prefix); if (ns != null) { Node formatType = attributes.getNamedItem("formatType"); typeMapper.put(new QName(ns, getTypeName( typeName.getNodeValue())), formatType.getNodeValue()); } } } } } else if (wsdl4jExtensibilityElement.getElementType() != null && wsdl4jExtensibilityElement.getElementType().getNamespaceURI().equals( org.apache.axis2.namespace.Constants.JAVA_NS)) { Element unknowJavaElement = unknown.getElement(); if (unknowJavaElement.getLocalName().equals("address") ) { NamedNodeMap nameAttributes = unknowJavaElement.getAttributes(); Node node = nameAttributes.getNamedItem("className"); Parameter serviceClass = new Parameter(); serviceClass.setName("className"); serviceClass.setValue(node.getNodeValue()); axisService.addParameter(serviceClass); Parameter transportName = new Parameter(); transportName.setName("TRANSPORT_NAME"); transportName.setValue("java"); axisService.addParameter(transportName); } } else { // Ignore this element - it is a totally unknown element if (isTraceEnabled) { log.trace("copyExtensibleElements:: Unknown Extensibility Element found " + unknown); } } } else if (wsdl4jExtensibilityElement instanceof SOAP12Address) { SOAP12Address soapAddress = (SOAP12Address) wsdl4jExtensibilityElement; if (description instanceof AxisEndpoint) { setEndpointURL((AxisEndpoint) description, soapAddress.getLocationURI()); } } else if (wsdl4jExtensibilityElement instanceof SOAPAddress) { SOAPAddress soapAddress = (SOAPAddress) wsdl4jExtensibilityElement; if (description instanceof AxisEndpoint) { setEndpointURL((AxisEndpoint) description, soapAddress.getLocationURI()); } } else if (wsdl4jExtensibilityElement instanceof HTTPAddress) { HTTPAddress httpAddress = (HTTPAddress) wsdl4jExtensibilityElement; if (description instanceof AxisEndpoint) { setEndpointURL((AxisEndpoint) description, httpAddress.getLocationURI()); } } else if (wsdl4jExtensibilityElement instanceof Schema) { Schema schema = (Schema) wsdl4jExtensibilityElement; // just add this schema - no need to worry about the imported // ones axisService.addSchema(getXMLSchema(schema.getElement(), schema .getDocumentBaseURI())); } else if (wsdl4jExtensibilityElement instanceof SOAP12Operation) { SOAP12Operation soapOperation = (SOAP12Operation) wsdl4jExtensibilityElement; AxisBindingOperation axisBindingOperation = (AxisBindingOperation) description; String style = soapOperation.getStyle(); if (style != null) { axisBindingOperation.setProperty(WSDLConstants.WSDL_1_1_STYLE, style); } String soapActionURI = soapOperation.getSoapActionURI(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("WSDL Binding Operation: " + axisBindingOperation.getName() + ", SOAPAction: " + soapActionURI); if (soapActionURI != null && !soapActionURI.equals("")) { axisBindingOperation .setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapActionURI); axisBindingOperation.getAxisOperation().setSoapAction(soapActionURI); if (!isServerSide) { axisBindingOperation.getAxisOperation().setOutputAction(soapActionURI); } axisService.mapActionToOperation(soapActionURI, axisBindingOperation.getAxisOperation()); } } else if (wsdl4jExtensibilityElement instanceof SOAPOperation) { SOAPOperation soapOperation = (SOAPOperation) wsdl4jExtensibilityElement; AxisBindingOperation axisBindingOperation = (AxisBindingOperation) description; String style = soapOperation.getStyle(); if (style != null) { axisBindingOperation.setProperty(WSDLConstants.WSDL_1_1_STYLE, style); } String soapAction = soapOperation.getSoapActionURI(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) log.debug("WSDL Binding Operation: " + axisBindingOperation.getName() + ", SOAPAction: " + soapAction); if (soapAction != null && !soapAction.equals("")) { axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapAction); axisBindingOperation.getAxisOperation().setSoapAction(soapAction); if (!isServerSide) { axisBindingOperation.getAxisOperation().setOutputAction(soapAction); } axisService.mapActionToOperation(soapAction, axisBindingOperation.getAxisOperation()); } } else if (wsdl4jExtensibilityElement instanceof HTTPOperation) { HTTPOperation httpOperation = (HTTPOperation) wsdl4jExtensibilityElement; AxisBindingOperation axisBindingOperation = (AxisBindingOperation) description; String httpLocation = httpOperation.getLocationURI(); if (httpLocation != null) { // change the template to make it same as WSDL 2 template httpLocation = httpLocation.replaceAll("\\(", "{"); httpLocation = httpLocation.replaceAll("\\)", "}"); axisBindingOperation .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation); } axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION, HTTPConstants.MEDIA_TYPE_X_WWW_FORM); } else if (wsdl4jExtensibilityElement instanceof SOAP12Header) { SOAP12Header soapHeader = (SOAP12Header) wsdl4jExtensibilityElement; SOAPHeaderMessage headerMessage = new SOAPHeaderMessage(); headerMessage.setNamespaceURI(soapHeader.getNamespaceURI()); headerMessage.setUse(soapHeader.getUse()); Boolean required = soapHeader.getRequired(); if (required != null) { headerMessage.setRequired(required.booleanValue()); } if (wsdl4jDefinition != null) { // find the relevant schema part from the messages Message msg = wsdl4jDefinition.getMessage(soapHeader .getMessage()); if (msg == null) { // TODO i18n this throw new AxisFault("message " + soapHeader.getMessage() + " not found in the WSDL "); } Part msgPart = msg.getPart(soapHeader.getPart()); if (msgPart == null) { // TODO i18n this throw new AxisFault("message part " + soapHeader.getPart() + " not found in the WSDL "); } // see basic profile 4.4.2 Bindings and Faults header, fault and headerfaults // can only have elements headerMessage.setElement(msgPart.getElementName()); } headerMessage.setMessage(soapHeader.getMessage()); headerMessage.setPart(soapHeader.getPart()); if (description instanceof AxisBindingMessage) { AxisBindingMessage bindingMessage = (AxisBindingMessage) description; List soapHeaders = (List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER); if (soapHeaders == null) { soapHeaders = new ArrayList(); bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, soapHeaders); } soapHeaders.add(headerMessage); } } else if (wsdl4jExtensibilityElement instanceof SOAPHeader) { SOAPHeader soapHeader = (SOAPHeader) wsdl4jExtensibilityElement; SOAPHeaderMessage headerMessage = new SOAPHeaderMessage(); headerMessage.setNamespaceURI(soapHeader.getNamespaceURI()); headerMessage.setUse(soapHeader.getUse()); Boolean required = soapHeader.getRequired(); if (null != required) { headerMessage.setRequired(required.booleanValue()); } if (null != wsdl4jDefinition) { // find the relevant schema part from the messages Message msg = wsdl4jDefinition.getMessage(soapHeader .getMessage()); if (msg == null) { // todo i18n this throw new AxisFault("message " + soapHeader.getMessage() + " not found in the WSDL "); } Part msgPart = msg.getPart(soapHeader.getPart()); if (msgPart == null) { // todo i18n this throw new AxisFault("message part " + soapHeader.getPart() + " not found in the WSDL "); } headerMessage.setElement(msgPart.getElementName()); } headerMessage.setMessage(soapHeader.getMessage()); headerMessage.setPart(soapHeader.getPart()); if (description instanceof AxisBindingMessage) { AxisBindingMessage bindingMessage = (AxisBindingMessage) description; List soapHeaders = (List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER); if (soapHeaders == null) { soapHeaders = new ArrayList(); bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, soapHeaders); } soapHeaders.add(headerMessage); } } else if (wsdl4jExtensibilityElement instanceof SOAPBinding) { SOAPBinding soapBinding = (SOAPBinding) wsdl4jExtensibilityElement; AxisBinding axisBinding = (AxisBinding) description; axisBinding.setType(soapBinding.getTransportURI()); axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); String style = soapBinding.getStyle(); if (style != null) { axisBinding.setProperty(WSDLConstants.WSDL_1_1_STYLE, style); } } else if (wsdl4jExtensibilityElement instanceof SOAP12Binding) { SOAP12Binding soapBinding = (SOAP12Binding) wsdl4jExtensibilityElement; AxisBinding axisBinding = (AxisBinding) description; axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); String style = soapBinding.getStyle(); if (style != null) { axisBinding.setProperty(WSDLConstants.WSDL_1_1_STYLE, style); } String transportURI = soapBinding.getTransportURI(); axisBinding.setType(transportURI); } else if (wsdl4jExtensibilityElement instanceof HTTPBinding) { HTTPBinding httpBinding = (HTTPBinding) wsdl4jExtensibilityElement; AxisBinding axisBinding = (AxisBinding) description; // set the binding style same as the wsd2 to process smoothly axisBinding.setType(WSDL2Constants.URI_WSDL2_HTTP); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpBinding.getVerb()); } } } private int getPolicyAttachmentPoint(AxisDescription description, String originOfExtensibilityElements) { int result = -1; // Attachment Point Not Identified if (SERVICE.equals(originOfExtensibilityElements)) { result = PolicyInclude.SERVICE_POLICY; } else if (PORT.equals(originOfExtensibilityElements)) { result = PolicyInclude.PORT_POLICY; } else if (BINDING.equals(originOfExtensibilityElements)) { result = PolicyInclude.BINDING_POLICY; } else if (BINDING_OPERATION.equals(originOfExtensibilityElements)) { result = PolicyInclude.BINDING_OPERATION_POLICY; } else if (BINDING_OPERATION_INPUT.equals(originOfExtensibilityElements)) { result = PolicyInclude.BINDING_INPUT_POLICY; } else if (BINDING_OPERATION_OUTPUT.equals(originOfExtensibilityElements)) { result = PolicyInclude.BINDING_OUTPUT_POLICY; } else if (PORT_TYPE.equals(originOfExtensibilityElements)) { result = PolicyInclude.PORT_TYPE_POLICY; } else if (PORT_TYPE_OPERATION.equals(originOfExtensibilityElements)) { result = PolicyInclude.OPERATION_POLICY; } else if (PORT_TYPE_OPERATION_INPUT.equals(originOfExtensibilityElements)) { result = PolicyInclude.INPUT_POLICY; } else if (PORT_TYPE_OPERATION_OUTPUT.equals(originOfExtensibilityElements)) { result = PolicyInclude.OUTPUT_POLICY; } if (isTraceEnabled) { log.trace("getPolicyAttachmentPoint:: axisDescription=" + description + " extensibilityPoint=" + originOfExtensibilityElements + " result=" + result); } return result; } /** * Look for the wrappable operations depending on the style * * @param binding * @return List of BindingOperationEntry objects */ private List findWrappableBindingOperations(Binding binding) { // first find the global style declaration. // for a SOAP binding this can be only rpc or document // as per the WSDL spec (section 3.4) the default style is document // now we have to handle the http bindings case as well // boolean isRPC = false; boolean isSOAPBinding = false; boolean isHttpBinding = false; List extElements = binding.getExtensibilityElements(); for (int i = 0; i < extElements.size(); i++) { if (extElements.get(i) instanceof SOAPBinding) { // we have a global SOAP binding! isSOAPBinding = true; SOAPBinding soapBinding = (SOAPBinding) extElements.get(i); if (RPC_STYLE.equals(soapBinding.getStyle())) { // set the global style to rpc isRPC = true; } this.bindingType = BINDING_TYPE_SOAP; break; } else if (extElements.get(i) instanceof SOAP12Binding) { // we have a global SOAP binding! isSOAPBinding = true; SOAP12Binding soapBinding = (SOAP12Binding) extElements.get(i); if (RPC_STYLE.equals(soapBinding.getStyle())) { // set the global style to rpc isRPC = true; } this.bindingType = BINDING_TYPE_SOAP; break; } else if (extElements.get(i) instanceof HTTPBinding) { isHttpBinding = true; this.bindingType = BINDING_TYPE_HTTP; } } if (log.isDebugEnabled()) { log.debug("Binding Name =" + binding.getQName()); log.debug(" isSOAPBinding =" + isSOAPBinding ); log.debug(" isHttpBinding =" + isHttpBinding ); log.debug(" isRPC =" + isRPC ); } // go through every operation and get their styles. // each one can have a style override from the global // styles. Depending on the style add the relevant operations // to the return list List returnList = new ArrayList(); if (isHttpBinding || isSOAPBinding) { BindingOperation bindingOp; for (Iterator bindingOperationsIterator = binding.getBindingOperations().iterator(); bindingOperationsIterator.hasNext();) { bindingOp = (BindingOperation) bindingOperationsIterator.next(); if (log.isDebugEnabled()) { log.debug(" Binding Operation =" + bindingOp.getName()); } if (isSOAPBinding) { String style = getSOAPStyle(bindingOp); if (log.isDebugEnabled()) { log.debug(" SOAPStyle =" + style); } if (style == null) { // no style specified // use the global style to determine whether to put this one or // not if (isRPC) { if (log.isDebugEnabled()) { log.debug(" schema wrappering required"); } BindingOperationEntry boe = new BindingOperationEntry(bindingOp, true, false, style, true); returnList.add(boe); } } else if (RPC_STYLE.equals(style)) { // add to the list if (log.isDebugEnabled()) { log.debug(" schema wrappering required"); } BindingOperationEntry boe = new BindingOperationEntry(bindingOp, true, false, style, true); returnList.add(boe); } // if not RPC we just leave it - default is doc } else { // i.e an http binding then we have to add the operation any way if (log.isDebugEnabled()) { log.debug(" schema wrappering required"); } BindingOperationEntry boe = new BindingOperationEntry(bindingOp, false, true, null, false); returnList.add(boe); } } } // if the binding is not either soap or http binding then we return and empty list // set this to the global list wrappableBOEs = returnList; return returnList; } /** * Guess the MEP based on the order of messages * * @param operation * @throws AxisFault */ private String getMEP(Operation operation) throws AxisFault { OperationType operationType = operation.getStyle(); if (isServerSide) { if (operationType != null) { if (operationType.equals(OperationType.REQUEST_RESPONSE)) { return WSDL2Constants.MEP_URI_IN_OUT; } if (operationType.equals(OperationType.ONE_WAY)) { if (operation.getFaults().size() > 0) { return WSDL2Constants.MEP_URI_ROBUST_IN_ONLY; } return WSDL2Constants.MEP_URI_IN_ONLY; } if (operationType.equals(OperationType.NOTIFICATION)) { return WSDL2Constants.MEP_URI_OUT_ONLY; } if (operationType.equals(OperationType.SOLICIT_RESPONSE)) { return WSDL2Constants.MEP_URI_OUT_IN; } throw new AxisFault("Cannot Determine the MEP"); } } else { if (operationType != null) { if (operationType.equals(OperationType.REQUEST_RESPONSE)) { return WSDL2Constants.MEP_URI_OUT_IN; } if (operationType.equals(OperationType.ONE_WAY)) { return WSDL2Constants.MEP_URI_OUT_ONLY; } if (operationType.equals(OperationType.NOTIFICATION)) { return WSDL2Constants.MEP_URI_IN_ONLY; } if (operationType.equals(OperationType.SOLICIT_RESPONSE)) { return WSDL2Constants.MEP_URI_IN_OUT; } throw new AxisFault("Cannot Determine the MEP"); } } throw new AxisFault("Cannot Determine the MEP"); } /** * Copies the extension attributes * * @param extAttributes * @param description * @param origin */ private void copyExtensionAttributes(Map extAttributes, AxisDescription description, String origin) { QName key; QName value; for (Iterator iterator = extAttributes.keySet().iterator(); iterator .hasNext();) { key = (QName) iterator.next(); if (Constants.URI_POLICY_NS.equals(key.getNamespaceURI()) && "PolicyURIs".equals(key.getLocalPart())) { value = (QName) extAttributes.get(key); String policyURIs = value.getLocalPart(); if (policyURIs.length() != 0) { String[] uris = policyURIs.split(" "); PolicyReference ref; for (int i = 0; i < uris.length; i++) { ref = new PolicyReference(); ref.setURI(uris[i]); if (PORT_TYPE.equals(origin) || PORT_TYPE_OPERATION.equals(origin) || PORT_TYPE_OPERATION_INPUT.equals(origin) || PORT_TYPE_OPERATION_OUTPUT.equals(origin)) { if (description != null) { PolicySubject subject = description.getPolicySubject(); if (subject != null) { subject.attachPolicyReference(ref); } } } } } } } } /** * Process the policy definitions * * @param definition */ private void processPoliciesInDefintion(Definition definition) { processPoliciesInDefintion(definition, new HashSet()); } /** * Process the policy definitions * * @param definition */ private void processPoliciesInDefintion(Definition definition, Set visitedWSDLs) { visitedWSDLs.add(definition.getDocumentBaseURI()); List extElements = definition.getExtensibilityElements(); ExtensibilityElement extElement; UnknownExtensibilityElement unknown = null; Policy policy = null; for (Iterator iterator = extElements.iterator(); iterator.hasNext();) { extElement = (ExtensibilityElement) iterator.next(); if (extElement instanceof UnknownExtensibilityElement) { unknown = (UnknownExtensibilityElement) extElement; if (WSDLConstants.WSDL11Constants.POLICY.equals(unknown.getElementType())) { policy = (Policy) PolicyUtil.getPolicyComponent(unknown.getElement()); String key; if ((key = policy.getName()) != null || (key = policy.getId()) != null) { axisService.registerPolicy(key, policy); // registry.register(key, policy); // registry.register("#" + key, policy); } } } } // include policices in other imported wsdls Iterator iter = definition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); Definition innerDefinition = wsdlImport.getDefinition(); // find the binding recursively if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) { processPoliciesInDefintion(innerDefinition, visitedWSDLs); } } } } private void setEndpointURL(AxisEndpoint axisEndpoint, String endpointURL) throws AxisFault { axisEndpoint.setEndpointURL(endpointURL); try { URL url = new URL(endpointURL); axisEndpoint.setTransportInDescription(url.getProtocol()); } catch (Exception e) { log.debug(e.getMessage(),e); } } /** * Inner class declaration for the processing exceptions */ public static class WSDLProcessingException extends RuntimeException { public WSDLProcessingException() { } public WSDLProcessingException(String message) { super(message); } public WSDLProcessingException(Throwable cause) { super(cause); } public WSDLProcessingException(String message, Throwable cause) { super(message, cause); } } public boolean isAllPorts() { return isAllPorts; } public void setAllPorts(boolean allPorts) { isAllPorts = allPorts; } // private void processPoliciesInDefinition() { // // Object obj; // for (Iterator iterator = wsdl4jDefinition.getExtensibilityElements().iterator(); iterator.hasNext();) { // obj = iterator.next(); // // if (obj instanceof UnknownExtensibilityElement) { // Element e = ((UnknownExtensibilityElement) obj).getElement(); // if (WSDLConstants.WSDL11Constants.POLICY.getNamespaceURI().equals(e.getNamespaceURI()) && // WSDLConstants.WSDL11Constants.POLICY.getLocalPart().equals(e.getLocalName())) { // Policy p = (Policy) PolicyUtil.getPolicyComponent(e); // reg.register(p.getId(), p); // } // } // } // } /** * This method is to split attribute like abc:cde and get the prefix part of it * so the method will retuen abc if the ":" is present in the the string else it * will return null * * @param attributeValue : String * @return String */ public static String getPrefix(String attributeValue) { if (attributeValue != null) { int splitIdex = attributeValue.indexOf(':'); if (splitIdex > 0) { return attributeValue.substring(0, splitIdex); } } return null; } public static String getTypeName(String attributeValue) { if (attributeValue != null) { int splitIdex = attributeValue.indexOf(':'); if (splitIdex > 0) { return attributeValue.substring(splitIdex + 1); } else { return attributeValue; } } return null; } /** * returns the wsld defintion for the given component. * @param definition * @param qname * @param componentType * @param visitedWSDLs * @return definition containing the component. */ private Definition getParentDefinition(Definition definition, QName qname, int componentType, Set visitedWSDLs){ visitedWSDLs.add(definition.getDocumentBaseURI()); Definition newParentDefinition = null; // first find through imports Iterator iter = definition.getImports().values().iterator(); Vector values = null; Import wsdlImport = null; for (; iter.hasNext();) { values = (Vector) iter.next(); for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) { wsdlImport = (Import) valuesIter.next(); Definition innerDefinition = wsdlImport.getDefinition(); if (!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())){ newParentDefinition = getParentDefinition(innerDefinition,qname,componentType,visitedWSDLs); if (newParentDefinition != null){ break; } } } if (newParentDefinition != null) { break; } } // if it not available in imports we check for the current definition. if (newParentDefinition == null) { // this can be in a imported wsdl if (isComponetAvailable(definition, qname, componentType)) { newParentDefinition = definition; } } return newParentDefinition; } private boolean isComponetAvailable(Definition definition, QName qname, int componentType){ boolean isAvailable = false; switch (componentType){ case COMPONENT_BINDING : { isAvailable = (definition.getBinding(qname) != null) && (definition.getBinding(qname).getPortType() != null); break; } case COMPONENT_PORT_TYPE : { isAvailable = (definition.getPortType(qname) != null); break; } case COMPONENT_MESSAGE : { isAvailable = (definition.getMessage(qname) != null); break; } } return isAvailable; } /** * Find BindingOperationEntry * @param boes List of BindingOperationEntry * @param bo BindingOperation * @return BindingOperation or null */ private BindingOperationEntry find(List boes, BindingOperation bo) { for (int i=0; i < boes.size(); i++) { BindingOperationEntry boe = (BindingOperationEntry) boes.get(i); if (boe.getBindingOperation() == bo) { return boe; } } return null; } /** * BindingOperation plus state information */ class BindingOperationEntry { private BindingOperation bindingOperation; private boolean isSOAPBinding; private boolean isHTTPBinding; private String soapStyle; private boolean isRPC; private boolean wrappedInput = true; private boolean wrappedOutput = true; public BindingOperationEntry(BindingOperation bindingOperation, boolean isSOAPBinding, boolean isHTTPBinding, String soapStyle, boolean isRPC) { super(); this.bindingOperation = bindingOperation; this.isSOAPBinding = isSOAPBinding; this.isHTTPBinding = isHTTPBinding; this.soapStyle = soapStyle; this.isRPC = isRPC; } public boolean isHTTPBinding() { return isHTTPBinding; } public boolean isSOAPBinding() { return isSOAPBinding; } public String getSoapStyle() { return soapStyle; } public boolean isRPC() { return isRPC; } public BindingOperation getBindingOperation() { return bindingOperation; } /** * @return true if wrapper xsd is used */ public boolean isWrappedInput() { return wrappedInput; } /** * @param wrappedInput indicate if wrapper xsd is needed */ public void setWrappedInput(boolean wrappedInput) { this.wrappedInput = wrappedInput; } /** * @return true if wrapper xsd is needed for the output message */ public boolean isWrappedOutput() { return wrappedOutput; } /** * @param wrappedOutput indicate if wrapper xsd is needed on the output message */ public void setWrappedOutput(boolean wrappedOutput) { this.wrappedOutput = wrappedOutput; } } } ./src/org/apache/axis2/description/PhaseRule.java0000664000175000017500000000767011767656530021122 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.phaseresolver.PhaseException; import java.io.Serializable; /** * Class PhaseRule */ public class PhaseRule implements Serializable { /** * Field after */ private String after; /** * Field before */ private String before; /** * Field phaseFirst */ private boolean phaseFirst; /** * Field phaseLast */ private boolean phaseLast; /** * Field phaseName */ private String phaseName; /** * Constructor PhaseRule. */ public PhaseRule() { } public PhaseRule(String phaseName) { this.phaseName = phaseName; } /** * Method getAfter. * * @return Returns String. */ public String getAfter() { return after; } /** * Method getBefore. * * @return Returns String. */ public String getBefore() { return before; } /** * Method getPhaseName. * * @return Returns String. */ public String getPhaseName() { return phaseName; } /** * Method isPhaseFirst. * * @return Returns boolean. */ public boolean isPhaseFirst() { return phaseFirst; } /** * Method isPhaseLast. * * @return Returns boolean. */ public boolean isPhaseLast() { return phaseLast; } /** * Set the "after" name for this rule. * * @param after the name of the "after" handler */ public void setAfter(String after) { if ("".equals(after)) after = null; this.after = after; } /** * Set the "before" name for this rule. * * @param before the name of the "before" handler */ public void setBefore(String before) { if ("".equals(before)) before = null; this.before = before; } /** * Method setPhaseFirst. * * @param phaseFirst true if this rule defines the first Handler in a Phase */ public void setPhaseFirst(boolean phaseFirst) { this.phaseFirst = phaseFirst; } /** * Method setPhaseLast. * * @param phaseLast true if this rule defines the last Handler in a Phase */ public void setPhaseLast(boolean phaseLast) { this.phaseLast = phaseLast; } /** * Method setPhaseName. * * @param phaseName the name of the Phase */ public void setPhaseName(String phaseName) { this.phaseName = phaseName; } /** * Validate "sane" rules - cannot have both phaseFirst/phaseLast and before/after * * @throws PhaseException if phaseFirst/phaseLast is set along with before/after */ public void validate() throws PhaseException { if (before != null || after != null) { if (phaseFirst) { throw new PhaseException( "Invalid PhaseRule (phaseFirst is set along with before/after)"); } if (phaseLast) { throw new PhaseException( "Invalid PhaseRule (phaseLast is set along with before/after)"); } } } } ./src/org/apache/axis2/description/ClientUtils.java0000664000175000017500000001526711767656530021472 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.ListenerManager; import org.apache.axis2.i18n.Messages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.net.URI; import java.net.URISyntaxException; /** * Utility methods for various clients to use. */ public class ClientUtils { private static final Log log = LogFactory.getLog(ClientUtils.class); public static synchronized TransportOutDescription inferOutTransport(AxisConfiguration ac, EndpointReference epr, MessageContext msgctx) throws AxisFault { String transportURI = (String) msgctx.getProperty(Constants.Configuration.TRANSPORT_URL); if (transportURI != null && !"".equals(transportURI)) { int index = transportURI.indexOf(':'); String transport = (index > 0) ? transportURI.substring(0, index) : null; if (transport != null) { TransportOutDescription transportOut = ac.getTransportOut(transport); if (transportOut == null) { log.error("No Tranport Sender found for : " + transport); throw new AxisFault("No Tranport Sender found for : " + transport); } else { return ac.getTransportOut(transport); } } else { log.error(Messages.getMessage("cannotInferTransport", transportURI)); throw new AxisFault(Messages.getMessage("cannotInferTransport", transportURI)); } } else { if (msgctx.getOptions().getTransportOut() != null) { if (msgctx.getOptions().getTransportOut().getSender() == null) { log.error(Messages.getMessage("Incomplete transport sender: missing sender!")); throw new AxisFault("Incomplete transport sender: missing sender!"); } return msgctx.getOptions().getTransportOut(); } if (epr == null || (epr.getAddress() == null)) { log.error(Messages.getMessage("cannotInferTransportNoAddr")); throw new AxisFault(Messages.getMessage("cannotInferTransportNoAddr")); } String uri = epr.getAddress(); int index = uri.indexOf(':'); String transport = (index > 0) ? uri.substring(0, index) : null; if (transport != null) { return ac.getTransportOut(transport); } else { log.error(Messages.getMessage("cannotInferTransport", uri)); throw new AxisFault(Messages.getMessage("cannotInferTransport", uri)); } } } public static synchronized TransportInDescription inferInTransport(AxisConfiguration ac, Options options, MessageContext msgCtxt) throws AxisFault { String listenerTransportProtocol = options.getTransportInProtocol(); if (listenerTransportProtocol == null) { EndpointReference replyTo = msgCtxt.getReplyTo(); if (replyTo != null) { try { URI uri = new URI(replyTo.getAddress()); listenerTransportProtocol = uri.getScheme(); } catch (URISyntaxException e) { //need to ignore } } else { //assume listener transport as sender transport if (msgCtxt.getTransportOut() != null) { listenerTransportProtocol = msgCtxt.getTransportOut().getName(); } } } TransportInDescription transportIn = null; if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) { if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) { transportIn = ac.getTransportIn(listenerTransportProtocol); ListenerManager listenerManager = msgCtxt.getConfigurationContext().getListenerManager(); if (transportIn == null) { // TODO : User should not be mandated to give an IN transport. If it is not given, we should // ask from the ListenerManager to give any available transport for this client. log.error(Messages.getMessage("unknownTransport", listenerTransportProtocol)); throw new AxisFault(Messages.getMessage("unknownTransport", listenerTransportProtocol)); } if (!listenerManager.isListenerRunning(transportIn.getName())) { listenerManager.addListener(transportIn, false); } } if (msgCtxt.getAxisService() != null) { if (!msgCtxt.isEngaged(Constants.MODULE_ADDRESSING)) { log.error(Messages.getMessage("2channelNeedAddressing")); throw new AxisFault(Messages.getMessage("2channelNeedAddressing")); } } else { if (!ac.isEngaged(Constants.MODULE_ADDRESSING)) { log.error(Messages.getMessage("2channelNeedAddressing")); throw new AxisFault(Messages.getMessage("2channelNeedAddressing")); } } } return transportIn; } } ./src/org/apache/axis2/description/AxisBindingMessage.java0000664000175000017500000002640311767656530022731 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.WSDL20Util; import org.apache.axis2.util.WSDLSerializationUtil; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.neethi.Policy; public class AxisBindingMessage extends AxisDescription { private String name; private String direction; private Map options; private AxisMessage axisMessage; // Used to indicate whether this message is a fault or not. Needed for the // WSDL 2.0 serializer private boolean fault = false; private Policy effectivePolicy = null; private Date lastPolicyCalcuatedTime = null; public boolean isFault() { return fault; } public void setFault(boolean fault) { this.fault = fault; } public String getName() { return name; } public void setName(String name) { this.name = name; } public AxisMessage getAxisMessage() { return axisMessage; } public void setAxisMessage(AxisMessage axisMessage) { this.axisMessage = axisMessage; } public String getDirection() { return direction; } public void setDirection(String direction) { this.direction = direction; } public AxisBindingMessage() { options = new HashMap(); } public void setProperty(String name, Object value) { options.put(name, value); } /** * @param name * name of the property to search for * @return the value of the property, or null if the property is not found */ public Object getProperty(String name) { Object obj = options.get(name); if (obj != null) { return obj; } return null; } public Object getKey() { return null; // To change body of implemented methods use File | // Settings | File Templates. } public void engageModule(AxisModule axisModule) throws AxisFault { throw new UnsupportedOperationException("Sorry we do not support this"); } public boolean isEngaged(String moduleName) { throw new UnsupportedOperationException( "axisMessage.isEngaged() is not supported"); } /** * Generates the bindingMessage element (can be input, output, infault or * outfault) * * @param tns - * The targetnamespace * @param wsoap - * The SOAP namespace (WSDL 2.0) * @param whttp - * The HTTP namespace (WSDL 2.0) * @param nameSpaceMap - * The namespacemap of the service * @return The generated bindingMessage element */ public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap, OMNamespace whttp, Map nameSpaceMap) { String property; ArrayList list; OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement bindingMessageElement; // If this is a fault, create a fault element and add fault specific // properties if (this.isFault()) { if (this.getParent() instanceof AxisBinding) { bindingMessageElement = omFactory.createOMElement( WSDL2Constants.FAULT_LOCAL_NAME, wsdl); } else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(this .getDirection())) { bindingMessageElement = omFactory.createOMElement( WSDL2Constants.IN_FAULT_LOCAL_NAME, wsdl); } else { bindingMessageElement = omFactory.createOMElement( WSDL2Constants.OUT_FAULT_LOCAL_NAME, wsdl); } bindingMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + this.name)); WSDL20Util.extractWSDL20SoapFaultInfo(options, bindingMessageElement, omFactory, wsoap); Integer code = (Integer) this.options .get(WSDL2Constants.ATTR_WHTTP_CODE); if (code != null) { bindingMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_CODE, whttp, code.toString())); } // Checks whether the message is an input message } else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(this .getDirection())) { bindingMessageElement = omFactory.createOMElement( WSDL2Constants.IN_PUT_LOCAL_NAME, wsdl); // Message should be an output message } else { bindingMessageElement = omFactory.createOMElement( WSDL2Constants.OUT_PUT_LOCAL_NAME, wsdl); } // Populate common properties property = (String) this.options .get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING); if (property != null) { bindingMessageElement .addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_CONTENT_ENCODING, whttp, property)); } list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WHTTP_HEADER); if (list != null && list.size() > 0) { WSDLSerializationUtil.addHTTPHeaderElements(omFactory, list, whttp, bindingMessageElement, nameSpaceMap); } list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WSOAP_HEADER); if (list != null && list.size() > 0) { WSDLSerializationUtil.addSOAPHeaderElements(omFactory, list, wsoap, bindingMessageElement, nameSpaceMap); } list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WSOAP_MODULE); if (list != null && list.size() > 0) { WSDLSerializationUtil.addSOAPModuleElements(omFactory, list, wsoap, bindingMessageElement); } WSDLSerializationUtil.addWSDLDocumentationElement(this, bindingMessageElement, omFactory, wsdl); WSDLSerializationUtil.addPoliciesAsExtensibleElement(this, bindingMessageElement); return bindingMessageElement; } public AxisBindingOperation getAxisBindingOperation() { return (AxisBindingOperation) parent; } public Policy getEffectivePolicy() { if (lastPolicyCalcuatedTime == null || isPolicyUpdated()) { effectivePolicy = calculateEffectivePolicy(); } return effectivePolicy; } public Policy calculateEffectivePolicy() { PolicySubject policySubject = null; ArrayList policyList = new ArrayList(); // AxisBindingMessage policySubject = getPolicySubject(); policyList.addAll(policySubject.getAttachedPolicyComponents()); // AxisBindingOperation policies AxisBindingOperation axisBindingOperation = getAxisBindingOperation(); if (axisBindingOperation != null) { policyList.addAll(axisBindingOperation.getPolicySubject() .getAttachedPolicyComponents()); } // AxisBinding AxisBinding axisBinding = (axisBindingOperation == null) ? null : axisBindingOperation.getAxisBinding(); if (axisBinding != null) { policyList.addAll(axisBinding.getPolicySubject() .getAttachedPolicyComponents()); } // AxisEndpoint AxisEndpoint axisEndpoint = (axisBinding == null) ? null : axisBinding .getAxisEndpoint(); if (axisEndpoint != null) { policyList.addAll(axisEndpoint.getPolicySubject() .getAttachedPolicyComponents()); } // AxisMessage if (axisMessage != null) { policyList.addAll(axisMessage.getPolicySubject() .getAttachedPolicyComponents()); } // AxisOperation AxisOperation axisOperation = (axisMessage == null) ? null : axisMessage.getAxisOperation(); if (axisOperation != null) { policyList.addAll(axisOperation.getPolicySubject() .getAttachedPolicyComponents()); } // AxisService AxisService axisService = (axisOperation == null) ? null : axisOperation.getAxisService(); if (axisService != null) { policyList.addAll(axisService.getPolicySubject() .getAttachedPolicyComponents()); } // AxisConfiguration AxisConfiguration axisConfiguration = (axisService == null) ? null : axisService.getAxisConfiguration(); if (axisConfiguration != null) { policyList.addAll(axisConfiguration.getPolicySubject() .getAttachedPolicyComponents()); } return PolicyUtil.getMergedPolicy(policyList, axisService); } private boolean isPolicyUpdated() { if (getPolicySubject().getLastUpdatedTime().after(lastPolicyCalcuatedTime)) { return true; } // AxisBindingOperation AxisBindingOperation axisBindingOperation = getAxisBindingOperation(); if (axisBindingOperation != null && axisBindingOperation.getPolicySubject().getLastUpdatedTime() .after(lastPolicyCalcuatedTime)) { return true; } // AxisBinding AxisBinding axisBinding = (axisBindingOperation == null) ? null : axisBindingOperation.getAxisBinding(); if (axisBinding != null && axisBinding.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisEndpoint AxisEndpoint axisEndpoint = (axisBinding == null) ? null : axisBinding .getAxisEndpoint(); if (axisEndpoint != null && axisEndpoint.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisMessage if (axisMessage != null && axisMessage.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisOperation AxisOperation axisOperation = (axisMessage == null) ? null : axisMessage.getAxisOperation(); if (axisOperation != null && axisOperation.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisService AxisService axisService = (axisOperation == null) ? null : axisOperation.getAxisService(); if (axisService != null && axisService.getPolicySubject().getLastUpdatedTime().after( lastPolicyCalcuatedTime)) { return true; } // AxisConfiguration AxisConfiguration axisConfiguration = (axisService == null) ? null : axisService.getAxisConfiguration(); if (axisConfiguration != null && axisConfiguration.getPolicySubject().getLastUpdatedTime() .after(lastPolicyCalcuatedTime)) { return true; } return false; } } ./src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java0000664000175000017500000017367711767656530024140 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import com.ibm.wsdl.util.xml.DOM2Writer; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.namespace.Constants; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.util.RESTUtil; import org.apache.axis2.wsdl.HTTPHeaderMessage; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.SOAPModuleMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.woden.WSDLException; import org.apache.woden.WSDLReader; import org.apache.woden.WSDLSource; import org.apache.woden.XMLElement; import org.apache.woden.internal.DOMWSDLFactory; import org.apache.woden.internal.wsdl20.BindingFaultImpl; import org.apache.woden.internal.wsdl20.BindingOperationImpl; import org.apache.woden.internal.wsdl20.extensions.InterfaceOperationExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingExtensionsImpl; import org.apache.woden.internal.wsdl20.extensions.http.HTTPHeaderImpl; import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingExtensionsImpl; import org.apache.woden.resolver.URIResolver; import org.apache.woden.schema.Schema; import org.apache.woden.types.NamespaceDeclaration; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingFault; import org.apache.woden.wsdl20.BindingFaultReference; import org.apache.woden.wsdl20.BindingMessageReference; import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.ElementDeclaration; import org.apache.woden.wsdl20.Endpoint; import org.apache.woden.wsdl20.Interface; import org.apache.woden.wsdl20.InterfaceFault; import org.apache.woden.wsdl20.InterfaceFaultReference; import org.apache.woden.wsdl20.InterfaceMessageReference; import org.apache.woden.wsdl20.InterfaceOperation; import org.apache.woden.wsdl20.Service; import org.apache.woden.wsdl20.enumeration.MessageLabel; import org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions; import org.apache.woden.wsdl20.extensions.http.HTTPHeader; import org.apache.woden.wsdl20.extensions.http.HTTPLocation; import org.apache.woden.wsdl20.extensions.rpc.Argument; import org.apache.woden.wsdl20.extensions.rpc.RPCInterfaceOperationExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPEndpointExtensions; import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock; import org.apache.woden.wsdl20.extensions.soap.SOAPModule; import org.apache.woden.wsdl20.xml.DescriptionElement; import org.apache.woden.wsdl20.xml.DocumentableElement; import org.apache.woden.wsdl20.xml.DocumentationElement; import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement; import org.apache.woden.wsdl20.xml.TypesElement; import org.apache.woden.xml.XMLAttr; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.InputStream; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; public class WSDL20ToAxisServiceBuilder extends WSDLToAxisServiceBuilder { protected static final Log log = LogFactory.getLog(WSDL20ToAxisServiceBuilder.class); protected Description description; private String wsdlURI; protected String interfaceName; private String savedTargetNamespace; private NamespaceDeclaration[] namespacemap; private List operationNames = new ArrayList(); private NamespaceMap stringBasedNamespaceMap; private boolean setupComplete = false; private Service wsdlService; private boolean isAllPorts; private URIResolver customWSDLResolver; // As bindings are processed add it to this array so that we dont process the same binding twice private Map processedBindings; public WSDL20ToAxisServiceBuilder(InputStream in, QName serviceName, String interfaceName) { this.in = in; this.serviceName = serviceName; this.interfaceName = interfaceName; this.axisService = new AxisService(); setPolicyRegistryFromService(axisService); } public WSDL20ToAxisServiceBuilder(String wsdlUri, String name, String interfaceName) throws WSDLException { String fullPath = wsdlUri; if (!wsdlUri.startsWith("http://")) { File file = new File(wsdlUri); fullPath = file.getAbsolutePath(); } setBaseUri(fullPath); Description description; try { description = readInTheWSDLFile(fullPath); } catch (AxisFault axisFault) { throw new WSDLException("ERROR", "Exception occured while reading WSDL 2.0 doc", axisFault); } DescriptionElement descriptionElement = description.toElement(); savedTargetNamespace = descriptionElement.getTargetNamespace() .toString(); namespacemap = descriptionElement.getDeclaredNamespaces(); this.description = description; this.serviceName = null; if (name != null) { serviceName = new QName(descriptionElement.getTargetNamespace().toString(), name); } this.interfaceName = interfaceName; this.axisService = new AxisService(); setPolicyRegistryFromService(axisService); } public WSDL20ToAxisServiceBuilder(String wsdlUri, String name, String interfaceName, boolean isAllPorts) throws WSDLException { this(wsdlUri, name, interfaceName); this.isAllPorts = isAllPorts; } public WSDL20ToAxisServiceBuilder(String wsdlUri, QName serviceName) { super(null, serviceName); this.wsdlURI = wsdlUri; } public WSDL20ToAxisServiceBuilder(String wsdlUri, AxisService service) { super(null, service); this.wsdlURI = wsdlUri; } public boolean isAllPorts() { return isAllPorts; } public void setAllPorts(boolean allPorts) { isAllPorts = allPorts; } /** * sets a custom WSDL locator * * @param customResolver - A custom Resolver that can resolve imports and includes */ public void setCustomWSDLResolver(URIResolver customResolver) { this.customWSDLResolver = customResolver; } public AxisService populateService() throws AxisFault { try { setup(); // Setting wsdl4jdefintion to axisService , so if some one want // to play with it he can do that by getting the parameter Parameter wsdlDescriptionParamter = new Parameter(); wsdlDescriptionParamter.setName(WSDLConstants.WSDL_20_DESCRIPTION); wsdlDescriptionParamter.setValue(description); axisService.addParameter(wsdlDescriptionParamter); if (description == null) { return null; } // setting target name space axisService.setTargetNamespace(savedTargetNamespace); // if there are documentation elements in the root. Lets add them as the wsdlService description // but since there can be multiple documentation elements, lets only add the first one addDocumentation(axisService, description.toElement()); // DocumentationElement[] documentationElements = description.toElement().getDocumentationElements(); // if (documentationElements != null && documentationElements.length > 0) { // axisService.setServiceDescription(documentationElements[0].getContent().toString()); // } // adding ns in the original WSDL // processPoliciesInDefintion(wsdl4jDefinition); TODO : Defering policy handling for now - Chinthaka // policy support // schema generation // Create the namespacemap axisService.setNamespaceMap(stringBasedNamespaceMap); // TypeDefinition[] typeDefinitions = // description.getTypeDefinitions(); // for(int i=0; i 0) { endpoint = endpoints[0]; } if (endpoint != null) { axisService.setEndpointName(endpoint.getName().toString()); axisService.setBindingName(endpoint.getBinding().getName().getLocalPart()); axisService.setEndpointURL(endpoint.getAddress().toString()); } } private void processService() throws AxisFault { Service[] services = description.getServices(); if (services.length == 0) { throw new AxisFault("No wsdlService found in the WSDL"); } if (serviceName != null) { for (int i = 0; i < services.length; i++) { if (serviceName.equals(services[i].getName())) { wsdlService = services[i]; break; // found it. Stop looking. } } if (wsdlService == null) { throw new AxisFault("Service with the specified name not found in the WSDL : " + serviceName.getLocalPart()); } } else { wsdlService = services[0]; } axisService.setName(wsdlService.getName().getLocalPart()); Interface serviceInterface = wsdlService.getInterface(); axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME, serviceInterface.getName().getLocalPart())); processInterface(serviceInterface); if (isCodegen) { axisService.setOperationsNameList(operationNames); } processEndpoints(serviceInterface); } private AxisEndpoint processEndpoint(Endpoint endpoint, Interface serviceInterface) throws AxisFault { AxisEndpoint axisEndpoint = new AxisEndpoint(); axisEndpoint.setParent(axisService); axisEndpoint.setName(endpoint.getName().toString()); setEndpointURL(axisEndpoint, endpoint.getAddress().toString()); Binding binding = endpoint.getBinding(); AxisBinding axisBinding; if (processedBindings.containsKey(binding.getName())) { axisBinding = (AxisBinding) processedBindings.get(binding.getName()); } else { axisBinding = processBinding(binding, serviceInterface); } axisEndpoint.setBinding(axisBinding); String bindingType = binding.getType().toString(); if (bindingType.equals(WSDL2Constants.URI_WSDL2_SOAP)) { processSOAPBindingEndpointExtensions(endpoint, axisEndpoint); } else if (bindingType.equals(WSDL2Constants.URI_WSDL2_HTTP)) { processHTTPBindingEndpointExtensions(endpoint, axisEndpoint); } addDocumentation(axisEndpoint, endpoint.toElement()); return axisEndpoint; } private void processSOAPBindingEndpointExtensions(Endpoint endpoint, AxisEndpoint axisEndpoint) throws AxisFault { SOAPEndpointExtensions soapEndpointExtensions; try { soapEndpointExtensions = (SOAPEndpointExtensions) endpoint .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_SOAP)); } catch (URISyntaxException e) { throw new AxisFault("SOAP Binding Endpoint Extension not found"); } if (soapEndpointExtensions != null) { axisEndpoint.setProperty(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_TYPE, soapEndpointExtensions.getHttpAuthenticationScheme()); axisEndpoint.setProperty(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_REALM, soapEndpointExtensions.getHttpAuthenticationRealm()); } } private void processHTTPBindingEndpointExtensions(Endpoint endpoint, AxisEndpoint axisEndpoint) throws AxisFault { HTTPEndpointExtensions httpEndpointExtensions; try { httpEndpointExtensions = (HTTPEndpointExtensions) endpoint .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_HTTP)); } catch (URISyntaxException e) { throw new AxisFault("HTTP Binding Endpoint Extension not found"); } if (httpEndpointExtensions != null) { axisEndpoint.setProperty(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_TYPE, httpEndpointExtensions.getHttpAuthenticationScheme()); axisEndpoint.setProperty(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_REALM, httpEndpointExtensions.getHttpAuthenticationRealm()); } } /** * contains all code which gathers non-wsdlService specific information from the * wsdl. *

        * After all the setup completes successfully, the setupComplete field is * set so that any subsequent calls to setup() will result in a no-op. Note * that subclass WSDL20ToAllAxisServicesBuilder will call populateService * for each endpoint in the WSDL. Separating the non-wsdlService specific * information here allows WSDL20ToAllAxisServicesBuilder to only do this * work 1 time per WSDL, instead of for each endpoint on each wsdlService. * * @throws AxisFault - Thrown in case the necessary resources are not available in the WSDL * @throws WSDLException - Thrown in case Woden throws an exception */ protected void setup() throws AxisFault, WSDLException { if (setupComplete) { // already setup, just do nothing and return return; } try { if (description == null) { Description description; DescriptionElement descriptionElement; if (wsdlURI != null && !"".equals(wsdlURI)) { description = readInTheWSDLFile(wsdlURI); descriptionElement = description.toElement(); } else if (in != null) { description = readInTheWSDLFile(in); descriptionElement = description.toElement(); } else { throw new AxisFault("No resources found to read the wsdl"); } savedTargetNamespace = descriptionElement.getTargetNamespace().toString(); namespacemap = descriptionElement.getDeclaredNamespaces(); this.description = description; } // Create the namespacemap stringBasedNamespaceMap = new NamespaceMap(); for (int i = 0; i < namespacemap.length; i++) { NamespaceDeclaration namespaceDeclaration = namespacemap[i]; stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(), namespaceDeclaration.getNamespaceURI().toString()); } setupComplete = true; } catch (AxisFault e) { throw e; // just rethrow AxisFaults } catch (WSDLException e) { // Preserve the WSDLException throw e; } catch(Exception e) { throw AxisFault.makeFault(e); } } private AxisBinding processBinding(Binding binding, Interface serviceInterface) throws AxisFault { AxisBinding axisBinding = new AxisBinding(); axisBinding.setName(binding.getName()); String bindingType = binding.getType().toString(); axisBinding.setType(bindingType); if (bindingType.equals(WSDL2Constants.URI_WSDL2_SOAP)) { processSOAPBindingExtention(binding, axisBinding, serviceInterface); } else if (bindingType.equals(WSDL2Constants.URI_WSDL2_HTTP)) { processHTTPBindingExtention(binding, axisBinding, serviceInterface); } // We should process the interface based on the service not on a binding processedBindings.put(binding.getName(), axisBinding); addDocumentation(axisBinding, binding.toElement()); return axisBinding; } private void processSOAPBindingExtention(Binding binding, AxisBinding axisBinding, Interface serviceInterface) throws AxisFault { // Capture all the binding specific properties // Set a comparator so tha httpLocations are stored in decending order Map httpLocationTable = new TreeMap(new Comparator(){ public int compare(Object o1, Object o2) { return (-1 * ((Comparable)o1).compareTo(o2)); } }); SOAPBindingExtensions soapBindingExtensions; try { soapBindingExtensions = (SOAPBindingExtensionsImpl) binding .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_SOAP)); } catch (URISyntaxException e) { throw new AxisFault("Soap Binding Extention not found"); } String soapVersion; if ((soapVersion = soapBindingExtensions.getSoapVersion()) != null) { if (soapVersion.equals(WSDL2Constants.SOAP_VERSION_1_1)) { axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else { axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } } else { // Set the default to soap 1.2 axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, WSDL20DefaultValueHolder.getDefaultValue( WSDL2Constants.ATTR_WSOAP_VERSION)); } URI soapUnderlyingProtocol = soapBindingExtensions.getSoapUnderlyingProtocol(); if (soapUnderlyingProtocol != null) { axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_PROTOCOL, soapUnderlyingProtocol.toString()); } URI soapMepDefault = soapBindingExtensions.getSoapMepDefault(); if (soapMepDefault != null) { axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_MEP, soapMepDefault.toString()); } axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, soapBindingExtensions.getHttpContentEncodingDefault()); axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE, createSoapModules(soapBindingExtensions.getSoapModules())); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, soapBindingExtensions.getHttpQueryParameterSeparatorDefault()); // Capture all the fault specific properties BindingFault[] bindingFaults = binding.getBindingFaults(); for (int i = 0; i < bindingFaults.length; i++) { BindingFaultImpl bindingFault = (BindingFaultImpl) bindingFaults[i]; InterfaceFault interfaceFault = serviceInterface.getFromAllInterfaceFaults(bindingFault.getRef()); AxisBindingMessage axisBindingFault = new AxisBindingMessage(); axisBindingFault.setFault(true); axisBindingFault.setName(interfaceFault.getName().getLocalPart()); axisBindingFault.setParent(axisBinding); addDocumentation(axisBindingFault, interfaceFault.toElement()); SOAPBindingFaultExtensions soapBindingFaultExtensions; try { soapBindingFaultExtensions = (SOAPBindingFaultExtensions) bindingFault .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_SOAP)); } catch (URISyntaxException e) { throw new AxisFault("Soap Binding Extention not found"); } axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER, createHttpHeaders( soapBindingFaultExtensions.getHttpHeaders())); axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, soapBindingFaultExtensions.getHttpContentEncoding()); axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_CODE, soapBindingFaultExtensions.getSoapFaultCode()); axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_SUBCODES, soapBindingFaultExtensions.getSoapFaultSubcodes()); axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, createSoapHeaders( soapBindingFaultExtensions.getSoapHeaders())); axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE, createSoapModules( soapBindingFaultExtensions.getSoapModules())); axisBinding.addFault(axisBindingFault); } // Capture all the binding operation specific properties BindingOperation[] bindingOperations = binding.getBindingOperations(); for (int i = 0; i < bindingOperations.length; i++) { BindingOperationImpl bindingOperation = (BindingOperationImpl) bindingOperations[i]; AxisBindingOperation axisBindingOperation = new AxisBindingOperation(); InterfaceOperation interfaceOperation = serviceInterface.getFromAllInterfaceOperations(bindingOperation.getRef()); AxisOperation axisOperation = axisService.getOperation(interfaceOperation.getName()); axisBindingOperation.setAxisOperation(axisOperation); axisBindingOperation.setParent(axisBinding); axisBindingOperation.setName(axisOperation.getName()); addDocumentation(axisBindingOperation, bindingOperation.toElement()); SOAPBindingOperationExtensions soapBindingOperationExtensions; try { soapBindingOperationExtensions = ((SOAPBindingOperationExtensions) bindingOperation.getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_SOAP))); } catch (URISyntaxException e) { throw new AxisFault("Soap Binding Extention not found"); } URI soapAction = soapBindingOperationExtensions.getSoapAction(); if (soapAction != null && !"\"\"".equals(soapAction.toString())) { axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapAction.toString()); } axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE, createSoapModules( soapBindingOperationExtensions.getSoapModules())); URI soapMep = soapBindingOperationExtensions.getSoapMep(); if (soapMep != null) { axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_MEP, soapMep.toString()); } HTTPLocation httpLocation = soapBindingOperationExtensions.getHttpLocation(); // If httpLocation is not null we should extract a constant part from it and add its value and the // corresponding AxisOperation to a map in order to dispatch rest messages. If httpLocation is null we add // the operation name into this map. String httpLocationString = ""; if (httpLocation != null) { String httpLocationTemplete = httpLocation.getOriginalLocation(); axisBindingOperation .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocationTemplete); httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete, HTTPConstants.HEADER_POST); } httpLocationTable.put(httpLocationString, axisOperation); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, soapBindingOperationExtensions.getHttpContentEncodingDefault()); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, soapBindingOperationExtensions.getHttpQueryParameterSeparator()); BindingMessageReference[] bindingMessageReferences = bindingOperation.getBindingMessageReferences(); for (int j = 0; j < bindingMessageReferences.length; j++) { BindingMessageReference bindingMessageReference = bindingMessageReferences[j]; AxisBindingMessage axisBindingMessage = new AxisBindingMessage(); axisBindingMessage.setParent(axisBindingOperation); addDocumentation(axisBindingMessage, bindingMessageReference.toElement()); AxisMessage axisMessage = axisOperation.getMessage(bindingMessageReference .getInterfaceMessageReference().getMessageLabel().toString()); axisBindingMessage.setAxisMessage(axisMessage); axisBindingMessage.setName(axisMessage.getName()); axisBindingMessage.setDirection(axisMessage.getDirection()); SOAPBindingMessageReferenceExtensions soapBindingMessageReferenceExtensions; try { soapBindingMessageReferenceExtensions = (SOAPBindingMessageReferenceExtensions) bindingMessageReference .getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_SOAP)); } catch (URISyntaxException e) { throw new AxisFault("Soap Binding Extention not found"); } axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER, createHttpHeaders( soapBindingMessageReferenceExtensions.getHttpHeaders())); axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, soapBindingMessageReferenceExtensions.getHttpContentEncoding()); axisBindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, createSoapHeaders( soapBindingMessageReferenceExtensions.getSoapHeaders())); axisBindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE, createSoapModules( soapBindingMessageReferenceExtensions.getSoapModules())); axisBindingOperation.addChild(axisMessage.getDirection(), axisBindingMessage); } BindingFaultReference [] bindingFaultReferences = bindingOperation.getBindingFaultReferences(); for (int j = 0; j < bindingFaultReferences.length; j++) { BindingFaultReference bindingFaultReference = bindingFaultReferences[j]; AxisBindingMessage axisBindingMessageFault = new AxisBindingMessage(); addDocumentation(axisBindingMessageFault, bindingFaultReference.toElement()); axisBindingMessageFault.setParent(axisBindingOperation); axisBindingMessageFault.setFault(true); axisBindingMessageFault.setName(bindingFaultReference.getInterfaceFaultReference() .getInterfaceFault().getName().getLocalPart()); SOAPBindingFaultReferenceExtensions soapBindingFaultReferenceExtensions; try { soapBindingFaultReferenceExtensions = (SOAPBindingFaultReferenceExtensions) bindingFaultReference .getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_SOAP)); } catch (URISyntaxException e) { throw new AxisFault("Soap Binding Extention not found"); } axisBindingMessageFault.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE, createSoapModules( soapBindingFaultReferenceExtensions.getSoapModules())); axisBindingOperation.addFault(axisBindingMessageFault); } axisBinding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationTable); axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); } } private void processHTTPBindingExtention(Binding binding, AxisBinding axisBinding, Interface serviceInterface) throws AxisFault { // Set a comparator so tha httpLocations are stored in decending order Map httpLocationTable = new TreeMap(new Comparator(){ public int compare(Object o1, Object o2) { return (-1 * ((Comparable)o1).compareTo(o2)); } }); // Capture all the binding specific properties HTTPBindingExtensionsImpl httpBindingExtensions; try { httpBindingExtensions = (HTTPBindingExtensionsImpl) binding .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_HTTP)); } catch (URISyntaxException e) { throw new AxisFault("HTTP Binding Extention not found"); } String httpMethodDefault = httpBindingExtensions.getHttpMethodDefault(); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpMethodDefault); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, httpBindingExtensions.getHttpQueryParameterSeparatorDefault()); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, httpBindingExtensions.getHttpContentEncodingDefault()); // Capture all the fault specific properties BindingFault[] bindingFaults = binding.getBindingFaults(); for (int i = 0; i < bindingFaults.length; i++) { BindingFaultImpl bindingFault = (BindingFaultImpl) bindingFaults[i]; InterfaceFault interfaceFault = serviceInterface.getFromAllInterfaceFaults(bindingFault.getRef()); AxisBindingMessage axisBindingFault = new AxisBindingMessage(); axisBindingFault.setFault(true); axisBindingFault.setName(interfaceFault.getName().getLocalPart()); axisBindingFault.setParent(axisBinding); addDocumentation(axisBindingFault, interfaceFault.toElement()); HTTPBindingFaultExtensions httpBindingFaultExtensions; try { httpBindingFaultExtensions = (HTTPBindingFaultExtensions) bindingFault .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_HTTP)); } catch (URISyntaxException e) { throw new AxisFault("HTTP Binding Extention not found"); } axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_CODE, httpBindingFaultExtensions .getHttpErrorStatusCode().getCode()); axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER, createHttpHeaders( httpBindingFaultExtensions.getHttpHeaders())); axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, httpBindingFaultExtensions.getHttpContentEncoding()); axisBinding.addFault(axisBindingFault); } // Capture all the binding operation specific properties BindingOperation[] bindingOperations = binding.getBindingOperations(); for (int i = 0; i < bindingOperations.length; i++) { BindingOperationImpl bindingOperation = (BindingOperationImpl) bindingOperations[i]; AxisBindingOperation axisBindingOperation = new AxisBindingOperation(); InterfaceOperation interfaceOperation = serviceInterface.getFromAllInterfaceOperations(bindingOperation.getRef()); AxisOperation axisOperation = axisService.getOperation(interfaceOperation.getName()); axisBindingOperation.setAxisOperation(axisOperation); axisBindingOperation.setParent(axisBinding); axisBindingOperation.setName(axisOperation.getName()); addDocumentation(axisBindingOperation, bindingOperation.toElement()); HTTPBindingOperationExtensions httpBindingOperationExtensions; try { httpBindingOperationExtensions = ((HTTPBindingOperationExtensions) bindingOperation.getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_HTTP))); } catch (URISyntaxException e) { throw new AxisFault("HTTP Binding Extention not found"); } axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_FAULT_SERIALIZATION, httpBindingOperationExtensions.getHttpFaultSerialization()); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION, httpBindingOperationExtensions.getHttpInputSerialization()); String httpMethod = httpBindingOperationExtensions. getHttpMethod(); if (httpMethod == null) { if (httpMethodDefault != null) { httpMethod = httpMethodDefault; } else { Boolean safeParameter = (Boolean) axisOperation.getParameterValue(WSDL2Constants.ATTR_WSDLX_SAFE); if (safeParameter != null && safeParameter.booleanValue()){ httpMethod = HTTPConstants.HEADER_GET; } else { httpMethod = HTTPConstants.HEADER_POST; } } } axisBindingOperation .setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpMethod); HTTPLocation httpLocation = httpBindingOperationExtensions.getHttpLocation(); // If httpLocation is not null we should extract a constant part from it and add its value and the // corresponding AxisOperation to a map in order to dispatch rest messages. If httpLocation is null we add // the operation name into this map. String httpLocationString = ""; if (httpLocation != null) { String httpLocationTemplete = httpLocation.getOriginalLocation(); axisBindingOperation .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocationTemplete); httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete, httpMethod); } httpLocationTable.put(httpLocationString, axisOperation); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, httpBindingOperationExtensions. isHttpLocationIgnoreUncited()); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION, httpBindingOperationExtensions.getHttpOutputSerialization()); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, httpBindingOperationExtensions.getHttpQueryParameterSeparator()); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, httpBindingOperationExtensions.getHttpContentEncodingDefault()); BindingMessageReference[] bindingMessageReferences = bindingOperation.getBindingMessageReferences(); for (int j = 0; j < bindingMessageReferences.length; j++) { BindingMessageReference bindingMessageReference = bindingMessageReferences[j]; AxisBindingMessage axisBindingMessage = new AxisBindingMessage(); axisBindingMessage.setParent(axisBindingOperation); AxisMessage axisMessage = axisOperation.getMessage(bindingMessageReference .getInterfaceMessageReference().getMessageLabel().toString()); axisBindingMessage.setAxisMessage(axisMessage); axisBindingMessage.setName(axisMessage.getName()); axisBindingMessage.setDirection(axisMessage.getDirection()); addDocumentation(axisBindingMessage, bindingMessageReference.toElement()); HTTPBindingMessageReferenceExtensions httpBindingMessageReferenceExtensions; try { httpBindingMessageReferenceExtensions = (HTTPBindingMessageReferenceExtensions) bindingMessageReference .getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_HTTP)); } catch (URISyntaxException e) { throw new AxisFault("HTTP Binding Extention not found"); } axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER, createHttpHeaders( httpBindingMessageReferenceExtensions.getHttpHeaders())); axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING, httpBindingMessageReferenceExtensions.getHttpContentEncoding()); axisBindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisBindingMessage); } BindingFaultReference[] bindingFaultReferences = bindingOperation.getBindingFaultReferences(); for (int j = 0; j < bindingFaultReferences.length; j++) { BindingFaultReference bindingFaultReference = bindingFaultReferences[j]; AxisBindingMessage axisBindingMessageFault = new AxisBindingMessage(); axisBindingMessageFault.setFault(true); axisBindingMessageFault.setName(bindingFaultReference.getInterfaceFaultReference() .getInterfaceFault().getName().getLocalPart()); axisBindingMessageFault.setParent(axisBindingOperation); axisBindingOperation.addFault(axisBindingMessageFault); addDocumentation(axisBindingMessageFault, bindingFaultReference.toElement()); } axisBinding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationTable); axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); } } private void processInterface(Interface serviceInterface) throws AxisFault { // TODO copy the policy elements // copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(), // axisService, PORT_TYPE); InterfaceOperation[] interfaceOperations = serviceInterface .getInterfaceOperations(); for (int i = 0; i < interfaceOperations.length; i++) { axisService.addOperation(populateOperations(interfaceOperations[i])); operationNames.add(interfaceOperations[i].getName()); } Interface[] extendedInterfaces = serviceInterface.getExtendedInterfaces(); for (int i = 0; i < extendedInterfaces.length; i++) { Interface extendedInterface = extendedInterfaces[i]; processInterface(extendedInterface); } } private AxisOperation populateOperations(InterfaceOperation operation) throws AxisFault { QName opName = operation.getName(); // Copy Name Attribute AxisOperation axisOperation = axisService.getOperation(opName); if (axisOperation == null) { URI pattern = operation.getMessageExchangePattern(); String MEP; if (pattern == null) { MEP = WSDL20DefaultValueHolder.getDefaultValue(WSDL2Constants.ATTR_WSOAP_MEP); } else { MEP = pattern.toString(); } if(!isServerSide){ // If in the client, need to toggle in-out to out-in etc. if(WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)){ MEP = WSDL2Constants.MEP_URI_OUT_IN; } if(WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)){ MEP = WSDL2Constants.MEP_URI_OUT_ONLY; } if(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)){ MEP = WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN; } } axisOperation = AxisOperationFactory.getOperationDescription(MEP); axisOperation.setName(opName); } URI[] operationStyle = operation.getStyle(); if (operationStyle != null && operationStyle.length > 0) { Parameter opStyleParameter = new Parameter(); opStyleParameter.setName(WSDL2Constants.OPERATION_STYLE); opStyleParameter.setValue(operationStyle); axisOperation.addParameter(opStyleParameter); } addDocumentation(axisOperation, operation.toElement()); // assuming the style of the operations of WSDL 2.0 is always document, for the time being :) // The following can be used to capture the wsdlx:safe attribute InterfaceOperationExtensionsImpl interfaceOperationExtensions; try { interfaceOperationExtensions = (InterfaceOperationExtensionsImpl) operation .getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_EXTENSIONS)); } catch (URISyntaxException e) { throw new AxisFault("WSDL2 extensions not defined for this operation"); } if (interfaceOperationExtensions != null) { Parameter parameter = new Parameter(WSDL2Constants.ATTR_WSDLX_SAFE, Boolean.valueOf( interfaceOperationExtensions.isSafe())); axisOperation.addParameter(parameter); } RPCInterfaceOperationExtensions rpcInterfaceOperationExtensions; try { rpcInterfaceOperationExtensions = (RPCInterfaceOperationExtensions) operation .getComponentExtensionContext( new URI(WSDL2Constants.URI_WSDL2_RPC)); } catch (URISyntaxException e) { throw new AxisFault("WSDL2 extensions not defined for this operation"); } if (rpcInterfaceOperationExtensions != null) { String rpcsig = ""; Argument[] signatures = rpcInterfaceOperationExtensions.getRPCSignature(); for (int i = 0; i < signatures.length; i++) { Argument sigArgument = signatures[i]; rpcsig = rpcsig + sigArgument.getName().getLocalPart() + " " + sigArgument.getDirection() + " "; } Parameter parameter = new Parameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, rpcsig); axisOperation.addParameter(parameter); } InterfaceMessageReference[] interfaceMessageReferences = operation .getInterfaceMessageReferences(); for (int i = 0; i < interfaceMessageReferences.length; i++) { InterfaceMessageReference messageReference = interfaceMessageReferences[i]; if (messageReference.getMessageLabel().equals( MessageLabel.IN)) { // Its an input message if (isServerSide) { createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_IN_VALUE); } else { createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_OUT_VALUE); } } else if (messageReference.getMessageLabel().equals( MessageLabel.OUT)) { if (isServerSide) { createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_OUT_VALUE); } else { createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_IN_VALUE); } } } // add operation level faults InterfaceFaultReference[] faults = operation.getInterfaceFaultReferences(); for (int i = 0; i < faults.length; i++) { AxisMessage faultMessage = new AxisMessage(); InterfaceFaultReference interfaceFaultReference = faults[i]; faultMessage.setDirection(interfaceFaultReference.getDirection().toString()); InterfaceFault interfaceFault = interfaceFaultReference.getInterfaceFault(); if (interfaceFault == null) { throw new AxisFault("Interface Fault reference defined in operation " + opName + " cannot be found in interface"); } faultMessage.setElementQName(interfaceFault.getElementDeclaration().getName()); faultMessage.setName(interfaceFault.getName().getLocalPart()); axisOperation.setFaultMessages(faultMessage); } return axisOperation; } private void createAxisMessage(AxisOperation axisOperation, InterfaceMessageReference messageReference, String messageLabel) throws AxisFault { AxisMessage message = axisOperation .getMessage(messageLabel); String messageContentModelName = messageReference.getMessageContentModel(); QName elementQName = null; if (WSDL2Constants.NMTOKEN_ELEMENT.equals(messageContentModelName)) { ElementDeclaration elementDeclaration = messageReference.getElementDeclaration(); if (elementDeclaration == null) { InterfaceMessageReferenceElement messageReferenceElement = messageReference.toElement(); QName qName = messageReferenceElement.getElement().getQName(); throw new AxisFault("Unable to find element " + qName.toString() + " reffered to by operation " + axisOperation.getName().getLocalPart()); } elementQName = elementDeclaration.getName(); } else if (WSDL2Constants.NMTOKEN_ANY.equals(messageContentModelName)) { elementQName = Constants.XSD_ANY; } else if (WSDL2Constants.NMTOKEN_NONE.equals(messageContentModelName)) { // nothing to do here keep the message element as null } else { throw new AxisFault("Sorry we do not support " + messageContentModelName + ". We do only support #any, #none and #element as message content models."); } message.setElementQName(elementQName); message.setName(elementQName != null ? elementQName.getLocalPart() : axisOperation.getName().getLocalPart()); axisOperation.addMessage(message, messageLabel); if(WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(messageLabel)){ XMLAttr xa = messageReference.toElement().getExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl","Action")); if(xa!=null){ String value = (String)xa.getContent(); if(value != null){ ArrayList al = axisOperation.getWSAMappingList(); if(al == null){ al = new ArrayList(); axisOperation.setWsamappingList(al); } al.add(value); } } }else{ XMLAttr xa = messageReference.toElement().getExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl","Action")); if(xa!=null){ String value = (String)xa.getContent(); if(value != null){ axisOperation.setOutputAction(value); } } } // populate this map so that this can be used in SOAPBody based dispatching if (elementQName != null) { axisService .addMessageElementQNameToOperationMapping(elementQName, axisOperation); } } private Description readInTheWSDLFile(String wsdlURI) throws WSDLException, AxisFault { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder; Document document; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(wsdlURI); } catch (ParserConfigurationException e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } catch (SAXException e) { throw AxisFault.makeFault(e); } return readInTheWSDLFile(document); } private Description readInTheWSDLFile(InputStream inputStream) throws WSDLException, AxisFault { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder; Document document; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(inputStream); } catch (ParserConfigurationException e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } catch (SAXException e) { throw AxisFault.makeFault(e); } return readInTheWSDLFile(document); } private Description readInTheWSDLFile(Document document) throws WSDLException { WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader(); if (customWSDLResolver != null) { reader.setURIResolver(customWSDLResolver); } // This turns on WSDL validation which is set off by default. reader.setFeature(WSDLReader.FEATURE_VALIDATION, true); WSDLSource wsdlSource = reader.createWSDLSource(); wsdlSource.setSource(document.getDocumentElement()); String uri = getBaseUri(); if (uri != null && !"".equals(uri)) { try { wsdlSource.setBaseURI(new URI(uri)); } catch (URISyntaxException e) { File f = new File(uri); if(f.exists()) { wsdlSource.setBaseURI(f.toURI()); } else { log.error(e.toString(), e); } } } if (log.isDebugEnabled()) { log.debug("Reading 2.0 WSDL with wsdl uri = " + wsdlURI); log.debug(" the stack at this point is: " + stackToString()); } return reader.readWSDL(wsdlSource); } /** * Convert woden dependent SOAPHeaderBlock objects to SOAPHeaderMessage objects * * @param soapHeaderBlocks - An array of SOAPHeaderBlock objects * @return ArrayList - An ArrayList of SOAPHeaderMessage objects */ private ArrayList createSoapHeaders(SOAPHeaderBlock soapHeaderBlocks[]) { if (soapHeaderBlocks.length == 0) { return null; } ArrayList soapHeaderMessages = new ArrayList(); for (int i = 0; i < soapHeaderBlocks.length; i++) { SOAPHeaderBlock soapHeaderBlock = soapHeaderBlocks[i]; ElementDeclaration elementDeclaration = soapHeaderBlock.getElementDeclaration(); if (elementDeclaration != null) { QName name = elementDeclaration.getName(); SOAPHeaderMessage soapHeaderMessage = new SOAPHeaderMessage(); soapHeaderMessage.setElement(name); soapHeaderMessage.setRequired(soapHeaderBlock.isRequired().booleanValue()); soapHeaderMessage .setMustUnderstand(soapHeaderBlock.mustUnderstand().booleanValue()); soapHeaderMessages.add(soapHeaderMessage); } } return soapHeaderMessages; } /** * Convert woden dependent SOAPHeaderBlock objects to SOAPHeaderMessage objects * * @param soapModules - An array of SOAPModule objects * @return ArrayList - An ArrayList of SOAPHeaderMessage objects */ private ArrayList createSoapModules(SOAPModule soapModules[]) { if (soapModules.length == 0) { return null; } ArrayList soapModuleMessages = new ArrayList(); for (int i = 0; i < soapModules.length; i++) { SOAPModule soapModule = soapModules[i]; SOAPModuleMessage soapModuleMessage = new SOAPModuleMessage(); soapModuleMessage.setUri(soapModule.getRef().toString()); soapModuleMessages.add(soapModuleMessage); } return soapModuleMessages; } /** * Convert woden dependent HTTPHeader objects to Header objects * * @param httpHeaders - An array of HTTPHeader objects * @return ArrayList - An ArrayList of Header objects */ private ArrayList createHttpHeaders(HTTPHeader httpHeaders[]) { if (httpHeaders.length == 0) { return null; } ArrayList httpHeaderMessages = new ArrayList(); for (int i = 0; i < httpHeaders.length; i++) { HTTPHeaderImpl httpHeader = (HTTPHeaderImpl) httpHeaders[i]; HTTPHeaderMessage httpHeaderMessage = new HTTPHeaderMessage(); httpHeaderMessage.setqName(httpHeader.getTypeName()); httpHeaderMessage.setName(httpHeader.getName()); httpHeaderMessage.setRequired(httpHeader.isRequired().booleanValue()); httpHeaderMessages.add(httpHeaderMessage); } return httpHeaderMessages; } /** * Adds documentation details to a given AxisDescription. * The documentation details is extracted from the WSDL element given. * @param axisDescription - The documentation will be added to this * @param element - The element that the documentation is extracted from. */ private void addDocumentation(AxisDescription axisDescription, DocumentableElement element) { DocumentationElement[] documentationElements = element.getDocumentationElements(); String documentation = ""; for (int i = 0; i < documentationElements.length; i++) { DocumentationElement documentationElement = documentationElements[i]; XMLElement contentElement = documentationElement.getContent(); Element content = (Element)contentElement.getSource(); if (content != null) { documentation = documentation + DOM2Writer.nodeToString(content.getFirstChild()); } } if (!"".equals(documentation)) { axisDescription.setDocumentation(documentation); } } private void setEndpointURL(AxisEndpoint axisEndpoint, String endpointURL) { axisEndpoint.setEndpointURL(endpointURL); try { URL url = new URL(endpointURL); axisEndpoint.setTransportInDescription(url.getProtocol()); } catch (Exception e) { log.debug(e.getMessage(), e); } } }./src/org/apache/axis2/description/PolicySubject.java0000664000175000017500000000735311767656530022007 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.description; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyReference; public class PolicySubject { private boolean updated = false; private Date lastUpdatedTime = new Date(); private HashMap attachedPolicyComponents = new HashMap(); public void attachPolicy(Policy policy) { String key = policy.getName(); if (key == null) { key = policy.getId(); if (key == null) { key = UUIDGenerator.getUUID(); policy.setId(key); } } attachPolicyComponent(key, policy); } public void attachPolicyReference(PolicyReference reference) { attachedPolicyComponents.put(reference.getURI(), reference); setLastUpdatedTime(new Date()); } public void attachPolicyComponents(List policyComponents) { for (Iterator iterator = policyComponents.iterator(); iterator .hasNext();) { attachPolicyComponent((PolicyComponent) iterator.next()); } } public void attachPolicyComponent(PolicyComponent policyComponent) { if (policyComponent instanceof Policy) { attachPolicy((Policy) policyComponent); } else if (policyComponent instanceof PolicyReference) { attachPolicyReference((PolicyReference) policyComponent); } else { throw new IllegalArgumentException( "Invalid top level policy component type"); } } public void attachPolicyComponent(String key, PolicyComponent policyComponent) { attachedPolicyComponents.put(key, policyComponent); setLastUpdatedTime(new Date()); if (!isUpdated()) { setUpdated(true); } } public PolicyComponent getAttachedPolicyComponent(String key) { return (PolicyComponent) attachedPolicyComponents.get(key); } public Collection getAttachedPolicyComponents() { return attachedPolicyComponents.values(); } public boolean isUpdated() { return updated; } public void setUpdated(boolean updated) { this.updated = updated; } public void updatePolicy(Policy policy) { String key = (policy.getName() != null) ? policy.getName() : policy .getId(); if (key == null) { throw new IllegalArgumentException( "policy doesn't have a name or an id "); } attachedPolicyComponents.put(key, policy); setLastUpdatedTime(new Date()); if (!isUpdated()) { setUpdated(true); } } public void detachPolicyComponent(String key) { attachedPolicyComponents.remove(key); setLastUpdatedTime(new Date()); if (!isUpdated()) { setUpdated(true); } } public void clear() { attachedPolicyComponents.clear(); setLastUpdatedTime(new Date()); if (!isUpdated()) { setUpdated(true); } } public Date getLastUpdatedTime() { return lastUpdatedTime; } public void setLastUpdatedTime(Date lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } } ./src/org/apache/axis2/wsdl/0000775000175000017500000000000011767656530015003 5ustar brianbrian./src/org/apache/axis2/wsdl/SOAPHeaderMessage.java0000664000175000017500000000513311767656530021030 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; import org.apache.axis2.namespace.Constants; import javax.xml.namespace.QName; public class SOAPHeaderMessage { public static final QName SOAP_11_HEADER = new QName( Constants.URI_WSDL11_SOAP, "header"); public static final QName SOAP_12_HEADER = new QName( Constants.URI_WSDL12_SOAP, "header"); private QName messageName = null; private String part = null; private QName element = null; private QName type; private String use; private String namespaceURI; private boolean required; private boolean mustUnderstand; public SOAPHeaderMessage() { this.type = SOAP_11_HEADER; } public SOAPHeaderMessage(QName type) { this.type = type; } public QName getMessage() { return messageName; } public void setMessage(QName message) { this.messageName = message; } public String part() { return part; } public void setPart(String part) { this.part = part; } public QName getElement() { return element; } public void setElement(QName element) { this.element = element; } public String getUse() { return use; } public void setUse(String use) { this.use = use; } public String getNamespaceURI() { return namespaceURI; } public void setNamespaceURI(String namespaceURI) { this.namespaceURI = namespaceURI; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public boolean isMustUnderstand() { return mustUnderstand; } public void setMustUnderstand(boolean mustUnderstand) { this.mustUnderstand = mustUnderstand; } } ./src/org/apache/axis2/wsdl/util/0000775000175000017500000000000011767656530015760 5ustar brianbrian./src/org/apache/axis2/wsdl/util/WSDLWrapperImpl.java0000664000175000017500000000401711767656530021561 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import javax.wsdl.Definition; /** * This interface provides support for processing a WSDL4J definition * with a lower memory footprint. This is useful for certain * environments. */ public interface WSDLWrapperImpl extends Definition { /** * Returns the WSDL4J Definition object that is being wrapped */ public Definition getUnwrappedDefinition(); /** * Sets the WSDL4J Definition object that is being wrapped * * @param d the WSDL4J Definition object */ public void setDefinitionToWrap(Definition d); /** * Sets the location for the WSDL4J Definition object that is being wrapped */ public void setWSDLLocation(String uriLocation); /** * Gets the location for the WSDL4J Definition object that is being wrapped */ public String getWSDLLocation(); /* * Release resources associated with the WSDL4J Definition object that is * being wrapped. */ public void releaseResources(); /** * Closes the use of the wrapper implementation and allows * internal resources to be released. */ public void close(); } ./src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java0000664000175000017500000001413611767656530023135 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.Types; import javax.wsdl.extensions.ExtensibilityElement; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; /** * This class provides support for processing a WSDL4J defintion which includes imports. * It allows the imports to be processed into a single WSDL4J Definition object */ public class WSDL4JImportedWSDLHelper { protected static final Log log = LogFactory.getLog(WSDL4JImportedWSDLHelper.class); private static final boolean isTraceEnabled = log.isTraceEnabled(); /** * The intention of this procedure is to process the imports. When * processing the imports the imported documents will be populating the * items in the main document recursivley * * @param wsdl4JDefinition */ public static void processImports(Definition wsdl4JDefinition, List processedDocuments) { Map wsdlImports = wsdl4JDefinition.getImports(); if (null != wsdlImports && !wsdlImports.isEmpty()) { Collection importsCollection = wsdlImports.values(); for (Iterator iterator = importsCollection.iterator(); iterator .hasNext();) { Vector values = (Vector) iterator.next(); for (int i = 0; i < values.size(); i++) { Import wsdlImport = (Import) values.elementAt(i); if (wsdlImport.getDefinition() != null) { Definition importedDef = wsdlImport.getDefinition(); if (importedDef != null) { String key = importedDef.getDocumentBaseURI(); if (key == null) { key = importedDef.getTargetNamespace(); } // stop recursive imports! if (processedDocuments.contains(key)) { return; } processedDocuments.add(key); processImports(importedDef, processedDocuments); // copy ns Map namespaces = importedDef.getNamespaces(); Iterator keys = namespaces.keySet().iterator(); while (keys.hasNext()) { Object key2 = keys.next(); if (!wsdl4JDefinition.getNamespaces() .containsValue(namespaces.get(key2))) { wsdl4JDefinition.getNamespaces().put(key2, namespaces.get(key2)); } } wsdl4JDefinition.getNamespaces().putAll(namespaces); // copy types Types t = importedDef.getTypes(); if (t != null) { List typesList = t.getExtensibilityElements(); for (int j = 0; j < typesList.size(); j++) { Types types = wsdl4JDefinition.getTypes(); if (types == null) { types = wsdl4JDefinition.createTypes(); wsdl4JDefinition.setTypes(types); } types.addExtensibilityElement((ExtensibilityElement) typesList .get(j)); } } // add messages Map messagesMap = importedDef.getMessages(); wsdl4JDefinition.getMessages().putAll(messagesMap); // add portypes Map porttypeMap = importedDef.getPortTypes(); wsdl4JDefinition.getPortTypes().putAll(porttypeMap); // add bindings Map bindingMap = importedDef.getBindings(); wsdl4JDefinition.getBindings().putAll(bindingMap); // add services Map serviceMap = importedDef.getServices(); wsdl4JDefinition.getServices().putAll(serviceMap); List extElementList = importedDef .getExtensibilityElements(); wsdl4JDefinition.getExtensibilityElements().addAll( extElementList); } } } } } } } ./src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java0000664000175000017500000001727511767656530023516 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.OptionsValidator; import org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension; public class WSDL2JavaOptionsValidator implements CommandLineOptionConstants, OptionsValidator { public boolean isInvalid(CommandLineOption option) { boolean invalid; String optionType = option.getOptionType(); if (optionType.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)) { invalid = false; } else { invalid = !(WSDL2JavaConstants.All_PORTS_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.All_PORTS_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.FLATTEN_FILES_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.FLATTEN_FILES_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_ALL_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.NO_WSDLS_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.OUTPUT_LOCATION_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.OVERRIDE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.OVERRIDE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.PACKAGE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.PACKAGE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.PORT_NAME_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.PORT_NAME_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.REPOSITORY_PATH_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.RESOURCE_FOLDER_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.RESOURCE_FOLDER_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVICE_NAME_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.STUB_LANGUAGE_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.UNPACK_CLASSES_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.UNWRAP_PARAMETERS.equalsIgnoreCase(optionType) || WSDL2JavaConstants.UNWRAP_PARAMETERS_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.WSDL_VERSION_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION_LONG.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION.equalsIgnoreCase(optionType) || WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION_LONG.equalsIgnoreCase(optionType) || XMLBeansExtension.XSDCONFIG_OPTION.equalsIgnoreCase(optionType) || XMLBeansExtension.XSDCONFIG_OPTION_LONG.equalsIgnoreCase(optionType) ); } return invalid; } } ./src/org/apache/axis2/wsdl/util/Constants.java0000664000175000017500000000632411767656530020604 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; public interface Constants { String BASE_64_PROPERTY_KEY = "base64map"; String PLAIN_BASE_64_PROPERTY_KEY = "plainbase64map"; String EXTERNAL_TEMPLATE_PROPERTY_KEY = "externalTemplate"; String XSLT_INCLUDE_DATABIND_SUPPORTER_HREF_KEY = "databindsupporter"; String XSLT_INCLUDE_TEST_OBJECT_HREF_KEY = "testObject"; String UNWRAPPED_KEY = "UnWrapped"; String UNWRAPPED_DETAILS = "UnWrapped_details"; String COMPLEX_TYPE = "complexType"; String ARRAY_TYPE = "arrayType"; public static final String ANY_ELEMENT_FIELD_NAME = "extraElement"; /** * Property for message receiver operation method handled by databinding code generation. This * is an optional parameter for an {@link org.apache.axis2.description.AxisOperation}. If * present, the value is the name of a method to be generated by the databinding code generation * and called by the message receiver code generation in order to process the OMElement and * invoke the service method. */ String DATABINDING_GENERATED_RECEIVER = "databinding-generated-receiver"; /** * Property for interface implementation method handled by databinding code generation. This is * an optional parameter for an {@link org.apache.axis2.description.AxisOperation}. If present, * the value is a Boolean flag to indicate that the method corresponding to that * operation will be generated by the data binding code generation. */ String DATABINDING_GENERATED_IMPLEMENTATION = "databinding-generated-implementation"; /** * Property for details to be passed inside the <databinders> element. This is an optional * parameter for an {@link org.apache.axis2.description.AxisOperation}. If present, the value is * a DOM element to be appended to the <databinders> content. */ String DATABINDING_OPERATION_DETAILS = "databinding-operation-details"; /** * Property for details to be passed inside the <databinders> element. This is an optional * parameter for an {@link org.apache.axis2.description.AxisService}. If present, the value is a * DOM element to be appended to the <databinders> content. */ String DATABINDING_SERVICE_DETAILS = "databinding-service-details"; public interface CodegenStyle { final int AUTOMATIC = 0; final int INTERFACE = 1; static final int BINDING = 2; } } ./src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java0000664000175000017500000004323611767656530022756 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.Constants; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Binding; import javax.wsdl.BindingFault; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.ExtensionRegistry; import javax.xml.namespace.QName; import java.net.URL; import java.util.List; import java.util.Map; /** * There are cases where a WSDL definition is kept in memory * in case it needs to be accessed during runtime. In situations where * there are lots of WSDL definitions or big WSDLs, the memory footprint can be * huge. * * This class provides support for processing a WSDL4J definition * with a lower memory footprint. This is useful for certain * environments. * * This class makes the decision on which implementation to use * to reduce memory footprint. This allows other implementations * to be used for specific environments without adding lots of extra * overhead to every environment. * */ public class WSDLDefinitionWrapper implements Definition { private static final Log log = LogFactory.getLog(WSDLDefinitionWrapper.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); private static final String myClassName = "WSDLDefinitionWrapper"; // javax.wsdl.Definition implements java.io.Serializable static final long serialVersionUID = -2788807375814097409L; // the setting used to indicate whether the in-memory copy of the // WSDL definition should be manipulated to reduce memory footprint private boolean reduceWSDLMemoryCache = false; // the optional setting used to specify which type of reduction to use private int reduceWSDLMemoryType = 0; // the wrapper implementation to use private WSDLWrapperImpl wrapperImpl = null; //------------------------------------------------------------------------- // constructors //------------------------------------------------------------------------- /** * Constructor * * @param def The WSDL Definition * @deprecated because this constructor does not provide any guidance for * memory usage */ public WSDLDefinitionWrapper(Definition def) { if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition) entry"); } prepare(def, null); } /** * @param def * @param limitMemory true if you want to use a memory sensitive wrapper */ public WSDLDefinitionWrapper(Definition def, boolean limitMemory, int memoryType) { if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition, boolean) entry"); } reduceWSDLMemoryCache = limitMemory; reduceWSDLMemoryType = memoryType; prepare(def, null); } /** * @param def WDDL Definition * @param axisConfig Axis Configuration */ public WSDLDefinitionWrapper(Definition def,AxisConfiguration axisConfig ) { if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,AxisConfiguration) entry "); } setupMemoryParms(axisConfig); prepare(def, null); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl * @deprecated use a constructor with a AxisConfiguration or memory limit parameter */ public WSDLDefinitionWrapper(Definition def, URL wURL) { if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,URL) entry"); } prepare(def, wURL); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl * @param limitInMemory The setting indicating whether the in-memory WSDL copy * should be manipulated to reduce memory footprint */ public WSDLDefinitionWrapper(Definition def, URL wURL, boolean limitInMemory) { reduceWSDLMemoryCache = limitInMemory; if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,URL,boolean) entry"); } prepare(def, wURL); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl * @param limitInMemory The setting indicating whether the in-memory WSDL copy * should be manipulated to reduce memory footprint * @param memoryType */ public WSDLDefinitionWrapper(Definition def, URL wURL, boolean limitInMemory, int memoryType) { reduceWSDLMemoryCache = limitInMemory; this.reduceWSDLMemoryType = memoryType; if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,URL,boolean) entry"); } prepare(def, wURL); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl * @param limitType The setting indicating which reduction technique * to use */ public WSDLDefinitionWrapper(Definition def, URL wURL, int limitType) { reduceWSDLMemoryCache = true; reduceWSDLMemoryType = limitType; if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,URL,int) entry"); } prepare(def, wURL); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl * @param axisCfg The AxisConfiguration object, to be used to get configuration settings */ public WSDLDefinitionWrapper(Definition def, URL wURL, AxisConfiguration axisCfg) { if (log.isDebugEnabled() ) { log.debug("WSDLDefinitionWrapper(Definition,URL,AxisConfiguration) entry"); } // determine what the setting for the memory optimization is setupMemoryParms(axisCfg); prepare(def, wURL); } private void setupMemoryParms( AxisConfiguration axisCfg) { if (log.isDebugEnabled() ) { log.debug("setupMemoryParms(AxisConfiguration) entry"); } // determine what the setting for the memory optimization is if (axisCfg != null) { Parameter param = axisCfg.getParameter(Constants.Configuration.REDUCE_WSDL_MEMORY_CACHE); reduceWSDLMemoryCache = param != null && ((String) param.getValue()).equalsIgnoreCase("true"); param = axisCfg.getParameter(Constants.Configuration.REDUCE_WSDL_MEMORY_TYPE); if (param != null) { String value = (String) param.getValue(); if (value != null) { Integer i = new Integer(value); reduceWSDLMemoryType = i.intValue(); } } if (log.isDebugEnabled() ) { log.debug("reduceWSDLMemoryCache:"+ reduceWSDLMemoryCache + ", reduceWSDLMemoryType:" + reduceWSDLMemoryType ); } } else { if (log.isDebugEnabled() ) { log.debug("AxisConfiguration is null. This is unexpected" ); } } } /** * Initialize the wsdl definition wrapper * * @param def The WSDL4J definition * @param wURL The URL where the WSDL is obtained */ private void prepare(Definition def, URL wURL) { if (reduceWSDLMemoryCache) { // if the type is specified, then use it // otherwise, default to the serialization technique if (reduceWSDLMemoryType == 2) { // a wrapper implementation that uses release & reload on the // underlying WSDL4J object // this would be desirable for those environments where // many of the WSDL definitions are not serializable wrapperImpl = new WSDLWrapperReloadImpl(def, wURL); } else { // a wrapper implementation that uses serialization to save the // underlying WSDL4J object wrapperImpl = new WSDLWrapperSaveImpl(def, wURL); } } else { // a wrapper implementation that is just a passthrough to the // underlying WSDL4J object wrapperImpl = new WSDLWrapperBasicImpl(def, wURL); } wrapperImpl.releaseResources(); } //------------------------------------------------------------------------- // public WSDLDefinitionWrapper methods //------------------------------------------------------------------------- /* * Returns the WSDL4J Definition object that is being wrapped */ public Definition getUnwrappedDefinition() { return wrapperImpl.getUnwrappedDefinition(); } public int getMemoryLimitType() { return this.reduceWSDLMemoryType; } //------------------------------------------------------------------------- // javax.wsdl.Defintion interface methods //------------------------------------------------------------------------- public void setDocumentBaseURI(String d) { // Set the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. wrapperImpl.setDocumentBaseURI(d); } public String getDocumentBaseURI() { // Get the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. return wrapperImpl.getDocumentBaseURI(); } public void setQName(QName n) { wrapperImpl.setQName(n); } public QName getQName() { return wrapperImpl.getQName(); } public void setTargetNamespace(String t) { wrapperImpl.setTargetNamespace(t); } public String getTargetNamespace() { return wrapperImpl.getTargetNamespace(); } public void addNamespace(String prefix, String namespaceURI) { wrapperImpl.addNamespace(prefix, namespaceURI); } public String removeNamespace(String prefix) { return wrapperImpl.removeNamespace(prefix); } public String getNamespace(String prefix) { return wrapperImpl.getNamespace(prefix); } public String getPrefix(String namespaceURI) { return wrapperImpl.getPrefix(namespaceURI); } public Map getNamespaces() { return wrapperImpl.getNamespaces(); } public List getNativeAttributeNames() { return wrapperImpl.getNativeAttributeNames(); } public void setTypes(Types types) { wrapperImpl.setTypes(types); } public Types getTypes() { return wrapperImpl.getTypes(); } public void addImport(Import importDef) { wrapperImpl.addImport(importDef); } public Import removeImport(Import importDef) { return wrapperImpl.removeImport(importDef); } public List getImports(String namespaceURI) { return wrapperImpl.getImports(namespaceURI); } public Map getImports() { return wrapperImpl.getImports(); } public void addMessage(Message message) { wrapperImpl.addMessage(message); } public Message getMessage(QName name) { return wrapperImpl.getMessage(name); } public Message removeMessage(QName name) { return wrapperImpl.removeMessage(name); } public Map getMessages() { return wrapperImpl.getMessages(); } public void addBinding(Binding binding) { wrapperImpl.addBinding(binding); } public Binding getBinding(QName name) { return wrapperImpl.getBinding(name); } public Binding removeBinding(QName name) { return wrapperImpl.removeBinding(name); } public Map getBindings() { return wrapperImpl.getBindings(); } public Map getAllBindings() { return wrapperImpl.getAllBindings(); } public void addPortType(PortType portType) { wrapperImpl.addPortType(portType); } public PortType getPortType(QName name) { return wrapperImpl.getPortType(name); } public PortType removePortType(QName name) { return wrapperImpl.removePortType(name); } public Map getPortTypes() { return wrapperImpl.getPortTypes(); } public Map getAllPortTypes() { return wrapperImpl.getAllPortTypes(); } public void addService(Service service) { wrapperImpl.addService(service); } public Service getService(QName name) { return wrapperImpl.getService(name); } public Service removeService(QName name) { return wrapperImpl.removeService(name); } public Map getServices() { return wrapperImpl.getServices(); } public Map getAllServices() { return wrapperImpl.getAllServices(); } public void setDocumentationElement(org.w3c.dom.Element docEl) { wrapperImpl.setDocumentationElement(docEl); } public org.w3c.dom.Element getDocumentationElement() { return wrapperImpl.getDocumentationElement(); } public void addExtensibilityElement(ExtensibilityElement extElement) { wrapperImpl.addExtensibilityElement(extElement); } public List getExtensibilityElements() { return wrapperImpl.getExtensibilityElements(); } public Binding createBinding() { return wrapperImpl.createBinding(); } public BindingFault createBindingFault() { return wrapperImpl.createBindingFault(); } public BindingInput createBindingInput() { return wrapperImpl.createBindingInput(); } public BindingOperation createBindingOperation() { return wrapperImpl.createBindingOperation(); } public BindingOutput createBindingOutput() { return wrapperImpl.createBindingOutput(); } public Fault createFault() { return wrapperImpl.createFault(); } public Import createImport() { return wrapperImpl.createImport(); } public Input createInput() { return wrapperImpl.createInput(); } public Message createMessage() { return wrapperImpl.createMessage(); } public Operation createOperation() { return wrapperImpl.createOperation(); } public Output createOutput() { return wrapperImpl.createOutput(); } public Part createPart() { return wrapperImpl.createPart(); } public Port createPort() { return wrapperImpl.createPort(); } public PortType createPortType() { return wrapperImpl.createPortType(); } public Service createService() { return wrapperImpl.createService(); } public Types createTypes() { return wrapperImpl.createTypes(); } public void setExtensionRegistry(ExtensionRegistry extReg) { wrapperImpl.setExtensionRegistry(extReg); } public ExtensionRegistry getExtensionRegistry() { return wrapperImpl.getExtensionRegistry(); } public String toString() { return wrapperImpl.toString(); } //------------------------------------------------------------------------- // other AbstractWSDLElement methods //------------------------------------------------------------------------- public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { return wrapperImpl.removeExtensibilityElement(extElement); } public java.lang.Object getExtensionAttribute(QName name) { return wrapperImpl.getExtensionAttribute(name); } public Map getExtensionAttributes() { return wrapperImpl.getExtensionAttributes(); } public void setExtensionAttribute(QName name, java.lang.Object value) { wrapperImpl.setExtensionAttribute(name, value); } } ./src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java0000664000175000017500000013266411767656530022412 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.util.Counter; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Binding; import javax.wsdl.BindingFault; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.ExtensionRegistry; import javax.xml.namespace.QName; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.URL; import java.util.List; import java.util.Map; /** * There are cases where a WSDL definition is kept in memory * in case it needs to be accessed during runtime. In situations where * there are lots of WSDL definitions or big WSDLs, the memory footprint can be * huge. * * This class provides support for processing a WSDL4J definition * with a lower memory footprint. This is useful for certain * environments. * */ public class WSDLWrapperSaveImpl implements WSDLWrapperImpl { private static final Log log = LogFactory.getLog(WSDLWrapperSaveImpl.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); private static final String myClassName = "WSDLWrapperSaveImpl"; // javax.wsdl.Definition implements java.io.Serializable static final long serialVersionUID = -2788807375814097409L; // the wsdl4j wsdl definition object that is being wrapped private Definition wsdlDefinition = null; // the location of the base document used in the wsdl4j definition private URL wsdlURL = null; private String wsdlExplicitURI = null; private String wsdlDocumentBaseURI = null; // an object that maintains a synchronized counter private Counter accessCount = null; // serialization-related information --------------------------- // // 'safeToSerialize' indicates whether the wrapped WSDL definition object is // safe to serialize. This is set to false if the underlying // WSDL4J's WSDL definition had an error when we tried to // serialize it. // // 'hasBeenSaved' indicates whether the wrapped WSDL definition object // has been successfully saved // // 'hasBeenUpdatedSinceSaving' indicates whether the wrapped WSDL definition // object has been updated since the last saved/serialziation // // private boolean safeToSerialize = true; private boolean hasBeenSaved = false; private boolean hasBeenUpdatedSinceSaving = false; private File savedDefinitionFile = null; private String savedFilename = null; /** * Constructor * * @param def The WSDL Definition */ public WSDLWrapperSaveImpl(Definition def) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperSaveImpl(Definition def) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, null); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl */ public WSDLWrapperSaveImpl(Definition def, URL wURL) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperSaveImpl(Definition def, URL wURL) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, wURL); } /** * Initialize the wsdl definition wrapper * * @param def The WSDL4J definition * @param wURL The URL where the WSDL is obtained */ private void prepare(Definition def, URL wURL) { if (isDebugEnabled) { log.debug(myClassName + ".prepare()"); } wsdlDefinition = def; wsdlURL = wURL; accessCount = new Counter(); releaseResources(); } //------------------------------------------------------------------------- // public WSDLDefinitionWrapper methods //------------------------------------------------------------------------- /* * Returns the WSDL4J Definition object that is being wrapped */ public Definition getUnwrappedDefinition() { getWrappedDefinitionForUse(); Definition def; if ((wsdlDefinition != null) && (wsdlDefinition instanceof WSDLDefinitionWrapper)) { def = ((WSDLDefinitionWrapper) wsdlDefinition).getUnwrappedDefinition(); } else { def = wsdlDefinition; } return def; } /** * Sets the WSDL4J Definition object that is being wrapped * * @param d the WSDL4J Definition object */ public void setDefinitionToWrap(Definition d) { wsdlDefinition = d; } /** * Sets the location for the WSDL4J Definition object that is being wrapped */ public void setWSDLLocation(String uriLocation) { if (uriLocation != null) { try { wsdlURL = new URL(uriLocation); } catch (Exception e) { // todo } } } /** * Gets the location for the WSDL4J Definition object that is being wrapped */ public String getWSDLLocation() { if (wsdlURL != null) { return wsdlURL.toString(); } else { return null; } } /** * Closes the use of the wrapper implementation and allows * internal resources to be released. */ public void close() { // TODO release temporary files } //------------------------------------------------------------------------- // javax.wsdl.Defintion interface methods //------------------------------------------------------------------------- public void setDocumentBaseURI(String d) { // Set the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".setDocumentBaseURI(" + d + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setDocumentBaseURI(d); } doneUsingWrappedDefinition(); } public String getDocumentBaseURI() { // Get the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".getDocumentBaseURI()"); } getWrappedDefinitionForUse(); String results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getDocumentBaseURI(); } doneUsingWrappedDefinition(); return results; } public void setQName(QName n) { if (isDebugEnabled) { log.debug(myClassName + ".setQName(" + n + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setQName(n); } doneUsingWrappedDefinition(); } public QName getQName() { if (isDebugEnabled) { log.debug(myClassName + ".getQName()"); } getWrappedDefinitionForUse(); QName results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getQName(); } doneUsingWrappedDefinition(); return results; } public void setTargetNamespace(String t) { if (isDebugEnabled) { log.debug(myClassName + ".setTargetNamespace(" + t + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setTargetNamespace(t); } doneUsingWrappedDefinition(); } public String getTargetNamespace() { if (isDebugEnabled) { log.debug(myClassName + ".getTargetNamespace()"); } getWrappedDefinitionForUse(); String results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getTargetNamespace(); } doneUsingWrappedDefinition(); return results; } public void addNamespace(String prefix, String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".addNamespace(" + prefix + ", " + namespaceURI + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addNamespace(prefix, namespaceURI); } doneUsingWrappedDefinition(); } public String removeNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".removeNamespace(" + prefix + ")"); } getWrappedDefinitionForUse(); String results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeNamespace(prefix); } doneUsingWrappedDefinition(); return results; } public String getNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".getNamespace(" + prefix + ")"); } getWrappedDefinitionForUse(); String results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getNamespace(prefix); } doneUsingWrappedDefinition(); return results; } public String getPrefix(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getPrefix(" + namespaceURI + ")"); } getWrappedDefinitionForUse(); String results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getPrefix(namespaceURI); } doneUsingWrappedDefinition(); return results; } public Map getNamespaces() { if (isDebugEnabled) { log.debug(myClassName + ".getNamespaces()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getNamespaces(); } doneUsingWrappedDefinition(); return results; } public List getNativeAttributeNames() { if (isDebugEnabled) { log.debug(myClassName + ".getNativeAttributeNames()"); } getWrappedDefinitionForUse(); List results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getNativeAttributeNames(); } doneUsingWrappedDefinition(); return results; } public void setTypes(Types types) { if (isDebugEnabled) { log.debug(myClassName + ".setTypes()"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setTypes(types); } doneUsingWrappedDefinition(); } public Types getTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getTypes()"); } getWrappedDefinitionForUse(); Types results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getTypes(); } doneUsingWrappedDefinition(); return results; } public void addImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".addImport(" + importDef + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addImport(importDef); } doneUsingWrappedDefinition(); } public Import removeImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".removeImport(" + importDef + ")"); } getWrappedDefinitionForUse(); Import results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeImport(importDef); } doneUsingWrappedDefinition(); return results; } public List getImports(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getImports(" + namespaceURI + ")"); } getWrappedDefinitionForUse(); List results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getImports(namespaceURI); } doneUsingWrappedDefinition(); return results; } public Map getImports() { if (isDebugEnabled) { log.debug(myClassName + ".getImports()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getImports(); } doneUsingWrappedDefinition(); return results; } public void addMessage(Message message) { if (isDebugEnabled) { log.debug(myClassName + ".addMessage(" + message + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addMessage(message); } doneUsingWrappedDefinition(); } public Message getMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getMessage(" + name + ")"); } getWrappedDefinitionForUse(); Message results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getMessage(name); } doneUsingWrappedDefinition(); return results; } public Message removeMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeMessage(" + name + ")"); } getWrappedDefinitionForUse(); Message results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeMessage(name); } doneUsingWrappedDefinition(); return results; } public Map getMessages() { if (isDebugEnabled) { log.debug(myClassName + ".getMessages()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getMessages(); } doneUsingWrappedDefinition(); return results; } public void addBinding(Binding binding) { if (isDebugEnabled) { log.debug(myClassName + ".addBinding(" + binding + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addBinding(binding); } doneUsingWrappedDefinition(); } public Binding getBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getBinding(" + name + ")"); } getWrappedDefinitionForUse(); Binding results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getBinding(name); } doneUsingWrappedDefinition(); return results; } public Binding removeBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeBinding(" + name + ")"); } getWrappedDefinitionForUse(); Binding results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeBinding(name); } doneUsingWrappedDefinition(); return results; } public Map getBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getBindings()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getBindings(); } doneUsingWrappedDefinition(); return results; } public Map getAllBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getAllBindings()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getAllBindings(); } doneUsingWrappedDefinition(); return results; } public void addPortType(PortType portType) { if (isDebugEnabled) { log.debug(myClassName + ".addPortType(" + portType + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addPortType(portType); } doneUsingWrappedDefinition(); } public PortType getPortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getPortType(" + name + ")"); } getWrappedDefinitionForUse(); PortType results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getPortType(name); } doneUsingWrappedDefinition(); return results; } public PortType removePortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removePortType(" + name + ")"); } getWrappedDefinitionForUse(); PortType results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removePortType(name); } doneUsingWrappedDefinition(); return results; } public Map getPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getPortTypes()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getPortTypes(); } doneUsingWrappedDefinition(); return results; } public Map getAllPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getAllPortTypes()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getAllPortTypes(); } doneUsingWrappedDefinition(); return results; } public void addService(Service service) { if (isDebugEnabled) { log.debug(myClassName + ".addService(" + service + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addService(service); } doneUsingWrappedDefinition(); } public Service getService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getService(" + name + ")"); } getWrappedDefinitionForUse(); Service results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getService(name); } doneUsingWrappedDefinition(); return results; } public Service removeService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeService(" + name + ")"); } getWrappedDefinitionForUse(); Service results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeService(name); } doneUsingWrappedDefinition(); return results; } public Map getServices() { if (isDebugEnabled) { log.debug(myClassName + ".getServices()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getServices(); } doneUsingWrappedDefinition(); return results; } public Map getAllServices() { if (isDebugEnabled) { log.debug(myClassName + ".getAllServices()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getAllServices(); } doneUsingWrappedDefinition(); return results; } public void setDocumentationElement(org.w3c.dom.Element docEl) { if (isDebugEnabled) { log.debug(myClassName + ".setDocumentationElement()"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setDocumentationElement(docEl); } doneUsingWrappedDefinition(); } public org.w3c.dom.Element getDocumentationElement() { if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement()"); } getWrappedDefinitionForUse(); org.w3c.dom.Element results = null; if (wsdlDefinition != null) { return wsdlDefinition.getDocumentationElement(); } doneUsingWrappedDefinition(); return results; } public void addExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".addExtensibilityElement(" + extElement + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.addExtensibilityElement(extElement); } doneUsingWrappedDefinition(); } public List getExtensibilityElements() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensibilityElements()"); } getWrappedDefinitionForUse(); List results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getExtensibilityElements(); } doneUsingWrappedDefinition(); return results; } public Binding createBinding() { if (isDebugEnabled) { log.debug(myClassName + ".createBinding()"); } getWrappedDefinitionForUse(); Binding results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createBinding(); } doneUsingWrappedDefinition(); return results; } public BindingFault createBindingFault() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingFault()"); } getWrappedDefinitionForUse(); BindingFault results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createBindingFault(); } doneUsingWrappedDefinition(); return results; } public BindingInput createBindingInput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingInput()"); } getWrappedDefinitionForUse(); BindingInput results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createBindingInput(); } doneUsingWrappedDefinition(); return results; } public BindingOperation createBindingOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOperation()"); } getWrappedDefinitionForUse(); BindingOperation results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createBindingOperation(); } doneUsingWrappedDefinition(); return results; } public BindingOutput createBindingOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOutput()"); } getWrappedDefinitionForUse(); BindingOutput results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createBindingOutput(); } doneUsingWrappedDefinition(); return results; } public Fault createFault() { if (isDebugEnabled) { log.debug(myClassName + ".createFault()"); } getWrappedDefinitionForUse(); Fault results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createFault(); } doneUsingWrappedDefinition(); return results; } public Import createImport() { if (isDebugEnabled) { log.debug(myClassName + ".createImport()"); } getWrappedDefinitionForUse(); Import results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createImport(); } doneUsingWrappedDefinition(); return results; } public Input createInput() { if (isDebugEnabled) { log.debug(myClassName + ".createInput()"); } getWrappedDefinitionForUse(); Input results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createInput(); } doneUsingWrappedDefinition(); return results; } public Message createMessage() { if (isDebugEnabled) { log.debug(myClassName + ".createMessage()"); } getWrappedDefinitionForUse(); Message results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createMessage(); } doneUsingWrappedDefinition(); return results; } public Operation createOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createOperation()"); } getWrappedDefinitionForUse(); Operation results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createOperation(); } doneUsingWrappedDefinition(); return results; } public Output createOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createOutput()"); } getWrappedDefinitionForUse(); Output results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createOutput(); } doneUsingWrappedDefinition(); return results; } public Part createPart() { if (isDebugEnabled) { log.debug(myClassName + ".createPart()"); } getWrappedDefinitionForUse(); Part results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createPart(); } doneUsingWrappedDefinition(); return results; } public Port createPort() { if (isDebugEnabled) { log.debug(myClassName + ".createPort()"); } getWrappedDefinitionForUse(); Port results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createPort(); } doneUsingWrappedDefinition(); return results; } public PortType createPortType() { if (isDebugEnabled) { log.debug(myClassName + ".createPortType()"); } getWrappedDefinitionForUse(); PortType results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createPortType(); } doneUsingWrappedDefinition(); return results; } public Service createService() { if (isDebugEnabled) { log.debug(myClassName + ".createService()"); } getWrappedDefinitionForUse(); Service results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createService(); } doneUsingWrappedDefinition(); return results; } public Types createTypes() { if (isDebugEnabled) { log.debug(myClassName + ".createTypes()"); } getWrappedDefinitionForUse(); Types results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.createTypes(); } doneUsingWrappedDefinition(); return results; } public void setExtensionRegistry(ExtensionRegistry extReg) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionRegistry(" + extReg + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setExtensionRegistry(extReg); } doneUsingWrappedDefinition(); } public ExtensionRegistry getExtensionRegistry() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionRegistry()"); } getWrappedDefinitionForUse(); ExtensionRegistry results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getExtensionRegistry(); } doneUsingWrappedDefinition(); return results; } public String toString() { getWrappedDefinitionForUse(); String results = ""; if (wsdlDefinition != null) { results = wsdlDefinition.toString(); } doneUsingWrappedDefinition(); return results; } //------------------------------------------------------------------------- // other AbstractWSDLElement methods //------------------------------------------------------------------------- public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".removeExtensibilityElement(" + extElement + ")"); } getWrappedDefinitionForUse(); ExtensibilityElement results = null; if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } results = wsdlDefinition.removeExtensibilityElement(extElement); } doneUsingWrappedDefinition(); return results; } public java.lang.Object getExtensionAttribute(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttribute(" + name + ")"); } getWrappedDefinitionForUse(); java.lang.Object results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getExtensionAttribute(name); } doneUsingWrappedDefinition(); return results; } public Map getExtensionAttributes() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttributes()"); } getWrappedDefinitionForUse(); Map results = null; if (wsdlDefinition != null) { results = wsdlDefinition.getExtensionAttributes(); } doneUsingWrappedDefinition(); return results; } public void setExtensionAttribute(QName name, java.lang.Object value) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionAttribute(" + name + ", " + value + ")"); } getWrappedDefinitionForUse(); if (wsdlDefinition != null) { if (hasBeenSaved) { hasBeenUpdatedSinceSaving = true; } wsdlDefinition.setExtensionAttribute(name, value); } doneUsingWrappedDefinition(); } //------------------------------------------------------------------------- // private utility methods //------------------------------------------------------------------------- /** * This is an internal utility to ensure that the * WSDL definition being wrapped is available for * use. *

        * For example, if the WSDL4J WSDL definition object * had been saved, this will reload it. */ private void getWrappedDefinitionForUse() { if (wsdlDefinition == null) { loadResources(); } if (wsdlDefinition != null) { accessCount.incrementAndGet(); } } /** * This is an internal utility to indicate that the * use of WSDL definition has completed. */ private void doneUsingWrappedDefinition() { long assessors = accessCount.decrementAndGet(); if (assessors == 0) { releaseResources(); } } /* * Reduces memory footprint of the in-memory caching of the WSDL definition * based on the configuration settings * */ public void releaseResources() { boolean saved = save(); if (saved) { // release the in-memory copy of the WSDL4J wsdlDefinition = null; } } /* * Loads the the WSDL definition back into memory */ public void loadResources() { if (wsdlDefinition == null) { wsdlDefinition = restore(); } } /** * Saves the current WSDL definition object that this wrapper contains. * This method has a number of checks to determine how to proceed with * the saving of the WSDL definition object, so the caller should not * need to make checks on whether to save or not. *

        * The caller is responsible for handling the wrapped WSDL * definition object, for example, deciding when to release * it or reload it. * * @return True - if the save succeeded * False - if the save failed */ private boolean save() { // if the wsdl definiton failed to serialize from a previous attempt // to save it, then don't try to save it if (safeToSerialize == false) { // exit quickly return false; } // at this point, we think it is safe to proceed with saving the // wsdl definition // make sure there is a file to use for saving the wsdl definition if (savedDefinitionFile == null) { try { savedDefinitionFile = File.createTempFile("wsdlDef_", null); savedFilename = savedDefinitionFile.getName(); log.debug(myClassName + ".save(): temp file = [" + savedFilename + "]"); } catch (Exception ex) { log.debug(myClassName + ".save(): error creating temp file = [" + ex.getMessage() + "]"); savedDefinitionFile = null; savedFilename = null; // can't save the wsdl definition at this time // might be able to do so later hasBeenSaved = false; return false; } } if (savedDefinitionFile != null) { // the File object exists, check to see if the wsdl definition has // been previously saved if (hasBeenSaved && !hasBeenUpdatedSinceSaving) { // no need to save because we saved it already // and there were no updates to the wsdl definition object // since the previous save return true; } // --------------------------------------------------------- // save to the file // --------------------------------------------------------- FileOutputStream outStream = null; ObjectOutputStream outObjStream = null; try { // setup an output stream to a physical file outStream = new FileOutputStream(savedDefinitionFile); // attach a stream capable of writing objects to the // stream connected to the file outObjStream = new ObjectOutputStream(outStream); // try to save the wsdl object log.debug(myClassName + ".save(): saving the wsdl definition....."); outObjStream.writeObject(wsdlDefinition); // close out the streams outObjStream.flush(); outObjStream.close(); outStream.flush(); outStream.close(); hasBeenSaved = true; hasBeenUpdatedSinceSaving = false; log.debug(myClassName + ".save(): ....saved the wsdl definition....."); long filesize = savedDefinitionFile.length(); log.debug(myClassName + ".save(): file size after save [" + filesize + "] temp file = [" + savedFilename + "]"); log.debug(myClassName + ".save(): end - - - - - - - - - - - - - - - -"); return true; } catch (Exception ex2) { // disable future tries at saving this WSDL definition object safeToSerialize = false; // indicate that the file cannot be used to restore from hasBeenSaved = false; log.debug(myClassName + ".save(): error with saving the wsdl definition = [" + ex2.getClass().getName() + " : " + ex2.getMessage() + "]", ex2); if (savedDefinitionFile != null) { try { savedDefinitionFile.delete(); savedDefinitionFile = null; savedFilename = null; } catch (Exception e) { // just absorb it } } if (outObjStream != null) { try { outObjStream.close(); } catch (Exception e) { // just absorb it } } if (outStream != null) { try { outStream.close(); } catch (Exception e) { // just absorb it } } log.debug(myClassName + ".save(): error exit - - - - - - - - - - - - - - - -"); return false; } } return false; } /** * Restores the WSDL definition from a previously saved copy. *

        * The caller is responsible for handling the wrapped WSDL * definition object, for example, deciding when to release * it or reload it. * * @return The restored WSDL definition object, or NULL */ private Definition restore() { if (!hasBeenSaved) { // the wsdl defintion has not been saved, or the previous saved version // should not be used for some reason return null; } if (savedDefinitionFile == null) { // no file to restore from return null; } // --------------------------------------------------------- // restore from the temporary file // --------------------------------------------------------- Definition restoredDefinition = null; FileInputStream inStream = null; ObjectInputStream inObjStream = null; try { // setup an input stream to the file inStream = new FileInputStream(savedDefinitionFile); // attach a stream capable of reading objects from the // stream connected to the file inObjStream = new ObjectInputStream(inStream); // try to restore the wrapped wsdl definition log.debug(myClassName + ".restore(): restoring the WSDL definition ....."); restoredDefinition = (Definition) inObjStream.readObject(); inObjStream.close(); inStream.close(); log.debug(myClassName + ".restore(): ....restored the WSDL definition ....."); } catch (Exception ex2) { log.debug(myClassName + ".restore(): error with restoring the WSDL definition = [" + ex2.getClass().getName() + " : " + ex2.getMessage() + "]", ex2); if (inObjStream != null) { try { inObjStream.close(); } catch (Exception e) { // just absorb it } } if (inStream != null) { try { inStream.close(); } catch (Exception e) { // just absorb it } } } log.debug(myClassName + ".restore(): end - - - - - - - - - - - - - - - -"); return restoredDefinition; } } ./src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java0000664000175000017500000006027411767656530022532 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Binding; import javax.wsdl.BindingFault; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.ExtensionRegistry; import javax.xml.namespace.QName; import java.net.URL; import java.util.List; import java.util.Map; /** * This class provides support for processing a WSDL4J definition * with a lower memory footprint. This is useful for certain * environments. */ public class WSDLWrapperBasicImpl implements WSDLWrapperImpl { private static final Log log = LogFactory.getLog(WSDLWrapperBasicImpl.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); private static final String myClassName = "WSDLWrapperBasicImpl"; // javax.wsdl.Definition implements java.io.Serializable static final long serialVersionUID = -2788807375814097409L; // the wsdl4j wsdl definition object that is being wrapped private Definition wsdlDefinition = null; // the location of the base document used in the wsdl4j definition private URL wsdlURL = null; private String wsdlExplicitURI = null; private String wsdlDocumentBaseURI = null; //------------------------------------------------------------------------- // constructors //------------------------------------------------------------------------- /** * Constructor * * @param def The WSDL Definition */ public WSDLWrapperBasicImpl(Definition def) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperBasicImpl(Definition def) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, null); } /** * Constructor * * @param def The WSDL Definition * @param wURL The URL for the wsdl */ public WSDLWrapperBasicImpl(Definition def, URL wURL) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperBasicImpl(Definition def, URL wURL) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, wURL); } /** * Initialize the wsdl definition wrapper * * @param def The WSDL4J definition * @param wURL The URL where the WSDL is obtained */ private void prepare(Definition def, URL wURL) { if (isDebugEnabled) { log.debug(myClassName + ".prepare()"); } wsdlDefinition = def; wsdlURL = wURL; } //------------------------------------------------------------------------- // public WSDLWrapperImpl methods //------------------------------------------------------------------------- /* * Releases objects to reduce memory footprint. */ public void releaseResources() { // placeholder } /* * Returns the WSDL4J Definition object that is being wrapped */ public Definition getUnwrappedDefinition() { Definition def; if ((wsdlDefinition != null) && (wsdlDefinition instanceof WSDLDefinitionWrapper)) { def = ((WSDLDefinitionWrapper) wsdlDefinition).getUnwrappedDefinition(); } else { def = wsdlDefinition; } return def; } /** * Sets the WSDL4J Definition object that is being wrapped * * @param d the WSDL4J Definition object */ public void setDefinitionToWrap(Definition d) { wsdlDefinition = d; } /** * Sets the location for the WSDL4J Definition object that is being wrapped */ public void setWSDLLocation(String uriLocation) { if (uriLocation != null) { try { wsdlURL = new URL(uriLocation); } catch (Exception e) { // todo } } } /** * Gets the location for the WSDL4J Definition object that is being wrapped */ public String getWSDLLocation() { if (wsdlURL != null) { return wsdlURL.toString(); } else { return null; } } /** * Closes the use of the wrapper implementation and allows * internal resources to be released. */ public void close() { // nothing to do for this implementation } //------------------------------------------------------------------------- // javax.wsdl.Defintion interface methods //------------------------------------------------------------------------- public void setDocumentBaseURI(String d) { // Set the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".setDocumentBaseURI(" + d + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setDocumentBaseURI(d); } } public String getDocumentBaseURI() { // Get the URI of the base document for the Definition. // This identifies the origin of the Definition. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".getDocumentBaseURI()"); } if (wsdlDefinition != null) { return wsdlDefinition.getDocumentBaseURI(); } return null; } public void setQName(QName n) { if (isDebugEnabled) { log.debug(myClassName + ".setQName(" + n + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setQName(n); } } public QName getQName() { if (isDebugEnabled) { log.debug(myClassName + ".getQName()"); } if (wsdlDefinition != null) { return wsdlDefinition.getQName(); } return null; } public void setTargetNamespace(String t) { if (isDebugEnabled) { log.debug(myClassName + ".setTargetNamespace(" + t + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setTargetNamespace(t); } } public String getTargetNamespace() { if (isDebugEnabled) { log.debug(myClassName + ".getTargetNamespace()"); } if (wsdlDefinition != null) { return wsdlDefinition.getTargetNamespace(); } return null; } public void addNamespace(String prefix, String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".addNamespace(" + prefix + ", " + namespaceURI + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addNamespace(prefix, namespaceURI); } } public String removeNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".removeNamespace(" + prefix + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeNamespace(prefix); } return null; } public String getNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".getNamespace(" + prefix + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getNamespace(prefix); } return null; } public String getPrefix(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getPrefix(" + namespaceURI + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getPrefix(namespaceURI); } return null; } public Map getNamespaces() { if (isDebugEnabled) { log.debug(myClassName + ".getNamespaces()"); } if (wsdlDefinition != null) { return wsdlDefinition.getNamespaces(); } return null; } public List getNativeAttributeNames() { if (isDebugEnabled) { log.debug(myClassName + ".getNativeAttributeNames()"); } if (wsdlDefinition != null) { return wsdlDefinition.getNativeAttributeNames(); } return null; } public void setTypes(Types types) { if (isDebugEnabled) { log.debug(myClassName + ".setTypes()"); } if (wsdlDefinition != null) { wsdlDefinition.setTypes(types); } } public Types getTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getTypes(); } return null; } public void addImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".addImport(" + importDef + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addImport(importDef); } } public Import removeImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".removeImport(" + importDef + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeImport(importDef); } return null; } public List getImports(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getImports(" + namespaceURI + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getImports(namespaceURI); } return null; } public Map getImports() { if (isDebugEnabled) { log.debug(myClassName + ".getImports()"); } if (wsdlDefinition != null) { return wsdlDefinition.getImports(); } return null; } public void addMessage(Message message) { if (isDebugEnabled) { log.debug(myClassName + ".addMessage(" + message + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addMessage(message); } } public Message getMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getMessage(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getMessage(name); } return null; } public Message removeMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeMessage(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeMessage(name); } return null; } public Map getMessages() { if (isDebugEnabled) { log.debug(myClassName + ".getMessages()"); } if (wsdlDefinition != null) { return wsdlDefinition.getMessages(); } return null; } public void addBinding(Binding binding) { if (isDebugEnabled) { log.debug(myClassName + ".addBinding(" + binding + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addBinding(binding); } } public Binding getBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getBinding(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getBinding(name); } return null; } public Binding removeBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeBinding(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeBinding(name); } return null; } public Map getBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getBindings()"); } if (wsdlDefinition != null) { return wsdlDefinition.getBindings(); } return null; } public Map getAllBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getAllBindings()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllBindings(); } return null; } public void addPortType(PortType portType) { if (isDebugEnabled) { log.debug(myClassName + ".addPortType(" + portType + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addPortType(portType); } } public PortType getPortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getPortType(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getPortType(name); } return null; } public PortType removePortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removePortType(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removePortType(name); } return null; } public Map getPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getPortTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getPortTypes(); } return null; } public Map getAllPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getAllPortTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllPortTypes(); } return null; } public void addService(Service service) { if (isDebugEnabled) { log.debug(myClassName + ".addService(" + service + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addService(service); } } public Service getService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getService(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getService(name); } return null; } public Service removeService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeService(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeService(name); } return null; } public Map getServices() { if (isDebugEnabled) { log.debug(myClassName + ".getServices()"); } if (wsdlDefinition != null) { return wsdlDefinition.getServices(); } return null; } public Map getAllServices() { if (isDebugEnabled) { log.debug(myClassName + ".getAllServices()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllServices(); } return null; } public void setDocumentationElement(org.w3c.dom.Element docEl) { if (isDebugEnabled) { log.debug(myClassName + ".setDocumentationElement()"); } if (wsdlDefinition != null) { wsdlDefinition.setDocumentationElement(docEl); } } public org.w3c.dom.Element getDocumentationElement() { if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement()"); } if (wsdlDefinition != null) { return wsdlDefinition.getDocumentationElement(); } return null; } public void addExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".addExtensibilityElement(" + extElement + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addExtensibilityElement(extElement); } } public List getExtensibilityElements() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensibilityElements()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensibilityElements(); } return null; } public Binding createBinding() { if (isDebugEnabled) { log.debug(myClassName + ".createBinding()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBinding(); } return null; } public BindingFault createBindingFault() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingFault()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingFault(); } return null; } public BindingInput createBindingInput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingInput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingInput(); } return null; } public BindingOperation createBindingOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOperation()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingOperation(); } return null; } public BindingOutput createBindingOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOutput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingOutput(); } return null; } public Fault createFault() { if (isDebugEnabled) { log.debug(myClassName + ".createFault()"); } if (wsdlDefinition != null) { return wsdlDefinition.createFault(); } return null; } public Import createImport() { if (isDebugEnabled) { log.debug(myClassName + ".createImport()"); } if (wsdlDefinition != null) { return wsdlDefinition.createImport(); } return null; } public Input createInput() { if (isDebugEnabled) { log.debug(myClassName + ".createInput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createInput(); } return null; } public Message createMessage() { if (isDebugEnabled) { log.debug(myClassName + ".createMessage()"); } if (wsdlDefinition != null) { return wsdlDefinition.createMessage(); } return null; } public Operation createOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createOperation()"); } if (wsdlDefinition != null) { return wsdlDefinition.createOperation(); } return null; } public Output createOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createOutput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createOutput(); } return null; } public Part createPart() { if (isDebugEnabled) { log.debug(myClassName + ".createPart()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPart(); } return null; } public Port createPort() { if (isDebugEnabled) { log.debug(myClassName + ".createPort()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPort(); } return null; } public PortType createPortType() { if (isDebugEnabled) { log.debug(myClassName + ".createPortType()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPortType(); } return null; } public Service createService() { if (isDebugEnabled) { log.debug(myClassName + ".createService()"); } if (wsdlDefinition != null) { return wsdlDefinition.createService(); } return null; } public Types createTypes() { if (isDebugEnabled) { log.debug(myClassName + ".createTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.createTypes(); } return null; } public void setExtensionRegistry(ExtensionRegistry extReg) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionRegistry(" + extReg + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setExtensionRegistry(extReg); } } public ExtensionRegistry getExtensionRegistry() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionRegistry()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionRegistry(); } return null; } public String toString() { if (wsdlDefinition != null) { return wsdlDefinition.toString(); } return ""; } //------------------------------------------------------------------------- // other AbstractWSDLElement methods //------------------------------------------------------------------------- public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".removeExtensibilityElement(" + extElement + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeExtensibilityElement(extElement); } return null; } public java.lang.Object getExtensionAttribute(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttribute(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionAttribute(name); } return null; } public Map getExtensionAttributes() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttributes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionAttributes(); } return null; } public void setExtensionAttribute(QName name, java.lang.Object value) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionAttribute(" + name + ", " + value + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setExtensionAttribute(name, value); } } } ./src/org/apache/axis2/wsdl/util/MessagePartInformationHolder.java0000664000175000017500000000276511767656530024414 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.List; /** * This class acts as the holder for the information that is required to be attached to the * AxisMessage during unwrapping */ public class MessagePartInformationHolder { private QName operationName; private List partsList = new ArrayList(); public QName getOperationName() { return operationName; } public void setOperationName(QName operationName) { this.operationName = operationName; } public List getPartsList() { return partsList; } public void setPartsList(List partsList) { this.partsList = partsList; } } ./src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java0000664000175000017500000014367111767656530022722 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; import javax.wsdl.Binding; import javax.wsdl.BindingFault; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.ExtensionRegistry; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.net.URLConnection; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Enumeration; import java.util.List; import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarFile; /** * This class provides support for processing a WSDL4J definition * with a lower memory footprint. This is useful for certain * environments. * * The Type and Documentation objects consume the most space * in many scenarios. This implementation reloads these objects * when then they are requested. */ public class WSDLWrapperReloadImpl implements WSDLWrapperImpl { private static final Log log = LogFactory.getLog(WSDLWrapperReloadImpl.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); private static final String myClassName = "WSDLWrapperReloadImpl"; // javax.wsdl.Definition implements java.io.Serializable static final long serialVersionUID = -2788807375814097409L; // the wsdl4j wsdl definition object that is being wrapped private Definition wsdlDefinition = null; // the location of the base document used in the wsdl4j definition private URL wsdlURL = null; private String wsdlExplicitURI = null; private String wsdlDocumentBaseURI = null; // The wsdlDefinition always has the Types and DocumentElement // purged from it. // If USE_WEAK_REFERENCES is true, then we keep a weak reference // to these objects. // If USE_WEAK_REFERENCES is false, then a loadDefinition is always // performed to get the Type or DocumentationElement private static boolean USE_WEAK_REFERENCES = true; private transient WeakReference weakTypes = null; private transient WeakReference weakDocElement = null; /** * Constructor * The WSDL Defintion object is owned by the WSDLWrapperReloadImpl object. * * @param def The WSDL Definition */ public WSDLWrapperReloadImpl(Definition def) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperReloadImpl(Definition def) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, null); } /** * Constructor * The WSDL Defintion object is owned by the WSDLWrapperReloadImpl object. * * @param def The WSDL Definition * @param wURL The URL for the wsdl */ public WSDLWrapperReloadImpl(Definition def, URL wURL) { if (log.isDebugEnabled()) { log.debug("WSDLWrapperReloadImpl(Definition def, URL wURL) called"); log.debug(JavaUtils.callStackToString()); } prepare(def, wURL); } /** * Initialize the wsdl definition wrapper * * @param def The WSDL4J definition * @param wURL The URL where the WSDL is obtained */ private void prepare(Definition def, URL wURL) { if (isDebugEnabled) { log.debug(myClassName + ".prepare()"); } wsdlDefinition = def; wsdlURL = wURL; if (def != null) { try { wsdlDocumentBaseURI = def.getDocumentBaseURI(); // build up the wsdlURL if possible if ((wsdlURL == null) && (wsdlDocumentBaseURI != null)) { try { URL locURL = new URL(wsdlDocumentBaseURI); wsdlURL = locURL; } catch (Exception uex) { // keep going } } // get the explicit location of the wsdl if possible if (wsdlURL != null) { wsdlExplicitURI = getExplicitURI(wsdlURL); } // Release the Types and DocumentationElement Resources releaseResources(); } catch (Exception e) { if (isDebugEnabled) { log.debug(myClassName + ".prepare(): Caught exception [" + e.getClass().getName() + "] error [" + e.getMessage() + "]", e); } } } if (isDebugEnabled) { log.debug(myClassName + ".prepare(): wsdlDocumentBaseURI [" + wsdlDocumentBaseURI + "] wsdlExplicitURI [" + wsdlExplicitURI + "] wsdlURL [" + wsdlURL + "]"); } } //------------------------------------------------------------------------- // public WSDLWrapperImpl methods //------------------------------------------------------------------------- /* * Releases Type and DocumentElement Resources */ public void releaseResources() { if (wsdlDefinition != null) { Types types = wsdlDefinition.getTypes(); if (types != null) { wsdlDefinition.setTypes(null); } this.setCachedTypes(types); Element element = wsdlDefinition.getDocumentationElement(); if (element != null) { wsdlDefinition.setDocumentationElement(null); } this.setCachedDocElement(element); } } /** * Store the cached type. Since this is a weak reference, * the gc may remove it. * @param types */ private void setCachedTypes(Types types) { if (USE_WEAK_REFERENCES) { if (weakTypes == null || weakTypes.get() == null) { if (types != null) { weakTypes = new WeakReference(types); } else { // The wsdl has no types weakTypes = new WeakReference(Boolean.FALSE); } } } } /** * Get the cached type. Since this is a weak reference, * the gc may remove it. * @return types */ private Types getCachedTypes() { if (USE_WEAK_REFERENCES) { if (weakTypes == null || weakTypes.get() == null) { return null; } else if (weakTypes.get().equals(Boolean.FALSE)) { // The wsdl has no types return null; } else { return (Types) weakTypes.get(); } } else { return null; } } private boolean hasCachedTypes() { if (USE_WEAK_REFERENCES) { return (weakTypes != null && weakTypes.get() != null); } else { return false; } } /** * Store the cached document element. Since this is a weak reference, * the gc may remove it. * @param e Element */ private void setCachedDocElement(Element e) { if (USE_WEAK_REFERENCES) { if (weakDocElement == null || weakDocElement.get() == null) { if (e != null) { weakDocElement = new WeakReference(e); } else { // The wsdl has no document element weakDocElement = new WeakReference(Boolean.FALSE); } } } } /** * Get the cached type. Since this is a weak reference, * the gc may remove it. * @return types */ private Element getCachedDocElement() { if (USE_WEAK_REFERENCES) { if (weakDocElement == null || weakDocElement.get() == null) { return null; } else if (weakDocElement.get().equals(Boolean.FALSE)) { // The wsdl has no document element return null; } else { return (Element) weakDocElement.get(); } } else { return null; } } private boolean hasCachedDocElement() { if (USE_WEAK_REFERENCES) { return (weakDocElement != null && weakDocElement.get() != null); } else { return false; } } /* * Returns a full, reloaded,WSDL4J Definition object. * This avoids the memory saving capabilities of this wrapper. * The caller must not save the returned defintion. * @return Defintion */ public Definition getUnwrappedDefinition() { Definition def; if (wsdlDefinition == null) { // If no definiotn, load one try { def = loadDefinition(); } catch (Exception e) { // unable to load the definition if (isDebugEnabled) { log.debug(myClassName + ".getUnwrappedDefinition(): error trying to load Definition [" + e.getClass().getName() + "] error [" + e.getMessage() + "] ", e); } def = null; } } else if (wsdlDefinition instanceof WSDLWrapperBasicImpl) { // If wrapping another wrapper, then delegate def = ((WSDLWrapperBasicImpl) wsdlDefinition).getUnwrappedDefinition(); } else { // The question is whether a new WSDLDefinition should be loaded and // returned or whether the existing definition (w/o the Type // and DocumentElement) should be returned. // // The answer is to reload the WSDLDefinition and provide the new // one without affecting the existing WSDLDefintion that is stored. // The onus is on the caller to free this new WSDLDefinition and // not hold onto it. If the calller wants memory saving // capabilities, then the caller should be using this wrapper directly. try { def = loadDefinition(); if(def == null) { def = wsdlDefinition; } } catch (Exception e) { // unable to load the definition if (isDebugEnabled) { log.debug(myClassName + ".getUnwrappedDefinition(): error trying to load Definition [" + e.getClass().getName() + "] error [" + e.getMessage() + "] ", e); } def = wsdlDefinition; } } return def; } /** * Sets the WSDL4J Definition object that is being wrapped * * @param d the WSDL4J Definition object */ public void setDefinitionToWrap(Definition d) { wsdlDefinition = d; } /** * Sets the location for the WSDL4J Definition object that is being wrapped */ public void setWSDLLocation(String uriLocation) { if (uriLocation != null) { try { wsdlURL = new URL(uriLocation); } catch (Exception e) { // todo } } } /** * Gets the location for the WSDL4J Definition object that is being wrapped */ public String getWSDLLocation() { if (wsdlURL != null) { return wsdlURL.toString(); } else { return null; } } /** * Closes the use of the wrapper implementation and allows * internal resources to be released. */ public void close() { // nothing to do for this implementation } //------------------------------------------------------------------------- // javax.wsdl.Defintion interface methods //------------------------------------------------------------------------- public void setDocumentBaseURI(String d) { // Set the URI of the base document for the Definition. // This identifies the origin of the Definition and // allows the Definition to be reloaded. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".setDocumentBaseURI(" + d + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setDocumentBaseURI(d); } } public String getDocumentBaseURI() { // Get the URI of the base document for the Definition. // This identifies the origin of the Definition and // allows the Definition to be reloaded. // Note that this is the URI of the base document, not the imports. if (isDebugEnabled) { log.debug(myClassName + ".getDocumentBaseURI()"); } if (wsdlDefinition != null) { return wsdlDefinition.getDocumentBaseURI(); } return null; } public void setQName(QName n) { if (isDebugEnabled) { log.debug(myClassName + ".setQName(" + n + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setQName(n); } } public QName getQName() { if (isDebugEnabled) { log.debug(myClassName + ".getQName()"); } if (wsdlDefinition != null) { return wsdlDefinition.getQName(); } return null; } public void setTargetNamespace(String t) { if (isDebugEnabled) { log.debug(myClassName + ".setTargetNamespace(" + t + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setTargetNamespace(t); } } public String getTargetNamespace() { if (isDebugEnabled) { log.debug(myClassName + ".getTargetNamespace()"); } if (wsdlDefinition != null) { return wsdlDefinition.getTargetNamespace(); } return null; } public void addNamespace(String prefix, String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".addNamespace(" + prefix + ", " + namespaceURI + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addNamespace(prefix, namespaceURI); } } public String removeNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".removeNamespace(" + prefix + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeNamespace(prefix); } return null; } public String getNamespace(String prefix) { if (isDebugEnabled) { log.debug(myClassName + ".getNamespace(" + prefix + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getNamespace(prefix); } return null; } public String getPrefix(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getPrefix(" + namespaceURI + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getPrefix(namespaceURI); } return null; } public Map getNamespaces() { if (isDebugEnabled) { log.debug(myClassName + ".getNamespaces()"); } if (wsdlDefinition != null) { return wsdlDefinition.getNamespaces(); } return null; } public List getNativeAttributeNames() { if (isDebugEnabled) { log.debug(myClassName + ".getNativeAttributeNames()"); } if (wsdlDefinition != null) { return wsdlDefinition.getNativeAttributeNames(); } return null; } public void setTypes(Types types) { if (wsdlDefinition != null) { // note: the wsdl definition implementation can't re-create the types // after the types got set to null so the wsdl definition would // need to be reloaded if (isDebugEnabled) { log.debug(myClassName + ".setTypes() from wsdl Definition"); } wsdlDefinition.setTypes(types); // TODO: should we keep the types object if it gets set? wsdlDefinition.setTypes(null); } else { /* // reload the wsdl definition object // TODO: what about any online changes that have been made to the definition? if (isDebugEnabled) { log.debug(myClassName+".setTypes() from reloaded wsdl Definition"); } Definition def = null; try { def = loadDefinition(); } catch (Exception e) { if (isDebugEnabled) { log.debug(myClassName+".setTypes(): error trying to load Definition ["+e.getClass().getName()+"] error ["+e.getMessage()+"] ", e); } } if (def != null) { def.setTypes(types); } else { if (isDebugEnabled) { log.debug(myClassName+".setTypes(): nothing to set"); } } */ if (isDebugEnabled) { log.debug(myClassName + ".setTypes(): nothing to set"); } } } public Types getTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getTypes() call stack =" + JavaUtils.callStackToString()); } // See if we have a weak reference to the Type if (hasCachedTypes()) { Types t = getCachedTypes(); if (isDebugEnabled) { log.debug(myClassName + ".getTypes() from weak reference [" + t + "]"); } return t; } // reload the wsdl definition object // TODO: what about any changes that have been made to the definition? Definition def = null; try { def = loadDefinition(); } catch (Exception e) { if (isDebugEnabled) { log.debug(myClassName + ".getTypes(): error trying to load Definition [" + e.getClass().getName() + "] error [" + e.getMessage() + "] ", e); } } if (def != null) { Types t = def.getTypes(); setCachedTypes(t); setCachedDocElement(def.getDocumentationElement()); if (isDebugEnabled) { log.debug(myClassName + ".getTypes() from reloaded wsdl Definition returning [" + t + "]"); } return t; } else { if (isDebugEnabled) { log.debug(myClassName + ".getTypes() returning NULL"); } return null; } } public void addImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".addImport(" + importDef + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addImport(importDef); } } public Import removeImport(Import importDef) { if (isDebugEnabled) { log.debug(myClassName + ".removeImport(" + importDef + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeImport(importDef); } return null; } public List getImports(String namespaceURI) { if (isDebugEnabled) { log.debug(myClassName + ".getImports(" + namespaceURI + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getImports(namespaceURI); } return null; } public Map getImports() { if (isDebugEnabled) { log.debug(myClassName + ".getImports()"); } if (wsdlDefinition != null) { return wsdlDefinition.getImports(); } return null; } public void addMessage(Message message) { if (isDebugEnabled) { log.debug(myClassName + ".addMessage(" + message + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addMessage(message); } } public Message getMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getMessage(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getMessage(name); } return null; } public Message removeMessage(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeMessage(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeMessage(name); } return null; } public Map getMessages() { if (isDebugEnabled) { log.debug(myClassName + ".getMessages()"); } if (wsdlDefinition != null) { return wsdlDefinition.getMessages(); } return null; } public void addBinding(Binding binding) { if (isDebugEnabled) { log.debug(myClassName + ".addBinding(" + binding + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addBinding(binding); } } public Binding getBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getBinding(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getBinding(name); } return null; } public Binding removeBinding(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeBinding(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeBinding(name); } return null; } public Map getBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getBindings()"); } if (wsdlDefinition != null) { return wsdlDefinition.getBindings(); } return null; } public Map getAllBindings() { if (isDebugEnabled) { log.debug(myClassName + ".getAllBindings()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllBindings(); } return null; } public void addPortType(PortType portType) { if (isDebugEnabled) { log.debug(myClassName + ".addPortType(" + portType + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addPortType(portType); } } public PortType getPortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getPortType(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getPortType(name); } return null; } public PortType removePortType(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removePortType(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removePortType(name); } return null; } public Map getPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getPortTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getPortTypes(); } return null; } public Map getAllPortTypes() { if (isDebugEnabled) { log.debug(myClassName + ".getAllPortTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllPortTypes(); } return null; } public void addService(Service service) { if (isDebugEnabled) { log.debug(myClassName + ".addService(" + service + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addService(service); } } public Service getService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getService(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getService(name); } return null; } public Service removeService(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".removeService(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeService(name); } return null; } public Map getServices() { if (isDebugEnabled) { log.debug(myClassName + ".getServices()"); } if (wsdlDefinition != null) { return wsdlDefinition.getServices(); } return null; } public Map getAllServices() { if (isDebugEnabled) { log.debug(myClassName + ".getAllServices()"); } if (wsdlDefinition != null) { return wsdlDefinition.getAllServices(); } return null; } public void setDocumentationElement(org.w3c.dom.Element docEl) { if (wsdlDefinition != null) { if (isDebugEnabled) { log.debug(myClassName + ".setDocumentationElement(docEl) from wsdl Definition"); } // set the element in the definition // don't make assumptions about what the implementation does wsdlDefinition.setDocumentationElement(docEl); // reset the element wsdlDefinition.setDocumentationElement(null); } else { /* // reload the wsdl definition object // TODO: what about any online changes that have been made to the definition if (isDebugEnabled) { log.debug(myClassName+".setDocumentationElement(docEl) from reloaded wsdl Definition"); } Definition def = null; try { def = loadDefinition(); } catch (Exception e) { if (isDebugEnabled) { log.debug(myClassName+".setDocumentationElement(docEl): error trying to load Definition ["+e.getClass().getName()+"] error ["+e.getMessage()+"] ", e); } } if (def != null) { def.setDocumentationElement(docEl); } else { if (isDebugEnabled) { log.debug(myClassName+".setDocumentationElement(docEl): nothing to set"); } } */ if (isDebugEnabled) { log.debug(myClassName + ".setDocumentationElement(docEl): nothing to set"); } } } public org.w3c.dom.Element getDocumentationElement() { if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement() call stack =" + JavaUtils.callStackToString()); } // See if we have a weak reference to the DocumentElement if (hasCachedDocElement()) { Element e = getCachedDocElement(); if (log.isDebugEnabled()) { log.debug(myClassName + ".getDocumentationElement() from weak reference "); } return e; } // reload the wsdl definition object // TODO: what about any online changes that have been made to the definition? if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement() from reloaded wsdl Definition"); } Definition def = null; try { def = loadDefinition(); } catch (Exception e) { if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement(): error trying to load Definition [" + e.getClass().getName() + "] error [" + e.getMessage() + "] ", e); } } if (def != null) { org.w3c.dom.Element docElement = def.getDocumentationElement(); setCachedDocElement(docElement); setCachedTypes(def.getTypes()); if (isDebugEnabled) { if (docElement != null) { log.debug(myClassName + ".getDocumentationElement() from reloaded wsdl Definition returning NON-NULL org.w3c.dom.Element"); } else { log.debug(myClassName + ".getDocumentationElement() from reloaded wsdl Definition returning NULL org.w3c.dom.Element"); } } return docElement; } else { if (isDebugEnabled) { log.debug(myClassName + ".getDocumentationElement() returning NULL"); } return null; } } public void addExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".addExtensibilityElement(" + extElement + ")"); } if (wsdlDefinition != null) { wsdlDefinition.addExtensibilityElement(extElement); } } public List getExtensibilityElements() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensibilityElements()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensibilityElements(); } return null; } public Binding createBinding() { if (isDebugEnabled) { log.debug(myClassName + ".createBinding()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBinding(); } return null; } public BindingFault createBindingFault() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingFault()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingFault(); } return null; } public BindingInput createBindingInput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingInput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingInput(); } return null; } public BindingOperation createBindingOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOperation()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingOperation(); } return null; } public BindingOutput createBindingOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createBindingOutput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createBindingOutput(); } return null; } public Fault createFault() { if (isDebugEnabled) { log.debug(myClassName + ".createFault()"); } if (wsdlDefinition != null) { return wsdlDefinition.createFault(); } return null; } public Import createImport() { if (isDebugEnabled) { log.debug(myClassName + ".createImport()"); } if (wsdlDefinition != null) { return wsdlDefinition.createImport(); } return null; } public Input createInput() { if (isDebugEnabled) { log.debug(myClassName + ".createInput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createInput(); } return null; } public Message createMessage() { if (isDebugEnabled) { log.debug(myClassName + ".createMessage()"); } if (wsdlDefinition != null) { return wsdlDefinition.createMessage(); } return null; } public Operation createOperation() { if (isDebugEnabled) { log.debug(myClassName + ".createOperation()"); } if (wsdlDefinition != null) { return wsdlDefinition.createOperation(); } return null; } public Output createOutput() { if (isDebugEnabled) { log.debug(myClassName + ".createOutput()"); } if (wsdlDefinition != null) { return wsdlDefinition.createOutput(); } return null; } public Part createPart() { if (isDebugEnabled) { log.debug(myClassName + ".createPart()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPart(); } return null; } public Port createPort() { if (isDebugEnabled) { log.debug(myClassName + ".createPort()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPort(); } return null; } public PortType createPortType() { if (isDebugEnabled) { log.debug(myClassName + ".createPortType()"); } if (wsdlDefinition != null) { return wsdlDefinition.createPortType(); } return null; } public Service createService() { if (isDebugEnabled) { log.debug(myClassName + ".createService()"); } if (wsdlDefinition != null) { return wsdlDefinition.createService(); } return null; } public Types createTypes() { if (isDebugEnabled) { log.debug(myClassName + ".createTypes()"); } if (wsdlDefinition != null) { return wsdlDefinition.createTypes(); } return null; } public void setExtensionRegistry(ExtensionRegistry extReg) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionRegistry(" + extReg + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setExtensionRegistry(extReg); } } public ExtensionRegistry getExtensionRegistry() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionRegistry()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionRegistry(); } return null; } public String toString() { if (wsdlDefinition != null) { return this.getClass().getName() + "\n" + wsdlDefinition.toString(); } return this.getClass().getName(); } //------------------------------------------------------------------------- // other AbstractWSDLElement methods //------------------------------------------------------------------------- public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { if (isDebugEnabled) { log.debug(myClassName + ".removeExtensibilityElement(" + extElement + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.removeExtensibilityElement(extElement); } return null; } public java.lang.Object getExtensionAttribute(QName name) { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttribute(" + name + ")"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionAttribute(name); } return null; } public Map getExtensionAttributes() { if (isDebugEnabled) { log.debug(myClassName + ".getExtensionAttributes()"); } if (wsdlDefinition != null) { return wsdlDefinition.getExtensionAttributes(); } return null; } public void setExtensionAttribute(QName name, java.lang.Object value) { if (isDebugEnabled) { log.debug(myClassName + ".setExtensionAttribute(" + name + ", " + value + ")"); } if (wsdlDefinition != null) { wsdlDefinition.setExtensionAttribute(name, value); } } //------------------------------------------------------------------------- // private methods //------------------------------------------------------------------------- private String getExplicitURI(URL wsdlURL) throws WSDLException { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + ") "); } String explicitURI = null; ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); try { URL url = wsdlURL; String filePath = null; boolean isFileProtocol = (url != null && "file".equals(url.getProtocol())) ? true : false; if (isFileProtocol) { filePath = (url != null) ? url.getPath() : null; URI uri = null; if (url != null) { uri = new URI(url.toString()); } // Check if the uri has relative path // ie path is not absolute and is not starting with a "/" boolean isRelativePath = (filePath != null && !new File(filePath).isAbsolute()) ? true : false; if (isRelativePath) { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): WSDL URL has a relative path"); } // Lets read the complete WSDL URL for relative path from class loader // Use relative path of url to fetch complete URL. url = getAbsoluteURL(classLoader, filePath); if (url == null) { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "WSDL URL for relative path not found in ClassLoader"); log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "Unable to read WSDL from relative path, check the relative path"); log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "Relative path example: file:/WEB-INF/wsdl/"); log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "Using relative path as default wsdl URL to load wsdl Definition."); } url = wsdlURL; } else { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "WSDL URL found for relative path: " + filePath + " scheme: " + uri.getScheme()); } } } } URLConnection urlCon = url.openConnection(); InputStream is = null; try { is = getInputStream(urlCon); } catch (IOException e) { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "Could not open url connection. Trying to use " + "classloader to get another URL."); } if (filePath != null) { url = getAbsoluteURL(classLoader, filePath); if (url == null) { if (log.isDebugEnabled()) { log.debug("Could not locate URL for wsdl. Reporting error"); } throw new WSDLException("WSDL4JWrapper : ", e.getMessage(), e); } else { urlCon = url.openConnection(); if (log.isDebugEnabled()) { log.debug("Found URL for WSDL from jar"); } } } else { if (isDebugEnabled) { log.debug(myClassName + ".getExplicitURI(" + wsdlURL + "): " + "Could not get URL from classloader. Reporting " + "error due to no file path."); } throw new WSDLException("WSDLWrapperReloadImpl : ", e.getMessage(), e); } } if (is != null) { is.close(); } explicitURI = urlCon.getURL().toString(); } catch (Exception ex) { throw new WSDLException("WSDLWrapperReloadImpl : ", ex.getMessage(), ex); } return explicitURI; } private URL getAbsoluteURL(final ClassLoader classLoader, final String filePath) throws WSDLException { URL url = (URL) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return classLoader.getResource(filePath); } } ); if (url == null) { if (log.isDebugEnabled()) { log.debug("Could not get URL from classloader. Looking in a jar."); } if (classLoader instanceof URLClassLoader) { URLClassLoader urlLoader = (URLClassLoader) classLoader; url = getURLFromJAR(urlLoader, wsdlURL); } } return url; } /** * Load and Return a Definition object. * (The caller will determine if the Definition object should have * its resources freed or not) * @return Definition * @throws WSDLException */ private Definition loadDefinition() throws WSDLException { Definition def = null; if (wsdlExplicitURI != null) { try { def = (Definition) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws WSDLException { WSDLReader reader = getWSDLReader(); return reader.readWSDL(wsdlExplicitURI); } }); } catch (PrivilegedActionException e) { if (isDebugEnabled) { log.debug(myClassName + ".loadDefinition(): " + "Exception thrown from AccessController: " + e); log.debug("Call Stack = " + JavaUtils.callStackToString()); } WSDLException we = new WSDLException("WSDLWrapperReloadImpl : ", e.getMessage(), e); throw we; } } // Loading the wsdl is expensive. Dump the callstack.. so that we // support can look at the trace and determine if this class is being used incorrectly. if (isDebugEnabled) { log.debug(myClassName + ".loadDefinition(): returning Definition [" + def + "]"); log.debug("Call Stack = " + JavaUtils.callStackToString()); } return def; } private URL getURLFromJAR(URLClassLoader urlLoader, URL relativeURL) throws WSDLException { URL[] urlList = urlLoader.getURLs(); if (urlList == null) { return null; } for (int i = 0; i < urlList.length; i++) { URL url = urlList[i]; if (url == null) { return null; } if ("file".equals(url.getProtocol())) { File f = new File(url.getPath()); //If file is not of type directory then its a jar file if (f.exists() && !f.isDirectory()) { try { JarFile jf = new JarFile(f); Enumeration entries = jf.entries(); // read all entries in jar file and return the first // wsdl file that matches the relative path while (entries.hasMoreElements()) { JarEntry je = (JarEntry) entries.nextElement(); String name = je.getName(); if (name.endsWith(".wsdl")) { String relativePath = relativeURL.getPath(); if (relativePath.endsWith(name)) { String path = f.getAbsolutePath(); // This check is necessary because Unix/Linux file paths begin // with a '/'. When adding the prefix 'jar:file:/' we may end // up with '//' after the 'file:' part. This causes the URL // object to treat this like a remote resource if (path != null && path.indexOf("/") == 0) { path = path.substring(1, path.length()); } URL absoluteUrl = new URL("jar:file:/" + path + "!/" + je.getName()); return absoluteUrl; } } } } catch (Exception e) { WSDLException we = new WSDLException("WSDLWrapperReloadImpl : ", e.getMessage(), e); throw we; } } } } return null; } /** * Returns a wsdl reader for the wsdl * * @return WSDLReader * @exception WSDLException */ private WSDLReader getWSDLReader() throws WSDLException { WSDLReader reader; try { reader = (WSDLReader) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws WSDLException { WSDLFactory factory = WSDLFactory.newInstance(); return factory.newWSDLReader(); } }); } catch (PrivilegedActionException e) { throw (WSDLException) e.getException(); } // prevent system out from occurring reader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false); return reader; } /** * This method provides a Java2 Security compliant way to obtain the InputStream * for a given URLConnection object. This is needed as a given URLConnection object * may be an instance of a FileURLConnection object which would require access * permissions if Java2 Security was enabled. */ private InputStream getInputStream(URLConnection urlCon) throws Exception { final URLConnection finalURLCon = urlCon; InputStream is = null; try { is = (InputStream) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws IOException { return finalURLCon.getInputStream(); } }); } catch(PrivilegedActionException e) { throw e.getException(); } return is; } } ./src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java0000664000175000017500000003735211767656530023536 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.wsdl.i18n.CodegenMessages; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; /** Loads the properties from the config properties. */ public class ConfigPropertyFileLoader { private static Map dbSupporterTemplateNameMap; private static String testObjectTemplateName; private static String srcFolderName; private static String resourceFolderName; private static String[] extensionClassNames; private static String[] postExtensionClassNames; private static String[] thirdPartySchemaNames; private static String[] languageTypes; private static String[] databindingFrameworkNames; private static String[] unwrapSuppoerteddatabindingFrameworkNames; private static String[] unwrapDirectdatabindingFrameworkNames; private static Map languageEmitterMap; private static Map languageSpecificPropertiesMap; private static Map databindingFrameworkNameToExtensionMap; private static String defaultLanguage; private static String defaultDBFrameworkName; private static final String CODE_GEN_KEY_PREFIX = "codegen.extension"; private static final String POST_CODE_GEN_KEY_PREFIX = "post.codegen.extension"; private static final String THIRD_PARTY_SCHEMA_KEY_PREFIX = "codegen.thirdparty.schema"; private static final String LANGUAGE_TYPE_KEY_PREFIX = "codegen.languages"; private static final String DEFAULT_LANGUAGE_TYPE_KEY = "codegen.languages.default"; private static final String EMITTER_CLASS_KEY = "codegen.emitters"; private static final String DATA_BINDING_FRAMEWORK_NAME_KEY = "codegen.databinding.frameworks"; private static final String DATA_BINDING_UNWRAP_SUPPORTED_FRAMEWORK_NAME_KEY = "codegen.databinding.unwrap.supported"; private static final String DATA_BINDING_UNWRAP_DIRECT_FRAMEWORK_NAME_KEY = "codegen.databinding.unwrap.direct"; private static final String DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY = "codegen.databinding.frameworks.default"; private static final String DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY = "codegen.databinding.extensions"; private static final String DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX = "codegen.databinding."; private static final String DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX = "template"; private static final String DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY = "codegen.databinding.testobject.template"; private static final String SOURCE_FOLDER_NAME_KEY = "codegen.general.src.name"; private static final String RESOURCE_FOLDER_NAME_KEY = "codegen.general.resource.name"; public static final String DEFAULT_CODEGEN_CONFIG_PROPERTIES = "/org/apache/axis2/wsdl/codegen/codegen-config.properties"; /* Note - Should be a non regular expression character. If not it should be properly escaped */ private static final String SEPARATOR_CHAR = ","; /** * Loads a stream from the given * * @param propertiesReference * @throws FileNotFoundException */ private static InputStream getStream(String propertiesReference) throws FileNotFoundException { InputStream stream = ConfigPropertyFileLoader.class.getResourceAsStream(propertiesReference); if (stream == null) { URL url = ConfigPropertyFileLoader.class.getResource(propertiesReference); stream = new FileInputStream(url.toString()); } return stream; } static { loadAllProperties(); } public static void reload() { reset(); loadAllProperties(); } private static void reset() { dbSupporterTemplateNameMap = new HashMap(); testObjectTemplateName = null; extensionClassNames = null; thirdPartySchemaNames = null; languageTypes = null; databindingFrameworkNames = null; languageEmitterMap = null; languageSpecificPropertiesMap = null; databindingFrameworkNameToExtensionMap = null; defaultLanguage = null; defaultDBFrameworkName = null; srcFolderName = null; resourceFolderName = null; } private static void loadAllProperties() { try { //look for the system property "org.apache.axis2.codegen.config" to for a property //entry refering to the config properties String property = System.getProperty("org.apache.axis2.codegen.config"); InputStream stream; if (property != null) { stream = getStream(property); } else { stream = getStream(DEFAULT_CODEGEN_CONFIG_PROPERTIES); } if (stream == null) { throw new RuntimeException( CodegenMessages.getMessage("propfileload.generalException")); } Properties props = new Properties(); props.load(stream); //create a new map for the lang specific properties languageSpecificPropertiesMap = new HashMap(); //create a new map for the databinding frameworks and their extensions databindingFrameworkNameToExtensionMap = new HashMap(); //load the extension class names String tempString = props.getProperty(CODE_GEN_KEY_PREFIX); if (tempString != null) { extensionClassNames = tempString.split(SEPARATOR_CHAR); } //load the post extension class names tempString = props.getProperty(POST_CODE_GEN_KEY_PREFIX); if (tempString != null) { postExtensionClassNames = tempString.split(SEPARATOR_CHAR); } //load the data binding framework names tempString = props.getProperty(DATA_BINDING_FRAMEWORK_NAME_KEY); if (tempString != null) { databindingFrameworkNames = tempString.split(SEPARATOR_CHAR); } //load the unwrap supported data binding framework names tempString = props.getProperty(DATA_BINDING_UNWRAP_SUPPORTED_FRAMEWORK_NAME_KEY); if (tempString != null) { unwrapSuppoerteddatabindingFrameworkNames = tempString.split(SEPARATOR_CHAR); } //load the unwrap supported data binding framework names tempString = props.getProperty(DATA_BINDING_UNWRAP_DIRECT_FRAMEWORK_NAME_KEY); if (tempString != null) { unwrapDirectdatabindingFrameworkNames = tempString.split(SEPARATOR_CHAR); } //load the source folder tempString = props.getProperty(SOURCE_FOLDER_NAME_KEY); if (tempString != null) { srcFolderName = tempString; } //load the resource folder name tempString = props.getProperty(RESOURCE_FOLDER_NAME_KEY); if (tempString != null) { resourceFolderName = tempString; } //populate the data binding framework name to extension name map tempString = props.getProperty(DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY); if (tempString != null) { String[] frameworkExtensionNames = tempString.split(SEPARATOR_CHAR); try { for (int i = 0; i < frameworkExtensionNames.length; i++) { databindingFrameworkNameToExtensionMap .put(databindingFrameworkNames[i], frameworkExtensionNames[i]); } } catch (ArrayIndexOutOfBoundsException e) { throw new Exception( CodegenMessages.getMessage("propfileload.frameworkMismatch")); } } //load the default framework name tempString = props.getProperty(DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY); if (tempString == null || !databindingFrameworkNameToExtensionMap.containsKey(tempString)) { throw new Exception(CodegenMessages.getMessage("propfileload.unknownFramework")); } defaultDBFrameworkName = tempString; //load the third party schema names tempString = props.getProperty(THIRD_PARTY_SCHEMA_KEY_PREFIX); if (tempString != null) { thirdPartySchemaNames = tempString.split(SEPARATOR_CHAR); } //populate the db supporter template names. dbSupporterTemplateNameMap = new HashMap(); String key; for (Iterator allProperties = props.keySet().iterator(); allProperties.hasNext();) { key = (String)allProperties.next(); if (key.startsWith(DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX) && key.endsWith(DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX)) { dbSupporterTemplateNameMap.put(key, props.getProperty(key)); } } testObjectTemplateName = props.getProperty(DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY); //load the language names tempString = props.getProperty(LANGUAGE_TYPE_KEY_PREFIX); if (tempString != null) { languageTypes = tempString.split(SEPARATOR_CHAR); //load the language emitter map tempString = props.getProperty(EMITTER_CLASS_KEY); if (tempString == null) { throw new Exception(CodegenMessages.getMessage("propfileload.emitterMissing")); } else { String[] tempClassNames = tempString.split(SEPARATOR_CHAR); //populate the map languageEmitterMap = new HashMap(); for (int i = 0; i < tempClassNames.length; i++) { languageEmitterMap.put(languageTypes[i], tempClassNames[i]); } } } // load the default language tempString = props.getProperty(DEFAULT_LANGUAGE_TYPE_KEY); if (null == tempString || !languageEmitterMap.containsKey(tempString)) { throw new Exception(CodegenMessages.getMessage("propfileload.unknownDefaultLang")); } defaultLanguage = tempString; // run through the language specific properties and populate the // language specific property map // String languageType; String tempkey; HashMap langSpecificMap; for (int i = 0; i < languageTypes.length; i++) { languageType = languageTypes[i]; langSpecificMap = new HashMap(); Enumeration keyEnum = props.keys(); while (keyEnum.hasMoreElements()) { tempkey = keyEnum.nextElement().toString(); if (tempkey.startsWith(languageType + ".")) { langSpecificMap.put(tempkey, props.get(tempkey)); } } //now add this to the lang specific properties map languageSpecificPropertiesMap.put(languageType, langSpecificMap); } } catch (IOException e) { throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(CodegenMessages.getMessage("propfileload.generalException"), e); } } /** @return the source folder name */ public static String getResourceFolderName() { return resourceFolderName; } /** @return the resource folder name */ public static String getSrcFolderName() { return srcFolderName; } /** * Gets the test object support template. This is used in the generated test class. * * @return Returns String. */ public static String getTestObjectTemplateName() { return testObjectTemplateName; } /** * Gets the databinder template names. This is the template that has the logic for creating the * databind supporters. * * @return Returns String. */ public static Map getDbSupporterTemplatesMap() { return dbSupporterTemplateNameMap; } /** * Gets the extension class names. * * @return Returns String[]. */ public static String[] getExtensionClassNames() { return extensionClassNames; } /** * get the post extension class names * * @return Returns String[]. */ public static String[] getPostExtensionClassNames() { return postExtensionClassNames; } /** * Gets the third party schema names list. * * @return Returns String[]. */ public static String[] getThirdPartySchemaNames() { return thirdPartySchemaNames; } /** * Gets the language type names. * * @return Returns String[]. */ public static String[] getLanguageTypes() { return languageTypes; } /** * Gets the emitter names map keys with the language name. * * @return Returns Map. */ public static Map getLanguageEmitterMap() { return languageEmitterMap; } /** * Get the list of unwrap supported data binding frameworks * * @return list */ public static List getUnwrapSupportedFrameworkNames() { return Arrays.asList(unwrapSuppoerteddatabindingFrameworkNames); } /** * Get the list of data binding frameworks that handle unwrapping directly. * * @return names */ public static List getUnwrapDirectFrameworkNames() { return Arrays.asList(unwrapDirectdatabindingFrameworkNames); } /** * Gets the default language name. * * @return Returns String. */ public static String getDefaultLanguage() { return defaultLanguage; } /** * Gets the language specific properties. * * @return Returns Map. */ public static Map getLanguageSpecificPropertiesMap() { return languageSpecificPropertiesMap; } /** * Gets the databinding framework names. * * @return Returns String[]. */ public static String[] getDatabindingFrameworkNames() { return databindingFrameworkNames; } /** * Gets the extensions map for the databinding frameworks. The entries are keys by the framework * name. * * @return Returns Map. */ public static Map getDatabindingFrameworkNameToExtensionMap() { return databindingFrameworkNameToExtensionMap; } /** * Gets the default DB framwork name. * * @return Returns String. */ public static String getDefaultDBFrameworkName() { return defaultDBFrameworkName; } } ./src/org/apache/axis2/wsdl/util/TypeTesterUtil.java0000664000175000017500000000316311767656530021574 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; public class TypeTesterUtil { /** * Check whether a given classname is primitives * * @param className */ public static boolean isPrimitive(String className) { return "int".equals(className) || "float".equals(className) || "boolean".equals(className) || "double".equals(className) || "byte".equals(className) || "short".equals(className) || "long".equals(className); } /** * Tests whether the given classname has a package the current logic is simple where we look * for a '.' inside the classname string * * @param className */ public static boolean hasPackage(String className) { return (className.indexOf('.') != -1); } } ./src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java0000664000175000017500000001067511767656530022454 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.util; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.i18n.CodegenMessages; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.stream.StreamSource; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Iterator; import java.util.Map; public class XSLTIncludeResolver implements URIResolver, Constants { private CodeGenConfiguration configuration; public static final String EMPTY_TEMPLATE = ""; public XSLTIncludeResolver() { } /** @param config */ public XSLTIncludeResolver(CodeGenConfiguration config) { this.configuration = config; } /** * Resolves a given href and base combination * * @param href * @param base * @throws TransformerException */ public Source resolve(String href, String base) throws TransformerException { String templateName; Map externalPropertyMap = configuration.getProperties(); InputStream supporterTemplateStream; if (XSLT_INCLUDE_DATABIND_SUPPORTER_HREF_KEY.equals(href)) { //use the language name from the configuration to search the key //our search only consists of looking for the data binding name //in the key Map dbSupporterMap = ConfigPropertyFileLoader.getDbSupporterTemplatesMap(); String key; for (Iterator keys = dbSupporterMap.keySet().iterator(); keys.hasNext();) { key = (String)keys.next(); if (key.indexOf(configuration.getDatabindingType()) != -1) { return getSourceFromTemplateName((String)dbSupporterMap.get(key)); } } } if (XSLT_INCLUDE_TEST_OBJECT_HREF_KEY.equals((href))) { return getSourceFromTemplateName(ConfigPropertyFileLoader.getTestObjectTemplateName()); } if (externalPropertyMap.get(href) != null) { templateName = externalPropertyMap.get(href).toString(); if (templateName != null) { supporterTemplateStream = getClass().getResourceAsStream(templateName); return new StreamSource(supporterTemplateStream); } } else if ((href != null) && (!href.equals("externalTemplate"))){ Source source = getSourceFromTemplateName(href); if ((source != null) && ((StreamSource)source).getInputStream() != null){ return source; } return getEmptySource(); } //if nothing could be found return an empty source return getEmptySource(); } /** * load the template from a given resource path * * @param templateName * @return the loaded transform source * @throws TransformerException */ private Source getSourceFromTemplateName(String templateName) throws TransformerException { InputStream supporterTemplateStream; if (templateName != null) { supporterTemplateStream = getClass().getResourceAsStream(templateName); return new StreamSource(supporterTemplateStream); } else { throw new TransformerException( CodegenMessages.getMessage("resolver.templateNotFound", templateName)); } } /** * returns an empty source * * @return stream source */ private Source getEmptySource() { return new StreamSource(new ByteArrayInputStream(EMPTY_TEMPLATE.getBytes())); } } ./src/org/apache/axis2/wsdl/SOAPModuleMessage.java0000664000175000017500000000177411767656530021074 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; public class SOAPModuleMessage { private String uri; public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } } ./src/org/apache/axis2/wsdl/WSDL2Code.java0000664000175000017500000000426411767656530017302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.CommandLineOptionParser; import org.apache.axis2.wsdl.codegen.CodeGenerationEngine; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator; public class WSDL2Code { public static void main(String[] args) throws Exception { CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser( args); validateCommandLineOptions(commandLineOptionParser); new CodeGenerationEngine(commandLineOptionParser).generate(); } private static void printUsage() { System.out.println(CodegenMessages.getMessage("wsdl2code.arg")); System.out.println(CodegenMessages.getMessage("wsdl2code.arg1")); for (int i = 2; i <= 45; i++) { System.out.println(" " + CodegenMessages.getMessage("wsdl2code.arg" + i)); } System.exit(0);//$NON-SEC-2 } private static void validateCommandLineOptions( CommandLineOptionParser parser) { if (parser.getInvalidOptions(new WSDL2JavaOptionsValidator()).size() > 0) printUsage(); if (null == parser.getAllOptions().get( CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION)) printUsage(); } } ./src/org/apache/axis2/wsdl/WSDL2C.java0000664000175000017500000000240311767656530016603 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; public class WSDL2C { public static void main(String[] args) throws Exception { String[] cargs = new String[args.length + 2]; System.arraycopy(args, 0, cargs, 0, args.length); System.setProperty("org.apache.adb.properties", "/org/apache/axis2/schema/c-schema-compile.properties"); cargs[args.length] = "-l"; cargs[args.length + 1] = "c"; WSDL2Code.main(cargs); } }./src/org/apache/axis2/wsdl/codegen/0000775000175000017500000000000011767656530016407 5ustar brianbrian./src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java0000664000175000017500000003347511767656530023302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen; import org.apache.axis2.AxisFault; import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder; import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder; import org.apache.axis2.description.WSDL20ToAxisServiceBuilder; import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.CommandLineOptionParser; import org.apache.axis2.wsdl.codegen.emitter.Emitter; import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.wsdl.WSDLException; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class CodeGenerationEngine { private static final Log log = LogFactory.getLog(CodeGenerationEngine.class); /** Array List for pre-extensions. Extensions that run before the emitter */ private List preExtensions = new ArrayList(); /** Array List for post-extensions. Extensions that run after the codegens */ private List postExtensions = new ArrayList(); /** Codegen configuration reference */ private CodeGenConfiguration configuration; /** * @param configuration * @throws CodeGenerationException */ public CodeGenerationEngine(CodeGenConfiguration configuration) throws CodeGenerationException { this.configuration = configuration; loadExtensions(); } /** * @param parser * @throws CodeGenerationException */ public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException { Map allOptions = parser.getAllOptions(); String wsdlUri; try { CommandLineOption option = (CommandLineOption)allOptions. get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION); wsdlUri = option.getOptionValue(); configuration = new CodeGenConfiguration(allOptions); if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. equals(configuration.getWSDLVersion())) { WSDL20ToAxisServiceBuilder builder; // jibx currently does not support multiservice if ((configuration.getServiceName() != null) || (configuration.getDatabindingType().equals("jibx"))) { builder = new WSDL20ToAxisServiceBuilder( wsdlUri, configuration.getServiceName(), configuration.getPortName(), configuration.isAllPorts()); builder.setCodegen(true); configuration.addAxisService(builder.populateService()); } else { builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, configuration.getPortName()); builder.setCodegen(true); builder.setAllPorts(configuration.isAllPorts()); configuration.setAxisServices( ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices()); } } else { //It'll be WSDL 1.1 Definition wsdl4jDef = readInTheWSDLFile(wsdlUri); // we save the original wsdl definition to write it to the resource folder later // this is required only if it has imports Map imports = wsdl4jDef.getImports(); if ((imports != null) && (imports.size() > 0)) { configuration.setWsdlDefinition(readInTheWSDLFile(wsdlUri)); } else { configuration.setWsdlDefinition(wsdl4jDef); } // we generate the code for one service and one port if the // user has specified them. // otherwise generate the code for every service. // TODO: find out a permanant solution for this. QName serviceQname = null; if (configuration.getServiceName() != null) { serviceQname = new QName(wsdl4jDef.getTargetNamespace(), configuration.getServiceName()); } WSDL11ToAxisServiceBuilder builder; // jibx currently does not support multiservice if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) { builder = new WSDL11ToAxisServiceBuilder( wsdl4jDef, serviceQname, configuration.getPortName(), configuration.isAllPorts()); builder.setCodegen(true); configuration.addAxisService(builder.populateService()); } else { builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, configuration.getPortName()); builder.setCodegen(true); builder.setAllPorts(configuration.isAllPorts()); configuration.setAxisServices( ((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices()); } } configuration.setBaseURI(getBaseURI(wsdlUri)); } catch (AxisFault axisFault) { throw new CodeGenerationException( CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault); } catch (WSDLException e) { throw new CodeGenerationException( CodegenMessages.getMessage("engine.wsdlParsingException"), e); } catch (Exception e) { throw new CodeGenerationException( CodegenMessages.getMessage("engine.wsdlParsingException"), e); } loadExtensions(); } /** * Loads the relevant preExtensions * * @throws CodeGenerationException */ private void loadExtensions() throws CodeGenerationException { //load pre extensions String[] extensions = ConfigPropertyFileLoader.getExtensionClassNames(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { //load the Extension class addPreExtension((CodeGenExtension)getObjectFromClassName(extensions[i].trim())); } } //load post extensions String[] postExtensions = ConfigPropertyFileLoader.getPostExtensionClassNames(); if (postExtensions != null) { for (int i = 0; i < postExtensions.length; i++) { //load the Extension class addPostExtension( (CodeGenExtension)getObjectFromClassName(postExtensions[i].trim())); } } } /** * Adds a given extension to the list * * @param ext */ private void addPreExtension(CodeGenExtension ext) { if (ext != null) { preExtensions.add(ext); } } /** * Adds a given extension to the list * * @param ext */ private void addPostExtension(CodeGenExtension ext) { if (ext != null) { postExtensions.add(ext); } } /** * Generate the code!! * * @throws CodeGenerationException */ public void generate() throws CodeGenerationException { try { //engage the pre-extensions for (int i = 0; i < preExtensions.size(); i++) { ((CodeGenExtension)preExtensions.get(i)).engage(configuration); } Emitter emitter; TypeMapper mapper = configuration.getTypeMapper(); if (mapper == null) { // this check is redundant here. The default databinding extension should // have already figured this out and thrown an error message. However in case the // users decides to mess with the config it is safe to keep this check in order to throw // a meaningful error message throw new CodeGenerationException( CodegenMessages.getMessage("engine.noProperDatabindingException")); } //Find and invoke the emitter by reflection Map emitterMap = ConfigPropertyFileLoader.getLanguageEmitterMap(); String className = (String)emitterMap.get(configuration.getOutputLanguage()); if (className != null) { emitter = (Emitter)getObjectFromClassName(className); emitter.setCodeGenConfiguration(configuration); emitter.setMapper(mapper); } else { throw new Exception(CodegenMessages.getMessage("engine.emitterMissing")); } //invoke the necessary methods in the emitter if (configuration.isServerSide()) { emitter.emitSkeleton(); // if the users want both client and server, it would be in the // generate all option if (configuration.isGenerateAll()) { emitter.emitStub(); } } else { emitter.emitStub(); } //engage the post-extensions for (int i = 0; i < postExtensions.size(); i++) { ((CodeGenExtension)postExtensions.get(i)).engage(configuration); } } catch (ClassCastException e) { throw new CodeGenerationException(CodegenMessages.getMessage("engine.wrongEmitter"), e); } catch (Exception e) { throw new CodeGenerationException(e); } } /** * Read the WSDL file * * @param uri * @throws WSDLException */ public Definition readInTheWSDLFile(final String uri) throws WSDLException { WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); reader.setFeature("javax.wsdl.importDocuments", true); return reader.readWSDL(uri); } /** * gets a object from the class * * @param className */ private Object getObjectFromClassName(String className) throws CodeGenerationException { try { Class extensionClass = getClass().getClassLoader().loadClass(className); return extensionClass.newInstance(); } catch (ClassNotFoundException e) { // TODO REVIEW FOR JAVA 6 // In Java 5, if you passed an array string such as "[Lcom.mypackage.MyClass;" to // loadClass, the class would indeed be loaded. // In JDK6, a ClassNotFoundException is thrown. // The work-around is to use code Class.forName instead. // Example: // try { // classLoader.loadClass(name); // } catch (ClassNotFoundException e) { // Class.forName(name, false, loader); // } log.debug(CodegenMessages.getMessage("engine.extensionLoadProblem"), e); return null; } catch (InstantiationException e) { throw new CodeGenerationException( CodegenMessages.getMessage("engine.extensionInstantiationProblem"), e); } catch (IllegalAccessException e) { throw new CodeGenerationException(CodegenMessages.getMessage("engine.illegalExtension"), e); } catch (NoClassDefFoundError e) { log.debug(CodegenMessages.getMessage("engine.extensionLoadProblem"), e); return null; } catch (Exception e) { throw new CodeGenerationException(e); } } /** * calculates the base URI Needs improvement but works fine for now ;) * * @param currentURI */ private String getBaseURI(String currentURI) throws URISyntaxException, IOException { File file = new File(currentURI); if (file.exists()) { return file.getCanonicalFile().getParentFile().toURI().toString(); } String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/")); return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); } /** * calculates the URI * needs improvement * * @param currentURI */ private String getURI(String currentURI) throws URISyntaxException, IOException { File file = new File(currentURI); if (file.exists()){ return file.getCanonicalFile().toURI().toString(); } else { return currentURI; } } public CodeGenConfiguration getConfiguration() { return configuration; } } ./src/org/apache/axis2/wsdl/codegen/codegen-config.properties0000664000175000017500000003023011767656530023372 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # ####################################################################################################################### ##################### code generator property file ################################################################# ####################################################################################################################### # Extensions - The extension class names are comma separated # and these extensions will run before the main emitter # these are loaded in their lexical order # Note the last extension - It includes a check to figure out whether proper databinding has taken place # This extension should appear AFTER all the databinding extensions inorder to function properly codegen.extension=org.apache.axis2.wsdl.codegen.extension.PackageFinder,\ org.apache.axis2.wsdl.codegen.extension.JAXWSWapperExtension,\ org.apache.axis2.wsdl.codegen.extension.SchemaUnwrapperExtension,\ org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension, \ org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension, \ org.apache.axis2.wsdl.codegen.extension.JiBXExtension, \ org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension, \ org.apache.axis2.wsdl.codegen.extension.TypeMapperExtension, \ org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension, \ org.apache.axis2.wsdl.codegen.extension.PolicyEvaluator #extensions that work after the main emitter. These will include functionality such as #formatters post.codegen.extension=org.apache.axis2.wsdl.codegen.extension.JavaPrettyPrinterExtension, \ org.apache.axis2.wsdl.codegen.extension.XMLPrettyPrinterExtension, \ org.apache.axis2.wsdl.codegen.extension.WSDLPrettyPrinterExtension, \ org.apache.axis2.wsdl.codegen.extension.ExcludePackageExtension #codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension # The third party schemas to be loaded. e.g. The Xmime extension # Note - these will be loaded from the org.apache.axis2.wsdl.codegen.schema package. # so whatever the third party schema's that are listed here should be present there #codegen.thirdparty.schema= codegen.thirdparty.schema=xmime.xsd,soap-enc.xsd ##################################################################################################################### ##################################################################################################################### # Codegen data binding frameworks and their related information # The names of the codegeneration frameworks in lexical order # these are the names that should be passed onto the tool as arguments as well codegen.databinding.frameworks=adb,xmlbeans,jibx,jaxbri,none # this property keeps the names of the databinding frameworks which support # unwrapping codegen.databinding.unwrap.supported=adb,xmlbeans,jibx,jaxbri # this property keeps the names of the databinding frameworks that handle unwrapping # directly (rather than by using the unwrapper extension) codegen.databinding.unwrap.direct=jibx # the related extensions for the specified data binding frameworks above # Note - these are in the lexical order of the framework names. There is an implicit assumption # that a given databinding framework will be processed only by one extension codegen.databinding.extensions=org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.JiBXExtension,org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension # the default data binding framework name codegen.databinding.frameworks.default=adb # the databinding templates - codegen.databinding.adb.supporter.template=/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl codegen.databinding.xmlbeans.supporter.template=/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl codegen.databinding.jibx.supporter.template=/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl codegen.databinding.jaxbri.supporter.template=/org/apache/axis2/jaxbri/template/JaxbRIDatabindingTemplate.xsl codegen.databinding.none.supporter.template=/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl codegen.databinding.testobject.template=/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl ##################################################################################################################### ##################################################################################################################### # Language types - these are the language types that the code generator understands. Again this is the name of the # language that should be passed from the tool as well # codegen.languages=java,c,jax-ws # Emitter class is the major code generator class that should be changed according to the language. # The emiiters need to implement the org.apache.axis2.wsdl.codegen.emitter.Emitter interface # Note - The emitters should appear in the lexical order of the languages. So the language java in the above # list corresponds to the org.apache.axis2.wsdl.codegen.emitter.JavaEmitter codegen.emitters=org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter,org.apache.axis2.wsdl.codegen.emitter.CEmitter,org.apache.axis2.wsdl.codegen.emitter.jaxws.JAXWS20Emitter # Default language, this is the default language that would be picked when no language is specified. it should be # one of the languages specified above codegen.languages.default=java # Default source folder name codegen.general.src.name=src # Default resource folder name codegen.general.resource.name=resources ##################################################################################################################### ######################## Language specific section ################################################################# ##################################################################################################################### # The language specific section has a special custom style. The language name comes first and separated from the period # a unique name. These parameters will be included in a hashmap that is will be stored in another hash map with the # language as the key ##################################################################################################################### # Java section - Templates. # The format of the templates is , # Note this section is specific to the emitter logic. One can have anything here! java.interface.template=org.apache.axis2.wsdl.codegen.writer.InterfaceWriter,/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl java.interface.impl.template=org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter,/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl java.bean.template=org.apache.axis2.wsdl.codegen.writer.BeanWriter,/org/apache/axis2/wsdl/template/java/BeanTemplate.xsl java.callback.template=org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter,/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl java.exception.template=org.apache.axis2.wsdl.codegen.writer.ExceptionWriter,/org/apache/axis2/wsdl/template/java/ExceptionTemplate.xsl java.skeleton.template=org.apache.axis2.wsdl.codegen.writer.SkeletonWriter,/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl java.skeleton.interface.template=org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter,/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl java.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl java.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl java.message.receiver.template=org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter,/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl # java.antbuild.xmlbeans.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl java.antbuild.jibx.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/jibxAntBuildTemplate.xsl java.antbuild.jaxbri.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/jaxbriAntBuildTemplate.xsl java.antbuild.adb.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl java.antbuild.none.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl # file extension for generated files from this language java.filename.extension=java # ##################################################################################################################### # C section - Templates. # The format of the templates is , # Note this section is specific to the emitter logic. One can have anything here! c.interface.header.template=org.apache.axis2.wsdl.codegen.writer.CStubHeaderWriter,/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl c.interface.impl.template=org.apache.axis2.wsdl.codegen.writer.CStubSourceWriter,/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl c.skeleton.header.template=org.apache.axis2.wsdl.codegen.writer.CSkelHeaderWriter,/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl c.skeleton.impl.template=org.apache.axis2.wsdl.codegen.writer.CSkelSourceWriter,/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl c.svc_skeleton.template=org.apache.axis2.wsdl.codegen.writer.CSvcSkeletonWriter,/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl c.service.template=org.apache.axis2.wsdl.codegen.writer.CServiceXMLWriter,/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl c.build.template=org.apache.axis2.wsdl.codegen.writer.CBuildScriptWriter,/org/apache/axis2/wsdl/template/c/BuildScriptTemplate.xsl # file extension for generated source files from this language c.filename.extension=c jax-ws.exception.template=org.apache.axis2.wsdl.codegen.writer.ExceptionWriter,/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl jax-ws.interface.impl.template=org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceImplTemplate.xsl jax-ws.skeleton.template=org.apache.axis2.wsdl.codegen.writer.SkeletonWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl jax-ws.skeleton.interface.template=org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl jax-ws.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl jax-ws.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/java/JaxwsServiceXMLTemplate.xsl jax-ws.antbuild.jaxbri.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/jaxbriAntBuildTemplate.xsl jax-ws.antbuild.none.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl # file extension for generated files from this language jax-ws.filename.extension=java ./src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java0000664000175000017500000000236111767656530024021 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen; public class CodeGenerationException extends Exception { private static final long serialVersionUID = 7763140075166886795L; public CodeGenerationException(String message) { super(message); } public CodeGenerationException(String message, Throwable throwable) { super(message, throwable); } public CodeGenerationException(Throwable throwable) { super(throwable); } } ./src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java0000664000175000017500000004016011767656530023307 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen; import org.apache.axis2.description.AxisService; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.URLProcessor; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import javax.wsdl.Definition; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class CodeGenConfiguration implements CommandLineOptionConstants { /** Axis Services reference */ private List axisServices; /** Axis service to use */ private AxisService axisService; /** Base URI */ private String baseURI; /** path to the repository - used for evaluating policy */ private String repositoryPath; /** Mapping file including the qname to type map */ private File typeMappingFile; /** keeps the WSDL version - default is 1.1 */ private String WSDLVersion = WSDL2JavaConstants.WSDL_VERSION_1; public String getWSDLVersion() { return WSDLVersion; } public void setWSDLVersion(String WSDLVersion) { this.WSDLVersion = WSDLVersion; } public File getTypeMappingFile() { return typeMappingFile; } public void setTypeMappingFile(File typeMappingFile) { this.typeMappingFile = typeMappingFile; } /** A map to keep the custom namespace and package name mappings */ private Map uri2PackageNameMap; public Map getUri2PackageNameMap() { return uri2PackageNameMap; } public void setUri2PackageNameMap(Map uri2PackageNameMap) { if (this.uri2PackageNameMap == null) { this.uri2PackageNameMap = uri2PackageNameMap; } else { this.uri2PackageNameMap.putAll(uri2PackageNameMap); } } /** Full path and name of XMLBeans xsdconfig file to use */ private String xsdConfigFile = null; /** * Returns the xsdconfig file to use for XMLBeans data binding. * * @return Full path and name of XMLBeans xsdconfig file to use * @deprecated */ public String getXsdConfigFile() { return xsdConfigFile; } /** * Sets the xsdconfig file to use for XMLBeans data binding. * * @param xsdConfigFile Full path and name of XMLBeans xsdconfig file to use * @deprecated */ public void setXsdConfigFile(String xsdConfigFile) { this.xsdConfigFile = xsdConfigFile; } /** Says whether to flatten the files or put them in specific folders */ private boolean flattenFiles = false; public boolean isFlattenFiles() { return flattenFiles; } public void setFlattenFiles(boolean flattenFiles) { this.flattenFiles = flattenFiles; } /** Folder name for the resource files */ private String resourceLocation = ConfigPropertyFileLoader.getResourceFolderName(); public String getResourceLocation() { return resourceLocation; } public void setResourceLocation(String resourceLocation) { this.resourceLocation = resourceLocation; } /** Folder name for the source files */ private String sourceLocation = ConfigPropertyFileLoader.getSrcFolderName(); public String getSourceLocation() { return sourceLocation; } public void setSourceLocation(String sourceLocation) { this.sourceLocation = sourceLocation; } /** Determines whether the parameters are wrapped or unwrapped true by default */ private boolean parametersWrapped = true; public boolean isParametersWrapped() { return parametersWrapped; } public void setParametersWrapped(boolean parametersWrapped) { this.parametersWrapped = parametersWrapped; } public String getBaseURI() { return baseURI; } public void setBaseURI(String baseURI) { this.baseURI = baseURI; } public Map getConfigurationProperties() { return configurationProperties; } public void setConfigurationProperties(Map configurationProperties) { this.configurationProperties = configurationProperties; } public void setOutputLanguage(String outputLanguage) { this.outputLanguage = outputLanguage; } public void setAdvancedCodeGenEnabled(boolean advancedCodeGenEnabled) { this.advancedCodeGenEnabled = advancedCodeGenEnabled; } public void setAsyncOn(boolean asyncOn) { this.asyncOn = asyncOn; } public void setSyncOn(boolean syncOn) { this.syncOn = syncOn; } public void setServerSide(boolean serverSide) { this.serverSide = serverSide; } public void setGenerateDeployementDescriptor(boolean generateDeployementDescriptor) { this.generateDeployementDescriptor = generateDeployementDescriptor; } public void setWriteTestCase(boolean writeTestCase) { this.writeTestCase = writeTestCase; } public void setOutputLocation(File outputLocation) { this.outputLocation = outputLocation; } private File outputLocation; //get the defaults for these from the property file private String outputLanguage = ConfigPropertyFileLoader.getDefaultLanguage(); private String databindingType = ConfigPropertyFileLoader.getDefaultDBFrameworkName(); private boolean advancedCodeGenEnabled = false; private boolean asyncOn = true; private boolean syncOn = true; private boolean serverSide = false; private boolean generateDeployementDescriptor = true; private boolean writeTestCase = false; private boolean skipMessageReceiver = false; private boolean skipWriteWSDLs = false; private boolean skipBuildXML = false; private boolean setoutputSourceLocation = false; private String packageName = URLProcessor.DEFAULT_PACKAGE; // Default packClasses is true, which means the classes generated // by default are wrapped. The effect of this setting will be controlled // to some extent, by the other settings as well. private boolean packClasses = true; private boolean generateAll = false; //user selected portname private String portName; //user selected servicename private String serviceName; //option to generate server side interface or not private boolean serverSideInterface = false; public boolean isServerSideInterface() { return serverSideInterface; } public void setServerSideInterface(boolean serverSideInterface) { this.serverSideInterface = serverSideInterface; } public boolean isSetoutputSourceLocation(){ return setoutputSourceLocation; } public String getPortName() { return portName; } public void setPortName(String portName) { this.portName = portName; } public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } /** A hashmap to hang the property objects */ private Map policyMap = new HashMap(); /* * A hashmap of properties that may be populated on the way. extensions can populate it * This can be used to keep non specific information */ private Map configurationProperties = new HashMap(); public boolean isGenerateAll() { return generateAll; } public void setGenerateAll(boolean generateAll) { this.generateAll = generateAll; } /** * Gets the wrap classes flag. * * @return Returns true if it is a wrap class, else returns false. */ public boolean isPackClasses() { return packClasses; } /** * Sets the wrap classes flag. * * @param packClasses */ public void setPackClasses(boolean packClasses) { this.packClasses = packClasses; } /** * Gets the policy map. * * @return Returns Map. */ public Map getPolicyMap() { return policyMap; } /** * Sets the policy map. * * @param policyMap */ public void setPolicyMap(Map policyMap) { this.policyMap = policyMap; } /** * Puts a property into the configuration. * * @param key * @param value */ public void putProperty(Object key, Object value) { configurationProperties.put(key, value); } /** * Gets the property from the configuration. * * @param key * @return Returns the property as Object. */ public Object getProperty(Object key) { return configurationProperties.get(key); } /** * Gets all property objects. * * @return Returns Map of all properties. */ public Map getProperties() { return configurationProperties; } private TypeMapper typeMapper; /** @return Returns TypeMapper. */ public TypeMapper getTypeMapper() { return typeMapper; } /** @param typeMapper */ public void setTypeMapper(TypeMapper typeMapper) { this.typeMapper = typeMapper; } /** @return Returns String. */ public String getDatabindingType() { return databindingType; } /** @param databindingType */ public void setDatabindingType(String databindingType) { this.databindingType = databindingType; } /** * Constructor for the configuration. It populates the values using the options map. * * @param optionMap */ public CodeGenConfiguration(Map optionMap) { CodegenConfigLoader.loadConfig(this, optionMap); this.axisServices = new ArrayList(); this.outputXmlFileNamesList = new ArrayList(); } /** @return Returns the outputLocation. */ public File getOutputLocation() { return outputLocation; } public String getOutputLanguage() { return outputLanguage; } public boolean isAdvancedCodeGenEnabled() { return advancedCodeGenEnabled; } /** @return Returns the packageName. */ public String getPackageName() { return packageName; } /** @param packageName The packageName to set. */ public void setPackageName(String packageName) { this.packageName = packageName; } public boolean isAsyncOn() { return asyncOn; } public boolean isSyncOn() { return syncOn; } public boolean isServerSide() { return serverSide; } public boolean isGenerateDeployementDescriptor() { return generateDeployementDescriptor; } public boolean isSkipBuildXML() { return skipBuildXML; } public void setSkipBuildXML(boolean skipBuildXML) { this.skipBuildXML = skipBuildXML; } public boolean isWriteTestCase() { return writeTestCase; } public boolean isSkipWriteWSDLs() { return skipWriteWSDLs; } public void setSkipWriteWSDLs(boolean writeWriteWSDLs) { this.skipWriteWSDLs = writeWriteWSDLs; } public boolean isSkipMessageReceiver() { return skipMessageReceiver; } public void setSkipMessageReceiver(boolean skipMessageReceiver) { this.skipMessageReceiver = skipMessageReceiver; } public void setRepositoryPath(String repositoryPath) { this.repositoryPath = repositoryPath; } public String getRepositoryPath() { return repositoryPath; } public List getAxisServices() { return axisServices; } public void setAxisServices(List axisServices) { this.axisServices = axisServices; } public void addAxisService(AxisService axisService) { this.axisServices.add(axisService); } public AxisService getAxisService() { // return the first element of the axis services if (axisService != null) { return axisService; } else if ((axisServices != null) && (axisServices.size() > 0)) { return (AxisService)axisServices.get(0); } else { return null; } } public void setAxisService(AxisService axisService) { this.axisService = axisService; } /** * This flag determines whether the generated classes are expected to be backword compatible * with Axis 1.x */ private boolean backwordCompatibilityMode = false; public boolean isBackwordCompatibilityMode() { return backwordCompatibilityMode; } public void setBackwordCompatibilityMode(boolean backwordCompatibilityMode) { this.backwordCompatibilityMode = backwordCompatibilityMode; } /** Should we suppress namespace prefixes */ private boolean suppressPrefixesMode = false; public boolean isSuppressPrefixesMode() { return suppressPrefixesMode; } public void setSuppressPrefixesMode(boolean suppressPrefixesMode) { this.suppressPrefixesMode = suppressPrefixesMode; } public String getTargetNamespace() { String targetNamespace = null; if ((this.axisServices != null) && (this.axisServices.size() > 0)) { targetNamespace = ((AxisService)this.axisServices.get(0)).getTargetNamespace(); } return targetNamespace; } public List getSchemaListForAllServices() { List schemas = new ArrayList(); AxisService axisService; for (Iterator iter = this.axisServices.iterator(); iter.hasNext();) { axisService = (AxisService)iter.next(); schemas.addAll(axisService.getSchema()); } return schemas; } /** keep this wsdl definition to write the wsdl file later */ private Definition wsdlDefinition; public Definition getWsdlDefinition() { return wsdlDefinition; } public void setWsdlDefinition(Definition wsdlDefinition) { this.wsdlDefinition = wsdlDefinition; } private boolean isAllPorts; private boolean isOverride; public boolean isAllPorts() { return isAllPorts; } public void setAllPorts(boolean allPorts) { isAllPorts = allPorts; } public boolean isOverride() { return isOverride; } public void setOverride(boolean override) { isOverride = override; } // this is used to keep the generated xml file list to pretty print. private List outputXmlFileNamesList; public List getOutputXmlFileNamesList() { return outputXmlFileNamesList; } public void setOutputXmlFileNamesList(List outputXmlFileNamesList) { this.outputXmlFileNamesList = outputXmlFileNamesList; } public void addXmlFileName(String fileName){ this.outputXmlFileNamesList.add(fileName); } public void setoutputSourceLocation(boolean setoutputsourcelocation) { setoutputSourceLocation = true; } private String excludeProperties; public String getExcludeProperties() { return excludeProperties; } public void setExcludeProperties(String excludeProperties) { this.excludeProperties = excludeProperties; } private String skeltonInterfaceName; private String skeltonClassName; public String getSkeltonInterfaceName() { return skeltonInterfaceName; } public void setSkeltonInterfaceName(String skeltonInterfaceName) { this.skeltonInterfaceName = skeltonInterfaceName; } public String getSkeltonClassName() { return skeltonClassName; } public void setSkeltonClassName(String skeltonClassName) { this.skeltonClassName = skeltonClassName; } } ./src/org/apache/axis2/wsdl/codegen/emitter/0000775000175000017500000000000011767656530020060 5ustar brianbrian./src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java0000664000175000017500000041737311767656530030137 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.emitter; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.description.AxisBinding; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL20DefaultValueHolder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.Utils; import org.apache.axis2.util.XSLTUtils; import org.apache.axis2.wsdl.HTTPHeaderMessage; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.SOAPModuleMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter; import org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter; import org.apache.axis2.wsdl.codegen.writer.ExceptionWriter; import org.apache.axis2.wsdl.codegen.writer.FileWriter; import org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter; import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; import org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter; import org.apache.axis2.wsdl.codegen.writer.SchemaWriter; import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter; import org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter; import org.apache.axis2.wsdl.codegen.writer.SkeletonWriter; import org.apache.axis2.wsdl.codegen.writer.TestClassWriter; import org.apache.axis2.wsdl.codegen.writer.WSDL11Writer; import org.apache.axis2.wsdl.codegen.writer.WSDL20Writer; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.util.Constants; import org.apache.axis2.wsdl.util.MessagePartInformationHolder; import org.apache.axis2.wsdl.util.TypeTesterUtil; import org.apache.axis2.wsdl.util.XSLTIncludeResolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import org.apache.ws.commons.schema.XmlSchema; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.net.URI; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public class AxisServiceBasedMultiLanguageEmitter implements Emitter { protected static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler"; protected static final String STUB_SUFFIX = "Stub"; protected static final String TEST_SUFFIX = "Test"; protected static final String SKELETON_CLASS_SUFFIX = "Skeleton"; protected static final String SKELETON_CLASS_SUFFIX_BACK = "Impl"; protected static final String SKELETON_INTERFACE_SUFFIX = "SkeletonInterface"; // keep a seperate variable for SKELETON_INTERFACE_SUFFIX_BACK although it is // "" to accomadate any future changes easily. protected static final String SKELETON_INTERFACE_SUFFIX_BACK = ""; protected static final String STUB_INTERFACE_SUFFIX_BACK = "Stub"; protected static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver"; protected static final String DATABINDING_SUPPORTER_NAME_SUFFIX = "DatabindingSupporter"; protected static Map mepToClassMap; protected static Map mepToSuffixMap; protected AxisBinding axisBinding; protected AxisEndpoint axisEndpoint; protected int uniqueFaultNameCounter = 0; /** * Field constructorMap */ protected static HashMap constructorMap = new HashMap(50); //~--- static initializers ------------------------------------------------ static { // Type maps to a valid initialization value for that type // Type var = new Type(arg) // Where "Type" is the key and "new Type(arg)" is the string stored // Used in emitting test cases and server skeletons. constructorMap.put("int", "0"); constructorMap.put("float", "0"); constructorMap.put("boolean", "true"); constructorMap.put("double", "0"); constructorMap.put("byte", "(byte)0"); constructorMap.put("short", "(short)0"); constructorMap.put("long", "0"); constructorMap.put("java.lang.Boolean", "new java.lang.Boolean(false)"); constructorMap.put("java.lang.Byte", "new java.lang.Byte((byte)0)"); constructorMap.put("java.lang.Double", "new java.lang.Double(0)"); constructorMap.put("java.lang.Float", "new java.lang.Float(0)"); constructorMap.put("java.lang.Integer", "new java.lang.Integer(0)"); constructorMap.put("java.lang.Long", "new java.lang.Long(0)"); constructorMap.put("java.lang.Short", "new java.lang.Short((short)0)"); constructorMap.put("java.math.BigDecimal", "new java.math.BigDecimal(0)"); constructorMap.put("java.math.BigInteger", "new java.math.BigInteger(\"0\")"); constructorMap.put("java.lang.Object", "new java.lang.String()"); constructorMap.put("byte[]", "new byte[0]"); constructorMap.put("java.util.Calendar", "java.util.Calendar.getInstance()"); constructorMap.put("javax.xml.namespace.QName", "new javax.xml.namespace.QName(\"http://foo\", \"bar\")"); //populate the MEP -> class map mepToClassMap = new HashMap(); mepToClassMap.put(WSDL2Constants.MEP_URI_IN_ONLY, "org.apache.axis2.receivers.AbstractInMessageReceiver"); mepToClassMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, "org.apache.axis2.receivers.AbstractMessageReceiver"); mepToClassMap.put(WSDL2Constants.MEP_URI_IN_OUT, "org.apache.axis2.receivers.AbstractInOutMessageReceiver"); //populate the MEP -> suffix map mepToSuffixMap = new HashMap(); mepToSuffixMap.put(WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "InOnly"); mepToSuffixMap.put(WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "InOnly"); mepToSuffixMap.put(WSDL2Constants.MEP_URI_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "InOnly"); mepToSuffixMap.put(WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "RobustInOnly"); mepToSuffixMap.put(WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "RobustInOnly"); mepToSuffixMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, MESSAGE_RECEIVER_SUFFIX + "RobustInOnly"); mepToSuffixMap.put(WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OUT, MESSAGE_RECEIVER_SUFFIX + "InOut"); mepToSuffixMap.put(WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT, MESSAGE_RECEIVER_SUFFIX + "InOut"); mepToSuffixMap.put(WSDL2Constants.MEP_URI_IN_OUT, MESSAGE_RECEIVER_SUFFIX + "InOut"); //register the other types as necessary } //~--- fields ------------------------------------------------------------- protected static final Log log = LogFactory.getLog(AxisServiceBasedMultiLanguageEmitter.class); protected URIResolver resolver; // this is used to keep the current service infoHolder protected Map infoHolder; // this is used to keep infoHolders for all services protected Map allServiceInfoHolder; protected CodeGenConfiguration codeGenConfiguration; protected TypeMapper mapper; protected AxisService axisService; protected List axisServices; //a map to keep the fault classNames protected Map fullyQualifiedFaultClassNameMap = new HashMap(); protected Map faultClassNameMap = new HashMap(); protected Map faultElementQNameMap = new HashMap(); protected Map instantiatableMessageClassNames = new HashMap(); protected static final String TEST_SRC_DIR_NAME = "test"; protected boolean useHolderClass_jaxws = false; protected boolean wrapped_jaxws = false; /** * default constructor - builds */ public AxisServiceBasedMultiLanguageEmitter() { infoHolder = new HashMap(); allServiceInfoHolder = new HashMap(); } /** * Sets the relevant codegen configuration * * @param configuration * @see Emitter#setCodeGenConfiguration(org.apache.axis2.wsdl.codegen.CodeGenConfiguration) */ public void setCodeGenConfiguration(CodeGenConfiguration configuration) { this.codeGenConfiguration = configuration; this.axisServices = codeGenConfiguration.getAxisServices(); this.axisService = codeGenConfiguration.getAxisService(); this.axisEndpoint = axisService.getEndpoint(axisService.getEndpointName()); this.axisBinding = axisEndpoint.getBinding(); resolver = new XSLTIncludeResolver(codeGenConfiguration); } /** * Sets the type mapper * * @param mapper * @see Emitter#setMapper(org.apache.axis2.wsdl.databinding.TypeMapper) */ public void setMapper(TypeMapper mapper) { this.mapper = mapper; } protected Object getBindingPropertyFromOperation(String name, QName qName) { // Get the correct AxisBindingOperation coresponding to the AxisOperation AxisBindingOperation axisBindingOperation = null; if (axisBinding != null) { axisBindingOperation = (AxisBindingOperation) axisBinding.getChild(qName); } Object property = null; if (axisBindingOperation != null) { property = axisBindingOperation.getProperty(name); } if ((property == null) && (axisBinding != null)) { property = axisBinding.getProperty(name); } if (property == null) { property = WSDL20DefaultValueHolder.getDefaultValue(name); } return property; } protected Policy getBindingPolicyFromMessage(AxisBindingOperation axisBindingOperation, String key) { AxisBindingMessage axisBindingMessage = null; if (axisBindingOperation != null) { axisBindingMessage = (AxisBindingMessage) axisBindingOperation.getChild(key); if (axisBindingMessage != null) { try { return axisBindingMessage.getEffectivePolicy(); } catch (RuntimeException ex){ log.error(ex.getMessage(), ex); } } } return null; } protected Object getBindingPropertyFromMessage(String name, QName qName, String key) { Object property = null; // Get the correct AxisBindingOperation coresponding to the AxisOperation AxisBindingOperation axisBindingOperation = null; if (axisBinding != null) { axisBindingOperation = (AxisBindingOperation) axisBinding.getChild(qName); } AxisBindingMessage axisBindingMessage = null; if (axisBindingOperation != null) { axisBindingMessage = (AxisBindingMessage) axisBindingOperation.getChild(key); if (axisBindingMessage != null) { property = axisBindingMessage.getProperty(name); } if (property == null) { property = axisBindingOperation.getProperty(name); } } if ((property == null) && (axisBinding != null)) { property = axisBinding.getProperty(name); } if (property == null) { property = WSDL20DefaultValueHolder.getDefaultValue(name); } return property; } protected Object getBindingPropertyFromMessageFault(String name, QName qName, String key) { Object property = null; // Get the correct AxisBindingOperation coresponding to the AxisOperation AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBinding.getChild(qName); AxisBindingMessage axisBindingMessageFault = null; AxisBindingMessage axisBindingFault = null; if (axisBindingOperation != null) { axisBindingMessageFault = (AxisBindingMessage) axisBindingOperation.getFault(key); if (axisBindingMessageFault != null) { property = axisBindingMessageFault.getProperty(name); } if (property == null) { axisBindingFault = axisBinding.getFault(key); property = axisBindingFault.getProperty(name); } } if (property == null) { property = WSDL20DefaultValueHolder.getDefaultValue(name); } return property; } /** * Update mapper for the stub */ protected void updateMapperForStub() { updateMapperClassnames(getFullyQualifiedStubName()); } /** * Returns the fully qualified Stub name reused in many methods * * @return classname */ protected String getFullyQualifiedStubName() { String packageName = codeGenConfiguration.getPackageName(); String localPart = null; if (this.axisService.getEndpoints().size() > 1) { localPart = makeJavaClassName(axisService.getName() + axisService.getEndpointName()); } else { localPart = makeJavaClassName(axisService.getName()); } return packageName + "." + localPart + STUB_SUFFIX; } /** * rests the fault name maps */ protected void resetFaultNames() { fullyQualifiedFaultClassNameMap.clear(); faultClassNameMap.clear(); faultElementQNameMap.clear(); } /** * Populate a map of fault class names */ protected void generateAndPopulateFaultNames() { //loop through and find the faults Iterator operations = axisService.getOperations(); AxisOperation operation; AxisMessage faultMessage; while (operations.hasNext()) { operation = (AxisOperation) operations.next(); ArrayList faultMessages = operation.getFaultMessages(); for (int i = 0; i < faultMessages.size(); i++) { faultMessage = (AxisMessage) faultMessages.get(i); //make a unique name and put that in the hashmap if (!fullyQualifiedFaultClassNameMap. containsKey(faultMessage.getName())) { //make a name String className = makeJavaClassName(faultMessage.getName()); QName faultQName = new QName(codeGenConfiguration.getTargetNamespace(), faultMessage.getName()); if (this.mapper.getQNameToMappingObject(faultQName) != null) { // i.e we already have an entry className = makeJavaClassName(className + "Exception" + (uniqueFaultNameCounter++)); } while (fullyQualifiedFaultClassNameMap.containsValue(className)) { className = makeJavaClassName(className + (uniqueFaultNameCounter++)); } fullyQualifiedFaultClassNameMap.put( faultMessage.getName(), className); //we've to keep track of the fault base names seperately faultClassNameMap.put(faultMessage.getName(), className); faultElementQNameMap.put(faultMessage.getName(), faultMessage.getElementQName()); } } } } /** * Emits the stubcode with bindings. * * @throws CodeGenerationException * @see Emitter#emitStub() */ public void emitStub() throws CodeGenerationException { try { //first keep a seperate copy of the original map to use in // every iteration // for every iteration qName2NameMap is changed in updateMapperForStub // method if in the packing mode Map originalTypeMap = getNewCopy(mapper.getAllMappedNames()); for (Iterator axisServicesIter = this.axisServices.iterator(); axisServicesIter.hasNext();) { this.axisService = (AxisService) axisServicesIter.next(); //we have to generate the code for each bininding //for the moment lets genrate the stub name with the service name and end point name if (!codeGenConfiguration.isPackClasses()) { // write the call back handlers writeCallBackHandlers(); } Map endpoints = this.axisService.getEndpoints(); for (Iterator endPointsIter = endpoints.values().iterator(); endPointsIter.hasNext();) { // set the end point details. this.axisEndpoint = (AxisEndpoint) endPointsIter.next(); this.axisBinding = this.axisEndpoint.getBinding(); axisService.setEndpointName(this.axisEndpoint.getName()); axisService.setBindingName( this.axisEndpoint.getBinding().getName().getLocalPart()); // see the comment at updateMapperClassnames for details and reasons for // calling this method if (mapper.isObjectMappingPresent()) { // initialize the map to original one copyMap(originalTypeMap, mapper.getAllMappedNames()); updateMapperForStub(); } else { copyToFaultMap(); } //generate and populate the fault names before hand. We need that for //the smooth opration of the thing //first reset the fault names and recreate it resetFaultNames(); generateAndPopulateFaultNames(); updateFaultPackageForStub(); // write the inteface // feed the binding information also // note that we do not create this interface if the user switched on the wrap classes mode // this interface also depends on the binding if (!codeGenConfiguration.isPackClasses()) { writeInterface(false); } if (codeGenConfiguration.isPackClasses()) { // write the call back handlers writeCallBackHandlers(); } // write the Exceptions writeExceptions(); // write interface implementations writeInterfaceImplementation(); // write the test classes writeTestClasses(); } } // save back type map if (this.mapper.isObjectMappingPresent()) { copyMap(originalTypeMap, this.mapper.getAllMappedNames()); } if (!codeGenConfiguration.isSkipBuildXML()) { // write an ant build file // Note that ant build is generated only once // and that has to happen here only if the // client side code is required if (!codeGenConfiguration.isGenerateAll()) { //our logic for the build xml is that it will //only be written when not flattened if (!codeGenConfiguration.isFlattenFiles()) { writeAntBuild(); } } } } catch (CodeGenerationException ce) { throw ce; } catch (Exception e) { throw new CodeGenerationException(e); } } public Map getNewCopy(Map copyFormMap) { Map copyToMap = new HashMap(); Object key; for (Iterator iter = copyFormMap.keySet().iterator(); iter.hasNext();) { key = iter.next(); copyToMap.put(key, copyFormMap.get(key)); } return copyToMap; } public void copyMap(Map copyFormMap, Map copyToMap) { Object key; for (Iterator iter = copyFormMap.keySet().iterator(); iter.hasNext();) { key = iter.next(); copyToMap.put(key, copyFormMap.get(key)); } } /** * Writes the Ant build. * * @throws Exception */ protected void writeAntBuild() throws Exception { // Write the service xml in a folder with the Document skeletonModel = createDOMDocumentForAntBuild(); debugLogDocument("Document for ant build:", skeletonModel); AntBuildWriter antBuildWriter = new AntBuildWriter(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getOutputLanguage()); antBuildWriter.setDatabindingFramework(codeGenConfiguration.getDatabindingType()); antBuildWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(skeletonModel, antBuildWriter); codeGenConfiguration.addXmlFileName(antBuildWriter.getOutputFile().getAbsolutePath());//$NON-SEC-3 } /** * Creates the DOM tree for the Ant build. Uses the interface. */ protected Document createDOMDocumentForAntBuild() { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("ant"); String serviceName = makeJavaClassName(axisService.getName()); String packageName = codeGenConfiguration.getPackageName(); String[] dotSeparatedValues = packageName.split("\\."); addAttribute(doc, "package", dotSeparatedValues[0], rootElement); addAttribute(doc, "name", serviceName, rootElement); addAttribute(doc, "servicename", serviceName, rootElement); addAttribute(doc, "src", codeGenConfiguration.getSourceLocation(), rootElement); addAttribute(doc, "resource", codeGenConfiguration.getResourceLocation(), rootElement); if (codeGenConfiguration.getAxisServices().size() > 1){ addAttribute(doc, "artifactname", "Services", rootElement); } else { addAttribute(doc, "artifactname", this.axisService.getName() , rootElement); } if (!codeGenConfiguration.isWriteTestCase()) { addAttribute(doc, "testOmit", "true", rootElement); } if (codeGenConfiguration.isServerSide()) { addAttribute(doc, "isserverside", "yes", rootElement); } doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////////////////// return doc; } /** * Write the test classes */ protected void writeTestClasses() throws Exception { if (codeGenConfiguration.isWriteTestCase()) { Document classModel = createDOMDocumentForTestCase(); debugLogDocument("Document for test case:", classModel); TestClassWriter callbackWriter = new TestClassWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), TEST_SRC_DIR_NAME), codeGenConfiguration.getOutputLanguage()); callbackWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(classModel, callbackWriter); } } /** * Creates the XML Model for the test case * * @return DOM document */ protected Document createDOMDocumentForTestCase() { String coreClassName = makeJavaClassName(axisService.getName()); Document doc = getEmptyDocument(); Element rootElement = doc.createElement("class"); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); if (this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "name", makeJavaClassName(axisService.getName() + axisService.getEndpointName()) + TEST_SUFFIX, rootElement); } else { addAttribute(doc, "name", makeJavaClassName(axisService.getName()) + TEST_SUFFIX, rootElement); } //todo is this right ??? addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement); addAttribute(doc, "interfaceName", coreClassName, rootElement); if (codeGenConfiguration.isPackClasses()) { if (this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "callbackname", makeJavaClassName( axisService.getName() + axisService.getEndpointName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } else { addAttribute(doc, "callbackname", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } } else { addAttribute(doc, "callbackname", coreClassName + CALL_BACK_HANDLER_SUFFIX, rootElement); } if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "stubname", makeJavaClassName(axisService.getBindingName()) + STUB_SUFFIX, rootElement); } else { if (this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "stubname", makeJavaClassName( axisService.getName() + axisService.getEndpointName()) + STUB_SUFFIX, rootElement); } else { addAttribute(doc, "stubname", makeJavaClassName(axisService.getName()) + STUB_SUFFIX, rootElement); } } //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); fillSyncAttributes(doc, rootElement); loadOperations(doc, rootElement, null); // add the databind supporters. Now the databind supporters are completly contained inside // the stubs implementation and not visible outside rootElement.appendChild(createDOMElementforDatabinders(doc, false)); doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////////////////// return doc; } /** * Writes the implementations. * * @throws Exception */ protected void writeInterfaceImplementation() throws Exception { // first check for the policies in this service and write them Document interfaceImplModel = createDOMDocumentForInterfaceImplementation(); debugLogDocument("Document for interface implementation:", interfaceImplModel); InterfaceImplementationWriter writer = new InterfaceImplementationWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); writer.setOverride(codeGenConfiguration.isOverride()); writeFile(interfaceImplModel, writer); } /** * Creates the DOM tree for implementations. */ protected Document createDOMDocumentForInterfaceImplementation() throws Exception { String packageName = codeGenConfiguration.getPackageName(); String localPart = makeJavaClassName(axisService.getName()); String stubName = makeJavaClassName(axisService.getName() + axisService.getEndpointName()) + STUB_SUFFIX; Document doc = getEmptyDocument(); Element rootElement = doc.createElement("class"); addAttribute(doc, "package", packageName, rootElement); addAttribute(doc, "servicename", localPart, rootElement); //The target nemespace is added as the namespace for this service addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "interfaceName", makeJavaClassName(axisService.getEndpointName()) + STUB_INTERFACE_SUFFIX_BACK, rootElement); addAttribute(doc, "name", makeJavaClassName(axisService.getBindingName()) + STUB_SUFFIX, rootElement); } else { if (this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "interfaceName", makeJavaClassName( axisService.getName() + axisService.getEndpointName()), rootElement); addAttribute(doc, "name", stubName, rootElement); } else { addAttribute(doc, "interfaceName", makeJavaClassName(axisService.getName()), rootElement); addAttribute(doc, "name", makeJavaClassName(axisService.getName()) + STUB_SUFFIX, rootElement); } } if (codeGenConfiguration.isPackClasses()) { if (this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "callbackname", makeJavaClassName( axisService.getName() + axisService.getEndpointName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } else { addAttribute(doc, "callbackname", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } } else { addAttribute(doc, "callbackname", localPart + CALL_BACK_HANDLER_SUFFIX, rootElement); } //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); // add the wrap classes flag if (codeGenConfiguration.isPackClasses()) { addAttribute(doc, "wrapped", "yes", rootElement); } // add SOAP version addSoapVersion(doc, rootElement); // add the end point addEndpoint(doc, rootElement); // set the sync/async attributes fillSyncAttributes(doc, rootElement); // ########################################################################################### // this block of code specifically applies to the integration of databinding code into the // generated classes tightly (probably as inner classes) // ########################################################################################### // check for the special models in the mapper and if they are present process them if (mapper.isObjectMappingPresent()) { // add an attribute to the root element showing that the writing has been skipped addAttribute(doc, "skip-write", "yes", rootElement); // process the mapper objects processModelObjects(mapper.getAllMappedObjects(), rootElement, doc); } // ############################################################################################# // load the operations loadOperations(doc, rootElement, null); // add the databind supporters. Now the databind supporters are completly contained inside // the stubs implementation and not visible outside rootElement.appendChild(createDOMElementforDatabinders(doc, false)); Object moduleCodegenPolicyExtensionElement; //if some extension has added the stub methods property, add them to the //main document if ((moduleCodegenPolicyExtensionElement = codeGenConfiguration.getProperty("module-codegen-policy-extensions")) != null) { rootElement.appendChild( doc.importNode((Element) moduleCodegenPolicyExtensionElement, true)); } //add another element to have the unique list of faults rootElement.appendChild(getUniqueListofFaults(doc)); doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////// return doc; } /** * A util method that returns a unique list of faults * * @param doc * @return DOM element */ protected Element getUniqueListofFaults(Document doc) { Element rootElement = doc.createElement("fault-list"); Element faultElement; String key; Iterator iterator = fullyQualifiedFaultClassNameMap.keySet().iterator(); while (iterator.hasNext()) { faultElement = doc.createElement("fault"); key = (String) iterator.next(); //as for the name of a fault, we generate an exception addAttribute(doc, "name", (String) fullyQualifiedFaultClassNameMap.get(key), faultElement); addAttribute(doc, "shortName", (String) faultClassNameMap.get(key), faultElement); //the type represents the type that will be wrapped by this //name String typeMapping = this.mapper.getTypeMappingName((QName) faultElementQNameMap.get(key)); addAttribute(doc, "type", (typeMapping == null) ? "" : typeMapping, faultElement); String attribValue = (String) instantiatableMessageClassNames. get(key); addAttribute(doc, "instantiatableType", attribValue == null ? "" : attribValue, faultElement); // add an extra attribute to say whether the type mapping is // the default if (mapper.getDefaultMappingName().equals(typeMapping)) { addAttribute(doc, "default", "yes", faultElement); } addAttribute(doc, "value", getParamInitializer(typeMapping), faultElement); rootElement.appendChild(faultElement); } return rootElement; } /** * add the qNames of the operation fault message names to faultMessages Mep * * @param operationFaultMessages * @param faultMessagesToMep */ protected void addFaultMessages(List operationFaultMessages, Set faultMessagesToMep) { AxisMessage faultMessage; for (Iterator iter = operationFaultMessages.iterator(); iter.hasNext();) { faultMessage = (AxisMessage) iter.next(); faultMessagesToMep.add(faultMessage.getName()); } } /** * A util method that returns a unique list of faults for a given mep * * @param doc * @return DOM element */ protected Element getUniqueListofFaultsofMep(Document doc, String mep) { // list to keep fault message qnames for this mep Set faultListForMep = new HashSet(); Iterator iter = this.axisService.getOperations(); AxisOperation axisOperation; for (; iter.hasNext();) { axisOperation = (AxisOperation) iter.next(); if (mep == null) { // add the fault messages addFaultMessages(axisOperation.getFaultMessages(), faultListForMep); } else { if (mep.equals(axisOperation.getMessageExchangePattern())) { // add the fault messages addFaultMessages(axisOperation.getFaultMessages(), faultListForMep); } } } Element rootElement = doc.createElement("fault-list"); Element faultElement; String key; Iterator iterator = faultListForMep.iterator(); while (iterator.hasNext()) { faultElement = doc.createElement("fault"); key = (String) iterator.next(); //as for the name of a fault, we generate an exception addAttribute(doc, "name", (String) fullyQualifiedFaultClassNameMap.get(key), faultElement); addAttribute(doc, "shortName", (String) faultClassNameMap.get(key), faultElement); //the type represents the type that will be wrapped by this //name String typeMapping = this.mapper.getTypeMappingName((QName) faultElementQNameMap.get(key)); addAttribute(doc, "type", (typeMapping == null) ? "" : typeMapping, faultElement); String attribValue = (String) instantiatableMessageClassNames. get(key); addAttribute(doc, "instantiatableType", attribValue == null ? "" : attribValue, faultElement); String exceptionName = ((QName) faultElementQNameMap.get(key)).getLocalPart(); addAttribute(doc, "localname", exceptionName == null ? "" : exceptionName, faultElement); // add an extra attribute to say whether the type mapping is // the default if (mapper.getDefaultMappingName().equals(typeMapping)) { addAttribute(doc, "default", "yes", faultElement); } addAttribute(doc, "value", getParamInitializer(typeMapping), faultElement); rootElement.appendChild(faultElement); } return rootElement; } /** * Adds the endpoint to the document. * * @param doc * @param rootElement */ protected void addEndpoint(Document doc, Element rootElement) throws Exception { Element endpointElement = doc.createElement("endpoint"); String endpoint = this.axisEndpoint.getEndpointURL(); Text text = doc.createTextNode((endpoint != null) ? endpoint : ""); endpointElement.appendChild(text); rootElement.appendChild(endpointElement); } /** * Looks for the SOAPVersion and adds it. * * @param doc * @param rootElement */ protected void addSoapVersion(Document doc, Element rootElement) { // loop through the extensibility elements to get to the bindings element addAttribute(doc, "soap-version", (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION), rootElement); } /** * Writes the exceptions. */ protected void writeExceptions() throws Exception { Element faultElement; String key; Iterator iterator = fullyQualifiedFaultClassNameMap.keySet().iterator(); while (iterator.hasNext()) { Document doc = getEmptyDocument(); faultElement = doc.createElement("fault"); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), faultElement); key = (String) iterator.next(); //as for the name of a fault, we generate an exception addAttribute(doc, "name", (String) faultClassNameMap.get(key), faultElement); addAttribute(doc, "shortName", (String) faultClassNameMap.get(key), faultElement); //the type represents the type that will be wrapped by this //name String typeMapping = this.mapper.getTypeMappingName((QName) faultElementQNameMap.get(key)); addAttribute(doc, "type", (typeMapping == null) ? "" : typeMapping, faultElement); String attribValue = (String) instantiatableMessageClassNames. get(key); addAttribute(doc, "instantiatableType", attribValue == null ? "" : attribValue, faultElement); // add an extra attribute to say whether the type mapping is // the default if (mapper.getDefaultMappingName().equals(typeMapping)) { addAttribute(doc, "default", "yes", faultElement); } addAttribute(doc, "value", getParamInitializer(typeMapping), faultElement); ExceptionWriter exceptionWriter = new ExceptionWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); doc.appendChild(faultElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(doc)); //////////////////////////////////////////////////////////// exceptionWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(doc, exceptionWriter); } } /** * Generates the model for the callbacks. */ protected Document createDOMDocumentForException() { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("callback"); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); addAttribute(doc, "name", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); // TODO JAXRPC mapping support should be considered here ?? this.loadOperations(doc, rootElement, null); doc.appendChild(rootElement); return doc; } /** * Writes the callback handlers. */ protected void writeCallBackHandlers() throws Exception { if (codeGenConfiguration.isAsyncOn()) { Document interfaceModel = createDOMDocumentForCallbackHandler(); debugLogDocument("Document for callback handler:", interfaceModel); CallbackHandlerWriter callbackWriter = new CallbackHandlerWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); callbackWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(interfaceModel, callbackWriter); } } /** * Generates the model for the callbacks. */ protected Document createDOMDocumentForCallbackHandler() { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("callback"); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); if (codeGenConfiguration.isPackClasses() && this.axisService.getEndpoints().size() > 1) { addAttribute(doc, "name", makeJavaClassName(axisService.getName() + axisService.getEndpointName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } else { addAttribute(doc, "name", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); } // TODO JAXRPC mapping support should be considered here ?? this.loadOperations(doc, rootElement, null); doc.appendChild(rootElement); return doc; } /** * Writes the interfaces. * * @throws Exception */ protected void writeInterface(boolean writeDatabinders) throws Exception { Document interfaceModel = createDOMDocumentForInterface(writeDatabinders); debugLogDocument("Document for interface:", interfaceModel); InterfaceWriter interfaceWriter = new InterfaceWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()), this.codeGenConfiguration.getOutputLanguage()); interfaceWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(interfaceModel, interfaceWriter); } /** * Creates the DOM tree for the interface creation. Uses the interface. */ protected Document createDOMDocumentForInterface(boolean writeDatabinders) { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("interface"); String localPart = null; if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { localPart = makeJavaClassName(axisService.getEndpointName() + STUB_INTERFACE_SUFFIX_BACK); } else { if (this.axisService.getEndpoints().size() > 1) { localPart = makeJavaClassName(axisService.getName() + axisService.getEndpointName()); } else { localPart = makeJavaClassName(axisService.getName()); } } addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); addAttribute(doc, "name", localPart, rootElement); addAttribute(doc, "callbackname", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX, rootElement); //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); fillSyncAttributes(doc, rootElement); loadOperations(doc, rootElement, null); // ########################################################################################### // this block of code specifically applies to the integration of databinding code into the // generated classes tightly (probably as inner classes) // ########################################################################################### // check for the special models in the mapper and if they are present process them if (writeDatabinders) { if (mapper.isObjectMappingPresent()) { // add an attribute to the root element showing that the writing has been skipped addAttribute(doc, "skip-write", "yes", rootElement); // process the mapper objects processModelObjects(mapper.getAllMappedObjects(), rootElement, doc); } } // ############################################################################################# doc.appendChild(rootElement); return doc; } /** * Update mapper for message receiver */ protected void updateMapperForMessageReceiver() { updateMapperClassnames(getFullyQualifiedMessageReceiverName()); } /** * @return fully qualified MR name */ protected String getFullyQualifiedMessageReceiverName() { String packageName = codeGenConfiguration.getPackageName(); String localPart = makeJavaClassName(axisService.getName()); return packageName + "." + localPart + MESSAGE_RECEIVER_SUFFIX; } /** * @return fully qualified skeleton name */ protected String getFullyQualifiedSkeletonName() { String packageName = codeGenConfiguration.getPackageName(); String localPart = makeJavaClassName(axisService.getName()); String skeltonName; if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { skeltonName = packageName + "." + makeJavaClassName(axisService.getBindingName()) + SKELETON_CLASS_SUFFIX_BACK; } else { skeltonName = packageName + "." + localPart + SKELETON_CLASS_SUFFIX; } return skeltonName; } /** * @return fully qualified skeleton interface name */ protected String getFullyQualifiedSkeletonInterfaceName() { String packageName = codeGenConfiguration.getPackageName(); String localPart = makeJavaClassName(axisService.getName()); String skeltonInterfaceName; if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { skeltonInterfaceName = packageName + "." + makeJavaClassName(axisService.getEndpointName()) + SKELETON_INTERFACE_SUFFIX_BACK; } else { skeltonInterfaceName = packageName + "." + localPart + SKELETON_INTERFACE_SUFFIX; } return skeltonInterfaceName; } /** * Emits the skeleton * * @throws CodeGenerationException */ public void emitSkeleton() throws CodeGenerationException { try { allServiceInfoHolder = new HashMap(); Map originalMap = getNewCopy(this.mapper.getAllMappedNames()); // we are going to generate following files seperately per service for (Iterator axisServicesIter = this.axisServices.iterator(); axisServicesIter.hasNext();) { // create a new hash map for each service this.infoHolder = new HashMap(); this.axisService = (AxisService) axisServicesIter.next(); this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding(); // see the comment at updateMapperClassnames for details and reasons for // calling this method if (mapper.isObjectMappingPresent()) { copyMap(originalMap, this.mapper.getAllMappedNames()); updateMapperForMessageReceiver(); } else { copyToFaultMap(); } //handle faults generateAndPopulateFaultNames(); // if (codeGenConfiguration.isServerSideInterface()) { //write skeletonInterface writeSkeletonInterface(); } // write skeleton only if the used has // asked for the deployment descriptor in the interface mode // else write it anyway :) if (codeGenConfiguration.isServerSideInterface()) { if (codeGenConfiguration.isGenerateDeployementDescriptor()) { writeSkeleton(); } } else { writeSkeleton(); } if (!codeGenConfiguration.isSkipMessageReceiver()) { // write a MessageReceiver for this particular service. writeMessageReceiver(); } // write the Exceptions writeExceptions(); if (!codeGenConfiguration.isSkipWriteWSDLs()) { //for the server side codegen //we need to serialize the WSDL's writeWSDLFiles(); } // save the info holder with the service allServiceInfoHolder.put(this.axisService.getName(),this.infoHolder); } // save back type map if (this.mapper.isObjectMappingPresent()) { copyMap(originalMap, this.mapper.getAllMappedNames()); } // write service xml // if asked if (codeGenConfiguration.isGenerateDeployementDescriptor()) { writeServiceXml(); } if (!codeGenConfiguration.isSkipBuildXML()) { //write the ant build //we skip this for the flattened case if (!codeGenConfiguration.isFlattenFiles()) { writeAntBuild(); } } } catch (CodeGenerationException cgExp) { throw cgExp; } catch (Exception e) { throw new CodeGenerationException(e); } } /** * Write out the WSDL files (and the schemas) writing the WSDL (and schemas) is somewhat special * so we cannot follow the usual pattern of using the class writer */ protected void writeWSDLFiles() { //first modify the schema names (and locations) so that //they have unique (flattened) names and the schema locations //are adjusted to suit it axisService.setCustomSchemaNamePrefix("");//prefix with nothing axisService.setCustomSchemaNameSuffix(".xsd");//suffix with .xsd - the file name extension //force the mappings to be reconstructed axisService.setSchemaLocationsAdjusted(false); //when generating the code we should copy all the schemas to // resource folder. Map changedMap = axisService.populateSchemaMappings(true); // add these two attribute to use the user defined wsdl to use. try { axisService.addParameter(new Parameter("useOriginalwsdl", "true")); axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "false")); } catch (AxisFault axisFault) { // there is no way to get this excpetion while in codegeneration } //now get the schema list and write it out SchemaWriter schemaWriter = new SchemaWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getResourceLocation())); // first write all the schmas. // then use the changedMap got above to adjust the names. Map schemaMappings = axisService.getSchemaMappingTable(); Iterator keys = schemaMappings.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); schemaWriter.writeSchema( (XmlSchema) schemaMappings.get(key), (String) key ); } //switch between the correct writer if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. equals(codeGenConfiguration.getWSDLVersion())) { // Woden cannot serialize the WSDL as yet, so lets serialize the axisService for now. WSDL20Writer wsdl20Writer = new WSDL20Writer( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getResourceLocation())); wsdl20Writer.writeWSDL(axisService); } else { // here we are going to write the wsdl and its imports // with out using the axis service. WSDL11Writer wsdl11Writer = new WSDL11Writer( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getResourceLocation())); wsdl11Writer.writeWSDL(axisService, codeGenConfiguration.getWsdlDefinition(), changedMap); } } /** * Utility method to copy the faults to the correct map */ protected void copyToFaultMap() { Map classNameMap = mapper.getAllMappedNames(); Iterator keys = classNameMap.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); instantiatableMessageClassNames.put(key, classNameMap.get(key)); } } /** * Change the fault classnames to go with the package and stub */ protected void updateFaultPackageForStub() { Iterator faultClassNameKeys = fullyQualifiedFaultClassNameMap.keySet().iterator(); while (faultClassNameKeys.hasNext()) { Object key = faultClassNameKeys.next(); String className = (String) fullyQualifiedFaultClassNameMap.get(key); //append the skelton name String fullyQualifiedStubName = getFullyQualifiedStubName(); fullyQualifiedFaultClassNameMap.put(key, codeGenConfiguration.getPackageName() + "." + className); } } /** * Writes the message receiver * * @throws Exception */ protected void writeMessageReceiver() throws Exception { //loop through the meps and generate code for each mep Iterator it = mepToClassMap.keySet().iterator(); while (it.hasNext()) { String mep = (String) it.next(); Document classModel = createDocumentForMessageReceiver( mep, codeGenConfiguration.isServerSideInterface()); debugLogDocument("Document for message receiver (mep=" + mep + "):", classModel); //write the class only if any methods are found if (Boolean.TRUE.equals(infoHolder.get(mep))) { MessageReceiverWriter writer = new MessageReceiverWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory( codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory( codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); writer.setOverride(codeGenConfiguration.isOverride()); writeFile(classModel, writer); } } } /** * Creates the XML model for the message receiver * * @param mep * @param isServerSideInterface * @return DOM Document */ protected Document createDocumentForMessageReceiver(String mep, boolean isServerSideInterface) { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("interface"); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); String localPart = makeJavaClassName(axisService.getName()); addAttribute(doc, "name", localPart + mepToSuffixMap.get(mep), rootElement); //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "skeletonname", makeJavaClassName(axisService.getBindingName()) + SKELETON_CLASS_SUFFIX_BACK, rootElement); if (isServerSideInterface) { addAttribute(doc, "skeletonInterfaceName", makeJavaClassName( axisService.getEndpointName()) + SKELETON_INTERFACE_SUFFIX_BACK, rootElement); } else { addAttribute(doc, "skeletonInterfaceName", makeJavaClassName( axisService.getBindingName()) + SKELETON_CLASS_SUFFIX_BACK, rootElement); } } else { if (this.codeGenConfiguration.getSkeltonClassName() != null){ addAttribute(doc, "skeletonname", this.codeGenConfiguration.getSkeltonClassName(), rootElement); } else { addAttribute(doc, "skeletonname", localPart + SKELETON_CLASS_SUFFIX, rootElement); } if (isServerSideInterface) { if (this.codeGenConfiguration.getSkeltonInterfaceName() != null){ addAttribute(doc, "skeletonInterfaceName", this.codeGenConfiguration.getSkeltonInterfaceName(), rootElement); } else { addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_INTERFACE_SUFFIX, rootElement); } } else { if (this.codeGenConfiguration.getSkeltonClassName() != null){ addAttribute(doc, "skeletonInterfaceName", this.codeGenConfiguration.getSkeltonClassName(), rootElement); } else { addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_CLASS_SUFFIX, rootElement); } } } addAttribute(doc, "basereceiver", (String) mepToClassMap.get(mep), rootElement); fillSyncAttributes(doc, rootElement); // ########################################################################################### // this block of code specifically applies to the integration of databinding code into the // generated classes tightly (probably as inner classes) // ########################################################################################### // check for the special models in the mapper and if they are present process them if (mapper.isObjectMappingPresent()) { // add an attribute to the root element showing that the writing has been skipped addAttribute(doc, "skip-write", "yes", rootElement); // process the mapper objects processModelObjects(mapper.getAllMappedObjects(), rootElement, doc); } // ############################################################################################# boolean isOpsFound = loadOperations(doc, rootElement, mep); //put the result in the property map infoHolder.put(mep, isOpsFound ? Boolean.TRUE : Boolean.FALSE); //create the databinder element with serverside as true rootElement.appendChild(createDOMElementforDatabinders(doc, true)); //attach a list of faults rootElement.appendChild(getUniqueListofFaultsofMep(doc, mep)); doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////////////////// return doc; } /** * create a dom element for databinders. This is called by other * * @param doc */ protected Element createDOMElementforDatabinders(Document doc, boolean isServerside) { // First Iterate through the operations and find the relevant fromOM and toOM methods to be generated ArrayList parameters = new ArrayList(); AxisOperation axisOperation = null; AxisBindingOperation axisBindingOperation = null; for (Iterator bindingOperationsIter = this.axisBinding.getChildren(); bindingOperationsIter.hasNext();) { axisBindingOperation = (AxisBindingOperation) bindingOperationsIter.next(); axisOperation = axisBindingOperation.getAxisOperation(); // Add the parameters to a map with their type as the key // this step is needed to remove repetitions // process the input parameters String MEP = axisOperation.getMessageExchangePattern(); if (WSDLUtil.isInputPresentForMEP(MEP)) { Element[] inputParamElement = getInputParamElement(doc, axisOperation); for (int i = 0; i < inputParamElement.length; i++) { //add an attribute to the parameter saying that this is an //input addAttribute(doc, "direction", "in", inputParamElement[i]); //add the short type name parameters.add( inputParamElement[i]); } } // process output parameters if (WSDLUtil.isOutputPresentForMEP(MEP)) { Element outputParamElement = getOutputParamElement(doc, axisOperation); if (outputParamElement != null) { //set the direction as out addAttribute(doc, "direction", "out", outputParamElement); parameters.add(outputParamElement); } } //process faults Element[] faultParamElements = getFaultParamElements(doc, axisOperation); for (int i = 0; i < faultParamElements.length; i++) { //set the direction as out - all faults are out messages ? addAttribute(doc, "direction", "out", faultParamElements[i]); parameters.add(faultParamElements[i]); } // process the header parameters Element newChild; List headerParameterQNameList = new ArrayList(); addHeaderOperations(headerParameterQNameList, axisBindingOperation, true); List parameterElementList = getParameterElementList(doc, headerParameterQNameList, WSDLConstants.SOAP_HEADER); for (int i = 0; i < parameterElementList.size(); i++) { newChild = (Element) parameterElementList.get(i); parameters.add(newChild); } headerParameterQNameList.clear(); parameterElementList.clear(); addHeaderOperations(headerParameterQNameList, axisBindingOperation, false); parameterElementList = getParameterElementList(doc, headerParameterQNameList, WSDLConstants.SOAP_HEADER); for (int i = 0; i < parameterElementList.size(); i++) { newChild = (Element) parameterElementList.get(i); parameters.add(newChild); } } Element rootElement = doc.createElement("databinders"); //add the db type attribute - the name of the databinding type //this will be used to select the correct template addAttribute(doc, "dbtype", codeGenConfiguration.getDatabindingType(), rootElement); //add the wrapped flag state - this is used by JiBX, but may be useful //for other frameworks in the future String wrapflag = Boolean.toString(codeGenConfiguration.isParametersWrapped()); addAttribute(doc, "wrapped", wrapflag, rootElement); //at this point we may need to capture the extra parameters passes to the //particular databinding framework //these parameters showup in the property map with String keys, and we //can just copy these items as attributes of the element. Element extraElement = addElement(doc, "extra", null, rootElement); Map propertiesMap = codeGenConfiguration.getProperties(); for (Iterator it = propertiesMap.keySet().iterator(); it.hasNext();) { Object key = it.next(); if (key instanceof String) { Object value = propertiesMap.get(key); //if the value is null set it to empty string if (value == null) value = ""; //add key="value" attribute to element iff value a string if (value instanceof String) { addAttribute(doc, (String) key, (String) value, extraElement); } } } //add the server side attribute. this helps the databinding template //to determine the methods to generate if (isServerside) { addAttribute(doc, "isserverside", "yes", rootElement); } // add the names of the elements that have base 64 content // if the base64 name list is missing then this whole step is skipped rootElement.appendChild(getBase64Elements(doc)); //add the method names rootElement.appendChild(getOpNames(doc)); for (Iterator iterator = parameters.iterator(); iterator.hasNext();) { rootElement.appendChild((Element) iterator.next()); } // finish with any extra information from service and operations Parameter details = axisService.getParameter(Constants.DATABINDING_SERVICE_DETAILS); if (details != null) { Object value = details.getValue(); if (value instanceof Element) { rootElement.appendChild(doc.importNode((Element) value, true)); } else if (value instanceof List) { for (Iterator iter = ((List) value).iterator(); iter.hasNext();) { rootElement.appendChild(doc.importNode((Element) iter.next(), true)); } } } axisOperation = null; for (Iterator operationsIterator = axisService.getOperations(); operationsIterator.hasNext();) { axisOperation = (AxisOperation) operationsIterator.next(); details = axisOperation.getParameter(Constants.DATABINDING_OPERATION_DETAILS); if (details != null) { rootElement.appendChild(doc.importNode((Element) details.getValue(), true)); } } /////////////////////////////////////////////// // System.out.println("databinding root element " + DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////// return rootElement; } /** * set the short type as it is in the data binding * * @param paramElement * @param xmlName */ protected void addShortType(Element paramElement, String xmlName) { if (xmlName != null) { String javaName; if (JavaUtils.isJavaKeyword(xmlName)) { javaName = JavaUtils.makeNonJavaKeyword(xmlName); } else { javaName = JavaUtils.capitalizeFirstChar(JavaUtils .xmlNameToJava(xmlName)); } addAttribute(paramElement.getOwnerDocument(), "shorttype", javaName, paramElement); } else { addAttribute(paramElement.getOwnerDocument(), "shorttype", "", paramElement); } } /** * Gets an element representing the operation names * * @param doc * @return Returns Element. */ protected Element getOpNames(Document doc) { Element root = doc.createElement("opnames"); Element elt; for (Iterator operationsIterator = axisService.getOperations(); operationsIterator.hasNext();) { AxisOperation axisOperation = (AxisOperation) operationsIterator.next(); elt = doc.createElement("name"); String localPart = axisOperation.getName().getLocalPart(); elt.appendChild(doc.createTextNode(JavaUtils.xmlNameToJava(localPart))); //what needs to be put here as the opertation namespace is actually the //traget namespace of the service addAttribute(doc, "opnsuri", axisService.getTargetNamespace(), elt); root.appendChild(elt); } return root; } /** * Gets the base64 types. If not available this will be empty!!! * * @param doc * @return Returns Element. */ protected Element getBase64Elements(Document doc) { Element root = doc.createElement("base64Elements"); Element elt; QName qname; // this is a list of QNames List list = (List) codeGenConfiguration.getProperties().get(Constants.BASE_64_PROPERTY_KEY); if ((list != null) && !list.isEmpty()) { int count = list.size(); for (int i = 0; i < count; i++) { qname = (QName) list.get(i); elt = doc.createElement("name"); addAttribute(doc, "ns-url", qname.getNamespaceURI(), elt); addAttribute(doc, "localName", qname.getLocalPart(), elt); root.appendChild(elt); } } return root; } /** * @param objectMappings * @param root * @param doc */ protected void processModelObjects(Map objectMappings, Element root, Document doc) { Iterator objectIterator = objectMappings.values().iterator(); while (objectIterator.hasNext()) { Object o = objectIterator.next(); if (o instanceof Document) { //we cannot have an empty document root.appendChild(doc.importNode(((Document) o).getDocumentElement(), true)); } else { // oops we have no idea how to do this, if the model provided is not a DOM document // we are done. we might as well skip it here } } } /** * we need to modify the mapper's class name list. The issue here is that in this case we do not * expect the fully qulified class names to be present in the class names list due to the simple * reason that they've not been written yet! Hence the mappers class name list needs to be * updated to suit the expected package to be written in this case we modify the package name to * have the class a inner class of the stub, interface or the message receiver depending on the * style */ protected void updateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix) { Map classNameMap = mapper.getAllMappedNames(); Iterator keys = classNameMap.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); String className = (String) classNameMap.get(key); String realClassName = className; if (className.endsWith("[]")){ realClassName = realClassName.substring(0,realClassName.indexOf("[]")); } //this is a generated class name - update the name if (!TypeTesterUtil.hasPackage(realClassName) && !TypeTesterUtil.isPrimitive(realClassName)) { classNameMap.put(key, fullyQulifiedIncludingClassNamePrefix + "." + className); instantiatableMessageClassNames.put(key, fullyQulifiedIncludingClassNamePrefix + "$" + className); } else { //this is a fully qualified class name - just leave it as it is classNameMap.put(key, className); instantiatableMessageClassNames.put(key, className); } } } /** * Write the service XML * * @throws Exception */ protected void writeServiceXml() throws Exception { // Write the service xml in a folder with the Document serviceXMLModel = createDOMDocumentForServiceXML(); debugLogDocument("Document for service XML:", serviceXMLModel); FileWriter serviceXmlWriter = new ServiceXMLWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getResourceLocation()), this.codeGenConfiguration.getOutputLanguage()); serviceXmlWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(serviceXMLModel, serviceXmlWriter); codeGenConfiguration.addXmlFileName(serviceXmlWriter.getOutputFile().getAbsolutePath());//$NON-SEC-3 } protected Document createDOMDocumentForServiceXML() { Document doc = getEmptyDocument(); String className = null; String serviceName = null; Element rootElement = doc.createElement("interfaces"); doc.appendChild(rootElement); for (Iterator iter = this.axisServices.iterator(); iter.hasNext();) { this.axisService = (AxisService) iter.next(); this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding(); serviceName = axisService.getName(); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { className = makeJavaClassName(axisService.getBindingName()); } else { className = makeJavaClassName(serviceName); } rootElement.appendChild(getServiceElement(serviceName, className, doc)); } return doc; } /** * A resusable method to return the service element for creating the service xml * * @param serviceName * @param className * @param doc * @return DOM Element */ protected Element getServiceElement(String serviceName, String className, Document doc) { if (allServiceInfoHolder.get(serviceName) != null){ this.infoHolder = (Map) allServiceInfoHolder.get(serviceName); } Element rootElement = doc.createElement("interface"); addAttribute(doc, "package", "", rootElement); addAttribute(doc, "classpackage", codeGenConfiguration.getPackageName(), rootElement); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "name", className + SKELETON_CLASS_SUFFIX_BACK, rootElement); } else { addAttribute(doc, "name", className + SKELETON_CLASS_SUFFIX, rootElement); } if (!codeGenConfiguration.isWriteTestCase()) { addAttribute(doc, "testOmit", "true", rootElement); } addAttribute(doc, "servicename", serviceName, rootElement); Iterator it = mepToClassMap.keySet().iterator(); while (it.hasNext()) { Object key = it.next(); if (Boolean.TRUE.equals(infoHolder.get(key))) { Element elt = addElement(doc, "messagereceiver", makeJavaClassName(serviceName) + mepToSuffixMap.get(key), rootElement); addAttribute(doc, "mepURI", key.toString(), elt); } } loadOperations(doc, rootElement, null); return rootElement; } protected void writeSkeleton() throws Exception { Document skeletonModel = createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface()); debugLogDocument("Document for skeleton:", skeletonModel); FileWriter skeletonWriter = new SkeletonWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()) , this.codeGenConfiguration.getOutputLanguage()); skeletonWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(skeletonModel, skeletonWriter); } /** * Write the skeletonInterface * * @throws Exception */ protected void writeSkeletonInterface() throws Exception { Document skeletonModel = createDOMDocumentForSkeletonInterface(); debugLogDocument("Document for skeleton Interface:", skeletonModel); FileWriter skeletonInterfaceWriter = new SkeletonInterfaceWriter( codeGenConfiguration.isFlattenFiles() ? getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) : getOutputDirectory(codeGenConfiguration.getOutputLocation(), codeGenConfiguration.getSourceLocation()) , this.codeGenConfiguration.getOutputLanguage()); skeletonInterfaceWriter.setOverride(codeGenConfiguration.isOverride()); writeFile(skeletonModel, skeletonInterfaceWriter); } /** * Creates the XMLModel for the skeleton * * @param isSkeletonInterface * @return DOM Document */ protected Document createDOMDocumentForSkeleton(boolean isSkeletonInterface) { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("interface"); String serviceName = makeJavaClassName(axisService.getName()); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "name", makeJavaClassName(axisService.getBindingName()) + SKELETON_CLASS_SUFFIX_BACK, rootElement); } else if (this.codeGenConfiguration.getSkeltonClassName() != null){ addAttribute(doc, "name", this.codeGenConfiguration.getSkeltonClassName(), rootElement); } else { addAttribute(doc, "name", serviceName + SKELETON_CLASS_SUFFIX, rootElement); } addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX, rootElement); //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); if (isSkeletonInterface) { if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "skeletonInterfaceName", makeJavaClassName( axisService.getEndpointName()) + SKELETON_INTERFACE_SUFFIX_BACK, rootElement); } else if (this.codeGenConfiguration.getSkeltonInterfaceName() != null){ addAttribute(doc, "skeletonInterfaceName", this.codeGenConfiguration.getSkeltonInterfaceName(), rootElement); } else { addAttribute(doc, "skeletonInterfaceName", serviceName + SKELETON_INTERFACE_SUFFIX, rootElement); } } fillSyncAttributes(doc, rootElement); loadOperations(doc, rootElement, null); //attach a list of faults rootElement.appendChild(getUniqueListofFaults(doc)); doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////////////////// return doc; } /** * Creates the XML model for the skeleton interface * * @return DOM Document */ protected Document createDOMDocumentForSkeletonInterface() { Document doc = getEmptyDocument(); Element rootElement = doc.createElement("interface"); String serviceName = makeJavaClassName(axisService.getName()); addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement); if (this.codeGenConfiguration.isBackwordCompatibilityMode()) { addAttribute(doc, "name", makeJavaClassName(axisService.getEndpointName()) + SKELETON_INTERFACE_SUFFIX_BACK, rootElement); } else if (this.codeGenConfiguration.getSkeltonInterfaceName() != null){ addAttribute(doc, "name", this.codeGenConfiguration.getSkeltonInterfaceName() , rootElement); } else { addAttribute(doc, "name", serviceName + SKELETON_INTERFACE_SUFFIX, rootElement); } addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX, rootElement); //add backwordcompatibility attribute addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()), rootElement); fillSyncAttributes(doc, rootElement); loadOperations(doc, rootElement, null); //attach a list of faults rootElement.appendChild(getUniqueListofFaults(doc)); doc.appendChild(rootElement); ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElement)); //////////////////////////////////////////////////////////// return doc; } /** * Loads the operations * * @param doc * @param rootElement * @param mep * @return boolean */ protected boolean loadOperations(Document doc, Element rootElement, String mep) { Element methodElement; String serviceName = makeJavaClassName(axisService.getName()); Iterator bindingOperations = this.axisBinding.getChildren(); boolean opsFound = false; AxisBindingOperation axisBindingOperation = null; AxisOperation axisOperation = null; while (bindingOperations.hasNext()) { axisBindingOperation = (AxisBindingOperation) bindingOperations.next(); axisOperation = axisBindingOperation.getAxisOperation(); // populate info holder with mep information. This will used in determining which // message receiver to use, etc., String messageExchangePattern = axisOperation.getMessageExchangePattern(); if (infoHolder.get(messageExchangePattern) == null) { infoHolder.put(messageExchangePattern, Boolean.TRUE); } if (mep == null) { opsFound = true; methodElement = generateMethodElement(doc, serviceName, axisBindingOperation); rootElement.appendChild(methodElement); } else { //mep is present - we move ahead only if the given mep matches the mep of this operation if (mep.equals(axisOperation.getMessageExchangePattern())) { //at this point we know it's true opsFound = true; methodElement = generateMethodElement(doc, serviceName, axisBindingOperation); rootElement.appendChild(methodElement); ////////////////////// } } } return opsFound; } /** * Common code to generate a element from an operation. * * @param doc * @param endpointName * @param bindingOperation * @return generated element * @throws DOMException */ protected Element generateMethodElement(Document doc, String endpointName, AxisBindingOperation bindingOperation) throws DOMException { AxisOperation axisOperation = bindingOperation.getAxisOperation(); Element methodElement; List soapHeaderInputParameterList = new ArrayList(); List soapHeaderOutputParameterList = new ArrayList(); methodElement = doc.createElement("method"); String localPart = axisOperation.getName().getLocalPart(); addAttribute(doc, "name", JavaUtils.xmlNameToJava(localPart), methodElement); addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement); addAttribute(doc, "style", (String) getBindingPropertyFromOperation( WSDLConstants.WSDL_1_1_STYLE, axisOperation.getName()), methodElement); // add documentation for this operation String comment = ""; if (axisOperation.getDocumentation() != null){ comment = axisOperation.getDocumentation().trim(); } addAttribute(doc, "comment", comment, methodElement); String messageExchangePattern = axisOperation.getMessageExchangePattern(); //Jaxws Specific if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){ boolean wrapped = false; if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) { AxisMessage msg = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if(msg.getParameter(Constants.UNWRAPPED_KEY) != null){ wrapped = true; } } addAttribute(doc, "parameterstyle", (wrapped)?"WRAPPPED":"BARE", methodElement); } addAttribute(doc, "dbsupportname", endpointName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX, methodElement); addAttribute(doc, "mep", Utils.getAxisSpecifMEPConstant(messageExchangePattern) + "", methodElement); addAttribute(doc, "mepURI", messageExchangePattern, methodElement); Parameter wsdl2StyleParameter = axisOperation.getParameter(WSDL2Constants.OPERATION_STYLE); if (wsdl2StyleParameter != null) { // provide WSDL2 styles to allow templates to take advantage of them, if desired addAttribute(doc, "wsdl2Styles", arrayToString((URI[])wsdl2StyleParameter.getValue()), methodElement); } // check for this operation to be handled directly by databinding code generation Parameter dbmethname = axisOperation.getParameter(Constants.DATABINDING_GENERATED_RECEIVER); if (dbmethname != null) { addAttribute(doc, "usedbmethod", (String) dbmethname.getValue(), methodElement); } Parameter dbgenimpl = axisOperation.getParameter(Constants.DATABINDING_GENERATED_IMPLEMENTATION); if (dbgenimpl != null && Boolean.TRUE.equals(dbgenimpl.getValue())) { addAttribute(doc, "usdbimpl", "true", methodElement); } else { addAttribute(doc, "usdbimpl", "false", methodElement); } addSOAPAction(doc, methodElement, bindingOperation.getName()); addOutputAndFaultActions(doc, methodElement, axisOperation); addHeaderOperations(soapHeaderInputParameterList, bindingOperation, true); // addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false); if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) { if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){ useHolderClass_jaxws = false; AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) { AxisMessage outMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if(inMessage.getName().equals(outMessage.getName())){ // in/out message useHolderClass_jaxws = true; addAttribute(doc, "useholder", "true", methodElement); } } } methodElement.appendChild(getInputElement(doc, bindingOperation, soapHeaderInputParameterList)); } if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) { methodElement.appendChild(getOutputElement(doc, bindingOperation, soapHeaderOutputParameterList)); } methodElement.appendChild(getFaultElement(doc, axisOperation)); setTransferCoding(axisOperation, methodElement, doc); String property = (String) getBindingPropertyFromOperation( WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, axisOperation.getName()); if (property != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR", "\"" + property + "\"")); } property = (String) getBindingPropertyFromOperation( WSDL2Constants.ATTR_WHTTP_LOCATION, axisOperation.getName()); if (property != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_LOCATION", "\"" + property + "\"")); } String mep = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WSOAP_MEP, axisOperation.getName()); String bindingType = null; if (axisBinding != null) { bindingType = axisBinding.getType(); } if (WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.ENABLE_REST", "true")); methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.HTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration .HTTP_METHOD_GET + "\"")); methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.CONTENT_TYPE", "\"" + org.apache.axis2.transport.http.HTTPConstants .MEDIA_TYPE_X_WWW_FORM + "\"")); methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.MESSAGE_TYPE", "\"" + org.apache.axis2.transport.http.HTTPConstants .MEDIA_TYPE_X_WWW_FORM + "\"")); methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.SOAP_RESPONSE_MEP", "true")); } else if (bindingType != null && bindingType.equals(WSDL2Constants.URI_WSDL2_HTTP)) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.ENABLE_REST", "true")); property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_METHOD, axisOperation.getName()); if (property != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.HTTP_METHOD", "\"" + property + "\"")); } else if (!WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) { // If there is no WHTTP_METHOD defined then we better compute the default value which is get if the operation // is wsdlx:safe or post otherwise Parameter safe = axisOperation.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE); if (safe != null) { if (((Boolean) safe.getValue()).booleanValue()) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.HTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration .HTTP_METHOD_GET + "\"")); } else { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.HTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration .HTTP_METHOD_POST + "\"")); } } } Boolean value = (Boolean) getBindingPropertyFromOperation( WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, axisOperation.getName()); if (value != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED", "\"" + value.booleanValue() + "\"")); } property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_CODE, axisOperation.getName()); if (property != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_CODE", "\"" + property + "\"")); } property = (String) getBindingPropertyFromOperation( WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION, axisOperation.getName()); if (property != null) { methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.CONTENT_TYPE", "\"" + property + "\"")); methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.MESSAGE_TYPE", "\"" + property + "\"")); } } return methodElement; } /** * Returns a comma-separated list of the string representations of the array elements. * @param array the array to be processed * @return the empty string "" if array is null or empty, the array element if size is 1, * or a comma-separated list when size > 1. */ private String arrayToString(Object[] array) { if (array == null || array.length == 0) { return ""; } int size = array.length; if (size == 1) { return String.valueOf(array[0]); } StringBuffer result = new StringBuffer(String.valueOf(array[0])); for (int i=1; i 'root' can be used to distinguish serialization roots from other elements that are present in a serialization but are not roots of a serialized value graph Attributes common to all elements that function as accessors or represent independent (multi-ref) values. The href attribute is intended to be used in a manner like CONREF. That is, the element content should be empty iff the href attribute appears 'Array' is a complex type for accessors identified by position ./src/org/apache/axis2/wsdl/codegen/schema/exception/0000775000175000017500000000000011767656530021645 5ustar brianbrian./src/org/apache/axis2/wsdl/codegen/schema/exception/DummySchemaGenerationException.java0000664000175000017500000000240011767656530030613 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema.exception; public class DummySchemaGenerationException extends Exception { public DummySchemaGenerationException() { } public DummySchemaGenerationException(String message) { super(message); } public DummySchemaGenerationException(String message, Throwable cause) { super(message, cause); } public DummySchemaGenerationException(Throwable cause) { super(cause); } } ./src/org/apache/axis2/wsdl/codegen/schema/TopElement.java0000664000175000017500000000354211767656530022572 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; import javax.xml.namespace.QName; /** * this class is used to represent the top element * details of the schema */ public class TopElement { private QName elementQName; private QName typeQName; public TopElement() { } public TopElement(QName elementQName) { this.elementQName = elementQName; } public QName getElementQName() { return elementQName; } public void setElementQName(QName elementQName) { this.elementQName = elementQName; } public QName getTypeQName() { return typeQName; } public void setTypeQName(QName typeQName) { this.typeQName = typeQName; } /** * top elements should have a unique name * @param obj * @return whether two objects are equal or not */ public boolean equals(Object obj) { boolean isEqual = false; if (obj instanceof TopElement){ isEqual = ((TopElement)obj).getElementQName().equals(this.elementQName); } return isEqual; } } ./src/org/apache/axis2/wsdl/codegen/schema/NamespacePrefix.java0000664000175000017500000000177711767656530023600 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; /** * provide namesapce prefixes */ public class NamespacePrefix { private int i = 0; public String getNextNamespacePrefix(){ return "ns" + i++; } } ./src/org/apache/axis2/wsdl/codegen/schema/XmlElement.java0000664000175000017500000000546411767656530022575 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; import org.apache.axis2.namespace.Constants; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import java.util.Map; /** * this class represents an xml element */ public class XmlElement { private String namespace; private String name; private QName type; public Element getSchemaElement(Document document, Map namespacePrefixMap) { Element element = document.createElementNS(Constants.URI_2001_SCHEMA_XSD, "xsd:element"); element.setPrefix("xsd"); element.setAttribute("name", this.name); if (this.type == null) { // this is an annnimous complex type element Element complextTypeElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD, "xsd:complexType"); complextTypeElement.setPrefix("xsd"); Element sequenceElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD, "xsd:sequence"); sequenceElement.setPrefix("xsd"); complextTypeElement.appendChild(sequenceElement); element.appendChild(complextTypeElement); } else if (Constants.URI_2001_SCHEMA_XSD.equals(this.type.getNamespaceURI())) { // this is a standard type element.setAttribute("type", "xsd:" + this.type.getLocalPart()); } else { // this element points to an complex type String prefix = (String) namespacePrefixMap.get(this.type.getNamespaceURI()); element.setAttribute("type", prefix + ":" + this.type.getLocalPart()); } return element; } public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } public String getName() { return name; } public void setName(String name) { this.name = name; } public QName getType() { return type; } public void setType(QName type) { this.type = type; } } ./src/org/apache/axis2/wsdl/codegen/schema/XmlComplexType.java0000664000175000017500000000354211767656530023450 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; import org.apache.axis2.namespace.Constants; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * this class represents an xml complex type * */ public class XmlComplexType { private String namespace; private String name; public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Element getSchemaElement(Document document){ Element complexElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD,"xsd:complexType"); complexElement.setPrefix("xsd"); complexElement.setAttribute("name", this.name); Element sequenceElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD, "xsd:sequence"); sequenceElement.setPrefix("xsd"); complexElement.appendChild(sequenceElement); return complexElement; } } ./src/org/apache/axis2/wsdl/codegen/schema/xmime.xsd0000664000175000017500000000322011767656530021503 0ustar brianbrian ./src/org/apache/axis2/wsdl/codegen/schema/XmlImport.java0000664000175000017500000000305011767656530022443 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; import org.apache.axis2.namespace.Constants; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * this class represents an xml schema import */ public class XmlImport { private String targetNamespace; public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } public Element getXmlSchemaElement(Document document){ Element importElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD,"xsd:import"); importElement.setPrefix("xsd"); importElement.setAttribute("namespace",this.targetNamespace); return importElement; } } ./src/org/apache/axis2/wsdl/codegen/schema/XmlSchema.java0000664000175000017500000001273511767656530022403 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.schema; import org.apache.axis2.namespace.Constants; import org.w3c.dom.Document; import org.w3c.dom.Element; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * this class represents and schema object. * it is assumed that we consider the xsd schemaa * as the defualt name space. * */ public class XmlSchema { public static final String XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/"; private Map namespacesPrefixMap; private Map imports; private Map elements; private Map complexTypes; private String targetNamespace; public XmlSchema() { this.namespacesPrefixMap = new HashMap(); this.imports = new HashMap(); this.elements = new HashMap(); this.complexTypes = new HashMap(); } public XmlSchema(String targetNamespace) { this(); this.targetNamespace = targetNamespace; // add the target namespace to namespace prifix map this.namespacesPrefixMap.put(this.targetNamespace,"tns"); this.namespacesPrefixMap.put(Constants.URI_2001_SCHEMA_XSD,"xsd"); } public void addNamespace(String namespace,String prefix){ this.namespacesPrefixMap.put(namespace,prefix); } public void addImport(XmlImport xmlImport){ this.imports.put(xmlImport.getTargetNamespace(),xmlImport); } public boolean isExists(XmlImport xmlImport){ return this.imports.containsKey(xmlImport.getTargetNamespace()); } public void addElement(XmlElement xmlElement){ this.elements.put(xmlElement.getName(),xmlElement); } public boolean isExists(XmlElement xmlElement){ return this.elements.containsKey(xmlElement.getName()); } public boolean isElementExists(String name){ return this.elements.containsKey(name); } public void addComplexType(XmlComplexType xmlComplexType){ this.complexTypes.put(xmlComplexType.getName(),xmlComplexType); } public boolean isExists(XmlComplexType xmlComplexType){ return this.complexTypes.containsKey(xmlComplexType.getName()); } public boolean isComplexTypeExists(String nameComplexType){ return this.complexTypes.containsKey(nameComplexType); } public Element getSchemaElement(Document document){ Element schemaElement = document.createElementNS(Constants.URI_2001_SCHEMA_XSD,"xsd:schema"); schemaElement.setPrefix("xsd"); // set target namesapce schemaElement.setAttribute("targetNamespace", this.targetNamespace); // register namesapce prefixes String namespace; String prefix; for (Iterator iter = this.namespacesPrefixMap.keySet().iterator(); iter.hasNext();){ namespace = (String) iter.next(); prefix = (String) this.namespacesPrefixMap.get(namespace); schemaElement.setAttributeNS(XMLNS_NAMESPACE_URI,"xmlns:" + prefix,namespace); } // adding imports XmlImport xmlImport; for (Iterator iter = this.imports.values().iterator();iter.hasNext();){ xmlImport = (XmlImport) iter.next(); schemaElement.appendChild(xmlImport.getXmlSchemaElement(document)); } // adding elements XmlElement xmlElement; for (Iterator iter = this.elements.values().iterator();iter.hasNext();){ xmlElement = (XmlElement) iter.next(); schemaElement.appendChild(xmlElement.getSchemaElement(document, this.namespacesPrefixMap)); } // adding complex types XmlComplexType xmlComplexType; for (Iterator iter = this.complexTypes.values().iterator();iter.hasNext();){ xmlComplexType = (XmlComplexType) iter.next(); schemaElement.appendChild(xmlComplexType.getSchemaElement(document)); } return schemaElement; } public Map getNamespacesPrefixMap() { return namespacesPrefixMap; } public void setNamespacesPrefixMap(Map namespacesPrefixMap) { this.namespacesPrefixMap = namespacesPrefixMap; } public Map getImports() { return imports; } public void setImports(Map imports) { this.imports = imports; } public Map getElements() { return elements; } public void setElements(Map elements) { this.elements = elements; } public Map getComplexTypes() { return complexTypes; } public void setComplexTypes(Map complexTypes) { this.complexTypes = complexTypes; } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } } ./src/org/apache/axis2/wsdl/codegen/extension/0000775000175000017500000000000011767656530020423 5ustar brianbrian./src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java0000664000175000017500000001471711767656530024154 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.description.AxisService; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.InputStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class JAXBRIExtension extends AbstractDBProcessingExtension { public static final String SCHEMA_FOLDER = "schemas"; public static String MAPPINGS = "mappings"; public static String MAPPING = "mapping"; public static String MESSAGE = "message"; public static String JAVA_NAME = "javaclass"; public static final String MAPPING_FOLDER = "Mapping"; public static final String MAPPER_FILE_NAME = "mapper"; public static final String SCHEMA_PATH = "/org/apache/axis2/wsdl/codegen/schema/"; public static final String JAXB_RI_API_CLASS = "javax.xml.bind.JAXBContext"; public static final String JAXB_RI_IMPL_CLASS = "com.sun.xml.bind.Util"; public static final String JAXB_RI_XJC_CLASS = "com.sun.tools.xjc.api.XJC"; public static final String JAXB_RI_UTILITY_CLASS = "org.apache.axis2.jaxbri.CodeGenerationUtility"; public static final String JAXB_RI_PROCESS_METHOD = "processSchemas"; public void engage(CodeGenConfiguration configuration) { //test the databinding type. If not just fall through if (testFallThrough(configuration.getDatabindingType())) { return; } try { // try dummy load of framework classes first to check missing jars try { ClassLoader cl = getClass().getClassLoader(); cl.loadClass(JAXB_RI_API_CLASS); cl.loadClass(JAXB_RI_IMPL_CLASS); cl.loadClass(JAXB_RI_XJC_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("JAX-B RI JARs not on classpath"); } // load the actual utility class Class clazz = null; try { clazz = JAXBRIExtension.class.getClassLoader().loadClass(JAXB_RI_UTILITY_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("JAX-B RI binding extension not in classpath"); } // invoke utility class method for actual processing Method method = clazz.getMethod(JAXB_RI_PROCESS_METHOD, new Class[] { List.class, Element[].class, CodeGenConfiguration.class }); List schemas = new ArrayList(); List axisServices = configuration.getAxisServices(); AxisService axisService = null; for (Iterator iter = axisServices.iterator(); iter.hasNext();) { axisService = (AxisService)iter.next(); schemas.addAll(axisService.getSchema()); } Element[] additionalSchemas = loadAdditionalSchemas(); TypeMapper mapper = (TypeMapper)method.invoke(null, new Object[] { schemas, additionalSchemas, configuration }); // set the type mapper to the config configuration.setTypeMapper(mapper); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException)e; } else { throw new RuntimeException(e); } } } /** * Loading the external schemas. * * @return element array consisting of the the DOM element objects that represent schemas */ private Element[] loadAdditionalSchemas() { //load additional schemas String[] schemaNames = ConfigPropertyFileLoader.getThirdPartySchemaNames(); Element[] schemaElements; try { ArrayList additionalSchemaElements = new ArrayList(); DocumentBuilder documentBuilder = getNamespaceAwareDocumentBuilder(); for (int i = 0; i < schemaNames.length; i++) { //the location for the third party schema;s is hardcoded if (!"".equals(schemaNames[i].trim())) { InputStream schemaStream = this.getClass().getResourceAsStream(SCHEMA_PATH + schemaNames[i]); Document doc = documentBuilder.parse(schemaStream); additionalSchemaElements.add(doc.getDocumentElement()); } } //Create the Schema element array schemaElements = new Element[additionalSchemaElements.size()]; for (int i = 0; i < additionalSchemaElements.size(); i++) { schemaElements[i] = (Element)additionalSchemaElements.get(i); } } catch (Exception e) { throw new RuntimeException( CodegenMessages.getMessage("extension.additionalSchemaFailure"), e); } return schemaElements; } private DocumentBuilder getNamespaceAwareDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); return documentBuilderFactory.newDocumentBuilder(); } } ./src/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.java0000664000175000017500000000425711767656530026630 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.util.PrettyPrinter; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import java.io.File; public class JavaPrettyPrinterExtension extends AbstractPrettyPrinterExtension { public JavaPrettyPrinterExtension() { /* * If the extension for property file changes it might effect this as * well !!! */ fileExtension = ".java"; } /** * Recursive procedure to prettify the files * * @param file */ protected void prettify(File file, CodeGenConfiguration configuration) { if (file.isFile() && file.exists() && file.getName().toLowerCase().endsWith(fileExtension)) { prettifyFile(file); } else if (file.isDirectory()) { File[] childFiles = file.listFiles(); for (int i = 0; i < childFiles.length; i++) { prettify(childFiles[i], configuration); } } } /** * Overridden to call the java pretty printer * * @param file */ protected void prettifyFile(File file) { // Special case jaxbri generated package-info.java // as jalopy corrupts the package level annotations if (file.getName().equals("package-info.java")) { return; } PrettyPrinter.prettify(file); } } ./src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java0000664000175000017500000004715411767656530026302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.apache.axis2.wsdl.util.Constants; import org.apache.axis2.wsdl.util.MessagePartInformationHolder; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAll; import org.apache.ws.commons.schema.XmlSchemaAny; import org.apache.ws.commons.schema.XmlSchemaAttribute; import org.apache.ws.commons.schema.XmlSchemaChoice; import org.apache.ws.commons.schema.XmlSchemaComplexContent; import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaContent; import org.apache.ws.commons.schema.XmlSchemaContentModel; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.apache.ws.commons.schema.XmlSchemaType; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; /** * This extension invokes the schema unwrapper depending on the users setting. it is desirable to * put this extension before other extensions since extnsions such as the databinding extension may * well depend on the schema being unwrapped previously. For a complete unwrap the following format * of the schema is expected < element > < complexType > < sequence > < element * /> < /sequence > < /complexType > < /element > *

        * When an unwrapped WSDL is encountered Axis2 generates a wrapper schema and that wrapper schema * has the above mentioned format. This unwrapping algorithm will work on a pure doc/lit WSDL if it * has the above mentioned format only */ public class SchemaUnwrapperExtension extends AbstractCodeGenerationExtension { private CodeGenConfiguration codeGenConfiguration; /** * @param configuration * @throws CodeGenerationException */ public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { this.codeGenConfiguration = configuration; if (!configuration.isParametersWrapped() && !codeGenConfiguration.getOutputLanguage().equals("jax-ws")) { // A check to avoid nasty surprises - Since unwrapping is not // supported by all frameworks, we check the framework name to be // compatible if (!ConfigPropertyFileLoader.getUnwrapSupportedFrameworkNames(). contains(configuration.getDatabindingType())) { throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedforunwrapping")); } else if (!ConfigPropertyFileLoader.getUnwrapDirectFrameworkNames(). contains(configuration.getDatabindingType())) { //walk the schema and find the top level elements List services = configuration.getAxisServices(); AxisService axisService; for (Iterator servicesIter = services.iterator(); servicesIter.hasNext();) { axisService = (AxisService) servicesIter.next(); for (Iterator operations = axisService.getOperations(); operations.hasNext();) { AxisOperation op = (AxisOperation) operations.next(); if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) { walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), WSDLConstants.INPUT_PART_QNAME_SUFFIX); } // get the out put parameter details as well to unwrap the responses //TODO: support xmlbeans if (configuration.getDatabindingType().equals("adb")) { if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) { walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), WSDLConstants.OUTPUT_PART_QNAME_SUFFIX); } } } } } } } /** * walk the given schema element For a successful unwrapping the element should have the * following structure < element > < complexType > < sequence > < element * /> < /sequence > < /complexType > < /element > */ public void walkSchema(AxisMessage message, String qnameSuffix) throws CodeGenerationException { //nothing to unwrap if (message.getSchemaElement() == null) { return; } List partNameList = new LinkedList(); XmlSchemaElement schemaElement = message.getSchemaElement(); XmlSchemaType schemaType = schemaElement.getSchemaType(); QName schemaTypeQname = schemaElement.getSchemaTypeName(); if (schemaType == null) { if (schemaTypeQname != null) { // find the schema type from all the schemas // now we need to get the schema of the extension type from the parent schema. For that let's first retrieve // the parent schema AxisService axisService = message.getAxisOperation().getAxisService(); ArrayList schemasList = axisService.getSchema(); XmlSchema schema = null; for (Iterator iter = schemasList.iterator(); iter.hasNext();) { schema = (XmlSchema) iter.next(); schemaType = getSchemaType(schema, schemaTypeQname); if (schemaType != null) { break; } } } } if (schemaType instanceof XmlSchemaComplexType) { handleAllCasesOfComplexTypes(schemaType, message, partNameList, qnameSuffix); } else if ((schemaType instanceof XmlSchemaSimpleType) || ((schemaTypeQname != null) && (schemaTypeQname.equals(new QName("http://www.w3.org/2001/XMLSchema", "anyType")))) ) { QName opName = message.getAxisOperation().getName(); partNameList.add(WSDLUtil.getPartQName(opName.getLocalPart(), qnameSuffix, schemaElement.getQName().getLocalPart())); } else if (schemaType == null) { throw new CodeGenerationException("Can not determine the schema type for the " + schemaElement.getName()); } else { //we've no idea how to unwrap a non complexType!!!!!! throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedSchemaFormat", schemaType.getName(), "complexType")); } try { //set in the axis message that the unwrapping was success message.addParameter(getParameter( Constants.UNWRAPPED_KEY, Boolean.TRUE)); // attach the opName and the parts name list into the // axis message by using the holder MessagePartInformationHolder infoHolder = new MessagePartInformationHolder(); infoHolder.setOperationName(message.getAxisOperation().getName()); infoHolder.setPartsList(partNameList); //attach it to the parameters message.addParameter( getParameter(Constants.UNWRAPPED_DETAILS, infoHolder)); } catch (AxisFault axisFault) { throw new CodeGenerationException(axisFault); } } private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { // if a complex type name exits for a element then // we keep that complex type to support unwrapping if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType; if (cmplxType.getContentModel() == null) { if (cmplxType.getParticle() != null) { processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList, qnameSuffix); } } else { // now lets handle case with extensions processComplexContentModel(cmplxType, message, partNameList, qnameSuffix); } // handle attributes here processAttributes(cmplxType, message, partNameList, qnameSuffix); } } private void processAttributes(XmlSchemaComplexType complexType, AxisMessage message, List partNameList, String qnameSuffix) { QName opName = message.getAxisOperation().getName(); XmlSchemaObjectCollection xmlObjectCollection = complexType.getAttributes(); XmlSchemaObject item; XmlSchemaAttribute xmlSchemaAttribute; for (Iterator iter = xmlObjectCollection.getIterator(); iter.hasNext();) { item = (XmlSchemaObject) iter.next(); if (item instanceof XmlSchemaAttribute) { xmlSchemaAttribute = (XmlSchemaAttribute) item; String partName = xmlSchemaAttribute.getName(); partNameList.add( WSDLUtil.getPartQName(opName.getLocalPart(), qnameSuffix, partName)); } } } private void processComplexContentModel(XmlSchemaComplexType cmplxType, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { XmlSchemaContentModel contentModel = cmplxType.getContentModel(); if (contentModel instanceof XmlSchemaComplexContent) { XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent) contentModel; XmlSchemaContent content = xmlSchemaComplexContent.getContent(); if (content instanceof XmlSchemaComplexContentExtension) { XmlSchemaComplexContentExtension schemaExtension = (XmlSchemaComplexContentExtension) content; // process particles inside this extension, if any if (schemaExtension.getParticle() != null) { processXMLSchemaSequence(schemaExtension.getParticle(), message, partNameList, qnameSuffix); } // now we need to get the schema of the extension type from the parent schema. For that let's first retrieve // the parent schema AxisService axisService = message.getAxisOperation().getAxisService(); ArrayList schemasList = axisService.getSchema(); XmlSchema parentSchema = null; XmlSchema schema = null; XmlSchemaType extensionSchemaType = null; for (Iterator iter = schemasList.iterator(); iter.hasNext();) { schema = (XmlSchema) iter.next(); extensionSchemaType = getSchemaType(schema, schemaExtension.getBaseTypeName()); if (extensionSchemaType != null) { break; } } // ok now we got the parent schema. Now let's get the extension's schema type handleAllCasesOfComplexTypes(extensionSchemaType, message, partNameList, qnameSuffix); } } } private XmlSchemaType getSchemaType(XmlSchema schema, QName typeName) { XmlSchemaType xmlSchemaType = null; if (schema != null) { xmlSchemaType = schema.getTypeByName(typeName); if (xmlSchemaType == null) { // try to find in an import or an include XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator includesIter = includes.getIterator(); Object object = null; while (includesIter.hasNext()) { object = includesIter.next(); if (object instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (object instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (xmlSchemaType != null) { break; } } } } } return xmlSchemaType; } private void processXMLSchemaSequence(XmlSchemaParticle schemaParticle, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { if (schemaParticle instanceof XmlSchemaSequence) { // get the name of the operation name and namespace, // part name and hang them somewhere ? The ideal place // would be the property bag in the codegen config! QName opName = message.getAxisOperation().getName(); XmlSchemaSequence sequence = (XmlSchemaSequence) schemaParticle; XmlSchemaObjectCollection items = sequence.getItems(); // if this is an empty sequence, return if (items.getCount() == 0) { return; } for (Iterator i = items.getIterator(); i.hasNext();) { Object item = i.next(); // get each and every element in the sequence and // traverse through them if (item instanceof XmlSchemaElement) { //add the element name to the part name list XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) item; XmlSchemaType schemaType = xmlSchemaElement.getSchemaType(); String partName = null; if (xmlSchemaElement.getRefName() != null) { partName = xmlSchemaElement.getRefName().getLocalPart(); } else { partName = xmlSchemaElement.getName(); } // part names are not unique across messages. Hence // we need some way of making the part name a unique // one (due to the fact that the type mapper // is a global list of types). // The seemingly best way to do that is to // specify a namespace for the part QName reference which // is stored in the list. This part qname is // temporary and should not be used with it's // namespace URI (which happened to be the operation name) // with _input attached to it partNameList.add( WSDLUtil.getPartQName(opName.getLocalPart(), qnameSuffix, partName)); // if the particle contains anything other than // a XMLSchemaElement then we are not in a position // to unwrap it } else if (item instanceof XmlSchemaAny) { // if this is an instance of xs:any, then there is no part name for it. Using ANY_ELEMENT_FIELD_NAME // for it for now //we have to handle both maxoccurs 1 and maxoccurs > 1 situation XmlSchemaAny xmlSchemaAny = (XmlSchemaAny) item; partNameList.add( WSDLUtil.getPartQName(opName.getLocalPart(), qnameSuffix, Constants.ANY_ELEMENT_FIELD_NAME)); } else { throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedSchemaFormat", "unknown type", "Element")); } } //we do not know how to deal with other particles //such as xs:all or xs:choice. Usually occurs when //passed with the user built WSDL where the style //is document. } else if (schemaParticle instanceof XmlSchemaChoice) { throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedSchemaFormat", "choice", "sequence")); } else if (schemaParticle instanceof XmlSchemaAll) { throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedSchemaFormat", "all", "sequence")); } else { throw new CodeGenerationException( CodegenMessages.getMessage("extension.unsupportedSchemaFormat", "unknown", "sequence")); } } /** * Generate a parametes object * * @param key * @param value */ private Parameter getParameter(String key, Object value) { Parameter myParameter = new Parameter(); myParameter.setName(key); myParameter.setValue(value); return myParameter; } } ./src/org/apache/axis2/wsdl/codegen/extension/CodeGenExtension.java0000664000175000017500000000212311767656530024465 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; public interface CodeGenExtension { public void engage(CodeGenConfiguration configuration) throws CodeGenerationException; } ./src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java0000664000175000017500000001644311767656530024604 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.description.AxisService; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.schema.AxisServiceTopElementSchemaGenerator; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.InputStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class XMLBeansExtension extends AbstractDBProcessingExtension { /** Name of "extra" option used to supply package name for xsb files. */ public static final String TYPESYSTEMNAME_OPTION = "typesystemname"; public static final String SCHEMA_FOLDER = "schemas"; public static final String XSDCONFIG_OPTION = "xc"; public static final String XSDCONFIG_OPTION_LONG = "xsdconfig"; public static String MAPPINGS = "mappings"; public static String MAPPING = "mapping"; public static String MESSAGE = "message"; public static String JAVA_NAME = "javaclass"; public static final String MAPPING_FOLDER = "Mapping"; public static final String MAPPER_FILE_NAME = "mapper"; public static final String SCHEMA_PATH = "/org/apache/axis2/wsdl/codegen/schema/"; public static final String XMLBEANS_CONFIG_CLASS = "org.apache.xmlbeans.BindingConfig"; public static final String XMLBEANS_UTILITY_CLASS = "org.apache.axis2.xmlbeans.CodeGenerationUtility"; public static final String XMLBEANS_PROCESS_METHOD = "processSchemas"; boolean debug = false; public void engage(CodeGenConfiguration configuration) { //test the databinding type. If not just fall through if (testFallThrough(configuration.getDatabindingType())) { return; } // check the JiBX binding definition file specified String typeSystemName = (String)configuration.getProperties().get(TYPESYSTEMNAME_OPTION); try { // try dummy load of framework class first to check missing jars try { getClass().getClassLoader().loadClass(XMLBEANS_CONFIG_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("XMLBeans framework jars not in classpath"); } // load the actual utility class Class clazz = null; try { clazz = getClass().getClassLoader().loadClass(XMLBEANS_UTILITY_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("XMLBeans binding extension not in classpath"); } // invoke utility class method for actual processing Method method = clazz.getMethod(XMLBEANS_PROCESS_METHOD, new Class[] { List.class, Element[].class, CodeGenConfiguration.class, String.class }); List schemas = new ArrayList(); List axisServices = configuration.getAxisServices(); AxisService axisService = null; AxisServiceTopElementSchemaGenerator schemaGenerator = null; for (Iterator iter = axisServices.iterator(); iter.hasNext();) { axisService = (AxisService)iter.next(); if (configuration.getProperties().containsKey( CommandLineOptionConstants.ExtensionArguments.WITHOUT_DATABIND_CODE)){ // use the dummy code schemaGenerator = new AxisServiceTopElementSchemaGenerator(axisService); schemas.addAll(schemaGenerator.getDummySchemaList()); } else { schemas.addAll(axisService.getSchema()); } } Element[] additionalSchemas = loadAdditionalSchemas(); TypeMapper mapper = (TypeMapper)method.invoke(null, new Object[] { schemas, additionalSchemas, configuration, typeSystemName }); // set the type mapper to the config configuration.setTypeMapper(mapper); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException)e; } else { throw new RuntimeException(e); } } } /** * Loading the external schemas. * * @return element array consisting of the the DOM element objects that represent schemas */ private Element[] loadAdditionalSchemas() { //load additional schemas String[] schemaNames = ConfigPropertyFileLoader.getThirdPartySchemaNames(); Element[] schemaElements; try { ArrayList additionalSchemaElements = new ArrayList(); DocumentBuilder documentBuilder = getNamespaceAwareDocumentBuilder(); for (int i = 0; i < schemaNames.length; i++) { //the location for the third party schema;s is hardcoded if (!"".equals(schemaNames[i].trim())) { InputStream schemaStream = this.getClass().getResourceAsStream(SCHEMA_PATH + schemaNames[i]); Document doc = documentBuilder.parse(schemaStream); additionalSchemaElements.add(doc.getDocumentElement()); } } //Create the Schema element array schemaElements = new Element[additionalSchemaElements.size()]; for (int i = 0; i < additionalSchemaElements.size(); i++) { schemaElements[i] = (Element)additionalSchemaElements.get(i); } } catch (Exception e) { throw new RuntimeException( CodegenMessages.getMessage("extension.additionalSchemaFailure"), e); } return schemaElements; } private DocumentBuilder getNamespaceAwareDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); return documentBuilderFactory.newDocumentBuilder(); } } ./src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java0000664000175000017500000000237711767656530024433 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import java.util.List; public interface PolicyExtension { public void init(CodeGenConfiguration codeGenConfiguration); public void addMethodsToStub(Document document, Element element, QName methodName, List assertions); } ./src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.java0000664000175000017500000000726711767656530023773 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * Code generation data binding extension for JiBX support. JiBX currently requires a predefined * binding definition to be supplied in order to be used with Axis2. */ public class JiBXExtension extends AbstractDBProcessingExtension { /** Name of "extra" option used to supply binding definition path. */ public static final String BINDING_PATH_OPTION = "bindingfile"; private static final String JIBX_MODEL_CLASS = "org.jibx.binding.model.BindingElement"; private static final String JIBX_UTILITY_CLASS = "org.apache.axis2.jibx.CodeGenerationUtility"; private static final String JIBX_UTILITY_METHOD = "engage"; public void engage(CodeGenConfiguration configuration) { // just return if JiBX binding not active if (testFallThrough(configuration.getDatabindingType())) { return; } // check the JiBX binding definition file specified String path = (String)configuration.getProperties().get(BINDING_PATH_OPTION); try { // try dummy load of framework class first to check missing jars try { getClass().getClassLoader().loadClass(JIBX_MODEL_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("JiBX framework jars not in classpath"); } // load the actual utility class Class clazz; try { clazz = JiBXExtension.class.getClassLoader().loadClass(JIBX_UTILITY_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("JiBX binding extension not in classpath"); } // create an instance of the class Object inst = null; Constructor constructor = clazz.getConstructor(new Class[] { CodeGenConfiguration.class }); inst = constructor.newInstance(new Object[] { configuration }); // invoke utility class method for actual processing Method method = clazz.getMethod(JIBX_UTILITY_METHOD, new Class[] { String.class }); method.invoke(inst, new Object[] { path }); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException)e; } else if (e instanceof InvocationTargetException) { if (e.getCause() instanceof RuntimeException) { throw (RuntimeException)e.getCause(); } else { throw new RuntimeException(e); } } else { throw new RuntimeException(e); } } } }./src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java0000664000175000017500000000446011767656530023755 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.util.URLProcessor; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; public class PackageFinder extends AbstractCodeGenerationExtension { public void engage(CodeGenConfiguration configuration) { String packageName = configuration.getPackageName(); if (packageName == null || URLProcessor.DEFAULT_PACKAGE.equals(packageName)) { //use the target namespace from the axis service to form a package name // since all the services are in same name space String targetNameSpace = configuration.getTargetNamespace(); // if this target name space exists in the ns2p then we have to get that package if ((configuration.getUri2PackageNameMap() != null) && configuration.getUri2PackageNameMap().containsKey(targetNameSpace.trim())) { packageName = (String)configuration.getUri2PackageNameMap().get(targetNameSpace); } else { // i.e. user have not given any ns2p information for this name space packageName = URLProcessor.makePackageName(configuration.getTargetNamespace()); if (packageName != null) { packageName = packageName.toLowerCase(); } } } if ((packageName == null) || "".equals(packageName)) { packageName = URLProcessor.DEFAULT_PACKAGE; } configuration.setPackageName(packageName); } } ./src/org/apache/axis2/wsdl/codegen/extension/TypeMapperExtension.java0000664000175000017500000001452311767656530025256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.databinding.DefaultTypeMapper; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; /** * The purpose of this extension is to populate the type mapper from the type mapping file. The * format of the type mapping file is as follows localName type *

        * In any case it is best that the type mapper extension be after all the databinding extensions */ public class TypeMapperExtension implements CodeGenExtension { private static final String MAPPING_ELEMENT_NAME = "mapping"; private static final String NAMESPACE_ATTRIBUTE_NAME = "namespace"; private static final String QNAME_ELEMENT_NAME = "qname"; private static final String VALUE_ELEMENT_NAME = "value"; private static final String DB_FRAMEWORK_ATTRIBUTE_NAME = "dbf"; /** @throws CodeGenerationException */ public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { if (configuration.getTypeMappingFile() != null) { //a type mapping is present. try building the //mapping from it // if the configuration already has a mapping then take it // the external mappings will override the currently available // mappings TypeMapper mapper = configuration.getTypeMapper(); // there is no mapper present - so just create a new one if (mapper == null) { mapper = new DefaultTypeMapper(); } //read the file as a DOM Document mappingDocument = buildDocument(configuration); Element rootMappingsElement = mappingDocument.getDocumentElement(); //override the databinding framework name. If a mapping file is //present then the databinding framework name will be overridden //if present. If a user wants to mix types then it must be //from the same databinding framework! //first do a sanity check to see whether the user is trying to //mix databinding types! String databindingName = rootMappingsElement. getAttribute(DB_FRAMEWORK_ATTRIBUTE_NAME); if (!databindingName.equals(configuration.getDatabindingType())) { throw new CodeGenerationException( CodegenMessages. getMessage("extension.databindingMismatch") ); } configuration. setDatabindingType( databindingName); NodeList mappingList = rootMappingsElement. getElementsByTagName(MAPPING_ELEMENT_NAME); int length = mappingList.getLength(); for (int i = 0; i < length; i++) { Element mappingNode = (Element)mappingList.item(i); //we know this is only one - if there are multiple then //it is invalid Element qNameChild = (Element)mappingNode. getElementsByTagName(QNAME_ELEMENT_NAME).item(0); Element valueChild = (Element)mappingNode. getElementsByTagName(VALUE_ELEMENT_NAME).item(0); //generate a Qname and add to the type mapping mapper.addTypeMappingName(new QName( qNameChild.getAttribute(NAMESPACE_ATTRIBUTE_NAME), getTextFromElement(qNameChild)), getTextFromElement(valueChild)); } //set the type mapper to the configurtion configuration.setTypeMapper(mapper); } } /** * Build a dom document from the mapping file * * @throws CodeGenerationException */ private Document buildDocument(CodeGenConfiguration configuration) throws CodeGenerationException { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder.parse(configuration.getTypeMappingFile()); } catch (Exception e) { throw new CodeGenerationException(e); } } /** * Gets the string content from an element. returns null if there are no test nodes found * * @param elt * @return text cotent of the element */ private String getTextFromElement(Element elt) { NodeList children = elt.getChildNodes(); String returnString = null; int length = children.getLength(); for (int i = 0; i < length; i++) { Node node = children.item(i); if (Node.TEXT_NODE == node.getNodeType()) { returnString = (returnString == null ? "" : returnString) + node.getNodeValue(); } } return returnString; } } ./src/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtension.java0000664000175000017500000003731511767656530025247 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.util.Constants; import org.apache.axis2.wsdl.util.MessagePartInformationHolder; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaType; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class JAXWSWapperExtension extends AbstractCodeGenerationExtension { private CodeGenConfiguration codeGenConfiguration; public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { this.codeGenConfiguration = configuration; if (!codeGenConfiguration.isParametersWrapped() && codeGenConfiguration.getOutputLanguage().equals("jax-ws")) { //walk the schema and find the top level elements List services = configuration.getAxisServices(); AxisService axisService; for (Iterator servicesIter = services.iterator(); servicesIter.hasNext();) { axisService = (AxisService) servicesIter.next(); for (Iterator operations = axisService.getOperations(); operations.hasNext();) { AxisOperation op = (AxisOperation) operations.next(); boolean wrappable = true; //get the input parameter details to unwrap the requests if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) { AxisMessage message = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); XmlSchemaElement schemaElement = message.getSchemaElement(); String opName = ((AxisOperation) message.getParent()).getName().getLocalPart(); if(!schemaElement.getName().equals(opName)) return; wrappable = walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), WSDLConstants.INPUT_PART_QNAME_SUFFIX); } //get the out put parameter details as well to unwrap the responses if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern()) && wrappable) { walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), WSDLConstants.OUTPUT_PART_QNAME_SUFFIX); } } } } } public boolean walkSchema(AxisMessage message, String qnameSuffix) throws CodeGenerationException { //nothing to unwrap if (message.getSchemaElement() == null) { return false; } List partNameList = new LinkedList(); XmlSchemaElement schemaElement = message.getSchemaElement(); // String opName = ((AxisOperation) message.getParent()).getName().getLocalPart(); // if(!schemaElement.getName().equals(opName)) // return false; XmlSchemaType schemaType = schemaElement.getSchemaType(); QName schemaTypeQname = schemaElement.getSchemaTypeName(); if (schemaType == null) { if (schemaTypeQname != null) { // find the schema type from all the schemas // now we need to get the schema of the extension type from the parent schema. For that let's first retrieve // the parent schema AxisService axisService = (AxisService) message.getParent().getParent(); ArrayList schemasList = axisService.getSchema(); XmlSchema schema = null; for (Iterator iter = schemasList.iterator(); iter.hasNext();) { schema = (XmlSchema) iter.next(); schemaType = getSchemaType(schema, schemaTypeQname); if (schemaType != null) { break; } } } } if (schemaType instanceof XmlSchemaComplexType) { if(!handleAllCasesOfComplexTypes(schemaType, message, partNameList, qnameSuffix)){ return false; } } else { return false; } // else if ((schemaType instanceof XmlSchemaSimpleType) || // ((schemaTypeQname != null) && (schemaTypeQname.equals(new QName("http://www.w3.org/2001/XMLSchema", "anyType"))))) { // QName opName = ((AxisOperation) message.getParent()).getName(); // partNameList.add(WSDLUtil.getPartQName(opName.getLocalPart(), // qnameSuffix, // schemaElement.getQName().getLocalPart())); // } else if (schemaType == null) { // throw new CodeGenerationException("Can not determine the schema type for the " // + schemaElement.getName()); // } else { // //we've no idea how to unwrap a non complexType!!!!!! // throw new CodeGenerationException( // CodegenMessages.getMessage("extension.unsupportedSchemaFormat", // schemaType.getName(), "complexType")); // } try { //set in the axis message that the unwrapping was success message.addParameter(getParameter( Constants.UNWRAPPED_KEY, Boolean.TRUE)); // attach the opName and the parts name list into the // axis message by using the holder MessagePartInformationHolder infoHolder = new MessagePartInformationHolder(); infoHolder.setOperationName(((AxisOperation) message.getParent()).getName()); infoHolder.setPartsList(partNameList); //attach it to the parameters message.addParameter( getParameter(Constants.UNWRAPPED_DETAILS, infoHolder)); } catch (AxisFault axisFault) { throw new CodeGenerationException(axisFault); } return true; } /** * Generate a parametes object * * @param key * @param value */ private Parameter getParameter(String key, Object value) { Parameter myParameter = new Parameter(); myParameter.setName(key); myParameter.setValue(value); return myParameter; } private XmlSchemaType getSchemaType(XmlSchema schema, QName typeName) { XmlSchemaType xmlSchemaType = null; if (schema != null) { xmlSchemaType = schema.getTypeByName(typeName); if (xmlSchemaType == null) { // try to find in an import or an include XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator includesIter = includes.getIterator(); Object object = null; while (includesIter.hasNext()) { object = includesIter.next(); if (object instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (object instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (xmlSchemaType != null) { break; } } } } } return xmlSchemaType; } private boolean handleAllCasesOfComplexTypes(XmlSchemaType schemaType, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { // if a complex type name exits for a element then // we keep that complex type to support unwrapping if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType; XmlSchemaObjectCollection xmlObjectCollection = cmplxType.getAttributes(); if (xmlObjectCollection.getCount() != 0) return false; if (cmplxType.getContentModel() == null) { if (cmplxType.getParticle() != null) { return processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList, qnameSuffix); } } else { // now lets handle case with extensions return processComplexContentModel(cmplxType, message, partNameList, qnameSuffix); } // handle attributes here // processAttributes(cmplxType, message, partNameList, qnameSuffix); } return false; } private boolean processComplexContentModel(XmlSchemaComplexType cmplxType, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { //TODO implement this method return false; } private boolean processXMLSchemaSequence(XmlSchemaParticle schemaParticle, AxisMessage message, List partNameList, String qnameSuffix) throws CodeGenerationException { if (schemaParticle instanceof XmlSchemaSequence) { // get the name of the operation name and namespace, // part name and hang them somewhere ? The ideal place // would be the property bag in the codegen config! QName opName = ((AxisOperation) message.getParent()).getName(); XmlSchemaSequence sequence = (XmlSchemaSequence) schemaParticle; XmlSchemaObjectCollection items = sequence.getItems(); // if this is an empty sequence, return if (items.getCount() == 0) { /*be carefull */ return true; } for (Iterator i = items.getIterator(); i.hasNext();) { Object item = i.next(); // get each and every element in the sequence and // traverse through them if (item instanceof XmlSchemaElement) { //add the element name to the part name list XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) item; // if(xmlSchemaElement.isNillable()){ // return false; // } XmlSchemaType schemaType = xmlSchemaElement.getSchemaType(); String partName = null; if (xmlSchemaElement.getRefName() != null) { partName = xmlSchemaElement.getRefName().getLocalPart(); } else { partName = xmlSchemaElement.getName(); } // part names are not unique across messages. Hence // we need some way of making the part name a unique // one (due to the fact that the type mapper // is a global list of types). // The seemingly best way to do that is to // specify a namespace for the part QName reference which // is stored in the list. This part qname is // temporary and should not be used with it's // namespace URI (which happened to be the operation name) // with _input attached to it partNameList.add( WSDLUtil.getPartQName(opName.getLocalPart(), qnameSuffix, partName)); // if the particle contains anything other than // a XMLSchemaElement then we are not in a position // to unwrap it // } // else if (item instanceof XmlSchemaAny) { // // // if this is an instance of xs:any, then there is no part name for it. Using ANY_ELEMENT_FIELD_NAME // // for it for now // // //we have to handle both maxoccurs 1 and maxoccurs > 1 situation // XmlSchemaAny xmlSchemaAny = (XmlSchemaAny) item; // // partNameList.add( // WSDLUtil.getPartQName(opName.getLocalPart(), // qnameSuffix, // Constants.ANY_ELEMENT_FIELD_NAME)); } else { // throw new CodeGenerationException( // CodegenMessages.getMessage("extension.unsupportedSchemaFormat", // "unknown type", "Element")); return false; } } return true; //we do not know how to deal with other particles //such as xs:all or xs:choice. Usually occurs when //passed with the user built WSDL where the style //is document. // } else if (schemaParticle instanceof XmlSchemaChoice) { // throw new CodeGenerationException( // CodegenMessages.getMessage("extension.unsupportedSchemaFormat", // "choice", "sequence")); // // } else if (schemaParticle instanceof XmlSchemaAll) { // throw new CodeGenerationException( // CodegenMessages.getMessage("extension.unsupportedSchemaFormat", // "all", "sequence")); } else { // throw new CodeGenerationException( // CodegenMessages.getMessage("extension.unsupportedSchemaFormat", // "unknown", "sequence")); return false; } } }./src/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.java0000664000175000017500000000306411767656530027174 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import java.util.Map; public abstract class AbstractDBProcessingExtension extends AbstractCodeGenerationExtension { /** * Method to test whether the passed in framework name is relevant to this extension. * * @param dbFrameworkName * @return Returns boolean. */ protected boolean testFallThrough(String dbFrameworkName) { Map extensionsMap = ConfigPropertyFileLoader.getDatabindingFrameworkNameToExtensionMap(); String mappedExtension = extensionsMap.get(dbFrameworkName) != null ? extensionsMap.get(dbFrameworkName).toString() : ""; return !(getClass().getName().equals(mappedExtension)); } } ./src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java0000664000175000017500000000166411767656530025577 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; public interface ModulePolicyExtension { public PolicyExtension getPolicyExtension(); } ./src/org/apache/axis2/wsdl/codegen/extension/WSDLPrettyPrinterExtension.java0000664000175000017500000000223511767656530026512 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.util.XMLPrettyPrinter; import java.io.File; public class WSDLPrettyPrinterExtension extends AbstractPrettyPrinterExtension { public WSDLPrettyPrinterExtension() { fileExtension = ".wsdl"; } protected void prettifyFile(File file) { XMLPrettyPrinter.prettify(file); } } ./src/org/apache/axis2/wsdl/codegen/extension/AbstractCodeGenerationExtension.java0000664000175000017500000000207711767656530027543 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractCodeGenerationExtension implements CodeGenExtension { protected Log log = LogFactory.getLog(this.getClass()); } ./src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java0000664000175000017500000000370711767656530024631 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import java.lang.reflect.Method; /** Extension for simple data binding. */ public class SimpleDBExtension extends AbstractDBProcessingExtension { private static final String ADB_INVOKE_CLASS_NAME = "org.apache.axis2.schema.ExtensionUtility"; private static final String INVOKE_METHOD_NAME = "invoke"; /** * */ public void engage(CodeGenConfiguration configuration) { //test the databinding type. If not just fall through if (testFallThrough(configuration.getDatabindingType())) { return; } try { //invoke the adb codegen by reflection Class adbGeneratorClass = Class. forName(ADB_INVOKE_CLASS_NAME); Method invokeMethod = adbGeneratorClass.getMethod( INVOKE_METHOD_NAME, new Class[] { CodeGenConfiguration.class }); invokeMethod.invoke(null, new Object[] { configuration }); } catch (Exception e) { throw new RuntimeException(e); } } } ./src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java0000664000175000017500000000503511767656530026677 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.databinding.CDefaultTypeMapper; import org.apache.axis2.wsdl.databinding.DefaultTypeMapper; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.i18n.CodegenMessages; public class DefaultDatabindingExtension extends AbstractDBProcessingExtension { public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { TypeMapper mapper = configuration.getTypeMapper(); if (testFallThrough(configuration.getDatabindingType())) { //if it's fall through for the default databinding extension and a mapper has //not yet being set, then there's a problem. //Hence check the mapper status here if (mapper == null) { //this shouldn't happen throw new CodeGenerationException( CodegenMessages.getMessage("extension.noProperDatabinding")); } return; } //the mapper has not been populated yet. since this extension is //registered for -d none, we have to generate a new type mapper //that serves only the default types if (mapper == null) { if (configuration.getOutputLanguage() != null && !configuration.getOutputLanguage().trim().equals("") && configuration.getOutputLanguage().toLowerCase().equals("c")) { configuration.setTypeMapper(new CDefaultTypeMapper()); } else { configuration.setTypeMapper(new DefaultTypeMapper()); } } } } ./src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java0000664000175000017500000000446111767656530025607 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.ws.commons.schema.XmlSchema; import java.util.List; public class WSDLValidatorExtension extends AbstractCodeGenerationExtension { public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { //WSDLDescription wom = this.configuration.getWom(); List schemaList = configuration.getSchemaListForAllServices(); if (schemaList == null || schemaList.isEmpty()) { //there are no types to be considered return; } for (int i = 0; i < schemaList.size(); i++) { XmlSchema s = (XmlSchema)schemaList.get(i); if (s.getIncludes().getCount() != 0) { //there are some included - now see whether there are any //elements or types declared! if (s.getElements().getCount() == 0 && s.getSchemaTypes().getCount() == 0 && s.getGroups().getCount() == 0 && s.getTargetNamespace() == null) { // if there's no targetNamespace there's probably no name, but try it anyway throw new CodeGenerationException( CodegenMessages.getMessage("extension.invalidWSDL", s.toString())); } } } } } ./src/org/apache/axis2/wsdl/codegen/extension/XMLPrettyPrinterExtension.java0000664000175000017500000000235311767656530026402 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.util.XMLPrettyPrinter; import java.io.File; public class XMLPrettyPrinterExtension extends AbstractPrettyPrinterExtension { public XMLPrettyPrinterExtension() { fileExtension = ".xml"; } /** * calls the xml pretty printers * * @param file */ protected void prettifyFile(File file) { XMLPrettyPrinter.prettify(file); } } ./src/org/apache/axis2/wsdl/codegen/extension/AbstractPrettyPrinterExtension.java0000664000175000017500000000414511767656530027506 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import java.io.File; import java.util.Iterator; import java.util.List; public abstract class AbstractPrettyPrinterExtension extends AbstractCodeGenerationExtension { /** If the extension for property file changes it might effect this as well !!! */ protected String fileExtension = ""; public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { //recurse through the output files and prettify them File outputFolder = configuration.getOutputLocation(); prettify(outputFolder,configuration); } /** * Recursive procedure to prettify the files * * @param file */ protected void prettify(File file, CodeGenConfiguration configuration) { List xmlFileList = configuration.getOutputXmlFileNamesList(); String fileName = null; for (Iterator iter = xmlFileList.iterator();iter.hasNext();){ fileName = (String) iter.next(); prettifyFile(new File(fileName)); } } /** * Implement this to call the proper pretty printers * * @param file */ protected abstract void prettifyFile(File file); } ./src/org/apache/axis2/wsdl/codegen/extension/ExcludePackageExtension.java0000664000175000017500000000652111767656530026034 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import java.io.File; /** * this extension deletes the packages sepcifies by the user from the * generated code. * this feature is very important to remove some commonly generated classes. */ public class ExcludePackageExtension extends AbstractCodeGenerationExtension { public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { String excludePackagesString = configuration.getExcludeProperties(); if ((excludePackagesString != null) && (excludePackagesString.trim().length() > 0)) { String[] excludePackages = excludePackagesString.split(","); File outPutFileLocation = null; if (configuration.isFlattenFiles()) { outPutFileLocation = getOutputDirectory(configuration.getOutputLocation(), null); } else { outPutFileLocation = getOutputDirectory(configuration.getOutputLocation(), configuration.getSourceLocation()); } String excluePackage = null; File tempFile = null; for (int i = 0; i < excludePackages.length; i++) { tempFile = outPutFileLocation; String[] directories = excludePackages[i].split("\\."); int j = 0; for (; j < directories.length; j++) { tempFile = new File(tempFile, directories[j]); if (!tempFile.exists()) { break; } } if (j == directories.length) { // this means this loop has gone to end and a directory // exists at the end deleteDirectory(tempFile); } } } } private void deleteDirectory(File directory) { File[] children = directory.listFiles(); for (int i = 0; i < children.length; i++) { if (children[i].isDirectory()) { deleteDirectory(children[i]); } else { children[i].delete(); } } // delete this directory directory.delete(); } private File getOutputDirectory(File outputDir, String dir2) { if (dir2 != null && !"".equals(dir2)) { outputDir = new File(outputDir, dir2); } if (!outputDir.exists()) { outputDir.mkdirs(); } return outputDir; } } ./src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java0000664000175000017500000002151211767656530024411 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.extension; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.modules.Module; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class PolicyEvaluator implements CodeGenExtension { private CodeGenConfiguration configuration; /** * Init method to initialization * * @param configuration * @param namespace2ExtsMap */ private void init(CodeGenConfiguration configuration, Map namespace2ExtsMap) { this.configuration = configuration; // adding default PolicyExtensions namespace2ExtsMap .put("http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization", new MTOMPolicyExtension(configuration)); namespace2ExtsMap.put("http://schemas.xmlsoap.org/ws/2004/09/policy/encoding", new EncodePolicyExtension()); String repository = configuration.getRepositoryPath(); if (repository == null) { return; } try { ConfigurationContext configurationCtx = ConfigurationContextFactory .createConfigurationContextFromFileSystem(repository, null); AxisConfiguration axisConfiguration = configurationCtx .getAxisConfiguration(); for (Iterator iterator = axisConfiguration.getModules().values() .iterator(); iterator.hasNext();) { AxisModule axisModule = (AxisModule)iterator.next(); String[] namespaces = axisModule.getSupportedPolicyNamespaces(); if (namespaces == null) { continue; } Module module = axisModule.getModule(); if (!(module instanceof ModulePolicyExtension)) { continue; } PolicyExtension ext = ((ModulePolicyExtension)module).getPolicyExtension(); for (int i = 0; i < namespaces.length; i++) { namespace2ExtsMap.put(namespaces[i], ext); } } } catch (Exception e) { System.err .println("cannot create repository : policy will not be supported"); } } public void engage(CodeGenConfiguration configuration) { Map namespace2ExtMap = new HashMap(); //initialize init(configuration, namespace2ExtMap); Document document = getEmptyDocument(); Element rootElement = document.createElement("module-codegen-policy-extensions"); AxisOperation axisOperation; QName opName; PolicyInclude policyInclude; Policy policy; List axisServices = configuration.getAxisServices(); AxisService axisService; for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) { axisService = (AxisService)servicesIter.next(); for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) { axisOperation = (AxisOperation)iterator.next(); opName = axisOperation.getName(); policyInclude = axisOperation.getPolicyInclude(); policy = policyInclude.getEffectivePolicy(); if (policy != null) { processPolicies(document, rootElement, policy, opName, namespace2ExtMap); } } } // TODO: think about this how can we support this configuration.putProperty("module-codegen-policy-extensions", rootElement); } /** * Process policies * * @param document * @param rootElement * @param policy * @param opName */ private void processPolicies(Document document, Element rootElement, Policy policy, QName opName, Map ns2Exts) { HashMap map = new HashMap(); for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) { String targetNamesapce = null; Assertion assertion; List assertionList; for (Iterator assertions = ((List)iterator.next()).iterator(); assertions.hasNext();) { assertion = (Assertion)assertions.next(); targetNamesapce = assertion.getName().getNamespaceURI(); if ((assertionList = (List)map.get(targetNamesapce)) == null) { assertionList = new ArrayList(); map.put(targetNamesapce, assertionList); } assertionList.add(assertions); } // here we pick the first policy alternative and ignor the rest break; } for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) { String targetNamespace = (String)iterator.next(); PolicyExtension policyExtension = (PolicyExtension)ns2Exts.get(targetNamespace); if (policyExtension == null) { System.err.println("cannot find a PolicyExtension to process " + targetNamespace + "type assertions"); continue; } policyExtension.init(configuration); policyExtension.addMethodsToStub(document, rootElement, opName, (List)map.get(targetNamespace)); } } private Document getEmptyDocument() { try { DocumentBuilder documentBuilder = DocumentBuilderFactory .newInstance().newDocumentBuilder(); return documentBuilder.newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } } class MTOMPolicyExtension implements PolicyExtension { private boolean setOnce = false; private CodeGenConfiguration configuration; public void init(CodeGenConfiguration configuration) { } public MTOMPolicyExtension(CodeGenConfiguration configuration) { this.configuration = configuration; } public void addMethodsToStub(Document document, Element element, QName operationName, List assertions) { // FIXME // if (!setOnce) { // Object plainBase64PropertyMap = configuration.getProperty(Constants.PLAIN_BASE_64_PROPERTY_KEY); // configuration.putProperty(Constants.BASE_64_PROPERTY_KEY, plainBase64PropertyMap); // // setOnce = true; // } // // Element optimizeContent = document.createElement("optimizeContent"); // Element opNameElement = document.createElement("opName"); // // opNameElement.setAttribute("ns-url", operationName.getNamespaceURI()); // opNameElement.setAttribute("localName", operationName.getLocalPart()); // // optimizeContent.appendChild(opNameElement); // // element.appendChild(optimizeContent); } } class EncodePolicyExtension implements PolicyExtension { public void init(CodeGenConfiguration configuration) { } public void addMethodsToStub(Document document, Element element, QName operationName, List assertions) { // TODO implement encoding } } } ./src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java0000664000175000017500000003656211767656530023107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen; import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension; import org.apache.axis2.wsdl.i18n.CodegenMessages; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; class CodegenConfigLoader implements CommandLineOptionConstants { public static void loadConfig(CodeGenConfiguration config, Map optionMap) { String outputLocation = "."; //default output directory is the current working directory CommandLineOption commandLineOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG, optionMap); if (commandLineOption != null) { //set isoutputSourceLocation true when user specify an output source location config.setoutputSourceLocation(true); outputLocation = commandLineOption.getOptionValue(); } File outputLocationFile = new File(outputLocation); config.setOutputLocation(outputLocationFile); //check and create the directories if (outputLocationFile.exists()) {//$NON-SEC-2 if (outputLocationFile.isFile()) {//$NON-SEC-2 throw new RuntimeException( CodegenMessages.getMessage("options.notADirectoryException")); } } else { outputLocationFile.mkdirs();//$NON-SEC-2 } config.setServerSide(loadOption(WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG, optionMap) != null); config.setGenerateDeployementDescriptor( loadOption(WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION_LONG, optionMap) != null); config.setWriteTestCase(loadOption(WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION_LONG, optionMap) != null); config.setSkipWriteWSDLs(loadOption(null, WSDL2JavaConstants.NO_WSDLS_OPTION_LONG, optionMap) != null); config.setSkipMessageReceiver(loadOption(null, WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG, optionMap) != null); config.setSkipBuildXML(loadOption(null, WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG, optionMap) != null); boolean asyncFlagPresent = (loadOption(WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION_LONG, optionMap) != null); boolean syncFlagPresent = (loadOption(WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION_LONG, optionMap) != null); if (asyncFlagPresent && !syncFlagPresent) { config.setAsyncOn(true); config.setSyncOn(false); } if (syncFlagPresent && !asyncFlagPresent) { config.setAsyncOn(false); config.setSyncOn(true); } commandLineOption = loadOption(WSDL2JavaConstants.PACKAGE_OPTION, WSDL2JavaConstants.PACKAGE_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setPackageName(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.STUB_LANGUAGE_OPTION, WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setOutputLanguage(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setDatabindingType(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.UNPACK_CLASSES_OPTION, WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setPackClasses(false); } // source folder commandLineOption = loadOption(WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION, WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setSourceLocation(commandLineOption.getOptionValue()); } // resource folder commandLineOption = loadOption(WSDL2JavaConstants.RESOURCE_FOLDER_OPTION, WSDL2JavaConstants.RESOURCE_FOLDER_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setResourceLocation(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.PORT_NAME_OPTION, WSDL2JavaConstants.PORT_NAME_OPTION_LONG, optionMap); config.setPortName(commandLineOption != null ? commandLineOption.getOptionValue() : null); commandLineOption = loadOption(WSDL2JavaConstants.SERVICE_NAME_OPTION, WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG, optionMap); config.setServiceName( commandLineOption != null ? commandLineOption.getOptionValue() : null); commandLineOption = loadOption(WSDL2JavaConstants.REPOSITORY_PATH_OPTION, WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG, optionMap); config.setRepositoryPath( commandLineOption != null ? commandLineOption.getOptionValue() : null); config.setServerSideInterface(loadOption(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION_LONG, optionMap) != null); config.setGenerateAll(loadOption(WSDL2JavaConstants.GENERATE_ALL_OPTION, WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG, optionMap) != null); //populate the external mapping commandLineOption = loadOption( WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION, WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION_LONG, optionMap); if (commandLineOption != null) { try { config.setTypeMappingFile(new File(commandLineOption.getOptionValue())); } catch (Exception e) { throw new RuntimeException( CodegenMessages.getMessage("options.nomappingFile"), e); } } // load the namespace to package list commandLineOption = loadOption( WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION, WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION_LONG, optionMap); if (commandLineOption != null) { //the syntax for the value of the namespaces and packages is //to be a comma seperated list with uri=packagename,uri=packagename... String value = commandLineOption.getOptionValue(); if (value != null) { // Try treating the values as a name=value pair separated by comma's if (value.indexOf('=') != -1) { String valuepairs[] = value.split(","); if (valuepairs.length > 0) { //put them in the hash map HashMap map = new HashMap(valuepairs.length); for (int i = 0; i < valuepairs.length; i++) { String values[] = valuepairs[i].split("="); if (values.length == 2) { map.put(values[0], values[1]); } } config.setUri2PackageNameMap(map); } } else { // Try loading the properties from the file specified try { Properties p = new Properties();//$NON-SEC-3 p.load(new FileInputStream(value));//$NON-SEC-2//$NON-SEC-3 config.setUri2PackageNameMap(p); } catch (IOException e) { throw new RuntimeException( CodegenMessages. getMessage("options.noFile", value), e); } } } } commandLineOption = loadOption(WSDL2JavaConstants.UNWRAP_PARAMETERS, WSDL2JavaConstants.UNWRAP_PARAMETERS_LONG, optionMap); if (commandLineOption != null) { config.setParametersWrapped(false); } commandLineOption = loadOption(WSDL2JavaConstants.WSDL_VERSION_OPTION, WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG, optionMap); if (commandLineOption != null) { String optionValue = commandLineOption.getOptionValue(); if (WSDL2JavaConstants.WSDL_VERSION_2.equals(optionValue) || WSDL2JavaConstants.WSDL_VERSION_2_OPTIONAL.equals(optionValue)) { //users can say either 2.0 or 2 - we just set it to the constant config.setWSDLVersion(WSDL2JavaConstants.WSDL_VERSION_2); } //ignore the other cases - they'll be taken as 1.1 } config .setFlattenFiles(loadOption( WSDL2JavaConstants.FLATTEN_FILES_OPTION, WSDL2JavaConstants.FLATTEN_FILES_OPTION_LONG, optionMap) != null); commandLineOption = loadOption( WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION, WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setBackwordCompatibilityMode(true); } commandLineOption = loadOption( WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION, WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION_LONG, optionMap); if (commandLineOption != null) { config.setSuppressPrefixesMode(true); } commandLineOption = loadOption(XMLBeansExtension.XSDCONFIG_OPTION, XMLBeansExtension.XSDCONFIG_OPTION_LONG, optionMap); if (commandLineOption != null) { config.getProperties().put(XMLBeansExtension.XSDCONFIG_OPTION, commandLineOption.getOptionValue()); } //setting http proxy host and http proxy port commandLineOption = loadOption(null, WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG, optionMap); if (commandLineOption != null) { System.setProperty("http.proxyHost", commandLineOption.getOptionValue());//$NON-SEC-2 } commandLineOption = loadOption(null, WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG, optionMap); if (commandLineOption != null) { System.setProperty("http.proxyPort", commandLineOption.getOptionValue());//$NON-SEC-2 } commandLineOption = loadOption(WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION, WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION_LONG, optionMap); if (commandLineOption != null){ config.setExcludeProperties(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION, WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION_LONG, optionMap); if (commandLineOption != null){ config.setSkeltonInterfaceName(commandLineOption.getOptionValue()); } commandLineOption = loadOption(WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION, WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION_LONG, optionMap); if (commandLineOption != null){ config.setSkeltonClassName(commandLineOption.getOptionValue()); } // setting the overrid and all ports options config.setAllPorts(loadOption(WSDL2JavaConstants.All_PORTS_OPTION, WSDL2JavaConstants.All_PORTS_OPTION_LONG, optionMap) != null); config.setOverride(loadOption(WSDL2JavaConstants.OVERRIDE_OPTION, WSDL2JavaConstants.OVERRIDE_OPTION_LONG, optionMap) != null); // loop through the map and find parameters having the extra prefix. //put them in the property map Iterator keyIterator = optionMap.keySet().iterator(); while (keyIterator.hasNext()) { Object key = keyIterator.next(); CommandLineOption option = (CommandLineOption)optionMap.get(key); if (key.toString().startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)) { //add this to the property map config.getProperties().put(key.toString().replaceFirst( WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX, ""), option.getOptionValue()); } } } private static CommandLineOption loadOption(String shortOption, String longOption, Map options) { //short option gets precedence CommandLineOption option = null; if (longOption != null) { option = (CommandLineOption)options.get(longOption); if (option != null) { return option; } } if (shortOption != null) { option = (CommandLineOption)options.get(shortOption); } return option; } } ./src/org/apache/axis2/wsdl/codegen/writer/0000775000175000017500000000000011767656530017723 5ustar brianbrian./src/org/apache/axis2/wsdl/codegen/writer/CBuildScriptWriter.java0000664000175000017500000000316511767656530024317 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; import java.io.FileOutputStream; public class CBuildScriptWriter extends FileWriter { public CBuildScriptWriter(File outputFileLocation,String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", "build", ".sh"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } } ./src/org/apache/axis2/wsdl/codegen/writer/CStubHeaderWriter.java0000664000175000017500000000463511767656530024124 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.util.XSLTTemplateProcessor; import org.w3c.dom.Document; import javax.xml.transform.URIResolver; import java.io.File; import java.io.FileOutputStream; public class CStubHeaderWriter extends FileWriter { public CStubHeaderWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public CStubHeaderWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", fileName, ".h"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } /** * Writes the output file. * * @param doc * @throws Exception */ public void parse(Document doc, URIResolver resolver) throws Exception { if (!fileExists) { XSLTTemplateProcessor.parse(this.stream, doc, this.xsltStream, resolver); this.stream.write('\n'); this.stream.write('\n'); this.stream.flush(); this.stream.close(); } } } ./src/org/apache/axis2/wsdl/codegen/writer/CStubSourceWriter.java0000664000175000017500000000467711767656530024202 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.util.XSLTTemplateProcessor; import org.w3c.dom.Document; import javax.xml.transform.URIResolver; import java.io.File; import java.io.FileOutputStream; public class CStubSourceWriter extends FileWriter { public CStubSourceWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public CStubSourceWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", fileName, getFileExtensionForLanguage(language)); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } /** * Writes the output file. * * @param doc * @throws Exception */ public void parse(Document doc, URIResolver resolver) throws Exception { if (!fileExists) { XSLTTemplateProcessor.parse(this.stream, doc, this.xsltStream, resolver); this.stream.write('\n'); this.stream.write('\n'); this.stream.flush(); this.stream.close(); } } } ./src/org/apache/axis2/wsdl/codegen/writer/SkeletonWriter.java0000664000175000017500000000230111767656530023543 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class SkeletonWriter extends FileWriter { public SkeletonWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public SkeletonWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/PolicyFileWriter.java0000664000175000017500000000313211767656530024021 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; import java.io.FileOutputStream; public class PolicyFileWriter extends FileWriter { public PolicyFileWriter(File outputFileLocation) { this.outputFileLocation = outputFileLocation; } public void createOutFile(String packageName, String fileName) throws Exception { File outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, packageName, fileName, ".xml"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } } ./src/org/apache/axis2/wsdl/codegen/writer/AntBuildWriter.java0000664000175000017500000000727211767656530023475 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.util.XSLTTemplateProcessor; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.w3c.dom.Document; import javax.xml.transform.URIResolver; import java.io.File; import java.io.FileOutputStream; import java.util.Iterator; import java.util.Map; public class AntBuildWriter extends FileWriter { private String databindingFramework = ConfigPropertyFileLoader.getDefaultDBFrameworkName(); public AntBuildWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public AntBuildWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void setDatabindingFramework(String databindingFramework) { this.databindingFramework = databindingFramework; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", "build", ".xml"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } //overridden to get the correct behavior protected String findTemplate(Map languageSpecificPropertyMap) { String ownClazzName = this.getClass().getName(); String key; String propertyValue; String templateName = null; Iterator keys = languageSpecificPropertyMap.keySet().iterator(); while (keys.hasNext()) { //check for template entries key = keys.next().toString(); if (key.endsWith(TEMPLATE_SUFFIX)) { // check if the class name is there propertyValue = languageSpecificPropertyMap.get(key).toString(); if (propertyValue.startsWith(ownClazzName)) { if (key.indexOf(databindingFramework) != -1) { templateName = propertyValue .substring(propertyValue.indexOf(SEPARATOR_STRING) + 1); break; } } } } return templateName; } /** * Writes the output file. * * @param doc * @throws Exception */ public void parse(Document doc, URIResolver resolver) throws Exception { if (!fileExists) { XSLTTemplateProcessor.parse(this.stream, doc, this.xsltStream, resolver); this.stream.flush(); this.stream.close(); } } } ./src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java0000664000175000017500000002403111767656530022676 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.description.AxisService; import org.apache.axis2.util.FileWriter; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.extensions.schema.Schema; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLWriter; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; public class WSDL11Writer { public static final String IMPORT_TAG = "import"; public static final String INCLUDE_TAG = "include"; public static final String SCHEMA_LOCATION = "schemaLocation"; private File baseFolder = null; private int count; public WSDL11Writer(File baseFolder) { this.baseFolder = baseFolder; this.count = 0; } public void writeWSDL(AxisService axisService) { try { if (axisService != null) { //create a output file File outputFile = FileWriter.createClassFile(baseFolder, null, axisService.getName(), ".wsdl"); FileOutputStream fos = new FileOutputStream(outputFile); axisService.printWSDL(fos); fos.flush(); fos.close(); } } catch (Exception e) { throw new RuntimeException("WSDL writing failed!", e); } } public void writeWSDL(AxisService axisService, Definition definition, Map changedMap) { try { if (axisService != null) { Map baseURIwsdlNameMap = new HashMap(); // add the initial definition to the map baseURIwsdlNameMap.put(definition.getDocumentBaseURI(),axisService.getName() + ".wsdl"); writeWSDL(definition, axisService.getName() + ".wsdl", changedMap, baseURIwsdlNameMap); } } catch (Exception e) { throw new RuntimeException("WSDL writing failed!", e); } } private void writeWSDL(Definition definition, String fileName, Map changedMap, Map baseURIwsdlNameMap) throws Exception { // first process the imports and save them. Map imports = definition.getImports(); if (imports != null && (imports.size() > 0)) { Vector importsVector = null; Import wsdlImport = null; String wsdlName = null; String wsdlLocation = null; for (Iterator improtsVectorIter = imports.values().iterator(); improtsVectorIter.hasNext();) { importsVector = (Vector)improtsVectorIter.next(); for (Iterator importsIter = importsVector.iterator(); importsIter.hasNext();) { wsdlImport = (Import)importsIter.next(); wsdlLocation = wsdlImport.getDefinition().getDocumentBaseURI(); // we have to process this wsdl file only if it has not been processed earlier if (!baseURIwsdlNameMap.containsKey(wsdlLocation)) { wsdlName = wsdlLocation.substring(wsdlLocation.lastIndexOf('/') + 1); if (!wsdlName.endsWith(".wsdl") && !wsdlName.endsWith(".xsd")){ // this seems to be an online wsdl so we generate a dummy name if (wsdlName.indexOf("xsd") > -1){ wsdlName = "xsd" + count++ + ".xsd"; } else { wsdlName = "wsdl" + count++ + ".wsdl"; } } //trim the wsdl part while (baseURIwsdlNameMap.containsValue(wsdlName)) { // import file name can either be xsd or wsdl String fileNamePart = wsdlName.substring(0,wsdlName.lastIndexOf(".")); String extension = wsdlName.substring(wsdlName.lastIndexOf(".")); wsdlName = fileNamePart + count++ + extension; } baseURIwsdlNameMap.put(wsdlLocation, wsdlName); Definition innerDefinition = wsdlImport.getDefinition(); writeWSDL(innerDefinition, wsdlName, changedMap, baseURIwsdlNameMap); } wsdlImport.setLocationURI((String)baseURIwsdlNameMap.get(wsdlLocation)); } } } // change the locations on the imported schemas adjustWSDLSchemaLocations(definition, changedMap); // finally save the file WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter(); File outputFile = FileWriter.createClassFile(baseFolder, null, fileName, null); FileOutputStream out = new FileOutputStream(outputFile); // we have a catch here // if there are multimple services in the definition object // we have to write only the relavent service. if (definition.getServices().size() > 1){ List removedServices = new ArrayList(); List servicesList = new ArrayList(); Map services = definition.getServices(); // populate the services list for (Iterator iter = services.values().iterator();iter.hasNext();){ servicesList.add(iter.next()); } Service service; String serviceNameFromFileName = fileName; if (fileName.indexOf(".wsdl") > -1){ serviceNameFromFileName = fileName.substring(0,fileName.lastIndexOf(".wsdl")); } if (fileName.indexOf(".xsd") > -1){ serviceNameFromFileName = fileName.substring(0,fileName.lastIndexOf(".xsd")); } for (Iterator iter = servicesList.iterator();iter.hasNext();){ service = (Service) iter.next(); if (!service.getQName().getLocalPart().equals(serviceNameFromFileName)){ definition.removeService(service.getQName()); removedServices.add(service); } } //now we have only the required service so write it wsdlWriter.writeWSDL(definition, out); // again add the removed services for (Iterator iter = removedServices.iterator(); iter.hasNext();){ service = (Service) iter.next(); definition.addService(service); } } else { // no problem proceed normaly wsdlWriter.writeWSDL(definition, out); } out.flush(); out.close(); } /** * @deprecated please use adjustWSDLSchemaLocations * @param definition * @param changedSchemaLocations */ public void adjustWSDLSchemaLocatins(Definition definition, Map changedSchemaLocations) { adjustWSDLSchemaLocations(definition, changedSchemaLocations); } /** * adjust the schema locations in the original wsdl * * @param definition * @param changedSchemaLocations */ public void adjustWSDLSchemaLocations(Definition definition, Map changedSchemaLocations) { Types wsdlTypes = definition.getTypes(); if (wsdlTypes != null) { List extensibilityElements = wsdlTypes.getExtensibilityElements(); Object currentObject; Schema schema; for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) { currentObject = iter.next(); if (currentObject instanceof Schema) { schema = (Schema)currentObject; changeLocations(schema.getElement(), changedSchemaLocations); } } } } private void changeLocations(Element element, Map changedSchemaLocations) { NodeList nodeList = element.getChildNodes(); String tagName; for (int i = 0; i < nodeList.getLength(); i++) { tagName = nodeList.item(i).getLocalName(); if (IMPORT_TAG.equals(tagName) || INCLUDE_TAG.equals(tagName)) { processImport(nodeList.item(i), changedSchemaLocations); } } } private void processImport(Node importNode, Map changedSchemaLocations) { NamedNodeMap nodeMap = importNode.getAttributes(); Node attribute; String attributeValue; for (int i = 0; i < nodeMap.getLength(); i++) { attribute = nodeMap.item(i); if (attribute.getNodeName().equals("schemaLocation")) { attributeValue = attribute.getNodeValue(); if (changedSchemaLocations.get(attributeValue) != null) { attribute.setNodeValue( (String)changedSchemaLocations.get(attributeValue)); } } } } } ./src/org/apache/axis2/wsdl/codegen/writer/InterfaceImplementationWriter.java0000664000175000017500000000242511767656530026574 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class InterfaceImplementationWriter extends FileWriter { public InterfaceImplementationWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public InterfaceImplementationWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.java0000664000175000017500000000344711767656530023754 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; import java.io.FileOutputStream; public class ServiceXMLWriter extends FileWriter { public ServiceXMLWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public ServiceXMLWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, packageName, "services", ".xml"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists || this.isOverride) { this.stream = new FileOutputStream(outputFile); } } } ./src/org/apache/axis2/wsdl/codegen/writer/CallbackHandlerWriter.java0000664000175000017500000000232511767656530024757 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class CallbackHandlerWriter extends FileWriter { public CallbackHandlerWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public CallbackHandlerWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/CSkelSourceWriter.java0000664000175000017500000000220711767656530024146 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class CSkelSourceWriter extends CStubSourceWriter { public CSkelSourceWriter(String outputFileLocation) { super(outputFileLocation); } public CSkelSourceWriter(File outputFileLocation, String language) { super(outputFileLocation, language); } } ./src/org/apache/axis2/wsdl/codegen/writer/ExceptionWriter.java0000664000175000017500000000230311767656530023717 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class ExceptionWriter extends FileWriter { public ExceptionWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public ExceptionWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/CSvcSkeletonWriter.java0000664000175000017500000000470211767656530024331 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.util.XSLTTemplateProcessor; import org.w3c.dom.Document; import javax.xml.transform.URIResolver; import java.io.File; import java.io.FileOutputStream; public class CSvcSkeletonWriter extends FileWriter { public CSvcSkeletonWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public CSvcSkeletonWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", fileName, getFileExtensionForLanguage(language)); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } /** * Writes the output file. * * @param doc * @throws Exception */ public void parse(Document doc, URIResolver resolver) throws Exception { if (!fileExists) { XSLTTemplateProcessor.parse(this.stream, doc, this.xsltStream, resolver); this.stream.write('\n'); this.stream.write('\n'); this.stream.flush(); this.stream.close(); } } } ./src/org/apache/axis2/wsdl/codegen/writer/InterfaceWriter.java0000664000175000017500000000230411767656530023662 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class InterfaceWriter extends FileWriter { public InterfaceWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public InterfaceWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java0000664000175000017500000000355311767656530022704 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.description.AxisService; import org.apache.axis2.util.FileWriter; import java.io.File; import java.io.FileOutputStream; public class WSDL20Writer { private File baseFolder = null; public WSDL20Writer(File baseFolder) { this.baseFolder = baseFolder; } public void writeWSDL(AxisService axisService) { try { if (axisService != null) { //create a output file File outputFile = FileWriter.createClassFile(baseFolder, null, axisService.getName(), ".wsdl"); FileOutputStream fos = new FileOutputStream(outputFile); axisService.printWSDL2(fos); fos.flush(); fos.close(); } } catch (Exception e) { throw new RuntimeException("WSDL writing failed!", e); } } } ./src/org/apache/axis2/wsdl/codegen/writer/CSkelHeaderWriter.java0000664000175000017500000000221011767656530024070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class CSkelHeaderWriter extends CStubHeaderWriter { public CSkelHeaderWriter(String outputFileLocation) { super(outputFileLocation); } public CSkelHeaderWriter(File outputFileLocation, String language) { super(outputFileLocation, language); } } ./src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java0000664000175000017500000000517211767656530023170 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.util.FileWriter; import org.apache.axis2.util.XMLPrettyPrinter; import org.apache.ws.commons.schema.XmlSchema; import javax.xml.transform.OutputKeys; import java.io.File; import java.io.FileOutputStream; import java.util.HashMap; import java.util.Map; /** A convenient class to write out the schemas into a file in the output location */ public class SchemaWriter { private File baseFolder = null; public SchemaWriter(File baseFolder) { this.baseFolder = baseFolder; } public void writeSchema(XmlSchema schema, String schemaFileName) { try { if (schema != null) { //create a output file File outputFile = FileWriter.createClassFile(baseFolder, null, schemaFileName.substring(0, schemaFileName.lastIndexOf( ".")), ".xsd"); FileOutputStream fos = new FileOutputStream(outputFile); //set the options for the schemas schema.write(fos,getDefaultOptionMap()); fos.flush(); fos.close(); XMLPrettyPrinter.prettify(outputFile); } } catch (Exception e) { throw new RuntimeException("Schema writing failed!", e); } } private Map getDefaultOptionMap(){ Map options = new HashMap(); options.put(OutputKeys.OMIT_XML_DECLARATION,"no"); options.put(OutputKeys.INDENT,"yes"); return options; } } ./src/org/apache/axis2/wsdl/codegen/writer/MessageReceiverWriter.java0000664000175000017500000000232411767656530025035 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class MessageReceiverWriter extends FileWriter { public MessageReceiverWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public MessageReceiverWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } }./src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java0000664000175000017500000000233311767656530025371 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class SkeletonInterfaceWriter extends FileWriter { public SkeletonInterfaceWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public SkeletonInterfaceWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/codegen/writer/CServiceXMLWriter.java0000664000175000017500000000336511767656530024056 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; import java.io.FileOutputStream; public class CServiceXMLWriter extends FileWriter { public CServiceXMLWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public CServiceXMLWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, "", "services", ".xml"); //set the existing flag fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } } } ./src/org/apache/axis2/wsdl/codegen/writer/FileWriter.java0000664000175000017500000001547111767656530022652 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.XSLTTemplateProcessor; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import javax.xml.transform.URIResolver; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.util.Iterator; import java.util.Map; public abstract class FileWriter { private static final Log log = LogFactory.getLog(FileWriter.class); protected File outputFileLocation = null; protected File outputFile = null; protected FileOutputStream stream = null; protected InputStream xsltStream = null; protected String language = ConfigPropertyFileLoader.getDefaultLanguage(); //default would java protected static final String TEMPLATE_SUFFIX = ".template"; protected static final String EXTENSION_SUFFIX = ".extension"; protected static final String SEPARATOR_STRING = ","; protected boolean fileExists = false;//a flag saying the file is existing protected boolean isOverride = false; /** * Sets the language. * * @param language */ public void setLanguage(String language) { this.language = language; } /** Loads the template. */ public void loadTemplate() throws CodeGenerationException { // the default behavior for the class writers is to use the property map from the languge specific types // The properties are arranged in the following order // .* .template=, //first get the language specific property map Class clazz = this.getClass(); Map languageSpecificPropertyMap = (Map)ConfigPropertyFileLoader.getLanguageSpecificPropertiesMap().get(this.language); if (languageSpecificPropertyMap == null) { throw new CodeGenerationException( CodegenMessages.getMessage("writer.noLangPropertiesExtension")); } String templateName = findTemplate(languageSpecificPropertyMap); if (templateName != null) { this.xsltStream = clazz.getResourceAsStream(templateName); } else { throw new CodeGenerationException(CodegenMessages.getMessage("writer.templateMissing")); } } protected String findTemplate(Map languageSpecificPropertyMap) { //search through the proprty names to find the template relevant to this class String ownClazzName = this.getClass().getName(); String key; String propertyValue; String templateName = null; Iterator keys = languageSpecificPropertyMap.keySet().iterator(); while (keys.hasNext()) { //check for template entries key = keys.next().toString(); if (key.endsWith(TEMPLATE_SUFFIX)) { // check if the class name is there propertyValue = languageSpecificPropertyMap.get(key).toString(); if (propertyValue.startsWith(ownClazzName)) { //bingo! we found the right template templateName = propertyValue.substring(propertyValue.indexOf(SEPARATOR_STRING) + 1); break; } } } return templateName; } /** * Creates the output file. * * @param packageName * @param fileName * @throws Exception */ public void createOutFile(String packageName, String fileName) throws Exception { outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation, packageName, fileName, getFileExtensionForLanguage(language)); //set the existing flag if (this.isOverride) { this.stream = new FileOutputStream(outputFile); } else { fileExists = outputFile.exists(); if (!fileExists) { this.stream = new FileOutputStream(outputFile); } else { log.info(Messages.getMessage("fileExistsNoOverwrite", outputFile.toString())); } } } /** * Finds the file name extension. * * @param language * @return Returns the file extension. */ protected String getFileExtensionForLanguage(String language) { Map languageSpecificPropertyMap = (Map)ConfigPropertyFileLoader.getLanguageSpecificPropertiesMap().get(this.language); Iterator keys = languageSpecificPropertyMap.keySet().iterator(); String key; String extension = null; while (keys.hasNext()) { //check for template entries key = keys.next().toString(); if (key.endsWith(EXTENSION_SUFFIX)) { extension = languageSpecificPropertyMap.get(key).toString(); //add a . to the front extension = "." + extension; } } return extension; } /** * Writes the output file. * * @param doc * @throws Exception */ public void parse(Document doc, URIResolver resolver) throws Exception { if (!fileExists) { XSLTTemplateProcessor.parse(this.stream, doc, this.xsltStream, resolver); this.stream.flush(); this.stream.close(); } } public boolean isOverride() { return isOverride; } public void setOverride(boolean override) { isOverride = override; } public File getOutputFile() { return outputFile; } public void setOutputFile(File outputFile) { this.outputFile = outputFile; } } ./src/org/apache/axis2/wsdl/codegen/writer/TestClassWriter.java0000664000175000017500000000230311767656530023666 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.codegen.writer; import java.io.File; public class TestClassWriter extends FileWriter { public TestClassWriter(String outputFileLocation) { this.outputFileLocation = new File(outputFileLocation); } public TestClassWriter(File outputFileLocation, String language) { this.outputFileLocation = outputFileLocation; this.language = language; } } ./src/org/apache/axis2/wsdl/WSDL2Java.java0000664000175000017500000000170011767656530017301 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; public class WSDL2Java { public static void main(String[] args) throws Exception { WSDL2Code.main(args); } } ./src/org/apache/axis2/wsdl/databinding/0000775000175000017500000000000011767656530017247 5ustar brianbrian./src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java0000664000175000017500000001404611767656530023655 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import org.apache.axiom.om.OMElement; import org.apache.axis2.namespace.Constants; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.wsdl.i18n.CodegenMessages; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public abstract class TypeMappingAdapter implements TypeMapper { /** * Default class name is the OMElement or the default case However the extensions can override * the default class to suit the databinding framework! */ protected String defaultClassName = OMElement.class.getName(); protected static final String XSD_SCHEMA_URL = Constants.URI_2001_SCHEMA_XSD; //hashmap that contains the type mapping names protected HashMap qName2NameMap = new HashMap(); //hashmap that contains the type mapping objects protected HashMap qName2ObjectMap = new HashMap(); //hashmap for keeping the status objects. protected HashMap qName2StatusMap = new HashMap(); //counter variable to generate unique parameter ID's protected int counter = 0; // this is to keep generated parameter names protected List parameterNameList = new ArrayList(); protected boolean isObject = false; //Upper limit for the paramete count protected static final int UPPER_PARAM_LIMIT = 1000; private static final String PARAMETER_NAME_SUFFIX = "param"; /** * Gets the type mapping name. If type mapping is not found, returns default. * * @see TypeMapper#getTypeMappingName(javax.xml.namespace.QName) */ public String getTypeMappingName(QName qname) { if ((qname != null)) { Object o = qName2NameMap.get(qname); if (o != null) { return (String)o; } else if (Constants.XSD_ANYTYPE.equals(qname) || Constants.XSD_ANY.equals(qname)) { return defaultClassName; } else if (Constants.XSD_STRING.equals(qname)) { return String.class.getName(); } else { throw new UnmatchedTypeException( CodegenMessages.getMessage("databinding.typemapper.typeunmatched", qname.getLocalPart(), qname.getNamespaceURI()) ); } } else { return null; } } /** @see TypeMapper#getParameterName(javax.xml.namespace.QName) */ public String getParameterName(QName qname) { if (counter == UPPER_PARAM_LIMIT) { counter = 0; } if ((qname != null) && (qname.getLocalPart().length() != 0)) { String paramName = JavaUtils.xmlNameToJavaIdentifier(qname.getLocalPart()); if (parameterNameList.contains(paramName)) { paramName = paramName + counter++; } parameterNameList.add(paramName); return paramName; } else { return PARAMETER_NAME_SUFFIX + counter++; } } /** @see TypeMapper#addTypeMappingName(javax.xml.namespace.QName,String) */ public void addTypeMappingName(QName qname, String value) { qName2NameMap.put(qname, value); } /** * @param qname * @return Returns object representing a specific form of the XSD compilation. * @see TypeMapper#getTypeMappingObject(javax.xml.namespace.QName) */ public Object getTypeMappingObject(QName qname) { return qName2ObjectMap.get(qname); } /** * return the class name for this QName * @param qname * @return return class names */ public Object getQNameToMappingObject(QName qname){ return qName2NameMap.get(qname); } /** * @param qname * @param value * @see TypeMapper#addTypeMappingObject(javax.xml.namespace.QName, Object) */ public void addTypeMappingObject(QName qname, Object value) { isObject = true; qName2ObjectMap.put(qname, value); } /** * @return Returns boolean. * @see TypeMapper#isObjectMappingPresent() */ public boolean isObjectMappingPresent() { return isObject; } /** @see TypeMapper#getAllMappedNames() */ public Map getAllMappedNames() { return qName2NameMap; } /** @see TypeMapper#getAllMappedObjects() */ public Map getAllMappedObjects() { return qName2ObjectMap; } /** @see TypeMapper#getDefaultMappingName() */ public String getDefaultMappingName() { return defaultClassName; } /** * @param defaultMapping * @see TypeMapper#setDefaultMappingName(String) */ public void setDefaultMappingName(String defaultMapping) { this.defaultClassName = defaultMapping; } /** * @param qName * @param status * @see TypeMapper#addTypeMappingStatus(javax.xml.namespace.QName, Object) */ public void addTypeMappingStatus(QName qName, Object status) { this.qName2StatusMap.put(qName, status); } /** * @param qName * @see TypeMapper#getTypeMappingStatus(javax.xml.namespace.QName) */ public Object getTypeMappingStatus(QName qName) { return this.qName2StatusMap.get(qName); } } ./src/org/apache/axis2/wsdl/databinding/JavaTypeMapper.java0000664000175000017500000000213311767656530023001 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; /** * The java type mapper can do without any default configuration However if any such default type * mappings are needed, they can be put inside the constructor */ public class JavaTypeMapper extends TypeMappingAdapter { public JavaTypeMapper() { } } ./src/org/apache/axis2/wsdl/databinding/UnmatchedTypeException.java0000664000175000017500000000242511767656530024546 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; /** A simple exception that will be thrown if a type is not matched! */ public class UnmatchedTypeException extends RuntimeException { public UnmatchedTypeException() { } public UnmatchedTypeException(String message) { super(message); } public UnmatchedTypeException(Throwable cause) { super(cause); } public UnmatchedTypeException(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axis2/wsdl/databinding/TypeMapper.java0000664000175000017500000000756311767656530022213 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import javax.xml.namespace.QName; import java.util.Map; public interface TypeMapper { /** * Returns whether the mapping is the object type or the normal class name type * * @return Returns boolean. */ public boolean isObjectMappingPresent(); /** * Gets the type mapping class name. * * @param qname name of the XML element to be mapped * @return Returns a string that represents the particular type. */ public String getTypeMappingName(QName qname); /** * Gets the type mapping Object. * * @param qname name of the XML element to be mapped * @return Returns an Object that represents the particular class in a pre specified form. It * can be a specific format to the databinding framework used. This allows tight * integrations with the databinding framework, allowing the emitter to write the * databinding classes in its own way. */ public Object getTypeMappingObject(QName qname); public Object getQNameToMappingObject(QName qname); /** * Gets the parameter name. * * @param qname name of the XML element to get a parameter * @return Returns a unique parameter name. */ public String getParameterName(QName qname); /** * Adds a type mapping name to the type mapper. * * @param qname * @param value * @see #getTypeMappingName(javax.xml.namespace.QName) */ public void addTypeMappingName(QName qname, String value); /** * Adds a type mapping object to the type mapper. * * @param qname the xml Qname that this type refers to * @param value the type mapping object * @see #getTypeMappingObject(javax.xml.namespace.QName) */ public void addTypeMappingObject(QName qname, Object value); /** @return Returns a map containing all type mapping names i.e. Qname to classname */ public Map getAllMappedNames(); /** @return Returns a map containing all type mapping model objects i.e. Qname to model objects */ public Map getAllMappedObjects(); /** @return the default mapping name for this type mapper */ public String getDefaultMappingName(); /** * Sets the default type mapping - the databinders may change the default mapping to suit their * default mapping * * @param defaultMapping */ public void setDefaultMappingName(String defaultMapping); /** * Allows the storage of a status object with a mapping to the qname. This may be used to store * certain status information that will be used by different type mappers. A given type mapper * may choose not to implement this! * * @param qname * @param status */ public void addTypeMappingStatus(QName qName, Object status); /** * Returns the relevant status object given the qName of the xml element * * @param qName * @return the status object * @see #addTypeMappingStatus(javax.xml.namespace.QName, Object) */ public Object getTypeMappingStatus(QName qName); } ./src/org/apache/axis2/wsdl/databinding/CUtils.java0000664000175000017500000001133511767656530021320 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import java.text.Collator; import java.util.Arrays; import java.util.Locale; public class CUtils { static final String keywords[] = { // c/ c++ keywords "asm", "auto", "bool", "break", "break", "case", "catch", "char", "class", "const", "const_cast", "continue", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "operator", "private", "protected", "public", "register", "reinterpret_cast", "return", "short", "signed", "sizeof", "static", "static_cast", "struct", "switch", "template", "this", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", //microsoft c++ keywords reference: http://msdn2.microsoft.com/en-US/library/2e6a4at9(VS.80).aspx "__abstract", "abstract", "__alignof Operator", "array", "__asm", "__assume", "__based", "bool", "__box", "break", "case", "catch", "__cdecl", "char", "class", "const", "const_cast", "continue", "__declspec", "default", "__delegate", "delegate", "delete", "deprecated", "dllexport", "dllimport", "do", "double", "dynamic_cast", "else", "enum", "enum class", "enum struct", "event", "__event", "__except", "explicit", "extern", "false", "__fastcall", "__finally", "finally", "float", "for", "for each", "in", "__forceinline", "friend", "friend_as", "__gc", "gcnew", "generic", "goto", "__hook", "__identifier", "if", "__if_exists", "__if_not_exists", "initonly", "__inline", "inline", "int", "__int8", "__int16", "__int32", "__int64", "__interface", "interface class", "interface struct", "interior_ptr", "__leave", "literal", "long", "__m64", "__m128", "__m128d", "__m128i", "__multiple_inheritance", "mutable", "naked", "namespace", "new", "new", "__nogc", "noinline", "__noop", "noreturn", "nothrow", "novtable", "nullptr", "operator", "__pin", "private", "__property", "property", "property", "protected", "public", "__raise", "ref struct", "ref class", "register", "reinterpret_cast", "return", "safecast", "__sealed", "sealed", "selectany", "short", "signed", "__single_inheritance", "sizeof", "static", "static_cast", "__stdcall", "struct", "__super", "switch", "template", "this", "thread", "throw", "true", "try", "__try/__except", "__try/__finally", "__try_cast", "typedef", "typeid", "typeid", "typename", "__unaligned", "__unhook", "union", "unsigned", "using declaration", "using directive", "uuid", "__uuidof", "value struct", "value class", "__value", "virtual", "__virtual_inheritance", "void", "volatile", "__w64", "__wchar_t", "wchar_t", "while", }; /** Collator for comparing the strings */ static final Collator englishCollator = Collator.getInstance(Locale.ENGLISH); /** Use this character as suffix */ static final char keywordPrefix = '_'; /** * Checks if the input string is a valid C keyword. * * @return Returns boolean. */ public static boolean isCKeyword(String keyword) { return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0); } /** * Turns a C keyword string into a non-C keyword string. (Right now this simply means appending * an underscore.) */ public static String makeNonCKeyword(String keyword) { return keywordPrefix + keyword ; } } ./src/org/apache/axis2/wsdl/databinding/CDefaultTypeMapper.java0000775000175000017500000000255211767656530023617 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import javax.xml.namespace.QName; public class CDefaultTypeMapper extends TypeMappingAdapter { private String defaultStructName = "axiom_node_t*"; public CDefaultTypeMapper() { } /** * Gets the type mapping name. always returns the default mapping * * @see TypeMapper#getTypeMappingName(javax.xml.namespace.QName) */ public String getTypeMappingName(QName qname) { if ((qname != null)) { return defaultStructName; } else { return null; } } } ./src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java0000664000175000017500000000257711767656530023520 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import javax.xml.namespace.QName; /** The default type mapper. This type mapper has no default configurations */ public class DefaultTypeMapper extends TypeMappingAdapter { public DefaultTypeMapper() { } /** * Gets the type mapping name. always returns the default mapping * * @see TypeMapper#getTypeMappingName(javax.xml.namespace.QName) */ public String getTypeMappingName(QName qname) { if ((qname != null)) { return defaultClassName; } else { return null; } } } ./src/org/apache/axis2/wsdl/databinding/CTypeMapper.java0000664000175000017500000000405111767656530022303 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.databinding; import org.apache.axis2.namespace.Constants; import org.apache.axis2.wsdl.i18n.CodegenMessages; import javax.xml.namespace.QName; public class CTypeMapper extends TypeMappingAdapter { private String defaultStructName = "axiom_node_t*"; public CTypeMapper() { } public String getTypeMappingName(QName qname) { if ((qname != null)) { Object o = qName2NameMap.get(qname); if (o != null) { return (String)o; } else if (Constants.XSD_ANYTYPE.equals(qname) || Constants.XSD_ANY.equals(qname)) { return defaultStructName; } else { throw new UnmatchedTypeException( CodegenMessages.getMessage("databinding.typemapper.typeunmatched", qname.getLocalPart(), qname.getNamespaceURI()) ); } } else { return null; } } public String getDefaultMappingName() { return defaultStructName; } public void setDefaultMappingName(String defaultMapping) { this.defaultStructName = defaultMapping; } } ./src/org/apache/axis2/wsdl/i18n/0000775000175000017500000000000011767656530015562 5ustar brianbrian./src/org/apache/axis2/wsdl/i18n/resource.properties0000664000175000017500000002455411767656530021541 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # # Translation instructions. # 1. Each message line is of the form key=value. # Translate the value, DO NOT translate the key. # 2. The messages may contain arguments that will be filled in # by the runtime. These are of the form: {0}, {1}, etc. # These must appear as is in the message, though the order # may be changed to support proper language syntax. # 3. If a single quote character is to appear in the resulting # message, it must appear in this file as two consecutive # single quote characters. # 4. Lines beginning with "#" (like this one) are comment lines # and may contain translation instructions. They need not be # translated unless your translated file, rather than this file, # will serve as a base for other translators. # ################## WSDL2Code ###################################### wsdl2code.arg=Usage: WSDL2Java [options] -uri : A url or path to a WSDL wsdl2code.arg1=\nwhere [options] include: wsdl2code.arg2= -o Specify a directory path for the generated code. wsdl2code.arg3= -a Generate async style code only (Default: off). wsdl2code.arg4= -s Generate sync style code only (Default: off). Takes precedence over -a. wsdl2code.arg5= -p Specify a custom package name for the generated code. wsdl2code.arg6= -l Valid languages are java and c (Default: java). wsdl2code.arg7= -t Generate a test case for the generated code. wsdl2code.arg8= -ss Generate server side code (i.e. skeletons) (Default: off). wsdl2code.arg9= -sd Generate service descriptor (i.e. services.xml). (Default: off). Valid with -ss. wsdl2code.arg10= -d Valid databinding(s) are adb, xmlbeans, jibx and jaxbri (Default: adb). wsdl2code.arg11= -g Generates all the classes. Valid only with -ss. wsdl2code.arg12= -pn Choose a specific port when there are multiple ports in the wsdl. wsdl2code.arg13= -sn Choose a specific service when there are multiple services in the wsdl. wsdl2code.arg14= -u Unpacks the databinding classes wsdl2code.arg15= -r Specify a repository against which code is generated. wsdl2code.arg16= -ns2p ns1=pkg1,ns2=pkg2 Specify a custom package name for each namespace specified in the wsdl's schema. wsdl2code.arg17= -ssi Generate an interface for the service implementation (Default: off). wsdl2code.arg18= -wv WSDL Version. Valid Options : 2, 2.0, 1.1 wsdl2code.arg19= -S Specify a directory path for generated source wsdl2code.arg20= -R Specify a directory path for generated resources wsdl2code.arg21= -em Specify an external mapping file wsdl2code.arg22= -f Flattens the generated files wsdl2code.arg23= -uw Switch on un-wrapping. wsdl2code.arg24= -xsdconfig Use XMLBeans .xsdconfig file. Valid only with -d xmlbeans. wsdl2code.arg25= -ap Generate code for all ports wsdl2code.arg26= -or Overwrite the existing classes wsdl2code.arg27= -b Generate Axis 1.x backword compatible code. wsdl2code.arg28= -sp Suppress namespace prefixes (Optimzation that reduces size of soap request/response) wsdl2code.arg29= -E Extra configuration options specific to certain databindings. Examples: wsdl2code.arg30= \t\t\t -Ebindingfile (for jibx) - specify the file path for the binding file wsdl2code.arg31= \t\t\t -Etypesystemname (for xmlbeans) - override the randomly generated type system name wsdl2code.arg32= \t\t\t -Ejavaversion 1.5 (for xmlbeans) - generates Java 1.5 code (typed lists instead of arrays) wsdl2code.arg33= \t\t\t -Emp (for ADB) - extension mapper package name wsdl2code.arg34= \t\t\t -Eosv (for ADB) - turn off strict validation. wsdl2code.arg35= \t\t\t -Ewdc (for xmlbeans) - Generate code with a dummy schema. if someone use this option wsdl2code.arg36= \t\t\t they have to generate the xmlbeans code seperately with the scomp command comes with the wsdl2code.arg37= \t\t\t xmlbeans distribution and replace the Axis2 generated classes with correct classes wsdl2code.arg38= --noBuildXML Don't generate the build.xml in the output directory wsdl2code.arg39= --noWSDL Don't generate WSDL's in the resources directory wsdl2code.arg40= --noMessageReceiver Don't generate a MessageReceiver in the generated sources wsdl2code.arg41= --http-proxy-host Proxy host address if you are behind a firewall wsdl2code.arg42= --http-proxy-port Proxy prot address if you are behind a firewall wsdl2code.arg43= -ep Exclude packages - these packages are deleted after codegeneration wsdl2code.arg44= -sin Skelton interface name - used to specify a name for skelton interface other than the default one wsdl2code.arg45= -scn Skelton class name - used to specify a name for skelton class other than the default one ################## prop file loader ################################# propfileload.frameworkMismatch=Number of frameworks and extension names do not match! propfileload.unknownFramework=Unknown framework specified for default! propfileload.emitterMissing=No emitters found! propfileload.unknownDefaultLang=Unknown Language specified for default! propfileload.generalException=Exception while loading the property file ################# template resolver ################################# resolver.templateNotFound={0} template not found! ################### Codegen engine ################################### engine.wsdlParsingException=Error parsing WSDL engine.invalidWsdlLocation=Invalid WSDL Location engine.noProperDatabindingException=Unable to use specified databinding! engine.emitterMissing=Emitter class not found! engine.wrongEmitter=Non emitter class found! engine.extensionLoadProblem=Extension class loading problem engine.extensionInstantiationProblem=Extension class instantiation problem engine.illegalExtension=Illegal extension! ################### Options ################################### options.notADirectoryException=The specified output location is not a directory! options.nomappingFile=Unable to load mapping file! options.noFile=The specified output location is not a directory! writer.noLangPropertiesExtension=No language specific properties!!! writer.templateMissing=template for this writer is not found! extension.bindingMissing=bindings are not present in the original document extension.noProperDatabinding=No proper databinding has taken place extension.invalidWSDL=Invalid WSDL: The WSDL Types Schema does not define a targetNamespace in {0} extension.additionalSchemaFailure=Additional schema loading failed!! extension.encodedNotSupported=The use 'encoded' is not supported! extension.databindingMismatch=The specified databinding frameworks do not match! extension.unhandledSchemaConstruct=Unhandled schema construct! extension.unsupportedforunwrapping=Unsupported framework for unwrapping! extension.unsupportedSchemaFormat=Unsupported Schema format for unwrapping! found {0} but expected {1} emitter.unknownStyle=Unknown code generation style {0} emitter.cannotFindBinding=Cannot find a binding!! emitter.logEntryInterface1=Interface mode is selected.The following items will not be generated emitter.logEntryInterface2=1. Message Receiver emitter.logEntryInterface3=2. Stub emitter.logEntryInterface4=3. CallbackHandler emitter.logEntryInterface5=4. Test Classes emitter.logEntryInterface6=5. Databinding Supporters emitter.coreclassNameError=Cannot form the core class name emitter.serviceNotFoundError=specified service {0} not found emitter.endpointNotFoundError=specified end point {0} not found emitter.noEndpointsFoundError=endpoints not found emitter.warningMultipleServices=Warning - Multiple services found - picking the first service! emitter.warningMultipleEndpoints=Warning - Multiple endpoints found - picking the first endpoint! emitter.switchingMessages=Warning -No services found - switched to the interface mode! emitter.warningMultiplePorttypes=Warning - Found multiple porttypes - picking the first # Type mappers databinding.typemapper.typeunmatched=No type was mapped to the name {0} with namespace {1} databinding.typemapper.typeunmatched.null=No type can be matched to a null QName! ##################### java2WSDL java2wsdl.arg1=Usage java2wsdl -cn : class file name java2wsdl.arg2=-o : output file location java2wsdl.arg3=-cp : list of classpath entries - (urls) java2wsdl.arg4=-tn : target namespace java2wsdl.arg5=-tp : target namespace prefix java2wsdl.arg6=-stn : target namespace for schema java2wsdl.arg7=-stp : target namespace prefix for schema java2wsdl.arg8=-sn : service name java2wsdl.arg9=-of : output file name for the WSDL java2wsdl.generalError=An error occured while generating code java2wsdl.notAFolder=The specivied location {0} is not a folder java2wsdl.classIsMust=class name must be present! ./src/org/apache/axis2/wsdl/i18n/CodegenMessages.java0000664000175000017500000001373011767656530021465 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl.i18n; import org.apache.axis2.i18n.MessageBundle; import org.apache.axis2.i18n.MessagesConstants; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * @see org.apache.axis2.i18n.Messages The implementation is the same but just thisClass static * reference has CodegenMessages.class */ public class CodegenMessages { //Only this changes from the original class private static Class thisClass = CodegenMessages.class; private static final String projectName = MessagesConstants.projectName; private static final String resourceName = MessagesConstants.resourceName; private static final Locale locale = MessagesConstants.locale; private static final String packageName = getPackage(thisClass.getName()); private static final ClassLoader classLoader = thisClass.getClassLoader(); private static final ResourceBundle parent = (MessagesConstants.rootPackageName.equals(packageName)) ? null : MessagesConstants.rootBundle; /** ** NO NEED TO CHANGE ANYTHING BELOW **** */ private static final MessageBundle messageBundle = new MessageBundle(projectName, packageName, resourceName, locale, classLoader, parent); /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @return Returns the formatted message. */ public static String getMessage(String key) throws MissingResourceException { return messageBundle.getMessage(key); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0) throws MissingResourceException { return messageBundle.getMessage(key, arg0); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getMessage(String key, String[] args) throws MissingResourceException { return messageBundle.getMessage(key, args); } public static ResourceBundle getResourceBundle() { return messageBundle.getResourceBundle(); } public static MessageBundle getMessageBundle() { return messageBundle; } private static String getPackage(String name) { return name.substring(0, name.lastIndexOf('.')).intern(); } } ./src/org/apache/axis2/wsdl/HTTPHeaderMessage.java0000664000175000017500000000273111767656530021046 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; import javax.xml.namespace.QName; public class HTTPHeaderMessage { // Holds the QName of the type attribute private QName qName; // Holds the value of the name attribute private String name; private boolean required; public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public QName getqName() { return qName; } public void setqName(QName qName) { this.qName = qName; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ./src/org/apache/axis2/wsdl/WSDLUtil.java0000664000175000017500000000566311767656530017267 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; import org.apache.axis2.description.WSDL2Constants; import javax.xml.namespace.QName; /** * Some utility methods for the WSDL users */ public class WSDLUtil { /** * returns whether the given mep uri is one of the * input meps * * @param mep */ public static boolean isInputPresentForMEP(String mep) { return WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mep) || WSDL2Constants.MEP_URI_IN_ONLY.equals(mep) || WSDL2Constants.MEP_URI_IN_OUT.equals(mep) || WSDL2Constants.MEP_URI_OUT_IN.equals(mep) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mep) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep); } /** * returns whether the given mep URI is one of the output meps * * @param MEP */ public static boolean isOutputPresentForMEP(String MEP) { return WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_IN.equals(MEP) || WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP); } /** * part names are not unique across messages. Hence * we need some way of making the part name a unique * one (due to the fact that the type mapper * is a global list of types). * The seemingly best way to do that is to * specify a namespace for the part QName reference which * is stored in the list. This part qname is * temporary and should not be used with it's * namespace URI (which happened to be the operation name) * with _input (or a similar suffix) attached to it * * @param opName * @param suffix * @param partName */ public static QName getPartQName(String opName, String suffix, String partName) { return new QName(opName + suffix, partName); } } ./src/org/apache/axis2/wsdl/template/0000775000175000017500000000000011767656530016616 5ustar brianbrian./src/org/apache/axis2/wsdl/template/c/0000775000175000017500000000000011767656530017040 5ustar brianbrian./src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl0000664000175000017500000001104211767656530023341 0ustar brianbrian /** * .c * * This file was auto-generated from WSDL for "" service * by the Apache Axis2/C version: #axisVersion# #today# * Axis2/C skeleton for the axisService */ #include ".h" adb__t* /** * auto generated function definition signature * for "" operation. * * @param * * @param dp_ - output header * @return * @param */ axis2_status_t _ (const axutil_env_t *env , adb__t* , adb__t** dp_ /* output header double ptr*/ ) { /* TODO fill this with the necessary business logic */ return NULL; return AXIS2_SUCCESS; } ./src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl0000664000175000017500000000427711767656530023257 0ustar brianbrian This file was auto-generated from WSDL by the Apache Axis2 version: #axisVersion# #today# Service wsamapping ./src/org/apache/axis2/wsdl/template/c/BuildScriptTemplate.xsl0000664000175000017500000000414111767656530023510 0ustar brianbrian gcc -g -shared -olib.so -I $AXIS2C_HOME/include/axis2-1.3.1/ -I -L$AXIS2C_HOME/lib \ -laxutil \ -laxis2_axiom \ -laxis2_engine \ -laxis2_parser \ -lpthread \ -laxis2_http_sender \ -laxis2_http_receiver \ -lguththila \ *.c /*.c gcc -g -shared -olib.so -I $AXIS2C_HOME/include/axis2-1.3.1/ -L$AXIS2C_HOME/lib \ -laxutil \ -laxis2_axiom \ -laxis2_engine \ -laxis2_parser \ -lpthread \ -laxis2_http_sender \ -laxis2_http_receiver \ -lguththila \ *.c ./src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl0000664000175000017500000001212611767656530023275 0ustar brianbrian /** * .h * * This file was auto-generated from WSDL for "" service * by the Apache Axis2/C version: #axisVersion# #today# * Axis2/C skeleton for the axisService- Header file */ #include <axis2_svc_skeleton.h> #include <axutil_log_default.h> #include <axutil_error_default.h> #include <axiom_text.h> #include <axiom_node.h> #include <axiom_element.h> #include <stdio.h> adb_ #include ".h" adb_ #include ".h" #ifdef __cplusplus extern "C" { #endif adb__t* /** * auto generated function declaration * for "" operation. * * @param * * @param dp_ - output header * @return * @param */ axis2_status_t _ (const axutil_env_t *env , adb__t* , adb__t** dp_ /* output header double ptr*/ ); #ifdef __cplusplus } #endif ./src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl0000664000175000017500000002770211767656530023322 0ustar brianbrian /** * .h * * This file was auto-generated from WSDL for "" service * by the Apache Axis2/Java version: #axisVersion# #today# */ #include <stdio.h> #include <axiom.h> #include <axutil_utils.h> #include <axiom_soap.h> #include <axis2_client.h> #include <axis2_stub.h> adb_ #include ".h" adb_ #include ".h" #ifdef __cplusplus extern "C" { #endif /***************** function prototypes - for header file *************/ /** * axis2_stub_create_ * Create and return the stub with services populated * @param env Environment ( mandatory) * @param client_home Axis2/C home ( mandatory ) * @param endpoint_uri Service endpoint uri( optional ) - if NULL default picked from WSDL used * @return Newly created stub object */ axis2_stub_t* axis2_stub_create_(const axutil_env_t *env, axis2_char_t *client_home, axis2_char_t *endpoint_uri); /** * axis2_stub_populate_services_for_ * populate the svc in stub with the service and operations * @param stub The stub * @param env environment ( mandatory) */ void axis2_stub_populate_services_for_( axis2_stub_t *stub, const axutil_env_t *env); /** * axis2_stub_get_endpoint_uri_of_ * Return the endpoint URI picked from WSDL * @param env environment ( mandatory) * @return The endpoint picked from WSDL */ axis2_char_t * axis2_stub_get_endpoint_uri_of_(const axutil_env_t *env); adb__t* /** * Auto generated function declaration * for "" operation. * @param stub The stub (axis2_stub_t) * @param env environment ( mandatory) * * @param _ * * @param dp_ - output header * @return */ axis2_status_t axis2_stub_op__( axis2_stub_t *stub, const axutil_env_t *env, adb__t* _ , adb__t** dp_ /* output header double ptr*/ ); /** * Auto generated function for asynchronous invocations * for "" operation. * @param stub The stub * @param env environment ( mandatory) * @param _ * @param user_data user data to be accessed by the callbacks * @param on_complete callback to handle on complete * @param on_error callback to handle on error */ adb__t* axutil__t* axis2__t* void axis2_stub_start_op__( axis2_stub_t *stub, const axutil_env_t *env, adb__t* _ , void *user_data, axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, _, adb__t* _ , void *data) , axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data) ); /** * function to free any soap input headers * @param env environment ( mandatory) */ void axis2_stub_op___free_input_headers(const axutil_env_t *env, , adb__t* _ ); /** * function to free any soap output headers * @param env environment ( mandatory) */ void axis2_stub_op___free_output_headers(const axutil_env_t *env, , adb__t* _ ); #ifdef __cplusplus } #endif ./src/org/apache/axis2/wsdl/template/c/package.html0000664000175000017500000000167111767656530021326 0ustar brianbrian This package is a "non class containing" one that has the xsl templates for the c class generation ./src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl0000664000175000017500000013674711767656530023404 0ustar brianbrian /** * .c * * This file was auto-generated from WSDL for "" service * by the Apache Axis2/Java version: #axisVersion# #today# */ #include ".h" #include <axis2_msg.h> /** * C implementation */ axis2_stub_t* axis2_stub_create_(const axutil_env_t *env, axis2_char_t *client_home, axis2_char_t *endpoint_uri) { axis2_stub_t *stub = NULL; axis2_endpoint_ref_t *endpoint_ref = NULL; AXIS2_FUNC_PARAM_CHECK (client_home, env, NULL) if (NULL == endpoint_uri) { endpoint_uri = axis2_stub_get_endpoint_uri_of_(env); } endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri); stub = axis2_stub_create_with_endpoint_ref_and_client_home (env, endpoint_ref, client_home); if (NULL == stub) { if(NULL != endpoint_ref) { axis2_endpoint_ref_free(endpoint_ref, env); } return NULL; } axis2_stub_populate_services_for_(stub, env); return stub; } void axis2_stub_populate_services_for_(axis2_stub_t *stub, const axutil_env_t *env) { axis2_svc_client_t *svc_client = NULL; axutil_qname_t *svc_qname = NULL; axutil_qname_t *op_qname = NULL; axis2_svc_t *svc = NULL; axis2_op_t *op = NULL; axis2_op_t *annon_op = NULL; axis2_msg_t *msg_out = NULL; axis2_msg_t *msg_in = NULL; axis2_msg_t *msg_out_fault = NULL; axis2_msg_t *msg_in_fault = NULL; /* Modifying the Service */ svc_client = axis2_stub_get_svc_client (stub, env ); svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client, env ); annon_op = axis2_svc_get_op_with_name(svc, env, AXIS2_ANON_OUT_IN_OP); msg_out = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT); msg_in = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN); msg_out_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT_FAULT); msg_in_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN_FAULT); svc_qname = axutil_qname_create(env,"" ,NULL, NULL); axis2_svc_set_qname (svc, env, svc_qname); /* creating the operations*/ op_qname = axutil_qname_create(env, "" , "", NULL); op = axis2_op_create_with_qname(env, op_qname); axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_IN_ONLY); axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN); axis2_msg_increment_ref(msg_out, env); axis2_msg_increment_ref(msg_in, env); axis2_msg_increment_ref(msg_out_fault, env); axis2_msg_increment_ref(msg_in_fault, env); axis2_op_add_msg(op, env, AXIS2_MSG_OUT, msg_out); axis2_op_add_msg(op, env, AXIS2_MSG_IN, msg_in); axis2_op_add_msg(op, env, AXIS2_MSG_OUT_FAULT, msg_out_fault); axis2_op_add_msg(op, env, AXIS2_MSG_IN_FAULT, msg_in_fault); axis2_svc_add_op(svc, env, op); } /** *return end point picked from wsdl */ axis2_char_t* axis2_stub_get_endpoint_uri_of_( const axutil_env_t *env ) { axis2_char_t *endpoint_uri = NULL; /* set the address from here */ endpoint_uri = ""; return endpoint_uri; } adb__t* axutil__t* axis2__t* /** * auto generated method signature * for "" operation. * * @param _ * * @param dp_ - output header * @return */ void axis2_stub_op__( axis2_stub_t *stub, const axutil_env_t *env, adb__t* _ , adb__t** dp_ /* output header double ptr*/ ) { axis2_svc_client_t *svc_client = NULL; axis2_options_t *options = NULL; axiom_node_t *ret_node = NULL; const axis2_char_t *soap_action = NULL; axutil_qname_t *op_qname = NULL; axiom_node_t *payload = NULL; axis2_bool_t is_soap_act_set = AXIS2_TRUE; axutil_string_t *soap_act = NULL; ret_val = NULL; axiom_node_t *input_header = NULL; axis2_op_client_t *op_client = NULL; const axis2_msg_ctx_t *msg_ctx = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *header_base_node = NULL; axiom_node_t *output_header = NULL; adb__t* _ = NULL; payload = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); payload = _; svc_client = axis2_stub_get_svc_client(stub, env ); input_header = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); input_header = _; axis2_svc_client_add_header(svc_client, env, input_header); options = axis2_stub_get_options( stub, env); if (NULL == options) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub"); return NULL; } soap_action = axis2_options_get_action( options, env ); if (NULL == soap_action) { is_soap_act_set = AXIS2_FALSE; soap_action = ""; soap_act = axutil_string_create(env, ""); axis2_options_set_soap_action(options, env, soap_act); axis2_options_set_action( options, env, soap_action ); } axis2_options_set_soap_version(options, env, AXIOM_SOAP12 ); axis2_options_set_soap_version(options, env, AXIOM_SOAP11 ); ret_node = axis2_svc_client_send_receive_with_op_qname( svc_client, env, op_qname, payload); if (!is_soap_act_set) { axis2_options_set_soap_action(options, env, NULL); axis2_options_set_action( options, env, NULL); } op_client = axis2_svc_client_get_op_client(svc_client, env); if(!op_client) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "op client is NULL"); return NULL; } msg_ctx = axis2_op_client_get_msg_ctx(op_client, env, AXIS2_WSDL_MESSAGE_LABEL_OUT); if(!msg_ctx) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "response msg ctx is NULL"); return NULL; } res_soap_env = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env); if(!res_soap_env) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "response evelope is NULL"); return NULL; } res_soap_header = axiom_soap_envelope_get_header(res_soap_env, env); if(res_soap_header) { header_base_node = axiom_soap_header_get_base_node(res_soap_header, env); } if(!header_base_node) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Required response header is NULL"); } output_header = axiom_node_get_first_child(header_base_node, env); while(output_header && axiom_node_get_node_type(output_header, env) != AXIOM_ELEMENT) { output_header = axiom_node_get_next_sibling(output_header, env); } output_header = axiom_node_get_next_sibling(output_header, env); while(output_header && axiom_node_get_node_type(output_header, env) != AXIOM_ELEMENT) { output_header = axiom_node_get_next_sibling(output_header, env); } _ if( NULL == output_header) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Response header is NULL"); /* you can't have a response header NULL, just free things and exit */ axis2_stub_op___free_output_headers(env, , _ ); return; return NULL; } /* you can have these parameters NULL, to avoid deserializing them */ if(dp_) { = adb__create(env); if(adb__deserialize(, env, &output_header, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the _deserialize: " "This should be due to an invalid output header"); axis2_stub_op___free_output_headers(env, , _ ); return; return NULL; } _ = input_header; *dp_ = _; } return; if ( NULL == ret_node ) { return NULL; } ret_val = adb__create(env); if(adb__deserialize(ret_val, env, &ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { if(ret_val != NULL) { adb__free(ret_val, env); } AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the _deserialize: " "This should be due to an invalid XML"); return NULL; } return ret_val; return ret_node; } adb__t* axutil__t* axis2__t* struct axis2_stub___callback_data { void *data; axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, _, adb__t* , void *data); axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data); }; static axis2_status_t AXIS2_CALL axis2_stub_on_error__(axis2_callback_t *callback, const axutil_env_t *env, int exception) { axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int, void *data); struct axis2_stub___callback_data* callback_data = NULL; void *user_data = NULL; axis2_status_t status; callback_data = (struct axis2_stub___callback_data*)axis2_callback_get_data(callback); user_data = callback_data->data; on_error = callback_data->on_error; status = on_error(env, exception, user_data); if(callback_data) { AXIS2_FREE(env->allocator, callback_data); } return status; } axis2_status_t AXIS2_CALL axis2_stub_on_complete__(axis2_callback_t *callback, const axutil_env_t *env) { axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, _, adb__t* , void *data); struct axis2_stub___callback_data* callback_data = NULL; void *user_data = NULL; axis2_status_t status = AXIS2_SUCCESS; ret_val = NULL; axiom_node_t *ret_node = NULL; axiom_soap_envelope_t *soap_envelope = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *header_base_node = NULL; axiom_node_t *output_header = NULL; adb__t* _ = NULL; callback_data = (struct axis2_stub___callback_data*)axis2_callback_get_data(callback); soap_envelope = axis2_callback_get_envelope(callback, env); if(soap_envelope) { axiom_soap_body_t *soap_body; soap_body = axiom_soap_envelope_get_body(soap_envelope, env); if(soap_body) { axiom_node_t *body_node = axiom_soap_body_get_base_node(soap_body, env); if(body_node) { ret_node = axiom_node_get_first_child(body_node, env); } } res_soap_header = axiom_soap_envelope_get_header(soap_envelope, env); if(res_soap_header) { header_base_node = axiom_soap_header_get_base_node(res_soap_header, env); } if(!header_base_node) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Required response header is NULL"); } if(header_base_node) { if(status == AXIS2_SUCCESS) { output_header = axiom_node_get_first_child(header_base_node, env); while(output_header && axiom_node_get_node_type(output_header, env) != AXIOM_ELEMENT) { output_header = axiom_node_get_next_sibling(output_header, env); } output_header = axiom_node_get_next_sibling(output_header, env); while(output_header && axiom_node_get_node_type(output_header, env) != AXIOM_ELEMENT) { output_header = axiom_node_get_next_sibling(output_header, env); } _ if( NULL == output_header) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Response header is NULL"); /* you can't have a response header NULL, just free things and exit */ axis2_stub_op___free_output_headers(env, , _ ); status = AXIS2_FAILURE; } else { = adb__create(env); if(adb__deserialize(, env, &output_header, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the _deserialize: " "This should be due to an invalid output header"); axis2_stub_op___free_output_headers(env, , _ ); status = AXIS2_FAILURE; } _ = output_header; } } if(status == AXIS2_FAILURE) { _ = NULL; } } } user_data = callback_data->data; on_complete = callback_data->on_complete; if(ret_node != NULL) { ret_val = adb__create(env); if(adb__deserialize(ret_val, env, &ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the LendResponse_deserialize: " "This should be due to an invalid XML"); adb__free(ret_val, env); ret_val = NULL; } } else { ret_val = NULL; } status = on_complete(env, ret_val, _ , user_data); status = on_complete(env, ret_node, _ , user_data); if(callback_data) { AXIS2_FREE(env->allocator, callback_data); } return status; } /** * auto generated method signature for asynchronous invocations * for "" operation. * * @param _ * @param on_complete callback to handle on complete * @param on_error callback to handle on error */ void axis2_stub_start_op__( axis2_stub_t *stub, const axutil_env_t *env, adb__t* _ , void *user_data, axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, _, adb__t* , void *data) , axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data) ) { axis2_callback_t *callback = NULL; axis2_svc_client_t *svc_client = NULL; axis2_options_t *options = NULL; const axis2_char_t *soap_action = NULL; axiom_node_t *payload = NULL; axis2_bool_t is_soap_act_set = AXIS2_TRUE; axutil_string_t *soap_act = NULL; struct axis2_stub___callback_data *callback_data; callback_data = (struct axis2_stub___callback_data*) AXIS2_MALLOC(env->allocator, sizeof(struct axis2_stub___callback_data)); if(NULL == callback_data) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Can not allocate memeory for the callback data structures"); return; } payload = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); payload = _; options = axis2_stub_get_options( stub, env); if (NULL == options) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "options is null in stub"); return; } svc_client = axis2_stub_get_svc_client (stub, env); soap_action =axis2_options_get_action (options, env); if (NULL == soap_action) { is_soap_act_set = AXIS2_FALSE; soap_action = ""; soap_act = axutil_string_create(env, ""); axis2_options_set_soap_action(options, env, soap_act); axis2_options_set_action( options, env, soap_action); } axis2_options_set_soap_version(options, env, AXIOM_SOAP12); axis2_options_set_soap_version(options, env, AXIOM_SOAP11); callback = axis2_callback_create(env); /* Set our on_complete fucntion pointer to the callback object */ axis2_callback_set_on_complete(callback, axis2_stub_on_complete__); /* Set our on_error function pointer to the callback object */ axis2_callback_set_on_error(callback, axis2_stub_on_error__); callback_data-> data = user_data; callback_data-> on_complete = on_complete; callback_data-> on_error = on_error; axis2_callback_set_data(callback, (void*)callback_data); /* Send request */ axis2_svc_client_send_receive_non_blocking(svc_client, env, payload, callback); if (!is_soap_act_set) { axis2_options_set_soap_action(options, env, NULL); axis2_options_set_action(options, env, NULL); } } /** * auto generated method signature for in only mep invocations * for "" operation. * @param _ * @param on_complete callback to handle on complete * @param on_error callback to handle on error */ axis2_status_t axis2_stub_op__( axis2_stub_t *stub, const axutil_env_t *env , adb__t* _ ) { axis2_status_t status; axis2_svc_client_t *svc_client = NULL; axis2_options_t *options = NULL; const axis2_char_t *soap_action = NULL; axutil_qname_t *op_qname = NULL; axiom_node_t *payload = NULL; axiom_node_t *input_header = NULL; payload = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); payload = _; input_header = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); input_header = _; axis2_svc_client_add_header(svc_client, env, input_header); options = axis2_stub_get_options( stub, env); if ( NULL == options ) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub"); return AXIS2_FAILURE; } svc_client = axis2_stub_get_svc_client (stub, env ); soap_action = axis2_options_get_action ( options, env ); if ( NULL == soap_action ) { soap_action = ""; axis2_options_set_action( options, env, soap_action ); } axis2_options_set_soap_version(options, env, AXIOM_SOAP12 ); axis2_options_set_soap_version(options, env, AXIOM_SOAP11 ); op_qname = axutil_qname_create(env, "" , "", NULL); status = axis2_svc_client_send_robust_with_op_qname( svc_client, env, op_qname, payload); return status; } /** * function to free any soap input headers */ void axis2_stub_op___free_input_headers(const axutil_env_t *env, , adb__t* _ ) { _ if() { adb__free(, env); } /* we don't have anything to free on */ } /** * function to free any soap output headers */ void axis2_stub_op___free_output_headers(const axutil_env_t *env, , adb__t* _ ) { _ if() { adb__free(, env); } /* we don't have anything to free on */ } ./src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl0000664000175000017500000010200411767656530022672 0ustar brianbrian /** * .c * * This file was auto-generated from WSDL for "" service * by the Apache Axis2 version: #axisVersion# #today# * */ #include ".h" #include <axis2_svc_skeleton.h> #include <stdio.h> #include <axis2_svc.h> /** * functions prototypes */ /* On fault, handle the fault */ axiom_node_t* AXIS2_CALL _on_fault(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *node); /* Free the service */ int AXIS2_CALL _free(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env); /* This method invokes the right service method */ axiom_node_t* AXIS2_CALL _invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *node, axis2_msg_ctx_t *msg_ctx); /* Initializing the environment */ int AXIS2_CALL _init(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env); /* Create the service */ axis2_svc_skeleton_t* AXIS2_CALL _create(const axutil_env_t *env); static const axis2_svc_skeleton_ops_t _svc_skeleton_ops_var = { _init, _invoke, _on_fault, _free }; /** * Implementations for the functions */ axis2_svc_skeleton_t* AXIS2_CALL _create(const axutil_env_t *env) { axis2_svc_skeleton_t *svc_skeleton = NULL; /* Allocate memory for the structs */ svc_skeleton = (axis2_svc_skeleton_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t)); svc_skeleton->ops = &_svc_skeleton_ops_var; return svc_skeleton; } int AXIS2_CALL _init(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env) { /* Any initialization stuff of goes here */ return AXIS2_SUCCESS; } int AXIS2_CALL _free(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env) { /* Free the service skeleton */ if (svc_skeleton) { AXIS2_FREE(env->allocator, svc_skeleton); svc_skeleton = NULL; } return AXIS2_SUCCESS; } /** * function to free any soap input headers */ void axis2_stub_op___free_input_headers(const axutil_env_t *env, , adb__t* _ ) { _ if() { adb__free(, env); } /* we don't have anything to free on */ } /** * function to free any soap output headers */ void axis2_stub_op___free_output_headers(const axutil_env_t *env, , adb__t* _ ) { _ if() { adb__free(, env); } /* we don't have anything to free on */ } /* * Create the response soap envelope when output headers are to be set.. */ axiom_soap_envelope_t* AXIS2_CALL _create_response_envelope(const axutil_env_t *env, axis2_msg_ctx_t *in_msg_ctx, axis2_msg_ctx_t *msg_ctx, axiom_node_t *body_content_node) { const axis2_char_t *soap_ns = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI; int soap_version = AXIOM_SOAP12; axiom_namespace_t *env_ns = NULL; axiom_soap_envelope_t *default_envelope = NULL; axiom_soap_header_t *out_header = NULL; axiom_soap_body_t *out_body = NULL; axiom_node_t *out_node = NULL; if (in_msg_ctx && axis2_msg_ctx_get_is_soap_11(in_msg_ctx, env)) { soap_ns = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI; /* default is 1.2 */ soap_version = AXIOM_SOAP11; } /* create the soap envelope here */ env_ns = axiom_namespace_create(env, soap_ns, "soapenv"); if (!env_ns) { return NULL; } default_envelope = axiom_soap_envelope_create(env, env_ns); if (!default_envelope) { axiom_namespce_free(env_ns, env); return NULL; } out_header = axiom_soap_header_create_with_parent(env, default_envelope); if (!out_header) { axiom_soap_envelope_free(default_envelope, env); axiom_namespce_free(env_ns, env); return NULL; } out_body = axiom_soap_body_create_with_parent(env, default_envelope); if (!out_body) { axiom_soap_body_free(out_body, env); axiom_soap_envelope_free(default_envelope, env); axiom_namespce_free(env_ns, env); return NULL; } out_node = axiom_soap_body_get_base_node(out_body, env); if (!out_node) { axiom_soap_body_free(out_body, env); axiom_soap_envelope_free(default_envelope, env); axiom_namespce_free(env_ns, env); return NULL; } if (body_content_node) { axiom_node_add_child(out_node, env, body_content_node); } if(axis2_msg_ctx_set_soap_envelope(msg_ctx, env, default_envelope) == AXIS2_FAILURE) { axiom_soap_body_free(out_body, env); axiom_soap_envelope_free(default_envelope, env); axiom_namespce_free(env_ns, env); if (body_content_node) { axiom_node_free(body_content_node, env); } return NULL; } return default_envelope; } /* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL _invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axis2_msg_ctx_t *in_msg_ctx = NULL; axiom_soap_envelope_t *req_soap_env = NULL; axiom_soap_header_t *req_soap_header = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *ret_node = NULL; axiom_node_t *input_header = NULL; axiom_node_t *output_header = NULL; axiom_node_t *header_base_node = NULL; adb__t* axis2_status_t ret_val = NULL; adb__t* input_val = NULL; adb__t* _ = NULL; adb__t* _ = NULL; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if(operation_ctx) { in_msg_ctx = axis2_op_ctx_get_msg_ctx(operation_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN); } if(in_msg_ctx) { req_soap_env = axis2_msg_ctx_get_soap_envelope(in_msg_ctx, env); } if(!req_soap_env) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "request evelope is NULL"); return NULL; } req_soap_header = axiom_soap_envelope_get_header(req_soap_env, env); if(req_soap_header) { header_base_node = axiom_soap_header_get_base_node(req_soap_header, env); } if ( axutil_strcmp(op_name, "") == 0 ) { input_val = adb__create( env); if( AXIS2_FAILURE == adb__deserialize(input_val, env, &content_node, NULL, AXIS2_FALSE)) { adb__free(input_val, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the _deserialize: " "This should be due to an invalid XML"); return NULL; } content_node; input_header = axiom_node_get_first_child(header_base_node, env); while(input_header && axiom_node_get_node_type(input_header, env) != AXIOM_ELEMENT) { input_header = axiom_node_get_next_sibling(input_header, env); } input_header = axiom_node_get_next_sibling(input_header, env); while(input_header && axiom_node_get_node_type(input_header, env) != AXIOM_ELEMENT) { input_header = axiom_node_get_next_sibling(input_header, env); } _ if( NULL == input_header) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Response header is NULL"); /* you can't have a response header NULL, just free things and exit */ axis2_stub_op___free_input_headers(env, , _ ); adb__free(input_val, env); return NULL; } = adb__create(env); if(adb__deserialize(, env, &input_header, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { if( != NULL) { adb__free(, env); } AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the _deserialize: " "This should be due to an invalid input header"); axis2_stub_op___free_input_headers(env, , _ ); adb__free(input_val, env); return NULL; } = input_header; ret_val = _(env , input_val, _ , &_ ); if ( NULL == ret_val ) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from "); adb__free(input_val, env); axis2_stub_op___free_input_headers(env, , _ ); axis2_stub_op___free_output_headers(env, , _ ); return NULL; } ret_node = adb__serialize(ret_val, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb__free(ret_val, env); adb__free(input_val, env); ret_val; res_soap_env = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env); if(!res_soap_env) { res_soap_env = _create_response_envelope(env, in_msg_ctx, msg_ctx, ret_node); } if(!res_soap_env) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "response evelope is NULL"); axis2_stub_op___free_input_headers(env, , _ ); axis2_stub_op___free_output_headers(env, , _ ); return NULL; } res_soap_header = axiom_soap_envelope_get_header(res_soap_env, env); if(res_soap_header) { header_base_node = axiom_soap_header_get_base_node(res_soap_header, env); } if(!header_base_node) { axis2_stub_op___free_input_headers(env, , _ ); axis2_stub_op___free_output_headers(env, , _ ); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Required response header is NULL"); return NULL; } output_header = adb__serialize(_, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); output_header = _; axiom_node_add_child(header_base_node, env, output_header); axis2_stub_op___free_input_headers(env, , _ ); axis2_stub_op___free_output_headers(env, , _ ); return ret_node; if( AXIS2_FAILURE == ret_val ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from "); } adb__free(input_val, env); axis2_stub_op___free_input_headers(env, , _ ); return NULL; } } printf(" service ERROR: invalid OM parameters in request\n"); return NULL; } axiom_node_t* AXIS2_CALL _on_fault(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *node) { axiom_node_t *error_node = NULL; axiom_element_t *error_ele = NULL; error_ele = axiom_element_create(env, node, "fault", NULL, &error_node); axiom_element_set_text(error_ele, env, " failed", error_node); return error_node; } /** * Following block distinguish the exposed part of the dll. */ AXIS2_EXTERN int axis2_get_instance(struct axis2_svc_skeleton **inst, const axutil_env_t *env) { *inst = _create(env); if(!(*inst)) { return AXIS2_FAILURE; } return AXIS2_SUCCESS; } AXIS2_EXTERN int axis2_remove_instance(axis2_svc_skeleton_t *inst, const axutil_env_t *env) { axis2_status_t status = AXIS2_FAILURE; if (inst) { status = AXIS2_SVC_SKELETON_FREE(inst, env); } return status; } ./src/org/apache/axis2/wsdl/template/general/0000775000175000017500000000000011767656530020233 5ustar brianbrian./src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl0000664000175000017500000003075111767656530024636 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${test} Test the classpath for the availability of necesary classes Print out the availabilities Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} jars.ok ${classes} ${src} axis2.class.path jars.ok ${classes} ${test} axis2.class.path jars.ok jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl *.xsd ${lib}/${name}.aar **/Test.class ${classes} compile.src compile.test ${lib}/${name}-test-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class ${build}/repo/ ${build}/repo/services ${build}/lib/${name}.aar ${build}/repo/services/ ${build}/repo axis2.class.path ${lib}/${name}-test-client.jar axis2.class.path ${classes} ${build}/test-reports/ test.class.path ${build}/test-reports/ ${test} **/*Test*.java ${build} ./src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl0000664000175000017500000000766011767656530024451 0ustar brianbrian This file was auto-generated from WSDL by the Apache Axis2 version: #axisVersion# #today# . . true true ./src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl0000664000175000017500000003452411767656530025723 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${test} ${resources} ${lib}/${xbeans.packaged.jar.name} **/services.xml, **/*.xsd Test the classpath for the availability of necesary classes Print out the availabilities XmlBeans Availability = ${xbeans.available} Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} jars.ok ${classes} ${src} ${lib}/${xbeans.packaged.jar.name} axis2.class.path jars.ok ${classes} ${test} ${lib}/${xbeans.packaged.jar.name} axis2.class.path jars.ok jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl *.xsd **/schemaorg_apache_xmlbean/** ${lib}/${xbeans.packaged.jar.name} ${classes}/lib ${lib}/${name}.aar **/Test.class ${classes} compile.src compile.test ${lib}/${name}-test-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class ${resources} **/*.wsdl **/*.xsd **/*.xml ${build}/repo/ ${build}/repo/services ${build}/lib/${name}.aar ${build}/repo/services/ ${build}/repo axis2.class.path ${lib}/${name}-test-client.jar axis2.class.path ${build}/test-reports/ test.class.path ${build}/test-reports/ ${test} **/*Test*.java ${build} ./src/org/apache/axis2/wsdl/template/general/jaxmeAntBuildTemplate.xsl0000664000175000017500000003347211767656530025217 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${resources} ${lib}/${xbeans.packaged.jar.name} **/services.xml, **/*.xsd Test the classpath for the availability of necesary classes Print out the availabilities XmlBeans Availability = ${xbeans.available} Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} jars.ok ${classes} ${src} ${lib}/${xbeans.packaged.jar.name} axis2.class.path jars.ok ${classes} ${src} ${test} ${lib}/${xbeans.packaged.jar.name} axis2.class.path jars.ok jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl *.xsd **/schemaorg_apache_xmlbean/** ${lib}/${xbeans.packaged.jar.name} ${classes}/lib ${lib}/${name}.aar **/Test.class ${classes} ${lib}/${name}-test-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class ${resources} **/*.wsdl **/*.xsd **/*.xml ${build}/repo/ ${build}/repo/services ${build}/lib/${name}.aar ${build}/repo/services/ ${build}/repo axis2.class.path ${lib}/${name}-test-client.jar axis2.class.path ${build}/test-reports/ test.class.path ${build}/test-reports/ ${test} **/*Test*.java ${build} ./src/org/apache/axis2/wsdl/template/general/jaxbriAntBuildTemplate.xsl0000664000175000017500000003144411767656530025367 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${test} Test the classpath for the availability of necesary classes Print out the availabilities JAX-B RI Availability = ${jaxbri.available} Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} jars.ok ${classes} ${src} axis2.class.path jars.ok ${classes} ${test} axis2.class.path jars.ok jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl **/schemaorg_apache_xmlbean/** ${lib}/${name}.aar **/Test.class ${classes} compile.src compile.test ${lib}/${name}-test-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class ${build}/repo/ ${build}/repo/services ${build}/lib/${name}.aar ${build}/repo/services/ ${build}/repo axis2.class.path ${lib}/${name}-test-client.jar axis2.class.path ${build}/test-reports/ test.class.path ${build}/test-reports/ ${test} **/*Test*.java ${build} ./src/org/apache/axis2/wsdl/template/general/jibxAntBuildTemplate.xsl0000664000175000017500000003151211767656530025040 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${test} Test the classpath for the availability of necesary classes Print out the availabilities Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} JiBX Availability= ${jibx.available} jars.ok ${classes} ${src} axis2.class.path jars.ok ${classes} ${test} axis2.class.path jars.ok jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl *.xsd ${lib}/${name}.aar **/Test.class ${classes} compile.src compile.test ${lib}/${name}-test-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class ${build}/repo/ ${build}/repo/services ${build}/lib/${name}.aar ${build}/repo/services/ ${build}/repo axis2.class.path ${lib}/${name}-test-client.jar axis2.class.path ${classes} ${build}/test-reports/ test.class.path ${build}/test-reports/ ${test} **/*Test*.java ${build} ./src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl0000664000175000017500000002334511767656530025535 0ustar brianbrian jar.server jar.client Auto generated ant build file ${env.AXIS2_HOME} . ${project.base.dir}/ ${project.base.dir}/test ${project.base.dir}/build ${build}/classes ${build}/lib ${project.base.dir}/ ${java.class.path} ${maven.class.path} ${axis2.home} lib/*.jar ${build} ${classes} ${lib} ${test} Test the classpath for the availability of necesary classes Print out the availabilities Stax Availability= ${stax.available} Axis2 Availability= ${axis2.available} jars.ok ${classes} ${src} axis2.class.path jars.ok ${classes} ${test} axis2.class.path jars.ok compile.src compile.test ${lib}/${name}-client.jar ${classes} **/META-INF/*.* **/lib/*.* **/*MessageReceiver.class **/*Skeleton.class jars.ok ${classes}/META-INF false ${resources} *.xml *.wsdl *.xsd ${lib}/${name}.aar **/Test.class ${classes} ./src/org/apache/axis2/wsdl/template/java/0000775000175000017500000000000011767656530017537 5ustar brianbrian./src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceTemplate.xsl0000664000175000017500000002174511767656530027733 0ustar brianbrian package ; import ; /** * .java * * This class was auto-generated from WSDL. * Apache Axis2 version: #axisVersion# #today# */ @( = "" = "", ) public interface { } /** * @param * @return * @throws * @param * @return * @throws */ @javax.jws.WebMethod @javax.jws.Oneway @javax.jws.WebResult(targetNamespace = "" , partName = "") @javax.jws.soap.SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE) @javax.xml.ws.RequestWrapper(localName = "", targetNamespace = "", className = "") @javax.xml.ws.ResponseWrapper(localName = "", targetNamespace = "", className = "") public void void ( @javax.jws.WebParam(name = "", targetNamespace = "", mode = javax.jws.WebParam.Mode.INOUT , partName = "") javax.xml.ws.Holder< > javax.xml.ws.Holder< > , @javax.jws.WebParam(name = "", targetNamespace = "", mode = javax.jws.WebParam.Mode.INOUT , partName = "") javax.xml.ws.Holder< > javax.xml.ws.Holder< > , @javax.jws.WebParam(name = "", targetNamespace = "" , partName = "") , @javax.jws.WebParam(name = "", targetNamespace = "" , partName = "") , ) throws , ; ./src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl0000664000175000017500000022523711767656530026604 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /* * java implementation */ . public class extends org.apache.axis2.client.Stub implements { protected org.apache.axis2.description.AxisOperation[] _operations; //hashmaps to keep the fault mapping private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); private java.util.HashMap faultMessageMap = new java.util.HashMap(); private static int counter = 0; private static synchronized String getUniqueSuffix(){ // reset the counter if it is greater than 99999 if (counter > 99999){ counter = 0; } counter = counter + 1; return Long.toString(System.currentTimeMillis()) + "_" + counter; } private void populateAxisService() throws org.apache.axis2.AxisFault { //creating the Service with a unique name _service = new org.apache.axis2.description.AxisService("" + getUniqueSuffix()); addAnonymousOperations(); //creating the operations org.apache.axis2.description.AxisOperation __operation; _operations = new org.apache.axis2.description.AxisOperation[]; __operation = new org.apache.axis2.description.OutOnlyAxisOperation(); __operation = new org.apache.axis2.description.RobustOutOnlyAxisOperation(); __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("", "")); _service.addOperation(__operation); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicySubject().attachPolicy(getPolicy("")); _operations[]=__operation; } //populates the faults private void populateFaults(){ faultExceptionNameMap.put( new javax.xml.namespace.QName("",""),""); faultExceptionClassNameMap.put(new javax.xml.namespace.QName("",""),""); faultMessageMap.put( new javax.xml.namespace.QName("",""),""); } /** *Constructor that takes in a configContext */ public (org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { this(configurationContext,targetEndpoint,false); } /** * Constructor that takes in a configContext and useseperate listner */ public (org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint, boolean useSeparateListener) throws org.apache.axis2.AxisFault { //To populate AxisService populateAxisService(); populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); _service.applyPolicy(); configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference( targetEndpoint)); _serviceClient.getOptions().setUseSeparateListener(useSeparateListener); //Set the soap version _serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } /** * Default Constructor */ public (org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault { this(configurationContext,"" ); //this(configurationContext,"" ); } /** * Default Constructor */ public () throws org.apache.axis2.AxisFault { this("" ); //this("" ); } /** * Constructor taking the target endpoint */ public (java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { this(null,targetEndpoint); } /** * Auto generated method signature * * @see .# * @param * @throws : */ public void ( , , ) public void void ( , , , ) throws java.rmi.RemoteException , { org.apache.axis2.context.MessageContext _messageContext = null; try{ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[].getName()); _operationClient.getOptions().setAction(""); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,,); // create a message context _messageContext = new org.apache.axis2.context.MessageContext(); // create SOAP envelope with that payload org.apache.axiom.soap.SOAPEnvelope env = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), wrap(), optimizeContent(new javax.xml.namespace.QName("", ""))); dummyWrappedType = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , dummyWrappedType, optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI())); env.build(); // add the children only if the parameter is not null if (!=null){ org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env,true); org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env); } // add the children only if the parameter is not null if (!=null){ addHttpHeader(_messageContext,"",); } //Unknown style detected !! No code is generated //Style is taken to be "rpc". No input parameters org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); env.getBody().addChild(factory.createOMElement("", "", "")); //Style is taken to be "document". No input parameters // according to the WS-Basic profile in this case we have to send an empty soap message org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); //Unknown style detected !! No code is generated //adding SOAP soap_headers _serviceClient.addHeadersToEnvelope(env); // set the message context with that soap envelope _messageContext.setEnvelope(env); // add the message contxt to the operation client _operationClient.addMessageContext(_messageContext); //execute the operation client _operationClient.execute(true); return; org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); return toByte(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toChar(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toDouble(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toFloat(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toInt(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toLong(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toShort(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); return toBoolean(_returnEnv.getBody().getFirstElement(), getEnvelopeNamespaces(_returnEnv)); java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement() , .class, getEnvelopeNamespaces(_returnEnv)); return get(()object); return get(()object); return; return ()object; //Unknown style detected !! No code is generated }catch(org.apache.axis2.AxisFault f){ org.apache.axiom.om.OMElement faultElt = f.getDetail(); if (faultElt!=null){ if (faultExceptionNameMap.containsKey(faultElt.getQName())){ //make the fault by reflection try{ java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName()); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex= (java.lang.Exception) exceptionClass.newInstance(); //message class java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName()); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass,null); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", new java.lang.Class[]{messageClass}); m.invoke(ex,new java.lang.Object[]{messageObject}); if (ex instanceof ){ throw ()ex; } throw new java.rmi.RemoteException(ex.getMessage(), ex); }catch(java.lang.ClassCastException e){ // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.ClassNotFoundException e) { // we cannot intantiate the class - throw the original Axis fault throw f; }catch (java.lang.NoSuchMethodException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.IllegalAccessException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.InstantiationException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } }else{ throw f; } }else{ throw f; } } finally { _messageContext.getTransportOut().getSender().cleanup(_messageContext); } } /** * Auto generated method signature for Asynchronous Invocations * * @see .#start * @param */ public void start( , , , final . callback) throws java.rmi.RemoteException{ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[].getName()); _operationClient.getOptions().setAction(""); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,,); // create SOAP envelope with that payload org.apache.axiom.soap.SOAPEnvelope env=null; final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); //Style is Doc. dummyWrappedType = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , dummyWrappedType, optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI())); // add the soap_headers only if they are not null if (!=null){ org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env,true); org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env); } // add the children only if the parameter is not null if (!=null){ addHttpHeader(_messageContext,"",); } //Unknown style detected !! No code is generated //Style is Doc. No input parameters org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); env.getBody().addChild(factory.createOMElement("", "", "")); //Style is taken to be "document". No input parameters // according to the WS-Basic profile in this case we have to send an empty soap message org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); //Unknown style detected !! No code is generated // adding SOAP soap_headers _serviceClient.addHeadersToEnvelope(env); // create message context with that soap envelope _messageContext.setEnvelope(env); // add the message context to the operation client _operationClient.addMessageContext(_messageContext); // Nothing to pass as the callback!!! _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { public void onMessage(org.apache.axis2.context.MessageContext resultContext) { try { org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope(); callback.receiveResult(toByte(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toChar(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toDouble(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toFloat(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toInt(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toLong(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toShort(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); callback.receiveResult(toBoolean(resultEnv.getBody().getFirstElement(), getEnvelopeNamespaces(resultEnv))); java.lang.Object object = fromOM(resultEnv.getBody().getFirstElement(), .class, getEnvelopeNamespaces(resultEnv)); callback.receiveResult( ); get(()object)); ()object); ); ()object); } catch (org.apache.axis2.AxisFault e) { callback.receiveError(e); } } public void onError(java.lang.Exception error) { if (error instanceof org.apache.axis2.AxisFault) { org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error; org.apache.axiom.om.OMElement faultElt = f.getDetail(); if (faultElt!=null){ if (faultExceptionNameMap.containsKey(faultElt.getQName())){ //make the fault by reflection try{ java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName()); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex= (java.lang.Exception) exceptionClass.newInstance(); //message class java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName()); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass,null); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", new java.lang.Class[]{messageClass}); m.invoke(ex,new java.lang.Object[]{messageObject}); if (ex instanceof ){ callback.receiveError(()ex); return; } callback.receiveError(new java.rmi.RemoteException(ex.getMessage(), ex)); } catch(java.lang.ClassCastException e){ // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (java.lang.ClassNotFoundException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (java.lang.NoSuchMethodException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (java.lang.IllegalAccessException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (java.lang.InstantiationException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } catch (org.apache.axis2.AxisFault e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveError(f); } } else { callback.receiveError(f); } } else { callback.receiveError(f); } } else { callback.receiveError(error); } } public void onFault(org.apache.axis2.context.MessageContext faultContext) { org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext); onError(fault); } public void onComplete() { try { _messageContext.getTransportOut().getSender().cleanup(_messageContext); } catch (org.apache.axis2.AxisFault axisFault) { callback.receiveError(axisFault); } } }); org.apache.axis2.util.CallbackReceiver _callbackReceiver = null; if ( _operations[].getMessageReceiver()==null && _operationClient.getOptions().isUseSeparateListener()) { _callbackReceiver = new org.apache.axis2.util.CallbackReceiver(); _operations[].setMessageReceiver( _callbackReceiver); } //execute the operation client _operationClient.execute(false); } /** * Auto generated method signature * * @throws : */ public void ( , , , ) throws java.rmi.RemoteException , { org.apache.axis2.context.MessageContext _messageContext = null; try { org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[].getName()); _operationClient.getOptions().setAction(""); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,,); _operationClient.getOptions().setAction(""); org.apache.axiom.soap.SOAPEnvelope env = null; _messageContext = new org.apache.axis2.context.MessageContext(); //Style is Doc. dummyWrappedType = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , dummyWrappedType, optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), , optimizeContent(new javax.xml.namespace.QName("", ""))); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI())); // add the children only if the parameter is not null if (!=null){ org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env,true); org.apache.axiom.om.OMElement omElement = toOM(, optimizeContent(new javax.xml.namespace.QName("", ""))); addHeader(omElement,env); } // add the children only if the parameter is not null if (!=null){ addHttpHeader(_messageContext,"",); } //Unknown style detected !! No code is generated //Style is taken to be "document". No input parameters org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); env.getBody().addChild(factory.createOMElement("", "", "")); //Style is taken to be "document". No input parameters // according to the WS-Basic profile in this case we have to send an empty soap message org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); env = factory.getDefaultEnvelope(); //Unknown style detected !! No code is generated //adding SOAP soap_headers _serviceClient.addHeadersToEnvelope(env); // create message context with that soap envelope _messageContext.setEnvelope(env); // add the message contxt to the operation client _operationClient.addMessageContext(_messageContext); _operationClient.execute(true); }catch(org.apache.axis2.AxisFault f){ org.apache.axiom.om.OMElement faultElt = f.getDetail(); if (faultElt!=null){ if (faultExceptionNameMap.containsKey(faultElt.getQName())){ //make the fault by reflection try{ java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName()); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex= (java.lang.Exception) exceptionClass.newInstance(); //message class java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName()); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass,null); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", new java.lang.Class[]{messageClass}); m.invoke(ex,new java.lang.Object[]{messageObject}); if (ex instanceof ){ throw ()ex; } throw new java.rmi.RemoteException(ex.getMessage(), ex); }catch(java.lang.ClassCastException e){ // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.ClassNotFoundException e) { // we cannot intantiate the class - throw the original Axis fault throw f; }catch (java.lang.NoSuchMethodException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.IllegalAccessException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } catch (java.lang.InstantiationException e) { // we cannot intantiate the class - throw the original Axis fault throw f; } }else{ throw f; } }else{ throw f; } } finally { _messageContext.getTransportOut().getSender().cleanup(_messageContext); } _messageContext.getTransportOut().getSender().cleanup(_messageContext); return; } /** * A utility method that copies the namepaces from the SOAPEnvelope */ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ java.util.Map returnMap = new java.util.HashMap(); java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); while (namespaceIterator.hasNext()) { org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); } return returnMap; } //////////////////////////////////////////////////////////////////////// private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) { java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(policyString.getBytes()); return org.apache.neethi.PolicyEngine.getPolicy(bais); } ///////////////////////////////////////////////////////////////////////// private javax.xml.namespace.QName[] opNameArray = null; private boolean optimizeContent(javax.xml.namespace.QName opName) { setOpNameArray(); if (opNameArray == null) { return false; } for (int i = 0; i < opNameArray.length; i++) { if (opName.equals(opNameArray[i])) { return true; } } return false; } //interface-implementation } ./src/org/apache/axis2/wsdl/template/java/JaxwsServiceEndpointInterfaceImplTemplate.xsl0000664000175000017500000001401011767656530030540 0ustar brianbrian package ; /** * .java * * This class was auto-generated from WSDL. * Apache Axis2 version: #axisVersion# #today# */ @( = "" = "", ) public class { } /** * @param * @return * @throws * @param * @return * @throws */ public void void ( @javax.jws.WebParam(name = "", targetNamespace = "", mode = javax.jws.WebParam.Mode.INOUT , partName = "") javax.xml.ws.Holder< > javax.xml.ws.Holder< > , , , ) throws , { //TODO : fill this with the necessary business logic throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#" + this.getClass().getEnclosingMethod().getName()); } ./src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl0000664000175000017500000002536411767656530025530 0ustar brianbrian //Create the desired XmlObject and provide it as the test object public org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class type) throws java.lang.Exception{ java.lang.reflect.Method creatorMethod = null; if (org.apache.xmlbeans.XmlObject.class.isAssignableFrom(type)){ Class[] declaredClasses = type.getDeclaredClasses(); for (int i = 0; i < declaredClasses.length; i++) { Class declaredClass = declaredClasses[i]; if (declaredClass.getName().endsWith("$Factory")){ creatorMethod = declaredClass.getMethod("newInstance",null); break; } } } if (creatorMethod!=null){ return (org.apache.xmlbeans.XmlObject)creatorMethod.invoke(null,null); }else{ throw new java.lang.Exception("Creator not found!"); } } private get( wrappedType){ return wrappedType.get().xgetArray(); return wrappedType.get().xget(); } //Create an ADBBean and provide it as the test object public org.apache.axis2.databinding.ADBBean getTestObject(java.lang.Class type) throws java.lang.Exception{ return (org.apache.axis2.databinding.ADBBean) type.newInstance(); } private get( wrappedType){ return wrappedType.get().get(); return wrappedType.get(); } private get( wrappedType){ return wrappedType.get(); } private wrap( innerType){ wrappedElement = new (); wrappedElement.set(innerType); return wrappedElement; } // create the desired object and provide it as the test object public java.lang.Object getTestObject(java.lang.Class type) throws java.lang.Exception { return type.newInstance(); } //Create an object and provide it as the test object public Object getTestObject(java.lang.Class type) throws java.lang.Exception{ return type.newInstance(); } //Create an OMElement and provide it as the test object public org.apache.axiom.om.OMElement getTestObject(java.lang.Object dummy){ org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory(); org.apache.axiom.om.OMNamespace defNamespace = factory.createOMNamespace("",null); return org.apache.axiom.om.OMAbstractFactory.getOMFactory().createOMElement("test",defNamespace); } ./src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl0000664000175000017500000003265411767656530023675 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /* * java interface */ public interface { /** * Auto generated method signature * * @param * @throws : */ public void ( , , ) throws java.rmi.RemoteException public void void ( , , , ) throws java.rmi.RemoteException , ; /** * Auto generated method signature for Asynchronous Invocations * * @param */ public void start( , , , final . callback) throws java.rmi.RemoteException; /** * Auto generated method signature for Asynchronous Invocations * * @throws : */ public void ( , , , ) throws java.rmi.RemoteException , ; // } ./src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl0000664000175000017500000001157311767656530025126 0ustar brianbrian /** * Starts a reliabel message sequence */ public void startSequence() { _getServiceClient().getOptions().setProperty("START_RM_SEQUENCE", "true"); } /** * Marks the last message for the sequence */ public void setLastMessage() { _getServiceClient().getOptions().setProperty("Sandesha2ClientAPIPropertyWSRMLastMessage", "true"); } /** * Terminates the reliabel message sequence */ public void endSequence() { _getServiceClient().getOptions().setProperty("END_RM_SEQUENCE", "true"); } // auto genenrated stub methods public void setUsername(java.lang.String username) { _serviceClient.getOptions().setProperty(org.apache.ws.security.handler.WSHandlerConstants.USER, username); } public void setPassword(java.lang.String password) { _UTCallback pwCallback = new _UTCallback(); pwCallback.setPassword(password); _serviceClient .getOptions() .setProperty( org.apache.ws.security.handler.WSHandlerConstants.PASSWORD_TYPE, "PasswordText"); _serviceClient .getOptions() .setProperty( org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_REF, pwCallback); } private class _UTCallback implements javax.security.auth.callback.CallbackHandler { private java.lang.String password; public _UTCallback() { } public void setPassword(java.lang.String password) { this.password = password; } public void handle(javax.security.auth.callback.Callback[] callbacks) throws java.io.IOException, javax.security.auth.callback.UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof org.apache.ws.security.WSPasswordCallback) { org.apache.ws.security.WSPasswordCallback pc = (org.apache.ws.security.WSPasswordCallback) callbacks[i]; if (pc.getIdentifer().equals(getUsername())) { pc.setPassword(password); } else { pc.setPassword(password); } } else { throw new javax.security.auth.callback.UnsupportedCallbackException( callbacks[i], "Unrecognized Callback"); } } } private java.lang.String getUsername() { return (String) _serviceClient.getOptions().getProperty( org.apache.ws.security.handler.WSHandlerConstants.USER); } } private void setOpNameArray(){ opNameArray = new javax.xml.namespace.QName[] { , new javax.xml.namespace.QName("","") }; } private void setOpNameArray(){ opNameArray = null; } ./src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl0000664000175000017500000002267711767656530025406 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * java skeleton interface for the axisService */ public interface { /** * Auto generated method signature * * @param * @param * @param * @param * @throws : */ public void ( ) public void void ( , ) throws , ; } ./src/org/apache/axis2/wsdl/template/java/JaxwsExceptionTemplate.xsl0000664000175000017500000001072211767656530024740 0ustar brianbrian package ; import ; /** * .java * * This class was auto-generated from WSDL. * Apache Axis2 version: #axisVersion# #today# * */ @( ="" ="", ) public class extends Exception{ /** * Java type that goes as soapenv:Fault detail element. */ private faultInfo; /** * @param faultInfo * @param message */ public (String message, faultInfo) { super(message); this.faultInfo = faultInfo; } /** * @param faultInfo * @param message * @param cause */ public (String message, faultInfo, Throwable cause) { super(message, cause); this.faultInfo = faultInfo; } /** * @return * returns fault bean: */ public getFaultInfo() { return faultInfo; } } ./src/org/apache/axis2/wsdl/template/java/JaxwsServiceXMLTemplate.xsl0000664000175000017500000000546511767656530024773 0ustar brianbrian This file was auto-generated from WSDL Apache Axis2 version: #axisVersion# #today# org.apache.axis2.jaxws.server.JAXWSMessageReceiver . ./src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl0000664000175000017500000001130511767656530024755 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * Callback class, Users can extend this class and implement * their own receiveResult and receiveError methods. */ public abstract class { protected Object clientData; /** * User can pass in any object that needs to be accessed once the NonBlocking * Web service call is finished and appropriate method of this CallBack is called. * @param clientData Object mechanism by which the user can pass in user data * that will be avilable at the time this callback is called. */ public (Object clientData){ this.clientData = clientData; } /** * Please use this constructor if you don't want to set any clientData */ public (){ this.clientData = null; } /** * Get the client data */ public Object getClientData() { return clientData; } /** * auto generated Axis2 call back method for method * override this method for handling normal response from operation */ public void receiveResult( result result result ) { } /** * auto generated Axis2 Error handler * override this method for handling error response from operation */ public void receiveError(java.lang.Exception e) { } // No methods generated for meps other than in-out } ./src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl0000664000175000017500000003413011767656530023671 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /* * Junit test case */ public class extends junit.framework.TestCase{ /** * Auto generated test method */ public void test() throws java.lang.Exception{ . stub = new .();//the default implementation should point to the right endpoint = ()getTestObject(.class); // TODO : Fill in the here //There is no output to be tested! stub.( ,get() ,get() , ); assertNotNull(stub.( ,get() ,get() , )); //There is no output to be tested! stub.(); assertNotNull(stub.()); } tempCallback /** * Auto generated test method */ public void testStart() throws java.lang.Exception{ . stub = new .(); = ()getTestObject(.class); // TODO : Fill in the here stub.start( ,get() , , new () ); stub.start( new () ); } private class extends .{ public (){ super(null);} public void receiveResult( result result result ) { } public void receiveError(java.lang.Exception e) { fail(); } } /** * Auto generated test method */ public void test() throws java.lang.Exception{ . stub = new .();//the default implementation should point to the right endpoint = ()getTestObject(.class); // TODO : Fill in the here //There is no output to be tested! stub.( ,get() , ); //There is no output to be tested! stub.(); } } ./src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl0000664000175000017500000002414011767656530023550 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * java skeleton for the axisService */ public class implements { /** * Auto generated method signature * * @param * @param * @param * @param * @throws : */ public void ( ) public void void ( , ) throws , { //TODO : fill this with the necessary business logic throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#"); } } ./src/org/apache/axis2/wsdl/template/java/package.html0000664000175000017500000000172311767656530022023 0ustar brianbrian This package is a "non class containing" one that has the xsl templates for the Java class generation ./src/org/apache/axis2/wsdl/template/java/ExceptionTemplate.xsl0000664000175000017500000000363211767656530023725 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; public class extends java.lang.Exception{ private faultMessage; public () { super(""); } public (java.lang.String s) { super(s); } public (java.lang.String s, java.lang.Throwable ex) { super(s, ex); } public void setFaultMessage( msg){ faultMessage = msg; } public getFaultMessage(){ return faultMessage; } } ./src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl0000664000175000017500000011134011767656530025034 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * message receiver */ public class extends { public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) throws org.apache.axis2.AxisFault{ try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); skel = ()obj; //Out Envelop org.apache.axiom.soap.SOAPEnvelope envelope = null; //Find the axisOperation that has been set by the Dispatch phase. org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation(); if (op == null) { throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } java.lang.String methodName; if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){ } else if("".equals(methodName)){ = 0; = false; = '\u0000'; = null; wrappedParam = ()fromOM( msgContext.getEnvelope().getBody().getFirstElement(), .class, getEnvelopeNamespaces(msgContext.getEnvelope())); = wrap(skel.( get(wrappedParam))); skel.( get(wrappedParam)); wrap(skel.(wrappedParam)); skel.(wrappedParam); = wrap(skel.()); skel.(); wrappedParam = ()fromOM( msgContext.getEnvelope().getBody().getFirstElement(), .class, getEnvelopeNamespaces(msgContext.getEnvelope())); = wrap( wrap( wrap(); skel.( , get(wrappedParam) ) skel.(wrappedParam) ) ; = wrap( wrap( skel.() ) ; envelope = toEnvelope(getSOAPFactory(msgContext), , false); envelope = getSOAPFactory(msgContext).getDefaultEnvelope(); //Unknown style!! No code is generated throw new java.lang.UnsupportedOperationException("Unknown Style"); envelope = (msgContext.getEnvelope().getBody().getFirstElement(), skel, getSOAPFactory(msgContext)); } else { throw new java.lang.RuntimeException("method not found"); } newMsgContext.setEnvelope(envelope); } } catch ( e) { msgContext.setProperty(org.apache.axis2.Constants.FAULT_NAME,""); org.apache.axis2.AxisFault f = createAxisFault(e); if (e.getFaultMessage() != null){ f.setDetail(toOM(e.getFaultMessage(),false)); } throw f; } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } } //message-receiver /** * A utility method that copies the namepaces from the SOAPEnvelope */ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ java.util.Map returnMap = new java.util.HashMap(); java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); while (namespaceIterator.hasNext()) { org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); } return returnMap; } private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) { org.apache.axis2.AxisFault f; Throwable cause = e.getCause(); if (cause != null) { f = new org.apache.axis2.AxisFault(e.getMessage(), cause); } else { f = new org.apache.axis2.AxisFault(e.getMessage()); } return f; } }//end of class /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * message receiver */ public class extends { public void invokeBusinessLogic(org.apache.axis2.context.MessageContext inMessage) throws org.apache.axis2.AxisFault{ try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(inMessage); skel = ()obj; //Out Envelop org.apache.axiom.soap.SOAPEnvelope envelope = null; //Find the axisOperation that has been set by the Dispatch phase. org.apache.axis2.description.AxisOperation op = inMessage.getOperationContext().getAxisOperation(); if (op == null) { throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } java.lang.String methodName; if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){ } else if("".equals(methodName)){ wrappedParam = ()fromOM( inMessage.getEnvelope().getBody().getFirstElement(), .class, getEnvelopeNamespaces(inMessage.getEnvelope())); skel.( , get(wrappedParam) ); skel.(wrappedParam); skel.(); //Unknown style!! No code is generated throw new java.lang.UnsupportedOperationException("Unknown Style"); (inMessage.getEnvelope().getBody().getFirstElement(), skel, null); } else { throw new java.lang.RuntimeException("method not found"); } } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } } //message-receiver /** * A utility method that copies the namepaces from the SOAPEnvelope */ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ java.util.Map returnMap = new java.util.HashMap(); java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); while (namespaceIterator.hasNext()) { org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); } return returnMap; } }//end of class /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * message receiver */ public class extends { public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext) throws org.apache.axis2.AxisFault{ try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); skel = ()obj; //Out Envelop org.apache.axiom.soap.SOAPEnvelope envelope = null; //Find the axisOperation that has been set by the Dispatch phase. org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation(); if (op == null) { throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } java.lang.String methodName; if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){ } else if("".equals(methodName)){ //doc style wrappedParam = ()fromOM( msgContext.getEnvelope().getBody().getFirstElement(), .class, getEnvelopeNamespaces(msgContext.getEnvelope())); skel.( get(wrappedParam) ); skel.(wrappedParam) ; skel.(); wrappedParam = ()fromOM( msgContext.getEnvelope().getBody().getFirstElement(), .class, getEnvelopeNamespaces(msgContext.getEnvelope())); skel.( , get(wrappedParam) ); skel.(wrappedParam) ; skel.(); envelope = getSOAPFactory(msgContext).getDefaultEnvelope(); //Unknown style!! No code is generated throw new java.lang.UnsupportedOperationException("Unknown Style"); envelope = (msgContext.getEnvelope().getBody().getFirstElement(), skel, getSOAPFactory(msgContext)); } else { throw new java.lang.RuntimeException("method not found"); } } } catch ( e) { msgContext.setProperty(org.apache.axis2.Constants.FAULT_NAME,""); org.apache.axis2.AxisFault f = createAxisFault(e); if (e.getFaultMessage() != null){ f.setDetail(toOM(e.getFaultMessage(),false)); } throw f; } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } } //message-receiver /** * A utility method that copies the namepaces from the SOAPEnvelope */ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ java.util.Map returnMap = new java.util.HashMap(); java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); while (namespaceIterator.hasNext()) { org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); } return returnMap; } private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) { org.apache.axis2.AxisFault f; Throwable cause = e.getCause(); if (cause != null) { f = new org.apache.axis2.AxisFault(e.getMessage(), cause); } else { f = new org.apache.axis2.AxisFault(e.getMessage()); } return f; } }//end of class ./src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl0000664000175000017500000000435211767656530025013 0ustar brianbrian private org.apache.axiom.om.OMElement fromOM( org.apache.axiom.om.OMElement param, java.lang.Class type, java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault { return param; } private org.apache.axiom.om.OMElement toOM(org.apache.axiom.om.OMElement param, boolean optimizeContent) throws org.apache.axis2.AxisFault { return param; } private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, org.apache.axiom.om.OMElement param, boolean optimizeContent) throws org.apache.axis2.AxisFault { org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope(); envelope.getBody().addChild(param); return envelope; } /** * get the default envelope */ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory) throws org.apache.axis2.AxisFault { return factory.getDefaultEnvelope(); } ./src/org/apache/axis2/wsdl/template/java/JaxwsServiceClassTemplate.xsl0000664000175000017500000001036511767656530025373 0ustar brianbrian package ; import java.net.URL; import javax.xml.namespace.QName; import java.net.MalformedURLException; import javax.xml.ws.Service; /** * .java * * This class was auto-generated from WSDL. * Apache Axis2 version: #axisVersion# #today# * */ @( ="" ="", ) public class extends Service { public final static URL _WSDL_LOCATION; static { URL url = null; try { url = new URL(""); } catch (MalformedURLException e) { e.printStackTrace(); } _WSDL_LOCATION = url; } public () { super(_WSDL_LOCATION, new QName("","")); } public (URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } /** * @return * returns */ @( ="" ="", ) public get() { return ()super.getPort(new QName("",""), .class); } } ./src/org/apache/axis2/wsdl/WSDLConstants.java0000664000175000017500000002161611767656530020322 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.wsdl; import org.apache.axis2.namespace.Constants; import javax.xml.namespace.QName; public interface WSDLConstants { String WSDL_1_1_STYLE = "style"; String STYLE_RPC = "rpc"; String STYLE_DOC = "document"; String STYLE_MSG = "msg"; String WSDL_4_J_DEFINITION = "wsdl4jDefinition"; String WSDL_20_DESCRIPTION = "WSDL20Description"; /** * Field WSDL2_0_NAMESPACE */ public static final String WSDL2_0_NAMESPACE = Constants.NS_URI_WSDL20; /** * Field WSDL1_1_NAMESPACE */ public static final String WSDL1_1_NAMESPACE = Constants.NS_URI_WSDL11; /** * Field WSDL_MESSAGE_DIRECTION_IN */ public static final String WSDL_MESSAGE_DIRECTION_IN = "in"; public static final String WSDL_MESSAGE_IN_MESSAGE = "inMessage"; public static final String WSDL_MESSAGE_OUT_MESSAGE = "outMessage"; public static final String SOAP_HEADER = "soap_header"; public static final String HTTP_HEADER = "http_header"; /** * Field WSDL_MESSAGE_DIRECTION_OUT */ public static final String WSDL_MESSAGE_DIRECTION_OUT = "out"; ////////////////////////////////////////////////// //////////////// Message Labels/////////////////// ////////////////////////////////////////////////// /** * Constant to represent the message label "In" which is used by the * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, * In-Optional-Out, Out-In, Out-Optional-In. */ public static final byte MESSAGE_LABEL_IN = 0; public static final String MESSAGE_LABEL_IN_VALUE = "In"; public static final String MESSAGE_LABEL_FAULT_VALUE = "Fault"; /** * Constant to represent the message label "Out" which is used by the * following WSDL 2.0 defined MEPs: In-Out, In-Optional-Out, Out-Only, * Robust Out-Only, Out-In, Out-Optional-In. */ public static final int MESSAGE_LABEL_OUT = 1; public static final String MESSAGE_LABEL_OUT_VALUE = "Out"; /** * */ public static final String WSDL_USE_LITERAL = "literal"; public static final String WSDL_USE_ENCODED = "encoded"; int WSDL_1_1 = 1; int WSDL_2_0 = 2; String INPUT_PART_QNAME_SUFFIX = "_input"; String OUTPUT_PART_QNAME_SUFFIX = "_output"; public static interface WSDL11Constants { /** * The Type name for the SOAP Address defined in the Port/Endpoint */ QName SOAP_11_ADDRESS = new QName( Constants.URI_WSDL11_SOAP, "address"); QName SOAP_12_ADDRESS = new QName( Constants.URI_WSDL12_SOAP, "address"); QName SOAP_11_OPERATION = new QName( Constants.URI_WSDL11_SOAP, "operation"); QName SOAP_12_OPERATION = new QName( Constants.URI_WSDL12_SOAP, "operation"); QName SCHEMA = new QName( Constants.URI_2001_SCHEMA_XSD, "schema"); QName SOAP_11_BODY = new QName( Constants.URI_WSDL11_SOAP, "body"); QName SOAP_12_BODY = new QName( Constants.URI_WSDL12_SOAP, "body"); QName SOAP_11_HEADER = new QName( Constants.URI_WSDL11_SOAP, "header"); QName SOAP_12_HEADER = new QName( Constants.URI_WSDL12_SOAP, "header"); QName SOAP_11_BINDING = new QName( Constants.URI_WSDL11_SOAP, "binding"); QName SOAP_12_BINDING = new QName( Constants.URI_WSDL12_SOAP, "binding"); QName POLICY = new QName( Constants.URI_POLICY, "Policy"); QName POLICY_REFERENCE = new QName( Constants.URI_POLICY, "PolicyReference"); } public static final int MEP_CONSTANT_OUT_IN = 16; public static final int MEP_CONSTANT_OUT_ONLY = 14; public static final int MEP_CONSTANT_IN_ONLY = 10; public static final int MEP_CONSTANT_ROBUST_IN_ONLY = 11; public static final int MEP_CONSTANT_IN_OUT = 12; public static final int MEP_CONSTANT_IN_OPTIONAL_OUT = 13; int MEP_CONSTANT_OUT_OPTIONAL_IN = 17; int MEP_CONSTANT_INVALID = -1; int MEP_CONSTANT_ROBUST_OUT_ONLY = 15; public static interface WSDL20_2006Constants { /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#in-only * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_ONLY */ public String MEP_URI_IN_ONLY = "http://www.w3.org/2006/01/wsdl/in-only"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#robust-in-only * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_IN_ONLY */ public String MEP_URI_ROBUST_IN_ONLY = "http://www.w3.org/2006/01/wsdl/robust-in-only"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#in-out * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OUT */ public String MEP_URI_IN_OUT = "http://www.w3.org/2006/01/wsdl/in-out"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#in-opt-out * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT */ public String MEP_URI_IN_OPTIONAL_OUT = "http://www.w3.org/2006/01/wsdl/in-opt-out"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#out-only * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_ONLY */ public String MEP_URI_OUT_ONLY = "http://www.w3.org/2006/01/wsdl/out-only"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#robust-out-only * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY */ public String MEP_URI_ROBUST_OUT_ONLY = "http://www.w3.org/2006/01/wsdl/robust-out-only"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#out-in * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_IN */ public String MEP_URI_OUT_IN = "http://www.w3.org/2006/01/wsdl/out-in"; /** * http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#out-opt-in * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN */ public String MEP_URI_OUT_OPTIONAL_IN = "http://www.w3.org/2006/01/wsdl/out-opt-in"; } public static interface WSDL20_2004_Constants { /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_ONLY */ public String MEP_URI_IN_ONLY = "http://www.w3.org/2004/08/wsdl/in-only"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_IN_ONLY */ public String MEP_URI_ROBUST_IN_ONLY = "http://www.w3.org/2004/08/wsdl/robust-in-only"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OUT */ public String MEP_URI_IN_OUT = "http://www.w3.org/2004/08/wsdl/in-out"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT */ public String MEP_URI_IN_OPTIONAL_OUT = "http://www.w3.org/2004/08/wsdl/in-opt-out"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_ONLY */ public String MEP_URI_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/out-only"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY */ public String MEP_URI_ROBUST_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/robust-out-only"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_IN */ public String MEP_URI_OUT_IN = "http://www.w3.org/2004/08/wsdl/out-in"; /** * @deprecated Please use org.apache.axis2.description.WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN */ public String MEP_URI_OUT_OPTIONAL_IN = "http://www.w3.org/2004/08/wsdl/out-opt-in"; } } ./src/org/apache/axis2/addressing/0000775000175000017500000000000011767656530016155 5ustar brianbrian./src/org/apache/axis2/addressing/EndpointReference.java0000664000175000017500000007024511767656530022427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.AxisFault; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Externalizable; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Class EndpointReference * This class models the WS-A EndpointReferenceType. But this can be used without any WS-A handlers as well * Since the models for this in Submission and Final versions are different, lets make this to comply with * WS-A Final version. So any information found with WS-A submission will be "pumped" in to this model. */ public class EndpointReference implements Externalizable, SafeSerializable { private static final long serialVersionUID = 5278892171162372439L; private static final Log log = LogFactory.getLog(EndpointReference.class); // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; private static final String myClassName = "EndpointReference"; /** * An ID which can be used to correlate operations on an instance of * this object in the log files */ private String logCorrelationIDString; /** * The list of URIs that should be considered equivalent to * the WS-Addressing anonymous URI */ private static List anonymousEquivalentURIs = new ArrayList(); /** * *

        xs:anyURI
        * xs:any* * xs:any* * * */ private String name; private String address; private ArrayList addressAttributes; private ArrayList metaData; private ArrayList metaDataAttributes; private Map referenceParameters; private ArrayList extensibleElements; private ArrayList attributes; /** * No-Arg Constructor * Required for Externalizable objects */ public EndpointReference() {} /** * Adds a parameter to the list of anonymous equivalent URIs. * @param anonymousEquivalentURI any URI that has an address that * begins with this value will be considered to be anonymous */ public static void addAnonymousEquivalentURI(String anonymousEquivalentURI){ if (log.isTraceEnabled()) log.trace("addAnonymousEquivalentURI: " + anonymousEquivalentURI); synchronized (anonymousEquivalentURIs) { anonymousEquivalentURIs.add(anonymousEquivalentURI); } } /** * @param address */ public EndpointReference(String address) { this.address = address; } /** * @param omElement */ public void addReferenceParameter(OMElement omElement) { if (omElement == null) { return; } if (referenceParameters == null) { referenceParameters = new HashMap(); } referenceParameters.put(omElement.getQName(), omElement); } /** * @param qname * @param value - the text of the OMElement. Remember that this is a convenient method for the user, * which has limited capability. If you want more power use @See EndpointReference#addReferenceParameter(OMElement) */ public void addReferenceParameter(QName qname, String value) { if (qname == null) { return; } OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(qname, null); omElement.setText(value); addReferenceParameter(omElement); } /** * This will return a Map of reference parameters with QName as the key and an OMElement * as the value * * @return - map of the reference parameters, where the key is the QName of the reference parameter * and the value is an OMElement */ public Map getAllReferenceParameters() { return referenceParameters; } public String getAddress() { return address; } /** * @param address - xs:anyURI */ public void setAddress(String address) { this.address = address; } public ArrayList getAddressAttributes() { return addressAttributes; } public void setAddressAttributes(ArrayList al) { addressAttributes = al; } public ArrayList getMetadataAttributes() { return metaDataAttributes; } public void setMetadataAttributes(ArrayList al) { metaDataAttributes = al; } /** * This method identifies whether the address is a WS-Addressing spec defined * anonymous URI. * * @return true if the address is a WS-Addressing spec defined anonymous URI. * * @see #hasAnonymousAddress() */ public boolean isWSAddressingAnonymous() { return (AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(address) || AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(address)); } /** * This method is used to identify when response messages should be sent using * the back channel of a two-way transport. * * @return true if the address is a WS-Addressing spec defined anonymous URI, * or starts with a string that is specified to be equivalent to an anonymous * URI. * * @see #addAnonymousEquivalentURI(String) */ public boolean hasAnonymousAddress() { boolean result = isWSAddressingAnonymous(); if(!result && address != null) { //If the address is not WS-A anonymous it might still be considered anonymous synchronized(anonymousEquivalentURIs){ if(!anonymousEquivalentURIs.isEmpty()){ Iterator it = anonymousEquivalentURIs.iterator(); while(it.hasNext()){ result = address.startsWith((String)it.next()); if(result){ break; } } } } //end sync } if (log.isTraceEnabled()) { log.trace("hasAnonymousAddress: " + address + " is Anonymous: " + result); } return result; } /** * hasNoneAddress * * @return true if the address is the 'None URI' from the final addressing spec. */ public boolean hasNoneAddress() { boolean result = AddressingConstants.Final.WSA_NONE_URI.equals(address); if (log.isTraceEnabled()) { log.trace("hasNoneAddress: " + address + " is None: " + result); } return result; } /** * @param localName * @param ns * @param value */ public void addAttribute(String localName, OMNamespace ns, String value) { if (attributes == null) { attributes = new ArrayList(); } attributes.add(OMAbstractFactory.getOMFactory().createOMAttribute(localName, ns, value)); } public ArrayList getAttributes() { return attributes; } /** * @param omAttribute */ public void addAttribute(OMAttribute omAttribute) { if (attributes == null) { attributes = new ArrayList(); } attributes.add(omAttribute); } public ArrayList getExtensibleElements() { return extensibleElements; } /** * {any} * * @param extensibleElements */ public void setExtensibleElements(ArrayList extensibleElements) { this.extensibleElements = extensibleElements; } public void addExtensibleElement(OMElement extensibleElement) { if (extensibleElement != null) { if (this.extensibleElements == null) { this.extensibleElements = new ArrayList(); } this.extensibleElements.add(extensibleElement); } } public ArrayList getMetaData() { return metaData; } public void addMetaData(OMNode metaData) { if (metaData != null) { if (this.metaData == null) { this.metaData = new ArrayList(); } this.metaData.add(metaData); } } /** * @deprecated */ public String getName() { return name; } /** * @param name * @deprecated */ public void setName(String name) { this.name = name; } /** * Set a Map with QName as the key and an OMElement * as the value * * @param referenceParameters */ public void setReferenceParameters(Map referenceParameters) { this.referenceParameters = referenceParameters; } /* * (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuffer buffer = new StringBuffer("Address: " + address); if (addressAttributes != null) { buffer.append(", Address Attributes: ").append(addressAttributes); } if (metaData != null) { buffer.append(", Metadata: ").append(metaData); } if (metaDataAttributes != null) { buffer.append(", Metadata Attributes: ").append(metaDataAttributes); } if (referenceParameters != null) { buffer.append(", Reference Parameters: ").append(referenceParameters); } if (extensibleElements != null) { buffer.append(", Extensibility elements: ").append(extensibleElements); } if (attributes != null) { buffer.append(", Attributes: ").append(attributes); } return buffer.toString(); } /** * @param eprOMElement * @deprecated use {@link EndpointReferenceHelper#fromOM(OMElement)} instead. */ public void fromOM(OMElement eprOMElement) { OMElement addressElement = eprOMElement.getFirstChildWithName(new QName("Address")); setAddress(addressElement.getText()); Iterator allAddrAttributes = addressElement.getAllAttributes(); if (addressAttributes == null) { addressAttributes = new ArrayList(); } while (allAddrAttributes.hasNext()) { OMAttribute attribute = (OMAttribute) allAddrAttributes.next(); addressAttributes.add(attribute); } OMElement refParamElement = eprOMElement .getFirstChildWithName(new QName(AddressingConstants.EPR_REFERENCE_PARAMETERS)); if (refParamElement != null) { Iterator refParams = refParamElement.getChildElements(); while (refParams.hasNext()) { OMElement omElement = (OMElement) refParams.next(); addReferenceParameter(omElement); } } OMElement metaDataElement = eprOMElement .getFirstChildWithName(new QName(AddressingConstants.Final.WSA_METADATA)); if (metaDataElement != null) { Iterator children = metaDataElement.getChildren(); while (children.hasNext()) { OMNode omNode = (OMNode) children.next(); addMetaData(omNode); } } setName(eprOMElement.getLocalName()); Iterator allAttributes = eprOMElement.getAllAttributes(); if (attributes == null) { attributes = new ArrayList(); } while (allAttributes.hasNext()) { OMAttribute attribute = (OMAttribute) allAttributes.next(); attributes.add(attribute); } Iterator childElements = eprOMElement.getChildElements(); while (childElements.hasNext()) { OMElement eprChildElement = (OMElement) childElements.next(); String localName = eprChildElement.getLocalName(); if (!localName.equals("Address") && !localName.equals(AddressingConstants.EPR_REFERENCE_PARAMETERS) && !localName.equals(AddressingConstants.Final.WSA_METADATA)) { addExtensibleElement(eprChildElement); } } } /** * @param nsurl * @param localName * @param prefix * @throws AxisFault * @deprecated use {@link EndpointReferenceHelper#toOM(EndpointReference, QName, String)} instead. */ public OMElement toOM(String nsurl, String localName, String prefix) throws AxisFault { OMFactory fac = OMAbstractFactory.getOMFactory(); if (prefix != null) { OMNamespace wrapNs = fac.createOMNamespace(nsurl, prefix); OMElement epr = fac.createOMElement(localName, wrapNs); OMNamespace wsaNS = fac.createOMNamespace(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_DEFAULT_PREFIX); OMElement addressE = fac.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS, epr); addressE.setText(address); if (addressAttributes != null) { Iterator attrIter = addressAttributes.iterator(); while (attrIter.hasNext()) { OMAttribute omAttributes = (OMAttribute) attrIter.next(); addressE.addAttribute(omAttributes); } } if (this.metaData != null) { OMElement metadataE = fac.createOMElement(AddressingConstants.Final.WSA_METADATA, wsaNS, epr); Iterator metadata = this.metaData.iterator(); while (metadata.hasNext()) { metadataE.addChild((OMNode) metadata.next()); } } if (this.referenceParameters != null) { OMElement refParameterElement = fac.createOMElement(AddressingConstants.EPR_REFERENCE_PARAMETERS, wsaNS, epr); Iterator refParms = referenceParameters.values().iterator(); while (refParms.hasNext()) { refParameterElement.addChild((OMNode) refParms.next()); } } if (attributes != null) { Iterator attrIter = attributes.iterator(); while (attrIter.hasNext()) { OMAttribute omAttributes = (OMAttribute) attrIter.next(); epr.addAttribute(omAttributes); } } // add xs:any ArrayList omElements = extensibleElements; if (omElements != null) { for (int i = 0; i < omElements.size(); i++) { epr.addChild((OMElement) omElements.get(i)); } } return epr; } else { throw new AxisFault("prefix must be specified"); } } /** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. *

        * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). *

        * * @param epr The object to compare with * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(EndpointReference epr) { // NOTE: the input object is expected to exist (ie, be non-null) if ((this.name != null) && (epr.getName() != null)) { if (!this.name.equals(epr.getName())) { return false; } } else if ((this.name == null) && (epr.getName() == null)) { // continue } else { // mismatch return false; } if ((this.address != null) && (epr.getAddress() != null)) { if (!this.address.equals(epr.getAddress())) { return false; } } else if ((this.address == null) && (epr.getAddress() == null)) { // continue } else { // mismatch return false; } // TODO: is a strict test ok to use? ArrayList eprMetaData = epr.getMetaData(); if ((this.metaData != null) && (eprMetaData != null)) { if (!this.metaData.equals(eprMetaData)) { // This is a strict test // Returns true if and only if the specified object // is also a list, both lists have the same size, and // all corresponding pairs of elements in the two lists // are equal, ie, two lists are defined to be equal if // they contain the same elements in the same order. return false; } } else if ((this.metaData == null) && (eprMetaData == null)) { // keep going } else { // one of the lists is null return false; } ArrayList eprExtensibleElements = epr.getExtensibleElements(); if ((this.extensibleElements != null) && (eprExtensibleElements != null)) { if (!this.extensibleElements.equals(eprExtensibleElements)) { // This is a strict test // Returns true if and only if the specified object // is also a list, both lists have the same size, and // all corresponding pairs of elements in the two lists // are equal, ie, two lists are defined to be equal if // they contain the same elements in the same order. return false; } } else if ((this.extensibleElements == null) && (eprExtensibleElements == null)) { // keep going } else { // one of the lists is null return false; } ArrayList eprAttributes = epr.getAttributes(); if ((this.attributes != null) && (eprAttributes != null)) { if (!this.attributes.equals(eprAttributes)) { // This is a strict test // Returns true if and only if the specified object // is also a list, both lists have the same size, and // all corresponding pairs of elements in the two lists // are equal, ie, two lists are defined to be equal if // they contain the same elements in the same order. return false; } } else if ((this.attributes == null) && (eprAttributes == null)) { // keep going } else { // one of the lists is null return false; } // TODO: check the Map referenceParameters for equivalency return true; } //REVIEW: The following code is rather heavyweight, because we have to build // the OM tree -- it would probably be better to have two serialization/deserialization // paths and therefore, for trivial EPRs, store a smaller amount of info /** * Write the EPR to the specified OutputStream. Because of potential * OMElements/Attributes, we need to actually serialize the OM structures * (at least in some cases.) */ public void writeExternal(java.io.ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // revision ID out.writeInt(revisionID); // Correlation ID String logCorrelationIDString = getLogCorrelationIDString(); // String object id out.writeObject(logCorrelationIDString); // Write out the content as xml out.writeUTF("start xml"); // write marker OMElement om = EndpointReferenceHelper.toOM(OMAbstractFactory.getOMFactory(), this, new QName("urn:axis2", "omepr", "ser"), AddressingConstants.Final.WSA_NAMESPACE); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { om.serialize(baos); } catch (Exception e) { IOException ioe = new IOException("Unable to serialize the EndpointReference with logCorrelationID [" +logCorrelationIDString+"]"); ioe.initCause(e); if (log.isDebugEnabled()) { log.debug("writeObject(): Unable to serialize the EPR with logCorrelationID [" +logCorrelationIDString+"] original error ["+e.getClass().getName() +"] message ["+e.getMessage()+"]",e); } throw ioe; } out.writeInt(baos.size()); out.write(baos.toByteArray()); out.writeUTF("end xml"); // write marker if (log.isDebugEnabled()) { byte[] buffer = baos.toByteArray(); String content = new String(buffer); log.debug("writeObject(): EPR logCorrelationID ["+logCorrelationIDString+"] " +" EPR content size ["+baos.size()+"]" +" EPR content ["+content+"]"); } } /** * Read the EPR to the specified InputStream. */ public void readExternal(java.io.ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // revision ID int revID = in.readInt(); // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } // String object id logCorrelationIDString = (String) in.readObject(); // Read xml content in.readUTF(); // read marker int numBytes = in.readInt(); byte[] serBytes = new byte[numBytes]; // read the data from the input stream int bytesRead = 0; int numberOfBytesLastRead; while (bytesRead < numBytes) { numberOfBytesLastRead = in.read(serBytes, bytesRead, numBytes - bytesRead); if (numberOfBytesLastRead == -1) { // TODO: What should we do if the reconstitution fails? // For now, log the event and throw an exception if (log.isDebugEnabled()) { log.debug("readObject(): EPR logCorrelationID ["+logCorrelationIDString+"] " + " ***WARNING*** unexpected end to data: data read from input stream [" + bytesRead + "] expected data size [" + numBytes + "]"); } IOException ioe = new IOException("Unable to deserialize the EndpointReference with logCorrelationID [" +logCorrelationIDString+"]" +" Cause: Unexpected end to data from input stream"); throw ioe; } bytesRead += numberOfBytesLastRead; } if (bytesRead == 0) { IOException ioe = new IOException("Unable to deserialize the EndpointReference with logCorrelationID [" +logCorrelationIDString+"]" +" Cause: No data from input stream"); throw ioe; } in.readUTF(); // read marker ByteArrayInputStream bais = new ByteArrayInputStream(serBytes); if (log.isDebugEnabled()) { String content = new String(serBytes); log.debug("readObject(): EPR logCorrelationID ["+logCorrelationIDString+"] " +" expected content size ["+numBytes+"]" +" content size ["+content.length()+"]" +" EPR buffered content ["+content+"]"); } XMLStreamReader xmlReader = null; try { xmlReader = StAXUtils.createXMLStreamReader(bais); StAXOMBuilder builder = new StAXOMBuilder(xmlReader); OMElement om = builder.getDocumentElement(); // expand the OM so we can close the stream reader om.build(); // trace point if (log.isDebugEnabled()) { log.debug(myClassName + ":readObject(): " + " EPR ["+logCorrelationIDString + "]" + " EPR OM content ["+om.toString()+ "]"); } EndpointReferenceHelper.fromOM(this, om, AddressingConstants.Final.WSA_NAMESPACE); } catch (Exception e) { IOException ioe = new IOException("Unable to deserialize the EndpointReference with logCorrelationID [" +logCorrelationIDString+"]"); ioe.initCause(e); if (log.isDebugEnabled()) { log.debug("readObject(): Unable to deserialize the EPR with logCorrelationID [" +logCorrelationIDString+"] original error ["+e.getClass().getName() +"] message ["+e.getMessage()+"]",e); } throw ioe; } finally { // Make sure that the reader is properly closed // Note that closing a ByteArrayInputStream has no effect if (xmlReader != null) { try { xmlReader.close(); } catch (Exception e2) { IOException ioe2 = new IOException("Unable to close the XMLStreamReader for the EndpointReference with logCorrelationID [" +logCorrelationIDString+"]"); ioe2.initCause(e2); if (log.isDebugEnabled()) { log.debug("readObject(): Unable to close the XMLStreamReader for the EPR with logCorrelationID [" +logCorrelationIDString+"] original error ["+e2.getClass().getName() +"] message ["+e2.getMessage()+"]",e2); } throw ioe2; } } } } /** * Get the ID associated with this object instance. * * @return A string that can be output to a log file as an identifier * for this object instance. It is suitable for matching related log * entries. */ public String getLogCorrelationIDString() { if (logCorrelationIDString == null) { logCorrelationIDString = myClassName + "@" + UUIDGenerator.getUUID(); } return logCorrelationIDString; } } ./src/org/apache/axis2/addressing/AddressingConstants.java0000664000175000017500000003105111767656530023000 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing; import javax.xml.namespace.QName; /** * Interface AddressingConstants */ public interface AddressingConstants { // ====================== Common Message Addressing Properties =================== static final String WSA_MESSAGE_ID = "MessageID"; static final String WSA_RELATES_TO = "RelatesTo"; static final String WSA_RELATES_TO_RELATIONSHIP_TYPE = "RelationshipType"; static final String WSA_TO = "To"; static final String WSA_REPLY_TO = "ReplyTo"; static final String WSA_FROM = "From"; static final String WSA_FAULT_TO = "FaultTo"; static final String WSA_ACTION = "Action"; static final String EPR_SERVICE_NAME = "ServiceName"; static final String EPR_REFERENCE_PARAMETERS = "ReferenceParameters"; // ====================== Common EPR Elements ============================ static final String EPR_ADDRESS = "Address"; static final String WS_ADDRESSING_VERSION = "WSAddressingVersion"; static final String WSA_DEFAULT_PREFIX = "wsa"; static final String PARAM_SERVICE_GROUP_CONTEXT_ID = "ServiceGroupContextIdFromAddressing"; static final String IS_ADDR_INFO_ALREADY_PROCESSED = "IsAddressingProcessed"; static final String DISABLE_ADDRESSING_FOR_IN_MESSAGES = "disableAddressingForInMessages"; static final String ADDR_VALIDATE_ACTION = "addressing.validateAction"; // ====================== WSDL Binding Constants ======================== static final String USING_ADDRESSING = "UsingAddressing"; static final String ANONYMOUS = "Anonymous"; // ====================== Addressing Requirement Levels ================== // These are used to represent the requirement level on WS-Addressing indicated // in a services.xml or a WSDL file. static final String ADDRESSING_REQUIREMENT_PARAMETER = "addressingRequirementParameter"; // ADDRESSING_UNSPECIFIED is the equivalent of no UsingAddressing flag in a // WSDL file and the default of the WSAddressingRequred attribute in service.xml static final String ADDRESSING_UNSPECIFIED = "unspecified"; // ADDRESSING_OPTIONAL is the equivalent of // in a WSDL file static final String ADDRESSING_OPTIONAL = "optional"; // ADDRESSING_REQUIRED is the equivalent of // in a WSDL file static final String ADDRESSING_REQUIRED = "required"; // If this property is set, addressing headers will be replaced from the information in the // message context. static final String REPLACE_ADDRESSING_HEADERS = "ReplaceAddressingHeaders"; // this property once set to Boolean.TRUE will make the messages to skip Addressing Handler. // So you will not see Addressing Headers in the OUT path. static final String DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages"; static final String ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS = "addMustUnderstandToAddressingHeaders"; static final String SOAP_ROLE_FOR_ADDRESSING_HEADERS = "wsaddressingRole"; /** * A property pointing to an ArrayList of OMAttribute objects representing any attributes * of the wsa:Action header. */ static final String ACTION_ATTRIBUTES = "actionAttributes"; /** * A property pointing to an ArrayList of OMAttribute objects representing any attributes * of the wsa:MessageID header. */ static final String MESSAGEID_ATTRIBUTES = "messageidAttributes"; /** * When set to Boolean.TRUE this will cause the addressing out handler to output all * populated addressing headers in a message, including any optional ones. */ static final String INCLUDE_OPTIONAL_HEADERS = "includeOptionalHeaders"; /** * This property, if set to Boolean.TRUE, will mean that the addressing handler allows partially * ws-addressed messages to be sent even if they are then invalid rather than throwing a fault. *

        * It is not clear how necessary this property is and it may be removed before the next release if * it is not seen to be necessary - davidillsley@apache.org */ static final String DISABLE_OUTBOUND_ADDRESSING_VALIDATION = "disableAddressingOutboundValidation"; /** * This parameter is used to attach OMElement ReferenceParameters found in an EPR embedded in a * WSDL to an AxisEndpoint object. */ static final String REFERENCE_PARAMETER_PARAMETER = "referenceParameters"; /** * This parameter is used to decide whether the reference parameters in an inbound request * message are to be processed or not. */ static final String DISABLE_REF_PARAMETER_EXTRACT = "disableRefParamExtract"; static final String WSAM_INVOCATION_PATTERN_PARAMETER_NAME = "wsamInvocationPattern"; static final String WSAM_INVOCATION_PATTERN_SYNCHRONOUS = "synchronous"; static final String WSAM_INVOCATION_PATTERN_ASYNCHRONOUS = "asynchronous"; static final String WSAM_INVOCATION_PATTERN_BOTH = "both"; // ======================== Common Faults ============================== static final String FAULT_ACTION_NOT_SUPPORTED = "ActionNotSupported"; static final String FAULT_ACTION_NOT_SUPPORTED_REASON = "The [action] cannot be processed at the receiver."; static final String FAULT_ADDRESSING_DESTINATION_UNREACHABLE = "DestinationUnreachable"; interface Final { // ====================== Addressing 1.0 Final Version Constants ==================== static final String WSA_NAMESPACE = "http://www.w3.org/2005/08/addressing"; static final String WSAW_NAMESPACE = "http://www.w3.org/2006/05/addressing/wsdl"; static final String WSAM_NAMESPACE = "http://www.w3.org/2007/05/addressing/metadata"; /** * @deprecated use {@link #WSA_DEFAULT_RELATIONSHIP_TYPE} instead. */ static final String WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE = "http://www.w3.org/2005/08/addressing/reply"; static final String WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE = "IsReferenceParameter"; static final String WSA_ANONYMOUS_URL = "http://www.w3.org/2005/08/addressing/anonymous"; static final String WSA_NONE_URI = "http://www.w3.org/2005/08/addressing/none"; static final String WSA_FAULT_ACTION = "http://www.w3.org/2005/08/addressing/fault"; static final String WSA_SOAP_FAULT_ACTION = "http://www.w3.org/2005/08/addressing/soap/fault"; static final String WSA_TYPE_ATTRIBUTE_VALUE = "true"; static final String WSA_SERVICE_NAME_ENDPOINT_NAME = "EndpointName"; static final String WSA_POLICIES = "Policies"; static final String WSA_METADATA = "Metadata"; static final String WSA_DEFAULT_METADATA_PREFIX = "wsam"; static final String WSA_ORIGINAL_METADATA_PREFIX = "wsaw"; static final String WSA_INTERFACE_NAME = "InterfaceName"; static final String WSA_DEFAULT_RELATIONSHIP_TYPE = "http://www.w3.org/2005/08/addressing/reply"; // fault information static final String FAULT_HEADER_PROB_HEADER_QNAME = "ProblemHeaderQName"; static final String FAULT_HEADER_PROB_HEADER = "ProblemHeader"; static final String FAULT_HEADER_PROB_IRI = "ProblemIRI"; static final String FAULT_HEADER_DETAIL = "FaultDetail"; static final String FAULT_INVALID_HEADER = "InvalidAddressingHeader"; static final String FAULT_INVALID_HEADER_REASON = "A header representing a Message Addressing Property is not valid and the message cannot be processed"; static final String FAULT_ADDRESSING_HEADER_REQUIRED = "MessageAddressingHeaderRequired"; static final String FAULT_ADDRESSING_HEADER_REQUIRED_REASON = "A required header representing a Message Addressing Property is not present"; static final String FAULT_ADDRESSING_DESTINATION_UNREACHABLE_REASON = "No route can be determined to reach [destination]"; static final String FAULT_INVALID_CARDINALITY = "InvalidCardinality"; static final String FAULT_ONLY_ANONYMOUS_ADDRESS_SUPPORTED = "OnlyAnonymousAddressSupported"; static final String FAULT_ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED = "OnlyNonAnonymousAddressSupported"; static final String FAULT_PROBLEM_ACTION_NAME = "ProblemAction"; static final QName WSAW_USING_ADDRESSING = new QName(WSAW_NAMESPACE, USING_ADDRESSING); static final QName WSAW_ANONYMOUS = new QName(WSAW_NAMESPACE, USING_ADDRESSING); static final QName WSA_ENDPOINT_REFERENCE = new QName(WSA_NAMESPACE,"EndpointReference"); final QName QNAME_WSA_TO = new QName(WSA_NAMESPACE, WSA_TO); final QName QNAME_WSA_FROM = new QName(WSA_NAMESPACE, WSA_FROM); final QName QNAME_WSA_REPLY_TO = new QName(WSA_NAMESPACE, WSA_REPLY_TO); final QName QNAME_WSA_RELATES_TO = new QName(WSA_NAMESPACE, WSA_RELATES_TO); final QName QNAME_WSA_MESSAGE_ID = new QName(WSA_NAMESPACE, WSA_MESSAGE_ID); final QName QNAME_WSA_HEADER_DETAIL = new QName(WSA_NAMESPACE, FAULT_HEADER_DETAIL); final QName QNAME_PROBLEM_HEADER = new QName(WSA_NAMESPACE, FAULT_HEADER_PROB_HEADER_QNAME); final QName QNAME_INVALID_HEADER = new QName(WSA_NAMESPACE, FAULT_INVALID_HEADER); } interface Submission { // ====================== Addressing Submission Version Constants =================== static final String WSA_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/08/addressing"; /** * @deprecated use {@link #WSA_DEFAULT_RELATIONSHIP_TYPE} instead. */ static final String WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE = "wsa:Reply"; static final String WSA_DEFAULT_RELATIONSHIP_TYPE = "wsa:Reply"; static final String WSA_ANONYMOUS_URL = "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"; static final String EPR_REFERENCE_PROPERTIES = "ReferenceProperties"; static final String WSA_FAULT_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault"; static final String WSA_SERVICE_NAME_ENDPOINT_NAME = "PortName"; static final String WSA_INTERFACE_NAME = "PortType"; // fault information static final String FAULT_INVALID_HEADER = "InvalidMessageInformationHeader"; static final String FAULT_INVALID_HEADER_REASON = "A message information header is not valid and the message cannot be processed. The validity failure can be either structural or semantic, e.g. a [destination] that is not a URI or a [relationship] to a [message id] that was never issued."; static final String FAULT_ADDRESSING_HEADER_REQUIRED = "MessageInformationHeaderRequired"; static final String FAULT_ADDRESSING_HEADER_REQUIRED_REASON = "A required message information header, To, MessageID, or Action, is not present."; static final String FAULT_ADDRESSING_DESTINATION_UNREACHABLE_REASON = "No route can be determined to reach the destination role defined by the WS-Addressing To."; static final QName WSAW_USING_ADDRESSING = new QName(WSA_NAMESPACE, USING_ADDRESSING); final QName QNAME_WSA_TO = new QName(WSA_NAMESPACE, WSA_TO); final QName QNAME_WSA_FROM = new QName(WSA_NAMESPACE, WSA_FROM); final QName QNAME_WSA_REPLY_TO = new QName(WSA_NAMESPACE, WSA_REPLY_TO); final QName QNAME_WSA_RELATES_TO = new QName(WSA_NAMESPACE, WSA_RELATES_TO); final QName QNAME_WSA_MESSAGE_ID = new QName(WSA_NAMESPACE, WSA_MESSAGE_ID); } } ./src/org/apache/axis2/addressing/wsdl/0000775000175000017500000000000011767656530017126 5ustar brianbrian./src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java0000664000175000017500000004323611767656530026055 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing.wsdl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Input; import javax.wsdl.Operation; import javax.wsdl.OperationType; import javax.wsdl.Output; import javax.wsdl.PortType; /** * Generates a wsa:Action value using the Default Action Pattern defined at * http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#defactionwsdl11 */ public class WSDL11DefaultActionPatternHelper { private static final Log log = LogFactory.getLog(WSDL11DefaultActionPatternHelper.class); // String constants used extensively in this class private static final String URN = "urn"; private static final String SLASH = "/"; private static final String COLON = ":"; private static final String REQUEST = "Request"; private static final String RESPONSE = "Response"; private static final String SOLICIT = "Solicit"; private static final String FAULT = "Fault"; /** * Generate the Action for an Input using the Default Action Pattern *

        * Pattern is defined as [target namespace][delimiter][port type name][delimiter][input name] * * @param def is required to obtain the targetNamespace * @param wsdl4jPortType is required to obtain the portType name * @param op is required to generate the input name if not explicitly specified * @param input is required for its name if specified * @return a wsa:Action value based on the Default Action Pattern and the provided objects */ public static String generateActionFromInputElement(Definition def, PortType wsdl4jPortType, Operation op, Input input) { // Get the targetNamespace of the wsdl:definitions String targetNamespace = def.getTargetNamespace(); // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // Get the portType name (as a string to be included in the action) String portTypeName = wsdl4jPortType.getQName().getLocalPart(); // Get the name of the input element (and generate one if none explicitly specified) String inputName = getNameFromInputElement(op, input); // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(inputName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("generateActionFromInputElement result: " + result); } return result; } /** * Get the name of the specified Input element using the rules defined in WSDL 1.1 * Section 2.4.5 http://www.w3.org/TR/wsdl#_names */ private static String getNameFromInputElement(Operation op, Input input) { // Get the name from the input element if specified. String result = input.getName(); // If not we'll have to generate it. if (result == null) { // If Request-Response or Solicit-Response do something special per // WSDL 1.1 Section 2.4.5 OperationType operationType = op.getStyle(); if (null != operationType) { if (operationType.equals(OperationType.REQUEST_RESPONSE)) { result = op.getName() + REQUEST; } else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) { result = op.getName() + RESPONSE; } } // If the OperationType was not available for some reason, assume on-way or notification if (result == null) { result = op.getName(); } } return result; } protected static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName) { if (messageExchangePattern == null && inputName == null) { throw new IllegalArgumentException( "One of messageExchangePattern or inputName must the non-null to generate an action."); } // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // N.B. Unlike core Axis2 processing WSDL, JAX-WS accotation processing passes in the // out-in MEP when constructing the client, hence we need to take account of it here // in addition to the expected in-out if (inputName == null) { inputName = operationName; if (messageExchangePattern.indexOf("in-out") >= 0) { inputName += REQUEST; } else if (messageExchangePattern.indexOf("out-in") >= 0) { inputName += RESPONSE; } } // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(inputName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("getInputActionFromStringInformation result: " + result); } return result; } /** * Generate the Action for an Output using the Default Action Pattern *

        * Pattern is defined as [target namespace][delimiter][port type name][delimiter][output name] * * @param def is required to obtain the targetNamespace * @param wsdl4jPortType is required to obtain the portType name * @param op is required to generate the output name if not explicitly specified * @param output is required for its name if specified * @return a wsa:Action value based on the Default Action Pattern and the provided objects */ public static String generateActionFromOutputElement(Definition def, PortType wsdl4jPortType, Operation op, Output output) { // Get the targetNamespace of the wsdl:definition String targetNamespace = def.getTargetNamespace(); // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // Get the portType name (as a string to be included in the action) String portTypeName = wsdl4jPortType.getQName().getLocalPart(); // Get the name of the output element (and generate one if none explicitly specified) String outputName = getNameFromOutputElement(op, output); // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(outputName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("generateActionFromOutputElement result: " + result); } return result; } /** * Get the name of the specified Output element using the rules defined in WSDL 1.1 * Section 2.4.5 http://www.w3.org/TR/wsdl#_names */ private static String getNameFromOutputElement(Operation op, Output output) { // Get the name from the output element if specified. String result = output.getName(); // If not we'll have to generate it. if (result == null) { // If Request-Response or Solicit-Response do something special per // WSDL 1.1 Section 2.4.5 OperationType operationType = op.getStyle(); if (null != operationType) { if (operationType.equals(OperationType.REQUEST_RESPONSE)) { return op.getName() + RESPONSE; } else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) { return op.getName() + SOLICIT; } } // If the OperationType was not available for some reason, assume on-way or notification if (result == null) { result = op.getName(); } } return result; } protected static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName) { if (messageExchangePattern == null && outputName == null) { throw new IllegalArgumentException( "One of messageExchangePattern or outputName must the non-null to generate an action."); } // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // N.B. Unlike core Axis2 processing WSDL, JAX-WS annotation processing passes in the // out-in MEP when constructing the client, hence we need to take account of it here // in addition to the expected in-out if (outputName == null) { outputName = operationName; if (messageExchangePattern.indexOf("in-out") >= 0) { outputName += RESPONSE; } else if (messageExchangePattern.indexOf("out-in") >= 0) { outputName += REQUEST; } } // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(outputName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("getOutputActionFromStringInformation result: " + result); } return result; } /** * Generate the Action for a Fault using the Default Action Pattern *

        * Pattern is defined as [target namespace][delimiter][port type name][delimiter][operation name][delimiter]Fault[delimiter][fault name] * * @param def is required to obtain the targetNamespace * @param wsdl4jPortType is required to obtain the portType name * @param op is required to obtain the operation name * @param fault is required to obtain the fault name * @return a wsa:Action value based on the Default Action Pattern and the provided objects */ public static String generateActionFromFaultElement(Definition def, PortType wsdl4jPortType, Operation op, Fault fault) { // Get the targetNamespace of the wsdl:definition String targetNamespace = def.getTargetNamespace(); // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // Get the portType name (as a string to be included in the action) String portTypeName = wsdl4jPortType.getQName().getLocalPart(); // Get the operation name (as a string to be included in the action) String operationName = op.getName(); // Get the name of the fault element (name is mandatory on fault elements) String faultName = fault.getName(); // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(operationName); sb.append(delimiter); sb.append(FAULT); sb.append(delimiter); sb.append(faultName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("generateActionFromFaultElement result: " + result); } return result; } protected static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName) { // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" // character), the default action value may not conform to the rules of the IRI scheme. Authors // are advised to specify explicit values in the WSDL in this case.' String delimiter = SLASH; if (targetNamespace.toLowerCase().startsWith(URN)) { delimiter = COLON; } // Append the bits together StringBuffer sb = new StringBuffer(); sb.append(targetNamespace); // Deal with the problem that the targetNamespace may or may not have a trailing delimiter if (!targetNamespace.endsWith(delimiter)) { sb.append(delimiter); } sb.append(portTypeName); sb.append(delimiter); sb.append(operationName); sb.append(delimiter); sb.append(FAULT); sb.append(delimiter); sb.append(faultName); // Resolve the action from the StringBuffer String result = sb.toString(); if (log.isTraceEnabled()) { log.trace("getFaultActionFromStringInformation result: " + result); } return result; } } ./src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java0000664000175000017500000002154411767656530023210 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing.wsdl; import org.apache.axis2.addressing.AddressingConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Input; import javax.wsdl.Operation; import javax.wsdl.Output; import javax.wsdl.PortType; import javax.wsdl.extensions.AttributeExtensible; import javax.xml.namespace.QName; import java.util.List; /** * The WSDL11ActionHelper provides 3 static methods to determine the correct wsa:Action value from * a wsdl4j Input/Output/Fault object. It first attempts to access the wsaw:Action attribute and if * that is not found uses the WSDL11DefaultActionPatternHelper to generate and Action based on the * Default Action Pattern for WSDL1.1 at http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#defactionwsdl11 */ public class WSDL11ActionHelper { private static final Log log = LogFactory.getLog(WSDL11ActionHelper.class); private static final QName submissionWSAWNS = new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.WSA_ACTION); private static final QName finalWSANS = new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION); private static final QName finalWSAWNS = new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION); private static final QName finalWSAMNS = new QName(AddressingConstants.Final.WSAM_NAMESPACE, AddressingConstants.WSA_ACTION); /** * getActionFromInputElement * * @param def the wsdl:definitions which contains the wsdl:portType * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation * @param op the wsdl:operation which contains the input element * @param input the input element to be examined to generate the wsa:Action * @return either the wsaw:Action from the input element or an action generated using the DefaultActionPattern */ public static String getActionFromInputElement(Definition def, PortType wsdl4jPortType, Operation op, Input input) { String result = getWSAWActionExtensionAttribute(input); if (result == null) { result = WSDL11DefaultActionPatternHelper .generateActionFromInputElement(def, wsdl4jPortType, op, input); } log.trace(result); return result; } /** * getActionFromOutputElement * * @param def the wsdl:definitions which contains the wsdl:portType * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation * @param op the wsdl:operation which contains the output element * @param output the input element to be examined to generate the wsa:Action * @return either the wsaw:Action from the output element or an action generated using the DefaultActionPattern */ public static String getActionFromOutputElement(Definition def, PortType wsdl4jPortType, Operation op, Output output) { String result = getWSAWActionExtensionAttribute(output); if (result == null) { result = WSDL11DefaultActionPatternHelper .generateActionFromOutputElement(def, wsdl4jPortType, op, output); } log.trace(result); return result; } /** * getActionFromFaultElement * * @param def the wsdl:definitions which contains the wsdl:portType * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation * @param op the wsdl:operation which contains the fault element * @param fault the fault element to be examined to generate the wsa:Action * @return either the wsaw:Action from the fault element or an action generated using the DefaultActionPattern */ public static String getActionFromFaultElement(Definition def, PortType wsdl4jPortType, Operation op, Fault fault) { String result = getWSAWActionExtensionAttribute(fault); if (result == null) { result = WSDL11DefaultActionPatternHelper .generateActionFromFaultElement(def, wsdl4jPortType, op, fault); } log.trace(result); return result; } private static String getWSAWActionExtensionAttribute(AttributeExtensible ae) { // Search first for a wsaw:Action using the submission namespace Object attribute = ae.getExtensionAttribute(submissionWSAWNS); // Then if that did not exist one using the w3c WSAM namespace if (attribute == null) { attribute = ae.getExtensionAttribute(finalWSAMNS); } // Then if that did not exist one using the w3c WSAW namespace // (for backwards compat reasons) if (attribute == null) { attribute = ae.getExtensionAttribute(finalWSAWNS); } // Then finally if that did not exist, try the 2005/08 NS // (Included here because it's needed for Apache Muse) if (attribute == null) { attribute = ae.getExtensionAttribute(finalWSANS); } // wsdl4j may return a String, QName or a List of either // If it is a list, extract the first element if (attribute instanceof List) { List l = (List) attribute; if (l.size() > 0) { attribute = l.get(0); } else { attribute = null; } } // attribute must now be a QName or String or null // If it is a QName, take the LocalPart as a String if (attribute instanceof QName) { QName qn = (QName) attribute; attribute = qn.getLocalPart(); } if ((attribute instanceof String)) { String result = (String) attribute; log.trace(result); return result; } else { if (log.isTraceEnabled()) { log.trace("No wsaw:Action attribute found"); } return null; } } public static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName) { return WSDL11DefaultActionPatternHelper.getInputActionFromStringInformation( messageExchangePattern, targetNamespace, portTypeName, operationName, inputName); } public static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName) { return WSDL11DefaultActionPatternHelper.getOutputActionFromStringInformation( messageExchangePattern, targetNamespace, portTypeName, operationName, outputName); } public static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName) { return WSDL11DefaultActionPatternHelper.getFaultActionFromStringInformation(targetNamespace, portTypeName, operationName, faultName); } } ./src/org/apache/axis2/addressing/metadata/0000775000175000017500000000000011767656530017735 5ustar brianbrian./src/org/apache/axis2/addressing/metadata/ServiceName.java0000664000175000017500000001552511767656530023011 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing.metadata; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingConstants.Final; import org.apache.axis2.addressing.AddressingConstants.Submission; import javax.xml.namespace.QName; public class ServiceName { public static final QName subQName = new QName(Submission.WSA_NAMESPACE, AddressingConstants.EPR_SERVICE_NAME, AddressingConstants.WSA_DEFAULT_PREFIX); public static final QName wsamQName = new QName(Final.WSAM_NAMESPACE, AddressingConstants.EPR_SERVICE_NAME, Final.WSA_DEFAULT_METADATA_PREFIX); public static final QName wsawQName = new QName(Final.WSAW_NAMESPACE, AddressingConstants.EPR_SERVICE_NAME, Final.WSA_ORIGINAL_METADATA_PREFIX); /** * Field name */ private QName name; /** * Field portName */ private String endpointName; /** * * */ public ServiceName() { } /** * @param name */ public ServiceName(QName name) { this.name = name; } /** * @param name * @param endpointName */ public ServiceName(QName name, String endpointName) { this.name = name; this.endpointName = endpointName; } /** * Method getName */ public QName getName() { return name; } /** * Method getPortName */ public String getEndpointName() { return endpointName; } /** * Method setName * * @param name */ public void setName(QName name) { this.name = name; } /** * Method setPortName * * @param endpointName */ public void setEndpointName(String endpointName) { this.endpointName = endpointName; } /** * Convenience method to convert objects of this type to an {@link OMElement} so that it * can be added to an {@link org.apache.axis2.addressing.EndpointReference} * *

        Use:

        *

        * OMElement omElement = * serviceName.toOM(new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "ServiceName", "wsa")); *

        *

        or

        *

        * OMElement omElement = * serviceName.toOM(new QName("http://www.w3.org/2007/05/addressing/metadata", "ServiceName", "wsam")); *

        *

        * the difference being whether the EndpointReference is meant to represent a 2004/08 * (Submission) or 2005/08 (Final) EndpointReference, respectively. *

        * @param factory OMFactory to use when generating OMElements * @param qname the QName that carries the namespace of the metadata element. * * @return an OMElement that can be added to the metadata of an EndpointReference. */ public OMElement toOM(OMFactory factory, QName qname) throws AxisFault { String localName = qname.getLocalPart(); if (!AddressingConstants.EPR_SERVICE_NAME.equals(localName)) { throw new AxisFault("The local name must be 'ServiceName'."); } String prefix = qname.getPrefix(); if (prefix == null) { throw new AxisFault("The prefix cannot be null."); } String namespace = qname.getNamespaceURI(); if (namespace == null) { throw new AxisFault("The namespace canot be null."); } OMNamespace metadataNs = factory.createOMNamespace(namespace, prefix); OMElement element = factory.createOMElement(localName, metadataNs); element.setText(name); if (endpointName != null) { String attributeName = Submission.WSA_NAMESPACE.equals(namespace) ? Submission.WSA_SERVICE_NAME_ENDPOINT_NAME : Final.WSA_SERVICE_NAME_ENDPOINT_NAME; element.addAttribute(attributeName, endpointName, null); } return element; } /** * Convenience method to extract metadata from the ServiceName element. * *

        * <wsam:ServiceName xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" EndpointName="...">...</wsam:ServiceName> *

        *

        or

        *

        * <wsa:ServiceName xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" PortName="...">...</wsa:ServiceName> *

        * * @param omElement the OMElement that holds the metadata. */ public void fromOM(OMElement omElement) throws AxisFault { QName qname = omElement.getQName(); String attributeName = null; if (wsamQName.equals(qname) || wsawQName.equals(qname)) { attributeName = Final.WSA_SERVICE_NAME_ENDPOINT_NAME; } else if (subQName.equals(qname)) { attributeName = Submission.WSA_SERVICE_NAME_ENDPOINT_NAME; } else { throw new AxisFault("Unrecognized element."); } name = omElement.getTextAsQName(); endpointName = omElement.getAttributeValue(new QName(attributeName)); } /** * Static method to test whether an OMElement is recognized * as a ServiceName element. If this method returns true then * {@link #fromOM(OMElement)} is guaranteed not to fail. * * @param omElement the OMElement to test. * @return true if the element is a ServiceName element, * false otherwise. */ public static boolean isServiceNameElement(OMElement omElement) { boolean result = false; QName qname = omElement.getQName(); if (wsamQName.equals(qname) || wsawQName.equals(qname) || subQName.equals(qname)) result = true; return result; } } ./src/org/apache/axis2/addressing/metadata/InterfaceName.java0000664000175000017500000001303711767656530023305 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing.metadata; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingConstants.Final; import org.apache.axis2.addressing.AddressingConstants.Submission; import javax.xml.namespace.QName; public class InterfaceName { public static final QName subQName = new QName(Submission.WSA_NAMESPACE, Submission.WSA_INTERFACE_NAME, AddressingConstants.WSA_DEFAULT_PREFIX); public static final QName wsamQName = new QName(Final.WSAM_NAMESPACE, Final.WSA_INTERFACE_NAME, Final.WSA_DEFAULT_METADATA_PREFIX); public static final QName wsawQName = new QName(Final.WSAW_NAMESPACE, Final.WSA_INTERFACE_NAME, Final.WSA_ORIGINAL_METADATA_PREFIX); /** * Field name */ private QName name; /** * */ public InterfaceName() { } /** * @param name */ public InterfaceName(QName name) { this.name = name; } /** * Method getName */ public QName getName() { return name; } /** * Method setName * * @param name */ public void setName(QName name) { this.name = name; } /** * Convenience method to convert objects of this type to an {@link OMElement} so that it * can be added to an {@link org.apache.axis2.addressing.EndpointReference} * *

        Use:

        *

        * OMElement omElement = * serviceName.toOM(new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "PortType", "wsa")); *

        *

        or

        *

        * OMElement omElement = * serviceName.toOM(new QName("http://www.w3.org/2007/05/addressing/metadata", "InterfaceName", "wsam")); *

        *

        * the difference being whether the EndpointReference is meant to represent a 2004/08 * (Submission) or 2005/08 (Final) EndpointReference, respectively. *

        * * @param qname the QName that carries the namespace of the metadata element. * @param fac TODO * @return an OMElement that can be added to the metadata of an EndpointReference. */ public OMElement toOM(OMFactory fac, QName qname) throws AxisFault { String prefix = qname.getPrefix(); if (prefix == null) { throw new AxisFault("The prefix cannot be null."); } String localName = qname.getLocalPart(); if (!Final.WSA_INTERFACE_NAME.equals(localName) && !Submission.WSA_INTERFACE_NAME.equals(localName)) { throw new AxisFault("The local name must be 'InterfaceName' or 'PortType'."); } String namespace = qname.getNamespaceURI(); if (namespace == null) { throw new AxisFault("The namespace canot be null."); } OMNamespace metadataNs = fac.createOMNamespace(namespace, prefix); OMElement element = fac.createOMElement(localName, metadataNs); element.setText(name); return element; } /** * Convenience method to extract metadata from an element. * *

        * <wsam:InterfaceName xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">...</wsam:ServiceName> *

        *

        or

        *

        * <wsa:PortType xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">...</wsa:ServiceName> *

        * * @param omElement the OMElement that holds the metadata. */ public void fromOM(OMElement omElement) throws AxisFault { QName qname = omElement.getQName(); if (!wsamQName.equals(qname) && !wsawQName.equals(qname) && !subQName.equals(qname)) { throw new AxisFault("Unrecognized element."); } name = omElement.getTextAsQName(); } /** * Static method to test whether an OMElement is recognized * as a ServiceName element. If this method returns true then * {@link #fromOM(OMElement)} is guaranteed not to fail. * * @param omElement the OMElement to test. * @return true if the element is a ServiceName element, * false otherwise. */ public static boolean isInterfaceNameElement(OMElement omElement) { boolean result = false; QName qname = omElement.getQName(); if (wsamQName.equals(qname) || wsawQName.equals(qname) || subQName.equals(qname)) result = true; return result; } } ./src/org/apache/axis2/addressing/metadata/WSDLLocation.java0000664000175000017500000001031311767656530023040 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing.metadata; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import javax.xml.namespace.QName; public class WSDLLocation { private static final QName WSDLI = new QName("http://www.w3.org/2006/01/wsdl-instance", "wsdlLocation", "wsdli"); private String targetNamespace; private String wsdlURL; public WSDLLocation() { } public WSDLLocation(String targetNamespace, String wsdlURL) { this.targetNamespace = targetNamespace; this.wsdlURL = wsdlURL; } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } public String getLocation() { return wsdlURL; } public void setLocation(String wsdlURL) { this.wsdlURL = wsdlURL; } /** * Convenience method to convert an object of this type to an OMAttribute * @param factory OMFactory to use when generating OMElements * * @return an OMAttribute that can be added to an EndpointReference */ public OMAttribute toOM(OMFactory factory) { String value = new StringBuffer(targetNamespace).append(" ").append(wsdlURL).toString(); OMNamespace wsdliNs = factory.createOMNamespace(WSDLI.getNamespaceURI(), WSDLI.getPrefix()); OMAttribute omAttribute = factory.createOMAttribute(WSDLI.getLocalPart(), wsdliNs, value); return omAttribute; } /** * Convenience method for converting an OMAttribute to an instance of this type. *

        * <... xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" wsdli:wsdlLocation="targetNamespace wsdlURL" ...> *

        * @param omAttribute the OMAttribute that holds the wsdl location. * @throws AxisFault */ public void fromOM(OMAttribute omAttribute) throws AxisFault { QName qname = omAttribute.getQName(); if (WSDLI.equals(qname)) { String value = omAttribute.getAttributeValue().trim(); String[] values = value.split("\\s", 2); //Don't set any values if split doesn't //give us the correct number of elements. if (values.length != 2) return; targetNamespace = values[0]; wsdlURL = values[1]; } else { throw new AxisFault("Unrecognized element."); } } /** * Static method to test whether an OMElement is recognized * as a ServiceName element. If this method returns true then * {@link #fromOM(OMAttribute)} is guaranteed not to throw an exception. * * @param omAttribute the OMElement to test. * @return true if the element is a ServiceName element, * false otherwise. */ public static boolean isWSDLLocationAttribute(OMAttribute omAttribute) { boolean result = false; QName qname = omAttribute.getQName(); if (WSDLI.equals(qname)) result = true; return result; } } ./src/org/apache/axis2/addressing/RelatesTo.java0000664000175000017500000002006611767656530020726 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; /** * Class RelatesTo */ public class RelatesTo implements Externalizable, SafeSerializable { /* * setup for logging */ private static final Log log = LogFactory.getLog(RelatesTo.class); private static final String myClassName = "RelatesTo"; /** * @serial The serialization version ID tracks the version of the class. * If a class definition changes, then the serialization/externalization * of the class is affected. If a change to the class is made which is * not compatible with the serialization/externalization of the class, * then the serialization version ID should be updated. * Refer to the "serialVer" utility to compute a serialization * version ID. */ private static final long serialVersionUID = -1120384315333414960L; /** * @serial Tracks the revision level of a class to identify changes to the * class definition that are compatible to serialization/externalization. * If a class definition changes, then the serialization/externalization * of the class is affected. * Refer to the writeExternal() and readExternal() methods. */ // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; /** * Field relationshipType */ private String relationshipType; /** * Field value */ private String value; private ArrayList extensibilityAttributes = null; /** * Constructor RelatesTo */ public RelatesTo() { } /** * Constructor RelatesTo * * @param value */ public RelatesTo(String value) { this.value = value; } /** * Constructor RelatesTo * * @param value * @param relationshipType */ public RelatesTo(String value, String relationshipType) { this.value = value; this.relationshipType = relationshipType; } /** * Method getRelationshipType. If the relationship type has not been set it returns * the default value {@link AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE} */ public String getRelationshipType() { return (relationshipType != null && !"".equals(relationshipType) ? relationshipType : AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE); } /** * Method getValue */ public String getValue() { return value; } /** * Method setRelationshipType * * @param relationshipType */ public void setRelationshipType(String relationshipType) { this.relationshipType = relationshipType; } /** * Method setValue * * @param value */ public void setValue(String value) { this.value = value; } public ArrayList getExtensibilityAttributes() { return extensibilityAttributes; } public void setExtensibilityAttributes(ArrayList extensibilityAttributes) { this.extensibilityAttributes = extensibilityAttributes; } /* * (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return "Identifier: " + value + ", Relationship type: " + relationshipType; } /* =============================================================== * Externalizable support * =============================================================== */ /** * Save the contents of this object. *

        * NOTE: Transient fields and static fields are not saved. * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // write out contents of this object // NOTES: For each item, where appropriate, // write out the following information, IN ORDER: // the class name // the active or empty flag // the data length, if appropriate // the data //--------------------------------------------------------- // in order to handle future changes to the object // definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various strings //--------------------------------------------------------- // String relationshipType out.writeObject(relationshipType); // String value out.writeObject(value); //--------------------------------------------------------- // collections and lists //--------------------------------------------------------- out.writeList(extensibilityAttributes); } /** * Restore the contents of the object that was * previously saved. *

        * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various strings //--------------------------------------------------------- // String relationshipType relationshipType = (String)in.readObject(); // String value value = (String) in.readObject(); //--------------------------------------------------------- // collections and lists //--------------------------------------------------------- // ArrayList extensibilityAttributes extensibilityAttributes = in.readArrayList(); } } ./src/org/apache/axis2/addressing/AddressingHelper.java0000664000175000017500000002652011767656530022250 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Map; public class AddressingHelper { private static final Log log = LogFactory.getLog(AddressingHelper.class); /** * Returns true if the ReplyTo address does not match one of the supported * anonymous urls. If the ReplyTo is not set, anonymous is assumed, per the Final * spec. The AddressingInHandler should have set the ReplyTo to non-null in the * 2004/08 case to ensure the different semantics. (per AXIS2-885) * * @param messageContext */ public static boolean isReplyRedirected(MessageContext messageContext) { EndpointReference replyTo = messageContext.getReplyTo(); if (replyTo == null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " isReplyRedirected: ReplyTo is null. Returning false"); } return false; } else { return !replyTo.hasAnonymousAddress(); } } /** * Returns true if the FaultTo address does not match one of the supported * anonymous urls. If the FaultTo is not set, the ReplyTo is checked per the * spec. * * @param messageContext * @see #isReplyRedirected(org.apache.axis2.context.MessageContext) */ public static boolean isFaultRedirected(MessageContext messageContext) { EndpointReference faultTo = messageContext.getFaultTo(); if (faultTo == null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " isReplyRedirected: FaultTo is null. Returning isReplyRedirected"); } return isReplyRedirected(messageContext); } else { return !faultTo.hasAnonymousAddress(); } } /** * If the inbound FaultTo header was invalid and caused a fault, the fault should not be * sent to it. * * @return true if the fault should be sent to the FaultTo */ public static boolean shouldSendFaultToFaultTo(MessageContext messageContext) { // there are some information that the fault thrower wants to pass to the fault path. // Means that the fault is a ws-addressing one hence use the ws-addressing fault action. Object faultInfoForHeaders = messageContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS); // if the exception is due to a problem in the faultTo header itself, we can not use those // fault informatio to send the error. Try to send using replyTo, leave it to transport boolean doNotSendFaultUsingFaultTo = false; if (faultInfoForHeaders != null) { // TODO: This should probably store a QName instead of a String.. currently we rely on prefix string matching!! String problemHeaderName = (String) ((Map) faultInfoForHeaders) .get(AddressingConstants.Final.FAULT_HEADER_PROB_HEADER_QNAME); doNotSendFaultUsingFaultTo = (problemHeaderName != null && (AddressingConstants .WSA_DEFAULT_PREFIX + ":" + AddressingConstants.WSA_FAULT_TO) .equals(problemHeaderName)); } return !doNotSendFaultUsingFaultTo; } public static String getAddressingRequirementParemeterValue(AxisDescription axisDescription){ String value = ""; if (axisDescription != null) { value = Utils.getParameterValue( axisDescription.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER)); if(value !=null){ value = value.trim(); } if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("getAddressingRequirementParemeterValue: value: '" + value + "'"); } } if (value == null || "".equals(value)) { value = AddressingConstants.ADDRESSING_UNSPECIFIED; } return value; } /** * Extract the parameter representing the Anonymous flag from the AxisOperation * and return the String value. Return the default of "optional" if not specified. * * @param axisOperation */ public static String getInvocationPatternParameterValue(AxisOperation axisOperation) { String value = ""; if (axisOperation != null) { value = Utils.getParameterValue( axisOperation.getParameter(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME)); if(value !=null){ value = value.trim(); } if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("getInvocationPatternParameterValue: value: '" + value + "'"); } } if (value == null || "".equals(value)) { value = AddressingConstants.WSAM_INVOCATION_PATTERN_BOTH; } return value; } /** * Set the value of an existing unlocked Parameter representing Anonymous or add a new one if one * does not exist. If a locked Parameter of the same name already exists the method will trace and * return. * * @param axisOperation * @param value */ public static void setInvocationPatternParameterValue(AxisOperation axisOperation, String value) { if (value == null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setInvocationPatternParameterValue: value passed in is null. return"); } return; } Parameter param = axisOperation.getParameter(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME); // If an existing parameter exists if (param != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setInvocationPatternParameterValue: Parameter already exists"); } // and is not locked if (!param.isLocked()) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setInvocationPatternParameterValue: Parameter not locked. Setting value: " + value); } // set the value param.setValue(value); } } else { // otherwise, if no Parameter exists if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setInvocationPatternParameterValue: Parameter does not exist"); } // Create new Parameter with correct name/value param = new Parameter(); param.setName(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME); param.setValue(value); try { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setInvocationPatternParameterValue: Adding parameter with value: " + value); } // and add it to the AxisOperation object axisOperation.addParameter(param); } catch (AxisFault af) { // This should not happen. AxisFault is only ever thrown when a locked Parameter // of the same name already exists and this should be dealt with by the outer // if statement. if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug( "setInvocationPatternParameterValue: addParameter failed: " + af.getMessage()); } } } } public static void setAddressingRequirementParemeterValue(AxisDescription axisDescription, String value) { if (value == null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("getAddressingRequirementParemeterValue: value passed in is null. return"); } return; } Parameter param = axisDescription.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER); // If an existing parameter exists if (param != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setAddressingRequirementParemeterValue: Parameter already exists"); } // and is not locked if (!param.isLocked()) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setAddressingRequirementParemeterValue: Parameter not locked. Setting value: " + value); } // set the value param.setValue(value); } } else { // otherwise, if no Parameter exists if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setAddressingRequirementParemeterValue: Parameter does not exist"); } // Create new Parameter with correct name/value param = new Parameter(); param.setName(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER); param.setValue(value); try { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("setAddressingRequirementParemeterValue: Adding parameter with value: " + value); } // and add it to the AxisOperation object axisDescription.addParameter(param); } catch (AxisFault af) { // This should not happen. AxisFault is only ever thrown when a locked Parameter // of the same name already exists and this should be dealt with by the outer // if statement. if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug( "setAddressingRequirementParemeterValue: addParameter failed: " + af.getMessage()); } } } } } ./src/org/apache/axis2/addressing/EndpointReferenceHelper.java0000664000175000017500000006000611767656530023561 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.addressing; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.AttributeHelper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.metadata.InterfaceName; import org.apache.axis2.addressing.metadata.ServiceName; import org.apache.axis2.addressing.metadata.WSDLLocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * The methods in this class are used to process {@link EndpointReference} objects * according to the rules of the 2005/08 (Final) and 2004/08 (submission) WS-Addressing * specifications. */ public class EndpointReferenceHelper { private static final Log log = LogFactory.getLog(EndpointReferenceHelper.class); private final static Map finalQNames = new IdentityHashMap(); private final static Map submissionQNames = new IdentityHashMap(); /** * Populates an endpoint reference based on the OMElement and * WS-Addressing namespace that is passed in. * * @param epr an endpoint reference instance to hold the info. * @param eprOMElement an element of endpoint reference type * @param addressingNamespace the namespace of the WS-Addressing spec to comply with. * @throws AxisFault if unable to locate an address element, or if the specified namespace * is different to the actual namespace. * @see #fromOM(OMElement) */ public static void fromOM(EndpointReference epr, OMElement eprOMElement, String addressingNamespace) throws AxisFault { String namespace = fromOM(epr, eprOMElement); if (!namespace.equals(addressingNamespace)) throw new AxisFault("The endpoint reference does not match the specified namespace."); } /** * Populates an endpoint reference based on the OMElement. Returns the * WS-Addressing namespace of the endpoint reference. * * @param epr an endpoint reference instance to hold the info. If the endpoint * reference is null then just the WS-Addressing namespace is returned. * @param eprOMElement an element of endpoint reference type * @return a string representing the WS-Addressing namespace of the endpoint reference. * @throws AxisFault if unable to locate an address element. */ public static String fromOM(EndpointReference epr, OMElement eprOMElement) throws AxisFault { boolean isFinalAddressingNamespace = false; Map map = null; //First pass, identify the addressing namespace. OMElement address = eprOMElement .getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS)); if (address != null) { map = finalQNames; isFinalAddressingNamespace = true; if (log.isDebugEnabled()) { log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Final.WSA_NAMESPACE); } } else { address = eprOMElement.getFirstChildWithName( (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS)); if (address != null) { map = submissionQNames; isFinalAddressingNamespace = false; if (log.isDebugEnabled()) { log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Submission.WSA_NAMESPACE); } } else { throw new AxisFault( "Unable to locate an address element for the endpoint reference type."); } } //Second pass, identify the properties. if (epr != null) fromOM(epr, eprOMElement, map, isFinalAddressingNamespace); return ((QName) map.get(AddressingConstants.EPR_ADDRESS)).getNamespaceURI(); } /** * Populates an endpoint reference based on the String that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * String that are not recognised are saved as extensibility elements. * * @param eprString string from the element of endpoint reference type * @throws AxisFault if unable to locate an address element * @deprecated use {@link #fromString(String)} instead. */ public static EndpointReference fromOM(String eprString) throws AxisFault { return fromString(eprString); } /** * Populates an endpoint reference based on the String that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * String that are not recognised are saved as extensibility elements. * * @param eprString string from the element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromString(String eprString) throws AxisFault { try { return fromOM(new StAXOMBuilder( new ByteArrayInputStream(eprString.getBytes())).getDocumentElement()); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } /** * Populates an endpoint reference based on the OMElement that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * OMElement that are not recognised are saved as extensibility elements. * * @param eprOMElement an element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromOM(OMElement eprOMElement) throws AxisFault { EndpointReference epr = new EndpointReference(""); fromOM(epr, eprOMElement); return epr; } /** * Creates an OMElement based on the properties of the endpoint * reference. The output may differ based on the addressing namespace that is * in effect when this method is called. If the http://www.w3.org/2005/08/addressing * namespace is in effect, and a metadata property has been defined for the * endpoint reference, then there will be a metadata element to contain the * property in the output. If the http://schemas.xmlsoap.org/ws/2004/08/addressing * namespace is in effect, however, then no metadata element will be included * in the output, even if a metadata property element has been defined. * * @param factory * @param epr * @param qname * @param addressingNamespace * @return * @throws AxisFault */ public static OMElement toOM(OMFactory factory, EndpointReference epr, QName qname, String addressingNamespace) throws AxisFault { OMElement eprElement = null; if (log.isDebugEnabled()) { log.debug("toOM: Factory, " + factory); log.debug("toOM: Endpoint reference, " + epr); log.debug("toOM: Element qname, " + qname); log.debug("toOM: Addressing namespace, " + addressingNamespace); } if (addressingNamespace == null) { throw new AxisFault("Addressing namespace cannot be null."); } if (qname.getPrefix() != null) { OMNamespace wrapNs = factory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()); if (factory instanceof SOAPFactory) { eprElement = ((SOAPFactory) factory).createSOAPHeaderBlock(qname.getLocalPart(), wrapNs); } else { eprElement = factory.createOMElement(qname.getLocalPart(), wrapNs); } OMNamespace wsaNS = factory.createOMNamespace(addressingNamespace, AddressingConstants.WSA_DEFAULT_PREFIX); OMElement addressE = factory.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS, eprElement); String address = epr.getAddress(); addressE.setText(address); ArrayList addressAttributes = epr.getAddressAttributes(); if (addressAttributes != null) { Iterator attrIter = addressAttributes.iterator(); while (attrIter.hasNext()) { OMAttribute omAttribute = (OMAttribute) attrIter.next(); AttributeHelper.importOMAttribute(omAttribute, addressE); } } List metaData = epr.getMetaData(); if (metaData != null && AddressingConstants.Final.WSA_NAMESPACE.equals(addressingNamespace)) { OMElement metadataE = factory.createOMElement( AddressingConstants.Final.WSA_METADATA, wsaNS, eprElement); for (int i = 0, size = metaData.size(); i < size; i++) { OMElement omElement = (OMElement) metaData.get(i); metadataE.addChild(ElementHelper.importOMElement(omElement, factory)); } ArrayList metadataAttributes = epr.getMetadataAttributes(); if (metadataAttributes != null) { Iterator attrIter = metadataAttributes.iterator(); while (attrIter.hasNext()) { OMAttribute omAttribute = (OMAttribute) attrIter.next(); AttributeHelper.importOMAttribute(omAttribute, metadataE); } } } Map referenceParameters = epr.getAllReferenceParameters(); if (referenceParameters != null) { OMElement refParameterElement = factory.createOMElement( AddressingConstants.EPR_REFERENCE_PARAMETERS, wsaNS, eprElement); Iterator iterator = referenceParameters.values().iterator(); while (iterator.hasNext()) { OMElement omElement = (OMElement) iterator.next(); refParameterElement.addChild(ElementHelper.importOMElement(omElement, factory)); } } List attributes = epr.getAttributes(); if (attributes != null) { for (int i = 0, size = attributes.size(); i < size; i++) { OMAttribute omAttribute = (OMAttribute) attributes.get(i); AttributeHelper.importOMAttribute(omAttribute, eprElement); } } // add xs:any List extensibleElements = epr.getExtensibleElements(); if (extensibleElements != null) { for (int i = 0, size = extensibleElements.size(); i < size; i++) { OMElement omElement = (OMElement) extensibleElements.get(i); eprElement.addChild(ElementHelper.importOMElement(omElement, factory)); } } } else { throw new AxisFault("prefix must be specified"); } return eprElement; } private static void fromOM(EndpointReference epr, OMElement eprOMElement, Map map, boolean isFinalAddressingNamespace) { Iterator childElements = eprOMElement.getChildElements(); while (childElements.hasNext()) { OMElement eprChildElement = (OMElement) childElements.next(); QName qname = eprChildElement.getQName(); if (map.get(AddressingConstants.EPR_ADDRESS).equals(qname)) { //We need to identify the address element again in order to ensure //that it is not included with the extensibility elements. epr.setAddress(eprChildElement.getText()); Iterator allAddrAttributes = eprChildElement.getAllAttributes(); ArrayList addressAttributes = new ArrayList(); while (allAddrAttributes.hasNext()) { OMAttribute attribute = (OMAttribute) allAddrAttributes.next(); addressAttributes.add(attribute); } epr.setAddressAttributes(addressAttributes); } else if (map.get(AddressingConstants.EPR_REFERENCE_PARAMETERS).equals(qname)) { Iterator iterator = eprChildElement.getChildElements(); while (iterator.hasNext()) { OMElement element = (OMElement) iterator.next(); epr.addReferenceParameter(element); } } else if (isFinalAddressingNamespace && map.get(AddressingConstants.Final.WSA_METADATA).equals(qname)) { Iterator iterator = eprChildElement.getChildElements(); while (iterator.hasNext()) { OMNode node = (OMNode) iterator.next(); epr.addMetaData(node); } Iterator allMDAttributes = eprChildElement.getAllAttributes(); ArrayList metadataAttributes = new ArrayList(); while (allMDAttributes.hasNext()) { OMAttribute attribute = (OMAttribute) allMDAttributes.next(); metadataAttributes.add(attribute); } epr.setMetadataAttributes(metadataAttributes); } else if (!isFinalAddressingNamespace && map.get(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES).equals(qname)) { // since we have the model for WS-Final, we don't have a place to keep this reference properties. // The only compatible place is reference properties Iterator iterator = eprChildElement.getChildElements(); while (iterator.hasNext()) { OMElement element = (OMElement) iterator.next(); epr.addReferenceParameter(element); } } else { epr.addExtensibleElement(eprChildElement); } } Iterator attributes = eprOMElement.getAllAttributes(); while (attributes.hasNext()) { OMAttribute attribute = (OMAttribute) attributes.next(); epr.addAttribute(attribute); } if (log.isDebugEnabled()) { log.debug("fromOM: Endpoint reference, " + epr); } } /** * Retrieves the WS-Addressing EPR ServiceName element from an EPR. * * @param epr the EPR to retrieve the element from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @return an instance of ServiceName. The return value is * never null. * @throws AxisFault */ public static ServiceName getServiceNameMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault { ServiceName serviceName = new ServiceName(); List elements = null; if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) elements = epr.getExtensibleElements(); else elements = epr.getMetaData(); if (elements != null) { //Retrieve the service name and endpoint name. for (int i = 0, size = elements.size(); i < size; i++) { OMElement omElement = (OMElement) elements.get(i); if (ServiceName.isServiceNameElement(omElement)) { serviceName.fromOM(omElement); break; } } } return serviceName; } /** * Retrieves the WS-Addressing EPR PortType, or InterfaceName, element from an EPR, * as appropriate. * * @param epr the EPR to retrieve the element from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @return an instance of InterfaceName. The return value is * never null. * @throws AxisFault */ public static InterfaceName getInterfaceNameMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault { InterfaceName interfaceName = new InterfaceName(); List elements = null; if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) elements = epr.getExtensibleElements(); else elements = epr.getMetaData(); if (elements != null) { //Retrieve the service name and endpoint name. for (int i = 0, size = elements.size(); i < size; i++) { OMElement omElement = (OMElement) elements.get(i); if (InterfaceName.isInterfaceNameElement(omElement)) { interfaceName.fromOM(omElement); break; } } } return interfaceName; } /** * Retrieves the wsdli:wsdlLocation attribute from an EPR. * * @param epr the EPR to retrieve the attribute from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @return an instance of WSDLLocation. The return value is * never null. * @throws AxisFault */ public static WSDLLocation getWSDLLocationMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault { WSDLLocation wsdlLocation = new WSDLLocation(); List attributes = null; if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) attributes = epr.getAttributes(); else attributes = epr.getMetadataAttributes(); if (attributes != null) { //Retrieve the wsdl location. for (int i = 0, size = attributes.size(); i < size; i++) { OMAttribute omAttribute = (OMAttribute) attributes.get(i); if (WSDLLocation.isWSDLLocationAttribute(omAttribute)) { wsdlLocation.fromOM(omAttribute); break; } } } return wsdlLocation; } /** * Adds an instance of ServiceName as metadata to the specified EPR. * The metadata is mapped to a WS-Addressing EPR ServiceName element. * * @param factory an OMFactory * @param epr the EPR to retrieve the attribute from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @param serviceName an instance of ServiceName that contains the * metadata * @throws AxisFault */ public static void setServiceNameMetadata(OMFactory factory, EndpointReference epr, String addressingNamespace, ServiceName serviceName) throws AxisFault { if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) { OMElement omElement = serviceName.toOM(factory, ServiceName.subQName); epr.addExtensibleElement(omElement); } else { OMElement omElement = serviceName.toOM(factory, ServiceName.wsamQName); epr.addMetaData(omElement); } } /** * Adds an instance of InterfaceName as metadata to the specified EPR. * The metadata is mapped to a WS-Addressing EPR PortType or InterfaceName element. * * @param factory an OMFactory * @param epr the EPR to retrieve the attribute from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @param interfaceName an instance of InterfaceName that contains the * metadata * @throws AxisFault */ public static void setInterfaceNameMetadata(OMFactory factory, EndpointReference epr, String addressingNamespace, InterfaceName interfaceName) throws AxisFault { if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) { OMElement omElement = interfaceName.toOM(factory, InterfaceName.subQName); epr.addExtensibleElement(omElement); } else { OMElement omElement = interfaceName.toOM(factory, InterfaceName.wsamQName); epr.addMetaData(omElement); } } /** * Adds an instance of WSDLLocation as metadata to the specified EPR. * The metadata is mapped to a wsdli:wsdlLocation attribute. * * @param factory an OMFactory * @param epr the EPR to retrieve the attribute from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @param wsdlLocation an instance of WSDLLocation that contains the * metadata * @throws AxisFault */ public static void setWSDLLocationMetadata(OMFactory factory, EndpointReference epr, String addressingNamespace, WSDLLocation wsdlLocation) throws AxisFault { OMAttribute attribute = wsdlLocation.toOM(factory); if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) { epr.addAttribute(attribute); } else { ArrayList list = new ArrayList(); list.add(attribute); epr.setMetadataAttributes(list); } } static { finalQNames.put(AddressingConstants.EPR_ADDRESS, new QName( AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS)); finalQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName( AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS)); finalQNames.put(AddressingConstants.Final.WSA_METADATA, new QName( AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.Final.WSA_METADATA)); submissionQNames.put(AddressingConstants.EPR_ADDRESS, new QName( AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS)); submissionQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName( AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS)); submissionQNames.put(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES, new QName( AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES)); } } ./src/org/apache/axis2/engine/0000775000175000017500000000000011767656530015277 5ustar brianbrian./src/org/apache/axis2/engine/AxisConfiguration.java0000664000175000017500000012341511767656530021604 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.builder.Builder; import org.apache.axis2.clustering.ClusterManager; import org.apache.axis2.context.MessageContext; import org.apache.axis2.dataretrieval.AxisDataLocator; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.ModuleDeployer; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.ModuleConfiguration; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.i18n.Messages; import org.apache.axis2.phaseresolver.PhaseMetadata; import org.apache.axis2.phaseresolver.PhaseResolver; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.util.TargetResolver; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.File; import java.net.URL; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Class AxisConfiguration */ public class AxisConfiguration extends AxisDescription { private static final Log log = LogFactory.getLog(AxisConfiguration.class); /* * To store configured data locators */ private HashMap dataLocators = new HashMap(); private HashMap dataLocatorClassNames = new HashMap(); /** * This is a Map of String name -> AxisModule for all available Modules. */ private final HashMap allModules = new HashMap(); // To store mapping between default version and module name private final HashMap nameToversionMap = new HashMap(); // private final HashMap serviceGroups = new HashMap(); private final HashMap transportsIn = new HashMap(); private final HashMap transportsOut = new HashMap(); private final HashMap policySupportedModules = new HashMap(); /** * Stores the QNames of local policy assertions */ private final ArrayList localPolicyAssertions = new ArrayList(); // to store AxisObserver Objects private ArrayList observersList = null; private URL axis2Repository = null; private Map allServices = new Hashtable(); private Map allEndpoints = new Hashtable(); /** * Stores the module specified in the server.xml at the document parsing time. */ private List globalModuleList; private Hashtable faultyModules; /** * To store faulty services */ private Hashtable faultyServices; private ArrayList inFaultPhases; private ArrayList inPhasesUptoAndIncludingPostDispatch; private HashMap messageReceivers; private HashMap messageBuilders; private HashMap messageFormatters; private ClassLoader moduleClassLoader; private HashMap moduleConfigmap; private ArrayList outFaultPhases; private ArrayList outPhases; protected PhasesInfo phasesinfo; private ClassLoader serviceClassLoader; private ClassLoader systemClassLoader; //To keep track of whether the system has started or not private boolean start; private ArrayList targetResolvers; private ClusterManager clusterManager; private AxisConfigurator configurator; /** * Constructor AxisConfiguration. */ public AxisConfiguration() { moduleConfigmap = new HashMap(); globalModuleList = new ArrayList(); messageReceivers = new HashMap(); messageBuilders = new HashMap(); messageFormatters = new HashMap(); outPhases = new ArrayList(); inFaultPhases = new ArrayList(); outFaultPhases = new ArrayList(); faultyServices = new Hashtable(); faultyModules = new Hashtable(); observersList = new ArrayList(); inPhasesUptoAndIncludingPostDispatch = new ArrayList(); systemClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); serviceClassLoader = systemClassLoader; moduleClassLoader = systemClassLoader; this.phasesinfo = new PhasesInfo(); targetResolvers = new ArrayList(); } public void addMessageReceiver(String mepURL, MessageReceiver messageReceiver) { messageReceivers.put(mepURL, messageReceiver); } /** * Register a messageBuilder implementation against a content type. * This is used by Axis2 to support different message formats. * * @param contentType the relevant content-type (i.e. "text/xml") * @param messageBuilder a Builder implementation */ public void addMessageBuilder(String contentType, Builder messageBuilder) { messageBuilders.put(contentType, messageBuilder); } /** * Register a messageFormatter implementation against a content type. * This is used by Axis2 to support serialization of messages to different * message formats. (Eg: JSON) * * @param contentType the relevant content-type (i.e. "text/xml") * @param messageFormatter a MessageFormatter implementation */ public void addMessageFormatter(String contentType, MessageFormatter messageFormatter) { messageFormatters.put(contentType, messageFormatter); } /** * Add an available Module to this configuration * * @param module an AxisModule * @throws AxisFault in case of error */ public void addModule(AxisModule module) throws AxisFault { module.setParent(this); if (module.getVersion() == null) { if (module.getName().endsWith(AxisModule.VERSION_SNAPSHOT)) { allModules.put(module.getName(), module); String moduleName = module.getName().substring(0, module.getName().indexOf(AxisModule.VERSION_SNAPSHOT) - 1); module.setName(moduleName); module.setVersion(AxisModule.VERSION_SNAPSHOT); } else { allModules.put(module.getName(), module); } } else { // Calculate the module version from the name allModules.put(Utils.getModuleName(module.getName(), module.getVersion()), module); } notifyObservers(AxisEvent.MODULE_DEPLOY, module); // Registering the policy namespaces that the module understand registerModulePolicySupport(module); // Registering the policy assertions that are local to the system registerLocalPolicyAssertions(module); } public void deployModule(String moduleFileName) throws DeploymentException { File moduleFile = new File(moduleFileName); if (!moduleFile.exists()) { throw new DeploymentException("Module archive '" + moduleFileName + "' doesn't exist"); } DeploymentFileData dfd = new DeploymentFileData(moduleFile, new ModuleDeployer(this)); dfd.deploy(); } /** * To remove a given module from the system * * @param module name of module to remove * @deprecated Use {@link #removeModule(String,String)} */ public void removeModule(String module) { allModules.remove(module); // TODO disengage has to be done here } /** * Remove a module with moduleName & moduleVersion * * @param moduleName * @param moduleVersion */ public void removeModule(String moduleName, String moduleVersion) { allModules.remove(Utils.getModuleName(moduleName, moduleVersion)); // TODO disengage has to be done here } /** * Adds module configuration, if there is a moduleConfig tag in service. * * @param moduleConfiguration a ModuleConfiguration to remember */ public void addModuleConfig(ModuleConfiguration moduleConfiguration) { moduleConfigmap.put(moduleConfiguration.getModuleName(), moduleConfiguration); } public void addObservers(AxisObserver axisObserver) { observersList.add(axisObserver); } /** * Method addService. * * @param service * @throws AxisFault */ public synchronized void addService(AxisService service) throws AxisFault { AxisServiceGroup axisServiceGroup = new AxisServiceGroup(); axisServiceGroup.setServiceGroupName(service.getName()); axisServiceGroup.setParent(this); axisServiceGroup.addService(service); addServiceGroup(axisServiceGroup); // processEndpoints(service, service.getAxisConfiguration()); } public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup) throws AxisFault { axisServiceGroup.setParent(this); notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup); AxisService axisService; Iterator services = axisServiceGroup.getServices(); while (services.hasNext()) { axisService = (AxisService) services.next(); if (axisService.getSchemaTargetNamespace() == null) { axisService.setSchemaTargetNamespace(Java2WSDLConstants.AXIS2_XSD); } } services = axisServiceGroup.getServices(); while (services.hasNext()) { axisService = (AxisService) services.next(); if (axisService.isUseDefaultChains()) { Iterator operations = axisService.getOperations(); while (operations.hasNext()) { AxisOperation operation = (AxisOperation) operations.next(); phasesinfo.setOperationPhases(operation); } } } Iterator enModule = getEngagedModules().iterator(); while (enModule.hasNext()) { axisServiceGroup.engageModule((AxisModule) enModule.next()); } services = axisServiceGroup.getServices(); ArrayList servicesIAdded = new ArrayList(); while (services.hasNext()) { axisService = (AxisService) services.next(); processEndpoints(axisService, axisService.getAxisConfiguration()); Map endpoints = axisService.getEndpoints(); String serviceName = axisService.getName(); try { addToAllServicesMap(axisService); } catch (AxisFault axisFault) { // Whoops, must have been a duplicate! If we had a problem here, we have to // remove all the ones we added... for (Iterator i = servicesIAdded.iterator(); i.hasNext();) { AxisService service = (AxisService) i.next(); allServices.remove(service.getName()); } // And toss this in case anyone wants it? throw axisFault; } servicesIAdded.add(axisService); if (endpoints != null) { Iterator endpointNameIter = endpoints.keySet().iterator(); while (endpointNameIter.hasNext()) { String endpointName = (String) endpointNameIter.next(); allEndpoints.put(serviceName + "." + endpointName, axisService); } } if (!axisService.isClientSide()) { notifyObservers(AxisEvent.SERVICE_DEPLOY, axisService); } } // serviceGroups.put(axisServiceGroup.getServiceGroupName(), // axisServiceGroup); addChild(axisServiceGroup); } public void addToAllServicesMap(AxisService axisService) throws AxisFault { String serviceName = axisService.getName(); AxisService oldService = (AxisService) allServices.get(serviceName); if (oldService == null) { allServices.put(serviceName, axisService); } else { // If we were already there, that's fine. If not, fault! if (oldService != axisService) { throw new AxisFault(Messages.getMessage("twoservicecannothavesamename", axisService.getName())); } } } public AxisServiceGroup removeServiceGroup(String serviceGroupName) throws AxisFault { AxisServiceGroup axisServiceGroup = (AxisServiceGroup) getChild(serviceGroupName); if (axisServiceGroup == null) { throw new AxisFault(Messages.getMessage("invalidservicegroupname", serviceGroupName)); } Iterator services = axisServiceGroup.getServices(); while (services.hasNext()) { AxisService axisService = (AxisService) services.next(); allServices.remove(axisService.getName()); if (!axisService.isClientSide()) { notifyObservers(AxisEvent.SERVICE_REMOVE, axisService); } //removes the endpoints to this service String serviceName = axisService.getName(); String key = null; for (Iterator iter = axisService.getEndpoints().keySet().iterator(); iter.hasNext();){ key = serviceName + "." + (String)iter.next(); this.allEndpoints.remove(key); } } removeChild(serviceGroupName); notifyObservers(AxisEvent.SERVICE_REMOVE, axisServiceGroup); return axisServiceGroup; } /** * Method addTransportIn. * * @param transport * @throws AxisFault */ public void addTransportIn(TransportInDescription transport) throws AxisFault { if (transport.getReceiver() == null) { throw new AxisFault( "Transport Receiver can not be null for the transport " + transport.getName()); } transportsIn.put(transport.getName(), transport); } /** * Method addTransportOut. * * @param transport * @throws AxisFault */ public void addTransportOut(TransportOutDescription transport) throws AxisFault { if (transport.getSender() == null) { throw new AxisFault( "Transport sender can not be null for the transport " + transport.getName()); } transportsOut.put(transport.getName(), transport); } /** * Engages the default module version corresponding to the given module name, * or if the module name contains version number in it then it will engage * the correct module. Both the below cases are valid : - * 1. engageModule("addressing"); 2. engageModule("addressing-1.23"); * * @param moduleref QName of module to engage * @throws AxisFault * @deprecated Please use the String version instead */ public void engageModule(QName moduleref) throws AxisFault { engageModule(moduleref.getLocalPart()); } /** * Engages the default module version corresponding to given module name , * or if the module name contains version number in it then it will engage * the correct module. Both of the below two cases are valid 1. * engageModule("addressing"); 2. engageModule("addressing-1.23"); * * @param moduleref name of module to engage * @throws AxisFault */ public void engageModule(String moduleref) throws AxisFault { AxisModule module = getModule(moduleref); if (module != null) { engageModule(module); } else { throw new AxisFault(Messages.getMessage("modulenotavailble", moduleref)); } } /** * Engages a module using given name and its version ID. * * @param moduleName * @param versionID * @throws AxisFault */ public void engageModule(String moduleName, String versionID) throws AxisFault { String actualName = Utils.getModuleName(moduleName, versionID); AxisModule module = getModule(actualName); if (module != null) { engageModule(module); } else { throw new AxisFault(Messages.getMessage("refertoinvalidmodule")); } } public void onEngage(AxisModule module, AxisDescription engager) throws AxisFault { Iterator servicegroups = getServiceGroups(); while (servicegroups.hasNext()) { AxisServiceGroup serviceGroup = (AxisServiceGroup) servicegroups.next(); serviceGroup.engageModule(module, engager); } } /** * To dis-engage a module from the system. This will remove all the handlers * belonging to this module from all the handler chains. * * @param module module to disengage */ public void onDisengage(AxisModule module) throws AxisFault { PhaseResolver phaseResolver = new PhaseResolver(this); phaseResolver.disengageModuleFromGlobalChains(module); Iterator serviceGroups = getServiceGroups(); while (serviceGroups.hasNext()) { AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups.next(); axisServiceGroup.disengageModule(module); } } public void notifyObservers(int event_type, AxisService service) { AxisEvent event = new AxisEvent(event_type); for (int i = 0; i < observersList.size(); i++) { AxisObserver axisObserver = (AxisObserver) observersList.get(i); try { if (!service.isClientSide()) { axisObserver.serviceUpdate(event, service); } } catch (Throwable e) { // No need to stop the system due to this, so log and ignore log.debug(e); } } } public void notifyObservers(int event_type, AxisModule moule) { AxisEvent event = new AxisEvent(event_type); for (int i = 0; i < observersList.size(); i++) { AxisObserver axisObserver = (AxisObserver) observersList.get(i); try { axisObserver.moduleUpdate(event, moule); } catch (Throwable e) { // No need to stop the system due to this, so log and ignore log.debug(e); } } } public void notifyObservers(int event_type, AxisServiceGroup serviceGroup) { AxisEvent event = new AxisEvent(event_type); for (int i = 0; i < observersList.size(); i++) { AxisObserver axisObserver = (AxisObserver) observersList.get(i); try { axisObserver.serviceGroupUpdate(event, serviceGroup); } catch (Throwable e) { // No need to stop the system due to this, so log and ignore log.debug(e); } } } /** * Method removeService. * * @param name * @throws AxisFault */ public synchronized void removeService(String name) throws AxisFault { AxisService service = (AxisService) allServices.remove(name); if (service != null) { AxisServiceGroup serviceGroup = service.getAxisServiceGroup(); serviceGroup.removeService(name); log.debug(Messages.getMessage("serviceremoved", name)); } } /** * Add an AxisModule to the list of globally deployed modules. *

        * TODO: should this check for duplicate names? * * @param moduleName name of AxisModule to add to list. */ public void addGlobalModuleRef(String moduleName) { globalModuleList.add(moduleName); } /** * Engage all the previously added global modules. * * @throws AxisFault if an individual engageModule() fails */ public void engageGlobalModules() throws AxisFault { for (Iterator i = globalModuleList.iterator(); i.hasNext();) { engageModule((String) i.next()); } } public Hashtable getFaultyModules() { return faultyModules; } public Hashtable getFaultyServices() { return faultyServices; } public void removeFaultyService(String key) { Iterator itr = faultyServices.keySet().iterator(); while (itr.hasNext()) { String fullFileName = (String) itr.next(); if (fullFileName.indexOf(key) > 0) { faultyServices.remove(fullFileName); return; } } } // to get the out flow correpodning to the global out flow; public ArrayList getOutFlowPhases() { return this.outPhases; } /** * @return Returns ArrayList. */ public ArrayList getInFaultFlowPhases() { return inFaultPhases; } public ArrayList getInFlowPhases() { return inPhasesUptoAndIncludingPostDispatch; } public MessageReceiver getMessageReceiver(String mepURL) { return (MessageReceiver) messageReceivers.get(mepURL); } /** * @param contentType * @return the configured message builder implementation class name against * the given content type. */ public Builder getMessageBuilder(String contentType) { return (Builder) messageBuilders.get(contentType); } /** * @param contentType * @return the configured message formatter implementation class name * against the given content type. */ public MessageFormatter getMessageFormatter(String contentType) { return (MessageFormatter) messageFormatters.get(contentType); } // /** // * // * @deprecate Please use String version instead // * @param qname // * @return // */ // public AxisModule getModule(QName qname) { // return getModule(qname.getLocalPart()); // } /** * Method getModule. First it will check whether the given module is there * in the hashMap, if so returns that and the name, which can be either with * version string or without version string.

        If its not found and the * name does not contain the version string in it then checks whether the default * version of the module is available in the sytem for the given name, then returns * that. * * @param name * @return Returns ModuleDescription. */ public AxisModule getModule(String name) { AxisModule module = (AxisModule) allModules.get(name); if (module != null) { return module; } // checks whether the version string seperator is not there in the // module name String moduleName = name; String defaultModuleVersion = getDefaultModuleVersion(moduleName); if (defaultModuleVersion != null) { module = (AxisModule) allModules.get(Utils.getModuleName(moduleName, defaultModuleVersion)); if (module != null) { return module; } } return null; } /** * Return the module having name=moduleName & version=moduleVersion * * @param moduleName The module name * @param moduleVersion The version of the module * @return The AxisModule having name=moduleName & version=moduleVersion */ public AxisModule getModule(String moduleName, String moduleVersion) { if (moduleVersion == null || moduleVersion.trim().length() == 0) { moduleVersion = getDefaultModuleVersion(moduleName); } return (AxisModule) allModules.get(Utils.getModuleName(moduleName, moduleVersion)); } /** * The class loader that becomes the parent of all the modules * * @return */ public ClassLoader getModuleClassLoader() { return this.moduleClassLoader; } public ModuleConfiguration getModuleConfig(String moduleName) { return (ModuleConfiguration) moduleConfigmap.get(moduleName); } /** * @return Returns HashMap. */ public HashMap getModules() { return allModules; } /** * Get a list of the global modules * * @return the global module list. BE CAREFUL, this list is mutable. * @deprecated please use addGlobalModule() */ public List getGlobalModules() { return globalModuleList; } /** * @return Returns ArrayList. */ public ArrayList getOutFaultFlowPhases() { return outFaultPhases; } public PhasesInfo getPhasesInfo() { return phasesinfo; } public URL getRepository() { return axis2Repository; } /** * Method getService. * * @param name * @return Returns AxisService. */ public AxisService getService(String name) throws AxisFault { AxisService axisService = (AxisService) allServices.get(name); if (axisService != null) { if (axisService.isActive()) { return axisService; } else { throw new AxisFault(Messages .getMessage("serviceinactive", name)); } } else { axisService = (AxisService) allEndpoints.get(name); if (axisService != null) { if (axisService.isActive()) { return axisService; } else { throw new AxisFault(Messages .getMessage("serviceinactive", name)); } } } return null; } /** * Service can start and stop, once stopped it cannot be accessed, so we * need a way to get the service even if service is not active. * * @return AxisService */ public AxisService getServiceForActivation(String serviceName) { AxisService axisService = null; axisService = (AxisService) allServices.get(serviceName); if (axisService != null) { return axisService; } else { axisService = (AxisService) allEndpoints.get(serviceName); return axisService; } } // The class loader that becomes the parent of all the services public ClassLoader getServiceClassLoader() { return this.serviceClassLoader; } public AxisServiceGroup getServiceGroup(String serviceNameAndGroupString) { // return (AxisServiceGroup) // serviceGroups.get(serviceNameAndGroupString); return (AxisServiceGroup) getChild(serviceNameAndGroupString); } public Iterator getServiceGroups() { // return serviceGroups.values().iterator(); return getChildren(); } // To get all the services in the system public HashMap getServices() { HashMap hashMap = new HashMap(this.allServices.size()); Object key; for (Iterator iter = this.allServices.keySet().iterator(); iter.hasNext();){ key = iter.next(); hashMap.put(key, this.allServices.get(key)); } return hashMap; } // The class loader which become the top most parent of all the modules and // services public ClassLoader getSystemClassLoader() { return this.systemClassLoader; } public TransportInDescription getTransportIn(String name) { return (TransportInDescription) transportsIn.get(name); } public TransportOutDescription getTransportOut(String name) { return (TransportOutDescription) transportsOut.get(name); } public HashMap getTransportsIn() { return transportsIn; } public HashMap getTransportsOut() { return transportsOut; } /** * This method needs to remain for a few Axis2 releases to support * legacy apps still using it. * * @param qname * @deprecated Use {@link #isEngaged(String)} */ public boolean isEngaged(QName qname) { return isEngaged(qname.getLocalPart()); } public boolean isEngaged(String moduleId) { AxisModule module = getModule(moduleId); if (module == null) { return false; } boolean isEngaged = super.isEngaged(module); if (!isEngaged) { AxisModule defaultModule = getDefaultModule(moduleId); isEngaged = engagedModules != null && engagedModules.values().contains(defaultModule); } return isEngaged; } public boolean isEngaged(AxisModule axisModule) { boolean isEngaged = super.isEngaged(axisModule); if (!isEngaged) { isEngaged = engagedModules != null && engagedModules.values().contains(axisModule); } return isEngaged; } public void setGlobalOutPhase(ArrayList outPhases) { this.outPhases = outPhases; } /** * @param list */ public void setInFaultPhases(ArrayList list) { inFaultPhases = list; } public void setInPhasesUptoAndIncludingPostDispatch( ArrayList inPhasesUptoAndIncludingPostDispatch) { this.inPhasesUptoAndIncludingPostDispatch = inPhasesUptoAndIncludingPostDispatch; } public void setModuleClassLoader(ClassLoader classLoader) { this.moduleClassLoader = classLoader; } /** * @param list */ public void setOutFaultPhases(ArrayList list) { outFaultPhases = list; } public void setPhasesInfo(PhasesInfo phasesInfo) { this.phasesinfo = phasesInfo; } public void setRepository(URL axis2Repository) { this.axis2Repository = axis2Repository; } public void setServiceClassLoader(ClassLoader classLoader) { this.serviceClassLoader = classLoader; } public void setSystemClassLoader(ClassLoader classLoader) { this.systemClassLoader = classLoader; } /** * Adds a default module version, which can be done either programmatically * or by using axis2.xml. The default module version is important if user * asks to engage a module without given version ID, in which case, * the default version is engaged. * * @param moduleName * @param moduleVersion */ public void addDefaultModuleVersion(String moduleName, String moduleVersion) { if (nameToversionMap.get(moduleName) == null) { nameToversionMap.put(moduleName, moduleVersion); } } public String getDefaultModuleVersion(String moduleName) { return (String) nameToversionMap.get(moduleName); } public AxisModule getDefaultModule(String moduleName) { String defaultModuleVersion = getDefaultModuleVersion(moduleName); if (defaultModuleVersion == null) { return (AxisModule) allModules.get(moduleName); } else { return (AxisModule) allModules.get(moduleName + "-" + defaultModuleVersion); } } public ClusterManager getClusterManager() { return clusterManager; } public void setClusterManager(ClusterManager clusterManager) { this.clusterManager = clusterManager; } public Object getKey() { return toString(); } public void stopService(String serviceName) throws AxisFault { AxisService service = (AxisService) allServices.get(serviceName); if (service == null) { throw new AxisFault(Messages.getMessage("servicenamenotvalid", serviceName)); } service.setActive(false); notifyObservers(AxisEvent.SERVICE_STOP, service); } public void startService(String serviceName) throws AxisFault { AxisService service = (AxisService) allServices.get(serviceName); if (service == null) { throw new AxisFault(Messages.getMessage("servicenamenotvalid", serviceName)); } service.setActive(true); notifyObservers(AxisEvent.SERVICE_START, service); } public List getModulesForPolicyNamesapce(String namesapce) { return (List) policySupportedModules.get(namesapce); } public void registerModulePolicySupport(AxisModule axisModule) { String[] namespaces = axisModule.getSupportedPolicyNamespaces(); if (namespaces == null) { return; } List modulesList; for (int i = 0; i < namespaces.length; i++) { modulesList = (List) policySupportedModules.get(namespaces[i]); if (modulesList != null) { modulesList.add(axisModule); } else { modulesList = new ArrayList(); modulesList.add(axisModule); policySupportedModules.put(namespaces[i], modulesList); } } } public void registerLocalPolicyAssertions(AxisModule axisModule) { QName[] localPolicyAssertions = axisModule.getLocalPolicyAssertions(); if (localPolicyAssertions == null) { return; } for (int i = 0; i < localPolicyAssertions.length; i++) { addLocalPolicyAssertion(localPolicyAssertions[i]); } } public ArrayList getObserversList() { return observersList; } public boolean isStart() { return start; } public void setStart(boolean start) { this.start = start; } /** * getTargetResolverChain returns an instance of * TargetResolver which iterates over the registered * TargetResolvers, calling each one in turn when * resolveTarget is called. */ public TargetResolver getTargetResolverChain() { if (targetResolvers.isEmpty()) { return null; } return new TargetResolver() { public void resolveTarget(MessageContext messageContext) { Iterator iter = targetResolvers.iterator(); while (iter.hasNext()) { TargetResolver tr = (TargetResolver) iter.next(); tr.resolveTarget(messageContext); } } }; } public void addTargetResolver(TargetResolver tr) { targetResolvers.add(tr); } public void addLocalPolicyAssertion(QName name) { this.localPolicyAssertions.add(name); } public List getLocalPolicyAssertions() { return this.localPolicyAssertions; } public void removeLocalPolicyAssertion(QName name) { this.localPolicyAssertions.remove(name); } public boolean isAssertionLocal(QName name) { return this.localPolicyAssertions.contains(name); } /** * Allows to define/configure Data Locator for specified dialect at Axis 2 Configuration. * * @param dialect- an absolute URI represents the format and version of data * @param classname - class name of the Data Locator configured to support retrieval * for the specified dialect. */ public void addDataLocatorClassNames(String dialect, String classname) { dataLocatorClassNames.put(dialect, classname); } /** * For internal used only! To store instance of DataLocator when it is first loaded. This allows to * reuse of the DataLocator after it is initially loaded. * * @param dialect- an absolute URI represents the format and version of data * @param dataLocator - specified an DataLocator instance to support retrieval * of the specified dialect. */ public void addDataLocator(String dialect, AxisDataLocator dataLocator) { dataLocators.put(dialect, dataLocator); } /** * Return DataLocator instance for specified dialect. */ public AxisDataLocator getDataLocator(String dialect) { return (AxisDataLocator) dataLocators.get(dialect); } /** * Return classname of DataLocator configured for specified dialect. */ public String getDataLocatorClassName(String dialect) { return (String) dataLocatorClassNames.get(dialect); } /** * Checks whether the system pre-defined phases * for all the flows, have been changed. If they have been changed, throws a DeploymentException. * * @throws org.apache.axis2.deployment.DeploymentException * */ public void validateSystemPredefinedPhases() throws DeploymentException { PhasesInfo phasesInfo = getPhasesInfo(); setInPhasesUptoAndIncludingPostDispatch(phasesInfo.getGlobalInflow()); setInFaultPhases(phasesInfo.getGlobalInFaultPhases()); setGlobalOutPhase(phasesInfo.getGlobalOutPhaseList()); setOutFaultPhases(phasesInfo.getOUT_FaultPhases()); } public AxisConfigurator getConfigurator() { return configurator; } public void setConfigurator(AxisConfigurator configurator) { this.configurator = configurator; } public void cleanup() { if (configurator != null) { configurator.cleanup(); } } /** * This method can be used to insert a phase at the runtime for a given location * And the relative location can be specified by beforePhase and afterPhase. Parameters * Either or both of them can be null , if both the parameters are null then the phase * will be added some where in the global phase. If one of them are null then the phase * will be added * - If the beforePhase is null then the phase will be added after the afterPhase * - If the after phase is null then the phase will be added before the beforePhase * Type of the flow will be specified by the parameter flow. * 1 - Inflow * 2 - out flow * 3 - fault in flow * 4 - fault out flow * * @param d the Deployable representing the Phase to deploy * @param flow the type of the flow * @throws org.apache.axis2.AxisFault : If something went wrong */ public void insertPhase(Deployable d, int flow) throws AxisFault { switch (flow) { case PhaseMetadata.IN_FLOW : { List phaseList = phasesinfo.getINPhases(); phaseList = findAndInsertPhase(d, phaseList); if (phaseList != null) { phasesinfo.setINPhases((ArrayList)phaseList); } break; } case PhaseMetadata.OUT_FLOW : { List phaseList = phasesinfo.getOUTPhases(); phaseList = findAndInsertPhase(d, phaseList); if (phaseList != null) { phasesinfo.setOUTPhases((ArrayList)phaseList); } break; } case PhaseMetadata.FAULT_OUT_FLOW : { List phaseList = phasesinfo.getOutFaultPhaseList(); phaseList = findAndInsertPhase(d, phaseList); if (phaseList != null) { phasesinfo.setOUT_FaultPhases((ArrayList)phaseList); } break; } case PhaseMetadata.FAULT_IN_FLOW : { List phaseList = phasesinfo.getIN_FaultPhases(); phaseList = findAndInsertPhase(d, phaseList); if (phaseList != null) { phasesinfo.setIN_FaultPhases((ArrayList)phaseList); } break; } } } /** * Insert a Phase * @param d * @param phaseList * @return * @throws AxisFault */ private List findAndInsertPhase(Deployable d, List phaseList) throws AxisFault { DeployableChain ec = new DeployableChain(); String last = null; for (Iterator i = phaseList.iterator(); i.hasNext();) { Phase phase = (Phase)i.next(); String name = phase.getName(); Deployable existing = new Deployable(name); existing.setTarget(phase); if (last != null) { // Set up explicit chain relationship for preexisting phases, for now. ec.addRelationship(last, name); } last = name; try { ec.deploy(existing); } catch (Exception e) { // This should never happen when building a simple list like the above throw AxisFault.makeFault(e); } } try { ec.deploy(d); if (d.getTarget() == null) { Phase phase = new Phase(); phase.setName(d.getName()); d.setTarget(phase); } ec.rebuild(); } catch (Exception e) { throw AxisFault.makeFault(e); } phaseList = ec.getChain(); return phaseList; } private void processEndpoints(AxisService axisService, AxisConfiguration axisConfiguration) throws AxisFault { Map enspoints = axisService.getEndpoints(); if (enspoints == null || enspoints.size() == 0) { org.apache.axis2.deployment.util.Utils.addEndpointsToService( axisService, axisConfiguration); } } } ./src/org/apache/axis2/engine/DefaultObjectSupplier.java0000664000175000017500000000216711767656530022407 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; public class DefaultObjectSupplier implements ObjectSupplier { public Object getObject(Class clazz) throws AxisFault { try { return clazz.newInstance(); } catch (Exception e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/engine/AxisEvent.java0000664000175000017500000000270511767656530020054 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; public class AxisEvent { /** * An Axis event is sent to registered listeners whenever anything significant * happens to AxisConfiguration. */ public static final int SERVICE_DEPLOY = 1; public static final int SERVICE_REMOVE = 0; public static final int SERVICE_STOP = 2; public static final int SERVICE_START = 3; public static final int MODULE_DEPLOY = 4; public static final int MODULE_REMOVE = 5; private int EVENT_TYPE; public AxisEvent(int EVENT_TYPE) { this.EVENT_TYPE = EVENT_TYPE; } public int getEventType() { return EVENT_TYPE; } } ./src/org/apache/axis2/engine/Pingable.java0000664000175000017500000000215711767656530017670 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; public interface Pingable { public int PING_FAILD = 0; public int PING_MODULE_LEVEL = 1; public int PING_MR_LEVEL = 2; public int PING_SUCCESSFUL = 3; public String OPERATION_TO_PING = "operationToPing"; int ping() throws AxisFault; } ./src/org/apache/axis2/engine/AxisConfigurator.java0000664000175000017500000000263611767656530021440 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; public interface AxisConfigurator { /** * Configurationcontextfactory will invoke this method to get the AxisConfiguration * * @return AxisConfigurator */ AxisConfiguration getAxisConfiguration() throws AxisFault; /** * Method to deploy services from the repository */ void loadServices(); /** * Engages the global modules specified in the configuration * * @throws AxisFault */ void engageGlobalModules() throws AxisFault; /** * Clean up the mess */ void cleanup(); } ./src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java0000664000175000017500000000205411767656530023011 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatches based on the SOAPAction. * * @deprecated use org.apache.axis2.dispatchers.SOAPActionBasedDispatcher */ public class SOAPActionBasedDispatcher extends org.apache.axis2.dispatchers.SOAPActionBasedDispatcher { } ./src/org/apache/axis2/engine/DependencyManager.java0000664000175000017500000001637311767656530021525 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.service.Lifecycle; import org.apache.axis2.util.Loader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Iterator; /** * If the service implementation has an init method with 1 or 2 message context as its parameters, then * the DependencyManager calls the init method with appropriate parameters. */ public class DependencyManager { private static final Log log = LogFactory.getLog(DependencyManager.class); public final static String SERVICE_INIT_METHOD = "init"; public final static String SERVICE_DESTROY_METHOD = "destroy"; /** * Initialize a new service object. Essentially, check to see if the object wants to receive * an init() call - if so, call it. * * @param obj the service object * @param serviceContext the active ServiceContext * @throws AxisFault if there's a problem initializing * * @deprecated please use initServiceObject() */ public static void initServiceClass(Object obj, ServiceContext serviceContext) throws AxisFault { initServiceObject(obj, serviceContext); } /** * Initialize a new service object. Essentially, check to see if the object wants to receive * an init() call - if so, call it. * * @param obj the service object * @param serviceContext the active ServiceContext * @throws AxisFault if there's a problem initializing */ public static void initServiceObject(Object obj, ServiceContext serviceContext) throws AxisFault { // This is the way to do things into the future. if (obj instanceof Lifecycle) { ((Lifecycle)obj).init(serviceContext); return; } // ...however, we also still support the old way for now. Note that introspecting for // a method like this is something like 10 times slower than the above instanceof check. Class classToLoad = obj.getClass(); // We can not call classToLoad.getDeclaredMethed() , since there // can be insatnce where mutiple services extends using one class // just for init and other reflection methods Method method = null; try { method = classToLoad.getMethod(SERVICE_INIT_METHOD, new Class[]{ServiceContext.class}); } catch (Exception e) { //We do not need to inform this to user , since this something // Axis2 is checking to support Session. So if the method is // not there we should ignore that } if (method != null) { try { method.invoke(obj, new Object[]{serviceContext}); } catch (IllegalAccessException e) { log.info("Exception trying to call " + SERVICE_INIT_METHOD, e); } catch (IllegalArgumentException e) { log.info("Exception trying to call " + SERVICE_INIT_METHOD, e); } catch (InvocationTargetException e) { log.info("Exception trying to call " + SERVICE_INIT_METHOD, e); } } } /** * To init all the services in application scope * * @param serviceGroupContext the ServiceGroupContext from which to extract all the services * @throws AxisFault if there's a problem initializing */ public static void initService(ServiceGroupContext serviceGroupContext) throws AxisFault { AxisServiceGroup serviceGroup = serviceGroupContext.getDescription(); Iterator serviceItr = serviceGroup.getServices(); while (serviceItr.hasNext()) { AxisService axisService = (AxisService) serviceItr.next(); ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService); AxisService service = serviceContext.getAxisService(); ClassLoader classLoader = service.getClassLoader(); Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS); if (implInfoParam != null) { try { Class implClass = Loader.loadClass( classLoader, ((String) implInfoParam.getValue()).trim()); Object serviceImpl = implClass.newInstance(); serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl); initServiceObject(serviceImpl, serviceContext); } catch (Exception e) { AxisFault.makeFault(e); } } } } /** * Notify a service object that it's on death row. * @param serviceContext the active ServiceContext */ public static void destroyServiceObject(ServiceContext serviceContext) { Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT); if (obj != null) { // If this is a Lifecycle object, just call it. if (obj instanceof Lifecycle) { ((Lifecycle)obj).destroy(serviceContext); return; } // For now, we also use "raw" introspection to try and find the destroy method. Class classToLoad = obj.getClass(); Method method = null; try { method = classToLoad.getMethod(SERVICE_DESTROY_METHOD, new Class[]{ServiceContext.class}); } catch (NoSuchMethodException e) { //We do not need to inform this to user , since this something // Axis2 is checking to support Session. So if the method is // not there we should ignore that } if(method!=null){ try { method.invoke(obj, new Object[]{serviceContext}); } catch (IllegalAccessException e) { log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e); } catch (InvocationTargetException e) { log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e); } } } } } ./src/org/apache/axis2/engine/AddressingBasedDispatcher.java0000664000175000017500000000206611767656530023177 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatcher based on the WS-Addressing properties. * @deprecated use org.apache.axis2.dispatchers.AddressingBasedDispatcher */ public class AddressingBasedDispatcher extends org.apache.axis2.dispatchers.AddressingBasedDispatcher { } ./src/org/apache/axis2/engine/AbstractDispatcher.java0000664000175000017500000001210011767656530021706 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This the base class for all dispatchers. A dispatcher's task is * to find the service for an incoming SOAP message. *

        * In Axis2, a chain of dispatchers is setup. Each tries to * dispatch and return without throwing an exception, in case it fails * to find the service or operation. Dispatchers look for services, operations, * or both. * */ public abstract class AbstractDispatcher extends AbstractHandler { /** * Field NAME */ public static final String NAME = "AbstractDispatcher"; private static final Log log = LogFactory.getLog(AbstractDispatcher.class); public AbstractDispatcher() { init(new HandlerDescription(NAME)); } /** * Called by Axis Engine to find the operation. * * @param service * @param messageContext * @return Returns AxisOperation. * @throws AxisFault */ public abstract AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault; /** * Called by Axis Engine to find the service. * * @param messageContext * @return Returns AxisService. * @throws AxisFault */ public abstract AxisService findService(MessageContext messageContext) throws AxisFault; public abstract void initDispatcher(); /** * @param msgctx * @throws org.apache.axis2.AxisFault */ public InvocationResponse invoke(MessageContext msgctx) throws AxisFault { AxisService axisService = msgctx.getAxisService(); if (axisService == null) { axisService = findService(msgctx); if (axisService != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("servicefound", axisService.getName())); } msgctx.setAxisService(axisService); } } if ((axisService != null) && (msgctx.getAxisOperation() == null)) { AxisOperation axisOperation = findOperation(axisService, msgctx); if (axisOperation != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("operationfound", axisOperation .getName().getLocalPart())); } msgctx.setAxisOperation(axisOperation); //setting axisMessage into messageContext msgctx.setAxisMessage(axisOperation.getMessage( WSDLConstants.MESSAGE_LABEL_IN_VALUE)); AxisEndpoint axisEndpoint = (AxisEndpoint) msgctx.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME); if (axisEndpoint != null) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint.getBinding() .getChild(axisOperation.getName()); msgctx .setProperty( Constants.AXIS_BINDING_MESSAGE, axisBindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); msgctx.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation); } } } return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/engine/AxisError.java0000664000175000017500000000241111767656530020056 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; public class AxisError extends RuntimeException { private static final long serialVersionUID = 6291062136407995920L; public AxisError() { } /** * @param message Error message */ public AxisError(String message) { super(message); } /** * @param message Error message * @param cause Cause */ public AxisError(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axis2/engine/Deployable.java0000664000175000017500000000507711767656530020233 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import java.util.HashSet; import java.util.Set; /** * A Deployable is a container for something (Phases, Handlers) which wants * to be deployed in an ordered and constrained fashion via a * DeployableChain. */ public class Deployable { private String name; private String phase; private Set successors; private Set predecessors; boolean first; boolean last; Object target; public Deployable(String name) { this.name = name; } public Deployable(String name, Object target) { this.name = name; this.target = target; } public String getName() { return name; } public void addSuccessor(String name) { if (successors == null) { successors = new HashSet(); } successors.add(name); } public void addPredecessor(String name) { if (predecessors == null) { predecessors = new HashSet(); } predecessors.add(name); } public Set getPredecessors() { return predecessors; } public Set getSuccessors() { return successors; } public String getPhase() { return phase; } public void setPhase(String phase) { this.phase = phase; } public boolean isFirst() { return first; } public void setFirst(boolean first) { this.first = first; } public boolean isLast() { return last; } public void setLast(boolean last) { this.last = last; } public void setTarget(Object target) { this.target = target; } public Object getTarget() { return target; } } ./src/org/apache/axis2/engine/ObjectSupplier.java0000664000175000017500000000243311767656530021076 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; public interface ObjectSupplier { /** * If someone want to write service impl class with interface * being there method parameter , then at the time of deserilization * this method will provide the impl class for that interface. * * @param clazz Type * @return * @throws AxisFault : will throw an exception when something goes wrong */ Object getObject(Class clazz) throws AxisFault; } ./src/org/apache/axis2/engine/MessageReceiver.java0000664000175000017500000000246211767656530021217 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; /** * An instance of MessageReceiver can be setup to receive messages. The application logic has no impact * on the Axis Engine iself. It is upto the application logic to do whatever it needs. For e.g. * the MessageReceiver can handle a message, send a response back and/or send other messages. */ public interface MessageReceiver { public void receive(MessageContext messageCtx) throws AxisFault; } ./src/org/apache/axis2/engine/AxisServer.java0000664000175000017500000001037511767656530020243 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisService; /** * This class provide a very convenient way of creating server and deploying services. * Once someone call start method it will fire up configuration context and start up the listeners. * One can provide repository location and axis.xml as system properties. */ public class AxisServer { protected ConfigurationContext configContext; protected ListenerManager listenerManager; private boolean startOnDeploy; private boolean started = false; /** * If you do not want Axis2 to start the server automatically then pass the "false" else "true" * @param startOnDeploy : boolean */ public AxisServer(boolean startOnDeploy){ this.startOnDeploy = startOnDeploy; listenerManager = new ListenerManager(); } /** * Server will start automatically if you call deployService */ public AxisServer() { this(true); } /** * Will make Java class into a web service * @param serviceClassName : Actual class you want to make as a web service * @throws AxisFault : If something went wrong */ public void deployService(String serviceClassName) throws AxisFault{ if(configContext==null){ configContext = getConfigurationContext(); } AxisConfiguration axisConfig = configContext.getAxisConfiguration(); AxisService service = AxisService.createService(serviceClassName,axisConfig); axisConfig.addService(service); if(startOnDeploy){ start(); } } /** * Will create a configuration context from the avialable data and then it * will start the listener manager * @throws AxisFault if something went wrong */ protected void start()throws AxisFault { if(configContext==null){ configContext = getConfigurationContext(); } if(!started){ listenerManager.startSystem(configContext); started = true; } } /** * Stop the server, automatically terminates the listener manager as well. * @throws AxisFault */ public void stop() throws AxisFault{ if(configContext!=null){ configContext.terminate(); } } /** * Set the configuration context. Please call this before you call deployService or start method * * @param configContext ConfigurationContext */ public void setConfigurationContext(ConfigurationContext configContext) { this.configContext = configContext; } /** * Creates a default configuration context if one is not set already via setConfigurationContext * * @return ConfigurationContext * @throws AxisFault */ public ConfigurationContext getConfigurationContext() throws AxisFault { if(configContext == null){ configContext = createDefaultConfigurationContext(); } return configContext; } /** * Users extending this class can override this method to supply a custom ConfigurationContext * @return ConfigurationContext * @throws AxisFault */ protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault { return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null); } } ./src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java0000664000175000017500000000213611767656530023362 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatches the operation based on the information from the target endpoint URL. * * @deprecated use org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher */ public class HTTPLocationBasedDispatcher extends org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher { } ./src/org/apache/axis2/engine/AxisEngine.java0000664000175000017500000007051411767656530020203 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axiom.soap.RolePlayer; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.Handler.InvocationResponse; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.util.CallbackReceiver; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.MessageContextBuilder; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * There is one engine for the Server and the Client. the send() and receive() * Methods are the basic operations the Sync, Async messageing are build on top. */ public class AxisEngine { /** * Field log */ private static final Log log = LogFactory.getLog(AxisEngine.class); private static boolean RESUMING_EXECUTION = true; private static boolean NOT_RESUMING_EXECUTION = false; /** * Constructor AxisEngine */ public AxisEngine(ConfigurationContext engineContext) { } private static void checkMustUnderstand(MessageContext msgContext) throws AxisFault { List unprocessed = null; SOAPEnvelope envelope = msgContext.getEnvelope(); if (envelope.getHeader() == null) { return; } // Get all the headers targeted to us Iterator headerBlocks = envelope.getHeader().getHeadersToProcess((RolePlayer)msgContext.getConfigurationContext().getAxisConfiguration().getParameterValue("rolePlayer")); while (headerBlocks.hasNext()) { SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next(); QName headerName = headerBlock.getQName(); // if this header block has been processed or mustUnderstand isn't // turned on then its cool if (headerBlock.isProcessed() || !headerBlock.getMustUnderstand()) { continue; } if(LoggingControl.debugLoggingAllowed && log.isDebugEnabled()){ log.debug("MustUnderstand header not processed or registered as understood"+headerName); } if(isReceiverMustUnderstandProcessor(msgContext)){ if(unprocessed == null){ unprocessed = new ArrayList(); } if(!unprocessed.contains(headerName)){ unprocessed.add(headerName); } continue; } // Oops, throw an appropriate MustUnderstand fault!! QName faultQName = headerBlock.getVersion().getMustUnderstandFaultCode(); throw new AxisFault(Messages.getMessage("mustunderstandfailed", headerBlock.getNamespace().getNamespaceURI(), headerBlock.getLocalName()), faultQName); } if(unprocessed !=null && unprocessed.size()>0){ //Adding HeaderQNames that failed MU check as AxisService Parameter //They will be examined later by MessageReceivers. if(log.isDebugEnabled()){ log.debug("Adding Unprocessed headers to MessageContext."); } msgContext.setProperty(Constants.UNPROCESSED_HEADER_QNAMES, unprocessed); } } private static boolean isReceiverMustUnderstandProcessor(MessageContext msgContext){ MessageReceiver receiver = null; if(msgContext.isServerSide()){ receiver = msgContext.getAxisOperation().getMessageReceiver(); } return (receiver!=null && receiver.getClass().getName().endsWith("JAXWSMessageReceiver")); } /** * This method is called to handle any error that occurs at inflow or outflow. But if the * method is called twice, it implies that sending the error handling has failed, in which case * the method logs the error and exists. * * @deprecated (post 1.1 branch) */ public static MessageContext createFaultMessageContext(MessageContext processingContext, Throwable e) throws AxisFault { return MessageContextBuilder.createFaultMessageContext(processingContext, e); } /** * This methods represents the inflow of the Axis, this could be either at the server side or the client side. * Here the ExecutionChain is created using the Phases. The Handlers at the each Phases is ordered in * deployment time by the deployment module * * @throws AxisFault * @see MessageContext * @see Phase * @see Handler */ public static InvocationResponse receive(MessageContext msgContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " receive:" + msgContext.getMessageID()); } ConfigurationContext confContext = msgContext.getConfigurationContext(); ArrayList preCalculatedPhases; if (msgContext.isFault() || msgContext.isProcessingFault()) { preCalculatedPhases = confContext.getAxisConfiguration().getInFaultFlowPhases(); msgContext.setFLOW(MessageContext.IN_FAULT_FLOW); } else { preCalculatedPhases = confContext.getAxisConfiguration().getInFlowPhases(); msgContext.setFLOW(MessageContext.IN_FLOW); } // Set the initial execution chain in the MessageContext to a *copy* of what // we got above. This allows individual message processing to change the chain without // affecting later messages. msgContext.setExecutionChain((ArrayList) preCalculatedPhases.clone()); try { InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION); if (pi.equals(InvocationResponse.CONTINUE)) { checkMustUnderstand(msgContext); if (msgContext.isServerSide()) { // invoke the Message Receivers MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver(); if (receiver == null) { throw new AxisFault(Messages.getMessage( "nomessagereciever", msgContext.getAxisOperation().getName().toString())); } receiver.receive(msgContext); } flowComplete(msgContext); } else if (pi.equals(InvocationResponse.SUSPEND)) { return pi; } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); // Undo any partial work. // Remove the incoming message context if (log.isDebugEnabled()) { log.debug("InvocationResponse is aborted. " + "The incoming MessageContext is removed, " + "and the OperationContext is marked as incomplete"); } AxisOperation axisOp = msgContext.getAxisOperation(); if(axisOp!=null){ String mepURI = axisOp.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI)) { OperationContext opCtx = msgContext.getOperationContext(); if (opCtx != null) { opCtx.removeMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } } } else{ log.debug("Could not clean up op ctx for " + msgContext); } return pi; } else { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.receive()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } catch (AxisFault e) { log.error(e.getMessage(), e); msgContext.setFailureReason(e); flowComplete(msgContext); throw e; } return InvocationResponse.CONTINUE; } private static void processFault(MessageContext msgContext, AxisFault e) { try { MessageContext faultMC = MessageContextBuilder.createFaultMessageContext(msgContext, e); // Figure out where this goes sendFault(faultMC); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } } /** * Take the execution chain from the msgContext , and then take the current Index * and invoke all the phases in the arraylist * if the msgContext is pauesd then the execution will be breaked * * @param msgContext * @return An InvocationResponse that indicates what * the next step in the message processing should be. * @throws AxisFault */ private static InvocationResponse invoke(MessageContext msgContext, boolean resuming) throws AxisFault { if (msgContext.getCurrentHandlerIndex() == -1) { msgContext.setCurrentHandlerIndex(0); } InvocationResponse pi = InvocationResponse.CONTINUE; while (msgContext.getCurrentHandlerIndex() < msgContext.getExecutionChain().size()) { Handler currentHandler = (Handler) msgContext.getExecutionChain(). get(msgContext.getCurrentHandlerIndex()); try { if (!resuming) { msgContext.addExecutedPhase(currentHandler); } else { /* If we are resuming the flow, we don't want to add the phase * again, as it has already been added. */ resuming = false; } pi = currentHandler.invoke(msgContext); } catch (AxisFault e) { if (msgContext.getCurrentPhaseIndex() == 0) { /* If we got a fault, we still want to add the phase to the list to be executed for flowComplete(...) unless this was the first handler, as then the currentPhaseIndex will be set to 0 and this will look like we've executed all of the handlers. If, at some point, a phase really needs to get notification of flowComplete, then we'll need to introduce some more complex logic to keep track of what has been executed.*/ msgContext.removeFirstExecutedPhase(); } throw e; } if (pi.equals(InvocationResponse.SUSPEND) || pi.equals(InvocationResponse.ABORT)) { break; } msgContext.setCurrentHandlerIndex(msgContext.getCurrentHandlerIndex() + 1); } return pi; } private static void flowComplete(MessageContext msgContext) { Iterator invokedPhaseIterator = msgContext.getExecutedPhases(); while (invokedPhaseIterator.hasNext()) { Handler currentHandler = ((Handler) invokedPhaseIterator.next()); currentHandler.flowComplete(msgContext); } /*This is needed because the OutInAxisOperation currently invokes * receive() even when a fault occurs, and we will have already executed * the flowComplete on those before receiveFault() is called. */ msgContext.resetExecutedPhases(); } /** * If the msgConetext is puased and try to invoke then * first invoke the phase list and after the message receiver * * @param msgContext * @return An InvocationResponse allowing the invoker to perhaps determine * whether or not the message processing will ever succeed. * @throws AxisFault */ public static InvocationResponse resumeReceive(MessageContext msgContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " resumeReceive:" + msgContext.getMessageID()); } //REVIEW: This name is a little misleading, as it seems to indicate that there should be a resumeReceiveFault as well, when, in fact, this does both //REVIEW: Unlike with receive, there is no wrapping try/catch clause which would //fire off the flowComplete on an error, as we have to assume that the //message will be resumed again, but perhaps we need to unwind back to //the point at which the message was resumed and provide another API //to allow the full unwind if the message is going to be discarded. //invoke the phases InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION); //invoking the MR if (pi.equals(InvocationResponse.CONTINUE)) { checkMustUnderstand(msgContext); if (msgContext.isServerSide()) { // invoke the Message Receivers MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver(); if (receiver == null) { throw new AxisFault(Messages.getMessage( "nomessagereciever", msgContext.getAxisOperation().getName().toString())); } receiver.receive(msgContext); } flowComplete(msgContext); } return pi; } /** * To resume the invocation at the send path , this is neened since it is require to call * TransportSender at the end * * @param msgContext * @return An InvocationResponse allowing the invoker to perhaps determine * whether or not the message processing will ever succeed. * @throws AxisFault */ public static InvocationResponse resumeSend(MessageContext msgContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " resumeSend:" + msgContext.getMessageID()); } //REVIEW: This name is a little misleading, as it seems to indicate that there should be a resumeSendFault as well, when, in fact, this does both //REVIEW: Unlike with send, there is no wrapping try/catch clause which would //fire off the flowComplete on an error, as we have to assume that the //message will be resumed again, but perhaps we need to unwind back to //the point at which the message was resumed and provide another API //to allow the full unwind if the message is going to be discarded. //invoke the phases InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION); //Invoking Transport Sender if (pi.equals(InvocationResponse.CONTINUE)) { // write the Message to the Wire TransportOutDescription transportOut = msgContext.getTransportOut(); TransportSender sender = transportOut.getSender(); sender.invoke(msgContext); flowComplete(msgContext); } return pi; } /** * Resume processing of a message. * * @param msgctx * @return An InvocationResponse allowing the invoker to perhaps determine * whether or not the message processing will ever succeed. * @throws AxisFault */ public static InvocationResponse resume(MessageContext msgctx) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgctx.getLogIDString() + " resume:" + msgctx.getMessageID()); } msgctx.setPaused(false); if (msgctx.getFLOW() == MessageContext.IN_FLOW) { return resumeReceive(msgctx); } else { return resumeSend(msgctx); } } /** * This methods represents the outflow of the Axis, this could be either at the server side or the client side. * Here the ExecutionChain is created using the Phases. The Handlers at the each Phases is ordered in * deployment time by the deployment module * * @param msgContext * @throws AxisFault * @see MessageContext * @see Phase * @see Handler */ public static void send(MessageContext msgContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " send:" + msgContext.getMessageID()); } // find and invoke the Phases OperationContext operationContext = msgContext.getOperationContext(); ArrayList executionChain = operationContext.getAxisOperation().getPhasesOutFlow(); //rather than having two steps added both oparation and global chain together ArrayList outPhases = new ArrayList(); outPhases.addAll(executionChain); outPhases.addAll(msgContext.getConfigurationContext().getAxisConfiguration().getOutFlowPhases()); msgContext.setExecutionChain(outPhases); msgContext.setFLOW(MessageContext.OUT_FLOW); try { InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION); if (pi.equals(InvocationResponse.CONTINUE)) { // write the Message to the Wire TransportOutDescription transportOut = msgContext.getTransportOut(); if (transportOut == null) { throw new AxisFault("Transport out has not been set"); } TransportSender sender = transportOut.getSender(); // This boolean property only used in client side fireAndForget invocation //It will set a property into message context and if some one has set the //property then transport sender will invoke in a diffrent thread Object isTransportNonBlocking = msgContext.getProperty( MessageContext.TRANSPORT_NON_BLOCKING); if (isTransportNonBlocking != null && ((Boolean) isTransportNonBlocking).booleanValue()) { msgContext.getConfigurationContext().getThreadPool().execute( new TransportNonBlockingInvocationWorker(msgContext, sender)); } else { sender.invoke(msgContext); } //REVIEW: In the case of the TransportNonBlockingInvocationWorker, does this need to wait until that finishes? flowComplete(msgContext); } else if (pi.equals(InvocationResponse.SUSPEND)) { } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); } else { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.send()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } catch (AxisFault e) { msgContext.setFailureReason(e); flowComplete(msgContext); throw e; } } /** * Sends the SOAP Fault to another SOAP node. * * @param msgContext * @throws AxisFault */ public static void sendFault(MessageContext msgContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " sendFault:" + msgContext.getMessageID()); } OperationContext opContext = msgContext.getOperationContext(); //FIXME: If this gets paused in the operation-specific phases, the resume is not going to function correctly as the phases will not have all been set // find and execute the Fault Out Flow Handlers if (opContext != null) { AxisOperation axisOperation = opContext.getAxisOperation(); ArrayList faultExecutionChain = axisOperation.getPhasesOutFaultFlow(); //adding both operation specific and global out fault flows. ArrayList outFaultPhases = new ArrayList(); outFaultPhases.addAll((ArrayList) faultExecutionChain.clone()); msgContext.setExecutionChain((ArrayList) outFaultPhases.clone()); msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW); try { InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION); if (pi.equals(InvocationResponse.SUSPEND)) { log.warn(msgContext.getLogIDString() + " The resumption of this flow may function incorrectly, as the OutFaultFlow will not be used"); return; } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); return; } else if (!pi.equals(InvocationResponse.CONTINUE)) { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.sendFault()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } catch (AxisFault e) { msgContext.setFailureReason(e); flowComplete(msgContext); throw e; } } msgContext.setExecutionChain((ArrayList) msgContext.getConfigurationContext() .getAxisConfiguration().getOutFaultFlowPhases().clone()); msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW); InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION); if (pi.equals(InvocationResponse.CONTINUE)) { // Actually send the SOAP Fault TransportOutDescription transportOut = msgContext.getTransportOut(); if (transportOut == null) { throw new AxisFault("Transport out has not been set"); } TransportSender sender = transportOut.getSender(); sender.invoke(msgContext); flowComplete(msgContext); } else if (pi.equals(InvocationResponse.SUSPEND)) { } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); } else { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.sendFault()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } /** * here we assume that it is resume from an operation level handler * @param msgContext * @throws AxisFault */ public static void resumeSendFault(MessageContext msgContext) throws AxisFault{ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace(msgContext.getLogIDString() + " resumeSendFault:" + msgContext.getMessageID()); } OperationContext opContext = msgContext.getOperationContext(); if (opContext != null) { try { InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION); if (pi.equals(InvocationResponse.SUSPEND)) { log.warn(msgContext.getLogIDString() + " The resumption of this flow may function incorrectly, as the OutFaultFlow will not be used"); return; } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); return; } else if (!pi.equals(InvocationResponse.CONTINUE)) { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.sendFault()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } catch (AxisFault e) { msgContext.setFailureReason(e); flowComplete(msgContext); throw e; } } msgContext.setExecutionChain((ArrayList) msgContext.getConfigurationContext() .getAxisConfiguration().getOutFaultFlowPhases().clone()); msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW); InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION); if (pi.equals(InvocationResponse.CONTINUE)) { // Actually send the SOAP Fault TransportOutDescription transportOut = msgContext.getTransportOut(); if (transportOut == null) { throw new AxisFault("Transport out has not been set"); } TransportSender sender = transportOut.getSender(); sender.invoke(msgContext); flowComplete(msgContext); } else if (pi.equals(InvocationResponse.SUSPEND)) { } else if (pi.equals(InvocationResponse.ABORT)) { flowComplete(msgContext); } else { String errorMsg = "Unrecognized InvocationResponse encountered in AxisEngine.sendFault()"; log.error(msgContext.getLogIDString() + " " + errorMsg); throw new AxisFault(errorMsg); } } /** * This class is used when someone invoke a service invocation with two transports * If we dont create a new thread then the main thread will block untill it gets the * response . In the case of HTTP transportsender will block untill it gets HTTP 200 * So , main thread also block till transport sender rereases the tread. So there is no * actual non-blocking. That is why when sending we creat a new thead and send the * requset via that. *

        * So whole porpose of this class to send the requset via a new thread *

        * way transport. */ private static class TransportNonBlockingInvocationWorker implements Runnable { private MessageContext msgctx; private TransportSender sender; public TransportNonBlockingInvocationWorker(MessageContext msgctx, TransportSender sender) { this.msgctx = msgctx; this.sender = sender; } public void run() { try { sender.invoke(msgctx); } catch (Exception e) { log.info(msgctx.getLogIDString() + " " + e.getMessage()); if (msgctx.getProperty(MessageContext.DISABLE_ASYNC_CALLBACK_ON_TRANSPORT_ERROR) == null) { AxisOperation axisOperation = msgctx.getAxisOperation(); if (axisOperation != null) { MessageReceiver msgReceiver = axisOperation.getMessageReceiver(); if ((msgReceiver != null) && (msgReceiver instanceof CallbackReceiver)) { Object callback = ((CallbackReceiver) msgReceiver) .lookupCallback(msgctx.getMessageID()); if (callback == null) return; // TODO: should we log this?? if (callback instanceof Callback) { ((Callback)callback).onError(e); } else { ((AxisCallback)callback).onError(e); } } } } } } } } ./src/org/apache/axis2/engine/DeployableChain.java0000664000175000017500000002425311767656530021173 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * A DeployableChain is a container which manages dependencies between Deployables. You * deploy() them in, then call rebuild() which will set up a chain, correctly ordered according * to the constraints in the Deployables. */ public class DeployableChain { /** The actual things (handlers or phases) */ List chain = new ArrayList(); Deployable first; Deployable last; /** A Map of name -> List (of Strings). Each List contains the key's successors */ Map activeConstraints = new LinkedHashMap(); /** A Map of name -> Deployable for all deployed items */ private Map deployed = new LinkedHashMap(); /** * Deploy a Deployable into this chain. Note that this does NOT order yet. The idea * is to deploy everything first, then call rebuild() to generate the fully ordered chain. * This method will validate the Deployable, including confirming that it's compatible with * any previously deployed item of the same name. * * @param deployable Deployable to deploy. * @throws Exception if there is a deployment error. */ public void deploy(Deployable deployable) throws Exception { String name = deployable.getName(); Set mySuccessors = deployable.getSuccessors(); Set myPredecessors = deployable.getPredecessors(); if (deployable.isFirst()) { if (first != null) { throw new Exception("'" + first.getName() + "' is already first, can't deploy '" + name + "' as first also."); } if (myPredecessors != null) { throw new Exception("Deploying '" + name + "' - can't both be first and have predecessors!"); } first = deployable; } if (deployable.isLast()) { if (last != null) { throw new Exception("'" + last.getName() + "' is already last, can't deploy '" + name + "' as last also."); } if (mySuccessors != null) { throw new Exception("Deploying '" + name + "' - can't both be last and have successors!"); } last = deployable; } Deployable previous = (Deployable)deployed.get(name); if (previous == null) { deployed.put(name, deployable); } else { // If something by this name already exists, ensure it's compatible if (previous.isFirst() != deployable.isFirst()) { throw new Exception("Can't deploy '" + name + "', values for first don't match!"); } if (previous.isLast() != deployable.isLast()) { throw new Exception("Can't deploy '" + name + "', values for last don't match!"); } Object target = previous.getTarget(); if (target != null) { if (deployable.getTarget() != null && !target.equals(deployable.getTarget())) { throw new Exception("Can't deploy '" + name + "', targets must either match or be null."); } } else { previous.setTarget(deployable.getTarget()); } } if (mySuccessors != null && !mySuccessors.isEmpty()) { Set successors = (Set)activeConstraints.get(name); if (successors == null) { successors = new LinkedHashSet(); activeConstraints.put(name, successors); } successors.addAll(mySuccessors); } if (myPredecessors != null) { for (Iterator i = myPredecessors.iterator(); i.hasNext();) { String predecessor = (String)i.next(); // define relationship for each one addRelationship(predecessor, name); } } } /** * Find the correct (minimum) index for a given name. Finds the active constraints * for the name, then walks that list, making sure that each one is already placed. * If a given successor isn't yet placed, we recursively call this method to place it, * passing a set of "what's left to do" and a set of "what we've seen". * * This results in chain containing the names (Strings). * * TODO: investigate optimizing this algorithm a bit * * @param name the target deployable's name * @param remaining a Set of the names of things we have yet to deploy * @param seen a Set of the names of things we've already seen (to detect loops) * @return an index >=0 or -1 if there was a dependency cycle * @throws Exception if there's a cyclic dependency */ private int getMinIndex(String name, Set remaining, Set seen) throws Exception { if (seen.contains(name)) { // We return -1 here instead of throwing the Exception so we can build a better // error message below. return -1; } Collection successors = (Collection)activeConstraints.get(name); if (successors == null || successors.isEmpty()) { // Never put anything after the thing marked "last"... int index = (last == null) ? chain.size() : chain.size() - 1; chain.add(index, name); remaining.remove(name); return index; } int minIndex = -1; for (Iterator i = successors.iterator(); i.hasNext();) { String otherName = (String)i.next(); int otherIdx = chain.indexOf(otherName); if (otherIdx > -1) { if ((minIndex == -1) || (minIndex > otherIdx)) { minIndex = otherIdx; } } else { // This guy isn't in our list yet - put him in IF he's real (exists in // the deployed list) and we haven't already placed him (exists in // the remaining set). if ((deployed.get(otherName) != null) && remaining.contains(otherName)) { seen.add(name); // Not in list yet, go place it int min = getMinIndex(otherName, remaining, seen); if (minIndex == -1 || min < minIndex) { minIndex = min; } if (minIndex == -1) { throw new Exception("Trying to put '" + name + "' before '" + otherName + "' - incompatible constraints!"); } } } } if (minIndex == -1) minIndex = 0; chain.add(minIndex, name); remaining.remove(name); return minIndex; } /** * Taking into account all the active constraints, order the list. This blows * away the old order. Could improve this slightly with a "dirty" flag. * * @throws Exception if there's an ordering conflict */ public void rebuild() throws Exception { chain.clear(); Set keys = new LinkedHashSet(); keys.addAll(deployed.keySet()); // First goes first. if (first != null) { chain.add(first.getName()); keys.remove(first.getName()); } // Last goes next, and everything else will get inserted before it if it exists. if (last != null) { Collection afterLast = (Collection)activeConstraints.get(last.getName()); if (afterLast != null) { throw new Exception("Can't have anything which goes after '" + last.getName() + "', which has been declared last."); } chain.add(last.getName()); keys.remove(last.getName()); } while (!keys.isEmpty()) { String name = (String)keys.iterator().next(); getMinIndex(name, keys, new LinkedHashSet()); } // Now we've got a chain of names. Convert to actual things before we return. for (int i = 0; i < chain.size(); i++) { String name = (String)chain.get(i); chain.set(i, ((Deployable)deployed.get(name)).getTarget()); } } /** * Adds a before/after relationship to the active constraints. * * @param before name of the Deployable that must come first * @param after name of the Deployable that must come later */ public void addRelationship(String before, String after) { Set successors = (Set)activeConstraints.get(before); if (successors == null) { successors = new LinkedHashSet(); activeConstraints.put(before, successors); } successors.add(after); } /** * Get the chain - once rebuild() has been called this will be the chain of target objects. * * @return a List of target objects in the correct order */ public List getChain() { // todo - should this call rebuild() automatically (if dirty flag is set)? return chain; } } ./src/org/apache/axis2/engine/RequestURIOperationDispatcher.java0000664000175000017500000000214311767656530024042 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatches the operation based on the information from the target endpoint URL. * * @deprecated use org.apache.axis2.dispatchers.RequestURIOperationDispatcher */ public class RequestURIOperationDispatcher extends org.apache.axis2.dispatchers.RequestURIOperationDispatcher { } ./src/org/apache/axis2/engine/Handler.java0000664000175000017500000001237411767656530017526 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; /** * A Handler represents a piece of message processing functionality in Axis2. * * Handlers are combined into chains and phases in order to provide customizable functionality * such as security, reliability, etc. Handlers must be multi-thread safe and should keep all * their state in Context objects (see the org.apache.axis2.context package). */ public interface Handler { /** * @deprecated This method will be going away after the 1.3 release, it was never used. */ public void cleanup(); /** * Initialize a Handler. * * @param handlerDesc the HandlerDescription for this Handler */ public void init(HandlerDescription handlerDesc); /** * This method will be called on each registered handler when a message * needs to be processed. If the message processing is paused by the * handler, then this method will be called again for the handler that * paused the processing once it is resumed. *

        * This method may be called concurrently from multiple threads. *

        * Handlers that want to determine the type of message that is to be * processed (e.g. response vs request, inbound vs. outbound, etc.) can * retrieve that information from the MessageContext via * MessageContext.getFLOW() and * MessageContext.getAxisOperation().getMessageExchangePattern() APIs. * * @param msgContext the MessageContext to process with this * Handler. * @return An InvocationResponse that indicates what * the next step in the message processing should be. * @throws AxisFault if the handler encounters an error */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault; /** * This method will be called on each registered handler that had its * invoke(...) method called during the processing of the message, once * the message processing has completed. During execution of the * flowComplete's, handlers are invoked in the opposite order that they * were invoked originally. Note that implementations SHOULD check * msgContext.getFailureReason() to see if this is an error or a normal * completion. * * @param msgContext the MessageContext to process with this * Handler. */ public void flowComplete(MessageContext msgContext); /** * Gets the HandlerDescription of a handler. * * @return Returns HandlerDescription. */ public HandlerDescription getHandlerDesc(); /** * Return the name of this Handler * * @return the handler's name as a String */ public String getName(); /** * Get a Parameter from this Handler * * @param name the name of the desired value * @return the Parameter, or null. */ public Parameter getParameter(String name); /** * This type encapsulates an enumeration of possible message processing * instruction values that may be returned by a handler/phase within the * runtime. The returned instruction will determine the next step in * the processing. */ public class InvocationResponse { public static InvocationResponse CONTINUE = new InvocationResponse(0, "InvocationResponse.CONTINUE"); public static InvocationResponse SUSPEND = new InvocationResponse(1, "InvocationResponse.SUSPEND"); public static InvocationResponse ABORT = new InvocationResponse(2, "InvocationResponse.ABORT"); private int instructionID; private String description; private InvocationResponse(int instructionID, String description) { this.instructionID = instructionID; this.description = description; } public int hashCode() { return instructionID; } public boolean equals(Object obj) { if (!(obj instanceof InvocationResponse)) { return false; } final InvocationResponse instance = (InvocationResponse) obj; return (instructionID == instance.instructionID); } public String toString() { return description; } } } ./src/org/apache/axis2/engine/ServiceLifeCycle.java0000664000175000017500000000332711767656530021327 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisService; /** * When you want to initialize database connections , starting threads and etc.. * at the time you deploy service (similar to loadonstartup). * You need to implement this interface and add additional (optional) attribute * into services.xml */ public interface ServiceLifeCycle { /** * this will be called during the deployement time of the service. irrespective * of the service scope this method will be called */ public void startUp(ConfigurationContext configctx, AxisService service); /** * this will be called during the system shut down time. irrespective * of the service scope this method will be called */ public void shutDown(ConfigurationContext configctx, AxisService service); }./src/org/apache/axis2/engine/RequestURIBasedDispatcher.java0000664000175000017500000000212511767656530023120 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatches the service based on the information from the target endpoint URL. * * @deprecated use org.apache.axis2.dispatchers.RequestURIBasedDispatcher */ public class RequestURIBasedDispatcher extends org.apache.axis2.dispatchers.RequestURIBasedDispatcher { } ./src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java0000664000175000017500000000214011767656530023772 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; /** * Dispatches based on the namespace URI of the first child of * the body. * * @deprecated use org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher */ public class SOAPMessageBodyBasedDispatcher extends org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher { } ./src/org/apache/axis2/engine/ListenerManager.java0000664000175000017500000002303311767656530021223 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.i18n.Messages; import org.apache.axis2.modules.Module; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.TransportSender; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.HashMap; import java.util.Iterator; import java.util.List; public class ListenerManager { private static final Log log = LogFactory.getLog(ListenerManager.class); public static ConfigurationContext defaultConfigurationContext; public static ListenerManager getDefaultListenerManager() { if (defaultConfigurationContext == null) return null; return defaultConfigurationContext.getListenerManager(); } private ConfigurationContext configctx; private HashMap startedTransports = new HashMap(); private boolean stopped ; public void init(ConfigurationContext configCtx) { configCtx.setTransportManager(this); this.configctx = configCtx; } public ConfigurationContext getConfigctx() { return configctx; } /** * To get an EPR for a given service * * @param serviceName : Name of the service * @param transportName : name of the trasport can be null , if it is null then * @return String */ public synchronized EndpointReference getEPRforService(String serviceName, String opName, String transportName) throws AxisFault { if (transportName == null || "".equals(transportName)) { AxisService service = configctx.getAxisConfiguration().getService(serviceName); if (service == null) { throw new AxisFault(Messages.getMessage( "servicenotfoundinthesystem", serviceName)); } if (service.isEnableAllTransports()) { Iterator itr_st = startedTransports.values().iterator(); while (itr_st.hasNext()) { TransportListener transportListener = (TransportListener) itr_st.next(); EndpointReference[] epRsForService = transportListener.getEPRsForService(serviceName, null); if (epRsForService != null) { return epRsForService[0]; } } // if nothing can be found return null return null; } else { List exposeTransport = service.getExposedTransports(); TransportListener listener = (TransportListener) startedTransports.get(exposeTransport.get(0)); EndpointReference[] eprsForService; eprsForService = listener.getEPRsForService(serviceName, null); return eprsForService != null ? eprsForService[0] : null; } } else { TransportInDescription trsIN = configctx.getAxisConfiguration() .getTransportIn(transportName); TransportListener listener = trsIN.getReceiver(); EndpointReference[] eprsForService; eprsForService = listener.getEPRsForService(serviceName, null); return eprsForService != null ? eprsForService[0] : null; } } /** * To start all the transports */ public synchronized void start() { for (Iterator transportNames = configctx.getAxisConfiguration().getTransportsIn().values().iterator(); transportNames.hasNext();) { try { TransportInDescription transportIn = (TransportInDescription) transportNames.next(); TransportListener listener = transportIn.getReceiver(); if (listener != null && startedTransports.get(transportIn.getName()) == null) { listener.init(configctx, transportIn); listener.start(); if (startedTransports.get(transportIn.getName()) == null) { startedTransports.put(transportIn.getName(), listener); } } } catch (Exception e) { log.info(e.getMessage(), e); } } Runtime.getRuntime().addShutdownHook(new ListenerManagerShutdownThread(this)); } public synchronized void startSystem(ConfigurationContext configurationContext) { init(configurationContext); start(); } /** * Stop all the transports and notify modules of shutdown. */ public synchronized void stop() throws AxisFault { if (stopped) { return; } for (Iterator iter = startedTransports.values().iterator(); iter.hasNext();) { TransportListener transportListener = (TransportListener) iter.next(); transportListener.stop(); } /*Stop the transport senders*/ HashMap transportOut = configctx.getAxisConfiguration().getTransportsOut(); if (transportOut.size() > 0) { Iterator trsItr = transportOut.values().iterator(); while (trsItr.hasNext()) { TransportOutDescription outDescription = (TransportOutDescription) trsItr.next(); TransportSender trsSededer = outDescription.getSender(); if (trsSededer != null) { trsSededer.stop(); } } } /*Shut down the modules*/ HashMap modules = configctx.getAxisConfiguration().getModules(); if (modules != null) { Iterator moduleitr = modules.values().iterator(); while (moduleitr.hasNext()) { AxisModule axisModule = (AxisModule) moduleitr.next(); Module module = axisModule.getModule(); if (module != null) { module.shutdown(configctx); } } } configctx.cleanupContexts(); /*Shut down the services*/ for (Iterator services = configctx.getAxisConfiguration().getServices().values().iterator(); services.hasNext();) { AxisService axisService = (AxisService) services.next(); ServiceLifeCycle serviceLifeCycle = axisService.getServiceLifeCycle(); if (serviceLifeCycle != null) { serviceLifeCycle.shutDown(configctx, axisService); } } stopped = true; } /** * @param trsIn : Transport in description (which contains Transport Listener) * @param started : whether transport Listener running or not * @throws AxisFault : will throw AxisFault if something goes wrong */ public synchronized void addListener(TransportInDescription trsIn, boolean started) throws AxisFault { configctx.getAxisConfiguration().addTransportIn(trsIn); TransportListener transportListener = trsIn.getReceiver(); if (transportListener != null) { if (!started) { transportListener.init(configctx, trsIn); transportListener.start(); } startedTransports.put(trsIn.getName(), transportListener); } } public synchronized boolean isListenerRunning(String transportName) { return startedTransports.get(transportName) != null; } public boolean isStopped() { return stopped; } public void destroy() throws AxisFault { stop(); this.configctx.setTransportManager(null); for (Iterator iter = startedTransports.values().iterator(); iter.hasNext();) { TransportListener transportListener = (TransportListener) iter.next(); transportListener.destroy(); } this.startedTransports.clear(); this.configctx = null; defaultConfigurationContext = null; } static class ListenerManagerShutdownThread extends Thread { ListenerManager listenerManager; public ListenerManagerShutdownThread(ListenerManager listenerManager) { super(); this.listenerManager = listenerManager; } public void run() { try { if (!listenerManager.stopped) { listenerManager.stop(); } } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } } } } ./src/org/apache/axis2/engine/Phase.java0000664000175000017500000003575611767656530017222 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.PhaseRule; import org.apache.axis2.phaseresolver.PhaseException; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Iterator; import java.util.List; /** * A Phase is an ordered collection of Handlers. */ public class Phase implements Handler { public static final String ALL_PHASES = "*"; /** * Field log */ private static final Log log = LogFactory.getLog(Phase.class); /** * Field handlers */ private List handlers; /** * A handler has been marked as present in both the first phase and the last phase */ private boolean isOneHandler; /** * Field phaseName */ private String phaseName; /** * Field phaseFirstSet */ private boolean phaseFirstSet; /** * Field phaseLastSet */ private boolean phaseLastSet; /** * Default constructor */ public Phase() { this(null); } /** * Create a named Phase * * @param phaseName the name for this Phase */ public Phase(String phaseName) { handlers = new CopyOnWriteArrayList(); this.phaseName = phaseName; } /** * Add a handler to the Phase. * * @param handler the Handler to add */ public void addHandler(Handler handler) { log.debug("Handler " + handler.getName() + " added to Phase " + phaseName); if (phaseLastSet) { // handlers.size() can not be 0 , since when setting phase last it is always > 0 if (handlers.size() == 1) { handlers.add(0, handler); } else { handlers.add(handlers.size() - 2, handler); } } else { handlers.add(handler); } } /** * Add a HandlerDescription to the Phase * * @param handlerDesc the HandlerDescription to add * @throws PhaseException if there is a problem */ public void addHandler(HandlerDescription handlerDesc) throws PhaseException { Iterator handlers_itr = getHandlers().iterator(); while (handlers_itr.hasNext()) { Handler hand = (Handler) handlers_itr.next(); HandlerDescription thisDesc = hand.getHandlerDesc(); if (handlerDesc.getName().equals(thisDesc.getName())) { return; } } if (isOneHandler) { throw new PhaseException("Phase '" + this.getPhaseName() + "' can only have one handler, since there is a " + "handler with both phaseFirst and phaseLast true "); } if (handlerDesc.getRules().isPhaseFirst() && handlerDesc.getRules().isPhaseLast()) { if (!handlers.isEmpty()) { throw new PhaseException(this.getPhaseName() + " already contains Handlers, and " + handlerDesc.getName() + " cannot therefore be both phaseFirst and phaseLast."); } else { handlers.add(handlerDesc.getHandler()); isOneHandler = true; } } else if (handlerDesc.getRules().isPhaseFirst()) { setPhaseFirst(handlerDesc.getHandler()); } else if (handlerDesc.getRules().isPhaseLast()) { setPhaseLast(handlerDesc.getHandler()); } else { insertHandler(handlerDesc); } } /** * Add a Handler at a particular index within the Phase. * * If we have a Phase with (H1, H2), calling addHandler(H3, 1) will result in (H1, H3, H2) * * @param handler the Handler to add * @param index the position in the Phase at which to place the Handler */ public void addHandler(Handler handler, int index) { if (log.isDebugEnabled()) { log.debug("Handler " + handler.getName() + " inserted at position " + index + " of Phase " + phaseName); } handlers.add(index, handler); } /** * Confirm that all post-conditions of this Phase are met. After all Handlers in a * Phase are invoke()d, this method will be called. Subclasses should override it in order * to confirm that the purpose of the given Phase has been acheived. * * @param msgContext the active MessageContext * @throws AxisFault if a post-condition has not been met, or other problems occur */ public void checkPostConditions(MessageContext msgContext) throws AxisFault { // Default version does nothing } /** * Check the preconditions for a Phase. This method will be called when the Phase is * invoked, BEFORE any Handlers are invoked. Subclasses should override it in order * to confirm that necessary preconditions are met before the Phase does its work. They * should throw an appropriate AxisFault if not. * * @param msgContext the active MessageContext * @throws AxisFault if a precondition is not met, or in case of other problem */ public void checkPreconditions(MessageContext msgContext) throws AxisFault { // Default version does nothing } public void cleanup() { // Default version does nothing } public void init(HandlerDescription handlerdesc) { // Default version does nothing } private void insertHandler(HandlerDescription handlerDesc) throws PhaseException { Handler handler = handlerDesc.getHandler(); PhaseRule rules = handler.getHandlerDesc().getRules(); String beforeName = rules.getBefore(); String afterName = rules.getAfter(); // If we don't care where it goes, tack it on at the end if (beforeName == null && afterName == null) { addHandler(handler); return; } // Otherwise walk the list and find the right place to put it int beforeIndex = -1, afterIndex = -1; for (int i = 0; i < handlers.size(); i++) { Handler tempHandler = (Handler) handlers.get(i); if ((beforeName != null) && (beforeIndex == -1)) { if (tempHandler.getName().equals(beforeName)) { // Found the "before" handler beforeIndex = i; } } if ((afterName != null) && (afterIndex == -1)) { if (tempHandler.getName().equals(afterName)) { // Found the "after" handler afterIndex = i; } } } if ((beforeIndex > -1) && (afterIndex >= beforeIndex)) { throw new PhaseException("Can't insert handler because " + beforeName + " is before " + afterName + " in Phase '" + phaseName + "'"); } if (phaseFirstSet && beforeIndex == 0) { throw new PhaseException("Can't insert handler before handler '" + beforeName + "', which is marked phaseFirst"); } if (phaseLastSet && afterIndex == (handlers.size() - 1)) { throw new PhaseException("Can't insert handler after handler '" + afterName + "', which is marked phaseLast"); } if (beforeIndex > -1) { handlers.add(beforeIndex, handler); } else if (afterIndex > -1){ if (phaseLastSet){ if (handlers.size() ==1){ handlers.add(0,handler); } else { handlers.add(handlers.size() -2,handler); } } else { if (afterIndex == (handlers.size() -1)) { handlers.add(handler); } else { handlers.add(afterIndex +1,handler); } } } else { if (phaseLastSet) { if (handlers.size() ==1){ handlers.add(0,handler); } else { handlers.add(handlers.size() -2,handler); } } else { handlers.add(handler); } } } /** * Invoke all the handlers in this Phase * * @param msgctx the current MessageContext * @return An InvocationResponse that indicates what * the next step in the message processing should be. * @throws org.apache.axis2.AxisFault */ public final InvocationResponse invoke(MessageContext msgctx) throws AxisFault { boolean isDebugEnabled = LoggingControl.debugLoggingAllowed && log.isDebugEnabled(); if (isDebugEnabled) { log.debug(msgctx.getLogIDString() + " Checking pre-condition for Phase \"" + phaseName + "\""); } InvocationResponse pi = InvocationResponse.CONTINUE; int currentIndex = msgctx.getCurrentPhaseIndex(); if (currentIndex == 0) { checkPreconditions(msgctx); } if (isDebugEnabled) { log.debug(msgctx.getLogIDString() + " Invoking phase \"" + phaseName + "\""); } int handlersSize = handlers.size(); while (currentIndex < handlersSize) { Handler handler = (Handler) handlers.get(currentIndex); if (isDebugEnabled) { log.debug(msgctx.getLogIDString() + " Invoking Handler '" + handler.getName() + "' in Phase '" + phaseName + "'"); } pi = handler.invoke(msgctx); if (!pi.equals(InvocationResponse.CONTINUE)) { return pi; } currentIndex++; msgctx.setCurrentPhaseIndex(currentIndex); } if (isDebugEnabled) { log.debug(msgctx.getLogIDString() + " Checking post-conditions for phase \"" + phaseName + "\""); } msgctx.setCurrentPhaseIndex(0); checkPostConditions(msgctx); return pi; } public void flowComplete(MessageContext msgContext) { boolean isDebugEnabled = LoggingControl.debugLoggingAllowed && log.isDebugEnabled(); if (isDebugEnabled) { log.debug(msgContext.getLogIDString() + " Invoking flowComplete() in Phase \"" + phaseName + "\""); } // This will be non-zero if we failed during execution of one of the // handlers in this phase int currentHandlerIndex = msgContext.getCurrentPhaseIndex(); if (currentHandlerIndex == 0) { currentHandlerIndex = handlers.size(); } else { /*We need to set it to 0 so that any previous phases will execute all * of their handlers.*/ msgContext.setCurrentPhaseIndex(0); } for (; currentHandlerIndex > 0; currentHandlerIndex--) { Handler handler = (Handler) handlers.get(currentHandlerIndex - 1); if (isDebugEnabled) { log.debug(msgContext.getLogIDString() + " Invoking flowComplete() for Handler '" + handler.getName() + "' in Phase '" + phaseName + "'"); } handler.flowComplete(msgContext); } } public String toString() { return this.getPhaseName(); } public int getHandlerCount() { return handlers.size(); } public HandlerDescription getHandlerDesc() { return null; } /** * Gets all the handlers in the phase. * * @return Returns an ArrayList of Handlers */ public List getHandlers() { return handlers; } public String getName() { return phaseName; } public Parameter getParameter(String name) { return null; } /** * @return Returns the name. */ public String getPhaseName() { return phaseName; } public void setName(String phaseName) { this.phaseName = phaseName; } /** * Add a Handler to the Phase in the very first position, and ensure no other Handler * will come before it. * * @param handler the Handler to add * @throws PhaseException if another Handler is already set as phaseFirst */ public void setPhaseFirst(Handler handler) throws PhaseException { if (phaseFirstSet) { throw new PhaseException("PhaseFirst has been set already, cannot have two" + " phaseFirst Handlers for Phase '" + this.getPhaseName() + "'"); } handlers.add(0, handler); phaseFirstSet = true; } /** * Add a Handler to the Phase in the very last position, and ensure no other Handler * will come after it. * * @param handler the Handler to add * @throws PhaseException if another Handler is already set as phaseLast */ public void setPhaseLast(Handler handler) throws PhaseException { if (phaseLastSet) { throw new PhaseException("PhaseLast already has been set," + " cannot have two PhaseLast Handler for same phase " + this.getPhaseName()); } handlers.add(handler); phaseLastSet = true; } /** * Remove a given Handler from a phase using a HandlerDescription * * @param handlerDesc the HandlerDescription to remove */ public void removeHandler(HandlerDescription handlerDesc) { if (handlers.remove(handlerDesc.getHandler())) { PhaseRule rule = handlerDesc.getRules(); if (rule.isPhaseFirst()) { phaseFirstSet = false; } if (rule.isPhaseLast()) { phaseLastSet = false; } if (rule.isPhaseFirst() && rule.isPhaseLast()) { isOneHandler = false; } log.debug("removed handler " + handlerDesc.getName() + " from the phase " + phaseName); } else { log.debug("unable to remove handler " + handlerDesc.getName() + " from the phase " + phaseName); } } } ./src/org/apache/axis2/engine/DispatchPhase.java0000664000175000017500000003474511767656530020677 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAPHeader; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.context.SessionContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.RequestResponseTransport; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004_Constants; import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2006Constants; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class DispatchPhase extends Phase { public DispatchPhase() { } public DispatchPhase(String phaseName) { super(phaseName); } public void checkPostConditions(MessageContext msgContext) throws AxisFault { EndpointReference toEPR = msgContext.getTo(); if (msgContext.getAxisService() == null) { AxisFault fault = new AxisFault(Messages.getMessage("servicenotfoundforepr", ((toEPR != null) ? toEPR.getAddress() : ""))); fault.setFaultCode(org.apache.axis2.namespace.Constants.FAULT_CLIENT); throw fault; } AxisService service = msgContext.getAxisService(); AxisOperation operation = msgContext.getAxisOperation(); // If we're configured to do so, check the service for a single op... if (operation == null && JavaUtils.isTrue(service.getParameterValue(AxisService.SUPPORT_SINGLE_OP))) { Iterator ops = service.getOperations(); // If there's exactly one, that's the one we want. If there's more, forget it. if (ops.hasNext()) { operation = (AxisOperation)ops.next(); if (ops.hasNext()) { operation = null; } } msgContext.setAxisOperation(operation); } // If we still don't have an operation, fault. if (operation == null) { AxisFault fault = new AxisFault(Messages.getMessage("operationnotfoundforepr", ((toEPR != null) ? toEPR.getAddress() : ""), msgContext.getWSAAction())); fault.setFaultCode(org.apache.axis2.namespace.Constants.FAULT_CLIENT); throw fault; } validateTransport(msgContext); validateBindings(msgContext); loadContexts(service, msgContext); if (msgContext.getOperationContext() == null) { throw new AxisFault(Messages.getMessage("cannotBeNullOperationContext")); } if (msgContext.getServiceContext() == null) { throw new AxisFault(Messages.getMessage("cannotBeNullServiceContext")); } // TODO - review this if ((msgContext.getAxisOperation() == null) && (msgContext.getOperationContext() != null)) { msgContext.setAxisOperation(msgContext.getOperationContext().getAxisOperation()); } if ((msgContext.getAxisService() == null) && (msgContext.getServiceContext() != null)) { msgContext.setAxisService(msgContext.getServiceContext().getAxisService()); } // We should send an early ack to the transport whever possible, but some modules need // to use the backchannel, so we need to check if they have disabled this code. Boolean disableAck = (Boolean) msgContext.getProperty(Constants.Configuration.DISABLE_RESPONSE_ACK); if(disableAck == null || disableAck.booleanValue() == false) { String mepString = msgContext.getAxisOperation().getMessageExchangePattern(); if (isOneway(mepString)) { Object requestResponseTransport = msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL); if (requestResponseTransport != null) { ((RequestResponseTransport) requestResponseTransport).acknowledgeMessage(msgContext); } } else if (mepString.equals(WSDL20_2006Constants.MEP_URI_IN_OUT) || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_OUT) || mepString.equals(WSDL2Constants.MEP_URI_IN_OUT)) { // OR, if 2 way operation but the response is intended to not use the response channel of a 2-way transport // then we don't need to keep the transport waiting. Object requestResponseTransport = msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL); if (requestResponseTransport != null) { if (AddressingHelper.isReplyRedirected(msgContext) && AddressingHelper.isFaultRedirected(msgContext)) { ((RequestResponseTransport) requestResponseTransport).acknowledgeMessage(msgContext); } } } } ArrayList operationChain = msgContext.getAxisOperation().getRemainingPhasesInFlow(); msgContext.setExecutionChain((ArrayList) operationChain.clone()); } private void loadContexts(AxisService service, MessageContext msgContext) throws AxisFault { String scope = service == null ? null : service.getScope(); ServiceContext serviceContext = msgContext.getServiceContext(); if ((msgContext.getOperationContext() != null) && (serviceContext != null)) { msgContext.setServiceGroupContextId( ((ServiceGroupContext)serviceContext.getParent()).getId()); return; } if (Constants.SCOPE_TRANSPORT_SESSION.equals(scope)) { fillContextsFromSessionContext(msgContext); } else if (Constants.SCOPE_SOAP_SESSION.equals(scope)) { extractServiceGroupContextId(msgContext); } AxisOperation axisOperation = msgContext.getAxisOperation(); // if (axisOperation == null) { // return; // } OperationContext operationContext = axisOperation.findForExistingOperationContext(msgContext); if (operationContext != null) { // register operation context and message context // axisOperation.registerOperationContext(msgContext, operationContext); axisOperation.registerMessageContext(msgContext, operationContext); serviceContext = (ServiceContext) operationContext.getParent(); ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceContext.getParent(); msgContext.setServiceContext(serviceContext); msgContext.setServiceGroupContext(serviceGroupContext); msgContext.setServiceGroupContextId(serviceGroupContext.getId()); } else { // 2. if null, create new opCtxt if (serviceContext == null) { // fill the service group context and service context info msgContext.getConfigurationContext(). fillServiceContextAndServiceGroupContext(msgContext); serviceContext = msgContext.getServiceContext(); } operationContext = serviceContext.createOperationContext(axisOperation); axisOperation.registerMessageContext(msgContext, operationContext); } serviceContext.setMyEPR(msgContext.getTo()); } /** * To check wether the incoming request has come in valid transport , simpley the transports * that service author wants to expose * * @param msgctx the current MessageContext * @throws AxisFault in case of error */ private void validateTransport(MessageContext msgctx) throws AxisFault { AxisService service = msgctx.getAxisService(); if (service.isEnableAllTransports()) { return; } else { List trs = service.getExposedTransports(); String incommingTrs = msgctx.getIncomingTransportName(); for (int i = 0; i < trs.size(); i++) { String tr = (String) trs.get(i); if (incommingTrs != null && incommingTrs.equals(tr)) { return; } } } EndpointReference toEPR = msgctx.getTo(); throw new AxisFault(Messages.getMessage("servicenotfoundforepr", ((toEPR != null) ? toEPR.getAddress() : ""))); } /** * To check whether the incoming request has come in valid binding , we check whether service * author has disabled any binding using parameters * org.apache.axis2.Constants.Configuration.DISABLE_REST * @param service msgctx the current MessageContext * @throws AxisFault in case of error */ private void validateBindings(MessageContext msgctx) throws AxisFault { AxisService service = msgctx.getAxisService(); boolean disableREST = false; Parameter disableRESTParameter = service .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST); if (disableRESTParameter != null && JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { disableREST = true; } if (msgctx.isDoingREST() && disableREST) { throw new AxisFault(Messages.getMessage("bindingDisabled","Http")); } } private void fillContextsFromSessionContext(MessageContext msgContext) throws AxisFault { AxisService service = msgContext.getAxisService(); if (service == null) { throw new AxisFault(Messages.getMessage("unabletofindservice")); } SessionContext sessionContext = msgContext.getSessionContext(); if (sessionContext == null) { TransportListener listener = msgContext.getTransportIn().getReceiver(); sessionContext = listener.getSessionContext(msgContext); if (sessionContext == null) { createAndFillContexts(service, msgContext, sessionContext); return; } } String serviceGroupName = msgContext.getAxisServiceGroup().getServiceGroupName(); ServiceGroupContext serviceGroupContext = sessionContext.getServiceGroupContext(serviceGroupName); if (serviceGroupContext != null) { //setting service group context msgContext.setServiceGroupContext(serviceGroupContext); // setting Service context msgContext.setServiceContext(serviceGroupContext.getServiceContext(service)); } else { createAndFillContexts(service, msgContext, sessionContext); } ServiceContext serviceContext = sessionContext.getServiceContext(service); //found the serviceContext from session context , so adding that into msgContext if (serviceContext != null) { msgContext.setServiceContext(serviceContext); serviceContext.setProperty(HTTPConstants.COOKIE_STRING, sessionContext.getCookieID()); } } private void createAndFillContexts(AxisService service, MessageContext msgContext, SessionContext sessionContext) throws AxisFault { ServiceGroupContext serviceGroupContext; AxisServiceGroup axisServiceGroup = service.getAxisServiceGroup(); ConfigurationContext configCtx = msgContext.getConfigurationContext(); serviceGroupContext = configCtx.createServiceGroupContext(axisServiceGroup); msgContext.setServiceGroupContext(serviceGroupContext); ServiceContext serviceContext = serviceGroupContext.getServiceContext(service); msgContext.setServiceContext(serviceContext); if (sessionContext != null) { sessionContext.addServiceContext(serviceContext); sessionContext.addServiceGroupContext(serviceGroupContext); } } private static final QName SERVICE_GROUP_QNAME = new QName(Constants.AXIS2_NAMESPACE_URI, Constants.SERVICE_GROUP_ID, Constants.AXIS2_NAMESPACE_PREFIX); private void extractServiceGroupContextId(MessageContext msgContext) throws AxisFault { SOAPHeader soapHeader = msgContext.getEnvelope().getHeader(); if (soapHeader != null) { OMElement serviceGroupId = soapHeader.getFirstChildWithName(SERVICE_GROUP_QNAME); if (serviceGroupId != null) { msgContext.setServiceGroupContextId(serviceGroupId.getText()); } } } /** * This method will determine if the MEP indicated by 'mepString' specifies * a oneway MEP. */ boolean isOneway(String mepString) { return (mepString.equals(WSDL20_2006Constants.MEP_URI_IN_ONLY) || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY) || mepString.equals(WSDL2Constants.MEP_URI_IN_ONLY)); } } ./src/org/apache/axis2/engine/InstanceDispatcher.java0000664000175000017500000000403111767656530021713 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.handlers.AbstractHandler; /** * By the time the control comes to this handler, the dispatching must have happened * so that the message context contains the AxisServiceGroup, AxisService and * AxisOperation. * This will then try to find the Contexts of ServiceGroup, Service and the Operation. * @deprecated The functionality of this class has moved into the DispatchPhase postconditions */ public class InstanceDispatcher extends AbstractHandler { /** * This doesn't do anything, as the functionality is now in DispatchPhase.checkPostConditions() * The class remains for backwards compatibility of axis2.xml files, but it should go away after * 1.3. * * @param msgContext the MessageContext to process with this Handler. * @return An InvocationResponse that indicates what the next step in the message processing * should be. * @throws org.apache.axis2.AxisFault if the handler encounters an error */ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/engine/AxisObserver.java0000664000175000017500000000256111767656530020562 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.engine; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.ParameterInclude; public interface AxisObserver extends ParameterInclude { // The initilization code will go here void init(AxisConfiguration axisConfig); void serviceUpdate(AxisEvent event, AxisService service); void serviceGroupUpdate(AxisEvent event, AxisServiceGroup serviceGroup); void moduleUpdate(AxisEvent event, AxisModule module); } ./src/org/apache/axis2/util/0000775000175000017500000000000011767656530015007 5ustar brianbrian./src/org/apache/axis2/util/URLProcessor.java0000664000175000017500000001067111767656530020221 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.net.MalformedURLException; import java.util.StringTokenizer; public class URLProcessor { public static final String DEFAULT_PACKAGE = "org.apache.axis2"; /** * Method makePackageName. * * @param namespace * @return Returns String. */ public static String makePackageName(String namespace) { String hostname = null; String path = ""; // get the target namespace of the document try { java.net.URL u = new java.net.URL(namespace); hostname = u.getHost(); path = u.getPath(); } catch (MalformedURLException e) { if (namespace.indexOf(":") > -1) { hostname = namespace.substring(namespace.indexOf(":") + 1); // remove the leading / while (hostname.startsWith("/")) { hostname = hostname.substring(1); } if (hostname.indexOf("/") > -1) { hostname = hostname.substring(0, hostname.indexOf("/")); } } else { hostname = namespace.replace('/','.'); } } // if we didn't file a hostname, bail if (hostname == null || hostname.length() == 0) { return null; } // convert illegal java identifier hostname = hostname.replace('-', '_'); path = path.replace('-', '_'); path = path.replace(':', '_'); // chomp off last forward slash in path, if necessary if ((path.length() > 0) && (path.charAt(path.length() - 1) == '/')) { path = path.substring(0, path.length() - 1); } // tokenize the hostname and reverse it StringTokenizer st = new StringTokenizer(hostname, ".:"); String[] words = new String[st.countTokens()]; for (int i = 0; i < words.length; ++i) { words[i] = st.nextToken(); } StringBuffer sb = new StringBuffer(namespace.length()); for (int i = words.length - 1; i >= 0; --i) { addWordToPackageBuffer(sb, words[i], (i == words.length - 1)); } // tokenize the path StringTokenizer st2 = new StringTokenizer(path, "/"); while (st2.hasMoreTokens()) { addWordToPackageBuffer(sb, st2.nextToken(), false); } return sb.toString().toLowerCase(); } /** * Massages word into a form suitable for use in a Java package name. * Appends it to the target string buffer with a . delimiter if * word is not the first word in the package name. * * @param sb the buffer to append to * @param word the word to append * @param firstWord a flag indicating whether this is the first word */ private static void addWordToPackageBuffer(StringBuffer sb, String word, boolean firstWord) { if (JavaUtils.isJavaKeyword(word)) { word = JavaUtils.makeNonJavaKeyword(word); } // separate with dot after the first word if (!firstWord) { sb.append('.'); } // prefix digits with underscores if (Character.isDigit(word.charAt(0))) { sb.append('_'); } // replace periods with underscores if (word.indexOf('.') != -1) { char[] buf = word.toCharArray(); for (int i = 0; i < word.length(); i++) { if (buf[i] == '.') { buf[i] = '_'; } } word = new String(buf); } sb.append(word); } } ./src/org/apache/axis2/util/threadpool/0000775000175000017500000000000011767656530017150 5ustar brianbrian./src/org/apache/axis2/util/threadpool/ThreadFactory.java0000664000175000017500000000164711767656530022562 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util.threadpool; public interface ThreadFactory { public void execute(java.lang.Runnable runnable); } ./src/org/apache/axis2/util/threadpool/ThreadPool.java0000664000175000017500000001373711767656530022067 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util.threadpool; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.axis2.AxisFault; import org.apache.axis2.i18n.Messages; import org.apache.axis2.java.security.AccessController; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; /** * This the thread pool for axis2. This class will be used a singleton * across axis2 engine. ThreadPool is accepts AxisWorkers which has * run method on them and execute this method, using one of the threads * in the thread pool. */ public class ThreadPool implements ThreadFactory { private static final Log log = LogFactory.getLog(ThreadPool.class); protected static long SLEEP_INTERVAL = 1000; private static boolean shutDown; protected ThreadPoolExecutor executor; //integers that define the pool size, with the default values set. private int corePoolSize = 5; private int maxPoolSize = Integer.MAX_VALUE; public ThreadPool() { setExecutor(createDefaultExecutor("Axis2 Task", Thread.NORM_PRIORITY, true)); } public ThreadPool(int corePoolSize, int maxPoolSize) { this.corePoolSize = corePoolSize; this.maxPoolSize = maxPoolSize; setExecutor(createDefaultExecutor("Axis2 Task", Thread.NORM_PRIORITY, true)); } public Executor getExecutor() { return executor; } public void setExecutor(ThreadPoolExecutor executor) { this.executor = executor; } public void execute(Runnable worker) { if (shutDown) { throw new RuntimeException(Messages.getMessage("threadpoolshutdown")); } executor.execute(worker); } /** * A forceful shutdown mechanism for thread pool. */ public void forceShutDown() { if (log.isDebugEnabled()) { log.debug("forceShutDown called. Thread workers will be stopped"); } executor.shutdownNow(); } /** * This is the recommended shutdown method for the thread pool * This will wait till all the workers that are already handed over to the * thread pool get executed. * * @throws org.apache.axis2.AxisFault */ public void safeShutDown() throws AxisFault { synchronized (this) { shutDown = true; } executor.shutdown(); } protected ThreadPoolExecutor createDefaultExecutor(final String name, final int priority, final boolean daemon) { ThreadPoolExecutor rc; if (maxPoolSize == Integer.MAX_VALUE) { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DefaultThreadFactory(name, daemon, priority)); } else { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DefaultThreadFactory(name, daemon, priority)); } rc.allowCoreThreadTimeOut(true); return rc; } private static class DefaultThreadFactory implements edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory { private final String name; private final boolean daemon; private final int priority; public DefaultThreadFactory(String name, boolean daemon, int priority) { this.name = name; this.daemon = daemon; this.priority = priority; } public Thread newThread( final Runnable runnable) { // do the following section as privileged // so that it will work even when java2 security // has been enabled Thread returnThread = null; try { returnThread = (Thread) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() { Thread newThread = new Thread(runnable, name); newThread.setDaemon(daemon); newThread.setPriority(priority); return newThread; } } ); } catch (PrivilegedActionException e) { // note: inner class can't have its own static log variable if (log.isDebugEnabled()) { log.debug("ThreadPoolExecutor.newThread(): Exception from AccessController [" + e.getClass() .getName() + "] for [" + e.getMessage() + "]", e); } } return returnThread; } } } ./src/org/apache/axis2/util/threadpool/DefaultThreadFactory.java0000664000175000017500000000353711767656530024067 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util.threadpool; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * This is a simple ThreadFactory implementation using java.util.concurrent * Creates threads with the given name prefix */ public class DefaultThreadFactory implements ThreadFactory { final ThreadGroup group; final AtomicInteger count; final String namePrefix; public DefaultThreadFactory(final ThreadGroup group, final String namePrefix) { super(); this.count = new AtomicInteger(1); this.group = group; this.namePrefix = namePrefix; } public Thread newThread(final Runnable runnable) { StringBuffer buffer = new StringBuffer(); buffer.append(this.namePrefix); buffer.append('-'); buffer.append(this.count.getAndIncrement()); Thread t = new Thread(group, runnable, buffer.toString(), 0); t.setDaemon(false); t.setPriority(Thread.NORM_PRIORITY); return t; } } ./src/org/apache/axis2/util/UUIDGenerator.java0000664000175000017500000000165011767656530020271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * @deprecated */ public class UUIDGenerator extends org.apache.axiom.om.util.UUIDGenerator { } ./src/org/apache/axis2/util/ArrayStack.java0000664000175000017500000001366311767656530017727 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.util.ArrayList; import java.util.EmptyStackException; /** * An implementation of the {@link java.util.Stack} API that is based on an ArrayList * instead of a Vector, so it is not synchronized to protect against multi-threaded * access. The implementation is therefore operates faster in environments where you do not need to * worry about multiple thread contention. *

        * The removal order of an ArrayStack is based on insertion order: The most recently * added element is removed first. The iteration order is not the same as the removal order. * The iterator returns elements from the bottom up, whereas the {@link #remove()} method removes * them from the top down. *

        * Unlike Stack, ArrayStack accepts null entries. */ public class ArrayStack extends ArrayList { /** Ensure serialization compatibility */ private static final long serialVersionUID = 2130079159931574599L; /** * Constructs a new empty ArrayStack. The initial size is controlled by * ArrayList and is currently 10. */ public ArrayStack() { super(); } /** * Constructs a new empty ArrayStack with an initial size. * * @param initialSize the initial size to use * @throws IllegalArgumentException if the specified initial size is negative */ public ArrayStack(int initialSize) { super(initialSize); } /** * Return true if this stack is currently empty. *

        * This method exists for compatibility with java.util.Stack. New users of this * class should use isEmpty instead. * * @return true if the stack is currently empty */ public boolean empty() { return isEmpty(); } /** * Returns the top item off of this stack without removing it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public Object peek() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); } else { return get(n - 1); } } /** * Returns the n'th item down (zero-relative) from the top of this stack without removing it. * * @param n the number of items down to go * @return the n'th item on the stack, zero relative * @throws EmptyStackException if there are not enough items on the stack to satisfy this * request */ public Object peek(int n) throws EmptyStackException { int m = (size() - n) - 1; if (m < 0) { throw new EmptyStackException(); } else { return get(m); } } /** * Pops the top item off of this stack and return it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public Object pop() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); } else { return remove(n - 1); } } /** * Pushes a new item onto the top of this stack. The pushed item is also returned. This is * equivalent to calling add. * * @param item the item to be added * @return the item just pushed */ public Object push(Object item) { add(item); return item; } /** * Returns the one-based position of the distance from the top that the specified object exists * on this stack, where the top-most element is considered to be at distance 1. If * the object is not present on the stack, return -1 instead. The * equals() method is used to compare to the items in this stack. * * @param object the object to be searched for * @return the 1-based depth into the stack of the object, or -1 if not found */ public int search(Object object) { int i = size() - 1; // Current index int n = 1; // Current distance while (i >= 0) { Object current = get(i); if ((object == null && current == null) || (object != null && object.equals(current))) { return n; } i--; n++; } return -1; } /** * Returns the element on the top of the stack. * * @return the element on the top of the stack * @throws EmptyStackException if the stack is empty */ public Object get() { int size = size(); if (size == 0) { throw new EmptyStackException(); } return get(size - 1); } /** * Removes the element on the top of the stack. * * @return the removed element * @throws EmptyStackException if the stack is empty */ public Object remove() { int size = size(); if (size == 0) { throw new EmptyStackException(); } return remove(size - 1); } } ./src/org/apache/axis2/util/JavaUtils.java0000664000175000017500000004634611767656530017571 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.text.Collator; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; /** * JavaUtils */ public class JavaUtils { /** * These are java keywords as specified at the following URL (sorted alphabetically). * http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#229308 * Note that false, true, and null are not strictly keywords; they are literal values, * but for the purposes of this array, they can be treated as literals. * ****** PLEASE KEEP THIS LIST SORTED IN ASCENDING ORDER ****** */ static final String keywords[] = { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while" }; /** * Collator for comparing the strings */ static final Collator englishCollator = Collator.getInstance(Locale.ENGLISH); /** * Use this character as suffix */ static final char keywordPrefix = '_'; /** * Is this an XML punctuation character? */ private static boolean isPunctuation(char c) { return '-' == c || '.' == c || ':' == c || '\u00B7' == c || '\u0387' == c || '-' == c || '\u06DD' == c || '\u06DE' == c; } // isPunctuation /** * Checks if the input string is a valid java keyword. * * @return Returns boolean. */ public static boolean isJavaKeyword(String keyword) { // None of the java keywords have uppercase characters if (hasUpperCase(keyword)) { return false; } return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0); } /** * Check if the word has any uppercase letters * * @param word * @return */ public static boolean hasUpperCase(String word) { if (word == null) { return false; } int len = word.length(); for (int i = 0; i < len; i++) { if (Character.isUpperCase(word.charAt(i))) { return true; } } return false; } /** * Turns a java keyword string into a non-Java keyword string. (Right now * this simply means appending an underscore.) */ public static String makeNonJavaKeyword(String keyword) { return keywordPrefix + keyword; } public static String xmlNameToJava(String name) { // protect ourselves from garbage if (name == null || name.length() == 0) { return name; } char[] nameArray = name.toCharArray(); int nameLen = name.length(); StringBuffer result = new StringBuffer(nameLen); boolean wordStart = false; // The mapping indicates to convert first character. int i = 0; while (i < nameLen && (isPunctuation(nameArray[i]) || !Character.isJavaIdentifierStart(nameArray[i]))) { i++; } if (i < nameLen) { // Decapitalization code used to be here, but we use the // Introspector function now after we filter out all bad chars. result.append(nameArray[i]); //wordStart = !Character.isLetter(nameArray[i]); wordStart = !Character.isLetter(nameArray[i]) && nameArray[i] != "_".charAt(0); } else { // The identifier cannot be mapped strictly according to // JSR 101 if (Character.isJavaIdentifierPart(nameArray[0])) { result.append("_").append(nameArray[0]); } else { // The XML identifier does not contain any characters // we can map to Java. Using the length of the string // will make it somewhat unique. result.append("_").append(nameArray.length); } } // The mapping indicates to skip over // all characters that are not letters or // digits. The first letter/digit // following a skipped character is // upper-cased. for (++i; i < nameLen; ++i) { char c = nameArray[i]; // if this is a bad char, skip it and remember to capitalize next // good character we encounter if (isPunctuation(c) || !Character.isJavaIdentifierPart(c)) { wordStart = true; continue; } if (wordStart && Character.isLowerCase(c)) { result.append(Character.toUpperCase(c)); } else { result.append(c); } // If c is not a character, but is a legal Java // identifier character, capitalize the next character. // For example: "22hi" becomes "22Hi" //wordStart = !Character.isLetter(c); wordStart = !Character.isLetter(c) && c != "_".charAt(0); } // covert back to a String String newName = result.toString(); // check for Java keywords if (isJavaKeyword(newName)) { newName = makeNonJavaKeyword(newName); } return newName; } // xmlNameToJava /** * Capitalizes the first character of the name. * * @param name * @return Returns String. */ public static String capitalizeFirstChar(String name) { if ((name == null) || name.length() == 0) { return name; } char start = name.charAt(0); if (Character.isLowerCase(start)) { start = Character.toUpperCase(start); return start + name.substring(1); } return name; } // capitalizeFirstChar /** * converts an xml name to a java identifier * * @param name * @return java identifier */ public static String xmlNameToJavaIdentifier(String name) { String javaName = xmlNameToJava(name); // convert the first letter to lowercase if ((javaName != null) && (javaName.length() > 0)) { javaName = javaName.substring(0, 1).toLowerCase() + javaName.substring(1); } return javaName; } /** * Tests the String 'value': * return 'false' if its 'false', '0', or 'no' - else 'true' *

        * Follow in 'C' tradition of boolean values: * false is specific (0), everything else is true; */ public static boolean isTrue(String value) { return !isFalseExplicitly(value); } /** * Tests the String 'value': * return 'true' if its 'true', '1', or 'yes' - else 'false' */ public static boolean isTrueExplicitly(String value) { return value != null && (value.equalsIgnoreCase("true") || value.equals("1") || value.equalsIgnoreCase("yes")); } /** * Tests the Object 'value': * if its null, return default. * if its a Boolean, return booleanValue() * if its an Integer, return 'false' if its '0' else 'true' * if its a String, return isTrueExplicitly((String)value). * All other types return 'true' */ public static boolean isTrueExplicitly(Object value, boolean defaultVal) { if (value == null) { return defaultVal; } if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } if (value instanceof Integer) { return ((Integer) value).intValue() != 0; } if (value instanceof String) { return isTrueExplicitly((String) value); } return true; } public static boolean isTrueExplicitly(Object value) { return isTrueExplicitly(value, false); } /** * Tests the Object 'value': * if its null, return default. * if its a Boolean, return booleanValue() * if its an Integer, return 'false' if its '0' else 'true' * if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' * All other types return 'true' */ public static boolean isTrue(Object value, boolean defaultVal) { return !isFalseExplicitly(value, !defaultVal); } public static boolean isTrue(Object value) { return isTrue(value, false); } /** * Tests the String 'value': * return 'true' if its 'false', '0', or 'no' - else 'false' *

        * Follow in 'C' tradition of boolean values: * false is specific (0), everything else is true; */ public static boolean isFalse(String value) { return isFalseExplicitly(value); } /** * Tests the String 'value': * return 'true' if its null, 'false', '0', or 'no' - else 'false' */ public static boolean isFalseExplicitly(String value) { return value == null || value.equalsIgnoreCase("false") || value.equals("0") || value.equalsIgnoreCase("no"); } /** * Tests the Object 'value': * if its null, return default. * if its a Boolean, return !booleanValue() * if its an Integer, return 'true' if its '0' else 'false' * if its a String, return isFalseExplicitly((String)value). * All other types return 'false' */ public static boolean isFalseExplicitly(Object value, boolean defaultVal) { if (value == null) { return defaultVal; } if (value instanceof Boolean) { return !((Boolean) value).booleanValue(); } if (value instanceof Integer) { return ((Integer) value).intValue() == 0; } if (value instanceof String) { return isFalseExplicitly((String) value); } return false; } public static boolean isFalseExplicitly(Object value) { return isFalseExplicitly(value, true); } /** * Tests the Object 'value': * if its null, return default. * if its a Boolean, return booleanValue() * if its an Integer, return 'false' if its '0' else 'true' * if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' * All other types return 'true' */ public static boolean isFalse(Object value, boolean defaultVal) { return isFalseExplicitly(value, defaultVal); } public static boolean isFalse(Object value) { return isFalse(value, true); } public static boolean isJavaId(String id) { if (id == null || id.length() == 0 || isJavaKeyword(id)) { return false; } if (!Character.isJavaIdentifierStart(id.charAt(0))) { return false; } for (int i = 1; i < id.length(); i++) { if (!Character.isJavaIdentifierPart(id.charAt(i))) { return false; } } return true; } /** * An empty immutable String array. */ public static final String[] EMPTY_STRING_ARRAY = new String[0]; /** *

        Splits the provided text into an array, separator specified. * This is an alternative to using StringTokenizer.

        *

        *

        The separator is not included in the returned String array. * Adjacent separators are treated as one separator.

        *

        *

        A null input String returns null.

        *

        *

             * StringUtils.split(null, *)         = null
             * StringUtils.split("", *)           = []
             * StringUtils.split("a.b.c", '.')    = ["a", "b", "c"]
             * StringUtils.split("a..b.c", '.')   = ["a", "b", "c"]
             * StringUtils.split("a:b:c", '.')    = ["a:b:c"]
             * StringUtils.split("a\tb\nc", null) = ["a", "b", "c"]
             * StringUtils.split("a b c", ' ')    = ["a", "b", "c"]
             * 
        * * @param str the String to parse, may be null * @param separatorChar the character used as the delimiter, * null splits on whitespace * @return an array of parsed Strings, null if null String input */ public static String[] split(String str, char separatorChar) { if (str == null) { return null; } int len = str.length(); if (len == 0) { return EMPTY_STRING_ARRAY; } List list = new ArrayList(); int i = 0, start = 0; boolean match = false; while (i < len) { if (str.charAt(i) == separatorChar) { if (match) { list.add(str.substring(start, i)); match = false; } start = ++i; continue; } match = true; i++; } if (match) { list.add(str.substring(start, i)); } return (String[]) list.toArray(new String[list.size()]); } public static Class getWrapperClass(Class primitive) { if (primitive == int.class) { return java.lang.Integer.class; } else if (primitive == short.class) { return java.lang.Short.class; } else if (primitive == boolean.class) { return java.lang.Boolean.class; } else if (primitive == byte.class) { return java.lang.Byte.class; } else if (primitive == long.class) { return java.lang.Long.class; } else if (primitive == double.class) { return java.lang.Double.class; } else if (primitive == float.class) { return java.lang.Float.class; } else if (primitive == char.class) { return java.lang.Character.class; } return null; } public static Class getWrapperClass(String primitive) { if (primitive.equals("int")) { return java.lang.Integer.class; } else if (primitive.equals("short")) { return java.lang.Short.class; } else if (primitive.equals("boolean")) { return java.lang.Boolean.class; } else if (primitive.equals("byte")) { return java.lang.Byte.class; } else if (primitive.equals("long")) { return java.lang.Long.class; } else if (primitive.equals("double")) { return java.lang.Double.class; } else if (primitive.equals("float")) { return java.lang.Float.class; } else if (primitive.equals("char")) { return java.lang.Character.class; } return null; } /** * Scans the parameter string for the parameter search ignoring case when * comparing characters. * * @param string * @param search If test is empty -1 is always returned. * @return -1 if the string was not found or the index of the first matching * character */ public static int indexOfIgnoreCase(final String string, final String search) { int index = -1; final int stringLength = string.length(); final int testLength = search.length(); if (stringLength > 1 || testLength > 1) { final char firstCharOfTest = Character.toLowerCase(search.charAt(0)); final int lastStringCharacterToCheck = stringLength - testLength + 1; for (int i = 0; i < lastStringCharacterToCheck; i++) { if (firstCharOfTest == Character.toLowerCase(string.charAt(i))) { index = i; for (int j = 1; j < testLength; j++) { final char c = string.charAt(i + j); final char otherChar = search.charAt(j); if (Character.toLowerCase(c) != Character.toLowerCase(otherChar)) { index = -1; break; } } if (-1 != index) { break; } } } } return index; } /** * replace: Like String.replace except that the old new items are strings. * * @param name string * @param oldT old text to replace * @param newT new text to use * @return replacement string */ public static final String replace(String name, String oldT, String newT) { if (name == null) return ""; // Create a string buffer that is twice initial length. // This is a good starting point. StringBuffer sb = new StringBuffer(name.length() * 2); int len = oldT.length(); try { int start = 0; int i = name.indexOf(oldT, start); while (i >= 0) { sb.append(name.substring(start, i)); sb.append(newT); start = i + len; i = name.indexOf(oldT, start); } if (start < name.length()) sb.append(name.substring(start)); } catch (NullPointerException e) { // No FFDC code needed } return new String(sb); } /** * Get a string containing the stack of the current location. * Note This utility is useful in debug scenarios to dump out * the call stack. * * @return String */ public static String callStackToString() { return stackToString(new RuntimeException()); } /** * Get a string containing the stack of the specified exception * * @param e * @return */ public static String stackToString(Throwable e) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); // Jump past the throwable text = text.substring(text.indexOf("at")); text = replace(text, "at ", "DEBUG_FRAME = "); return text; } } ./src/org/apache/axis2/util/StreamWrapper.java0000664000175000017500000002632411767656530020455 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class StreamWrapper implements XMLStreamReader { private static final int STATE_SWITCHED = 0; private static final int STATE_INIT = 1; private static final int STATE_SWITCH_AT_NEXT = 2; private static final int STATE_COMPLETE_AT_NEXT = 3; private static final int STATE_COMPLETED = 4; private XMLStreamReader realReader = null; private int state = STATE_INIT; private int prevState = state; public StreamWrapper(XMLStreamReader realReader) { if (realReader == null) { throw new UnsupportedOperationException("Reader cannot be null"); } this.realReader = realReader; } public void close() throws XMLStreamException { if (state != STATE_INIT) { realReader.close(); } else { throw new XMLStreamException(); } } public int next() throws XMLStreamException { prevState = state; int returnEvent = -1; switch (state) { case STATE_INIT: if (realReader.getEventType() == START_DOCUMENT) { state = STATE_SWITCHED; returnEvent = realReader.next(); } else { state = STATE_SWITCHED; returnEvent = realReader.getEventType(); } break; case STATE_SWITCHED: returnEvent = realReader.next(); if (returnEvent == END_DOCUMENT) { state = STATE_COMPLETED; } else if (!realReader.hasNext()) { state = STATE_COMPLETE_AT_NEXT; } break; // case STATE_SWITCH_AT_NEXT: // state = STATE_SWITCHED; // returnEvent = realReader.getEventType(); // break; case STATE_COMPLETE_AT_NEXT: state = STATE_COMPLETED; returnEvent = END_DOCUMENT; break; case STATE_COMPLETED: //oops - no way we can go beyond this throw new XMLStreamException("end reached!"); default: throw new UnsupportedOperationException(); } return returnEvent; } public int nextTag() throws XMLStreamException { if (prevState != STATE_INIT) { return realReader.nextTag(); } else { throw new XMLStreamException(); } } public void require(int i, String s, String s1) throws XMLStreamException { if (state != STATE_INIT) { realReader.require(i, s, s1); } } public boolean standaloneSet() { if (state != STATE_INIT) { return realReader.standaloneSet(); } else { return false; } } public int getAttributeCount() { if (state != STATE_INIT) { return realReader.getAttributeCount(); } else { return 0; } } public String getAttributeLocalName(int i) { if (state != STATE_INIT) { return realReader.getAttributeLocalName(i); } else { return null; } } public QName getAttributeName(int i) { if (state != STATE_INIT) { return realReader.getAttributeName(i); } else { return null; } } public String getAttributeNamespace(int i) { if (state != STATE_INIT) { return realReader.getAttributeNamespace(i); } else { return null; } } public String getAttributePrefix(int i) { if (state != STATE_INIT) { return realReader.getAttributePrefix(i); } else { return null; } } public String getAttributeType(int i) { if (state != STATE_INIT) { return realReader.getAttributeType(i); } else { return null; } } public String getAttributeValue(int i) { if (state != STATE_INIT) { return realReader.getAttributeValue(i); } else { return null; } } public String getAttributeValue(String s, String s1) { if (state != STATE_INIT) { return realReader.getAttributeValue(s, s1); } else { return null; } } public String getCharacterEncodingScheme() { if (state != STATE_INIT) { return realReader.getCharacterEncodingScheme(); } else { return null; } } public String getElementText() throws XMLStreamException { if (state != STATE_INIT) { return realReader.getElementText(); } else { throw new XMLStreamException(); } } public String getEncoding() { if (state != STATE_INIT) { return realReader.getEncoding(); } else { return null; } } public int getEventType() { if (state == STATE_INIT) { return START_DOCUMENT; } else { return realReader.getEventType(); } } public String getLocalName() { if (state != STATE_INIT) { return realReader.getLocalName(); } else { return null; } } public Location getLocation() { if (state != STATE_INIT) { return realReader.getLocation(); } else { return null; } } public QName getName() { if (state != STATE_INIT) { return realReader.getName(); } else { return null; } } public NamespaceContext getNamespaceContext() { if (state != STATE_INIT) { return realReader.getNamespaceContext(); } else { return null; } } public int getNamespaceCount() { if (state != STATE_INIT) { return realReader.getNamespaceCount(); } else { return 0; } } public String getNamespacePrefix(int i) { if (state != STATE_INIT) { return realReader.getNamespacePrefix(i); } else { return null; } } public String getNamespaceURI() { if (state != STATE_INIT) { return realReader.getNamespaceURI(); } else { return null; } } public String getNamespaceURI(int i) { if (state != STATE_INIT) { return realReader.getNamespaceURI(i); } else { return null; } } public String getNamespaceURI(String s) { if (state != STATE_INIT) { return realReader.getNamespaceURI(s); } else { return null; } } public String getPIData() { if (state != STATE_INIT) { return realReader.getPIData(); } else { return null; } } public String getPITarget() { if (state != STATE_INIT) { return realReader.getPITarget(); } else { return null; } } public String getPrefix() { if (state != STATE_INIT) { return realReader.getPrefix(); } else { return null; } } public Object getProperty(String s) throws IllegalArgumentException { if (state != STATE_INIT) { return realReader.getProperty(s); } else { throw new IllegalArgumentException(); } } public String getText() { if (state != STATE_INIT) { return realReader.getText(); } else { return null; } } public char[] getTextCharacters() { if (state != STATE_INIT) { return realReader.getTextCharacters(); } else { return new char[0]; } } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { if (state != STATE_INIT) { return realReader.getTextCharacters(i, chars, i1, i2); } else { return 0; } } public int getTextLength() { if (state != STATE_INIT) { return realReader.getTextLength(); } else { return 0; } } public int getTextStart() { if (state != STATE_INIT) { return realReader.getTextStart(); } else { return 0; } } public String getVersion() { if (state != STATE_INIT) { return realReader.getVersion(); } else { return null; } } public boolean hasName() { if (state != STATE_INIT) { return realReader.hasName(); } else { return false; } } public boolean hasNext() throws XMLStreamException { if (state == STATE_COMPLETE_AT_NEXT) { return true; } else if (state == STATE_COMPLETED) { return false; } else if (state != STATE_INIT) { return realReader.hasNext(); } else { return true; } } public boolean hasText() { if (state != STATE_INIT) { return realReader.hasText(); } else { return false; } } public boolean isAttributeSpecified(int i) { if (state != STATE_INIT) { return realReader.isAttributeSpecified(i); } else { return false; } } public boolean isCharacters() { if (state != STATE_INIT) { return realReader.isCharacters(); } else { return false; } } public boolean isEndElement() { if (state != STATE_INIT) { return realReader.isEndElement(); } else { return false; } } public boolean isStandalone() { if (state != STATE_INIT) { return realReader.isStandalone(); } else { return false; } } public boolean isStartElement() { if (state != STATE_INIT) { return realReader.isStartElement(); } else { return false; } } public boolean isWhiteSpace() { if (state != STATE_INIT) { return realReader.isWhiteSpace(); } else { return false; } } } ./src/org/apache/axis2/util/PrettyPrinter.java0000664000175000017500000001046211767656530020510 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Properties; /** * Tidies up the java source code using Jalopy. * This is used by both ADB and Codegen hence needs to be in the * commons rather than a specific module */ public class PrettyPrinter { private static final Log log = LogFactory.getLog(PrettyPrinter.class); /** * Pretty prints contents of the java source file. * * @param file */ public static void prettify(File file) { // If the user has set "axis2.jalopy=false" on the system property, // then just return back to caller String property = System.getProperty("axis2.jalopy"); if((property == null) || !JavaUtils.isTrueExplicitly(property)){ return; } PrintStream backupOutputStream = System.out; PrintStream backupErrorStream = System.err; System.setOut(new PrintStream(new ByteArrayOutputStream())); System.setErr(new PrintStream(new ByteArrayOutputStream())); try { Class clazzConfigurator = Loader.loadClass("org.apache.log4j.PropertyConfigurator"); Method configure = clazzConfigurator.getMethod("configure", new Class[]{Properties.class}); Properties properties = new Properties(); properties.setProperty("log4j.logger.de.hunsicker.jalopy.io", System.getProperty("log4j.logger.de.hunsicker.jalopy.io", "FATAL")); configure.invoke(null, new Object[]{properties}); // Create an instance of the Jalopy bean Class clazz = Loader.loadClass("de.hunsicker.jalopy.Jalopy"); Object prettifier = clazz.newInstance(); // Set the input file Method input = clazz.getMethod("setInput", new Class[]{File.class}); input.invoke(prettifier, new Object[]{file}); // Set the output file Method output = clazz.getMethod("setOutput", new Class[]{File.class}); output.invoke(prettifier, new Object[]{file}); Class clazz2 = Loader.loadClass("de.hunsicker.jalopy.storage.Convention"); Method instance = clazz2.getMethod("getInstance", new Class[]{}); Object settings = instance.invoke(null, new Object[]{}); Class clazz3 = Loader.loadClass("de.hunsicker.jalopy.storage.ConventionKeys"); Field field = clazz3.getField("COMMENT_FORMAT_MULTI_LINE"); Object key = field.get(null); Method put = clazz2.getMethod("put", new Class[]{key.getClass(), String.class}); put.invoke(settings, new Object[]{key, "true"}); // format and overwrite the given input file Method format = clazz.getMethod("format", new Class[]{}); format.invoke(prettifier, new Object[]{}); log.debug("Pretty printed file : " + file); } catch (ClassNotFoundException e) { log.debug("Jalopy/Log4j not found - unable to pretty print " + file); } catch (Exception e) { log.warn("Exception occurred while trying to pretty print file " + file, e); } catch (Throwable t) { log.debug("Exception occurred while trying to pretty print file " + file, t); } finally { System.setOut(backupOutputStream); System.setErr(backupErrorStream); } } } ./src/org/apache/axis2/util/SelfManagedDataHolder.java0000664000175000017500000000461311767656530021754 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; public class SelfManagedDataHolder implements Externalizable { private transient String classname; private transient String id; private transient byte[] data; public SelfManagedDataHolder() { // should only be used by the ObjectStateUtils } // TODO better exception public SelfManagedDataHolder(String classname, String id, byte[] data) throws Exception { if ((classname == null) || (id == null)) { throw new Exception( "Argument cannot be null: classname = " + classname + ", id = " + id); } this.classname = classname; this.id = id; // TODO deep copy necessary? this.data = new byte[data.length]; for (int i = 0; i < data.length; i++) { this.data[i] = data[i]; } } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { classname = (String) in.readUTF(); id = (String) in.readUTF(); int datalength = in.readInt(); data = new byte[datalength]; in.read(data); } public void writeExternal(ObjectOutput out) throws IOException { out.writeUTF(classname); out.writeUTF(id); out.writeInt(data.length); out.write(data); } public String getClassname() { return classname; } public byte[] getData() { return data; } public String getId() { return id; } } ./src/org/apache/axis2/util/CommandLineOptionParser.java0000664000175000017500000001050511767656530022407 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class CommandLineOptionParser implements CommandLineOptionConstants { //states private static int STARTED = 0; private static int NEW_OPTION = 1; private static int SUB_PARAM_OF_OPTION = 2; private Map commandLineOptions; public CommandLineOptionParser(Map commandLineOptions) { this.commandLineOptions = commandLineOptions; } public CommandLineOptionParser(String[] args) { this.commandLineOptions = this.parse(args); } /** * Return a list with CommandLineOption objects * * @param args * @return CommandLineOption List */ private Map parse(String[] args) { Map commandLineOptions = new HashMap(); if (0 == args.length) { return commandLineOptions; } //State 0 means started //State 1 means earlier one was a new -option //State 2 means earlier one was a sub param of a -option int state = STARTED; ArrayList optionBundle = null; String optionType = null; CommandLineOption commandLineOption; for (int i = 0; i < args.length; i++) { if (args[i].startsWith("-")) { if (STARTED == state) { // fresh one state = NEW_OPTION; optionType = args[i]; } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) { // new one but old one should be saved commandLineOption = new CommandLineOption(optionType, optionBundle); commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption); state = NEW_OPTION; optionType = args[i]; optionBundle = null; } } else { if (STARTED == state) { commandLineOption = new CommandLineOption( CommandLineOptionConstants.SOLE_INPUT, args); commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption); return commandLineOptions; } else if (NEW_OPTION == state) { optionBundle = new ArrayList(); optionBundle.add(args[i]); state = SUB_PARAM_OF_OPTION; } else if (SUB_PARAM_OF_OPTION == state) { optionBundle.add(args[i]); } } } commandLineOption = new CommandLineOption(optionType, optionBundle); commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption); return commandLineOptions; } public Map getAllOptions() { return this.commandLineOptions; } public List getInvalidOptions(OptionsValidator validator) { List faultList = new ArrayList(); Iterator iterator = this.commandLineOptions.values().iterator(); while (iterator.hasNext()) { CommandLineOption commandLineOption = ((CommandLineOption) (iterator.next())); if (validator.isInvalid(commandLineOption)) { faultList.add(commandLineOption); } } return faultList; } }./src/org/apache/axis2/util/ThreadContextMigrator.java0000664000175000017500000001107311767656530022135 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; /** * This is the interface for a piece of code that will plug into the user * programming model impl (e.g. JAX-WS impl) and will be invoked while on the * ultimate thread of execution. It is intended to provide a mechanism to * allow information to be migrated between the Axis2 contexts and thread * local storage. *

        * Note: It is up to each particular programming model impl to decide whether * or not they wish to make use of the ThreadContextMigrators. *

        * For each general MEP, here is the invocation pattern: *

        * [one-way inbound] * migrateContextToThread(req) * cleanupThread(req) *

        * [req/rsp inbound] * migrateContextToThread(req) * migrateThreadToContext(rsp) * cleanupContext(rsp) * cleanupThread(req) *

        * [one-way outbound] * migrateThreadToContext(req) * cleanupContext(req) *

        * [req/rsp outbound (both sync and async)] * migrateThreadToContext(req) * cleanupContext(req) * migrateContextToThread(rsp) * Note: there is no corresponding cleanupThread(rsp); one of the inbound * cases would need to handle this *

        * If a fault occurs during execution of one of the migrators, it will be * treated like any other service fault (i.e. like what will happen if we can't * deliver the message to a service or if a handler fails. *

        * The cleanup* methods can be expected to be invoked after any exeception * that occurs within the scope of the migration that would cause that scope * to be left so that the thread and/or context may be cleaned up properly. */ public interface ThreadContextMigrator { /** * This method will be invoked when the processing of the message is * guaranteed to be on the thread of execution that will be used in * user space. It will be invoked for incoming messages. * Implementations of this interface can use the information found in the * MessageContext to determine whether a request or response is being * processed. * (e.g. MessageContext.getAxisOperation().getMessageExchangePattern()) * * @param messageContext * @throws AxisFault */ void migrateContextToThread(MessageContext messageContext) throws AxisFault; /** * This method will be invoked when the processing of the message is * guaranteed to still be on the thread of execution that was used in user * space, after all processing has completed (i.e. when the particular * processing of a message is unwinding.) It provides a mechanism which can * be used to clean up the TLS. * * @param messageContext */ void cleanupThread(MessageContext messageContext); /** * This method will be invoked when the processing of the message is * guaranteed to still be on the thread of execution that was used in * user space. It will be invoked for both outgoing messages. * Implementations of this interface can use the information found in the * MessageContext to determine whether a request or response is being * processed. * (e.g. MessageContext.getAxisOperation().getMessageExchangePattern()) * * @param messageContext * @throws AxisFault */ void migrateThreadToContext(MessageContext messageContext) throws AxisFault; /** * This method will be invoked when the processing of the message is * guaranteed to be on the thread of execution that will be used in user * space, after all processing has completed (i.e. when the particular * processing of a message is unwinding.) It provides a mechanism which can * be used to clean up the MessageContext or restore TLS. * * @param messageContext */ void cleanupContext(MessageContext messageContext); } ./src/org/apache/axis2/util/ExternalPolicySerializer.java0000664000175000017500000001227611767656530022656 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.neethi.Assertion; import org.apache.neethi.Constants; import org.apache.neethi.Policy; import javax.xml.namespace.QName; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamWriter; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; public class ExternalPolicySerializer { private List assertions2Filter = new ArrayList(); public void addAssertionToFilter(QName name) { assertions2Filter.add(name); } public void setAssertionsToFilter(List assertions2Filter) { this.assertions2Filter = assertions2Filter; } public List getAssertionsToFilter() { return assertions2Filter; } public void serialize(Policy policy, OutputStream os) { try { XMLStreamWriter writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(os); policy = (Policy) policy.normalize(false); String wspPrefix = writer.getPrefix(Constants.URI_POLICY_NS); if (wspPrefix == null) { wspPrefix = Constants.ATTR_WSP; writer.setPrefix(wspPrefix, Constants.URI_POLICY_NS); } String wsuPrefix = writer.getPrefix(Constants.URI_WSU_NS); if (wsuPrefix == null) { wsuPrefix = Constants.ATTR_WSU; writer.setPrefix(wsuPrefix, Constants.URI_WSU_NS); } writer.writeStartElement(wspPrefix, Constants.ELEM_POLICY, Constants.URI_POLICY_NS); QName key; String prefix = null; String namespaceURI = null; String localName = null; HashMap prefix2ns = new HashMap(); for (Iterator iterator = policy.getAttributes().keySet().iterator(); iterator .hasNext();) { key = (QName) iterator.next(); localName = key.getLocalPart(); namespaceURI = key.getNamespaceURI(); namespaceURI = (namespaceURI == null || namespaceURI.length() == 0) ? null : namespaceURI; if (namespaceURI != null) { String writerPrefix = writer.getPrefix(namespaceURI); writerPrefix = (writerPrefix == null || writerPrefix .length() == 0) ? null : writerPrefix; if (writerPrefix == null) { prefix = key.getPrefix(); prefix = (prefix == null || prefix.length() == 0) ? null : prefix; } else { prefix = writerPrefix; } if (prefix != null) { writer.writeAttribute(prefix, namespaceURI, localName, policy.getAttribute(key)); prefix2ns.put(prefix, key.getNamespaceURI()); } else { writer.writeAttribute(namespaceURI, localName, policy .getAttribute(key)); } } else { writer.writeAttribute(localName, policy.getAttribute(key)); } } // writes xmlns:wsp=".." writer.writeNamespace(wspPrefix, Constants.URI_POLICY_NS); String prefiX; for (Iterator iterator = prefix2ns.keySet().iterator(); iterator .hasNext();) { prefiX = (String) iterator.next(); writer.writeNamespace(prefiX, (String) prefix2ns.get(prefiX)); } writer.writeStartElement(Constants.ATTR_WSP, Constants.ELEM_EXACTLYONE, Constants.URI_POLICY_NS); // write List assertionList; for (Iterator iterator = policy.getAlternatives(); iterator .hasNext();) { assertionList = (List) iterator.next(); // write writer.writeStartElement(Constants.ATTR_WSP, Constants.ELEM_ALL, Constants.URI_POLICY_NS); Assertion assertion; for (Iterator assertions = assertionList.iterator(); assertions .hasNext();) { assertion = (Assertion) assertions.next(); if (assertions2Filter.contains(assertion.getName())) { // since this is an assertion to filter, we will not serialize this continue; } assertion.serialize(writer); } // write writer.writeEndElement(); } // write writer.writeEndElement(); // write writer.writeEndElement(); writer.flush(); } catch (Exception ex) { throw new RuntimeException(ex); } } } ./src/org/apache/axis2/util/LoggingControl.java0000664000175000017500000000336611767656530020611 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * This class provides a more efficient means of control over logging than * do most providers of the Common's logging API at the cost of runtime * flexibility. */ public class LoggingControl { /** * If this flag is set to false then debug messages will not be logged, * irrespective of the level set for the logger itself. This can only * be changed as the result of a JVM restart or a purge and reloading * of this class. *

        * Usage: if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())... * or * if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())... */ public static final boolean debugLoggingAllowed; static { String prop = null; try { prop = System.getProperty("Axis2.prohibitDebugLogging"); } catch (SecurityException SE) { //do nothing } debugLoggingAllowed = prop == null; } } ./src/org/apache/axis2/util/Utils.java0000664000175000017500000006007611767656530016763 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFault; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Flow; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.InOnlyAxisOperation; import org.apache.axis2.description.InOutAxisOperation; import org.apache.axis2.description.OutInAxisOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.PhaseRule; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisError; import org.apache.axis2.engine.Handler; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.receivers.RawXMLINOutMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.File; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Iterator; public class Utils { private static final Log log = LogFactory.getLog(Utils.class); public static void addHandler(Flow flow, Handler handler, String phaseName) { HandlerDescription handlerDesc = new HandlerDescription(handler.getName()); PhaseRule rule = new PhaseRule(phaseName); handlerDesc.setRules(rule); handler.init(handlerDesc); handlerDesc.setHandler(handler); flow.addHandler(handlerDesc); } /** * @see org.apache.axis2.util.MessageContextBuilder:createOutMessageContext() * @deprecated (post1.1branch) */ public static MessageContext createOutMessageContext(MessageContext inMessageContext) throws AxisFault { return MessageContextBuilder.createOutMessageContext(inMessageContext); } public static AxisService createSimpleService(QName serviceName, String className, QName opName) throws AxisFault { return createSimpleService(serviceName, new RawXMLINOutMessageReceiver(), className, opName); } public static AxisService createSimpleServiceforClient(QName serviceName, String className, QName opName) throws AxisFault { return createSimpleServiceforClient(serviceName, new RawXMLINOutMessageReceiver(), className, opName); } public static AxisService createSimpleInOnlyService(QName serviceName, MessageReceiver messageReceiver, QName opName) throws AxisFault { AxisService service = new AxisService(serviceName.getLocalPart()); service.setClassLoader(getContextClassLoader_DoPriv()); AxisOperation axisOp = new InOnlyAxisOperation(opName); axisOp.setMessageReceiver(messageReceiver); axisOp.setStyle(WSDLConstants.STYLE_RPC); service.addOperation(axisOp); service.mapActionToOperation(Constants.AXIS2_NAMESPACE_URI + "/" + opName.getLocalPart(), axisOp); return service; } private static ClassLoader getContextClassLoader_DoPriv() { return (ClassLoader) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } } ); } public static AxisService createSimpleService(QName serviceName, MessageReceiver messageReceiver, String className, QName opName) throws AxisFault { AxisService service = new AxisService(serviceName.getLocalPart()); service.setClassLoader(getContextClassLoader_DoPriv()); service.addParameter(new Parameter(Constants.SERVICE_CLASS, className)); AxisOperation axisOp = new InOutAxisOperation(opName); axisOp.setMessageReceiver(messageReceiver); axisOp.setStyle(WSDLConstants.STYLE_RPC); service.addOperation(axisOp); service.mapActionToOperation(Constants.AXIS2_NAMESPACE_URI + "/" + opName.getLocalPart(), axisOp); return service; } public static AxisService createSimpleServiceforClient(QName serviceName, MessageReceiver messageReceiver, String className, QName opName) throws AxisFault { AxisService service = new AxisService(serviceName.getLocalPart()); service.setClassLoader(getContextClassLoader_DoPriv()); service.addParameter(new Parameter(Constants.SERVICE_CLASS, className)); AxisOperation axisOp = new OutInAxisOperation(opName); axisOp.setMessageReceiver(messageReceiver); axisOp.setStyle(WSDLConstants.STYLE_RPC); service.addOperation(axisOp); return service; } public static ServiceContext fillContextInformation(AxisService axisService, ConfigurationContext configurationContext) throws AxisFault { // 2. if null, create new opCtxt // fill the service group context and service context info return fillServiceContextAndServiceGroupContext(axisService, configurationContext); } private static ServiceContext fillServiceContextAndServiceGroupContext(AxisService axisService, ConfigurationContext configurationContext) throws AxisFault { String serviceGroupContextId = UUIDGenerator.getUUID(); ServiceGroupContext serviceGroupContext = configurationContext.createServiceGroupContext(axisService.getAxisServiceGroup()); serviceGroupContext.setId(serviceGroupContextId); configurationContext.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext); return serviceGroupContext.getServiceContext(axisService); } /** * Break a full path into pieces * * @return an array where element [0] always contains the service, and element 1, if not null, contains * the path after the first element. all ? parameters are discarded. */ public static String[] parseRequestURLForServiceAndOperation(String path, String servicePath) { if (log.isDebugEnabled()) { log.debug("parseRequestURLForServiceAndOperation : [" + path + "][" + servicePath + "]"); } if (path == null) { return null; } String[] values = new String[2]; // TODO. This is kind of brittle. Any service with the name /services would cause fun. int index = path.lastIndexOf(servicePath); String service; if (-1 != index) { int serviceStart = index + servicePath.length(); if (path.length() > serviceStart + 1) { service = path.substring(serviceStart + 1); int queryIndex = service.indexOf('?'); if (queryIndex > 0) { service = service.substring(0, queryIndex); } int operationIndex = service.indexOf('/'); if (operationIndex > 0) { values[0] = service.substring(0, operationIndex); values[1] = service.substring(operationIndex + 1); operationIndex = values[1].lastIndexOf('/'); if (operationIndex > 0) { values[1] = values[1].substring(operationIndex + 1); } } else { values[0] = service; } } } else { if (log.isDebugEnabled()) { log.debug("Unable to parse request URL [" + path + "][" + servicePath + "]"); } } return values; } public static ConfigurationContext getNewConfigurationContext(String repositry) throws Exception { final File file = new File(repositry); boolean exists = exists(file); if (!exists) { throw new Exception("repository directory " + file.getAbsolutePath() + " does not exists"); } File axis2xml = new File(file, "axis.xml"); String axis2xmlString = null; if (exists(axis2xml)) { axis2xmlString = axis2xml.getName(); } String path = (String) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return file.getAbsolutePath(); } } ); return ConfigurationContextFactory .createConfigurationContextFromFileSystem(path, axis2xmlString); } private static boolean exists(final File file) { Boolean exists = (Boolean) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return new Boolean(file.exists()); } } ); return exists.booleanValue(); } public static String getParameterValue(Parameter param) { if (param == null) { return null; } else { return (String) param.getValue(); } } /** * Get the name of the module , where archive name is combination of module name + its version * The format of the name is as follows: * moduleName-00.0000 * Example: "addressing-01.0001.mar" would return "addressing" * * @param moduleName the name of the module archive * @return the module name parsed out of the file name */ public static String getModuleName(String moduleName) { if (moduleName.endsWith("-SNAPSHOT")) { return moduleName.substring(0, moduleName.indexOf("-SNAPSHOT")); } char delimiter = '-'; int version_index = moduleName.lastIndexOf(delimiter); if (version_index > 0) { String versionString = getModuleVersion(moduleName); if (versionString == null) { return moduleName; } else { return moduleName.substring(0, version_index); } } else { return moduleName; } } public static String getModuleVersion(String moduleName) { if (moduleName.endsWith("-SNAPSHOT")) { return "SNAPSHOT"; } char version_seperator = '-'; int version_index = moduleName.lastIndexOf(version_seperator); if (version_index > 0) { String versionString = moduleName.substring(version_index + 1, moduleName.length()); try { Float.parseFloat(versionString); return versionString; } catch (NumberFormatException e) { return null; } } else { return null; } } public static String getModuleName(String moduleName, String moduleVersion) { if (moduleVersion != null && moduleVersion.length() != 0) { moduleName = moduleName + "-" + moduleVersion; } return moduleName; } /** * - if he trying to engage the same module then method will returen false * - else it will return true * */ public static boolean checkVersion(String module1version, String module2version) throws AxisFault { if ((module1version !=null && !module1version.equals(module2version)) || module2version !=null && !module2version.equals(module1version)) { throw new AxisFault("trying to engage two different module versions " + module1version + " : " + module2version); } return true; } public static void calculateDefaultModuleVersion(HashMap modules, AxisConfiguration axisConfig) { Iterator allModules = modules.values().iterator(); HashMap defaultModules = new HashMap(); while (allModules.hasNext()) { AxisModule axisModule = (AxisModule) allModules.next(); String moduleName = axisModule.getName(); String moduleNameString; String moduleVersionString; if (AxisModule.VERSION_SNAPSHOT.equals(axisModule.getVersion())) { moduleNameString = axisModule.getName(); moduleVersionString = axisModule.getVersion(); } else { if (axisModule.getVersion() == null) { moduleNameString = getModuleName(moduleName); moduleVersionString = getModuleVersion(moduleName); if (moduleVersionString != null) { try { Float.valueOf(moduleVersionString); axisModule.setVersion(moduleVersionString); axisModule.setName(moduleName); } catch (NumberFormatException e) { moduleVersionString = null; } } } else { moduleNameString = axisModule.getName(); moduleVersionString = axisModule.getVersion(); } } String currentDefaultVerison = (String) defaultModules.get(moduleNameString); if (currentDefaultVerison != null) { // if the module version is null then , that will be ignore in this case if (!AxisModule.VERSION_SNAPSHOT.equals(currentDefaultVerison)) { if (moduleVersionString != null && isLatest(moduleVersionString, currentDefaultVerison)) { defaultModules.put(moduleNameString, moduleVersionString); } } } else { defaultModules.put(moduleNameString, moduleVersionString); } } Iterator def_mod_itr = defaultModules.keySet().iterator(); while (def_mod_itr.hasNext()) { String moduleName = (String) def_mod_itr.next(); axisConfig.addDefaultModuleVersion(moduleName, (String) defaultModules.get(moduleName)); } } public static boolean isLatest(String moduleVersion, String currentDefaultVersion) { if (AxisModule.VERSION_SNAPSHOT.equals(moduleVersion)) { return true; } else { float m_version = Float.parseFloat(moduleVersion); float m_c_vresion = Float.parseFloat(currentDefaultVersion); return m_version > m_c_vresion; } } /** * Check if a MessageContext property is true. * * @param messageContext the MessageContext * @param propertyName the property name * @return true if the property is Boolean.TRUE, "true", 1, etc. or false otherwise * @deprecated please use MessageContext.isTrue(propertyName) instead */ public static boolean isExplicitlyTrue(MessageContext messageContext, String propertyName) { Object flag = messageContext.getProperty(propertyName); return JavaUtils.isTrueExplicitly(flag); } /** * Maps the String URI of the Message exchange pattern to a integer. * Further, in the first lookup, it will cache the looked * up value so that the subsequent method calls are extremely efficient. */ public static int getAxisSpecifMEPConstant(String messageExchangePattern) { int mepConstant = WSDLConstants.MEP_CONSTANT_INVALID; if (WSDL2Constants.MEP_URI_IN_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OUT.equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_IN_OUT; } else if ( WSDL2Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_IN_ONLY; } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT .equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT .equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_OPTIONAL_OUT .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT; } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_IN .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_OUT_IN; } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_ONLY .equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants .MEP_URI_OUT_ONLY.equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_OUT_ONLY; } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN .equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_OUT_OPTIONAL_IN .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN; } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY .equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY; } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY .equals(messageExchangePattern) || WSDLConstants.WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY .equals(messageExchangePattern)) { mepConstant = WSDLConstants.MEP_CONSTANT_ROBUST_OUT_ONLY; } if (mepConstant == WSDLConstants.MEP_CONSTANT_INVALID) { throw new AxisError(Messages.getMessage("mepmappingerror")); } return mepConstant; } /** * Get an AxisFault object to represent the SOAPFault in the SOAPEnvelope attached * to the provided MessageContext. This first check for an already extracted AxisFault * and otherwise does a simple extract. *

        * MUST NOT be passed a MessageContext which does not contain a SOAPFault * * @param messageContext * @return */ public static AxisFault getInboundFaultFromMessageContext(MessageContext messageContext) { // Get the fault if it's already been extracted by a handler AxisFault result = (AxisFault) messageContext.getProperty(Constants.INBOUND_FAULT_OVERRIDE); // Else, extract it from the SOAPBody if (result == null) { SOAPEnvelope envelope = messageContext.getEnvelope(); SOAPFault soapFault; SOAPBody soapBody; if (envelope != null && (soapBody = envelope.getBody()) != null) { if ((soapFault = soapBody.getFault()) != null) { return new AxisFault(soapFault, messageContext); } // If its a REST response the content is not a SOAP envelop and hence we will // Have use the soap body as the exception if (messageContext.isDoingREST() && soapBody.getFirstElement() != null) { return new AxisFault(soapBody.getFirstElement().toString()); } } // Not going to be able to throw new IllegalArgumentException( "The MessageContext does not have an associated SOAPFault."); } return result; } /** * This method will provide the logic needed to retrieve an Object's classloader * in a Java 2 Security compliant manner. */ public static ClassLoader getObjectClassLoader(final Object object) { if(object == null) { return null; } else { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return object.getClass().getClassLoader(); } }); } } public static int getMtomThreshold(MessageContext msgCtxt){ Integer value = null; if(!msgCtxt.isServerSide()){ value = (Integer)msgCtxt.getProperty(Constants.Configuration.MTOM_THRESHOLD); }else{ Parameter param = msgCtxt.getParameter(Constants.Configuration.MTOM_THRESHOLD); if(param!=null){ value = (Integer)param.getValue(); } } int threshold = (value!=null)?value.intValue():0; if(log.isDebugEnabled()){ log.debug("MTOM optimized Threshold value ="+threshold); } return threshold; } } ./src/org/apache/axis2/util/DefaultEntityResolver.java0000664000175000017500000000213311767656530022154 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.xml.sax.InputSource; public class DefaultEntityResolver implements org.xml.sax.EntityResolver { public DefaultEntityResolver() { } public InputSource resolveEntity(String publicId, String systemId) { return XMLUtils.getEmptyInputSource(); } } ./src/org/apache/axis2/util/MultipleEntryHashMap.java0000664000175000017500000000403711767656530021735 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.util.ArrayList; import java.util.Hashtable; import java.util.Map; import java.util.Set; /** * This will make a hash map which can contain multiple entries for the same hash value. */ public class MultipleEntryHashMap { private Map table; public MultipleEntryHashMap() { this.table = new Hashtable(1); } /** * If you call get once in this, it will remove that item from the map * * @param key * @return */ public Object get(Object key) { ArrayList list = (ArrayList) table.get(key); if (list != null && list.size() > 0) { Object o = list.get(0); list.remove(0); // if (list.size() == 0) { // table.remove(key); // } return o; } return null; } public Object put(Object key, Object value) { ArrayList list = (ArrayList) table.get(key); if (list == null) { ArrayList listToBeAdded = new ArrayList(); table.put(key, listToBeAdded); listToBeAdded.add(value); } else { list.add(value); } return value; } public Set keySet() { return table.keySet(); } } ./src/org/apache/axis2/util/CommandLineOption.java0000664000175000017500000000457611767656530021245 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.util.ArrayList; public class CommandLineOption implements CommandLineOptionConstants { private String type; private ArrayList optionValues; public CommandLineOption(String type, String[] values) { setOptionType(type); ArrayList arrayList = new ArrayList(values.length); for (int i = 0; i < values.length; i++) { arrayList.add(values[i]); } this.optionValues = arrayList; } private void setOptionType(String type) { //cater for the long options first if (type.startsWith("--")) { type = type.replaceFirst("--", ""); } if (type.startsWith("-")) { type = type.replaceFirst("-", ""); } //we do not change the case of the option! this.type = type; } /** * @param type */ public CommandLineOption(String type, ArrayList values) { setOptionType(type); if (null != values) { this.optionValues = values; } } /** * @return Returns the type. * @see CommandLineOptionConstants */ public String getOptionType() { return type; } /** * @return Returns the optionValues. */ public String getOptionValue() { if ((optionValues != null) && (optionValues.size() > 0)) { return (String) optionValues.get(0); } else { return null; } } /** * @return Returns the optionValues. */ public ArrayList getOptionValues() { return optionValues; } } ./src/org/apache/axis2/util/Counter.java0000664000175000017500000000252011767656530017270 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * This class provides a simple zero-based counter with synchronized access. */ public class Counter { private long value = 0L; public synchronized long incrementAndGet() { return ++value; } public synchronized long decrementAndGet() { if (value > 0L) { return --value; } else { return value; } } public synchronized void reset() { value = 0L; } public synchronized long get() { return value; } } ./src/org/apache/axis2/util/HostConfiguration.java0000664000175000017500000000222311767656530021316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; //to keep infor getting from axis2.xml public class HostConfiguration { private String ip; private int port; public HostConfiguration(String ip, int port) { this.ip = ip; this.port = port; } public String getIp() { return ip; } public int getPort() { return port; } } ./src/org/apache/axis2/util/XMLChar.java0000664000175000017500000005527211767656530017123 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * This class defines the basic XML character properties. The data * in this class can be used to verify that a character is a valid * XML character or if the character is a space, name start, or name * character. *

        * A series of convenience methods are supplied to ease the burden * of the developer. Because inlining the checks can improve per * character performance, the tables of character properties are * public. Using the character as an index into the CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. */ public class XMLChar { // // Constants // /** * Character flags. */ private static final byte[] CHARS = new byte[1 << 16]; /** * Valid character mask. */ public static final int MASK_VALID = 0x01; /** * Space character mask. */ public static final int MASK_SPACE = 0x02; /** * Name start character mask. */ public static final int MASK_NAME_START = 0x04; /** * Name character mask. */ public static final int MASK_NAME = 0x08; /** * Pubid character mask. */ public static final int MASK_PUBID = 0x10; /** * Content character mask. Special characters are those that can * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

        * This is an optimization for the inner loop of character scanning. */ public static final int MASK_CONTENT = 0x20; /** * NCName start character mask. */ public static final int MASK_NCNAME_START = 0x40; /** * NCName character mask. */ public static final int MASK_NCNAME = 0x80; // // Static initialization // static { // // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | // [#xE000-#xFFFD] | [#x10000-#x10FFFF] // int charRange[] = { 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD, }; // // [3] S ::= (#x20 | #x9 | #xD | #xA)+ // int spaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; // // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | // CombiningChar | Extender // int nameChar[] = { 0x002D, 0x002E, // '-' and '.' }; // // [5] Name ::= (Letter | '_' | ':') (NameChar)* // int nameStartChar[] = { 0x003A, 0x005F, // ':' and '_' }; // // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] // int pubidChar[] = { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; int pubidRange[] = { 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A }; // // [84] Letter ::= BaseChar | Ideographic // int letterRange[] = { // BaseChar 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E, 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217, 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1, 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C, 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4, 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5, 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA, 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7, 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6, 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990, 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD, 0x09D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x110C, 0x110E, 0x1112, 0x1154, 0x1155, 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF, 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9, 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D, 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC, 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB, 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B, 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C, 0xAC00, 0xD7A3, // Ideographic 0x3021, 0x3029, 0x4E00, 0x9FA5, }; int letterChar[] = { // BaseChar 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, 0x1F5D, 0x1FBE, 0x2126, 0x212E, // Ideographic 0x3007, }; // // [87] CombiningChar ::= ... // int combiningCharRange[] = { 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1, 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652, 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954, 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8, 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48, 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43, 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83, 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03, 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56, 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD, 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48, 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9, 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84, 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7, 0x20D0, 0x20DC, 0x302A, 0x302F, }; int combiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; // // [88] Digit ::= ... // int digitRange[] = { 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F, 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F, 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F, 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, }; // // [89] Extender ::= ... // int extenderRange[] = { 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE, }; int extenderChar[] = { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; // // SpecialChar ::= '<', '&', '\n', '\r', ']' // int specialChar[] = { '<', '&', '\n', '\r', ']', }; // // Initialize // // set valid characters for (int i = 0; i < charRange.length; i += 2) { for (int j = charRange[i]; j <= charRange[i + 1]; j++) { CHARS[j] |= MASK_VALID | MASK_CONTENT; } } // remove special characters for (int i = 0; i < specialChar.length; i++) { CHARS[specialChar[i]] = (byte) (CHARS[specialChar[i]] & ~MASK_CONTENT); } // set space characters for (int i = 0; i < spaceChar.length; i++) { CHARS[spaceChar[i]] |= MASK_SPACE; } // set name start characters for (int i = 0; i < nameStartChar.length; i++) { CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } for (int i = 0; i < letterRange.length; i += 2) { for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) { CHARS[j] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } } for (int i = 0; i < letterChar.length; i++) { CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } // set name characters for (int i = 0; i < nameChar.length; i++) { CHARS[nameChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < digitRange.length; i += 2) { for (int j = digitRange[i]; j <= digitRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharRange.length; i += 2) { for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharChar.length; i++) { CHARS[combiningCharChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < extenderRange.length; i += 2) { for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < extenderChar.length; i++) { CHARS[extenderChar[i]] |= MASK_NAME | MASK_NCNAME; } // remove ':' from allowable MASK_NCNAME_START and MASK_NCNAME chars CHARS[':'] &= ~(MASK_NCNAME_START | MASK_NCNAME); // set Pubid characters for (int i = 0; i < pubidChar.length; i++) { CHARS[pubidChar[i]] |= MASK_PUBID; } for (int i = 0; i < pubidRange.length; i += 2) { for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) { CHARS[j] |= MASK_PUBID; } } } // () // // Public static methods // /** * Returns true if the specified character is a supplemental character. * * @param c The character to check. */ public static boolean isSupplemental(int c) { return (c >= 0x10000 && c <= 0x10FFFF); } /** * Returns true the supplemental character corresponding to the given * surrogates. * * @param h The high surrogate. * @param l The low surrogate. */ public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; } /** * Returns the high surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char highSurrogate(int c) { return (char) (((c - 0x00010000) >> 10) + 0xD800); } /** * Returns the low surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char lowSurrogate(int c) { return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); } /** * Returns whether the given character is a high surrogate * * @param c The character to check. */ public static boolean isHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDBFF); } /** * Returns whether the given character is a low surrogate * * @param c The character to check. */ public static boolean isLowSurrogate(int c) { return (0xDC00 <= c && c <= 0xDFFF); } /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

        * If the program chooses to apply the mask directly to the * CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isValid(int c) { return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isValid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean /** * Returns true if the specified character can be considered content. * * @param c The character to check. */ public static boolean isContent(int c) { return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isContent(int):boolean /** * Returns true if the specified character can be considered markup. * Markup characters include '<', '&', and '%'. * * @param c The character to check. */ public static boolean isMarkup(int c) { return c == '<' || c == '&' || c == '%'; } // isMarkup(int):boolean /** * Returns true if the specified character is a space character * as defined by production [3] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isSpace(int c) { return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0; } // isSpace(int):boolean /** * Returns true if the specified character is a space character * as amdended in the XML 1.1 specification. * * @param c The character to check. */ public static boolean isXML11Space(int c) { return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) || c == 0x85 || c == 0x2028; } // isXML11Space(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [5] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; } // isNameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; } // isName(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; } // isNCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; } // isNCName(int):boolean /** * Returns true if the specified character is a valid Pubid * character as defined by production [13] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isPubid(int c) { return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; } // isPubid(int):boolean /* * [5] Name ::= (Letter | '_' | ':') (NameChar)* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) { return false; } char ch = name.charAt(0); if (!isNameStart(ch)) { return false; } for (int i = 1; i < name.length(); i++) { ch = name.charAt(i); if (!isName(ch)) { return false; } } return true; } // isValidName(String):boolean /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) { return false; } char ch = ncName.charAt(0); if (!isNCNameStart(ch)) { return false; } for (int i = 1; i < ncName.length(); i++) { ch = ncName.charAt(i); if (!isNCName(ch)) { return false; } } return true; } // isValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) { return false; } for (int i = 0; i < nmtoken.length(); i++) { char ch = nmtoken.charAt(i); if (! isName(ch)) { return false; } } return true; } // isValidName(String):boolean // encodings /** * Returns true if the encoding name is a valid IANA encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * IANA encoding name. * * @param ianaEncoding The IANA encoding name. */ public static boolean isValidIANAEncoding(String ianaEncoding) { if (ianaEncoding != null) { int length = ianaEncoding.length(); if (length > 0) { char c = ianaEncoding.charAt(0); if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { for (int i = 1; i < length; i++) { c = ianaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } } return false; } // isValidIANAEncoding(String):boolean /** * Returns true if the encoding name is a valid Java encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * Java encoding name. * * @param javaEncoding The Java encoding name. */ public static boolean isValidJavaEncoding(String javaEncoding) { if (javaEncoding != null) { int length = javaEncoding.length(); if (length > 0) { for (int i = 1; i < length; i++) { char c = javaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } return false; } // isValidIANAEncoding(String):boolean } // class XMLChar ./src/org/apache/axis2/util/Loader.java0000664000175000017500000002230211767656530017057 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.java.security.AccessController; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.security.PrivilegedAction; /** * Loads resources (or images) from various sources. */ public class Loader { private static final Log log = LogFactory.getLog(Loader.class); /** * Searches for resource in different * places. The search order is as follows: *

          *

        1. Search for resource using the thread context * class loader under Java2. If that fails, search for * resource using the class loader that loaded this * class (Loader). *

        2. Try one last time with * ClassLoader.getSystemResource(resource), that is is * using the system class loader in JDK 1.2 and virtual machine's * built-in class loader in JDK 1.1. *
        *

        * * @param resource * @return Returns URL */ static public URL getResource(String resource) { ClassLoader classLoader = null; URL url = null; try { // We could not find resource. Ler us now try with the // classloader that loaded this class. classLoader = getTCL(); if (classLoader != null) { log.debug("Trying to find [" + resource + "] using " + classLoader + " class loader."); url = classLoader.getResource(resource); if (url != null) { return url; } } } catch (Throwable t) { log.warn("Caught Exception while in Loader.getResource. This may be innocuous.", t); } // Last ditch attempt: get the resource from the class path. It // may be the case that clazz was loaded by the Extentsion class // loader which the parent of the system class loader. Hence the // code below. log.debug("Trying to find [" + resource + "] using ClassLoader.getSystemResource()."); return ClassLoader.getSystemResource(resource); } /** * Gets the resource with the specified class loader. * * @param loader * @param resource * @return Returns URL. * @throws ClassNotFoundException */ static public URL getResource(ClassLoader loader, String resource) throws ClassNotFoundException { URL url = null; try { if (loader != null) { log.debug("Trying to find [" + resource + "] using " + loader + " class loader."); url = loader.getResource(resource); if (url != null) { return url; } } } catch (Throwable t) { log.warn("Caught Exception while in Loader.getResource. This may be innocuous.", t); } return getResource(resource); } /** * Searches for resource in different * places. The search order is as follows: *

          *

        1. Search for resource using the thread context * class loader under Java2. If that fails, search for * resource using the class loader that loaded this * class (Loader). *

        2. Try one last time with * ClassLoader.getSystemResourceAsStream(resource), that is is * using the system class loader in JDK 1.2 and virtual machine's * built-in class loader in JDK 1.1. *
        *

        * * @param resource * @return Returns URL */ static public InputStream getResourceAsStream(String resource) { ClassLoader classLoader = null; try { // Let's try the Thread Context Class Loader classLoader = getTCL(); if (classLoader != null) { log.debug("Trying to find [" + resource + "] using " + classLoader + " class loader."); InputStream is = classLoader.getResourceAsStream(resource); if (is != null) { return is; } } } catch (Throwable t) { log.warn("Caught Exception while in Loader.getResourceAsStream. This may be innocuous.", t); } try { // We could not find resource. Ler us now try with the // classloader that loaded this class. classLoader = Loader.class.getClassLoader(); if (classLoader != null) { log.debug("Trying to find [" + resource + "] using " + classLoader + " class loader."); InputStream is = classLoader.getResourceAsStream(resource); if (is != null) { return is; } } } catch (Throwable t) { log.warn("Caught Exception while in Loader.getResourceAsStream. This may be innocuous.", t); } // Last ditch attempt: get the resource from the class path. It // may be the case that clazz was loaded by the Extentsion class // loader which the parent of the system class loader. Hence the // code below. log.debug("Trying to find [" + resource + "] using ClassLoader.getSystemResourceAsStream()."); return ClassLoader.getSystemResourceAsStream(resource); } /** * Gets the resource with the specified class loader. * * @param loader * @param resource * @return Returns URL. * @throws ClassNotFoundException */ static public InputStream getResourceAsStream(ClassLoader loader, String resource) throws ClassNotFoundException { try { if (loader != null) { log.debug("Trying to find [" + resource + "] using " + loader + " class loader."); InputStream is = loader.getResourceAsStream(resource); if (is != null) { return is; } } } catch (Throwable t) { log.warn("Caught Exception while in Loader.getResource. This may be innocuous.", t); } return getResourceAsStream(resource); } /** * Gets the thread context class loader. * * @return Returns ClassLoader. * @throws IllegalAccessException * @throws InvocationTargetException */ static private ClassLoader getTCL() throws IllegalAccessException, InvocationTargetException { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); } /** * Loads the specified classloader and then falls back to the loadClass. * * @param loader * @param clazz * @return Returns Class. * @throws ClassNotFoundException */ static public Class loadClass(ClassLoader loader, String clazz) throws ClassNotFoundException { try { if (loader != null) { Class c = loader.loadClass(clazz); if (c != null) { return c; } } } catch (UnsupportedClassVersionError e) { log.debug(e); throw e; } catch (Throwable e) { log.debug(e); } return loadClass(clazz); } /** * If running under JDK 1.2, loads the specified class using the * Thread contextClassLoader . If that * fails, try Class.forname. *

        * * @param clazz * @return Returns Class. * @throws ClassNotFoundException */ static public Class loadClass(String clazz) throws ClassNotFoundException { try { ClassLoader tcl = getTCL(); if (tcl != null) { Class c = tcl.loadClass(clazz); if (c != null) { return c; } } } catch (UnsupportedClassVersionError e) { log.debug(e); throw e; } catch (Throwable e) { log.debug(e); } // we reached here because tcl was null or because of a // security exception, or because clazz could not be loaded... // In any case we now try one more time return Class.forName(clazz); } } ./src/org/apache/axis2/util/AxisPolicyLocator.java0000664000175000017500000001372111767656530021266 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.description.AxisBinding; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.description.PolicySubject; import org.apache.axis2.engine.AxisConfiguration; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyRegistry; public class AxisPolicyLocator implements PolicyRegistry { AxisDescription subject = null; private static final short AXIS_BINDING_MESSAGE = 1; private static final short AXIS_MESSAGE = 2; private static final short AXIS_BINDING_OPERATION = 3; private static final short AXIS_OPERATION = 4; private static final short AXIS_BINDING = 5; private static final short AXIS_ENDPOINT = 6; private static final short AXIS_SERVICE = 7; private static final short AXIS_SERVICE_GROUP = 8; private static final short AXIS_CONFIGURATION = 9; public AxisPolicyLocator(AxisDescription subject) { this.subject = subject; } public Policy lookup(String key) { if (subject == null) { return null; } Policy policy = null; PolicySubject policySubject = subject.getPolicySubject(); PolicyComponent attachedPolicyComponent = policySubject .getAttachedPolicyComponent(key); if (attachedPolicyComponent != null && attachedPolicyComponent instanceof Policy) { policy = (Policy) attachedPolicyComponent; if (policy != null) { return policy; } } if (subject instanceof AxisService) { policy = ((AxisService) subject).lookupPolicy(key); if (policy != null) { return policy; } } short type = getType(subject); /* * processing the parallel level */ AxisDescription parallelLevel = null; switch (type) { case AXIS_BINDING_MESSAGE: parallelLevel = ((AxisBindingMessage) subject).getAxisMessage(); break; case AXIS_BINDING_OPERATION: parallelLevel = ((AxisBindingOperation) subject).getAxisOperation(); break; default: break; } if (parallelLevel != null) { policy = (new AxisPolicyLocator(parallelLevel)).lookup(key); if (policy != null) { return policy; } } AxisDescription upperLevel = getUpperLevel(type, subject); if (upperLevel != null) { policy = (new AxisPolicyLocator(upperLevel)).lookup(key); return policy; } return null; } public void register(String key, Policy policy) { throw new UnsupportedOperationException(); } public void remove(String key) { throw new UnsupportedOperationException(); } private AxisDescription getUpperLevel(short type, AxisDescription thisLevel) { switch (type) { case AXIS_BINDING_MESSAGE: return ((AxisBindingMessage) thisLevel).getAxisBindingOperation(); case AXIS_BINDING_OPERATION: return ((AxisBindingOperation) thisLevel).getAxisBinding(); case AXIS_BINDING: return ((AxisBinding) thisLevel).getAxisEndpoint(); case AXIS_ENDPOINT: return ((AxisEndpoint) thisLevel).getAxisService(); case AXIS_MESSAGE: return ((AxisMessage) thisLevel).getAxisOperation(); case AXIS_OPERATION: return ((AxisOperation) thisLevel).getAxisService(); case AXIS_SERVICE: return ((AxisService) thisLevel).getAxisServiceGroup(); case AXIS_SERVICE_GROUP: return ((AxisServiceGroup) thisLevel).getAxisConfiguration(); default: return null; } } private short getType(AxisDescription description) { if (description instanceof AxisBindingMessage) { return AXIS_BINDING_MESSAGE; } else if (description instanceof AxisMessage) { return AXIS_MESSAGE; } else if (description instanceof AxisBindingOperation) { return AXIS_BINDING_OPERATION; } else if (description instanceof AxisOperation) { return AXIS_OPERATION; } else if (description instanceof AxisBinding) { return AXIS_BINDING; } else if (description instanceof AxisEndpoint) { return AXIS_ENDPOINT; } else if (description instanceof AxisService) { return AXIS_SERVICE; } else if (description instanceof AxisServiceGroup) { return AXIS_SERVICE_GROUP; } else if (description instanceof AxisConfiguration) { return AXIS_CONFIGURATION; } return -1; } } ./src/org/apache/axis2/util/SessionUtils.java0000664000175000017500000000567011767656530020326 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.Constants; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import java.util.Iterator; public class SessionUtils { /** * Walk through the list of services and use the minimum of the scopes as the scope for the whole service group * * @param axisServiceGroup * @return scope for the service group */ public static String calculateMaxScopeForServiceGroup(AxisServiceGroup axisServiceGroup) { Iterator servics = axisServiceGroup.getServices(); int maxScope = 1; while (servics.hasNext()) { AxisService axisService = (AxisService) servics.next(); int scopeIntValue = getScopeIntValue(axisService.getScope()); if (maxScope < scopeIntValue) { maxScope = scopeIntValue; } } return getScopeString(maxScope); } /** * convert scope into a numerical value * * @param scope * @return integer */ private static int getScopeIntValue(String scope) { if (Constants.SCOPE_REQUEST.equals(scope)) { return 1; } else if (Constants.SCOPE_TRANSPORT_SESSION.equals(scope)) { return 2; } else if (Constants.SCOPE_SOAP_SESSION.equals(scope)) { return 3; } else if (Constants.SCOPE_APPLICATION.equals(scope)) { return 4; } else { return 2; } } /** * Get the actual scope string given the numerical value * * @param scope * @return string */ private static String getScopeString(int scope) { switch (scope) { case 1 : { return Constants.SCOPE_REQUEST; } case 2 : { return Constants.SCOPE_TRANSPORT_SESSION; } case 3 : { return Constants.SCOPE_SOAP_SESSION; } case 4 : { return Constants.SCOPE_APPLICATION; } default : { return Constants.SCOPE_TRANSPORT_SESSION; } } } } ./src/org/apache/axis2/util/OptionsValidator.java0000664000175000017500000000201611767656530021152 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * An interface for the options validator. This acts as the input for the commandlineOptions parser */ public interface OptionsValidator { public boolean isInvalid(CommandLineOption option); } ./src/org/apache/axis2/util/TargetResolver.java0000664000175000017500000000271711767656530020631 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.context.MessageContext; /** * TargetResolver *

        * Interface to be implemented by code to update the invocation target URL * before the transport is selected and the engine invoked. *

        * Examples of use: * 1. wsa:To set to a URN value which needs translated to a targetable URL * 2. support clustering where a single URI may repesent multiple servers and one must be selected */ public interface TargetResolver { /** * resolveTarget examines the MessageContext and updates the MessageContext * in order to resolve the target. */ public void resolveTarget(MessageContext messageContext); }./src/org/apache/axis2/util/OptionsParser.java0000664000175000017500000001665711767656530020501 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * General purpose command line options parser. * If this is used outside of Axis just remove the Axis specific sections. */ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Vector; public class OptionsParser { private static final Log log = LogFactory.getLog(OptionsParser.class); String args[] = null; Vector usedArgs = null; /** * Constructor - just pass in the args from the command line. */ public OptionsParser(String _args[]) throws MalformedURLException { if (_args == null) { _args = new String[]{}; } args = _args; usedArgs = null; getUser(); getPassword(); } public String getPassword() { return (isValueSet('w')); } /** * This returns an array of unused args - these are the non-option * args from the command line. */ public String[] getRemainingArgs() { ArrayList al = null; int loop; for (loop = 0; loop < args.length; loop++) { if ((args[loop] == null) || (args[loop].length() == 0)) { continue; } if (args[loop].charAt(0) == '-') { continue; } if (al == null) { al = new ArrayList(); } al.add(args[loop]); } if (al == null) { return (null); } String a[] = new String[al.size()]; for (loop = 0; loop < al.size(); loop++) { a[loop] = (String) al.get(loop); } return (a); } /** * This just returns a string with the unprocessed flags - mainly * for error reporting - so you can report the unknown flags. */ public String getRemainingFlags() { StringBuffer sb = null; int loop; for (loop = 0; loop < args.length; loop++) { if ((args[loop] == null) || (args[loop].length() == 0)) { continue; } if (args[loop].charAt(0) != '-') { continue; } if (sb == null) { sb = new StringBuffer(); } sb.append(args[loop].substring(1)); } return ((sb == null) ? null : sb.toString()); } public String getUser() { return (isValueSet('u')); } /** * Returns an int specifying the number of times that the flag was * specified on the command line. Once this flag is looked for you * must save the result because if you call it again for the same * flag you'll get zero. */ public int isFlagSet(char optChar) { int value = 0; int loop; int i; for (loop = 0; (usedArgs != null) && (loop < usedArgs.size()); loop++) { String arg = (String) usedArgs.elementAt(loop); if (arg.charAt(0) != '-') { continue; } for (i = 0; i < arg.length(); i++) { if (arg.charAt(i) == optChar) { value++; } } } for (loop = 0; loop < args.length; loop++) { if ((args[loop] == null) || (args[loop].length() == 0)) { continue; } if (args[loop].charAt(0) != '-') { continue; } while ((args[loop] != null) && (i = args[loop].indexOf(optChar)) != -1) { args[loop] = args[loop].substring(0, i) + args[loop].substring(i + 1); if (args[loop].length() == 1) { args[loop] = null; } value++; if (usedArgs == null) { usedArgs = new Vector(); } usedArgs.add("-" + optChar); } } return (value); } /** * Returns a string (or null) specifying the value for the passed * option. If the option isn't there then null is returned. The * option's value can be specified one of two ways: * -x value * -xvalue * Note that: -ax value * is not value (meaning flag 'a' followed by option 'x'. * Options with values must be the first char after the '-'. * If the option is specified more than once then the last one wins. */ public String isValueSet(char optChar) { String value = null; int loop; int i; for (loop = 0; (usedArgs != null) && (loop < usedArgs.size()); loop++) { String arg = (String) usedArgs.elementAt(loop); if ((arg.charAt(0) != '-') || (arg.charAt(1) != optChar)) { continue; } value = arg.substring(2); if (loop + 1 < usedArgs.size()) { value = (String) usedArgs.elementAt(++loop); } } for (loop = 0; loop < args.length; loop++) { if ((args[loop] == null) || (args[loop].length() == 0)) { continue; } if (args[loop].charAt(0) != '-') { continue; } i = args[loop].indexOf(optChar); if (i != 1) { continue; } if (i != args[loop].length() - 1) { // Not at end of arg, so use rest of arg as value value = args[loop].substring(i + 1); args[loop] = args[loop].substring(0, i); } else { // Remove the char from the current arg args[loop] = args[loop].substring(0, i); // Nothing after char so use next arg if ((loop + 1 < args.length) && (args[loop + 1] != null)) { // Next arg is there and non-null if (args[loop + 1].charAt(0) != '-') { value = args[loop + 1]; args[loop + 1] = null; } } else { // Next is null or not there - do nothing // value = null ; } } if (args[loop].length() == 1) { args[loop] = null; } // For now, keep looping to get that last on there // break ; } if (value != null) { if (usedArgs == null) { usedArgs = new Vector(); } usedArgs.add("-" + optChar); if (value.length() > 0) { usedArgs.add(value); } } return (value); } } ./src/org/apache/axis2/util/MessageContextBuilder.java0000664000175000017500000007444311767656530022126 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.AddressingConstants.Final; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.jms.JMSConstants; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.net.URI; import java.net.URISyntaxException; import java.util.Iterator; import java.util.List; public class MessageContextBuilder { protected static final Log log = LogFactory.getLog(MessageContextBuilder.class); /** * Creates a new 'response' message context based on a 'request' message context * Only deals with properties/fields that are the same for both 'normal' and fault responses. */ private static MessageContext createResponseMessageContext(MessageContext inMessageContext) throws AxisFault { MessageContext newmsgCtx = inMessageContext.getConfigurationContext().createMessageContext(); newmsgCtx.setSessionContext(inMessageContext.getSessionContext()); newmsgCtx.setTransportIn(inMessageContext.getTransportIn()); newmsgCtx.setTransportOut(inMessageContext.getTransportOut()); newmsgCtx.setServerSide(inMessageContext.isServerSide()); // TODO: Should this be specifying (or defaulting to) the "response" relationshipType?? newmsgCtx.addRelatesTo(new RelatesTo(inMessageContext.getOptions().getMessageId())); newmsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, inMessageContext.getProperty( AddressingConstants.WS_ADDRESSING_VERSION)); newmsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, inMessageContext.getProperty( AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES)); newmsgCtx.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME, inMessageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME)); newmsgCtx.setProperty(Constants.AXIS_BINDING_OPERATION, inMessageContext.getProperty(Constants.AXIS_BINDING_OPERATION)); // Setting the charater set encoding newmsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, inMessageContext.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING)); //Setting the message type property newmsgCtx.setProperty(Constants.Configuration.MESSAGE_TYPE, inMessageContext.getProperty(Constants.Configuration.MESSAGE_TYPE)); newmsgCtx.setDoingREST(inMessageContext.isDoingREST()); newmsgCtx.setOperationContext(inMessageContext.getOperationContext()); newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT, inMessageContext.getProperty(MessageContext.TRANSPORT_OUT)); newmsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO, inMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO)); handleCorrelationID(inMessageContext,newmsgCtx); return newmsgCtx; } /** * Creates a MessageContext for use with a non-fault response based on an request MessageContext */ public static MessageContext createOutMessageContext(MessageContext inMessageContext) throws AxisFault { // Create a basic response MessageContext with basic fields copied MessageContext newmsgCtx = createResponseMessageContext(inMessageContext); // Simple response so set To to value of inbound ReplyTo newmsgCtx.setTo(inMessageContext.getReplyTo()); if (newmsgCtx.getTo() == null) { newmsgCtx.setTo(new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL)); } // do Target Resolution TargetResolver targetResolver = newmsgCtx.getConfigurationContext().getAxisConfiguration().getTargetResolverChain(); if (targetResolver != null) { targetResolver.resolveTarget(newmsgCtx); } // Determine ReplyTo for response message. AxisService axisService = inMessageContext.getAxisService(); if (axisService != null && Constants.SCOPE_SOAP_SESSION.equals(axisService.getScope())) { //If the wsa 2004/08 (submission) spec is in effect use the wsa anonymous URI as the default replyTo value. //This is necessary because the wsa none URI is not available in that spec. Object version = inMessageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION); if (AddressingConstants.Submission.WSA_NAMESPACE.equals(version)) { newmsgCtx.setReplyTo( new EndpointReference(AddressingConstants.Submission.WSA_ANONYMOUS_URL)); } else { newmsgCtx.setReplyTo(new EndpointReference(AddressingConstants.Final.WSA_NONE_URI)); } newmsgCtx.setMessageID(UUIDGenerator.getUUID()); // add the service group id as a reference parameter String serviceGroupContextId = inMessageContext.getServiceGroupContextId(); if (serviceGroupContextId != null && !"".equals(serviceGroupContextId)) { EndpointReference replyToEPR = newmsgCtx.getReplyTo(); replyToEPR.addReferenceParameter(new QName(Constants.AXIS2_NAMESPACE_URI, Constants.SERVICE_GROUP_ID, Constants.AXIS2_NAMESPACE_PREFIX), serviceGroupContextId); } } else { EndpointReference outboundToEPR = newmsgCtx.getTo(); Object version = newmsgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION); if (AddressingConstants.Submission.WSA_NAMESPACE.equals(version) || (outboundToEPR != null && !outboundToEPR.hasAnonymousAddress())) { newmsgCtx.setMessageID(UUIDGenerator.getUUID()); newmsgCtx.setReplyTo(new EndpointReference(AddressingConstants.Final.WSA_NONE_URI)); } } // Set wsa:Action for response message // Use specified value if available AxisOperation ao = inMessageContext.getAxisOperation(); if ((ao != null) && (ao.getOutputAction() != null)) { newmsgCtx.setWSAAction(ao.getOutputAction()); } else { // If not, simply copy the request value. Almost always invalid. newmsgCtx.setWSAAction(inMessageContext.getWSAAction()); } if (ao != null) { newmsgCtx.setAxisMessage(ao.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); } // setting the out bound binding message AxisBindingMessage inboundAxisBindingMessage = (AxisBindingMessage)inMessageContext.getProperty(Constants.AXIS_BINDING_MESSAGE); if (inboundAxisBindingMessage != null){ AxisBindingOperation axisBindingOperation = inboundAxisBindingMessage.getAxisBindingOperation(); newmsgCtx.setProperty(Constants.AXIS_BINDING_MESSAGE, axisBindingOperation.getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); } newmsgCtx.setDoingMTOM(inMessageContext.isDoingMTOM()); newmsgCtx.setDoingSwA(inMessageContext.isDoingSwA()); newmsgCtx.setServiceGroupContextId(inMessageContext.getServiceGroupContextId()); // Ensure transport settings match the scheme for the To EPR setupCorrectTransportOut(newmsgCtx); return newmsgCtx; } /** * Copies the correlation id (jms) from the in message ctx * to the out message ctx. Currently this check is for jms * only, but can be expanded to other transports if the need * arises. */ private static void handleCorrelationID(MessageContext inMessageContext,MessageContext outMessageContext) { if (inMessageContext.getIncomingTransportName()!= null && inMessageContext.getIncomingTransportName().equals(Constants.TRANSPORT_JMS)) { log.debug("Incoming Transport is JMS, lets check for JMS correlation id"); String correlationId = (String) inMessageContext.getProperty(JMSConstants.JMS_COORELATION_ID); log.debug("Correlation id is " + correlationId); if (correlationId != null && correlationId.length() > 0) { outMessageContext.setProperty(JMSConstants.JMS_COORELATION_ID, correlationId); } } } /** * This method is called to handle any error that occurs at inflow or outflow. But if the * method is called twice, it implies that sending the error handling has failed, in which case * the method logs the error and exits. */ public static MessageContext createFaultMessageContext(MessageContext processingContext, Throwable e) throws AxisFault { if (processingContext.isProcessingFault()) { // We get the error file processing the fault. nothing we can do throw new AxisFault(Messages.getMessage("errorwhileProcessingFault")); } // See if the throwable is an AxisFault and if it already contains the // fault MessageContext if (e instanceof AxisFault) { MessageContext faultMessageContext = ((AxisFault) e).getFaultMessageContext(); if (faultMessageContext != null) { // These may not have been set correctly when the original context // was created -- an example of this is with the SimpleHTTPServer. // I'm not sure if this is the correct thing to do, or if the // code that created this context in the first place should // expect that the transport out info was set correctly, as // it may need to use that info at some point before we get to // this code. faultMessageContext.setProperty(MessageContext.TRANSPORT_OUT, processingContext.getProperty( MessageContext.TRANSPORT_OUT)); faultMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO, processingContext.getProperty( Constants.OUT_TRANSPORT_INFO)); faultMessageContext.setProcessingFault(true); return faultMessageContext; } } // Create a basic response MessageContext with basic fields copied MessageContext faultContext = createResponseMessageContext(processingContext); // Register the fault message context OperationContext operationContext = processingContext.getOperationContext(); if (operationContext != null) { processingContext.getAxisOperation().addFaultMessageContext(faultContext, operationContext); } faultContext.setProcessingFault(true); // Set wsa:Action for response message // Use specified value if available String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null; if (faultAction == null) { AxisOperation op = processingContext.getAxisOperation(); if (op != null && op.getFaultAction() != null) { // TODO: Should the op be able to pick a fault action based on the fault? faultAction = op.getFaultAction(); } else { //If, for some reason there is no value set, should use a sensible action. faultAction = Final.WSA_SOAP_FAULT_ACTION; } } faultContext.setWSAAction(faultAction); // there are some information that the fault thrower wants to pass to the fault path. // Means that the fault is a ws-addressing one hence use the ws-addressing fault action. Object faultInfoForHeaders = processingContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS); if (faultInfoForHeaders != null) { faultContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInfoForHeaders); // Note that this overrides any action set above faultContext.setWSAAction(Final.WSA_FAULT_ACTION); } // if the exception is due to a problem in the faultTo header itself, we can not use that // fault information to send the error. Try to send using replyTo, else leave it to transport boolean shouldSendFaultToFaultTo = AddressingHelper.shouldSendFaultToFaultTo(processingContext); EndpointReference faultTo = processingContext.getFaultTo(); if (faultTo != null && shouldSendFaultToFaultTo) { faultContext.setTo(faultTo); } else { faultContext.setTo(processingContext.getReplyTo()); } if (faultContext.getTo() == null) { faultContext.setTo(new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL)); } // Not worth setting up the session information on a fault flow EndpointReference outboundToEPR = faultContext.getTo(); Object version = faultContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION); if (AddressingConstants.Submission.WSA_NAMESPACE.equals(version) || (outboundToEPR != null && !outboundToEPR.hasAnonymousAddress())) { faultContext.setMessageID(UUIDGenerator.getUUID()); faultContext.setReplyTo(new EndpointReference(AddressingConstants.Final.WSA_NONE_URI)); } // do Target Resolution TargetResolver targetResolver = faultContext.getConfigurationContext() .getAxisConfiguration().getTargetResolverChain(); if (targetResolver != null) { targetResolver.resolveTarget(faultContext); } // Ensure transport settings match the scheme for the To EPR setupCorrectTransportOut(faultContext); SOAPEnvelope envelope = createFaultEnvelope(processingContext, e); faultContext.setEnvelope(envelope); //get the SOAP headers, user is trying to send in the fault // TODO: Rationalize this mechanism a bit - maybe headers should live in the fault? List soapHeadersList = (List) processingContext.getProperty(SOAPConstants.HEADER_LOCAL_NAME); if (soapHeadersList != null) { SOAPHeader soapHeaderElement = envelope.getHeader(); for (int i = 0; i < soapHeadersList.size(); i++) { OMElement soapHeaderBlock = (OMElement) soapHeadersList.get(i); soapHeaderElement.addChild(soapHeaderBlock); } } // TODO: Transport-specific stuff in here? Why? Is there a better way? // now add HTTP Headers faultContext.setProperty(HTTPConstants.HTTP_HEADERS, processingContext.getProperty(HTTPConstants.HTTP_HEADERS)); return faultContext; } /** * Ensure that if the scheme of the To EPR for the response is different than the * transport used for the request that the correct TransportOut is available */ private static void setupCorrectTransportOut(MessageContext context) throws AxisFault { // Determine that we have the correct transport available. TransportOutDescription transportOut = context.getTransportOut(); try { EndpointReference responseEPR = context.getTo(); if (context.isServerSide() && responseEPR != null) { if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) { URI uri = new URI(responseEPR.getAddress()); String scheme = uri.getScheme(); if (!transportOut.getName().equals(scheme)) { ConfigurationContext configurationContext = context.getConfigurationContext(); transportOut = configurationContext.getAxisConfiguration() .getTransportOut(scheme); if (transportOut == null) { throw new AxisFault("Can not find the transport sender : " + scheme); } context.setTransportOut(transportOut); } if (context.getOperationContext() != null) { context.getOperationContext().setProperty( Constants.DIFFERENT_EPR, Constants.VALUE_TRUE); } } } } catch (URISyntaxException urise) { throw AxisFault.makeFault(urise); } } /** * Information to create the SOAPFault can be extracted from different places. * 1. Those information may have been put in to the message context by some handler. When someone * is putting like that, he must make sure the SOAPElements he is putting must be from the * correct SOAP Version. * 2. SOAPProcessingException is flexible enough to carry information about the fault. For example * it has an attribute to store the fault code. The fault reason can be extracted from the * message of the exception. I opted to put the stacktrace under the detail element. * eg : * stack trace goes here * *

        * If those information can not be extracted from any of the above places, I default the soap * fault values to following. * * * env:Receiver * * * unknown * * * * * *

        * -- EC * * @param context * @param e */ private static SOAPEnvelope createFaultEnvelope(MessageContext context, Throwable e) { SOAPEnvelope envelope; if (context.isSOAP11()) { envelope = OMAbstractFactory.getSOAP11Factory().getDefaultFaultEnvelope(); } else { // Following will make SOAP 1.2 as the default, too. envelope = OMAbstractFactory.getSOAP12Factory().getDefaultFaultEnvelope(); } SOAPFault fault = envelope.getBody().getFault(); SOAPProcessingException soapException = null; AxisFault axisFault = null; if (e == null) return envelope; if (e instanceof AxisFault) { axisFault = (AxisFault) e; } else if (e.getCause() instanceof AxisFault) { axisFault = (AxisFault) e.getCause(); } if (axisFault != null) { Iterator iter = axisFault.headerIterator(); while (iter.hasNext()) { SOAPHeaderBlock header = (SOAPHeaderBlock) iter.next(); envelope.getHeader().addChild(header); } } if (e instanceof SOAPProcessingException) { soapException = (SOAPProcessingException) e; } else if (axisFault != null) { if (axisFault.getCause() instanceof SOAPProcessingException) { soapException = (SOAPProcessingException) axisFault.getCause(); } } // user can set the fault information to the message context or to the AxisFault itself. // whatever user sets to the message context, supercedes eerything. Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME); String soapFaultCode = ""; if (faultCode != null) { fault.setCode((SOAPFaultCode) faultCode); } else if (soapException != null) { soapFaultCode = soapException.getFaultCode(); } else if (axisFault != null) { if (axisFault.getFaultCodeElement() != null) { fault.setCode(axisFault.getFaultCodeElement()); } else { QName faultCodeQName = axisFault.getFaultCode(); if (faultCodeQName != null) { if (faultCodeQName.getLocalPart().indexOf(":") == -1) { String prefix = faultCodeQName.getPrefix(); String uri = faultCodeQName.getNamespaceURI(); // Get the specified prefix and uri prefix = prefix == null ? "" : prefix; uri = uri == null || "" .equals(uri) ? fault.getNamespace().getNamespaceURI() : uri; // Make sure the prefix and uri are declared on the fault, and // get the resulting prefix. prefix = fault.declareNamespace(uri, prefix).getPrefix(); soapFaultCode = prefix + ":" + faultCodeQName.getLocalPart(); } else { soapFaultCode = faultCodeQName.getLocalPart(); } } } } // defaulting to fault code Receiver, if no message is available if (faultCode == null && context.getEnvelope() != null) { soapFaultCode = ("".equals(soapFaultCode) || (soapFaultCode == null)) ? SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + context.getEnvelope().getVersion().getReceiverFaultCode().getLocalPart() : soapFaultCode; } if (faultCode == null) { if (context.isSOAP11()) { fault.getCode().setText(soapFaultCode); } else { fault.getCode().getValue().setText(soapFaultCode); } } if (axisFault != null && !context.isSOAP11()) { if (axisFault.getFaultSubCodes() != null) { List faultSubCodes = axisFault.getFaultSubCodes(); QName faultSubCodeQName; for (Iterator subCodeiter = faultSubCodes.iterator(); subCodeiter.hasNext(); ) { faultSubCodeQName = (QName) subCodeiter.next(); SOAPFactory sf = (SOAPFactory)envelope.getOMFactory(); SOAPFaultSubCode soapFaultSubCode = sf.createSOAPFaultSubCode(fault.getCode()); SOAPFaultValue saopFaultValue = sf.createSOAPFaultValue(fault.getCode()); saopFaultValue.setText(faultSubCodeQName); soapFaultSubCode.setValue(saopFaultValue); fault.getCode().setSubCode(soapFaultSubCode); } } } SOAPFaultReason faultReason = (SOAPFaultReason)context.getProperty( SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME); if (faultReason == null && axisFault != null) { faultReason = axisFault.getFaultReasonElement(); } if (faultReason != null) { fault.setReason(faultReason); } else { String message = ""; if (soapException != null) { message = soapException.getMessage(); } else if (axisFault != null) { // Couldn't find FaultReasonElement, try reason string message = axisFault.getReason(); } if (message == null || "".equals(message)) { message = getFaultReasonFromException(e, context); } if (message == null || "".equals(message)) message = "unknown"; if (context.isSOAP11()) { fault.getReason().setText(message); } else { fault.getReason().getFirstSOAPText().setLang("en-US"); fault.getReason().getFirstSOAPText().setText(message); } } Object faultRole = context.getProperty(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME); if (faultRole != null) { fault.getRole().setText((String) faultRole); } else if (axisFault != null) { if (axisFault.getFaultRoleElement() != null) { fault.setRole(axisFault.getFaultRoleElement()); } } Object faultNode = context.getProperty(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME); if (faultNode != null) { SOAPFaultNode soapFaultNode = fault.getNode(); if(soapFaultNode != null) { soapFaultNode.setText((String) faultNode); } } else if (axisFault != null) { if (axisFault.getFaultNodeElement() != null) { fault.setNode(axisFault.getFaultNodeElement()); } } // Allow handlers to override the sendStacktraceDetailsWithFaults setting from the Configuration to allow // WS-* protocol faults to not include the exception. boolean sendStacktraceDetailsWithFaults = false; OperationContext oc = context.getOperationContext(); Object flagFromContext = null; if (oc != null) { flagFromContext = context.getOperationContext() .getProperty(Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS); } if (flagFromContext != null) { sendStacktraceDetailsWithFaults = JavaUtils.isTrue(flagFromContext); } else { Parameter param = context.getParameter( Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS); if (param != null) { sendStacktraceDetailsWithFaults = JavaUtils.isTrue(param.getValue()); } } Object faultDetail = context.getProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME); if (faultDetail != null) { fault.setDetail((SOAPFaultDetail) faultDetail); } else if (axisFault != null) { if (axisFault.getFaultDetailElement() != null) { fault.setDetail(axisFault.getFaultDetailElement()); } else { OMElement detail = axisFault.getDetail(); if (detail != null) { fault.getDetail().addDetailEntry(detail); } else if (sendStacktraceDetailsWithFaults) { fault.setException(axisFault); } } } else if (fault.getException() == null && sendStacktraceDetailsWithFaults) { if (e instanceof Exception) { fault.setException((Exception) e); } else { fault.setException(new Exception(e)); } } return envelope; } /** * By the time the exception comes here it can be wrapped by so many levels. This will crip down * to the root cause and get the initial error depending on the property * * @param e */ private static String getFaultReasonFromException(Throwable e, MessageContext context) { Throwable throwable = e; Parameter param = context.getParameter( Constants.Configuration.DRILL_DOWN_TO_ROOT_CAUSE_FOR_FAULT_REASON); boolean drillDownToRootCauseForFaultReason = param != null && ((String) param.getValue()).equalsIgnoreCase("true"); if (drillDownToRootCauseForFaultReason) { while (throwable.getCause() != null) { throwable = throwable.getCause(); } } return throwable.getMessage(); } private static String getSenderFaultCode(OMNamespace soapNamespace) { return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespace.getNamespaceURI()) ? SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP12Constants.FAULT_CODE_SENDER : SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP11Constants.FAULT_CODE_SENDER; } } ./src/org/apache/axis2/util/WSDL20Util.java0000664000175000017500000001460711767656530017433 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.WSDL20DefaultValueHolder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.transport.http.util.URIEncoderDecoder; import org.apache.woden.wsdl20.extensions.http.HTTPLocation; import org.apache.woden.wsdl20.extensions.http.HTTPLocationTemplate; import org.apache.woden.wsdl20.extensions.soap.SOAPFaultCode; import org.apache.woden.wsdl20.extensions.soap.SOAPFaultSubcodes; import javax.xml.namespace.QName; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.Map; public class WSDL20Util { public static void extractWSDL20SoapFaultInfo(Map options, OMElement bindingMessageElement, OMFactory omFactory, OMNamespace wsoap) { // Fault specific properties SOAPFaultCode faultCode = (SOAPFaultCode) options .get(WSDL2Constants.ATTR_WSOAP_CODE); if (faultCode != null && faultCode.getQName() != null) { bindingMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_CODE, wsoap, faultCode.getQName().getLocalPart())); } SOAPFaultSubcodes soapFaultSubcodes = (SOAPFaultSubcodes) options .get(WSDL2Constants.ATTR_WSOAP_SUBCODES); QName faultCodes[]; if (soapFaultSubcodes != null && (faultCodes = soapFaultSubcodes.getQNames()) != null) { for (int i = 0; i < faultCodes.length; i++) { bindingMessageElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_SUBCODES, wsoap, faultCodes[0].getLocalPart())); } } } /** * This method is used to resolve httplocation property. It changes the URL as stipulated by * the httplocation property. * * @param messageContext - The MessageContext of the request * @param rawURLString - The raw URL containing httplocation templates * @param detach - Boolean value specifying whether the element should be detached from the * envelop. When serializing data as application/x-form-urlencoded what goes in the body is the * remainder and therefore we should detach the element from the envelop. * @return - String with templated values replaced * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs */ public static String applyURITemplating(MessageContext messageContext, String rawURLString, boolean detach) throws AxisFault { OMElement firstElement; if (detach) { firstElement = messageContext.getEnvelope().getBody().getFirstElement(); } else { firstElement = messageContext.getEnvelope().getBody().getFirstElement().cloneOMElement(); } String queryParameterSeparator = (String) messageContext.getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); if (queryParameterSeparator == null) { queryParameterSeparator = WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT; } HTTPLocation httpLocation = new HTTPLocation(rawURLString); HTTPLocationTemplate[] templates = httpLocation.getTemplates(); for (int i = 0; i < templates.length; i++) { HTTPLocationTemplate template = templates[i]; String localName = template.getName(); String elementValue = getOMElementValue(localName, firstElement); if (template.isEncoded()) { try { if (template.isQuery()) { template.setValue(URIEncoderDecoder.quoteIllegal( elementValue, WSDL2Constants.LEGAL_CHARACTERS_IN_QUERY.replaceAll(queryParameterSeparator, ""))); } else { template.setValue(URIEncoderDecoder.quoteIllegal( elementValue, WSDL2Constants.LEGAL_CHARACTERS_IN_PATH)); } } catch (UnsupportedEncodingException e) { throw new AxisFault("Unable to encode Query String"); } } else { template.setValue(elementValue); } } return httpLocation.getFormattedLocation(); } /** * This method is used to retrive elements from the soap envelop * * @param elementName - The name of the required element * @param parentElement - The parent element that the required element should be retrived from * @return - The value of the element as a string */ private static String getOMElementValue(String elementName, OMElement parentElement) { OMElement httpURLParam = null; Iterator children = parentElement.getChildElements(); while (children.hasNext()) { OMElement child = (OMElement) children.next(); QName qName = child.getQName(); if (elementName.equals(qName.getLocalPart())) { httpURLParam = child; break; } } if (httpURLParam != null) { httpURLParam.detach(); if (parentElement.getFirstOMChild() == null) { parentElement.detach(); } return httpURLParam.getText(); } return ""; } } ./src/org/apache/axis2/util/Base64.java0000664000175000017500000000163111767656530016677 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; /** * @deprecated */ public class Base64 extends org.apache.axiom.om.util.Base64 { }./src/org/apache/axis2/util/ThreadContextMigratorUtil.java0000664000175000017500000001743311767656530023001 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; /** * This is a utility class to make it easier/cleaner for user programming * model-level implementations (e.g. the Axis2 JAX-WS code) to invoke the * ThreadContextMigrators. */ public class ThreadContextMigratorUtil { /** * Register a new ThreadContextMigrator. * * @param configurationContext * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param migrator */ public static void addThreadContextMigrator(ConfigurationContext configurationContext, String threadContextMigratorListID, ThreadContextMigrator migrator) throws AxisFault { AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration(); addThreadContextMigrator(axisConfiguration, threadContextMigratorListID, migrator); } /** * Register a new ThreadContextMigrator. * * @param axisConfiguration * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param migrator */ public static void addThreadContextMigrator(AxisConfiguration axisConfiguration, String threadContextMigratorListID, ThreadContextMigrator migrator) throws AxisFault { Parameter param = axisConfiguration.getParameter(threadContextMigratorListID); if (param == null) { param = new Parameter(threadContextMigratorListID, new LinkedList()); axisConfiguration.addParameter(param); } List migratorList = (List) param.getValue(); migratorList.add(migrator); } /** * Activate any registered ThreadContextMigrators to move context info * to the thread of execution. * * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param msgContext * @throws AxisFault */ public static void performMigrationToThread(String threadContextMigratorListID, MessageContext msgContext) throws AxisFault { if (msgContext == null) { return; } AxisConfiguration axisConfiguration = msgContext.getConfigurationContext().getAxisConfiguration(); Parameter param = axisConfiguration.getParameter(threadContextMigratorListID); if (param != null) { List migratorList = (List) param.getValue(); ListIterator threadContextMigrators = migratorList.listIterator(); while (threadContextMigrators.hasNext()) { ((ThreadContextMigrator) threadContextMigrators.next()) .migrateContextToThread(msgContext); } } } /** * Activate any registered ThreadContextMigrators to remove information * from the thread of execution if necessary. * * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param msgContext */ public static void performThreadCleanup(String threadContextMigratorListID, MessageContext msgContext) { if (msgContext == null) { return; } AxisConfiguration axisConfiguration = msgContext.getConfigurationContext().getAxisConfiguration(); Parameter param = axisConfiguration.getParameter(threadContextMigratorListID); if (param != null) { List migratorList = (List) param.getValue(); ListIterator threadContextMigrators = migratorList.listIterator(); while (threadContextMigrators.hasNext()) { ((ThreadContextMigrator) threadContextMigrators.next()).cleanupThread(msgContext); } } } /** * Activate any registered ThreadContextMigrators to move info from the * thread of execution into the context. * * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param msgContext * @throws AxisFault */ public static void performMigrationToContext(String threadContextMigratorListID, MessageContext msgContext) throws AxisFault { if (msgContext == null) { return; } AxisConfiguration axisConfiguration = msgContext.getConfigurationContext().getAxisConfiguration(); Parameter param = axisConfiguration.getParameter(threadContextMigratorListID); if (param != null) { List migratorList = (List) param.getValue(); ListIterator threadContextMigrators = migratorList.listIterator(); while (threadContextMigrators.hasNext()) { ((ThreadContextMigrator) threadContextMigrators.next()) .migrateThreadToContext(msgContext); } } } /** * Activate any registered ThreadContextMigrators to remove information from * the context if necessary. * * @param threadContextMigratorListID The name of the parameter in the * AxisConfiguration that contains * the list of migrators. * @param msgContext */ public static void performContextCleanup(String threadContextMigratorListID, MessageContext msgContext) { if (msgContext == null) { return; } AxisConfiguration axisConfiguration = msgContext.getConfigurationContext().getAxisConfiguration(); Parameter param = axisConfiguration.getParameter(threadContextMigratorListID); if (param != null) { List migratorList = (List) param.getValue(); ListIterator threadContextMigrators = migratorList.listIterator(); while (threadContextMigrators.hasNext()) { ((ThreadContextMigrator) threadContextMigrators.next()).cleanupContext(msgContext); } } } } ./src/org/apache/axis2/util/MetaDataEntry.java0000664000175000017500000002076211767656530020363 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.context.externalize.SafeSerializable; import javax.xml.namespace.QName; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; /** * An internal class for holding a set of information * about an object. */ public class MetaDataEntry implements Externalizable, SafeSerializable { // serialization identifier private static final long serialVersionUID = 8978361069526299875L; // supported revision levels, add a new level to manage compatible changes private static final int REVISION_2 = 2; // current revision level of this object private static final int revisionID = REVISION_2; // data to keep on an object private String className = null; private String qnameAsString = null; private String extraName = null; // list of MetaDataEntry objects that are owned by the // original object referred to by this MetaDataEntry private ArrayList children = null; // marker to indicate end-of-list public static String END_OF_LIST = "LAST_ENTRY"; /** * Simple constructor */ public MetaDataEntry() { } /** * Constructor * @param className name of the object class * @param qnameAsString an expanded version of the QName of this object */ public MetaDataEntry(String className, String qnameAsString) { this.className = className; this.qnameAsString = qnameAsString; } /** * Constructor * @param className name of the object class * @param qnameAsString an expanded version of the QName of this object * @param extraName an additional name associated withe the object */ public MetaDataEntry(String className, String qnameAsString, String extraName) { this.className = className; this.qnameAsString = qnameAsString; this.extraName = extraName; } /** * Constructor * @param className name of the object class * @param qnameAsString an expanded version of the QName of this object * @param children an ArrayList containing MetaDataEntries for owned objects */ public MetaDataEntry(String className, String qnameAsString, ArrayList children) { this.className = className; this.qnameAsString = qnameAsString; this.children = children; } /** * Get the class name * * @return the class name string */ public String getClassName() { return className; } /** * Set the class name * * @param c the class name string */ public void setClassName(String c) { className = c; } /** * Get the QName * * @return the QName based on the qnameAsString value */ public QName getQName() { if (qnameAsString != null) { return QName.valueOf(qnameAsString); } else { return null; } } /** * Set the QName * * @param q the QName */ public void setQName(QName q) { if (q != null) { qnameAsString = q.toString(); } else { qnameAsString = null; } } /** * Set the QName * * @param n the QName as a string */ public void setQName(String n) { qnameAsString = n; } /** * Get the QName as a string * * @return the QName as a string */ public String getQNameAsString() { return qnameAsString; } /** * This is a convenience method. * Returns the string that is used as a name. * * @return the name */ public String getName() { return qnameAsString; } /** * Get the additional name associated with the object * * @return the additional name string */ public String getExtraName() { return extraName; } /** * Set the additional name associated with the object * * @param e the extra name string */ public void setExtraName(String e) { extraName = e; } /** * Indicates whether the list is empty or not * * @return false for a non-empty list, true for an empty list */ public boolean isListEmpty() { return children == null || children.isEmpty(); } /** * Get the list * * @return the array list */ public ArrayList getChildren() { return children; } /** * Set the list * * @param L the ArrayList of MetaDataEntry objects */ public void setChildren(ArrayList L) { children = L; } /** * Add to the list * * @param e the MetaDataEntry object to add to the list */ public void addToList(MetaDataEntry e) { if (children == null) { children = new ArrayList(); } children.add(e); } /** * Remove the list */ public void removeList() { children = null; } // message strings private static final String UNSUPPORTED_SUID = "Serialization version ID is not supported."; private static final String UNSUPPORTED_REVID = "Revision ID is not supported."; /** * Save the contents of this object * * @param out The stream to write the object contents to * @throws IOException */ public void writeExternal(ObjectOutput o) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); // write out contents of this object //--------------------------------------------------------- // in order to handle future changes to the message // context definition, be sure to maintain the // object level identifiers //--------------------------------------------------------- // serialization version ID out.writeLong(serialVersionUID); // revision ID out.writeInt(revisionID); //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- out.writeObject(className); out.writeObject(qnameAsString); out.writeObject(extraName); out.writeList(children); } /** * Restore the contents of the object that was * previously saved. *

        * NOTE: The field data must read back in the same order and type * as it was written. * * @param in The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- className = (String) in.readObject(); qnameAsString = (String) in.readObject(); extraName = (String) in.readObject(); children = in.readArrayList(); } } ./src/org/apache/axis2/util/XMLUtils.java0000664000175000017500000005410111767656530017334 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import com.ibm.wsdl.Constants; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.Base64; import org.apache.axiom.om.util.StAXUtils; import org.w3c.dom.Attr; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.net.URLConnection; import java.util.Stack; public class XMLUtils { public static final String charEncoding = "ISO-8859-1"; private static final String saxParserFactoryProperty = "javax.xml.parsers.SAXParserFactory"; private static DocumentBuilderFactory dbf = getDOMFactory(); private static SAXParserFactory saxFactory; private static Stack saxParsers = new Stack(); private static String empty = ""; private static ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes()); static { // Initialize SAX Parser factory defaults initSAXFactory(null, true, false); } /** * Initializes the SAX parser factory. * * @param factoryClassName The (optional) class name of the desired * SAXParserFactory implementation. Will be * assigned to the system property * javax.xml.parsers.SAXParserFactory * unless this property is already set. * If null, leaves current setting * alone. * @param namespaceAware true if we want a namespace-aware parser * @param validating true if we want a validating parser */ public static void initSAXFactory(String factoryClassName, boolean namespaceAware, boolean validating) { if (factoryClassName != null) { try { saxFactory = (SAXParserFactory) Loader.loadClass(factoryClassName). newInstance(); /* * Set the system property only if it is not already set to * avoid corrupting environments in which Axis is embedded. */ if (System.getProperty(saxParserFactoryProperty) == null) { System.setProperty(saxParserFactoryProperty, factoryClassName); } } catch (Exception e) { saxFactory = SAXParserFactory.newInstance(); } } else { saxFactory = SAXParserFactory.newInstance(); } saxFactory.setNamespaceAware(namespaceAware); saxFactory.setValidating(validating); // Discard existing parsers saxParsers.clear(); } private static DocumentBuilderFactory getDOMFactory() { DocumentBuilderFactory dbf; try { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } catch (Exception e) { //log.error(Messages.getMessage("exception00"), e ); dbf = null; } return (dbf); } private static boolean tryReset = true; /** * Returns a SAX parser for reuse. * * @param parser A SAX parser that is available for reuse */ public static void releaseSAXParser(SAXParser parser) { if (!tryReset) { return; } //Free up possible ref. held by past contenthandler. try { XMLReader xmlReader = parser.getXMLReader(); if (null != xmlReader) { synchronized (XMLUtils.class) { saxParsers.push(parser); } } else { tryReset = false; } } catch (org.xml.sax.SAXException e) { tryReset = false; } } /** * Gets an empty new Document. * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur */ public static Document newDocument() throws ParserConfigurationException { synchronized (dbf) { return dbf.newDocumentBuilder().newDocument(); } } /** * Gets a new Document read from the input source. * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputSource inp) throws ParserConfigurationException, SAXException, IOException { DocumentBuilder db; synchronized (dbf) { try { db = dbf.newDocumentBuilder(); } catch (Exception e){ // Under some peculiar conditions (classloader issues), just scrap the old dbf, create a new one and try again. dbf = getDOMFactory(); db = dbf.newDocumentBuilder(); } } db.setEntityResolver(new DefaultEntityResolver()); db.setErrorHandler(new ParserErrorHandler()); return (db.parse(inp)); } /** * Gets a new Document read from the input stream * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException { return XMLUtils.newDocument(new InputSource(inp)); } /** * Gets a new Document read from the indicated uri * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException { // call the authenticated version as there might be // username/password info embeded in the uri. return XMLUtils.newDocument(uri, null, null); } /** * Creates a new document from the given URI. Uses the username and password * if the URI requires authentication. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException { InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password); Document doc = XMLUtils.newDocument(ins); // Close the Stream if (ins.getByteStream() != null) { ins.getByteStream().close(); } else if (ins.getCharacterStream() != null) { ins.getCharacterStream().close(); } return doc; } public static String getPrefix(String uri, Node e) { while (e != null && (e.getNodeType() == Element.ELEMENT_NODE)) { NamedNodeMap attrs = e.getAttributes(); for (int n = 0; n < attrs.getLength(); n++) { Attr a = (Attr) attrs.item(n); String name; if ((name = a.getName()).startsWith("xmlns:") && a.getNodeValue().equals(uri)) { return name.substring(6); } } e = e.getParentNode(); } return null; } public static String getNamespace(String prefix, Node e) { while (e != null && (e.getNodeType() == Node.ELEMENT_NODE)) { Attr attr = ((Element) e).getAttributeNodeNS(Constants.NS_URI_XMLNS, prefix); if (attr != null) { return attr.getValue(); } e = e.getParentNode(); } return null; } /** * Returns a QName when passed a string like "foo:bar" by mapping * the "foo" prefix to a namespace in the context of the given Node. * * @return Returns a QName generated from the given string representation. */ public static QName getQNameFromString(String str, Node e) { if (str == null || e == null) { return null; } int idx = str.indexOf(':'); if (idx > -1) { String prefix = str.substring(0, idx); String ns = getNamespace(prefix, e); if (ns == null) { return null; } return new QName(ns, str.substring(idx + 1)); } else { return new QName("", str); } } /** * Returns a string for a particular QName, mapping a new prefix * if necessary. */ public static String getStringForQName(QName qname, Element e) { String uri = qname.getNamespaceURI(); String prefix = getPrefix(uri, e); if (prefix == null) { int i = 1; prefix = "ns" + i; while (getNamespace(prefix, e) != null) { i++; prefix = "ns" + i; } e.setAttributeNS(Constants.NS_URI_XMLNS, "xmlns:" + prefix, uri); } return prefix + ":" + qname.getLocalPart(); } /** * Concatinates all the text and cdata node children of this elem and returns * the resulting text. * (by Matt Duftler) * * @param parentEl the element whose cdata/text node values are to * be combined. * @return Returns the concatinated string. */ public static String getChildCharacterData(Element parentEl) { if (parentEl == null) { return null; } Node tempNode = parentEl.getFirstChild(); StringBuffer strBuf = new StringBuffer(); CharacterData charData; while (tempNode != null) { switch (tempNode.getNodeType()) { case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE: charData = (CharacterData) tempNode; strBuf.append(charData.getData()); break; } tempNode = tempNode.getNextSibling(); } return strBuf.toString(); } public static class ParserErrorHandler implements ErrorHandler { /** * Returns a string describing parse exception details */ private String getParseExceptionInfo(SAXParseException spe) { String systemId = spe.getSystemId(); if (systemId == null) { systemId = "null"; } return "URI=" + systemId + " Line=" + spe.getLineNumber() + ": " + spe.getMessage(); } // The following methods are standard SAX ErrorHandler methods. // See SAX documentation for more info. public void warning(SAXParseException spe) throws SAXException { } public void error(SAXParseException spe) throws SAXException { String message = "Error: " + getParseExceptionInfo(spe); throw new SAXException(message); } public void fatalError(SAXParseException spe) throws SAXException { String message = "Fatal Error: " + getParseExceptionInfo(spe); throw new SAXException(message); } } /** * Utility to get the bytes uri. * Does NOT handle authenticated URLs, * use getInputSourceFromURI(uri, username, password) * * @param uri the resource to get */ public static InputSource getInputSourceFromURI(String uri) { return new InputSource(uri); } /** * Utility to get the bytes at a protected uri *

        * Retrieves the URL if a username and password are provided. * The java.net.URL class does not do Basic Authentication, so we have to * do it manually in this routine. *

        * If no username is provided, creates an InputSource from the uri * and lets the InputSource go fetch the contents. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password */ private static InputSource getInputSourceFromURI(String uri, String username, String password) throws IOException, ProtocolException, UnsupportedEncodingException { URL wsdlurl = null; try { wsdlurl = new URL(uri); } catch (MalformedURLException e) { // we can't process it, it might be a 'simple' foo.wsdl // let InputSource deal with it return new InputSource(uri); } // if no authentication, just let InputSource deal with it if (username == null && wsdlurl.getUserInfo() == null) { return new InputSource(uri); } // if this is not an HTTP{S} url, let InputSource deal with it if (!wsdlurl.getProtocol().startsWith("http")) { return new InputSource(uri); } URLConnection connection = wsdlurl.openConnection(); // Does this work for https??? if (!(connection instanceof HttpURLConnection)) { // can't do http with this URL, let InputSource deal with it return new InputSource(uri); } HttpURLConnection uconn = (HttpURLConnection) connection; String userinfo = wsdlurl.getUserInfo(); uconn.setRequestMethod("GET"); uconn.setAllowUserInteraction(false); uconn.setDefaultUseCaches(false); uconn.setDoInput(true); uconn.setDoOutput(false); uconn.setInstanceFollowRedirects(true); uconn.setUseCaches(false); // username/password info in the URL overrides passed in values String auth = null; if (userinfo != null) { auth = userinfo; } else if (username != null) { auth = (password == null) ? username : username + ":" + password; } if (auth != null) { uconn.setRequestProperty("Authorization", "Basic " + base64encode(auth.getBytes(charEncoding))); } uconn.connect(); return new InputSource(uconn.getInputStream()); } public static String base64encode(byte[] bytes) { return Base64.encode(bytes); } public static InputSource getEmptyInputSource() { return new InputSource(bais); } /** * Finds a Node with a given QNameb. * * @param node parent node * @param name QName of the child we need to find * @return Returns child node. */ public static Node findNode(Node node, QName name) { if (name.getNamespaceURI().equals(node.getNamespaceURI()) && name.getLocalPart().equals(node.getLocalName())) { return node; } NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node ret = findNode(children.item(i), name); if (ret != null) { return ret; } } return null; } /** * Convert DOM Element into a fully built OMElement * @param element dom Element * @return OMElement * @throws Exception */ public static OMElement toOM(Element element) throws Exception { return toOM(element, true); } /** * Convert DOM Element into a fully built OMElement * @param element * @param buildAll if true, full OM tree is immediately built. if false, caller is responsible * for building the tree and closing the parser. * @return * @throws Exception */ public static OMElement toOM(Element element, boolean buildAll) throws Exception { Source source = new DOMSource(element); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Result result = new StreamResult(baos); Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(source, result); ByteArrayInputStream is = new ByteArrayInputStream(baos.toByteArray()); XMLStreamReader reader = StAXUtils .createXMLStreamReader(is); StAXOMBuilder builder = new StAXOMBuilder(reader); builder.setCache(true); builder.releaseParserOnClose(true); OMElement omElement = builder.getDocumentElement(); if (buildAll) { omElement.build(); builder.close(); } return omElement; } /** * Converts a given OMElement to a DOM Element. * * @param element * @return Returns Element. * @throws Exception */ public static Element toDOM(OMElement element) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); element.serialize(baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); return factory.newDocumentBuilder().parse(bais).getDocumentElement(); } /** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built. * * @param inputStream * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream) throws XMLStreamException { return toOM(inputStream, true); } /** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param inputStream * @param buildAll * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream, boolean buildAll) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils .createXMLStreamReader(inputStream); OMFactory fac = OMAbstractFactory.getOMFactory(); StAXOMBuilder builder = new StAXOMBuilder(fac, xmlReader); builder.setCache(true); builder.releaseParserOnClose(true); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; } /** * Converts a given Reader to an OMNode. * The reurned OMNode is fully built. * * @param reader * @return * @throws XMLStreamException */ public static OMNode toOM(Reader reader) throws XMLStreamException { return toOM(reader, true); } /** * Converts a given Reader to an OMNode. * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param reader * @param buildAll * @return OMNode * @throws XMLStreamException */ public static OMNode toOM(Reader reader, boolean buildAll) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils .createXMLStreamReader(reader); OMFactory fac = OMAbstractFactory.getOMFactory(); StAXOMBuilder builder = new StAXOMBuilder(fac, xmlReader); builder.setCache(true); builder.releaseParserOnClose(true); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; } } ./src/org/apache/axis2/util/WSDLSerializationUtil.java0000664000175000017500000006603711767656530022033 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.PolicySubject; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.namespace.Constants; import org.apache.axis2.wsdl.HTTPHeaderMessage; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.SOAPModuleMessage; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyReference; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * Helps the AxisService to WSDL process */ public class WSDLSerializationUtil { public static final String CDATA_START = ""; public static final String CDATA_END_REGEX = "\\]\\]>"; /** * Given a namespace it returns the prefix for that namespace * @param namespace - The namespace that the prefix is needed for * @param nameSpaceMap - The namespaceMap * @return - The prefix of the namespace */ public static String getPrefix(String namespace, Map nameSpaceMap) { Set keySet; if (nameSpaceMap != null && (keySet = nameSpaceMap.keySet()) != null) { Iterator keys = keySet.iterator(); while (keys.hasNext()) { String key = (String) keys.next(); if (nameSpaceMap.get(key).equals(namespace)) { return key; } } } return null; } /** * Gets the correct element name for a given message * @param axisMessage - The axisMessage * @param nameSpaceMap - The namespaceMap * @return - The element name */ public static String getElementName(AxisMessage axisMessage, Map nameSpaceMap) { QName elementQName = axisMessage.getElementQName(); if (elementQName == null) { return WSDL2Constants.NMTOKEN_NONE; } else if (Constants.XSD_ANY.equals(elementQName)) { return WSDL2Constants.NMTOKEN_ANY; } else { String prefix = WSDLSerializationUtil.getPrefix(elementQName.getNamespaceURI(), nameSpaceMap); return prefix + ":" + elementQName.getLocalPart(); } } /** * Adds a soap header element to a given OMElement * @param omFactory - An OMFactory * @param list - The arraylist of soapHeaderMessages * @param wsoap - The WSDL 2.0 SOAP namespace * @param element - The element that the header should be added to * @param nameSpaceMap - The namespaceMap */ public static void addSOAPHeaderElements(OMFactory omFactory, ArrayList list, OMNamespace wsoap, OMElement element, Map nameSpaceMap) { for (int i = 0; i < list.size(); i++) { SOAPHeaderMessage soapHeaderMessage = (SOAPHeaderMessage) list.get(i); OMElement soapHeaderElement = omFactory.createOMElement(WSDL2Constants.ATTRIBUTE_HEADER, wsoap); QName qName = soapHeaderMessage.getElement(); soapHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_ELEMENT, null, getPrefix(qName.getNamespaceURI(), nameSpaceMap) + ":" + qName.getLocalPart())); soapHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND, null, Boolean.toString(soapHeaderMessage.isMustUnderstand()))); soapHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_REQUIRED, null, Boolean.toString(soapHeaderMessage.isRequired()))); element.addChild(soapHeaderElement); } } /** * Adds a soap module element to a given OMElement * @param omFactory - An OMFactory * @param list - The arraylist of soapModuleMessages * @param wsoap - The WSDL 2.0 SOAP namespace * @param element - The element that the header should be added to */ public static void addSOAPModuleElements(OMFactory omFactory, ArrayList list, OMNamespace wsoap, OMElement element) { for (int i = 0; i < list.size(); i++) { SOAPModuleMessage soapModuleMessage = (SOAPModuleMessage) list.get(i); OMElement soapModuleElement = omFactory.createOMElement(WSDL2Constants.ATTRIBUTE_MODULE, wsoap); soapModuleElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_REF, null, soapModuleMessage.getUri())); element.addChild(soapModuleElement); } } /** * Adds a HTTP header element to a given OMElement * @param omFactory - An OMFactory * @param list - The arraylist of HTTPHeaderMessages * @param whttp - The WSDL 2.0 HTTP namespace * @param element - The element that the header should be added to * @param nameSpaceMap - The namespaceMap */ public static void addHTTPHeaderElements(OMFactory omFactory, ArrayList list, OMNamespace whttp, OMElement element, Map nameSpaceMap) { for (int i = 0; i < list.size(); i++) { HTTPHeaderMessage httpHeaderMessage = (HTTPHeaderMessage) list.get(i); OMElement httpHeaderElement = omFactory.createOMElement(WSDL2Constants.ATTRIBUTE_HEADER, whttp); httpHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME, null, httpHeaderMessage.getName())); QName qName = httpHeaderMessage.getqName(); httpHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_TYPE, null, getPrefix(qName.getNamespaceURI(), nameSpaceMap) + ":" + qName.getLocalPart())); httpHeaderElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_REQUIRED, null, Boolean.valueOf(httpHeaderMessage.isRequired()).toString())); element.addChild(httpHeaderElement); } } /** * Generates a default SOAP 11 Binding for a given AxisService * @param fac - The OMFactory * @param axisService - The AxisService * @param wsdl the WSDL namespace * @param wsoap - The WSDL 2.0 SOAP namespace * @param tns - The target namespace * @return - The generated SOAP11Binding element */ public static OMElement generateSOAP11Binding(OMFactory fac, AxisService axisService, OMNamespace wsdl, OMNamespace wsoap, OMNamespace tns, String serviceName) { OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl); binding.addAttribute( fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, serviceName + Java2WSDLConstants.BINDING_NAME_SUFFIX)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns .getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_SOAP)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_VERSION, wsoap, WSDL2Constants.SOAP_VERSION_1_1)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_PROTOCOL, wsoap, WSDL2Constants.HTTP_PROTOCAL)); generateDefaultSOAPBindingOperations(axisService, fac, binding, wsdl, tns, wsoap); return binding; } /** * Generates a default SOAP 12 Binding for a given AxisService * @param fac - The OMFactory * @param axisService - The AxisService * @param wsdl the WSDL namespace * @param wsoap - The WSDL 2.0 SOAP namespace * @param tns - The target namespace * @return - The generated SOAP12Binding element */ public static OMElement generateSOAP12Binding(OMFactory fac, AxisService axisService, OMNamespace wsdl, OMNamespace wsoap, OMNamespace tns, String serviceName) { OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl); binding.addAttribute( fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, serviceName + Java2WSDLConstants.SOAP12BINDING_NAME_SUFFIX)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns .getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_SOAP)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_VERSION, wsoap, WSDL2Constants.SOAP_VERSION_1_2)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_PROTOCOL, wsoap, WSDL2Constants.HTTP_PROTOCAL)); generateDefaultSOAPBindingOperations(axisService, fac, binding, wsdl, tns, wsoap); return binding; } /** * Generates a default HTTP Binding for a given AxisService * @param fac - The OMFactory * @param axisService - The AxisService * @param wsdl the WSDL namespace * @param whttp - The WSDL 2.0 HTTP namespace * @param tns - The target namespace * @return - The generated HTTPBinding element */ public static OMElement generateHTTPBinding(OMFactory fac, AxisService axisService, OMNamespace wsdl, OMNamespace whttp, OMNamespace tns, String serviceName) { OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl); binding.addAttribute( fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, serviceName + Java2WSDLConstants.HTTP_BINDING)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns .getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME)); binding.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_HTTP)); Iterator iterator = axisService.getChildren(); while (iterator.hasNext()) { AxisOperation axisOperation = (AxisOperation) iterator.next(); OMElement opElement = fac.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl); binding.addChild(opElement); String name = axisOperation.getName().getLocalPart(); opElement.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + name)); opElement.addAttribute(fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_LOCATION, whttp, name)); } return binding; } private static void generateDefaultSOAPBindingOperations(AxisService axisService, OMFactory omFactory, OMElement binding, OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap) { Iterator iterator = axisService.getChildren(); while (iterator.hasNext()) { AxisOperation axisOperation = (AxisOperation) iterator.next(); if (axisOperation.isControlOperation()) { continue; } OMElement opElement = omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl); binding.addChild(opElement); String name = axisOperation.getName().getLocalPart(); opElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + name)); String soapAction = axisOperation.getSoapAction(); if (soapAction != null) { opElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ACTION, wsoap, soapAction)); } } } /** * Generates a default service element * @param omFactory - The OMFactory * @param wsdl the WSDL namespace * @param tns - The targetnamespace * @param axisService - The AxisService * @param disableREST only generate REST endpoint if this is false * @param disableSOAP12 only generate SOAP 1.2 endpoint if this is false * @return - The generated service element * @throws AxisFault - Thrown in case an exception occurs */ public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl, OMNamespace tns, AxisService axisService, boolean disableREST, boolean disableSOAP12, String serviceName) throws AxisFault { return generateServiceElement(omFactory, wsdl, tns, axisService, disableREST, disableSOAP12, null, serviceName); } /** * Generates a default service element * @param omFactory - The OMFactory * @param wsdl the WSDL namespace * @param tns - The targetnamespace * @param axisService - The AxisService * @param disableREST only generate REST endpoint if this is false * @param disableSOAP12 only generate SOAP 1.2 endpoint if this is false * @return - The generated service element * @throws AxisFault - Thrown in case an exception occurs */ public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl, OMNamespace tns, AxisService axisService, boolean disableREST, boolean disableSOAP12, String[] eprs, String serviceName) throws AxisFault { if(eprs == null){ eprs = axisService.getEPRs(); if (eprs == null) { eprs = new String[]{serviceName}; } } OMElement serviceElement; serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl); serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, serviceName)); serviceElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.INTERFACE_LOCAL_NAME, null, tns.getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME)); for (int i = 0; i < eprs.length; i++) { String name = ""; String epr = eprs[i]; if (epr.startsWith("https://")) { name = WSDL2Constants.DEFAULT_HTTPS_PREFIX; } OMElement soap11EndpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); soap11EndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME, null, name + WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME)); soap11EndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + serviceName + Java2WSDLConstants.BINDING_NAME_SUFFIX)); soap11EndpointElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); serviceElement.addChild(soap11EndpointElement); OMElement soap12EndpointElement = null; if (!disableSOAP12) { soap12EndpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); soap12EndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME, null, name + WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME)); soap12EndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + serviceName + Java2WSDLConstants.SOAP12BINDING_NAME_SUFFIX)); soap12EndpointElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); serviceElement.addChild(soap12EndpointElement); } OMElement httpEndpointElement = null; if (!disableREST) { httpEndpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); httpEndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.ATTRIBUTE_NAME, null, name + WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME)); httpEndpointElement.addAttribute(omFactory.createOMAttribute( WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + serviceName + Java2WSDLConstants .HTTP_BINDING)); httpEndpointElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); serviceElement.addChild(httpEndpointElement); } if (epr.startsWith("https://")) { OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTPS"); soap11EndpointElement.addChild(soap11Documentation); if (!disableSOAP12) { OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTPS"); soap12EndpointElement.addChild(soap12Documentation); } if (!disableREST) { OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTPS"); httpEndpointElement.addChild(httpDocumentation); } } else if (epr.startsWith("http://")) { OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTP"); soap11EndpointElement.addChild(soap11Documentation); if (!disableSOAP12) { OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTP"); soap12EndpointElement.addChild(soap12Documentation); } if (!disableREST) { OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTP"); httpEndpointElement.addChild(httpDocumentation); } } } return serviceElement; } /** * Adds the namespaces to the given OMElement * * @param descriptionElement - The OMElement that the namespaces should be added to * @param nameSpaceMap - The namespaceMap */ public static void populateNamespaces(OMElement descriptionElement, Map nameSpaceMap) { if (nameSpaceMap != null) { Iterator keys = nameSpaceMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); if ("".equals(key)) { descriptionElement.declareDefaultNamespace((String) nameSpaceMap.get(key)); } else { descriptionElement.declareNamespace((String) nameSpaceMap.get(key), key); } } } } public static void addWSAWActionAttribute(OMElement element, String action , OMNamespace wsaw) { if (action == null || action.length() == 0 || "\\\"\\\"".equals(action)) { return; } element.addAttribute("Action", action, wsaw); } public static void addExtensionElement(OMFactory fac, OMElement element, String name, String att1Name, String att1Value, OMNamespace soapNameSpace) { OMElement extElement = fac.createOMElement(name, soapNameSpace); element.addChild(extElement); extElement.addAttribute(att1Name, att1Value, null); } public static void addWSAddressingToBinding(String addressingFlag, OMFactory omFactory, OMElement bindingElement , OMNamespace wsaw) { // Add WS-Addressing UsingAddressing element if appropriate // SHOULD be on the binding element per the specification if (addressingFlag.equals(AddressingConstants.ADDRESSING_OPTIONAL)) { WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement, AddressingConstants.USING_ADDRESSING, "required", "true", wsaw); } else if (addressingFlag.equals(AddressingConstants.ADDRESSING_REQUIRED)) { WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement, AddressingConstants.USING_ADDRESSING, "required", "true", wsaw); } } public static void addWSDLDocumentationElement(AxisDescription axisDescription, OMElement omElement, OMFactory omFactory, OMNamespace wsdl) { OMNode documentationNode = axisDescription.getDocumentationNode(); OMElement documentation; if (documentationNode != null) { documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); documentation.addChild(documentationNode); omElement.addChild(documentation); } } public static void addPoliciesAsExtensibleElement( AxisDescription description, OMElement descriptionElement) { PolicySubject policySubject = description.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents(); ArrayList policies = new ArrayList(); for (Iterator iterator = attachPolicyComponents.iterator(); iterator .hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { policies.add(policyElement); } else if (policyElement instanceof PolicyReference) { String key = ((PolicyReference) policyElement).getURI(); if (key.startsWith("#")) { key = key.substring(key.indexOf("#") + 1); } AxisService service = getAxisService(description); PolicyLocator locator = new PolicyLocator(service); Policy p = locator.lookup(key); if (p == null) { throw new RuntimeException("Policy not found for uri : " + key); } policies.add(p); } } ExternalPolicySerializer filter = null; if (!policies.isEmpty()) { filter = new ExternalPolicySerializer(); AxisConfiguration axisConfiguration = description .getAxisConfiguration(); if (axisConfiguration != null) { filter.setAssertionsToFilter(axisConfiguration .getLocalPolicyAssertions()); } } for (Iterator iterator = policies.iterator(); iterator.hasNext();) { Policy policy = (Policy) iterator.next(); OMElement policyElement; try { policyElement = PolicyUtil.getPolicyComponentAsOMElement( policy, filter); } catch (Exception ex) { throw new RuntimeException(ex); } OMNode firstChild = descriptionElement.getFirstOMChild(); if (firstChild != null) { firstChild.insertSiblingBefore(policyElement); } else { descriptionElement.addChild(policyElement); } } } private static AxisService getAxisService(AxisDescription description) { if (description == null || description instanceof AxisService) { return (AxisService) description; } else { return getAxisService(description.getParent()); } } } ./src/org/apache/axis2/util/PolicyUtil.java0000664000175000017500000002240311767656530017750 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.Transformer; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.util.UUIDGenerator; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.PolicyInclude; import org.apache.neethi.Constants; import org.apache.neethi.Policy; import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyEngine; import org.apache.neethi.PolicyReference; import com.ibm.wsdl.util.xml.DOM2Writer; public class PolicyUtil { public static String getSafeString(String unsafeString) { StringBuffer sbuf = new StringBuffer(); char[] chars = unsafeString.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; switch (c) { case '\\': sbuf.append('\\'); sbuf.append('\\'); break; case '"': sbuf.append('\\'); sbuf.append('"'); break; case '\n': sbuf.append('\\'); sbuf.append('n'); break; case '\r': sbuf.append('\\'); sbuf.append('r'); break; default: sbuf.append(c); } } return sbuf.toString(); } public static PolicyReference createPolicyReference(Policy policy) { PolicyReference policyReference = new PolicyReference(); String key = policy.getName(); if (key == null) { key = policy.getId(); if (key == null) { key = UUIDGenerator.getUUID(); policy.setId(key); } policyReference.setURI("#" + key); } else { policyReference.setURI(key); } return policyReference; } public static OMElement getPolicyComponentAsOMElement( PolicyComponent policyComponent, ExternalPolicySerializer externalPolicySerializer) throws XMLStreamException, FactoryConfigurationError { if (policyComponent instanceof Policy) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); externalPolicySerializer.serialize((Policy) policyComponent, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos .toByteArray()); return (OMElement) XMLUtils.toOM(bais); } else { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement elem = fac.createOMElement(Constants.ELEM_POLICY_REF, Constants.URI_POLICY_NS, Constants.ATTR_WSP); elem.addAttribute(Constants.ATTR_URI, ((PolicyReference) policyComponent).getURI(), null); return elem; } } public static OMElement getPolicyComponentAsOMElement( PolicyComponent component) throws XMLStreamException, FactoryConfigurationError { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(baos); component.serialize(writer); writer.flush(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); return (OMElement) XMLUtils.toOM(bais); } public static PolicyComponent getPolicyComponentFromOMElement( OMElement policyComponent) throws IllegalArgumentException { if (Constants.Q_ELEM_POLICY.equals(policyComponent.getQName())) { return PolicyEngine.getPolicy(policyComponent); } else if (policyComponent.getQName().equals( new QName(Constants.URI_POLICY_NS, Constants.ELEM_POLICY_REF))) { return PolicyEngine.getPolicyReference(policyComponent); } else { throw new IllegalArgumentException( "Agrument is neither a nor a element"); } } public static Policy getPolicyFromOMElement(OMElement policyElement) { if (Constants.Q_ELEM_POLICY.equals(policyElement.getQName())) { return PolicyEngine.getPolicy(policyElement); } else { throw new IllegalArgumentException( "argument is not a element"); } } public static PolicyReference getPolicyReferenceFromOMElement( OMElement policyRefElement) { if (Constants.URI_POLICY_NS.equals(policyRefElement.getNamespace() .getNamespaceURI()) && Constants.ELEM_POLICY_REF.equals(policyRefElement .getLocalName())) { return PolicyEngine.getPolicyReference(policyRefElement); } else { throw new IllegalArgumentException( "argument is not a element"); } } public static PolicyComponent getPolicyComponent(org.w3c.dom.Element element) { if (Constants.URI_POLICY_NS.equals(element.getNamespaceURI())) { if (Constants.ELEM_POLICY.equals(element.getLocalName())) { return PolicyEngine.getPolicy(nodeToStream(element)); } else if (Constants.ELEM_POLICY_REF.equals(element.getLocalName())) { return PolicyEngine.getPolicyReferene(nodeToStream(element)); } } throw new IllegalArgumentException( "Agrument is neither a nor a element"); } private static InputStream nodeToStream(org.w3c.dom.Element element) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Transformer tf; try { // tf = TransformerFactory.newInstance().newTransformer(); // tf.transform(new DOMSource(element), new StreamResult(baos)); String nodeString = DOM2Writer.nodeToString(element); return new ByteArrayInputStream(nodeString.getBytes()); } catch (Exception e) { throw new RuntimeException("Unable to process policy"); } } public static String policyComponentToString(PolicyComponent policyComponent) throws XMLStreamException, FactoryConfigurationError { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(baos); policyComponent.serialize(writer); writer.flush(); return baos.toString(); } public static String generateId(AxisDescription description) { PolicyInclude policyInclude = description.getPolicyInclude(); String identifier = "-policy-1"; if (description instanceof AxisMessage) { identifier = "msg-" + ((AxisMessage) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisOperation) { identifier = "op-" + ((AxisOperation) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisService) { identifier = "service-" + ((AxisService) description).getName() + identifier; } /* * Int 49 is the value of the Character '1'. Here we want to change '1' * to '2' or '2' to '3' .. etc. to construct a unique identifier. */ for (int index = 49; policyInclude.getPolicy(identifier) != null; index++) { identifier = identifier.replace((char) index, (char) (index + 1)); } return identifier; } public static Policy getMergedPolicy(List policies, AxisDescription description) { Policy policy = null; for (Iterator iterator = policies.iterator(); iterator.hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { policy = (policy == null) ? (Policy) policyElement : (Policy) policy.merge((Policy) policyElement); } else { PolicyReference policyReference = (PolicyReference) policyElement; Policy policy2 = (Policy) policyReference.normalize( new AxisPolicyLocator(description), false); policy = (policy == null) ? policy2 : (Policy) policy .merge(policy2); } } if (policy != null) { policy = (Policy) policy.normalize(new AxisPolicyLocator( description), false); } return policy; } public static Policy getMergedPolicy(List policies, AxisService service) { Policy policy = null; for (Iterator iterator = policies.iterator(); iterator.hasNext();) { Object policyElement = iterator.next(); if (policyElement instanceof Policy) { policy = (policy == null) ? (Policy) policyElement : (Policy) policy.merge((Policy) policyElement); } else { PolicyReference policyReference = (PolicyReference) policyElement; Policy policy2 = (Policy) policyReference.normalize( new PolicyLocator(service), false); policy = (policy == null) ? policy2 : (Policy) policy .merge(policy2); } } if (policy != null) { policy = (Policy) policy.normalize(new PolicyLocator(service), false); } return policy; } } ./src/org/apache/axis2/util/SchemaUtil.java0000664000175000017500000000505311767656530017713 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import java.util.HashMap; import java.util.Iterator; /** * */ public class SchemaUtil { private static final Log log = LogFactory.getLog(SchemaUtil.class); public static XmlSchema[] getAllSchemas(XmlSchema schema) { HashMap map = new HashMap(); traverseSchemas(schema, map); return (XmlSchema[]) map.values().toArray(new XmlSchema[map.values().size()]); } private static void traverseSchemas(XmlSchema schema, HashMap map) { String key = schema.getTargetNamespace() + ":" + schema.getSourceURI(); if (map.containsKey(key)) { return; } map.put(key, schema); XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator tempIterator = includes.getIterator(); while (tempIterator.hasNext()) { Object o = tempIterator.next(); if (o instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) o).getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } if (o instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) o).getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } } } } } ./src/org/apache/axis2/util/XSLTTemplateProcessor.java0000664000175000017500000001236711767656530022051 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.w3c.dom.Document; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import java.io.InputStream; import java.io.OutputStream; public class XSLTTemplateProcessor { /** * Parses an XML stream with an XSL stream * * @param out Stream to write the output * @param xmlStream Source XML stream * @param xsltStream Source XSL stream * @throws TransformerFactoryConfigurationError * * @throws TransformerException */ public static void parse(OutputStream out, InputStream xmlStream, InputStream xsltStream) throws TransformerFactoryConfigurationError, TransformerException { Source xmlSource = new StreamSource(xmlStream); Source xsltSource = new StreamSource(xsltStream); Result result = new StreamResult(out); Transformer transformer = TransformerFactory.newInstance() .newTransformer(xsltSource); transformer.transform(xmlSource, result); } /** * Parses an XML stream with an XSL stream * * @param out Stream to write the output * @param doc * @param transformer * @throws TransformerFactoryConfigurationError * * @throws TransformerException */ public static void parse(OutputStream out, Document doc, Transformer transformer) throws TransformerFactoryConfigurationError, TransformerException { Source xmlSource = new DOMSource(doc); Result result = new StreamResult(out); transformer.transform(xmlSource, result); } /** * @param out * @param document * @param xsltStream * @throws TransformerFactoryConfigurationError * * @throws TransformerException */ public static void parse(OutputStream out, Document document, InputStream xsltStream) throws TransformerFactoryConfigurationError, TransformerException { Source xsltSource = new StreamSource(xsltStream); Transformer transformer = TransformerFactory.newInstance() .newTransformer(xsltSource); parse(out, document, transformer); } /** * @param out * @param document * @param xsltStream * @throws TransformerFactoryConfigurationError * * @throws TransformerException */ public static void parse(OutputStream out, Document document, InputStream xsltStream, URIResolver customResolver) throws TransformerFactoryConfigurationError, TransformerException { parse(out, document, xsltStream, customResolver, false); } /** * @param out * @param document * @param xsltStream * @throws TransformerFactoryConfigurationError * * @throws TransformerException */ public static void parse(OutputStream out, Document document, InputStream xsltStream, URIResolver customResolver, boolean pretty) throws TransformerFactoryConfigurationError, TransformerException { Source xsltSource = new StreamSource(xsltStream); TransformerFactory transformerFactory = TransformerFactory.newInstance(); if (pretty) { try { transformerFactory.setAttribute("indent-number", new Integer(2)); } catch (Exception e) { } } if (customResolver != null) { transformerFactory.setURIResolver(customResolver); } Transformer transformer = transformerFactory .newTransformer(xsltSource); if (pretty) { try { transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); } catch (Exception e) { } } parse(out, document, transformer); } } ./src/org/apache/axis2/util/ObjectStateUtils.java0000664000175000017500000003554411767656530021115 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axis2.context.externalize.ActivateUtils; import org.apache.axis2.context.externalize.ExternalizeConstants; import org.apache.axis2.context.externalize.SafeObjectInputStream; import org.apache.axis2.context.externalize.SafeObjectOutputStream; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.TransportListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; /** * Utility to write, read and activate externalized Objects */ public class ObjectStateUtils implements ExternalizeConstants { /* * setup for logging */ private static final Log log = LogFactory.getLog(ObjectStateUtils.class); // used to indicate an valid "null" object, // typically used in key-value pairs where a non-null key refers to a null // value public static String NULL_OBJECT = "NULL_OBJ"; // message/trace/logging strings public static final String UNSUPPORTED_SUID = "Serialization version ID is not supported."; public static final String UNSUPPORTED_REVID = "Revision ID is not supported."; // -------------------------------------------------------------------- // Save/Restore methods // -------------------------------------------------------------------- /** * Write a string to the specified output stream. * * @param o The output stream * @param str The string to write * @param desc A text description to use for logging * @throws IOException Exception */ public static void writeString(ObjectOutput o, String str, String desc) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); out.writeUTF(desc); out.writeObject(str); } /** * Read a string from the specified input stream. Returns null if no string is available. * * @param i The input stream * @param desc A text description to use for logging * @return The string or null, if not available * @throws IOException * @throws ClassNotFoundException */ public static String readString(ObjectInput i, String desc) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(i); // Get the marker in.readUTF(); // Get the object return (String) in.readObject(); } /** * Write an object to the specified output stream. * * @param o The output stream * @param obj The object to write * @param desc A text description to use for logging * @throws IOException Exception */ public static void writeObject(ObjectOutput o, Object obj, String desc) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); out.writeUTF(desc); out.writeObject(obj); } /** * Read an object from the specified input stream. Returns null if no object is available. * * @param i The input stream * @param desc A text description to use for logging * @return The object or null, if not available * @throws IOException * @throws ClassNotFoundException */ public static Object readObject(ObjectInput i, String desc) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(i); in.readUTF(); // Read Marker return in.readObject(); } /** * Write an array of objects to the specified output stream. NOTE: each object in the array * should implement either java.io.Serializable or java.io.Externalizable in order to be saved * * @param o The output stream * @param al The ArrayList to write * @param desc A text description to use for logging * @throws IOException Exception */ public static void writeArrayList(ObjectOutput o, ArrayList al, String desc) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); out.writeUTF(desc); out.writeList(al); } /** * Reads an array of objects from the specified input stream. Returns null if no array is * available. NOTE: each object in the array should implement either java.io.Serializable or * java.io.Externalizable in order to be saved * * @param i The input stream * @param desc A text description to use for logging * @return The ArrayList or null, if not available * @throws IOException * @throws ClassNotFoundException */ public static ArrayList readArrayList(ObjectInput i, String desc) throws IOException { SafeObjectInputStream in = SafeObjectInputStream.install(i); in.readUTF(); return in.readArrayList(); } /** * Write a hashmap of objects to the specified output stream. NOTE: each object in the map * should implement either java.io.Serializable or java.io.Externalizable in order to be saved * * @param o The output stream * @param map The HashMap to write * @param desc A text description to use for logging * @throws IOException Exception */ public static void writeHashMap(ObjectOutput o, HashMap map, String desc) throws IOException { SafeObjectOutputStream out = SafeObjectOutputStream.install(o); out.writeUTF(desc); out.writeMap(map); } /** * Read a hashmap of objects from the specified input stream. Returns null if no hashmap is * available. * * @param in The input stream * @param desc A text description to use for logging * @return The HashMap or null, if not available * @throws IOException * @throws ClassNotFoundException */ public static HashMap readHashMap(ObjectInput i, String desc) throws IOException { SafeObjectInputStream in = SafeObjectInputStream.install(i); in.readUTF(); return in.readHashMap(); } /** * Write a linked list of objects to the specified output stream. Note the saved * service group meta information may not match up with any of the serviceGroups that * are in the current AxisConfiguration object. * * @param axisConfig The AxisConfiguration object * @param serviceGrpClassName the class name string for the target object (could be a derived * class) * @param serviceGrpName the name associated with the service group * @return the AxisServiceGroup object that matches the criteria */ public static AxisServiceGroup findServiceGroup(AxisConfiguration axisConfig, String serviceGrpClassName, String serviceGrpName) { return ActivateUtils.findServiceGroup(axisConfig, serviceGrpClassName, serviceGrpName); } /** * Find the AxisMessage object that matches the criteria * * @param op The AxisOperation object * @param msgName The name associated with the message * @param msgElementName The name associated with the message element * @return the AxisMessage object that matches the given criteria */ public static AxisMessage findMessage(AxisOperation op, String msgName, String msgElementName) { return ActivateUtils.findMessage(op, msgName, msgElementName); } /** * Find the Handler object that matches the criteria * * @param existingHandlers The list of existing handlers and phases * @param handlerClassName the class name string for the target object (could be a derived * class) * @return the Handler object that matches the criteria */ public static Object findHandler(ArrayList existingHandlers, MetaDataEntry metaDataEntry) { return ActivateUtils.findHandler(existingHandlers, metaDataEntry); } /** * Find the TransportListener object that matches the criteria

        Note the saved meta * information may not match up with any of the objects that are in the current * AxisConfiguration object. * * @param axisConfig The AxisConfiguration object * @param listenerClassName the class name string for the target object (could be a derived * class) * @return the TransportListener object that matches the criteria */ public static TransportListener findTransportListener(AxisConfiguration axisConfig, String listenerClassName) { return ActivateUtils.findTransportListener(axisConfig, listenerClassName); } /** * Compares the two collections to see if they are equivalent. * * @param a1 The first collection * @param a2 The second collection * @param strict Indicates whether strict checking is required. Strict checking means that the * two collections must have the same elements in the same order. * Non-strict checking means that the two collections must have the same elements, * but the order is not significant. * @return TRUE if the two collections are equivalent FALSE, otherwise */ public static boolean isEquivalent(ArrayList a1, ArrayList a2, boolean strict) { return ActivateUtils.isEquivalent(a1, a2, strict); } /** * Compares the two collections to see if they are equivalent. * * @param m1 The first collection * @param m2 The second collection * @param strict Indicates whether strict checking is required. Strict checking means that the * two collections must have the same mappings. Non-strict checking means that the two * collections must have the same keys. In both cases, the order is not significant. * @return TRUE if the two collections are equivalent FALSE, otherwise */ public static boolean isEquivalent(Map m1, Map m2, boolean strict) { return ActivateUtils.isEquivalent(m1, m2, strict); } /** * Compares the two collections to see if they are equivalent. * * @param l1 * The first collection * @param l2 * The second collection * @return TRUE if the two collections are equivalent FALSE, otherwise */ public static boolean isEquivalent(LinkedList l1, LinkedList l2) { return ActivateUtils.isEquivalent(l1, l2); } } ./src/org/apache/axis2/util/FileWriter.java0000664000175000017500000000447611767656530017741 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import java.io.File; import java.io.IOException; public class FileWriter { /** * Creates/ returns a file object * * @param rootLocation - Location to be written * @param packageName - package, can be '.' separated * @param fileName name of the file * @param extension type of the file, java, cpp etc * @return the File that was created * @throws IOException * @throws Exception */ public static File createClassFile(File rootLocation, String packageName, String fileName, String extension) throws IOException, Exception { File returnFile = null; File root = rootLocation; if (packageName != null) { String directoryNames[] = packageName.split("\\."); File tempFile = null; int length = directoryNames.length; for (int i = 0; i < length; i++) { tempFile = new File(root, directoryNames[i]); root = tempFile; if (!tempFile.exists()) { tempFile.mkdir(); } } } if ((extension != null) && !fileName.endsWith(extension)) { fileName = fileName + extension; } returnFile = new File(root, fileName); if (!returnFile.exists()) { // returnFile.createNewFile(); } return returnFile; } } ./src/org/apache/axis2/util/URL.java0000664000175000017500000000411311767656530016313 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; public class URL { private int port = -1; private String fileName; private String host; private String protocol; public URL(String url) { int start = 0; int end = 0; end = url.indexOf("://"); if (end > 0) { protocol = url.substring(0, end); start = end + 3; } end = url.indexOf('/', start); if (end > 0) { String hostAndPort = url.substring(start, end); fileName = url.substring(end); int index = hostAndPort.indexOf(':'); if (index > 0) { host = hostAndPort.substring(0, index); port = Integer.parseInt(hostAndPort.substring(index + 1)); } else { host = hostAndPort; } } else { host = url; } } /** * @return Returns String. */ public String getFileName() { return fileName; } /** * @return Returns String. */ public String getHost() { return host; } /** * @return Returns int. */ public int getPort() { return port; } /** * @return Returns String. */ public String getProtocol() { return protocol; } } ./src/org/apache/axis2/util/XSLTUtils.java0000664000175000017500000000503011767656530017463 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class XSLTUtils { public static Document getDocument() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); return documentBuilderFactory.newDocumentBuilder().newDocument(); } /** * Utility method to add an attribute to a given element * * @param document * @param AttribName * @param attribValue * @param element */ public static void addAttribute(Document document, String AttribName, String attribValue, Element element) { Attr attribute = document.createAttribute(AttribName); attribute.setValue(attribValue); element.setAttributeNode(attribute); } public static Element getElement(Document document, String elementName) { return document.createElement(elementName); } /** * Utility method to add an attribute to a given element * * @param document * @param elementName * @param parentNode */ public static Element addChildElement(Document document, String elementName, Node parentNode) { Element elt = document.createElement(elementName); parentNode.appendChild(elt); return elt; } } ./src/org/apache/axis2/util/CallbackReceiver.java0000664000175000017500000001241711767656530021040 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.client.async.AsyncResult; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.engine.MessageReceiver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Map; /** * This is a MessageReceiver which is used on the client side to accept the * messages (response) that come to the client. This correlates the incoming message to * the related messages and makes a call to the appropriate callback. */ public class CallbackReceiver implements MessageReceiver { private static final Log log = LogFactory.getLog(CallbackReceiver.class); public static String SERVICE_NAME = "ClientService"; private ConcurrentHashMap callbackStore; public CallbackReceiver() { callbackStore = new ConcurrentHashMap(); } public void addCallback(String msgID, Callback callback) throws AxisFault { putIfAbsent(msgID, callback); } public void addCallback(String msgID, AxisCallback callback) throws AxisFault { putIfAbsent(msgID, callback); } /** * Inserts the specified key, value into the callback map. It throws an * exception if the message id was a duplicate. * * @param msgID The message id. * @param callback The callback object. * @throws AxisFault If the message id was a duplicate. */ private final void putIfAbsent(String msgID, Object callback) throws AxisFault { if (callbackStore.putIfAbsent(msgID, callback) == null) { if (log.isDebugEnabled()) { log.debug("CallbackReceiver: add callback " + msgID + ", " + callback + " ," + this); } } else { throw new AxisFault("The Callback for MessageID " + msgID + " is a duplicate"); } } public Object lookupCallback(String msgID) { Object o = callbackStore.remove(msgID); if (log.isDebugEnabled()) log.debug("CallbackReceiver: lookup callback " + msgID + ", " + o + " ," + this); return o; } public void receive(MessageContext msgContext) throws AxisFault { RelatesTo relatesTO = msgContext.getOptions().getRelatesTo(); if (relatesTO == null) { throw new AxisFault("Cannot identify correct Callback object. RelatesTo is null"); } String messageID = relatesTO.getValue(); Object callbackObj = callbackStore.remove(messageID); if (log.isDebugEnabled()) log.debug("CallbackReceiver: receive found callback " + callbackObj + ", " + messageID + ", " + this + ", " + msgContext.getAxisOperation()); if (callbackObj == null) { throw new AxisFault("The Callback for MessageID " + messageID + " was not found"); } if (callbackObj instanceof AxisCallback) { AxisCallback axisCallback = (AxisCallback)callbackObj; if (msgContext.isFault()) { axisCallback.onFault(msgContext); } else { axisCallback.onMessage(msgContext); } // Either way we're done. axisCallback.onComplete(); return; } // THIS NEXT PART WILL EVENTUALLY GO AWAY WHEN Callback DOES // OK, this must be an old-style Callback Callback callback = (Callback)callbackObj; AsyncResult result = new AsyncResult(msgContext); // check whether the result is a fault. try { SOAPEnvelope envelope = result.getResponseEnvelope(); OperationContext opContext = msgContext.getOperationContext(); if (opContext != null && !opContext.isComplete()) { opContext.addMessageContext(msgContext); } if (envelope.hasFault()) { AxisFault axisFault = Utils.getInboundFaultFromMessageContext(msgContext); callback.onError(axisFault); } else { callback.onComplete(result); } } catch (Exception e) { callback.onError(e); } finally { callback.setComplete(true); } } //to get the pending request public Map getCallbackStore() { return callbackStore; } } ./src/org/apache/axis2/util/PolicyLocator.java0000664000175000017500000000524211767656530020440 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.dataretrieval.DRConstants; import org.apache.axis2.dataretrieval.Data; import org.apache.axis2.dataretrieval.DataRetrievalException; import org.apache.axis2.dataretrieval.DataRetrievalRequest; import org.apache.axis2.description.AxisService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import org.apache.neethi.PolicyEngine; import org.apache.neethi.PolicyRegistry; public class PolicyLocator implements PolicyRegistry { private static final Log logger = LogFactory.getLog(PolicyLocator.class); private AxisService service; public PolicyLocator(AxisService service) { this.service = service; } public Policy lookup(String identifier) { Policy policy = service.lookupPolicy(identifier); if (policy == null) { try { MessageContext msgContext = new MessageContext(); msgContext.setAxisService(service); DataRetrievalRequest request = new DataRetrievalRequest(); request.putDialect(DRConstants.SPEC.DIALECT_TYPE_POLICY); request.putIdentifier(identifier); Data[] data = service.getData(request, msgContext); if (data.length != 0) { OMElement element = (OMElement) data[0].getData(); if (element != null) { return PolicyEngine.getPolicy(element); } } } catch (DataRetrievalException ex) { logger.error("" + ex); } catch (AxisFault ex) { logger.error("" + ex); } } return policy; } public void register(String identifier, Policy policy) { throw new UnsupportedOperationException(); } public void remove(String identifier) { throw new UnsupportedOperationException(); } } ./src/org/apache/axis2/util/XMLPrettyPrinter.java0000664000175000017500000001366111767656530021075 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMElement; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * An XML pretty printer based on xsl stylesheets */ public class XMLPrettyPrinter { private static final Log log = LogFactory.getLog(XMLPrettyPrinter.class); /** * Pretty prints contents of the xml file. * * @param file */ public static void prettify(final File file) { InputStream inputStream = null; FileOutputStream outputStream = null; byte[] byteArray = null; try { byteArray = IOUtils.getStreamAsByteArray(new FileInputStream(file)); inputStream = new ByteArrayInputStream(byteArray); outputStream = new FileOutputStream(file); Source stylesheetSource = new StreamSource(new ByteArrayInputStream(prettyPrintStylesheet.getBytes())); Source xmlSource = new StreamSource(inputStream); TransformerFactory tf = TransformerFactory.newInstance(); Templates templates = tf.newTemplates(stylesheetSource); Transformer transformer = templates.newTransformer(); transformer.setErrorListener(new ErrorListener(){ public void warning(TransformerException exception) throws TransformerException { log.warn("Exception occurred while trying to pretty print file " + file, exception); } public void error(TransformerException exception) throws TransformerException { log.error("Exception occurred while trying to pretty print file " + file, exception); } public void fatalError(TransformerException exception) throws TransformerException { log.error("Exception occurred while trying to pretty print file " + file, exception); } }); transformer.transform(xmlSource, new StreamResult(outputStream)); inputStream.close(); outputStream.close(); log.debug("Pretty printed file : " + file); } catch (Throwable t) { log.debug("Exception occurred while trying to pretty print file " + file, t); try { if (byteArray != null) { outputStream = new FileOutputStream(file); outputStream.write(byteArray); } } catch (IOException e) { log.debug(e.getMessage(), e); } } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { log.debug(e.getMessage(), e); } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { log.debug(e.getMessage(), e); } } } } private static final String prettyPrintStylesheet = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; public static void prettify(OMElement wsdlElement, OutputStream out) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); wsdlElement.serialize(baos); Source stylesheetSource = new StreamSource(new ByteArrayInputStream(prettyPrintStylesheet.getBytes())); Source xmlSource = new StreamSource(new ByteArrayInputStream(baos.toByteArray())); TransformerFactory tf = TransformerFactory.newInstance(); Templates templates = tf.newTemplates(stylesheetSource); Transformer transformer = templates.newTransformer(); transformer.transform(xmlSource, new StreamResult(out)); } } ./src/org/apache/axis2/util/CommandLineOptionConstants.java0000664000175000017500000001127311767656530023132 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.util; public interface CommandLineOptionConstants { interface WSDL2JavaConstants { String All_PORTS_OPTION = "ap"; String All_PORTS_OPTION_LONG = "all-ports"; String BACKWORD_COMPATIBILITY_OPTION = "b"; String BACKWORD_COMPATIBILITY_OPTION_LONG = "backword-compatible"; String CODEGEN_ASYNC_ONLY_OPTION = "a"; String CODEGEN_ASYNC_ONLY_OPTION_LONG = "async"; String CODEGEN_SYNC_ONLY_OPTION = "s"; String CODEGEN_SYNC_ONLY_OPTION_LONG = "sync"; String DATA_BINDING_TYPE_OPTION = "d"; String DATA_BINDING_TYPE_OPTION_LONG = "databinding-method"; String EXTERNAL_MAPPING_OPTION = "em"; String EXTERNAL_MAPPING_OPTION_LONG = "external-mapping"; String FLATTEN_FILES_OPTION = "f"; String FLATTEN_FILES_OPTION_LONG = "flatten-files"; String GENERATE_ALL_OPTION = "g"; String GENERATE_ALL_OPTION_LONG = "generate-all"; String GENERATE_SERVICE_DESCRIPTION_OPTION = "sd"; String GENERATE_SERVICE_DESCRIPTION_OPTION_LONG = "service-description"; String GENERATE_TEST_CASE_OPTION = "t"; String GENERATE_TEST_CASE_OPTION_LONG = "test-case"; String NAME_SPACE_TO_PACKAGE_OPTION = "ns2p"; String NAME_SPACE_TO_PACKAGE_OPTION_LONG = "namespace2package"; String NO_BUILD_XML_OPTION_LONG = "noBuildXML"; String NO_MESSAGE_RECEIVER_OPTION_LONG = "noMessageReceiver"; String NO_WSDLS_OPTION_LONG = "noWSDL"; String OUTPUT_LOCATION_OPTION = "o"; String OUTPUT_LOCATION_OPTION_LONG = "output"; String OVERRIDE_OPTION = "or"; String OVERRIDE_OPTION_LONG = "over-ride"; String PACKAGE_OPTION = "p"; String PACKAGE_OPTION_LONG = "package"; String PORT_NAME_OPTION = "pn"; String PORT_NAME_OPTION_LONG = "port-name"; String REPOSITORY_PATH_OPTION = "r"; String REPOSITORY_PATH_OPTION_LONG = "repository-path"; String RESOURCE_FOLDER_OPTION = "R"; String RESOURCE_FOLDER_OPTION_LONG = "resource-folder"; String SERVER_SIDE_CODE_OPTION = "ss"; String SERVER_SIDE_CODE_OPTION_LONG = "server-side"; String SERVER_SIDE_INTERFACE_OPTION = "ssi"; String SERVER_SIDE_INTERFACE_OPTION_LONG = "serverside-interface"; String SERVICE_NAME_OPTION = "sn"; String SERVICE_NAME_OPTION_LONG = "service-name"; String SOURCE_FOLDER_NAME_OPTION = "S"; String SOURCE_FOLDER_NAME_OPTION_LONG = "source-folder"; String STUB_LANGUAGE_OPTION = "l"; String STUB_LANGUAGE_OPTION_LONG = "language"; String SUPPRESS_PREFIXES_OPTION = "sp"; String SUPPRESS_PREFIXES_OPTION_LONG = "suppress-prefixes"; String UNPACK_CLASSES_OPTION = "u"; String UNPACK_CLASSES_OPTION_LONG = "unpack-classes"; String UNWRAP_PARAMETERS = "uw"; String UNWRAP_PARAMETERS_LONG = "unwrap-params"; String WSDL_LOCATION_URI_OPTION = "uri"; String WSDL_VERSION_OPTION = "wv"; String WSDL_VERSION_OPTION_LONG = "wsdl-version"; String HTTP_PROXY_HOST_OPTION_LONG = "http-proxy-host"; String HTTP_PROXY_PORT_OPTION_LONG = "http-proxy-port"; String EXCLUDE_PAKAGES_OPTION = "ep"; String EXCLUDE_PAKAGES_OPTION_LONG = "exclude-packages"; String SKELTON_INTERFACE_NAME_OPTION = "sin"; String SKELTON_INTERFACE_NAME_OPTION_LONG = "skelton-interface-name"; String SKELTON_CLASS_NAME_OPTION = "scn"; String SKELTON_CLASS_NAME_OPTION_LONG = "skelton-class-name"; String INVALID_OPTION = "INVALID_OPTION"; String EXTRA_OPTIONTYPE_PREFIX = "E"; String WSDL_VERSION_2 = "2.0"; String WSDL_VERSION_2_OPTIONAL = "2"; String WSDL_VERSION_1 = "1.1"; } interface ExtensionArguments { String WITHOUT_DATABIND_CODE = "wdc"; } public static final String SOLE_INPUT = "SOLE_INPUT"; } ./src/org/apache/axis2/Version.java0000664000175000017500000000347711767656530016335 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2; import org.apache.axis2.i18n.Messages; /** * Little utility to get the version and build date of the axis2.jar. *

        * The messages referenced here are automatically kept up-to-date by the * build.xml. */ public class Version { /** * Get the version of this AXIS. * * @return the version of this axis2 */ public static String getVersion() { return Messages.getMessage("axisVersion") + "\n" + Messages.getMessage("builtOn"); } /** * Returns the Axis Version number and build date. *

        * Example output: 1.1 Jul 08, 2003 (09:00:12 EDT) * * @return the full version of this axis2 */ public static String getVersionText() { return Messages.getMessage("axisVersionRaw"); } /** * Entry point. *

        * Calling this with no arguments returns the version of the client-side * axis2.jar. */ public static void main(String[] args) { System.out.println(getVersion()); } } ./src/org/apache/axis2/phaseresolver/0000775000175000017500000000000011767656530016714 5ustar brianbrian./src/org/apache/axis2/phaseresolver/PhaseResolver.java0000664000175000017500000002072711767656530022351 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.phaseresolver; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.Flow; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.Phase; import org.apache.axis2.wsdl.WSDLConstants; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Class PhaseResolver */ public class PhaseResolver { private static final int IN_FLOW = 1; private static final int OUT_FAULT_FLOW = 5; /** * Field axisConfig */ private AxisConfiguration axisConfig; /** * Field phaseHolder */ private PhaseHolder phaseHolder; /** * default constructor , to obuild chains for GlobalDescription * * @param axisconfig */ public PhaseResolver(AxisConfiguration axisconfig) { this.axisConfig = axisconfig; } private void engageModuleToFlow(Flow flow, List handlerChain) throws PhaseException { phaseHolder = new PhaseHolder(handlerChain); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription metadata = flow.getHandler(j); phaseHolder.addHandler(metadata); } } } private void engageModuleToOperation(AxisOperation axisOperation, AxisModule axisModule, int flowType) throws PhaseException { List phases = new ArrayList(); Flow flow = null; switch (flowType) { case PhaseMetadata.IN_FLOW : { phases.addAll(axisConfig.getInFlowPhases()); phases.addAll(axisOperation.getRemainingPhasesInFlow()); flow = axisModule.getInFlow(); break; } case PhaseMetadata.OUT_FLOW : { phases.addAll(axisOperation.getPhasesOutFlow()); phases.addAll(axisConfig.getOutFlowPhases()); flow = axisModule.getOutFlow(); break; } case PhaseMetadata.FAULT_OUT_FLOW : { phases.addAll(axisOperation.getPhasesOutFaultFlow()); phases.addAll(axisConfig.getOutFaultFlowPhases()); flow = axisModule.getFaultOutFlow(); break; } case PhaseMetadata.FAULT_IN_FLOW : { phases.addAll(axisOperation.getPhasesInFaultFlow()); phases.addAll(axisConfig.getInFaultFlowPhases()); flow = axisModule.getFaultInFlow(); break; } } engageModuleToFlow(flow, phases); } public void engageModuleToOperation(AxisOperation axisOperation, AxisModule module) throws PhaseException { for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) { engageModuleToOperation(axisOperation, module, type); } } /** * To remove handlers from global chians this method can be used , first it take inflow * of the module and then take handler one by one and then remove those handlers from * global inchain , * the same procedure will be carry out for all the other flows as well. * * @param module */ public void disengageModuleFromGlobalChains(AxisModule module) { //INFLOW Flow flow = module.getInFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, axisConfig.getInFlowPhases()); } } //OUTFLOW flow = module.getOutFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, axisConfig.getOutFlowPhases()); } } //INFAULTFLOW flow = module.getFaultInFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, axisConfig.getInFaultFlowPhases()); } } //OUTFAULTFLOW flow = module.getFaultOutFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, axisConfig.getOutFaultFlowPhases()); } } } /** * To remove handlers from operations chians this method can be used , first it take inflow * of the module and then take handler one by one and then remove those handlers from * global inchain , * the same procedure will be carry out for all the other flows as well. * * @param module */ public void disengageModuleFromOperationChain(AxisModule module, AxisOperation operation) { //INFLOW Flow flow = module.getInFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, operation.getRemainingPhasesInFlow()); } } //OUTFLOW flow = module.getOutFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, operation.getPhasesOutFlow()); } } //INFAULTFLOW flow = module.getFaultInFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, operation.getPhasesInFaultFlow()); } } //OUTFAULTFLOW flow = module.getFaultOutFlow(); if (flow != null) { for (int j = 0; j < flow.getHandlerCount(); j++) { HandlerDescription handler = flow.getHandler(j); removeHandlerfromaPhase(handler, operation.getPhasesOutFaultFlow()); } } } /** * To remove a single handler from a given list of phases * * @param handler * @param phaseList */ private void removeHandlerfromaPhase(HandlerDescription handler, ArrayList phaseList) { String phaseName = handler.getRules().getPhaseName(); Iterator phaseItr = phaseList.iterator(); while (phaseItr.hasNext()) { Phase phase = (Phase) phaseItr.next(); if (phase.getPhaseName().equals(phaseName)) { phase.removeHandler(handler); break; } } } public void engageModuleToMessage(AxisMessage axisMessage, AxisModule axisModule) throws PhaseException { String direction = axisMessage.getDirection(); AxisOperation axisOperation = axisMessage.getAxisOperation(); if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equalsIgnoreCase(direction)) { engageModuleToOperation(axisOperation, axisModule, PhaseMetadata.OUT_FLOW); } else if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equalsIgnoreCase(direction)) { engageModuleToOperation(axisOperation, axisModule, PhaseMetadata.IN_FLOW); } else if (WSDLConstants.MESSAGE_LABEL_FAULT_VALUE.equals(direction)) { //TODO : Need to handle fault correctly } } } ./src/org/apache/axis2/phaseresolver/PhaseHolder.java0000664000175000017500000000760011767656530021760 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.phaseresolver; import org.apache.axis2.deployment.DeploymentErrorMsgs; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.PhaseRule; import org.apache.axis2.engine.Phase; import org.apache.axis2.i18n.Messages; import java.util.List; /** * This class hold all the phases found in the services.xml and server.xml */ public class PhaseHolder { private List phaseList; public PhaseHolder() { } public PhaseHolder(List phases) { this.phaseList = phases; } /** * If the phase name is equal to "*" that implies , the handler should be * added to each and every phase in the system for a given flow , and at that * point if the phase rule contains any befores or afters then they will be * ignored. Phase first and phase last are supported , but make sure you dont * break any of the phase rules. *

        * If the phase name is not above then the hadler will be added to the phase * specified by the phase rule , and no rules will be ignored. * * @param handlerDesc HandlerDescription to deploy * @throws PhaseException if there's a problem */ public void addHandler(HandlerDescription handlerDesc) throws PhaseException { PhaseRule rule = handlerDesc.getRules(); // Make sure this rule makes sense (throws PhaseException if not) rule.validate(); String phaseName = rule.getPhaseName(); if (Phase.ALL_PHASES.equals(phaseName)) { handlerDesc.getRules().setBefore(""); handlerDesc.getRules().setAfter(""); for (int i = 0; i < phaseList.size(); i++) { Phase phase = (Phase) phaseList.get(i); phase.addHandler(handlerDesc); } } else { if (phaseExists(phaseName)) { getPhase(phaseName).addHandler(handlerDesc); } else { throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.INVALID_PHASE, phaseName, handlerDesc.getName())); } } } /** * this method is used to get the actual phase object given in the phase array list * * @param phaseName the name of the desired Phase * @return the matching Phase, or null */ private Phase getPhase(String phaseName) { for (int i = 0; i < phaseList.size(); i++) { Phase phase = (Phase) phaseList.get(i); if (phase.getPhaseName().equals(phaseName)) { return phase; } } return null; } /** * Check if a named Phase exists in this holder. * * @param phaseName name to check * @return true if a Phase matching the name was found, false otherwise */ private boolean phaseExists(String phaseName) { for (int i = 0; i < phaseList.size(); i++) { Phase phase = (Phase) phaseList.get(i); if (phase.getPhaseName().equals(phaseName)) { return true; } } return false; } } ./src/org/apache/axis2/phaseresolver/PhaseException.java0000664000175000017500000000300211767656530022471 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.phaseresolver; import org.apache.axis2.AxisFault; /** * Class PhaseException */ public class PhaseException extends AxisFault { private static final long serialVersionUID = 5690503396724929322L; /** * Constructor PhaseException * * @param message */ public PhaseException(String message) { super(message); } /** * Constructor PhaseException * * @param cause */ public PhaseException(Throwable cause) { super(cause); } /** * Constructor PhaseException * * @param message * @param cause */ public PhaseException(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axis2/phaseresolver/PhaseMetadata.java0000664000175000017500000000331111767656530022256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.phaseresolver; /** * Class PhaseMetadata */ public class PhaseMetadata { public static final int IN_FLOW = 1; public static final int OUT_FLOW = 2; public static final int FAULT_OUT_FLOW = 4; public static final int FAULT_IN_FLOW = 3; // INFLOW public static final String PHASE_TRANSPORTIN = "TransportIn"; public static final String PHASE_PRE_DISPATCH = "PreDispatch"; public static final String PHASE_POST_DISPATCH = "PostDispatch"; public static final String PHASE_POLICY_DETERMINATION = "PolicyDetermination"; public static final String PHASE_MESSAGE_PROCESSING = "MessageProcessing"; // OUTFLOW public static final String PHASE_MESSAGE_OUT = "MessageOut"; public static final String PHASE_DISPATCH = "Dispatch"; public static final String PHASE_TRANSPORT_OUT = "TransportOut"; public static final String TRANSPORT_PHASE = "TRANSPORT"; } ./src/org/apache/axis2/Constants.java0000664000175000017500000003751611767656530016665 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2; /** * Class Constants */ public class Constants extends org.apache.axis2.namespace.Constants { /** * Field SOAP_STYLE_RPC_ENCODED */ public static final int SOAP_STYLE_RPC_ENCODED = 1000; /** * Field SOAP_STYLE_RPC_LITERAL */ public static final int SOAP_STYLE_RPC_LITERAL = 1001; /** * Field SOAP_STYLE_DOC_LITERAL_WRAPPED */ public static final int SOAP_STYLE_DOC_LITERAL_WRAPPED = 1002; /** * Field SESSION_SCOPE */ public static final String SESSION_SCOPE = "session"; /** * Field SESSION_CONTEXT_PROPERTY */ public static final String SESSION_CONTEXT_PROPERTY = "SessionContext"; /** * Field PHASE_TRANSPORT */ public static final String PHASE_TRANSPORT = "transport"; /** * Field PHASE_SERVICE */ public static final String PHASE_SERVICE = "service"; /** * Field PHASE_GLOBAL */ public static final String PHASE_GLOBAL = "global"; /** * Field MESSAGE_SCOPE */ public static final String MESSAGE_SCOPE = "message"; public static final String AXIS_BINDING_OPERATION = "AxisBindingOperation"; public static final String AXIS_BINDING_MESSAGE = "AxisBindingMessage"; /** * To chenge the conetext path from axis2/service to something else */ public static final String PARAM_CONTEXT_ROOT = "contextRoot"; /** * To chenage the service path to somthing else */ public static final String PARAM_SERVICE_PATH = "servicePath"; //Parameter name for transport session managemntt public static final String MANAGE_TRANSPORT_SESSION = "manageTransportSession"; public static final String HTTP_RESPONSE_STATE = "axis2.http.response.state"; public static final String HTTP_BASIC_AUTH_REALM = "axis2.authentication.realm"; /** * Field APPLICATION_SCOPE */ public static final String SCOPE_APPLICATION = "application"; public static final String SCOPE_SOAP_SESSION = "soapsession"; public static final String SCOPE_TRANSPORT_SESSION = "transportsession"; public static final String SCOPE_REQUEST = "request"; public static final String AXIS2_REPO = "axis2.repo"; public static final String AXIS2_CONF = "axis2.xml"; public static final String USER_HOME = "user.home"; /** * Field TRANSPORT_TCP */ public static final String TRANSPORT_TCP = "tcp"; public static final String TRANSPORT_MAIL = "mailto"; public static final String TRANSPORT_LOCAL = "local"; public static final String TRANSPORT_JMS = "jms"; /** * Field TRANSPORT_HTTP */ public static final String TRANSPORT_HTTP = "http"; public static final String TRANSPORT_HTTPS = "https"; //Parameter name of Service impl class public static final String SERVICE_CLASS = "ServiceClass"; public static final String SERVICE_OBJECT_SUPPLIER = "ServiceObjectSupplier"; public static final String SERVICE_TCCL = "ServiceTCCL"; public static final String TCCL_DEFAULT = "default"; public static final String TCCL_COMPOSITE = "composite"; public static final String TCCL_SERVICE = "service"; public static final String FAULT_NAME = "faultName"; /** * Field REQUEST_URL_PREFIX */ public static final String LIST_PHASES = "listPhases"; public static final String LIST_MODULES = "listModules"; public static final String LIST_GLOABLLY_ENGAGED_MODULES = "globalModules"; public static final String LIST_CONTEXTS = "listContexts"; public static final String ENGAGE_MODULE_TO_SERVICE_GROUP = "engageToServiceGroup"; public static final String ENGAGE_MODULE_TO_SERVICE = "engageToService"; public static final String ENGAGE_GLOBAL_MODULE = "engagingglobally"; public static final String ADMIN_LOGIN = "adminlogin"; public static final String AXIS_WEB_CONTENT_ROOT = "/axis2-web/"; /** * List service for admin pages */ public static final String ADMIN_LISTSERVICES = "listService"; public static final String VIEW_GLOBAL_HANDLERS = "viewGlobalHandlers"; public static final String SELECT_SERVICE_FOR_PARA_EDIT = "selectServiceParaEdit"; public static final String SELECT_SERVICE = "selectService"; public static final String EDIT_SERVICE_PARA = "editServicepara"; public static final String VIEW_SERVICE_HANDLERS = "viewServiceHandlers"; public static final String USER_NAME = "userName"; public static final String ADMIN_SECURITY_DISABLED = "disableAdminSecurity"; /** * Field SINGLE_SERVICE */ public static final String SINGLE_SERVICE = "singleservice"; /** * @deprecated Please use org.apache.axis2.transport.http.HTTPConstants.MC_HTTP_SERVLETCONTEXT */ public static final String SERVLET_CONTEXT = "transport.http.servletContext"; /** * @deprecated Please use org.apache.axis2.transport.http.HTTPConstants.MC_HTTP_SERVLETREQUEST */ public static final String HTTP_SERVLET_REQUEST = "transport.http.servletRequest"; public static final String SERVICE_MAP = "servicemap"; public static final String SERVICE_ROOT = "serviceRoot"; public static final String SERVICE_PATH = "servicePath"; public static final String SERVICE_HANDLERS = "serviceHandlers"; public static final String SERVICE_GROUP_MAP = "serviceGroupmap"; public static final String SERVICE = "service"; public static final String SELECT_SERVICE_TYPE = "SELECT_SERVICE_TYPE"; public static final String IN_ACTIVATE_SERVICE = "inActivateService"; public static final String ACTIVATE_SERVICE = "activateService"; public static final String PHASE_LIST = "phaseList"; public static final String PASSWORD = "password"; public static final String OPERATION_MAP = "operationmap"; public static final String MODULE_MAP = "modulemap"; public static final String MODULE_ADDRESSING = "addressing"; public static final String LIST_SERVICE_GROUPS = "listServiceGroups"; public static final String LIST_OPERATIONS_FOR_THE_SERVICE = "listOperations"; public static final String IS_FAULTY = "Fault"; public static final String GLOBAL_HANDLERS = "axisconfig"; /** * Keys for service/module error maps */ public static final String ERROR_SERVICE_MAP = "errprservicemap"; public static final String ERROR_MODULE_MAP = "errormodulesmap"; public static final String ENGAGE_STATUS = "engagestatus"; public static final String CONFIG_CONTEXT = "config_context"; public static final String WSDL_CONTENT = "wsdl"; public static final String ACTION_MAPPING = "actionMapping"; public static final String OUTPUT_ACTION_MAPPING = "outputActionMapping"; public static final String FAULT_ACTION_MAPPING = "faultActionMapping"; public static final String FAULT_ACTION_NAME = "faultName"; public static final String VALUE_TRUE = "true"; public static final String VALUE_FALSE = "false"; public static final String VALUE_OPTIONAL = "optional"; public static final String TESTING_PATH = "target/test-resources/"; public static final String TESTING_REPOSITORY = TESTING_PATH + "samples"; public static final char SERVICE_NAME_SPLIT_CHAR = ':'; public static final String SERVICE_GROUP_ID = "ServiceGroupId"; public static final String RESPONSE_WRITTEN = "RESPONSE_WRITTEN"; //To have a floag if the replyTo is not annon one public static final String DIFFERENT_EPR = "DIFFERENT_EPR"; /** * This can be set in the MessageContext to give an response code the transport should use when sending it out. */ public static final String RESPONSE_CODE = "RESPONSE_CODE"; /** * Transport Info */ public static final String OUT_TRANSPORT_INFO = "OutTransportInfo"; /** * Field METHOD_NAME_ESCAPE_CHARACTER */ public static final char METHOD_NAME_ESCAPE_CHARACTER = '?'; public static final String LOGGED = "Logged"; public static final String CONTAINER_MANAGED = "ContainerManaged"; public static final String FAULT_INFORMATION_FOR_HEADERS = "FaultHeaders"; /** * @deprecated Please use org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING */ public static final String COOKIE_STRING = "Cookie"; public static final String SESSION_COOKIE = "axis_session"; public static final String SESSION_COOKIE_JSESSIONID = "JSESSIONID"; public static final String CUSTOM_COOKIE_ID = "customCookieID"; /** * Addressing Constants */ public static final String ADDRESSING_ACTION = "WS-Addressing:Action"; public static final String HTTP_FRONTEND_HOST_URL = "httpFrontendHostUrl"; public static final String DEFAULT_REST_PATH = "rest"; public static final String DEFAULT_SERVICES_PATH = "services"; public static final int APPLICATION_FAULT = 1; public static final int TRANSPORT_FAULT = 2; public static final int SOAP_PROCESSING_FAULT = 3; public static final String APPLICATION_FAULT_STRING = "applicationFault"; public static final String TRANSPORT_FAULT_STRING = "transportFault"; public static final String SOAP_PROCESSING_FAULT_STRING = "soapProcessingFault"; // used to handle piggy back messages with mail transport public static final String PIGGYBACK_MESSAGE = "piggybackMessage"; /** * Field Builder Selector */ public static final String BUILDER_SELECTOR = "builderselector"; /** * Property name for inbound fault processor to set a fault on the message * context to be thrown by the client code in favour of a simple translation * from SOAPFault to AxisFault */ public static final String INBOUND_FAULT_OVERRIDE = "inboundFaultOverride"; /** SOAP Role Configuration */ public static final String SOAP_ROLE_CONFIGURATION_ELEMENT = "SOAPRoleConfiguration"; public static final String SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE = "isUltimateReceiver"; public static final String SOAP_ROLE_ELEMENT = "role"; public static final String SOAP_ROLE_PLAYER_PARAMETER = "rolePlayer"; /** * This is used to store Header QNames that failed mustUnderstand check in AxisEngine. */ public static final String UNPROCESSED_HEADER_QNAMES = "unprocessedHeaderQNames"; // Keys to access JAXWS Request and Response SOAP Headers public static final String JAXWS_OUTBOUND_SOAP_HEADERS = "jaxws.binding.soap.headers.outbound"; public static final String JAXWS_INBOUND_SOAP_HEADERS = "jaxws.binding.soap.headers.inbound"; public static interface Configuration { public static final String ENABLE_REST = "enableREST"; public static final String ENABLE_HTTP_CONTENT_NEGOTIATION = "httpContentNegotiation"; public static final String ENABLE_REST_THROUGH_GET = "restThroughGet"; public static final String ARTIFACTS_TEMP_DIR = "artifactsDIR"; //Attachment configurations public static final String ENABLE_MTOM = "enableMTOM"; public static final String MTOM_THRESHOLD = "mtomThreshold"; public static final String CACHE_ATTACHMENTS = "cacheAttachments"; public static final String ATTACHMENT_TEMP_DIR = "attachmentDIR"; public static final String FILE_SIZE_THRESHOLD = "sizeThreshold"; public static final String ENABLE_SWA = "enableSwA"; public static final String MIME_BOUNDARY = "mimeBoundary"; public static final String MM7_COMPATIBLE = "MM7Compatible"; public static final String MM7_INNER_BOUNDARY = "MM7InnerBoundary"; public static final String MM7_PART_CID = "MM7PartCID"; public static final String REDUCE_WSDL_MEMORY_CACHE = "reduceWSDLMemoryCache"; public static final String REDUCE_WSDL_MEMORY_TYPE = "reduceWSDLMemoryType"; public static final String HTTP_METHOD_GET = "GET"; public static final String HTTP_METHOD_DELETE = "DELETE"; public static final String HTTP_METHOD_PUT = "PUT"; public static final String HTTP_METHOD = "HTTP_METHOD"; public static final String HTTP_METHOD_POST = "POST"; public static final String CONTENT_TYPE = "ContentType"; public static final String CONFIG_CONTEXT_TIMOUT_INTERVAL = "ConfigContextTimeoutInterval"; public static final String TRANSPORT_IN_URL = "TransportInURL"; public static final String URL_PARAMETER_LIST = "URLParameterList"; public static final String URL_HTTP_LOCATION_PARAMS_LIST = "HTTPLocationParamsList"; public static final String SEND_STACKTRACE_DETAILS_WITH_FAULTS = "sendStacktraceDetailsWithFaults"; public static final String DRILL_DOWN_TO_ROOT_CAUSE_FOR_FAULT_REASON = "drillDownToRootCauseForFaultReason"; public static final String DISABLE_REST = "disableREST"; public static final String DISABLE_SOAP12 = "disableSOAP12"; // this will contain the keys of all the properties that will be in the message context public static final String TRANSPORT_URL = "TransportURL"; /** * @deprecated please use org.apache.axis2.addressing.AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES */ public static final String DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages"; // if this property is set to Boolean.TRUE then the SOAPAction header, if present, // will NOT be set to the value of Options.getAction(). The empty value, "", will // be used instead. public static final String DISABLE_SOAP_ACTION = "disableSoapAction"; /** * Field CHARACTER_SET_ENCODING */ public static final String CHARACTER_SET_ENCODING = "CHARACTER_SET_ENCODING"; /** * If this is set to a Boolean 'true' value, the replyTo value will not be replaced in * an OutIn invocation. This is useful for modules that hope to get the reply message in * its own manner. */ public static final String USE_CUSTOM_LISTENER = "UseCustomListener"; /** * If this is set to a Boolean 'true' value, then OutIn operations will always be treated * as async. This is useful for modules that layer async behaviour on top of sync channels. */ public static final String USE_ASYNC_OPERATIONS = "UseAsyncOperations"; /** * This is used to specify the message format which the message needs to be serializes. * * @see org.apache.axis2.transport.MessageFormatter */ public static final String MESSAGE_TYPE = "messageType"; public static final String SOAP_RESPONSE_MEP = "soapResponseMEP"; /** * This will be used as a key for storing transport information. */ public static final String TRANSPORT_INFO_MAP = "TransportInfoMap"; /** * If this is set to a Boolean 'true' value, then RequestResponseTransport instances will * not be signalled by the Dispatch phase. This is useful for modules that add wish to * send extra messages in the backchannel. */ public static final String DISABLE_RESPONSE_ACK = "DisableResponseAck"; } } ./src/org/apache/axis2/modules/0000775000175000017500000000000011767656530015502 5ustar brianbrian./src/org/apache/axis2/modules/Module.java0000664000175000017500000000645011767656530017577 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.modules; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisModule; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; /** * Every module provides an implementation of this class. Modules are in one of * two states: "available" or "engaged". All modules that the runtime * detects (from the system modules/ directory or from other means) are said to * be in the "available" state. If some service indicates a dependency on this * module then the module is initialized (once for the life of the system) and * the state changes to "initialized". *

        *

        Any module which is in the "engaged" state can be engaged as needed * by the engine to respond to a message. Currently module engagement is done * via deployment (using module.xml). In the future we may engage modules * programmatically by introducing an engage() method to this interface, thereby * allowing more dynamic scenarios. */ public interface Module { // initialize the module public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault; /** * When engaging this module to some service or operation , module will be notify by calling this * method there module author can validate , add policy and do any thing that he want , and he can * refuse the engage as well * * @param axisDescription * @throws AxisFault */ void engageNotify(AxisDescription axisDescription) throws AxisFault; /** * Evaluate whether it can support the specified assertion and returns true if the assertion can * be supported. * * @param assertion the assertion that the module must decide whether it can support or not. * @return true if the specified assertion can be supported by the module */ public boolean canSupportAssertion(Assertion assertion); /** * Evaluates specified policy for the specified AxisDescription. It computes the configuration that * is appropriate to support the policy and stores it the appropriate description. * * @param policy the policy that is applicable for the specified AxisDescription * @throws AxisFault if anything goes wrong. */ public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault; // shutdown the module public void shutdown(ConfigurationContext configurationContext) throws AxisFault; } ./src/org/apache/axis2/deployment/0000775000175000017500000000000011767656530016212 5ustar brianbrian./src/org/apache/axis2/deployment/FileSystemConfigurator.java0000664000175000017500000001264511767656530023534 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisConfigurator; import org.apache.axis2.util.Loader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class FileSystemConfigurator extends DeploymentEngine implements AxisConfigurator { private static final Log log = LogFactory.getLog(FileSystemConfigurator.class); /** * To check whether need to create a service side or client side */ private String axis2xml = null; private String repoLocation = null; /** * Load an AxisConfiguration from the repository directory specified * * @param repoLocation * @param axis2xml */ public FileSystemConfigurator(String repoLocation, String axis2xml) throws AxisFault { if (repoLocation == null) { //checking wether user has set the system property repoLocation = System.getProperty(Constants.AXIS2_REPO); } // OK, we've got a repository location in mind. Let's make // sure it exists. if (repoLocation != null) { File repo = new File(repoLocation); if (repo.exists()) { // ok, save it if so this.repoLocation = repo.getAbsolutePath(); } else { log.info("Couldn't find repository location '" + repoLocation + "'"); throw new AxisFault("Couldn't find repository location '" + repoLocation + "'"); } } // Deal with the config file. If a filename was specified as an // arg to this constructor, just respect it. if (axis2xml == null) { // If not, check for a system property setting axis2xml = System.getProperty(Constants.AXIS2_CONF); // And if not that, try at the root of the repository if we have one. // It might be nice to default the repository to the current directory, but we don't yet if (axis2xml == null) { if (repoLocation != null) { axis2xml = repoLocation + File.separator + Constants.AXIS2_CONF; } } // In either case, check that the file exists... if not // we'll use the default axis2.xml on the classpath. if (axis2xml != null) { File configFile = new File(axis2xml); if (!configFile.exists()) { log.debug("Config file '" + axis2xml + "' doesn't exist, ignoring."); axis2xml = null; } } } this.axis2xml = axis2xml; } /** * First create a Deployment engine, use that to create an AxisConfiguration * * @return Axis Configuration * @throws AxisFault */ public synchronized AxisConfiguration getAxisConfiguration() throws AxisFault { InputStream configStream = null; try { if (axis2xml != null && !"".equals(axis2xml)) { configStream = new FileInputStream(axis2xml); } else { configStream = Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE); } axisConfig = populateAxisConfiguration(configStream); } catch (FileNotFoundException e) { throw new AxisFault("System can not find the given axis2.xml " + axis2xml); } finally { if(configStream != null) { try { configStream.close(); } catch (IOException e) { throw AxisFault.makeFault(e); } } } Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO); if (axis2repoPara != null) { repoLocation = (String) axis2repoPara.getValue(); } if (!(repoLocation == null || "".equals(repoLocation))) { loadRepository(repoLocation); } else { loadFromClassPath(); } axisConfig.setConfigurator(this); return axisConfig; } public void engageGlobalModules() throws AxisFault { engageModules(); } public void loadServices() { if (!(repoLocation == null || "".equals(repoLocation))) { super.loadServices(); } } } ./src/org/apache/axis2/deployment/repository/0000775000175000017500000000000011767656530020431 5ustar brianbrian./src/org/apache/axis2/deployment/repository/util/0000775000175000017500000000000011767656530021406 5ustar brianbrian./src/org/apache/axis2/deployment/repository/util/ArchiveReader.java0000664000175000017500000006541411767656530024767 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.repository.util; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.deployment.DeploymentErrorMsgs; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.DescriptionBuilder; import org.apache.axis2.deployment.ModuleBuilder; import org.apache.axis2.deployment.ServiceBuilder; import org.apache.axis2.deployment.ServiceGroupBuilder; import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator; import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver; import org.apache.axis2.deployment.resolver.WarBasedWSDLLocator; import org.apache.axis2.deployment.resolver.WarFileBasedURIResolver; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder; import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.WSDLToAxisServiceBuilder; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.namespace.Constants; import org.apache.axis2.util.Utils; import org.apache.axis2.util.XMLUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ArchiveReader implements DeploymentConstants { private static final Log log = LogFactory.getLog(ArchiveReader.class); public ArrayList buildServiceGroup(InputStream zin, DeploymentFileData currentFile, AxisServiceGroup axisServiceGroup, HashMap wsdlServices, ConfigurationContext configCtx) throws XMLStreamException, AxisFault { DescriptionBuilder builder = new DescriptionBuilder(zin, configCtx); OMElement rootElement = builder.buildOM(); String elementName = rootElement.getLocalName(); if (TAG_SERVICE.equals(elementName)) { AxisService axisService = null; String serviceName = DescriptionBuilder.getShortFileName(currentFile.getName()); if (serviceName != null) { axisService = (AxisService) wsdlServices.get(serviceName); } if (axisService == null) { axisService = (AxisService) wsdlServices.get( DescriptionBuilder.getShortFileName(currentFile.getName())); } if (axisService == null) { axisService = new AxisService(serviceName); } else { axisService.setWsdlFound(true); axisService.setCustomWsdl(true); } axisService.setParent(axisServiceGroup); axisService.setClassLoader(currentFile.getClassLoader()); ServiceBuilder serviceBuilder = new ServiceBuilder(configCtx, axisService); serviceBuilder.setWsdlServiceMap(wsdlServices); AxisService service = serviceBuilder.populateService(rootElement); ArrayList serviceList = new ArrayList(); serviceList.add(service); return serviceList; } else if (TAG_SERVICE_GROUP.equals(elementName)) { ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement, wsdlServices, configCtx); return groupBuilder.populateServiceGroup(axisServiceGroup); } throw new AxisFault("Invalid services.xml found"); } /** * Extracts Service XML files and builds the service groups. * * @param filename * @param axisServiceGroup * @param extractService * @param wsdls * @param configCtx * @return Returns ArrayList. * @throws DeploymentException */ public ArrayList processServiceGroup(String filename, DeploymentFileData currentFile, AxisServiceGroup axisServiceGroup, boolean extractService, HashMap wsdls, ConfigurationContext configCtx) throws AxisFault { // get attribute values if (!extractService) { ZipInputStream zin = null; FileInputStream fin = null; try { fin = new FileInputStream(filename); zin = new ZipInputStream(fin); ZipEntry entry; while ((entry = zin.getNextEntry()) != null) { if (entry.getName().equalsIgnoreCase(SERVICES_XML)) { axisServiceGroup.setServiceGroupName( DescriptionBuilder.getShortFileName(currentFile.getName())); return buildServiceGroup(zin, currentFile, axisServiceGroup, wsdls, configCtx); } } throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND, filename)); } catch (Exception e) { throw new DeploymentException(e); } finally { if (zin != null) { try { zin.close(); } catch (IOException e) { log.info(Messages.getMessage("errorininputstreamclose")); } } if (fin != null) { try { fin.close(); } catch (IOException e) { log.info(Messages.getMessage("errorininputstreamclose")); } } } } else { File file = new File(filename, SERVICES_XML); if (!file.exists()) { // try for meta-inf file = new File(filename, SERVICES_XML.toLowerCase()); } if (file.exists()) { InputStream in = null; try { in = new FileInputStream(file); axisServiceGroup.setServiceGroupName(currentFile.getName()); return buildServiceGroup(in, currentFile, axisServiceGroup, wsdls, configCtx); } catch (FileNotFoundException e) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND, e.getMessage())); } catch (XMLStreamException e) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.XML_STREAM_EXCEPTION, e.getMessage())); } finally { if (in != null) { try { in.close(); } catch (IOException e) { log.info(Messages.getMessage("errorininputstreamclose")); } } } } else { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND)); } } } /** * Creats AxisService. * * @param in * @return Returns AxisService. * @throws DeploymentException */ private List processWSDLFile(WSDLToAxisServiceBuilder axisServiceBuilder, File serviceArchiveFile, boolean isArchive, InputStream in, String baseURI) throws DeploymentException { try { if (serviceArchiveFile != null && isArchive) { axisServiceBuilder.setCustomResolver( new AARFileBasedURIResolver(serviceArchiveFile)); if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setCustomWSDLResolver( new AARBasedWSDLLocator(baseURI, serviceArchiveFile, in)); ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setDocumentBaseUri( serviceArchiveFile.getCanonicalFile().toURI().toString()); } else if (axisServiceBuilder instanceof WSDL20ToAllAxisServicesBuilder) { ((WSDL20ToAllAxisServicesBuilder) axisServiceBuilder).setCustomWSDLResolver( new AARBasedWSDLLocator(baseURI, serviceArchiveFile, in)); // trying to use the jar scheme as the base URI. I think this can be used to handle // wsdl 1.1 as well without using a custom URI resolver. Need to look at it later. axisServiceBuilder.setBaseUri( "jar:file://" + serviceArchiveFile.toURI() + "!/" + baseURI); } } else { if (serviceArchiveFile != null) { axisServiceBuilder.setBaseUri( serviceArchiveFile.getParentFile().toURI().toString()); if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setDocumentBaseUri( serviceArchiveFile.getCanonicalFile().toURI().toString()); } } } if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { return ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).populateAllServices(); } else if (axisServiceBuilder instanceof WSDL20ToAllAxisServicesBuilder) { return ((WSDL20ToAllAxisServicesBuilder) axisServiceBuilder).populateAllServices(); } } catch (AxisFault axisFault) { log.info("Trouble processing wsdl file :" + axisFault.getMessage()); if (log.isDebugEnabled()) { log.debug(axisFault); } } catch (IOException ioex) { log.info("Trouble processing wsdl file :" + ioex.getMessage()); if (log.isDebugEnabled()) { log.debug(ioex); } } return null; } /** * Creates service objects from wsdl file inside a service archive file. * * @param file ArchiveFileData * @throws DeploymentException DeploymentException */ public HashMap processWSDLs(DeploymentFileData file) throws DeploymentException { File serviceFile = file.getFile(); // to store service come from wsdl files HashMap servicesMap = new HashMap(); boolean isDirectory = serviceFile.isDirectory(); if (isDirectory) { try { File metaInfFolder = new File(serviceFile, META_INF); if (!metaInfFolder.exists()) { metaInfFolder = new File(serviceFile, META_INF.toLowerCase()); if (!metaInfFolder.exists()) { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.META_INF_MISSING, serviceFile.getName())); } } processFilesInFolder(metaInfFolder, servicesMap); } catch (FileNotFoundException e) { throw new DeploymentException(e); } catch (IOException e) { throw new DeploymentException(e); } catch (XMLStreamException e) { throw new DeploymentException(e); } } else { ZipInputStream zin; FileInputStream fin; try { fin = new FileInputStream(serviceFile); zin = new ZipInputStream(fin); //TODO Check whether this WSDL is empty ZipEntry entry; byte[] buf = new byte[1024]; int read; ByteArrayOutputStream out; while ((entry = zin.getNextEntry()) != null) { String entryName = entry.getName().toLowerCase(); if (entryName.startsWith(META_INF.toLowerCase()) && entryName.endsWith(SUFFIX_WSDL)) { out = new ByteArrayOutputStream(); // we do not want to generate the services for the // imported wsdl of one file. if ((entryName.indexOf("/") != entryName.lastIndexOf("/")) || (entryName.indexOf("wsdl_") != -1)) { //only care abt the toplevel wsdl continue; } while ((read = zin.read(buf)) > 0) { out.write(buf, 0, read); } ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); // now the question is which version of WSDL file this archive contains. // lets check the namespace of the root element and decide. But since we are // using axiom (dude, you are becoming handy here :)), we will not build the // whole thing. OMNamespace documentElementNS = ((OMElement) XMLUtils.toOM(in)).getNamespace(); if (documentElementNS != null) { WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder; if (WSDL2Constants.WSDL_NAMESPACE .equals(documentElementNS.getNamespaceURI())) { // we have a WSDL 2.0 document here. wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); wsdlToAxisServiceBuilder.setBaseUri(entryName); } else if (Constants.NS_URI_WSDL11. equals(documentElementNS.getNamespaceURI())) { wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(entryName); } else { throw new DeploymentException(Messages.getMessage("invalidWSDLFound")); } List services = processWSDLFile(wsdlToAxisServiceBuilder, serviceFile, true, new ByteArrayInputStream( out.toByteArray()), entry.getName()); if (services != null) { for (int i = 0; i < services.size(); i++) { AxisService axisService = (AxisService) services.get(i); if (axisService != null) { servicesMap.put(axisService.getName(), axisService); } } } } } } try { zin.close(); } catch (IOException e) { log.info(e); } try { fin.close(); } catch (IOException e) { log.info(e); } } catch (FileNotFoundException e) { throw new DeploymentException(e); } catch (IOException e) { throw new DeploymentException(e); } catch (XMLStreamException e) { throw new DeploymentException(e); } } return servicesMap; } public List getAxisServiceFromWsdl(InputStream in, ClassLoader loader, String wsdlUrl) throws Exception { // ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); // now the question is which version of WSDL file this archive contains. // lets check the namespace of the root element and decide. But since we are // using axiom (dude, you are becoming handy here :)), we will not build the // whole thing. OMElement element = (OMElement) XMLUtils.toOM(in); OMNamespace documentElementNS = element.getNamespace(); if (documentElementNS != null) { WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder; ByteArrayOutputStream out = new ByteArrayOutputStream(); element.serialize(out); if (Constants.NS_URI_WSDL11. equals(documentElementNS.getNamespaceURI())) { wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl, loader, new ByteArrayInputStream( out.toByteArray()))); wsdlToAxisServiceBuilder.setCustomResolver( new WarFileBasedURIResolver(loader)); return ((WSDL11ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices(); } else if (WSDL2Constants.WSDL_NAMESPACE. equals(documentElementNS.getNamespaceURI())){ wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl, loader, new ByteArrayInputStream( out.toByteArray()))); wsdlToAxisServiceBuilder.setCustomResolver( new WarFileBasedURIResolver(loader)); return ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices(); } else { throw new DeploymentException(Messages.getMessage("invalidWSDLFound")); } } return null; } public void processFilesInFolder(File folder, HashMap servicesMap) throws FileNotFoundException, XMLStreamException, DeploymentException { File files[] = folder.listFiles(); for (int i = 0; i < files.length; i++) { File file1 = files[i]; if (file1.getName().toLowerCase().endsWith(SUFFIX_WSDL)) { InputStream in = new FileInputStream(file1); FileInputStream in2; // now the question is which version of WSDL file this archive contains. // lets check the namespace of the root element and decide. But since we are // using axiom (dude, you are becoming handy here :)), we will not build the // whole thing. OMNamespace documentElementNS = ((OMElement) XMLUtils.toOM(in)).getNamespace(); if (documentElementNS != null) { WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder; if (WSDL2Constants.WSDL_NAMESPACE .equals(documentElementNS.getNamespaceURI())) { // we have a WSDL 2.0 document here. in2 = new FileInputStream(file1); wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder(in2); } else if (Constants.NS_URI_WSDL11. equals(documentElementNS.getNamespaceURI())) { in2 = new FileInputStream(file1); wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(in2); ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(file1.toURI() .toString()); } else { throw new DeploymentException(Messages.getMessage("invalidWSDLFound")); } FileInputStream in3 = new FileInputStream(file1); List services = processWSDLFile(wsdlToAxisServiceBuilder, file1, false, in2, file1.toURI().toString()); if (services != null) { for (int j = 0; j < services.size(); j++) { AxisService axisService = (AxisService) services.get(j); if (axisService != null) { servicesMap.put(axisService.getName(), axisService); } } } try { in2.close(); in3.close(); } catch (IOException e) { log.info(e); } } try { in.close(); } catch (IOException e) { log.info(e); } } } } public void readModuleArchive(DeploymentFileData deploymentFile, AxisModule module, boolean explodedDir, AxisConfiguration axisConfig) throws DeploymentException { // get attribute values boolean moduleXMLFound = false; String shortFileName = DescriptionBuilder.getShortFileName(deploymentFile.getName()); if (!explodedDir) { ZipInputStream zin; FileInputStream fin; try { fin = new FileInputStream(deploymentFile.getAbsolutePath()); zin = new ZipInputStream(fin); ZipEntry entry; while ((entry = zin.getNextEntry()) != null) { if (entry.getName().equalsIgnoreCase(MODULE_XML)) { moduleXMLFound = true; ModuleBuilder builder = new ModuleBuilder(zin, module, axisConfig); // setting module name module.setName(Utils.getModuleName(shortFileName)); module.setVersion(Utils.getModuleVersion(shortFileName)); builder.populateModule(); break; } } zin.close(); fin.close(); if (!moduleXMLFound) { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.MODULE_XML_MISSING, deploymentFile.getAbsolutePath())); } } catch (Exception e) { throw new DeploymentException(e); } } else { File file = new File(deploymentFile.getAbsolutePath(), MODULE_XML); if (file.exists() || (file = new File(deploymentFile.getAbsolutePath(), MODULE_XML.toLowerCase())) .exists()) { InputStream in = null; try { in = new FileInputStream(file); ModuleBuilder builder = new ModuleBuilder(in, module, axisConfig); // setting module name module.setName(Utils.getModuleName(shortFileName)); module.setVersion(Utils.getModuleVersion(shortFileName)); builder.populateModule(); } catch (FileNotFoundException e) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND, e.getMessage())); } finally { if (in != null) { try { in.close(); } catch (IOException e) { log.info(Messages.getMessage("errorininputstreamclose")); } } } } else { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.MODULE_XML_MISSING, deploymentFile.getAbsolutePath())); } } } } ./src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java0000664000175000017500000001015611767656530025766 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.repository.util; import org.apache.axis2.AxisFault; import org.apache.axis2.deployment.Deployer; import org.apache.axis2.deployment.DeploymentErrorMsgs; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.i18n.Messages; import java.io.File; import java.net.URL; /** * DeploymentFileData represents a "thing to deploy" in Axis2. It consists of a file, * a deployment ClassLoader, and a Deployer. */ public class DeploymentFileData { private File file; private ClassLoader classLoader; private Deployer deployer; public DeploymentFileData(File file) { this.file = file; } public DeploymentFileData(File file, Deployer deployer) { this(file); this.deployer = deployer; } public String getAbsolutePath() { return file.getAbsolutePath(); } public ClassLoader getClassLoader() { return classLoader; } public File getFile() { return file; } /** * Get the name of the file. * * @return the name of the referenced file */ public String getName() { return file.getName(); // No need to check for null due to constructor check } /** * Get the name of the file. * * @return the name of the referenced file * @deprecated please use getName() instead - this will disappear after 1.3. */ public String getServiceName() { return getName(); } public static boolean isModuleArchiveFile(String filename) { return (filename.endsWith(".mar")); } /** * Checks whether a given file is a jar or an aar file. * * @param filename file to check * @return Returns boolean. */ public static boolean isServiceArchiveFile(String filename) { return ((filename.endsWith(".jar")) | (filename.endsWith(".aar"))); } public static String getFileExtension(String fileName) { int index = fileName.lastIndexOf('.'); return fileName.substring(index + 1); } public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } public void setClassLoader(boolean isDirectory, ClassLoader parent, File file) throws AxisFault { if (!isDirectory) { if (this.file != null) { URL[] urlsToLoadFrom; try { if (!this.file.exists()) { throw new AxisFault(Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND, this.file.getAbsolutePath())); } urlsToLoadFrom = new URL[]{this.file.toURL()}; classLoader = Utils.createClassLoader(urlsToLoadFrom, parent, true, file); } catch (Exception e) { throw AxisFault.makeFault(e); } } } else { if (this.file != null) { classLoader = Utils.getClassLoader(parent, this.file); } } } public Deployer getDeployer() { return deployer; } public void setDeployer(Deployer deployer) { this.deployer = deployer; } public void deploy() throws DeploymentException { deployer.deploy(this); } } ./src/org/apache/axis2/deployment/repository/util/WSInfo.java0000664000175000017500000000371011767656530023417 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.repository.util; import org.apache.axis2.deployment.Deployer; public class WSInfo { private String fileName; private long lastModifiedDate; public static final int TYPE_SERVICE = 0; public static final int TYPE_MODULE = 1; public static final int TYPE_CUSTOM = 2; /** * To check whether the file is a module or a service */ private int type = TYPE_SERVICE; private Deployer deployer; public WSInfo(String fileName, long lastModifiedDate, Deployer deployer ,int type) { this.fileName = fileName; this.lastModifiedDate = lastModifiedDate; this.deployer = deployer; this.type = type; } public String getFileName() { return fileName; } public long getLastModifiedDate() { return lastModifiedDate; } public int getType() { return type; } public void setFileName(String fileName) { this.fileName = fileName; } public void setLastModifiedDate(long lastmodifieddate) { this.lastModifiedDate = lastmodifieddate; } public Deployer getDeployer() { return deployer; } } ./src/org/apache/axis2/deployment/repository/util/WSInfoList.java0000664000175000017500000001565211767656530024263 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.repository.util; import org.apache.axis2.deployment.Deployer; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.deployment.DeploymentEngine; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class WSInfoList implements DeploymentConstants { /** * This is to store all the jar files in a specified folder (WEB_INF) */ private List jarList = new ArrayList(); /** * All the currently updated jars */ public Map currentJars = new HashMap(); /** * Reference to DeploymentEngine to make update */ private boolean locked = false; private final DeploymentEngine deploymentEngine; public WSInfoList(DeploymentEngine deploy_engine) { deploymentEngine = deploy_engine; } /** * First checks whether the file is already available by the * system call fileExists. If it is not deployed yet then adds to the jarList * and to the deployment engine as a new service or module. * While adding new item to jarList, first creates the WSInfo object and * then adds to the jarlist and actual jar file is added to DeploymentEngine. *

        * If the files already exists, then checks whether it has been updated * then changes the last update date of the wsInfo and adds two entries to * DeploymentEngine - one for new deployment and other for undeployment. * * @param file actual jar files for either Module or service */ public synchronized void addWSInfoItem(File file, Deployer deployer , int type) { WSInfo info = (WSInfo) currentJars.get(file.getAbsolutePath()); if (info != null) { if (deploymentEngine.isHotUpdate() && isModified(file, info)) { WSInfo wsInfo = new WSInfo(info.getFileName(), info.getLastModifiedDate(), deployer,type); deploymentEngine.addWSToUndeploy(wsInfo); // add entry to undeploy list DeploymentFileData deploymentFileData = new DeploymentFileData(file, deployer); deploymentEngine.addWSToDeploy(deploymentFileData); // add entry to deploylist } } else { info = getFileItem(file, deployer, type); setLastModifiedDate(file, info); } jarList.add(info.getFileName()); } /** * Checks undeployed Services. Checks old jars files and current jars. * If name of the old jar file does not exist in the current jar * list then it is assumed that the jar file has been removed * and that is hot undeployment. */ private synchronized void checkForUndeployedServices() { if(!locked) { locked = true; } else{ return; } Iterator infoItems = currentJars.keySet().iterator(); List tobeRemoved = new ArrayList(); while (infoItems.hasNext()) { String fileName = (String) infoItems.next(); WSInfo infoItem = (WSInfo) currentJars.get(fileName); if (infoItem.getType() == WSInfo.TYPE_MODULE) { continue; } //seems like someone has deleted the file , so need to undeploy boolean found = false; for (int i = 0; i < jarList.size(); i++) { String s = (String) jarList.get(i); if(fileName.equals(s)){ found = true; } } if(!found){ tobeRemoved.add(fileName); deploymentEngine.addWSToUndeploy(infoItem); } } for (int i = 0; i < tobeRemoved.size(); i++) { String fileName = (String) tobeRemoved.get(i); currentJars.remove(fileName); } tobeRemoved.clear(); jarList.clear(); locked = false; } /** * Clears the jarlist. */ public void init() { jarList.clear(); } /** * */ public void update() { synchronized (deploymentEngine) { checkForUndeployedServices(); deploymentEngine.unDeploy(); deploymentEngine.doDeploy(); } } /** * Gets the WSInfo object related to a file if it exists, null otherwise. * */ private WSInfo getFileItem(File file , Deployer deployer , int type) { String fileName = file.getName(); WSInfo info = (WSInfo) currentJars.get(fileName); if(info==null){ info = new WSInfo(file.getAbsolutePath(), file.lastModified(), deployer ,type); currentJars.put(file.getAbsolutePath(), info); DeploymentFileData fileData = new DeploymentFileData(file, deployer); deploymentEngine.addWSToDeploy(fileData); } return info; } /** * Checks if a file has been modified by comparing the last update date of * both files and WSInfo. If they are different, the file is assumed to have * been modified. * * @param file * @param wsInfo */ private boolean isModified(File file, WSInfo wsInfo) { long currentTimeStamp = wsInfo.getLastModifiedDate(); setLastModifiedDate(file, wsInfo); return (currentTimeStamp != wsInfo.getLastModifiedDate()); } /** * Obtains the newest (as compared with timestamp stored in wsInfo) * timestamp and stores it in WSInfo. */ private void setLastModifiedDate(File file, WSInfo wsInfo) { if (file.isDirectory()) { File files [] = file.listFiles(); for (int i = 0; i < files.length; i++) { File fileItem = files[i]; if (fileItem.isDirectory()) { setLastModifiedDate(fileItem, wsInfo); } else if(wsInfo.getLastModifiedDate() < fileItem.lastModified()) { wsInfo.setLastModifiedDate(fileItem.lastModified()); } } } else if(wsInfo.getLastModifiedDate() < file.lastModified()) { wsInfo.setLastModifiedDate(file.lastModified()); } } } ./src/org/apache/axis2/deployment/DeploymentEngine.java0000664000175000017500000013445111767656530022333 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.repository.util.ArchiveReader; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.deployment.repository.util.WSInfo; import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator; import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver; import org.apache.axis2.deployment.scheduler.DeploymentIterator; import org.apache.axis2.deployment.scheduler.Scheduler; import org.apache.axis2.deployment.scheduler.SchedulerTask; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Flow; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.JavaUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public abstract class DeploymentEngine implements DeploymentConstants { private static final Log log = LogFactory.getLog(DeploymentEngine.class); //to keep the web resource location if any protected static String webLocationString = null; protected Scheduler scheduler; public static void setWebLocationString(String webLocationString) { DeploymentEngine.webLocationString = webLocationString; } /** * Support for hot update is controlled by this flag */ protected boolean hotUpdate = true; /** * Support for hot deployment is controlled by this flag */ protected boolean hotDeployment = true; /** * Stores all the web Services to deploy. */ protected List wsToDeploy = new ArrayList(); /** * Stores all the web Services to undeploy. */ protected List wsToUnDeploy = new ArrayList(); /** * to keep a ref to engine register * this ref will pass to engine when it call start() * method */ protected AxisConfiguration axisConfig; protected ConfigurationContext configContext; protected RepositoryListener repoListener; protected String servicesPath = null; protected File servicesDir = null; protected String modulesPath = null; protected File modulesDir = null; private File repositoryDir = null; //to deploy service (both aar and expanded) protected ServiceDeployer serviceDeployer; //To deploy modules (both mar and expanded) protected ModuleDeployer moduleDeployer; //To keep the mapping that which directory will contain which type , // for exmaple directory services will contains .aar private HashMap directoryToExtensionMappingMap = new HashMap(); //to keep map of which deployer can process which file extension , // for example ServiceDeployer will process .aar file private HashMap extensionToDeployerMappingMap = new HashMap(); public void loadServices() { repoListener.checkServices(); if (hotDeployment) { startSearch(repoListener); } } public void loadRepository(String repoDir) throws DeploymentException { File axisRepo = new File(repoDir); if (!axisRepo.exists()) { throw new DeploymentException( Messages.getMessage("cannotfindrepo", repoDir)); } setDeploymentFeatures(); prepareRepository(repoDir); // setting the CLs setClassLoaders(repoDir); repoListener = new RepositoryListener(this, false); org.apache.axis2.util.Utils .calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig); try { try { axisConfig.setRepository(axisRepo.toURL()); } catch (MalformedURLException e) { log.info(e.getMessage()); } axisConfig.validateSystemPredefinedPhases(); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } public void loadFromClassPath() throws DeploymentException { //loading modules from the classpath new RepositoryListener(this, true); org.apache.axis2.util.Utils.calculateDefaultModuleVersion( axisConfig.getModules(), axisConfig); axisConfig.validateSystemPredefinedPhases(); try { engageModules(); } catch (AxisFault axisFault) { log.info(Messages.getMessage(DeploymentErrorMsgs.MODULE_VALIDATION_FAILED, axisFault.getMessage())); throw new DeploymentException(axisFault); } } public void loadServicesFromUrl(URL repoURL) { try { String path = servicesPath == null ? DeploymentConstants.SERVICE_PATH : servicesPath; if (!path.endsWith("/")) { path += "/"; } String repoPath = repoURL.getPath(); if (!repoPath.endsWith("/")) { repoPath += "/"; repoURL = new URL(repoURL.getProtocol() + "://" + repoPath); } URL servicesDir = new URL(repoURL, path); URL filelisturl = new URL(servicesDir, "services.list"); ArrayList files = getFileList(filelisturl); for (Iterator fileIterator = files.iterator(); fileIterator.hasNext();) { String fileUrl = (String) fileIterator.next(); if (fileUrl.endsWith(".aar")) { AxisServiceGroup serviceGroup = new AxisServiceGroup(); URL servicesURL = new URL(servicesDir, fileUrl); ArrayList servicelist = populateService(serviceGroup, servicesURL, fileUrl.substring(0, fileUrl.indexOf(".aar"))); addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig); log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS, org.apache.axis2.util.Utils.getModuleName(serviceGroup.getServiceGroupName()), servicesURL.toString())); } } } catch (MalformedURLException e) { log.error(e.getMessage(), e); } catch (IOException e) { log.error(e.getMessage(), e); } } public void loadRepositoryFromURL(URL repoURL) throws DeploymentException { try { String path = modulesPath == null ? DeploymentConstants.MODULE_PATH : modulesPath; if (!path.endsWith("/")) { path = path + "/"; } String repoPath = repoURL.getPath(); if (!repoPath.endsWith("/")) { repoPath += "/"; repoURL = new URL(repoURL.getProtocol() + "://" + repoPath); } URL moduleDir = new URL(repoURL, path); URL filelisturl = new URL(moduleDir, "modules.list"); ArrayList files = getFileList(filelisturl); Iterator fileIterator = files.iterator(); while (fileIterator.hasNext()) { String fileUrl = (String) fileIterator.next(); if (fileUrl.endsWith(".mar")) { URL moduleurl = new URL(moduleDir, fileUrl); ClassLoader deploymentClassLoader = Utils.createClassLoader( new URL[]{moduleurl}, axisConfig.getModuleClassLoader(), true, (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); AxisModule module = new AxisModule(); module.setModuleClassLoader(deploymentClassLoader); module.setParent(axisConfig); String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar")); if (module.getName() == null) { module.setName(org.apache.axis2.util.Utils.getModuleName(moduleFile)); module.setVersion(org.apache.axis2.util.Utils.getModuleVersion(moduleFile)); } populateModule(module, moduleurl); module.setFileName(moduleurl); addNewModule(module, axisConfig); log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE, org.apache.axis2.util.Utils.getModuleName(module.getName(), module.getVersion()), moduleurl.toString())); } } org.apache.axis2.util.Utils. calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig); axisConfig.validateSystemPredefinedPhases(); } catch (MalformedURLException e) { throw new DeploymentException(e); } catch (IOException e) { throw new DeploymentException(e); } } private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException { try { ClassLoader classLoader = module.getModuleClassLoader(); InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml"); if (moduleStream == null) { moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml"); } if (moduleStream == null) { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString())); } ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig); moduleBuilder.populateModule(); } catch (IOException e) { throw new DeploymentException(e); } } protected ArrayList populateService(AxisServiceGroup serviceGroup, URL servicesURL, String serviceName) throws DeploymentException { try { serviceGroup.setServiceGroupName(serviceName); ClassLoader serviceClassLoader = Utils.createClassLoader( new URL[]{servicesURL}, axisConfig.getServiceClassLoader(), true, (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); String metainf = "meta-inf"; serviceGroup.setServiceGroupClassLoader(serviceClassLoader); //processing wsdl.list InputStream wsdlfilesStream = serviceClassLoader.getResourceAsStream("meta-inf/wsdl.list"); if (wsdlfilesStream == null) { wsdlfilesStream = serviceClassLoader.getResourceAsStream("META-INF/wsdl.list"); if (wsdlfilesStream != null) { metainf = "META-INF"; } } HashMap servicesMap = new HashMap(); if (wsdlfilesStream != null) { ArchiveReader reader = new ArchiveReader(); BufferedReader input = new BufferedReader(new InputStreamReader(wsdlfilesStream)); String line; while ((line = input.readLine()) != null) { line = line.trim(); if (line.length() > 0 && line.charAt(0)!='#') { line = metainf + "/" + line; try { List services = reader.getAxisServiceFromWsdl( serviceClassLoader.getResourceAsStream(line), serviceClassLoader, line); if (services != null) { for (int i = 0; i < services.size(); i++) { AxisService axisService = (AxisService) services.get(i); servicesMap.put(axisService.getName(), axisService); } } } catch (Exception e) { throw new DeploymentException(e); } } } } InputStream servicexmlStream = serviceClassLoader.getResourceAsStream("META-INF/services.xml"); if (servicexmlStream == null) { servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml"); } else { metainf = "META-INF"; } if (servicexmlStream == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND, servicesURL.toString())); } DescriptionBuilder builder = new DescriptionBuilder(servicexmlStream, configContext); OMElement rootElement = builder.buildOM(); String elementName = rootElement.getLocalName(); if (TAG_SERVICE.equals(elementName)) { AxisService axisService = null; String wsdlLocation = "META-INF/service.wsdl"; InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation); URL wsdlURL = serviceClassLoader.getResource(metainf + "/service.wsdl"); if (wsdlStream == null) { wsdlLocation = "META-INF/" + serviceName + ".wsdl"; wsdlStream = serviceClassLoader .getResourceAsStream(wsdlLocation); wsdlURL = serviceClassLoader.getResource(wsdlLocation); } if (wsdlStream != null) { WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = new WSDL11ToAxisServiceBuilder(wsdlStream, null, null); File file = Utils.toFile(servicesURL); if(file != null && file.exists()){ wsdl2AxisServiceBuilder.setCustomWSLD4JResolver( new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream)); wsdl2AxisServiceBuilder.setCustomResolver( new AARFileBasedURIResolver(file)); } if (wsdlURL != null) { wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString()); } axisService = wsdl2AxisServiceBuilder.populateService(); axisService.setWsdlFound(true); axisService.setCustomWsdl(true); axisService.setName(serviceName); } if (axisService == null) { axisService = new AxisService(serviceName); } axisService.setParent(serviceGroup); axisService.setClassLoader(serviceClassLoader); ServiceBuilder serviceBuilder = new ServiceBuilder(configContext, axisService); AxisService service = serviceBuilder.populateService(rootElement); ArrayList serviceList = new ArrayList(); serviceList.add(service); return serviceList; } else if (TAG_SERVICE_GROUP.equals(elementName)) { ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement, servicesMap, configContext); ArrayList servicList = groupBuilder.populateServiceGroup(serviceGroup); Iterator serviceIterator = servicList.iterator(); while (serviceIterator.hasNext()) { AxisService axisService = (AxisService) serviceIterator.next(); String wsdlLocation = "META-INF/service.wsdl"; InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation); URL wsdlURL = serviceClassLoader.getResource(wsdlLocation); if (wsdlStream == null) { wsdlLocation = "META-INF/" + serviceName + ".wsdl"; wsdlStream = serviceClassLoader .getResourceAsStream(wsdlLocation); wsdlURL = serviceClassLoader.getResource(wsdlLocation); } if (wsdlStream != null) { WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = new WSDL11ToAxisServiceBuilder(wsdlStream, axisService); File file = Utils.toFile(servicesURL); if(file != null && file.exists()){ wsdl2AxisServiceBuilder.setCustomWSLD4JResolver( new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream)); wsdl2AxisServiceBuilder.setCustomResolver( new AARFileBasedURIResolver(file)); } if (wsdlURL != null) { wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString()); } axisService = wsdl2AxisServiceBuilder.populateService(); axisService.setWsdlFound(true); axisService.setCustomWsdl(true); // Set the default message receiver for the operations that were // not listed in the services.xml Iterator operations = axisService.getOperations(); while (operations.hasNext()) { AxisOperation operation = (AxisOperation) operations.next(); if (operation.getMessageReceiver() == null) { operation.setMessageReceiver(loadDefaultMessageReceiver( operation.getMessageExchangePattern(), axisService)); } } } } return servicList; } } catch (IOException e) { throw new DeploymentException(e); } catch (XMLStreamException e) { throw new DeploymentException(e); } return null; } protected MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) { MessageReceiver messageReceiver; if (mepURL == null) { mepURL = WSDL2Constants.MEP_URI_IN_OUT; } if (service != null) { messageReceiver = service.getMessageReceiver(mepURL); if (messageReceiver != null) { return messageReceiver; } } return axisConfig.getMessageReceiver(mepURL); } public static void addNewModule(AxisModule modulemetadata, AxisConfiguration axisConfiguration) throws AxisFault { Flow inflow = modulemetadata.getInFlow(); ClassLoader moduleClassLoader = modulemetadata.getModuleClassLoader(); if (inflow != null) { Utils.addFlowHandlers(inflow, moduleClassLoader); } Flow outFlow = modulemetadata.getOutFlow(); if (outFlow != null) { Utils.addFlowHandlers(outFlow, moduleClassLoader); } Flow faultInFlow = modulemetadata.getFaultInFlow(); if (faultInFlow != null) { Utils.addFlowHandlers(faultInFlow, moduleClassLoader); } Flow faultOutFlow = modulemetadata.getFaultOutFlow(); if (faultOutFlow != null) { Utils.addFlowHandlers(faultOutFlow, moduleClassLoader); } axisConfiguration.addModule(modulemetadata); log.debug(Messages.getMessage(DeploymentErrorMsgs.ADDING_NEW_MODULE)); } public static void addServiceGroup(AxisServiceGroup serviceGroup, ArrayList serviceList, URL serviceLocation, DeploymentFileData currentDeploymentFile, AxisConfiguration axisConfiguration) throws AxisFault { fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfiguration); axisConfiguration.addServiceGroup(serviceGroup); if (currentDeploymentFile != null) { addAsWebResources(currentDeploymentFile.getFile(), serviceGroup.getServiceGroupName(), serviceGroup); } } protected static void fillServiceGroup(AxisServiceGroup serviceGroup, ArrayList serviceList, URL serviceLocation, AxisConfiguration axisConfig) throws AxisFault { // serviceGroup.setParent(axisConfig); // module from services.xml at serviceGroup level ArrayList groupModules = serviceGroup.getModuleRefs(); serviceGroup.setParent(axisConfig); for (int i = 0; i < groupModules.size(); i++) { String moduleName = (String) groupModules.get(i); AxisModule module = axisConfig.getModule(moduleName); if (module != null) { serviceGroup.engageModule(axisConfig.getModule(moduleName)); } else { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.BAD_MODULE_FROM_SERVICE, serviceGroup.getServiceGroupName(), moduleName)); } } Iterator services = serviceList.iterator(); while (services.hasNext()) { AxisService axisService = (AxisService) services.next(); axisService.setUseDefaultChains(false); axisService.setFileName(serviceLocation); serviceGroup.addService(axisService); // modules from ArrayList list = axisService.getModules(); for (int i = 0; i < list.size(); i++) { AxisModule module = axisConfig.getModule((String) list.get(i)); if (module == null) { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.BAD_MODULE_FROM_SERVICE, axisService.getName(), ((QName) list.get(i)).getLocalPart())); } axisService.engageModule(module); } for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) { AxisOperation opDesc = (AxisOperation) iterator.next(); ArrayList modules = opDesc.getModuleRefs(); for (int i = 0; i < modules.size(); i++) { String moduleName = (String) modules.get(i); AxisModule module = axisConfig.getModule(moduleName); if (module != null) { opDesc.engageModule(module); } else { throw new DeploymentException( Messages.getMessage( DeploymentErrorMsgs.BAD_MODULE_FROM_OPERATION, opDesc.getName().getLocalPart(), moduleName)); } } } } } /** * @param file ArchiveFileData */ public void addWSToDeploy(DeploymentFileData file) { wsToDeploy.add(file); } /** * @param file WSInfo */ public void addWSToUndeploy(WSInfo file) { wsToUnDeploy.add(file); } public void doDeploy() { try { if (wsToDeploy.size() > 0) { for (int i = 0; i < wsToDeploy.size(); i++) { DeploymentFileData fileToDeploy = (DeploymentFileData) wsToDeploy.get(i); try { fileToDeploy.deploy(); } catch (DeploymentException e) { // TODO : This probably isn't sufficient. Maybe provide an option to stop? log.info(e); } } } } finally { wsToDeploy.clear(); } } /** * Checks if the modules, referred by server.xml, exist or that they are deployed. * * @throws org.apache.axis2.AxisFault : If smt goes wrong */ public void engageModules() throws AxisFault { axisConfig.engageGlobalModules(); } /** * To get AxisConfiguration for a given inputStream this method can be used. * The inputstream should be a valid axis2.xml , else you will be getting * DeploymentExceptions. *

        * First creat a AxisConfiguration using given inputSream , and then it will * try to find the repository location parameter from AxisConfiguration, so * if user has add a parameter with the name "repository" , then the value * specified by that parameter will be the repository and system will try to * load modules and services from that repository location if it a valid * location. hot deployment and hot update will work as usual in this case. *

        * You will be getting AxisConfiguration corresponding to given inputstream * if it is valid , if something goes wrong you will be getting * DeploymentException * * @param in : InputStream to axis2.xml * @return a populated AxisConfiguration * @throws DeploymentException : If something goes wrong */ public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException { axisConfig = new AxisConfiguration(); AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig, this); builder.populateConfig(); try { if (in != null) { in.close(); } } catch (IOException e) { log.info("error in closing input stream"); } moduleDeployer = new ModuleDeployer(axisConfig); return axisConfig; } /** * Starts the Deployment engine to perform Hot deployment and so on. * * @param listener : RepositoryListener */ protected void startSearch(RepositoryListener listener) { scheduler = new Scheduler(); scheduler.schedule(new SchedulerTask(listener), new DeploymentIterator()); } public void unDeploy() { try { if (wsToUnDeploy.size() > 0) { for (int i = 0; i < wsToUnDeploy.size(); i++) { WSInfo wsInfo = (WSInfo) wsToUnDeploy.get(i); if (wsInfo.getType() == WSInfo.TYPE_SERVICE) { //No matter what we need to undeploy the service // if user has deleted the file from the repository serviceDeployer.unDeploy(wsInfo.getFileName()); } else { //We need to undeploy the service whether we have enable hotUpdate or not , // o.w what happen if someone delete the service from the repo Deployer deployer = wsInfo.getDeployer(); if (deployer != null) { deployer.unDeploy(wsInfo.getFileName()); } } } } } catch (Exception e) { log.info(e); } wsToUnDeploy.clear(); } /** * Gets AxisConfiguration. * * @return AxisConfiguration AxisConfiguration */ public AxisConfiguration getAxisConfig() { return axisConfig; } /** * Retrieves service name from the archive file name. * If the archive file name is service1.aar , then axis2 service name would be service1 * * @param fileName the archive file name * @return Returns String. */ public static String getAxisServiceName(String fileName) { char seperator = '.'; String value; int index = fileName.lastIndexOf(seperator); if (index > 0) { value = fileName.substring(0, index); return value; } return fileName; } public AxisModule getModule(String moduleName) throws AxisFault { return axisConfig.getModule(moduleName); } public boolean isHotUpdate() { return hotUpdate; } private static void addAsWebResources(File in, String serviceFileName, AxisServiceGroup serviceGroup) { try { if (webLocationString == null) { return; } if (in.isDirectory()) { return; } File webLocation = new File(webLocationString); File out = new File(webLocation, serviceFileName); int BUFFER = 1024; byte data[] = new byte[BUFFER]; FileInputStream fin = new FileInputStream(in); ZipInputStream zin = new ZipInputStream( fin); ZipEntry entry; while ((entry = zin.getNextEntry()) != null) { ZipEntry zip = new ZipEntry(entry); if (zip.getName().toUpperCase().startsWith("WWW")) { String fileName = zip.getName(); fileName = fileName.substring("WWW/".length(), fileName.length()); if (zip.isDirectory()) { new File(out, fileName).mkdirs(); } else { FileOutputStream tempOut = new FileOutputStream(new File(out, fileName)); int count; while ((count = zin.read(data, 0, BUFFER)) != -1) { tempOut.write(data, 0, count); } tempOut.close(); tempOut.flush(); } serviceGroup.setFoundWebResources(true); } } zin.close(); fin.close(); } catch (IOException e) { log.info(e.getMessage()); } } public static String getWebLocationString() { return webLocationString; } /** * To set the all the classLoader hierarchy this method can be used , the top most parent is * CCL then SCL(system Class Loader) * CCL * : * SCL * : : * MCCL SCCL * : : * MCL SCL *

        *

        * MCCL : module common class loader * SCCL : Service common class loader * MCL : module class loader * SCL : Service class loader * * @param axis2repoURI : The repository folder of Axis2 * @throws DeploymentException if there's a problem */ protected void setClassLoaders(String axis2repoURI) throws DeploymentException { ClassLoader sysClassLoader = Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI); axisConfig.setSystemClassLoader(sysClassLoader); if (servicesDir.exists()) { axisConfig.setServiceClassLoader( Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir)); } else { axisConfig.setServiceClassLoader(axisConfig.getSystemClassLoader()); } if (modulesDir.exists()) { axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(), modulesDir)); } else { axisConfig.setModuleClassLoader(axisConfig.getSystemClassLoader()); } } /** * Sets hotDeployment and hot update. */ protected void setDeploymentFeatures() { Parameter hotDeployment = axisConfig.getParameter(TAG_HOT_DEPLOYMENT); Parameter hotUpdate = axisConfig.getParameter(TAG_HOT_UPDATE); if (hotDeployment != null) { this.hotDeployment = JavaUtils.isTrue(hotDeployment.getValue(), true); } if (hotUpdate != null) { this.hotUpdate = JavaUtils.isTrue(hotUpdate.getValue(), true); } String serviceDirPara = (String) axisConfig.getParameterValue(DeploymentConstants.SERVICE_DIR_PATH); if (serviceDirPara != null) { servicesPath = serviceDirPara; } String moduleDirPara = (String) axisConfig.getParameterValue(DeploymentConstants.MODULE_DRI_PATH); if (moduleDirPara != null) { modulesPath = moduleDirPara; } } /** * Creates directories for modules/services, copies configuration xml from class loader if necessary * * @param repositoryName the pathname of the repository */ protected void prepareRepository(String repositoryName) { repositoryDir = new File(repositoryName); if (servicesPath != null) { servicesDir = new File(servicesPath); if (!servicesDir.exists()) { servicesDir = new File(repositoryDir, servicesPath); } } else { servicesDir = new File(repositoryDir, DeploymentConstants.SERVICE_PATH); } if (!servicesDir.exists()) { log.info(Messages.getMessage("noservicedirfound", getRepositoryPath(repositoryDir))); } if (modulesPath != null) { modulesDir = new File(modulesPath); if (!modulesDir.exists()) { modulesDir = new File(repositoryDir, modulesPath); } } else { modulesDir = new File(repositoryDir, DeploymentConstants.MODULE_PATH); } if (!modulesDir.exists()) { log.info(Messages.getMessage("nomoduledirfound", getRepositoryPath(repositoryDir))); } } protected String getRepositoryPath(File repository) { try { return repository.getCanonicalPath(); } catch (IOException e) { return repository.getAbsolutePath(); } } protected ArrayList getFileList(URL fileListUrl) { ArrayList fileList = new ArrayList(); InputStream in; try { in = fileListUrl.openStream(); } catch (IOException e) { return fileList; } BufferedReader input = null; try { input = new BufferedReader(new InputStreamReader(in)); String line; while ((line = input.readLine()) != null) { line = line.trim(); if (line.length() > 0 && line.charAt(0)!='#') { fileList.add(line); } } } catch (IOException ex) { ex.printStackTrace(); } finally { try { if (input != null) { input.close(); } } catch (IOException ex) { ex.printStackTrace(); } } return fileList; } public void setConfigContext(ConfigurationContext configContext) { this.configContext = configContext; initializeDeployers(this.configContext); } private void initializeDeployers(ConfigurationContext configContext) { serviceDeployer = new ServiceDeployer(); serviceDeployer.init(configContext); Iterator deployers = extensionToDeployerMappingMap.values().iterator(); while (deployers.hasNext()) { Deployer deployer = (Deployer) deployers.next(); deployer.init(configContext); } } /** * Builds an AxisModule for a given module archive file. This does not * called the init method since there is no reference to configuration context * so who ever create module using this has to called module.init if it is * required * * @param modulearchive : Actual module archive file * @param config : AxisConfiguration : for get classloaders etc.. * @return a complete AxisModule read from the file. * @throws org.apache.axis2.deployment.DeploymentException * if there's a problem */ public static AxisModule buildModule(File modulearchive, AxisConfiguration config) throws DeploymentException { final String MODULE_DEPLOYER = "moduleDeployer"; AxisModule axismodule; ModuleDeployer deployer = (ModuleDeployer) config.getParameterValue(MODULE_DEPLOYER); try { if (deployer == null) { deployer = new ModuleDeployer(config); config.addParameter(MODULE_DEPLOYER, deployer); } DeploymentFileData currentDeploymentFile = new DeploymentFileData(modulearchive, deployer); axismodule = new AxisModule(); ArchiveReader archiveReader = new ArchiveReader(); currentDeploymentFile.setClassLoader(false, config.getModuleClassLoader(), null); axismodule.setModuleClassLoader(currentDeploymentFile.getClassLoader()); archiveReader.readModuleArchive(currentDeploymentFile, axismodule, false, config); ClassLoader moduleClassLoader = axismodule.getModuleClassLoader(); Flow inflow = axismodule.getInFlow(); if (inflow != null) { Utils.addFlowHandlers(inflow, moduleClassLoader); } Flow outFlow = axismodule.getOutFlow(); if (outFlow != null) { Utils.addFlowHandlers(outFlow, moduleClassLoader); } Flow faultInFlow = axismodule.getFaultInFlow(); if (faultInFlow != null) { Utils.addFlowHandlers(faultInFlow, moduleClassLoader); } Flow faultOutFlow = axismodule.getFaultOutFlow(); if (faultOutFlow != null) { Utils.addFlowHandlers(faultOutFlow, moduleClassLoader); } } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } return axismodule; } /** * Fills an axisservice object using services.xml. First creates * an axisservice object using WSDL and then fills it using the given services.xml. * Loads all the required class and builds the chains, finally adds the * servicecontext to EngineContext and axisservice into EngineConfiguration. * * @param serviceInputStream InputStream containing configuration data * @param configCtx the ConfigurationContext in which we're deploying * @return Returns AxisService. * @throws DeploymentException if there's a problem */ public static AxisService buildService(InputStream serviceInputStream, ConfigurationContext configCtx) throws DeploymentException { AxisService axisService = new AxisService(); try { ServiceBuilder builder = new ServiceBuilder(serviceInputStream, configCtx, axisService); builder.populateService(builder.buildOM()); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } catch (XMLStreamException e) { throw new DeploymentException(e); } return axisService; } /** * To build a AxisServiceGroup for a given services.xml * You have to add the created group into AxisConfig * * @param servicesxml InputStream created from services.xml or equivalent * @param classLoader ClassLoader to use * @param serviceGroupName name of the service group * @param configCtx the ConfigurationContext in which we're deploying * @param archiveReader the ArchiveReader we're working with * @param wsdlServices Map of existing WSDL services * @return a fleshed-out AxisServiceGroup * @throws AxisFault if there's a problem */ public static AxisServiceGroup buildServiceGroup(InputStream servicesxml, ClassLoader classLoader, String serviceGroupName, ConfigurationContext configCtx, ArchiveReader archiveReader, HashMap wsdlServices) throws AxisFault { DeploymentFileData currentDeploymentFile = new DeploymentFileData(null, null); currentDeploymentFile.setClassLoader(classLoader); AxisServiceGroup serviceGroup = new AxisServiceGroup(); serviceGroup.setServiceGroupClassLoader(classLoader); serviceGroup.setServiceGroupName(serviceGroupName); AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); try { ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml, currentDeploymentFile, serviceGroup, wsdlServices, configCtx); fillServiceGroup(serviceGroup, serviceList, null, axisConfig); return serviceGroup; } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } public static AxisServiceGroup loadServiceGroup(File serviceFile, ConfigurationContext configCtx) throws AxisFault { try { DeploymentFileData currentDeploymentFile = new DeploymentFileData(serviceFile, null); DeploymentClassLoader classLoader = Utils.createClassLoader(serviceFile); currentDeploymentFile.setClassLoader(classLoader); AxisServiceGroup serviceGroup = new AxisServiceGroup(); serviceGroup.setServiceGroupClassLoader(classLoader); // Drop the extension and take the name String fileName = serviceFile.getName(); String serviceGroupName = fileName.substring(0, fileName.lastIndexOf(".")); serviceGroup.setServiceGroupName(serviceGroupName); AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); ArchiveReader archiveReader = new ArchiveReader(); HashMap wsdlServices = archiveReader.processWSDLs(currentDeploymentFile); InputStream serviceXml = classLoader.getResourceAsStream("META-INF/services.xml"); ArrayList serviceList = archiveReader.buildServiceGroup(serviceXml, currentDeploymentFile, serviceGroup, wsdlServices, configCtx); fillServiceGroup(serviceGroup, serviceList, null, axisConfig); return serviceGroup; } catch (Exception e) { throw new DeploymentException(e); } } public File getServicesDir() { return servicesDir; } public File getModulesDir() { return modulesDir; } public File getRepositoryDir() { return repositoryDir; } public void setExtensionToDeployerMappingMap(HashMap extensionToDeployerMappingMap) { this.extensionToDeployerMappingMap = extensionToDeployerMappingMap; } public void setDirectoryToExtensionMappingMap(HashMap directoryToExtensionMappingMap) { this.directoryToExtensionMappingMap = directoryToExtensionMappingMap; } public HashMap getDirectoryToExtensionMappingMap() { return directoryToExtensionMappingMap; } public RepositoryListener getRepoListener() { return repoListener; } public ServiceDeployer getServiceDeployer() { return serviceDeployer; } public ModuleDeployer getModuleDeployer() { return moduleDeployer; } public Deployer getDeployerForExtension(String extension) { return (Deployer) extensionToDeployerMappingMap.get(extension); } /** * Clean up the mess */ public void cleanup() { if (scheduler != null) { scheduler.cleanup(); } } } ./src/org/apache/axis2/deployment/AxisConfigBuilder.java0000664000175000017500000010262611767656530022425 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import edu.emory.mathcs.backport.java.util.Collections; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.RolePlayer; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.ApplicationXMLBuilder; import org.apache.axis2.builder.Builder; import org.apache.axis2.builder.MIMEBuilder; import org.apache.axis2.builder.MTOMBuilder; import org.apache.axis2.builder.SOAPBuilder; import org.apache.axis2.builder.XFormURLEncodedBuilder; import org.apache.axis2.dataretrieval.DRConstants; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.ModuleConfiguration; import org.apache.axis2.description.ParameterInclude; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisObserver; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.engine.Phase; import org.apache.axis2.i18n.Messages; import org.apache.axis2.phaseresolver.PhaseException; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.transport.TransportListener; import org.apache.axis2.transport.TransportSender; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Loader; import org.apache.axis2.util.TargetResolver; import org.apache.axis2.util.ThreadContextMigrator; import org.apache.axis2.util.ThreadContextMigratorUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.InputStream; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; public class AxisConfigBuilder extends DescriptionBuilder { protected static final Log log = LogFactory.getLog(AxisConfigBuilder.class); private DeploymentEngine deploymentEngine; public AxisConfigBuilder(InputStream serviceInputStream, AxisConfiguration axisConfiguration, DeploymentEngine deploymentEngine) { super(serviceInputStream, axisConfiguration); this.deploymentEngine = deploymentEngine; } public void populateConfig() throws DeploymentException { try { OMElement config_element = buildOM(); if (!TAG_AXISCONFIG.equals(config_element.getLocalName())) { throw new DeploymentException(Messages.getMessage("badelementfound", TAG_AXISCONFIG, config_element.getLocalName())); } // processing Parameters // Processing service level parameters Iterator itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, axisConfig, axisConfig); // process MessageReceiver OMElement messageReceiver = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVERS)); if (messageReceiver != null) { HashMap mrs = processMessageReceivers(messageReceiver); Iterator keys = mrs.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); axisConfig.addMessageReceiver(key, (MessageReceiver) mrs.get(key)); } } // Process Module refs Iterator moduleitr = config_element.getChildrenWithName(new QName(DeploymentConstants.TAG_MODULE)); processModuleRefs(moduleitr, axisConfig); // Processing Transport Senders Iterator trs_senders = config_element.getChildrenWithName(new QName(TAG_TRANSPORT_SENDER)); processTransportSenders(trs_senders); // Processing Transport Receivers Iterator trs_Reivers = config_element.getChildrenWithName(new QName(TAG_TRANSPORT_RECEIVER)); processTransportReceivers(trs_Reivers); // Process TargetResolvers OMElement targetResolvers = config_element.getFirstChildWithName(new QName(TAG_TARGET_RESOLVERS)); processTargetResolvers(axisConfig, targetResolvers); // Process ThreadContextMigrators OMElement threadContextMigrators = config_element.getFirstChildWithName(new QName(TAG_THREAD_CONTEXT_MIGRATORS)); processThreadContextMigrators(axisConfig, threadContextMigrators); // Process Observers Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER)); processObservers(obs_ittr); // Processing Phase orders Iterator phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER)); processPhaseOrders(phaseorders); Iterator moduleConfigs = config_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG)); processModuleConfig(moduleConfigs, axisConfig, axisConfig); // processing .. elements Iterator policyElements = config_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, axisConfig.getPolicySubject()); } // processing .. elements Iterator policyRefElements = config_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyRefElements.hasNext()) { processPolicyRefElements(policyElements, axisConfig.getPolicySubject()); } //to process default module versions OMElement defaultModuleVerionElement = config_element.getFirstChildWithName(new QName( TAG_DEFAULT_MODULE_VERSION)); if (defaultModuleVerionElement != null) { processDefaultModuleVersions(defaultModuleVerionElement); } OMElement clusterElement = config_element .getFirstChildWithName(new QName(TAG_CLUSTER)); if (clusterElement != null) { ClusterBuilder clusterBuilder = new ClusterBuilder(axisConfig); clusterBuilder.buildCluster(clusterElement); } /* * Add Axis2 default builders if they are not overidden by the config */ axisConfig.addMessageBuilder("multipart/related", new MIMEBuilder()); axisConfig.addMessageBuilder("application/soap+xml", new SOAPBuilder()); axisConfig.addMessageBuilder("text/xml", new SOAPBuilder()); axisConfig.addMessageBuilder("application/xop+xml", new MTOMBuilder()); axisConfig.addMessageBuilder("application/xml", new ApplicationXMLBuilder()); axisConfig.addMessageBuilder("application/x-www-form-urlencoded", new XFormURLEncodedBuilder()); // process MessageBuilders OMElement messageBuildersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_BUILDERS)); if (messageBuildersElement != null) { HashMap builderSelector = processMessageBuilders(messageBuildersElement); Iterator keys = builderSelector.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); axisConfig.addMessageBuilder(key, (Builder) builderSelector.get(key)); } } //process dataLocator configuration OMElement dataLocatorElement = config_element .getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT)); if (dataLocatorElement != null) { processDataLocatorConfig(dataLocatorElement); } // process roleplayer configuration OMElement rolePlayerElement = config_element .getFirstChildWithName(new QName(Constants.SOAP_ROLE_CONFIGURATION_ELEMENT)); if (rolePlayerElement != null) { processSOAPRoleConfig(axisConfig, rolePlayerElement); } // process MessageFormatters OMElement messageFormattersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_FORMATTERS)); if (messageFormattersElement != null) { HashMap messageFormatters = processMessageFormatters(messageFormattersElement); Iterator keys = messageFormatters.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); axisConfig.addMessageFormatter(key, (MessageFormatter) messageFormatters.get(key)); } } //Processing deployers. Iterator deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER)); if (deployerItr != null) { processDeployers(deployerItr); } //process Attachments Lifecycle manager configuration OMElement attachmentsLifecycleManagerElement = config_element .getFirstChildWithName(new QName(ATTACHMENTS_LIFECYCLE_MANAGER)); if (attachmentsLifecycleManagerElement != null) { processAttachmentsLifecycleManager(axisConfig, attachmentsLifecycleManagerElement); } } catch (XMLStreamException e) { throw new DeploymentException(e); } } private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) { if (targetResolvers != null) { Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER)); while (iterator.hasNext()) { OMElement targetResolver = (OMElement) iterator.next(); OMAttribute classNameAttribute = targetResolver.getAttribute(new QName(TAG_CLASS_NAME)); String className = classNameAttribute.getAttributeValue(); try { Class classInstance = Loader.loadClass(className); TargetResolver tr = (TargetResolver) classInstance.newInstance(); axisConfig.addTargetResolver(tr); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processTargetResolvers: Exception thrown initialising TargetResolver: " + e.getMessage()); } } } } } private void processThreadContextMigrators(AxisConfiguration axisConfig, OMElement targetResolvers) { if (targetResolvers != null) { Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR)); while (iterator.hasNext()) { OMElement threadContextMigrator = (OMElement) iterator.next(); OMAttribute listIdAttribute = threadContextMigrator.getAttribute(new QName(TAG_LIST_ID)); String listId = listIdAttribute.getAttributeValue(); OMAttribute classNameAttribute = threadContextMigrator.getAttribute(new QName(TAG_CLASS_NAME)); String className = classNameAttribute.getAttributeValue(); try { Class clazz = Loader.loadClass(className); ThreadContextMigrator migrator = (ThreadContextMigrator) clazz.newInstance(); ThreadContextMigratorUtil.addThreadContextMigrator(axisConfig, listId, migrator); } catch (UnsupportedClassVersionError e){ log.info("Disabled - " + className + " - " + e.getMessage()); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processThreadContextMigrators: Exception thrown initialising ThreadContextMigrator: " + e.getMessage()); } } } } } private void processAttachmentsLifecycleManager(AxisConfiguration axisConfig, OMElement element) { String className = element.getAttributeValue(new QName(TAG_CLASS_NAME)); try { Class classInstance = Loader.loadClass(className); LifecycleManager manager = (LifecycleManager) classInstance.newInstance(); axisConfig.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processAttachmentsLifecycleManager: Exception thrown initialising LifecycleManager: " + e.getMessage()); } } } private void processSOAPRoleConfig(AxisConfiguration axisConfig, OMElement soaproleconfigElement) { if (soaproleconfigElement != null) { final boolean isUltimateReceiever = JavaUtils.isTrue(soaproleconfigElement.getAttributeValue(new QName(Constants.SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE)), true); ArrayList roles = new ArrayList(); Iterator iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT)); while (iterator.hasNext()) { OMElement roleElement = (OMElement) iterator.next(); roles.add(roleElement.getText()); } final List unmodifiableRoles = Collections.unmodifiableList(roles); try{ RolePlayer rolePlayer = new RolePlayer(){ public List getRoles() { return unmodifiableRoles; } public boolean isUltimateDestination() { return isUltimateReceiever; } }; axisConfig.addParameter("rolePlayer", rolePlayer); } catch (AxisFault e) { if (log.isTraceEnabled()) { log.trace( "processTargetResolvers: Exception thrown initialising TargetResolver: " + e.getMessage()); } } } } private void processDeployers(Iterator deployerItr) { HashMap directoryToExtensionMappingMap = new HashMap(); HashMap extensionToDeployerMappingMap = new HashMap(); while (deployerItr.hasNext()) { OMElement element = (OMElement) deployerItr.next(); String directory = element.getAttributeValue(new QName(DIRECTORY)); if (directory == null) { log.error("Deployer missing 'directory' attribute : " + element.toString()); } String extension = element.getAttributeValue(new QName(EXTENSION)); if (extension == null) { log.error("Deployer missing 'extension' attribute : " + element.toString()); return; } // A leading dot is redundant, so strip it. So we allow either ".foo" or "foo", either // of which will result in extension="foo" if (extension.charAt(0) == '.') extension = extension.substring(1); String deployerClassName = element.getAttributeValue(new QName(TAG_CLASS_NAME)); Deployer deployer; try { Class deployerClass = Loader.loadClass(deployerClassName); deployer = (Deployer) deployerClass.newInstance(); } catch (UnsupportedClassVersionError ex) { log.info("Disabled - " + deployerClassName + " - " + ex.getMessage()); continue; } catch (Exception e) { log.info("Unable to instantiate deployer " + deployerClassName); log.debug(e.getMessage(), e); continue; } deployer.setDirectory(directory); deployer.setExtension(extension); if (directory != null) { ArrayList extensionList = (ArrayList) directoryToExtensionMappingMap.get(directory); if (extensionList == null) { extensionList = new ArrayList(); } extensionList.add(extension); directoryToExtensionMappingMap.put(directory, extensionList); } extensionToDeployerMappingMap.put(extension, deployer); } if (deploymentEngine != null) { deploymentEngine.setDirectoryToExtensionMappingMap(directoryToExtensionMappingMap); deploymentEngine.setExtensionToDeployerMappingMap(extensionToDeployerMappingMap); } } protected void processModuleConfig(Iterator moduleConfigs, ParameterInclude parent, AxisConfiguration config) throws DeploymentException { while (moduleConfigs.hasNext()) { OMElement moduleConfig = (OMElement) moduleConfigs.next(); OMAttribute moduleName_att = moduleConfig.getAttribute(new QName(ATTRIBUTE_NAME)); if (moduleName_att == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG)); } else { String module = moduleName_att.getAttributeValue(); ModuleConfiguration moduleConfiguration = new ModuleConfiguration(module, parent); Iterator parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, moduleConfiguration, parent); config.addModuleConfig(moduleConfiguration); } } } /** * Update the list of modules that is required to be engaged globally. */ protected void processModuleRefs(Iterator moduleRefs, AxisConfiguration config) { while (moduleRefs.hasNext()) { OMElement moduleref = (OMElement) moduleRefs.next(); OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE)); String refName = moduleRefAttribute.getAttributeValue(); axisConfig.addGlobalModuleRef(refName); } } /** * Processes AxisObservers. * * @param oservers */ private void processObservers(Iterator oservers) { while (oservers.hasNext()) { try { OMElement observerelement = (OMElement) oservers.next(); AxisObserver observer; OMAttribute trsClas = observerelement.getAttribute(new QName(TAG_CLASS_NAME)); if (trsClas == null) { log.info(Messages.getMessage(DeploymentErrorMsgs.OBSERVER_ERROR)); return; } final String clasName = trsClas.getAttributeValue(); Class observerclass; try { observerclass = (Class) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws ClassNotFoundException { return Loader.loadClass(clasName); } }); } catch (PrivilegedActionException e) { throw (ClassNotFoundException) e.getException(); } observer = (AxisObserver) observerclass.newInstance(); // processing Parameters // Processing service level parameters Iterator itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, observer, axisConfig); // initialization try { observer.init(axisConfig); } catch (Throwable e) { //Observer init may throw runtime exception , but we can stil // start Axis2 log.info(e.getMessage()); } axisConfig.addObservers(observer); } catch (Exception e) { log.info(e.getMessage()); } } } private ArrayList processPhaseList(OMElement phaseOrders) throws DeploymentException { ArrayList phaselist = new ArrayList(); Iterator phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE)); while (phases.hasNext()) { OMElement phaseelement = (OMElement) phases.next(); String phaseName = phaseelement.getAttribute(new QName(ATTRIBUTE_NAME)).getAttributeValue(); String phaseClass = phaseelement.getAttributeValue(new QName(TAG_CLASS_NAME)); Phase phase; try { phase = getPhase(phaseClass); } catch (Exception e) { throw new DeploymentException( Messages.getMessage("phaseclassnotfound", phaseClass, e.getMessage())); } phase.setName(phaseName); Iterator handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER)); while (handlers.hasNext()) { OMElement omElement = (OMElement) handlers.next(); HandlerDescription handler = processHandler(omElement, axisConfig, phaseName); handler.getRules().setPhaseName(phaseName); try { if (Utils.loadHandler(axisConfig.getSystemClassLoader(), handler)) { try { phase.addHandler(handler); } catch (PhaseException e) { throw new DeploymentException(e); } } } catch (UnsupportedClassVersionError e) { log.info("Disabled - " + handler + " - " + e.getMessage()); } } phaselist.add(phase); } return phaselist; } /** * Processes all the phase orders which are defined in axis2.xml. * * @param phaserders */ private void processPhaseOrders(Iterator phaserders) throws DeploymentException { PhasesInfo info = axisConfig.getPhasesInfo(); while (phaserders.hasNext()) { OMElement phaseOrders = (OMElement) phaserders.next(); String flowType = phaseOrders.getAttribute(new QName(TAG_TYPE)).getAttributeValue(); if (TAG_FLOW_IN.equals(flowType)) { info.setINPhases(processPhaseList(phaseOrders)); } else if (TAG_FLOW_IN_FAULT.equals(flowType)) { info.setIN_FaultPhases(processPhaseList(phaseOrders)); } else if (TAG_FLOW_OUT.equals(flowType)) { info.setOUTPhases(processPhaseList(phaseOrders)); } else if (TAG_FLOW_OUT_FAULT.equals(flowType)) { info.setOUT_FaultPhases(processPhaseList(phaseOrders)); } } } private void processDefaultModuleVersions(OMElement defaultVersions) throws DeploymentException { Iterator moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE)); while (moduleVersions.hasNext()) { OMElement omElement = (OMElement) moduleVersions.next(); String name = omElement.getAttributeValue(new QName(ATTRIBUTE_NAME)); if (name == null) { throw new DeploymentException(Messages.getMessage("modulenamecannotbenull")); } String version = omElement.getAttributeValue(new QName(ATTRIBUTE_DEFAULT_VERSION)); if (version == null) { throw new DeploymentException(Messages.getMessage("moduleversioncannotbenull")); } axisConfig.addDefaultModuleVersion(name, version); } } private void processTransportReceivers(Iterator trs_senders) throws DeploymentException { while (trs_senders.hasNext()) { TransportInDescription transportIN; OMElement transport = (OMElement) trs_senders.next(); // getting transport Name OMAttribute trsName = transport.getAttribute(new QName(ATTRIBUTE_NAME)); if (trsName != null) { String name = trsName.getAttributeValue(); transportIN = new TransportInDescription(name); // transport impl class OMAttribute trsClas = transport.getAttribute(new QName(TAG_CLASS_NAME)); if (trsClas != null) { try { String clasName = trsClas.getAttributeValue(); Class receiverClass; receiverClass = Loader.loadClass(clasName); TransportListener receiver = (TransportListener) receiverClass.newInstance(); transportIN.setReceiver(receiver); } catch (NoClassDefFoundError e) { if(deploymentEngine != null){ throw new DeploymentException(e); } else { // Called from createDefaultConfigurationContext in ConfigurationContextFactory // Please don't throw an exception. log.debug(Messages.getMessage("classnotfound", trsClas.getAttributeValue())); } } catch (ClassNotFoundException e) { throw new DeploymentException(e); } catch (IllegalAccessException e) { throw new DeploymentException(e); } catch (InstantiationException e) { throw new DeploymentException(e); } } try { Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, transportIN, axisConfig); // adding to axis2 config axisConfig.addTransportIn(transportIN); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } } } private void processTransportSenders(Iterator trs_senders) throws DeploymentException { while (trs_senders.hasNext()) { TransportOutDescription transportout; OMElement transport = (OMElement) trs_senders.next(); // getting transport Name OMAttribute trsName = transport.getAttribute(new QName(ATTRIBUTE_NAME)); if (trsName != null) { String name = trsName.getAttributeValue(); transportout = new TransportOutDescription(name); // transport impl class OMAttribute trsClas = transport.getAttribute(new QName(TAG_CLASS_NAME)); if (trsClas == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.TRANSPORT_SENDER_ERROR, name)); } String clasName = trsClas.getAttributeValue(); Class sender; try { sender = Loader.loadClass(clasName); TransportSender transportSender = (TransportSender) sender.newInstance(); transportout.setSender(transportSender); // process Parameters // processing Parameters // Processing service level parameters Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, transportout, axisConfig); // adding to axis2 config axisConfig.addTransportOut(transportout); } catch (NoClassDefFoundError e) { if(deploymentEngine != null){ log.debug(Messages.getMessage("errorinloadingts", clasName), e); throw new DeploymentException(e); } else { // Called from createDefaultConfigurationContext in ConfigurationContextFactory // Please don't throw an exception. log.debug(Messages.getMessage("classnotfound", trsClas.getAttributeValue())); } } catch (ClassNotFoundException e) { log.debug(Messages.getMessage("errorinloadingts", clasName), e); throw new DeploymentException(e); } catch (IllegalAccessException e) { log.debug(Messages.getMessage("errorinloadingts", clasName), e); throw new DeploymentException(e); } catch (InstantiationException e) { log.debug(Messages.getMessage("errorinloadingts", clasName), e); throw new DeploymentException(e); } catch (AxisFault axisFault) { log.debug(Messages.getMessage("errorinloadingts", clasName), axisFault); throw new DeploymentException(axisFault); } } } } /* * process data locator configuration for data retrieval. */ private void processDataLocatorConfig(OMElement dataLocatorElement) { OMAttribute serviceOverallDataLocatorclass = dataLocatorElement .getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE)); if (serviceOverallDataLocatorclass != null) { String className = serviceOverallDataLocatorclass .getAttributeValue(); axisConfig.addDataLocatorClassNames(DRConstants.GLOBAL_LEVEL, className); } Iterator iterator = dataLocatorElement.getChildrenWithName(new QName( DRConstants.DIALECT_LOCATOR_ELEMENT)); while (iterator.hasNext()) { OMElement locatorElement = (OMElement) iterator.next(); OMAttribute dialect = locatorElement.getAttribute(new QName( DRConstants.DIALECT_ATTRIBUTE)); OMAttribute dialectclass = locatorElement.getAttribute(new QName( DRConstants.CLASS_ATTRIBUTE)); axisConfig.addDataLocatorClassNames(dialect.getAttributeValue(), dialectclass.getAttributeValue()); } } protected HashMap processMessageFormatters(OMElement messageFormattersElement) throws DeploymentException { try { return super.processMessageFormatters(messageFormattersElement); } catch (NoClassDefFoundError e) { if (deploymentEngine != null) { throw new DeploymentException(e); } else { // Called from createDefaultConfigurationContext in ConfigurationContextFactory // Please don't throw an exception. return new HashMap(); } } } protected HashMap processMessageBuilders(OMElement messageBuildersElement) throws DeploymentException { try { return super.processMessageBuilders(messageBuildersElement); } catch (NoClassDefFoundError e) { if (deploymentEngine != null) { throw new DeploymentException(e); } else { // Called from createDefaultConfigurationContext in ConfigurationContextFactory // Please don't throw an exception. return new HashMap(); } } } private Phase getPhase(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { if (className == null) { return new Phase(); } Class phaseClass = Loader.loadClass(axisConfig.getSystemClassLoader(), className); return (Phase) phaseClass.newInstance(); } } ./src/org/apache/axis2/deployment/util/0000775000175000017500000000000011767656530017167 5ustar brianbrian./src/org/apache/axis2/deployment/util/BeanExcludeInfo.java0000664000175000017500000000505211767656530023027 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.util; /** * this class is used to keep the excludeProperties and includePropertes * of the given bean when generating the wsdl, and serializing. */ public class BeanExcludeInfo { // exclude property list given as a regualar expression // but we exclude this property only if it is not available // in the include properties list private String excludeProperties; private String includeProperties; public BeanExcludeInfo(String excludeProperties, String includeProperties) { this.excludeProperties = excludeProperties; this.includeProperties = includeProperties; } public String getExcludeProperties() { return excludeProperties; } public void setExcludeProperties(String excludeProperties) { this.excludeProperties = excludeProperties; } public String getIncludeProperties() { return includeProperties; } public void setIncludeProperties(String includeProperties) { this.includeProperties = includeProperties; } /** * a property is excluded if it ths given in the exclude list * but not in include list * @param property * @return is exclude the property or not */ public boolean isExcludedProperty(String property){ boolean isExclude = false; if ((excludeProperties != null) && (excludeProperties.trim().length() > 0)){ if (property.matches(excludeProperties)){ isExclude = true; if ((includeProperties != null) && (includeProperties.trim().length() > 0)){ if (property.matches(includeProperties)){ isExclude = false; } } } } return isExclude; } } ./src/org/apache/axis2/deployment/util/ExcludeInfo.java0000664000175000017500000000425711767656530022247 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.util; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * this class is used to keep the exclude property details of all the classes. * A map object is used to map the class name to an beanInfo object. here the class name is * acctually a regular expression * */ public class ExcludeInfo { private Map classNameToBeanInfoMap; public ExcludeInfo() { this.classNameToBeanInfoMap = new HashMap(); } public void putBeanInfo(String classNameRegx,BeanExcludeInfo beanExcludeInfo){ this.classNameToBeanInfoMap.put(classNameRegx,beanExcludeInfo); } public BeanExcludeInfo getBeanExcludeInfoForClass(String className){ // here map keys represents the regualr expressions for class names // so we have to iterate through the keys and find the beanInfo object String classNameRegx = null; BeanExcludeInfo beanExcludeInfo = null; for (Iterator iter = this.classNameToBeanInfoMap.keySet().iterator(); iter.hasNext();){ classNameRegx = (String) iter.next(); if (className.matches(classNameRegx)){ beanExcludeInfo = (BeanExcludeInfo) this.classNameToBeanInfoMap.get(classNameRegx); // this means we have find the required object break; } } return beanExcludeInfo; } } ./src/org/apache/axis2/deployment/util/PhasesInfo.java0000664000175000017500000002345611767656530022103 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.util; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.deployment.DeploymentErrorMsgs; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.Handler; import org.apache.axis2.engine.Phase; import org.apache.axis2.i18n.Messages; import org.apache.axis2.phaseresolver.PhaseException; import org.apache.axis2.phaseresolver.PhaseMetadata; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; public class PhasesInfo { private ArrayList INPhases; private ArrayList IN_FaultPhases; private ArrayList OUTPhases; private ArrayList OUT_FaultPhases; public PhasesInfo() { INPhases = new ArrayList(); IN_FaultPhases = new ArrayList(); OUTPhases = new ArrayList(); OUT_FaultPhases = new ArrayList(); } /** * To copy phase information from one to another * * @param phase */ private Phase copyPhase(Phase phase) throws DeploymentException { Phase newPhase = new Phase(phase.getPhaseName()); Iterator handlers = phase.getHandlers().iterator(); while (handlers.hasNext()) { try { Handler handlerDescription = (Handler) handlers.next(); newPhase.addHandler(handlerDescription.getHandlerDesc()); } catch (PhaseException e) { throw new DeploymentException(e); } } return newPhase; } HandlerDescription makeHandler(OMElement handlerElement) { String name = handlerElement.getAttributeValue(new QName("name")); QName qname = handlerElement.resolveQName(name); HandlerDescription desc = new HandlerDescription(qname.getLocalPart()); String className = handlerElement.getAttributeValue(new QName("class")); desc.setClassName(className); return desc; } public Phase makePhase(OMElement phaseElement) throws PhaseException { String phaseName = phaseElement.getAttributeValue(new QName("name")); Phase phase = new Phase(phaseName); Iterator children = phaseElement.getChildElements(); while (children.hasNext()) { OMElement handlerElement = (OMElement) children.next(); HandlerDescription handlerDesc = makeHandler(handlerElement); phase.addHandler(handlerDesc); } return phase; } public ArrayList getGlobalInflow() throws DeploymentException { ArrayList globalphase = new ArrayList(); boolean foundDispatchPhase = false; for (int i = 0; i < INPhases.size(); i++) { Phase phase = (Phase) INPhases.get(i); String phaseName = phase.getPhaseName(); if (!foundDispatchPhase) { if (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) { foundDispatchPhase = true; } globalphase.add(phase); } } if (!foundDispatchPhase) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.DISPATCH_PHASE_NOT_FOUND)); } return globalphase; } public ArrayList getGlobalOutPhaseList() throws DeploymentException { /** * I have assumed that PolicyDetermination and MessageProcessing are global out phase */ ArrayList globalPhaseList = new ArrayList(); boolean messageOut = false; for (int i = 0; i < OUTPhases.size(); i++) { Phase phase = (Phase) OUTPhases.get(i); String phaseName = phase.getPhaseName(); if (!messageOut) { if (PhaseMetadata.PHASE_MESSAGE_OUT.equals(phaseName)) { messageOut = true; globalPhaseList.add(copyPhase(phase)); } } else { globalPhaseList.add(copyPhase(phase)); } } return globalPhaseList; } public ArrayList getINPhases() { return INPhases; } public ArrayList getIN_FaultPhases() { return IN_FaultPhases; } public ArrayList getOUTPhases() { return OUTPhases; } public ArrayList getOutFaultPhaseList(){ return OUT_FaultPhases; } public ArrayList getOUT_FaultPhases() throws DeploymentException { ArrayList globalPhaseList = new ArrayList(); boolean messageOut = false; for (int i = 0; i < OUT_FaultPhases.size(); i++) { Phase phase = (Phase) OUT_FaultPhases.get(i); String phaseName = phase.getPhaseName(); if (!messageOut) { if (PhaseMetadata.PHASE_MESSAGE_OUT.equals(phaseName)) { messageOut = true; globalPhaseList.add(copyPhase(phase)); } } else { globalPhaseList.add(copyPhase(phase)); } } return globalPhaseList; } public ArrayList getOperationInFaultPhases() throws DeploymentException { ArrayList operationINPhases = new ArrayList(); boolean foundDispathPhase = false; for (int i = 0; i < IN_FaultPhases.size(); i++) { Phase phase = (Phase) IN_FaultPhases.get(i); String phaseName = phase.getPhaseName(); if (foundDispathPhase) { operationINPhases.add(copyPhase(phase)); } if (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) { foundDispathPhase = true; } } return operationINPhases; } public ArrayList getGlobalInFaultPhases() throws DeploymentException { ArrayList globalInfaultphase = new ArrayList(); boolean foundDispatchPhase = false; for (int i = 0; i < IN_FaultPhases.size(); i++) { Phase phase = (Phase) IN_FaultPhases.get(i); String phaseName = phase.getPhaseName(); if (!foundDispatchPhase) { if (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) { foundDispatchPhase = true; } globalInfaultphase.add(phase); } } if (!foundDispatchPhase) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.DISPATCH_PHASE_NOT_FOUND)); } return globalInfaultphase; } public ArrayList getOperationInPhases() throws DeploymentException { ArrayList operationINPhases = new ArrayList(); boolean foundDispathPhase = false; for (int i = 0; i < INPhases.size(); i++) { Phase phase = (Phase) INPhases.get(i); String phaseName = phase.getPhaseName(); if (foundDispathPhase) { operationINPhases.add(copyPhase(phase)); } if (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) { foundDispathPhase = true; } } return operationINPhases; } public ArrayList getOperationOutFaultPhases() throws DeploymentException { ArrayList operationFaultOutPhases = new ArrayList(); for (int i = 0; i < OUT_FaultPhases.size(); i++) { Phase phase = (Phase) OUT_FaultPhases.get(i); String phaseName = phase.getPhaseName(); if (PhaseMetadata.PHASE_MESSAGE_OUT.equals(phaseName)) { break; } operationFaultOutPhases.add(copyPhase(phase)); } return operationFaultOutPhases; } public ArrayList getOperationOutPhases() throws DeploymentException { ArrayList oprationOUTPhases = new ArrayList(); for (int i = 0; i < OUTPhases.size(); i++) { Phase phase = (Phase) OUTPhases.get(i); String phaseName = phase.getPhaseName(); if (PhaseMetadata.PHASE_MESSAGE_OUT.equals(phaseName)) { break; } oprationOUTPhases.add(copyPhase(phase)); } return oprationOUTPhases; } public void setINPhases(ArrayList INPhases) { this.INPhases = INPhases; } public void setIN_FaultPhases(ArrayList IN_FaultPhases) { this.IN_FaultPhases = IN_FaultPhases; } public void setOUTPhases(ArrayList OUTPhases) { this.OUTPhases = OUTPhases; } public void setOUT_FaultPhases(ArrayList OUT_FaultPhases) { this.OUT_FaultPhases = OUT_FaultPhases; } public void setOperationPhases(AxisOperation axisOperation) throws AxisFault { if (axisOperation != null) { try { axisOperation.setRemainingPhasesInFlow(getOperationInPhases()); axisOperation.setPhasesOutFlow(getOperationOutPhases()); axisOperation.setPhasesInFaultFlow(getOperationInFaultPhases()); axisOperation.setPhasesOutFaultFlow(getOperationOutFaultPhases()); } catch (DeploymentException e) { throw AxisFault.makeFault(e); } } } } ./src/org/apache/axis2/deployment/util/Utils.java0000664000175000017500000016240311767656530021140 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.util; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLDecoder; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Stack; import java.util.StringTokenizer; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.DeploymentClassLoader; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.repository.util.ArchiveReader; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.description.AxisBinding; import org.apache.axis2.description.AxisBindingMessage; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisOperationFactory; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Flow; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.AnnotationConstants; import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator; import org.apache.axis2.description.java2wsdl.DocLitBareSchemaGenerator; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.description.java2wsdl.SchemaGenerator; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.Handler; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.Loader; import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.PolicyComponent; import org.apache.ws.commons.schema.utils.NamespaceMap; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JMethod; public class Utils { public static String defaultEncoding = new OutputStreamWriter(System.out) .getEncoding(); private static Log log = LogFactory.getLog(Utils.class); public static void addFlowHandlers(Flow flow, ClassLoader clsLoader) throws AxisFault { int count = flow.getHandlerCount(); for (int j = 0; j < count; j++) { HandlerDescription handlermd = flow.getHandler(j); Handler handler; final Class handlerClass = getHandlerClass( handlermd.getClassName(), clsLoader); try { handler = (Handler) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws InstantiationException, IllegalAccessException { return handlerClass.newInstance(); } }); handler.init(handlermd); handlermd.setHandler(handler); } catch (PrivilegedActionException e) { throw AxisFault.makeFault(e); } } } public static boolean loadHandler(ClassLoader loader1, HandlerDescription desc) throws DeploymentException { String handlername = desc.getClassName(); Handler handler; try { final Class handlerClass = Loader.loadClass(loader1, handlername); Package aPackage = (Package) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return handlerClass.getPackage(); } }); if (aPackage != null && aPackage.getName().equals("org.apache.axis2.engine")) { String name = handlerClass.getName(); log.warn("Dispatcher " + name + " is now deprecated."); if (name.indexOf("InstanceDispatcher") != -1) { log.warn("Please remove the entry for " + handlerClass.getName() + "from axis2.xml"); } else { log .warn("Please edit axis2.xml " + "and replace with the same class in org.apache.axis2.dispatchers package"); } } handler = (Handler) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws InstantiationException, IllegalAccessException { return handlerClass.newInstance(); } }); handler.init(desc); desc.setHandler(handler); } catch (UnsupportedClassVersionError e) { throw e; } catch (ClassNotFoundException e) { if (handlername.indexOf("jaxws") > 0) { log.warn("[JAXWS] - unable to load " + handlername); return false; } throw new DeploymentException(e); } catch (Exception e) { throw new DeploymentException(e); } return true; } public static URL[] getURLsForAllJars(URL url, File tmpDir) { FileInputStream fin = null; InputStream in = null; ZipInputStream zin = null; try { ArrayList array = new ArrayList(); in = url.openStream(); String fileName = url.getFile(); int index = fileName.lastIndexOf('/'); if (index != -1) { fileName = fileName.substring(index + 1); } final File f = createTempFile(fileName, in, tmpDir); fin = (FileInputStream) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(f); } }); array.add(f.toURL()); zin = new ZipInputStream(fin); ZipEntry entry; String entryName; while ((entry = zin.getNextEntry()) != null) { entryName = entry.getName(); /** * id the entry name start with /lib and end with .jar then * those entry name will be added to the arraylist */ if ((entryName != null) && entryName.toLowerCase().startsWith("lib/") && entryName.toLowerCase().endsWith(".jar")) { String suffix = entryName.substring(4); File f2 = createTempFile(suffix, zin, tmpDir); array.add(f2.toURL()); } } return (URL[]) array.toArray(new URL[array.size()]); } catch (Exception e) { throw new RuntimeException(e); } finally { if (fin != null) { try { fin.close(); } catch (IOException e) { // } } if (in != null) { try { in.close(); } catch (IOException e) { // } } if (zin != null) { try { zin.close(); } catch (IOException e) { // } } } } public static File createTempFile(final String suffix, InputStream in, final File tmpDir) throws IOException { byte data[] = new byte[2048]; int count; File f; if (tmpDir == null) { String directory = (String) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty("java.io.tmpdir"); } }); final File tempFile = new File(directory, "_axis2"); Boolean exists = (Boolean) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(tempFile.exists()); } }); if (!exists.booleanValue()) { Boolean mkdirs = (Boolean) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(tempFile.mkdirs()); } }); if (!mkdirs.booleanValue()) { throw new IOException("Unable to create the directory"); } } try { f = (File) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { return File.createTempFile("axis2", suffix, tempFile); } }); } catch (PrivilegedActionException e) { throw (IOException) e.getException(); } } else { try { f = (File) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { return File.createTempFile("axis2", suffix, tmpDir); } }); } catch (PrivilegedActionException e) { throw (IOException) e.getException(); } } if (log.isDebugEnabled()) { log.debug("Created temporary file : " + f.getAbsolutePath());// $NON-SEC-4 } final File f2 = f; org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { f2.deleteOnExit(); return null; } }); FileOutputStream out = null; try { out = (FileOutputStream) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileOutputStream(f2); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException) e.getException(); } while ((count = in.read(data, 0, 2048)) != -1) { out.write(data, 0, count); } out.close(); return f; } public static ClassLoader getClassLoader(ClassLoader parent, String path) throws DeploymentException { return getClassLoader(parent, new File(path)); } /** * Get a ClassLoader which contains a classpath of a) the passed directory * and b) any jar files inside the "lib/" or "Lib/" subdirectory of the * passed directory. * * @param parent * parent ClassLoader which will be the parent of the result of * this method * @param file * a File which must be a directory for this to be useful * @return a new ClassLoader pointing to both the passed dir and jar files * under lib/ * @throws DeploymentException * if problems occur */ public static ClassLoader getClassLoader(final ClassLoader parent, File file) throws DeploymentException { URLClassLoader classLoader; if (file == null) return null; // Shouldn't this just return the parent? try { ArrayList urls = new ArrayList(); urls.add(file.toURL()); // lower case directory name File libfiles = new File(file, "lib"); if (!addFiles(urls, libfiles)) { // upper case directory name libfiles = new File(file, "Lib"); addFiles(urls, libfiles); } final URL urllist[] = new URL[urls.size()]; for (int i = 0; i < urls.size(); i++) { urllist[i] = (URL) urls.get(i); } classLoader = (URLClassLoader) AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new URLClassLoader(urllist, parent); } }); return classLoader; } catch (MalformedURLException e) { throw new DeploymentException(e); } } private static boolean addFiles(ArrayList urls, final File libfiles) throws MalformedURLException { Boolean exists = (Boolean) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(libfiles.exists()); } }); if (exists.booleanValue()) { urls.add(libfiles.toURL()); File jarfiles[] = (File[]) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return libfiles.listFiles(); } }); for (int i = 0; i < jarfiles.length; i++) { File jarfile = jarfiles[i]; if (jarfile.getName().endsWith(".jar")) { urls.add(jarfile.toURL()); } } } return exists.booleanValue(); } private static Class getHandlerClass(String className, ClassLoader loader1) throws AxisFault { Class handlerClass; try { handlerClass = Loader.loadClass(loader1, className); } catch (ClassNotFoundException e) { throw AxisFault.makeFault(e); } return handlerClass; } /** * This guy will create a AxisService using java reflection * * @param axisService * the target AxisService * @param axisConfig * the in-scope AxisConfiguration * @param excludeOperations * a List of Strings (or null), each containing a method to * exclude * @param nonRpcMethods * a List of Strings (or null), each containing a non-rpc method * name * @throws Exception * if a problem occurs */ public static void fillAxisService(final AxisService axisService, AxisConfiguration axisConfig, ArrayList excludeOperations, ArrayList nonRpcMethods) throws Exception { String serviceClass; Parameter implInfoParam = axisService .getParameter(Constants.SERVICE_CLASS); ClassLoader serviceClassLoader = axisService.getClassLoader(); if (implInfoParam != null) { serviceClass = (String) implInfoParam.getValue(); } else { // if Service_Class is null, every AbstractMR will look for // ServiceObjectSupplier. This is user specific and may contain // other looks. implInfoParam = axisService .getParameter(Constants.SERVICE_OBJECT_SUPPLIER); if (implInfoParam != null) { String className = ((String) implInfoParam.getValue()).trim(); final Class serviceObjectMaker = Loader.loadClass( serviceClassLoader, className); if (serviceObjectMaker.getModifiers() != Modifier.PUBLIC) { throw new AxisFault("Service class " + className + " must have public as access Modifier"); } // Find static getServiceObject() method, call it if there final Method method = (Method) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws NoSuchMethodException { return serviceObjectMaker.getMethod( "getServiceObject", new Class[] { AxisService.class }); } }); Object obj = null; if (method != null) { obj = org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws InstantiationException, IllegalAccessException, InvocationTargetException { return method.invoke(serviceObjectMaker .newInstance(), new Object[] { axisService }); } }); } if (obj == null) { log.warn("ServiceObjectSupplier implmentation Object could not be found"); throw new DeploymentException( "ServiceClass or ServiceObjectSupplier implmentation Object could not be found"); } serviceClass = obj.getClass().getName(); } else { return; } } // adding name spaces NamespaceMap map = new NamespaceMap(); map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX, Java2WSDLConstants.AXIS2_XSD); map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX, Java2WSDLConstants.URI_2001_SCHEMA_XSD); axisService.setNamespaceMap(map); SchemaGenerator schemaGenerator; Parameter generateBare = axisService .getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER); if (generateBare != null && "true".equals(generateBare.getValue())) { schemaGenerator = new DocLitBareSchemaGenerator(serviceClassLoader, serviceClass.trim(), axisService.getSchemaTargetNamespace(), axisService .getSchemaTargetNamespacePrefix(), axisService); } else { schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader, serviceClass.trim(), axisService.getSchemaTargetNamespace(), axisService .getSchemaTargetNamespacePrefix(), axisService); } schemaGenerator.setExcludeMethods(excludeOperations); schemaGenerator.setNonRpcMethods(nonRpcMethods); if (!axisService.isElementFormDefault()) { schemaGenerator .setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED); } // package to namespace map schemaGenerator.setPkg2nsmap(axisService.getP2nMap()); Collection schemas = schemaGenerator.generateSchema(); axisService.addSchema(schemas); axisService.setSchemaTargetNamespace(schemaGenerator .getSchemaTargetNameSpace()); axisService.setTypeTable(schemaGenerator.getTypeTable()); if (Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE.equals(axisService .getTargetNamespace())) { axisService .setTargetNamespace(schemaGenerator.getTargetNamespace()); } JMethod[] method = schemaGenerator.getMethods(); PhasesInfo pinfo = axisConfig.getPhasesInfo(); for (int i = 0; i < method.length; i++) { JMethod jmethod = method[i]; String opName = getSimpleName(jmethod); AxisOperation operation = axisService .getOperation(new QName(opName)); // if the operation there in services.xml then try to set it schema // element name if (operation == null) { operation = axisService.getOperation(new QName( getSimpleName(jmethod))); } MessageReceiver mr = axisService.getMessageReceiver(operation .getMessageExchangePattern()); if (mr != null) { } else { mr = axisConfig.getMessageReceiver(operation .getMessageExchangePattern()); } if (operation.getMessageReceiver() == null) { operation.setMessageReceiver(mr); } pinfo.setOperationPhases(operation); axisService.addOperation(operation); if (operation.getSoapAction() == null) { operation.setSoapAction("urn:" + opName); } } } public static AxisOperation getAxisOperationForJmethod(JMethod jmethod) throws AxisFault { AxisOperation operation; if (jmethod.getReturnType().isVoidType()) { if (jmethod.getExceptionTypes().length > 0) { operation = AxisOperationFactory .getAxisOperation(WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY); } else { operation = AxisOperationFactory .getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY); } } else { operation = AxisOperationFactory .getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT); } String opName = getSimpleName(jmethod); operation.setName(new QName(opName)); JAnnotation methodAnnon = jmethod .getAnnotation(AnnotationConstants.WEB_METHOD); if (methodAnnon != null) { String action = methodAnnon.getValue(AnnotationConstants.ACTION) .asString(); if (action != null && !"".equals(action)) { operation.setSoapAction(action); } } return operation; } public static String getSimpleName(JMethod method) { JAnnotation methodAnnon = method .getAnnotation(AnnotationConstants.WEB_METHOD); if (methodAnnon != null) { if (methodAnnon.getValue(AnnotationConstants.OPERATION_NAME) != null) { String methodName = methodAnnon.getValue( AnnotationConstants.OPERATION_NAME).asString(); if (methodName.equals("")) { methodName = method.getSimpleName(); } return methodName; } } return method.getSimpleName(); } public static OMElement getParameter(String name, String value, boolean locked) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement parameter = fac.createOMElement("parameter", null); parameter.addAttribute("name", name, null); parameter.addAttribute("locked", Boolean.toString(locked), null); parameter.setText(value); return parameter; } /** * This method is to get the list of services there in a module if module * want to add services then the way of doing that is 1. Add a directory * called services inside the module (both in mar case and expanded case) 2. * Then add a services.list file into that directory adding all the modules * you want to add 3. Then put all the services into services directory in * the module 4. All the class is module can be access via a the module * services. */ public static void deployModuleServices(AxisModule module, ConfigurationContext configCtx) throws AxisFault { try { AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); ArchiveReader archiveReader = new ArchiveReader(); PhasesInfo phasesInfo = axisConfig.getPhasesInfo(); final ClassLoader moduleClassLoader = module.getModuleClassLoader(); ArrayList services = new ArrayList(); final InputStream in = (InputStream) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return moduleClassLoader .getResourceAsStream("aars/aars.list"); } }); if (in != null) { BufferedReader input; try { input = new BufferedReader( (InputStreamReader) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new InputStreamReader(in); } })); String line; while ((line = input.readLine()) != null) { line = line.trim(); if (line.length() > 0 && line.charAt(0) != '#') { services.add(line); } } input.close(); } catch (IOException ex) { ex.printStackTrace(); } } if (services.size() > 0) { for (int i = 0; i < services.size(); i++) { final String servicename = (String) services.get(i); if (servicename == null || "".equals(servicename)) { continue; } InputStream fin = (InputStream) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return moduleClassLoader .getResourceAsStream("aars/" + servicename); } }); if (fin == null) { throw new AxisFault("No service archive found : " + servicename); } File inputFile = Utils .createTempFile( servicename, fin, (File) axisConfig .getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); DeploymentFileData filedata = new DeploymentFileData( inputFile); filedata .setClassLoader( false, moduleClassLoader, (File) axisConfig .getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); HashMap wsdlservice = archiveReader.processWSDLs(filedata); if (wsdlservice != null && wsdlservice.size() > 0) { Iterator servicesitr = wsdlservice.values().iterator(); while (servicesitr.hasNext()) { AxisService service = (AxisService) servicesitr .next(); Iterator operations = service.getOperations(); while (operations.hasNext()) { AxisOperation axisOperation = (AxisOperation) operations .next(); phasesInfo.setOperationPhases(axisOperation); } } } AxisServiceGroup serviceGroup = new AxisServiceGroup( axisConfig); serviceGroup.setServiceGroupClassLoader(filedata .getClassLoader()); ArrayList serviceList = archiveReader.processServiceGroup( filedata.getAbsolutePath(), filedata, serviceGroup, false, wsdlservice, configCtx); for (int j = 0; j < serviceList.size(); j++) { AxisService axisService = (AxisService) serviceList .get(j); Parameter moduleService = new Parameter(); moduleService.setValue("true"); moduleService.setName(AxisModule.MODULE_SERVICE); axisService.addParameter(moduleService); serviceGroup.addService(axisService); } axisConfig.addServiceGroup(serviceGroup); fin.close(); } } } catch (IOException e) { throw AxisFault.makeFault(e); } } /** * Normalize a uri containing ../ and ./ paths. * * @param uri * The uri path to normalize * @return The normalized uri */ public static String normalize(String uri) { if ("".equals(uri)) { return uri; } int leadingSlashes = 0; for (leadingSlashes = 0; leadingSlashes < uri.length() && uri.charAt(leadingSlashes) == '/'; ++leadingSlashes) { // FIXME: this block is empty!! } boolean isDir = (uri.charAt(uri.length() - 1) == '/'); StringTokenizer st = new StringTokenizer(uri, "/"); LinkedList clean = new LinkedList(); while (st.hasMoreTokens()) { String token = st.nextToken(); if ("..".equals(token)) { if (!clean.isEmpty() && !"..".equals(clean.getLast())) { clean.removeLast(); if (!st.hasMoreTokens()) { isDir = true; } } else { clean.add(".."); } } else if (!".".equals(token) && !"".equals(token)) { clean.add(token); } } StringBuffer sb = new StringBuffer(); while (leadingSlashes-- > 0) { sb.append('/'); } for (Iterator it = clean.iterator(); it.hasNext();) { sb.append(it.next()); if (it.hasNext()) { sb.append('/'); } } if (isDir && sb.length() > 0 && sb.charAt(sb.length() - 1) != '/') { sb.append('/'); } return sb.toString(); } public static String getPath(String parent, String childPath) { Stack parentStack = new Stack(); Stack childStack = new Stack(); if (parent != null) { String[] values = parent.split("/"); if (values.length > 0) { for (int i = 0; i < values.length; i++) { String value = values[i]; parentStack.push(value); } } } String[] values = childPath.split("/"); if (values.length > 0) { for (int i = 0; i < values.length; i++) { String value = values[i]; childStack.push(value); } } String filepath = ""; while (!childStack.isEmpty()) { String value = (String) childStack.pop(); if ("..".equals(value)) { parentStack.pop(); } else if (!"".equals(value)) { if ("".equals(filepath)) { filepath = value; } else { filepath = value + "/" + filepath; } } } while (!parentStack.isEmpty()) { String value = (String) parentStack.pop(); if (!"".equals(value)) { filepath = value + "/" + filepath; } } return filepath; } /** * Searches for jar files inside /lib dirctory. If there are any, the names * of those jar files will be added to the array list */ public static List findLibJars(URL url) { ArrayList embedded_jars = new ArrayList(); try { ZipInputStream zin = new ZipInputStream(url.openStream()); ZipEntry entry; String entryName = ""; while ((entry = zin.getNextEntry()) != null) { entryName = entry.getName(); /** * if the entry name start with /lib and ends with .jar add it * to the the arraylist */ if (entryName != null && (entryName.startsWith("lib/") || entryName .startsWith("Lib/")) && entryName.endsWith(".jar")) { embedded_jars.add(entryName); } } zin.close(); } catch (Exception e) { throw new RuntimeException(e); } return embedded_jars; } /** * To add the exclude method when generating schemas , here the exclude * methods will be session releated axis2 methods */ public static void addExcludeMethods(ArrayList excludeList) { excludeList.add("init"); excludeList.add("setOperationContext"); excludeList.add("startUp"); excludeList.add("destroy"); excludeList.add("shutDown"); } public static DeploymentClassLoader createClassLoader(File serviceFile) throws MalformedURLException { ClassLoader contextClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } }); return createDeploymentClassLoader(new URL[] { serviceFile.toURL() }, contextClassLoader, new ArrayList()); } public static ClassLoader createClassLoader(ArrayList urls, ClassLoader serviceClassLoader, boolean extractJars, File tmpDir) { URL url = (URL) urls.get(0); if (extractJars) { try { URL[] urls1 = Utils.getURLsForAllJars(url, tmpDir); urls.remove(0); urls.addAll(0, Arrays.asList(urls1)); URL[] urls2 = (URL[]) urls.toArray(new URL[urls.size()]); return createDeploymentClassLoader(urls2, serviceClassLoader, null); } catch (Exception e) { log .warn("Exception extracting jars into temporary directory : " + e.getMessage() + " : switching to alternate class loading mechanism"); log.debug(e.getMessage(), e); } } List embedded_jars = Utils.findLibJars(url); URL[] urls2 = (URL[]) urls.toArray(new URL[urls.size()]); return createDeploymentClassLoader(urls2, serviceClassLoader, embedded_jars); } public static File toFile(URL url) throws UnsupportedEncodingException { String path = URLDecoder.decode(url.getPath(), defaultEncoding); File file = new File(path.replace('/', File.separatorChar).replace('|', ':')); return file; } public static ClassLoader createClassLoader(URL[] urls, ClassLoader serviceClassLoader, boolean extractJars, File tmpDir) { if (extractJars) { try { URL[] urls1 = Utils.getURLsForAllJars(urls[0], tmpDir); return createDeploymentClassLoader(urls1, serviceClassLoader, null); } catch (Exception e) { log .warn("Exception extracting jars into temporary directory : " + e.getMessage() + " : switching to alternate class loading mechanism"); log.debug(e.getMessage(), e); } } List embedded_jars = Utils.findLibJars(urls[0]); return createDeploymentClassLoader(urls, serviceClassLoader, embedded_jars); } private static DeploymentClassLoader createDeploymentClassLoader( final URL[] urls, final ClassLoader serviceClassLoader, final List embeddedJars) { return (DeploymentClassLoader) AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return new DeploymentClassLoader(urls, embeddedJars, serviceClassLoader); } }); } /** * This method is to process bean exclude parameter and the XML format of * that would be + * * @param service , * AxisService object */ public static void processBeanPropertyExclude(AxisService service) { Parameter excludeBeanProperty = service .getParameter("beanPropertyRules"); if (excludeBeanProperty != null) { OMElement parameterElement = excludeBeanProperty .getParameterElement(); Iterator bneasItr = parameterElement.getChildrenWithName(new QName( "bean")); ExcludeInfo excludeInfo = new ExcludeInfo(); while (bneasItr.hasNext()) { OMElement bean = (OMElement) bneasItr.next(); String clazz = bean.getAttributeValue(new QName( DeploymentConstants.TAG_CLASS_NAME)); String excludePropertees = bean.getAttributeValue(new QName( DeploymentConstants.TAG_EXCLUDE_PROPERTIES)); String includeProperties = bean.getAttributeValue(new QName( DeploymentConstants.TAG_INCLUDE_PROPERTIES)); excludeInfo.putBeanInfo(clazz, new BeanExcludeInfo( excludePropertees, includeProperties)); } service.setExcludeInfo(excludeInfo); } } /** * This will split a bean exclude property values into ArrayList * * @param value : * String to be splited * @return : Arryalist of the splited string */ private static List getArrayFromString(String value) { String values[] = value.split(","); ArrayList list = new ArrayList(); for (int i = 0; i < values.length; i++) { String s = values[i]; list.add(s); } return list; } public static String getShortFileName(String filename) { File file = new File(filename); return file.getName(); } /** * The util method to prepare the JSR 181 annotated service name from given * annotation or for defaults JSR 181 specifies that the in * javax.jws.WebService the parameter serviceName contains the wsdl:service * name to mapp. If its not available then the default will be Simple name * of the class + "Service" * * @return String version of the ServiceName according to the JSR 181 spec */ public static String getAnnotatedServiceName(Class serviceClass, JAnnotation serviceAnnotation) { String serviceName = ""; if (serviceAnnotation.getValue(AnnotationConstants.SERVICE_NAME) != null) { serviceName = (serviceAnnotation .getValue(AnnotationConstants.SERVICE_NAME)).asString(); } if (serviceName.equals("")) { serviceName = serviceClass.getName(); int firstChar = serviceName.lastIndexOf('.') + 1; if (firstChar > 0) { serviceName = serviceName.substring(firstChar); } serviceName += "Service"; } return serviceName; } public static void addEndpointsToService(AxisService axisService) throws AxisFault { String serviceName = axisService.getName(); Iterator transportInValues = null; if (axisService.isEnableAllTransports()) { AxisConfiguration axisConfiguration = axisService .getAxisConfiguration(); if (axisConfiguration != null) { ArrayList transports = new ArrayList(); for (Iterator iterator = axisConfiguration.getTransportsIn() .values().iterator(); iterator.hasNext();) { TransportInDescription transportInDescription = (TransportInDescription) iterator .next(); transports.add(transportInDescription.getName()); } transportInValues = transports.iterator(); } } else { transportInValues = axisService.getExposedTransports().iterator(); } HashMap bindingCache = new HashMap(); if (transportInValues != null) { for (; transportInValues.hasNext();) { String transportName = (String) transportInValues.next(); String protocol = transportName.substring(0, 1).toUpperCase() + transportName.substring(1, transportName.length()) .toLowerCase(); /* * populates soap11 endpoint */ String soap11EndpointName = serviceName + protocol + "Soap11Endpoint"; AxisEndpoint httpSoap11Endpoint = new AxisEndpoint(); httpSoap11Endpoint.setName(soap11EndpointName); httpSoap11Endpoint.setParent(axisService); httpSoap11Endpoint.setTransportInDescription(transportName); populateSoap11Endpoint(axisService, httpSoap11Endpoint, bindingCache); axisService.addEndpoint(httpSoap11Endpoint.getName(), httpSoap11Endpoint); // setting soap11 endpoint as the default endpoint axisService.setEndpointName(soap11EndpointName); /* * generating Soap12 endpoint */ String soap12EndpointName = serviceName + protocol + "Soap12Endpoint"; AxisEndpoint httpSoap12Endpoint = new AxisEndpoint(); httpSoap12Endpoint.setName(soap12EndpointName); httpSoap12Endpoint.setParent(axisService); httpSoap12Endpoint.setTransportInDescription(transportName); populateSoap12Endpoint(axisService, httpSoap12Endpoint, bindingCache); axisService.addEndpoint(httpSoap12Endpoint.getName(), httpSoap12Endpoint); boolean disableREST = false; Parameter disableRESTParameter = axisService .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST); if (disableRESTParameter != null && JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { disableREST = true; } /* * generating Http endpoint */ if ("http".equals(transportName) && !disableREST) { String httpEndpointName = serviceName + protocol + "Endpoint"; AxisEndpoint httpEndpoint = new AxisEndpoint(); httpEndpoint.setName(httpEndpointName); httpEndpoint.setParent(axisService); httpEndpoint.setTransportInDescription(transportName); populateHttpEndpoint(axisService, httpEndpoint, bindingCache); axisService.addEndpoint(httpEndpoint.getName(), httpEndpoint); } } } } public static void addEndpointsToService(AxisService axisService, AxisConfiguration axisConfiguration) throws AxisFault { String serviceName = axisService.getName(); Iterator transportInValues = null; if (axisConfiguration != null) { ArrayList transports = new ArrayList(); for (Iterator iterator = axisConfiguration.getTransportsIn() .values().iterator(); iterator.hasNext();) { TransportInDescription transportInDescription = (TransportInDescription) iterator .next(); transports.add(transportInDescription.getName()); } transportInValues = transports.iterator(); } HashMap bindingCache = new HashMap(); if (transportInValues != null) { for (; transportInValues.hasNext();) { String transportName = (String) transportInValues.next(); String protocol = transportName.substring(0, 1).toUpperCase() + transportName.substring(1, transportName.length()) .toLowerCase(); /* * populates soap11 endpoint */ String soap11EndpointName = serviceName + protocol + "Soap11Endpoint"; AxisEndpoint httpSoap11Endpoint = new AxisEndpoint(); httpSoap11Endpoint.setName(soap11EndpointName); httpSoap11Endpoint.setParent(axisService); httpSoap11Endpoint.setTransportInDescription(transportName); populateSoap11Endpoint(axisService, httpSoap11Endpoint, bindingCache); axisService.addEndpoint(httpSoap11Endpoint.getName(), httpSoap11Endpoint); // setting soap11 endpoint as the default endpoint axisService.setEndpointName(soap11EndpointName); /* * generating Soap12 endpoint */ String soap12EndpointName = serviceName + protocol + "Soap12Endpoint"; AxisEndpoint httpSoap12Endpoint = new AxisEndpoint(); httpSoap12Endpoint.setName(soap12EndpointName); httpSoap12Endpoint.setParent(axisService); httpSoap12Endpoint.setTransportInDescription(transportName); populateSoap12Endpoint(axisService, httpSoap12Endpoint, bindingCache); axisService.addEndpoint(httpSoap12Endpoint.getName(), httpSoap12Endpoint); // axis2.xml or services.xml indicated no HTTP binding? boolean disableREST = false; Parameter disableRESTParameter = axisService .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST); if (disableRESTParameter != null && JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { disableREST = true; } /* * generating Http endpoint */ if (("http".equals(transportName) || "https".equals(transportName)) && !disableREST) { String httpEndpointName = serviceName + protocol + "Endpoint"; AxisEndpoint httpEndpoint = new AxisEndpoint(); httpEndpoint.setName(httpEndpointName); httpEndpoint.setParent(axisService); httpEndpoint.setTransportInDescription(transportName); populateHttpEndpoint(axisService, httpEndpoint, bindingCache); axisService.addEndpoint(httpEndpoint.getName(), httpEndpoint); } } } } public static void addSoap11Endpoint(AxisService axisService, URL url) throws Exception { String protocol = url.getProtocol(); protocol = protocol.substring(0, 1).toUpperCase() + protocol.substring(1, protocol.length()).toLowerCase(); String serviceName = axisService.getName(); String soap11EndpointName = serviceName + protocol + "Soap11Endpoint"; AxisEndpoint httpSoap11Endpoint = new AxisEndpoint(); httpSoap11Endpoint.setName(soap11EndpointName); httpSoap11Endpoint.setParent(axisService); httpSoap11Endpoint.setEndpointURL(url.toString()); httpSoap11Endpoint.setTransportInDescription(url.getProtocol()); populateSoap11Endpoint(axisService, httpSoap11Endpoint, null); axisService.addEndpoint(httpSoap11Endpoint.getName(), httpSoap11Endpoint); // setting soap11 endpoint as the default endpoint axisService.setEndpointName(soap11EndpointName); } public static void addSoap12Endpoint(AxisService axisService, URL url) throws Exception { String protocol = url.getProtocol(); protocol = protocol.substring(0, 1).toUpperCase() + protocol.substring(1, protocol.length()).toLowerCase(); String serviceName = axisService.getName(); String soap12EndpointName = serviceName + protocol + "Soap12Endpoint"; AxisEndpoint httpSoap12Endpoint = new AxisEndpoint(); httpSoap12Endpoint.setName(soap12EndpointName); httpSoap12Endpoint.setParent(axisService); httpSoap12Endpoint.setEndpointURL(url.toString()); httpSoap12Endpoint.setTransportInDescription(url.getProtocol()); populateSoap12Endpoint(axisService, httpSoap12Endpoint, null); axisService.addEndpoint(httpSoap12Endpoint.getName(), httpSoap12Endpoint); } public static void addHttpEndpoint(AxisService axisService, URL url) { String serviceName = axisService.getName(); String protocol = url.getProtocol(); protocol = protocol.substring(0, 1).toUpperCase() + protocol.substring(1, protocol.length()).toLowerCase(); String httpEndpointName = serviceName + protocol + "Endpoint"; AxisEndpoint httpEndpoint = new AxisEndpoint(); httpEndpoint.setName(httpEndpointName); httpEndpoint.setParent(axisService); httpEndpoint.setEndpointURL(url.toString()); httpEndpoint.setTransportInDescription(url.getProtocol()); populateHttpEndpoint(axisService, httpEndpoint, null); axisService.addEndpoint(httpEndpoint.getName(), httpEndpoint); } public static void processPolicyAttachments(Iterator attachmentElements, AxisService service) throws XMLStreamException, FactoryConfigurationError { OMElement attachmentElement; HashMap attachmentsMap = new HashMap(); for (; attachmentElements.hasNext();) { attachmentElement = (OMElement) attachmentElements.next(); OMElement appliesToElem = attachmentElement .getFirstChildWithName(new QName( DeploymentConstants.POLICY_NS_URI, DeploymentConstants.TAG_APPLIES_TO)); ArrayList policyComponents = new ArrayList(); // process elements .. for (Iterator policyElements = attachmentElement .getChildrenWithName(new QName( DeploymentConstants.POLICY_NS_URI, DeploymentConstants.TAG_POLICY)); policyElements .hasNext();) { PolicyComponent policy = PolicyUtil .getPolicyFromOMElement((OMElement) policyElements .next()); policyComponents.add(policy); } // process elements .. for (Iterator policyRefElements = attachmentElement .getChildrenWithName(new QName( DeploymentConstants.POLICY_NS_URI, DeploymentConstants.TAG_POLICY_REF)); policyRefElements .hasNext();) { PolicyComponent policyRef = PolicyUtil .getPolicyReferenceFromOMElement((OMElement) policyRefElements .next()); policyComponents.add(policyRef); } for (Iterator policySubjects = appliesToElem .getChildrenWithName(new QName("policy-subject")); policySubjects .hasNext();) { OMElement policySubject = (OMElement) policySubjects.next(); String identifier = policySubject.getAttributeValue(new QName( "identifier")); ArrayList values = (ArrayList) attachmentsMap.get(identifier); if (values == null) { values = new ArrayList(); attachmentsMap.put(identifier, values); } values.addAll(policyComponents); } } for (Iterator keys = attachmentsMap.keySet().iterator(); keys.hasNext();) { String identifier = (String) keys.next(); if (identifier.startsWith("binding:soap")) { processSoapAttachments(identifier, (List) attachmentsMap .get(identifier), service); } } } private static void populateSoap11Endpoint(AxisService axisService, AxisEndpoint axisEndpoint, HashMap bindingCache) { String serviceName = axisService.getName(); String name = serviceName + "Soap11Binding"; QName bindingName = new QName(name); AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding) bindingCache .get(name) : null; if (axisBinding == null) { axisBinding = new AxisBinding(); axisBinding.setName(bindingName); axisBinding.setType(Java2WSDLConstants.TRANSPORT_URI); axisBinding.setProperty(WSDLConstants.WSDL_1_1_STYLE, WSDLConstants.STYLE_DOC); axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); for (Iterator iterator = axisService.getChildren(); iterator .hasNext();) { AxisOperation operation = (AxisOperation) iterator.next(); AxisBindingOperation axisBindingOperation = new AxisBindingOperation(); axisBindingOperation.setName(operation.getName()); axisBindingOperation.setAxisOperation(operation); String soapAction = operation.getSoapAction(); if (soapAction != null) { axisBindingOperation.setProperty( WSDL2Constants.ATTR_WSOAP_ACTION, soapAction); } axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); populateBindingOperation(axisService, axisBinding, axisBindingOperation); } if (bindingCache != null) { bindingCache.put(name, axisBinding); } } axisBinding.setParent(axisEndpoint); axisEndpoint.setBinding(axisBinding); } private static void populateSoap12Endpoint(AxisService axisService, AxisEndpoint axisEndpoint, HashMap bindingCache) { String serviceName = axisService.getName(); String name = serviceName + "Soap12Binding"; QName bindingName = new QName(name); AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding) bindingCache .get(name) : null; if (axisBinding == null) { axisBinding = new AxisBinding(); axisBinding.setName(bindingName); axisBinding.setType(Java2WSDLConstants.TRANSPORT_URI); axisBinding.setProperty(WSDLConstants.WSDL_1_1_STYLE, WSDLConstants.STYLE_DOC); axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); for (Iterator iterator = axisService.getChildren(); iterator .hasNext();) { AxisOperation operation = (AxisOperation) iterator.next(); AxisBindingOperation axisBindingOperation = new AxisBindingOperation(); axisBindingOperation.setName(operation.getName()); axisBindingOperation.setAxisOperation(operation); String soapAction = operation.getSoapAction(); if (soapAction != null) { axisBindingOperation.setProperty( WSDL2Constants.ATTR_WSOAP_ACTION, soapAction); } axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); populateBindingOperation(axisService, axisBinding, axisBindingOperation); } if (bindingCache != null) { bindingCache.put(name, axisBinding); } } axisBinding.setParent(axisEndpoint); axisEndpoint.setBinding(axisBinding); } private static void populateHttpEndpoint(AxisService axisService, AxisEndpoint axisEndpoint, HashMap bindingCache) { String serviceName = axisService.getName(); String name = serviceName + "HttpBinding"; QName bindingName = new QName(name); AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding) bindingCache .get(name) : null; if (axisBinding == null) { axisBinding = new AxisBinding(); axisBinding.setName(bindingName); axisBinding.setType(WSDL2Constants.URI_WSDL2_HTTP); axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, "POST"); for (Iterator iterator = axisService.getChildren(); iterator .hasNext();) { AxisOperation operation = (AxisOperation) iterator.next(); AxisBindingOperation axisBindingOperation = new AxisBindingOperation(); QName operationQName = operation.getName(); axisBindingOperation.setName(operationQName); axisBindingOperation.setAxisOperation(operation); String httpLocation = operationQName.getLocalPart(); axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation); axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation); populateBindingOperation(axisService, axisBinding, axisBindingOperation); } if (bindingCache != null) { bindingCache.put(name, axisBinding); } } axisBinding.setParent(axisEndpoint); axisEndpoint.setBinding(axisBinding); } private static void populateBindingOperation(AxisService axisService, AxisBinding axisBinding, AxisBindingOperation axisBindingOperation) { AxisOperation axisOperation = axisBindingOperation.getAxisOperation(); if (WSDLUtil.isInputPresentForMEP(axisOperation .getMessageExchangePattern())) { AxisMessage axisInMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); AxisBindingMessage axisBindingInMessage = new AxisBindingMessage(); axisBindingInMessage.setName(axisInMessage.getName()); axisBindingInMessage.setDirection(axisInMessage.getDirection()); axisBindingInMessage.setAxisMessage(axisInMessage); axisBindingInMessage.setParent(axisBindingOperation); axisBindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisBindingInMessage); } if (WSDLUtil.isOutputPresentForMEP(axisOperation .getMessageExchangePattern())) { AxisMessage axisOutMessage = axisOperation .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage(); axisBindingOutMessage.setName(axisOutMessage.getName()); axisBindingOutMessage.setDirection(axisOutMessage.getDirection()); axisBindingOutMessage.setAxisMessage(axisOutMessage); axisBindingOutMessage.setParent(axisBindingOperation); axisBindingOperation.addChild( WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisBindingOutMessage); } ArrayList faultMessagesList = axisOperation.getFaultMessages(); for (Iterator iterator2 = faultMessagesList.iterator(); iterator2 .hasNext();) { AxisMessage axisFaultMessage = (AxisMessage) iterator2.next(); AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage(); axisBindingFaultMessage.setName(axisFaultMessage.getName()); axisBindingFaultMessage.setFault(true); axisBindingFaultMessage.setAxisMessage(axisFaultMessage); axisBindingFaultMessage.setParent(axisBindingOperation); axisBindingOperation.addFault(axisBindingFaultMessage); axisBinding.addFault(axisBindingFaultMessage); } axisBindingOperation.setAxisOperation(axisOperation); axisBindingOperation.setParent(axisBinding); } private static void processSoapAttachments(String identifier, List policyComponents, AxisService service) { Map map = service.getEndpoints(); String soapVersion = (identifier.indexOf("soap12") > -1) ? SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; for (Iterator iterator = map.values().iterator(); iterator.hasNext();) { AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next(); AxisBinding axisBinding = axisEndpoint.getBinding(); String wsoap = (String) axisBinding .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (soapVersion.equals(wsoap)) { String[] identifiers = identifier.split("/"); int key = identifiers.length; if (key == 1) { axisBinding.getPolicySubject().attachPolicyComponents( policyComponents); } else if (key == 2 || key == 3) { String opName = identifiers[1]; opName = opName.substring(opName.indexOf(":") + 1, opName .length()); AxisBindingOperation bindingOperation = null; boolean found = false; for (Iterator i = axisBinding.getChildren(); i.hasNext();) { bindingOperation = (AxisBindingOperation) i.next(); if (opName.equals(bindingOperation.getName() .getLocalPart())) { found = true; break; } } if (!found) { throw new IllegalArgumentException( "Invalid binding operation " + opName); } if (key == 2) { bindingOperation.getPolicySubject() .attachPolicyComponents(policyComponents); } else { if ("in".equals(identifiers[2])) { AxisBindingMessage bindingInMessage = (AxisBindingMessage) bindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE); bindingInMessage.getPolicySubject() .attachPolicyComponents(policyComponents); } else if ("out".equals(identifiers[2])) { AxisBindingMessage bindingOutMessage = (AxisBindingMessage) bindingOperation .getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); bindingOutMessage.getPolicySubject() .attachPolicyComponents(policyComponents); } else { // FIXME faults } } } break; } } } public static void populateEPMap(AxisService service) { HashMap map = new HashMap(); for (Iterator iterator = service.getEndpoints().values().iterator(); iterator .hasNext();) { AxisEndpoint endpoint = (AxisEndpoint) iterator.next(); String transportInDescription = endpoint .getTransportInDescription(); if (transportInDescription == null) { continue; } AxisBinding binding = endpoint.getBinding(); if (binding != null) { if (isSoap11Binding(binding)) { map.put(transportInDescription + ":soap11", endpoint); } else if (isSoap12Binding(binding)) { map.put(transportInDescription + ":soap12", endpoint); } else if (isHttpBinding(binding)) { map.put(transportInDescription + ":http", endpoint); } } } service.setEpMap(map); } public static void addModuleBindingOperation(AxisService service, AxisOperation operation) { ArrayList bindings = new ArrayList(); Map endpointsMap = service.getEndpoints(); for (Iterator iterator = endpointsMap.values().iterator(); iterator.hasNext();) { AxisEndpoint endpoint = (AxisEndpoint) iterator.next(); AxisBinding binding = endpoint.getBinding(); AxisBindingOperation bindingOperation = new AxisBindingOperation(); bindingOperation.setName(operation.getName()); bindingOperation.setAxisOperation(operation); if (!bindings.contains(binding.getName())) { if (isSoap11Binding(binding)) { String soapAction = operation.getSoapAction(); if (soapAction != null) { bindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapAction); } } else if (isSoap12Binding(binding)) { String soapAction = operation.getSoapAction(); if (soapAction != null) { bindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapAction); } } else if (isHttpBinding(binding)) { String serviceName = service.getName(); String name = serviceName + "HttpBinding"; String httpLocation = serviceName + "/" + operation.getName().getLocalPart(); bindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation); } } binding.addChild(bindingOperation.getName(), bindingOperation); populateBindingOperation(service, binding, bindingOperation); } } public static boolean isSoap11Binding(AxisBinding binding) { String type = binding.getType(); if (Java2WSDLConstants.TRANSPORT_URI.equals(type) || WSDL2Constants.URI_WSDL2_SOAP.equals(type)) { String v = (String) binding .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(v)) { return true; } } return false; } public static boolean isSoap12Binding(AxisBinding binding) { String type = binding.getType(); if (Java2WSDLConstants.TRANSPORT_URI.equals(type) || WSDL2Constants.URI_WSDL2_SOAP.equals(type)) { String v = (String) binding .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(v)) { return true; } } return false; } public static boolean isHttpBinding(AxisBinding binding) { String type = binding.getType(); if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { return true; } return false; } } ./src/org/apache/axis2/deployment/DeploymentErrorMsgs.java0000664000175000017500000001056611767656530023051 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; public class DeploymentErrorMsgs { public static final String ADDING_NEW_MODULE = "addingnewmodule"; public static final String BAD_MODULE_FROM_OPERATION = "badModuleFromOperation"; public static final String BAD_MODULE_FROM_SERVICE = "badModuleFromService"; public static final String BAD_PARAMETER_ARGUMENT = "badparaagu"; public static final String CONFIG_NOT_FOUND = "confignotfound"; public static final String CLASS_NOT_FOUND = "classnotfound"; public static final String DEPLOYING_MODULE = "deployingmodule"; public static final String DEPLOYING_WS = "deployingws"; public static final String DEPLOYING_POJO = "deployingpojo"; public static final String ELEMENT_IS_NOT_ALLOWED = "elementisnotallow"; public static final String ERROR_IN_LOADING_MESSAGE_RECEIVER = "errorinloadingmr"; public static final String FLOWTYPE_IS_REQUIRED = "flowtypeisrequird"; public static final String FILE_NOT_FOUND = "fileNotFound"; public static final String INFLOW_NOT_ALLOWED_IN_TRS_OUT = "inflownotallowedintrout"; public static final String INVALID_HANDLER = "invalidhandler"; public static final String INVALID_MODULE = "invalidmodule"; public static final String INVALID_MODULE_CONFIG = "invalidmoduleconfig"; public static final String INVALID_MODULE_REF = "invalidmodulerefbyconfig"; public static final String INVALID_OP = "invalid_op"; public static final String INVALID_PHASE = "invalidphase"; public static final String INVALID_SERVICE = "invalidservice"; public static final String INVALID_STORAGE_CLASS = "invalid_storage"; public static final String MODULE_CANNOT_HAVE_BOTH_NAME_AND_REFERENCE = "modulecannothavrbothnameandref"; public static final String DISPATCH_PHASE_NOT_FOUND = "dispatchPhaseNotFoundOnInflow"; public static final String MODULE_NOT_FOUND = "modulenotfound"; public static final String MODULE_VALIDATION_FAILED = "modulevalfailed"; public static final String MODULE_XML_MISSING = "modulexmlnotfound"; public static final String META_INF_MISSING = "noMetaInf"; public static final String OBSERVER_ERROR = "obsererror"; public static final String OPERATION_PROCESS_ERROR = "op_error"; public static final String OUTFLOW_NOT_ALLOWED_IN_TRS_IN = "outflownotallowedintrin"; public static final String PARAMETER_LOCKED = "parameterlockederror"; public static final String PATH_TO_CONFIG_CANNOT_BE_NULL = "pathtoconfigcanotnull"; public static final String REPOSITORY_CANNOT_BE_NULL = "repocannotbebull"; public static final String SERVICE_MODULE_CANNOT_REFER_GLOBAL_PHASE = "servicemodulecannothaveglobal"; public static final String SERVICE_NAME_ERROR = "servicenameeror"; public static final String SERVICE_REMOVED = "serviceremoved"; public static final String SERVICE_XML_NOT_FOUND = "servicexmlnotfound"; public static final String ERROR_SETTING_CLIENT_HOME = "settingcl"; public static final String TRANSPORT_SENDER_ERROR = "transportSenderError"; public static final String XML_STREAM_EXCEPTION = "StreamException"; public static final String ERROR_LOADING_MESSAGE_BUILDER = "errorloadingbuilder"; public static final String ERROR_LOADING_MESSAGE_FORMATTER = "errorloadingformatter"; public static final String DEPLOYING_EXCEPTION = "deployingexception"; public static final String STORING_FAULTY_SERVICE = "stroringfaultyservice"; public static final String JAXWS_JARS_MISSING = "jaxwsjarsmissing"; public static final String FAULTY_SERVICE_REMOVAL = "faultyserviceremoval"; } ./src/org/apache/axis2/deployment/DeploymentException.java0000664000175000017500000000236411767656530023061 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; public class DeploymentException extends AxisFault { private static final long serialVersionUID = -206215612208580684L; public DeploymentException(String message) { super(message); } public DeploymentException(Throwable cause) { super(cause); } public DeploymentException(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axis2/deployment/DeploymentClassLoader.java0000664000175000017500000002203711767656530023316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.attachments.utils.IOUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLClassLoader; import java.net.URLConnection; import java.net.URLStreamHandler; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class DeploymentClassLoader extends URLClassLoader { // List of URL's private URL[] urls = null; // List of jar files inside the jars in the original url private List embedded_jars; /** * DeploymentClassLoader is extended from URLClassLoader. The constructor * does not override the super constructor, but takes in an addition list of * jar files inside /lib directory. * * @param urls URLs * @param parent parent classloader ClassLoader */ public DeploymentClassLoader(URL[] urls, List embedded_jars, ClassLoader parent) { super(urls, parent); this.urls = urls; this.embedded_jars = embedded_jars; } /** * Finds and loads the class with the specified name from the URL search * path. Any URLs referring to JAR files are loaded and opened as needed * until the class is found. * * @param name the name of the class * @return the resulting class * @exception ClassNotFoundException if the class could not be found */ protected Class findClass(String name) throws ClassNotFoundException { Class clazz; try { clazz = super.findClass(name); } catch (ClassNotFoundException e) { byte raw[] = null; try { String completeFileName = name; /** * Replacing org.apache. -> org/apache/... */ completeFileName = completeFileName.replace('.', '/').concat(".class"); raw = getBytes(completeFileName); } catch (Exception ex) { // Fall through } if (raw == null) { throw new ClassNotFoundException("Class Not found : " + name); } clazz = defineClass(name, raw, 0, raw.length); } return clazz; } /** * Finds the resource with the specified name on the URL search path. * * @param resource the name of the resource * @return a URL for the resource, or null * if the resource could not be found. */ public URL findResource(String resource) { URL url = super.findResource(resource); if (url == null) { for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) { String libjar_name = (String) embedded_jars.get(i); try { InputStream in = getJarAsStream(libjar_name); ZipInputStream zin = new ZipInputStream(in); ZipEntry entry; String entryName; while ((entry = zin.getNextEntry()) != null) { entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { byte[] raw = IOUtils.getStreamAsByteArray(zin); return new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName, new ByteUrlStreamHandler(raw)); } } } catch (Exception e) { throw new RuntimeException(e); } } } return url; } /** * Returns an Enumeration of URLs representing all of the resources * on the URL search path having the specified name. * * @param resource the resource name * @exception IOException if an I/O exception occurs * @return an Enumeration of URLs */ public Enumeration findResources(String resource) throws IOException { ArrayList resources = new ArrayList(); Enumeration e = super.findResources(resource); while (e.hasMoreElements()) { resources.add(e.nextElement()); } for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) { String libjar_name = (String) embedded_jars.get(i); try { InputStream in = getJarAsStream(libjar_name); ZipInputStream zin = new ZipInputStream(in); ZipEntry entry; String entryName; while ((entry = zin.getNextEntry()) != null) { entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { byte[] raw = IOUtils.getStreamAsByteArray(zin); resources.add(new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName, new ByteUrlStreamHandler(raw))); } } } catch (Exception ex) { throw new RuntimeException(ex); } } return Collections.enumeration(resources); } /** * Access the jars file (/lib) one by one , then for each one create a ZipInputStream * and check to see whether there is any entry eith given name. if it is found then * return the byte array for that * * @param resource String Name of the file to be found * @return byte[] * @throws java.io.IOException Exception */ private byte[] getBytes(String resource) throws Exception { for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) { String libjar_name = (String) embedded_jars.get(i); InputStream in = getJarAsStream(libjar_name); byte[] bytes = getBytes(in, resource); if(bytes != null) { return bytes; } } return null; } /** * Get a specific entry's content as a byte array * * @param in * @param resource * @return * @throws Exception */ private byte[] getBytes(InputStream in, String resource) throws Exception { ZipInputStream zin = new ZipInputStream(in); ZipEntry entry; String entryName; while ((entry = zin.getNextEntry()) != null) { entryName = entry.getName(); if (entryName != null && entryName.endsWith(resource)) { byte[] raw = IOUtils.getStreamAsByteArray(zin); zin.close(); return raw; } } return null; } /** * Get the specified embedded jar from the main jar * * @param libjar_name * @return * @throws Exception */ private InputStream getJarAsStream(String libjar_name) throws Exception { return new ByteArrayInputStream(getBytes(urls[0].openStream(), libjar_name)); } public static class ByteUrlStreamHandler extends URLStreamHandler { private byte[] bytes; public ByteUrlStreamHandler(byte[] bytes) { this.bytes = bytes; } protected URLConnection openConnection(URL u) throws IOException { return new ByteURLConnection(u, bytes); } } public static class ByteURLConnection extends URLConnection { protected byte[] bytes; public ByteURLConnection(URL url, byte[] bytes) { super(url); this.bytes = bytes; } public void connect() { } public InputStream getInputStream() { return new ByteArrayInputStream(bytes); } } public InputStream getResourceAsStream(String name) { URL url = findResource(name); if(url == null) { url = getResource(name); } if(url!=null){ try { return url.openStream(); } catch (IOException e) { throw new RuntimeException(e); } } return null; } } ./src/org/apache/axis2/deployment/ClusterBuilder.java0000664000175000017500000002777111767656530022023 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.clustering.ClusterManager; import org.apache.axis2.clustering.configuration.ConfigurationManager; import org.apache.axis2.clustering.configuration.ConfigurationManagerListener; import org.apache.axis2.clustering.context.ContextManager; import org.apache.axis2.clustering.context.ContextManagerListener; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import javax.xml.namespace.QName; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Builds a service description from OM */ public class ClusterBuilder extends DescriptionBuilder { // private static final Log log = LogFactory.getLog(ClusterBuilder.class); public ClusterBuilder(AxisConfiguration axisConfig) { this.axisConfig = axisConfig; } public ClusterBuilder(InputStream serviceInputStream, AxisConfiguration axisConfig) { super(serviceInputStream, axisConfig); } /** * Populates service from corresponding OM. */ public void buildCluster(OMElement clusterElement) throws DeploymentException { OMAttribute classNameAttr = clusterElement.getAttribute(new QName(TAG_CLASS_NAME)); if (classNameAttr == null) { throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CLUSTER)); } String className = classNameAttr.getAttributeValue(); ClusterManager clusterManager; try { Class clazz; try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage("clusterImplNotFound", className)); } clusterManager = (ClusterManager) clazz.newInstance(); clusterManager.setConfigurationContext(configCtx); //loading the parameters. processParameters(clusterElement.getChildrenWithName(new QName(TAG_PARAMETER)), clusterManager, null); //loading the ConfigurationManager loadConfigManager(clusterElement, clusterManager); // loading the ContextManager loadContextManager(clusterElement, clusterManager); axisConfig.setClusterManager(clusterManager); } catch (InstantiationException e) { throw new DeploymentException(Messages.getMessage("cannotLoadClusterImpl")); } catch (IllegalAccessException e) { throw new DeploymentException(e); } } private void loadContextManager(OMElement clusterElement, ClusterManager clusterManager) throws DeploymentException, InstantiationException, IllegalAccessException { OMElement contextManagerEle = clusterElement.getFirstChildWithName(new QName(TAG_CONTEXT_MANAGER)); if (contextManagerEle != null) { // Load & set the ContextManager class OMAttribute classNameAttr = contextManagerEle.getAttribute(new QName(ATTRIBUTE_CLASS)); if (classNameAttr == null) { throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CONTEXT_MANAGER)); } String className = classNameAttr.getAttributeValue(); Class clazz; try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage("clusterImplNotFound", className)); } ContextManager contextManager = (ContextManager) clazz.newInstance(); clusterManager.setContextManager(contextManager); // Load & set the ContextManagerListener OMElement listenerEle = contextManagerEle.getFirstChildWithName(new QName(TAG_LISTENER)); if (listenerEle != null) { classNameAttr = listenerEle.getAttribute(new QName(TAG_CLASS_NAME)); if (classNameAttr == null) { throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_LISTENER)); } className = classNameAttr.getAttributeValue(); try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage("clusterImplNotFound", className)); } ContextManagerListener listener = (ContextManagerListener) clazz.newInstance(); contextManager.setContextManagerListener(listener); } else { throw new DeploymentException(Messages.getMessage("contextManagerListenerIsNull")); } //loading the parameters. processParameters(contextManagerEle.getChildrenWithName(new QName(TAG_PARAMETER)), contextManager, null); // Load the replication patterns to be excluded. We load the following structure. /* */ OMElement replicationEle = contextManagerEle.getFirstChildWithName(new QName(TAG_REPLICATION)); if (replicationEle != null) { // Process defaults OMElement defaultsEle = replicationEle.getFirstChildWithName(new QName(TAG_DEFAULTS)); if (defaultsEle != null) { List defaults = new ArrayList(); for (Iterator iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE)); iter.hasNext();) { OMElement excludeEle = (OMElement) iter.next(); OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME)); defaults.add(nameAtt.getAttributeValue()); } contextManager.setReplicationExcludePatterns(TAG_DEFAULTS, defaults); } // Process specifics for (Iterator iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT)); iter.hasNext();) { OMElement contextEle = (OMElement) iter.next(); String ctxClassName = contextEle.getAttribute(new QName(ATTRIBUTE_CLASS)).getAttributeValue(); List excludes = new ArrayList(); for (Iterator iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE)); iter2.hasNext();) { OMElement excludeEle = (OMElement) iter2.next(); OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME)); excludes.add(nameAtt.getAttributeValue()); } contextManager.setReplicationExcludePatterns(ctxClassName, excludes); } } } } private void loadConfigManager(OMElement clusterElement, ClusterManager clusterManager) throws DeploymentException, InstantiationException, IllegalAccessException { OMElement configManagerEle = clusterElement.getFirstChildWithName(new QName(TAG_CONFIGURATION_MANAGER)); if (configManagerEle != null) { OMAttribute classNameAttr = configManagerEle.getAttribute(new QName(ATTRIBUTE_CLASS)); if (classNameAttr == null) { throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CONFIGURATION_MANAGER)); } String className = classNameAttr.getAttributeValue(); Class clazz; try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage("clusterImplNotFound", className)); } ConfigurationManager configurationManager = (ConfigurationManager) clazz.newInstance(); clusterManager.setConfigurationManager(configurationManager); OMElement listenerEle = configManagerEle.getFirstChildWithName(new QName(TAG_LISTENER)); if (listenerEle != null) { classNameAttr = listenerEle.getAttribute(new QName(TAG_CLASS_NAME)); if (classNameAttr == null) { throw new DeploymentException(Messages.getMessage("clusterImplNotFound", TAG_LISTENER)); } className = classNameAttr.getAttributeValue(); try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage("configurationManagerListenerIsNull")); } ConfigurationManagerListener listener = (ConfigurationManagerListener) clazz .newInstance(); listener.setConfigurationContext(configCtx); configurationManager.setConfigurationManagerListener(listener); } else { throw new DeploymentException(Messages.getMessage("configurationManagerListenerIsNull")); } //updating the ConfigurationManager with the new ConfigurationContext configurationManager.setConfigurationContext(configCtx); //loading the parameters. processParameters(configManagerEle.getChildrenWithName(new QName(TAG_PARAMETER)), configurationManager, null); } } } ./src/org/apache/axis2/deployment/RepositoryListener.java0000664000175000017500000003157211767656530022752 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.deployment.repository.util.WSInfo; import org.apache.axis2.deployment.repository.util.WSInfoList; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.util.Loader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; public class RepositoryListener implements DeploymentConstants { protected static final Log log = LogFactory.getLog(RepositoryListener.class); protected DeploymentEngine deploymentEngine; /** Reference to a WSInfoList */ protected WSInfoList wsInfoList; /** * This constructor takes two arguments, a folder name and a reference to Deployment Engine * First, it initializes the system, by loading all the modules in the /modules directory and * then creates a WSInfoList to store information about available modules and services. * * @param deploymentEngine reference to engine registry for updates * @param isClasspath true if this RepositoryListener should scan the classpath for * Modules */ public RepositoryListener(DeploymentEngine deploymentEngine, boolean isClasspath) { this.deploymentEngine = deploymentEngine; wsInfoList = new WSInfoList(deploymentEngine); init2(isClasspath); } public void init2(boolean isClasspath) { if (!isClasspath) { init(); } loadClassPathModules(); } /** Finds a list of modules in the folder and adds to wsInfoList. */ public void checkModules() { File root = deploymentEngine.getModulesDir(); File[] files = root.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { File file = files[i]; if (isSourceControlDir(file)) { continue; } if (!file.isDirectory()) { if (DeploymentFileData.isModuleArchiveFile(file.getName())) { addFileToDeploy(file, deploymentEngine.getModuleDeployer(), WSInfo.TYPE_MODULE); } } else { if (!"lib".equalsIgnoreCase(file.getName())) { addFileToDeploy(file, deploymentEngine.getModuleDeployer(), WSInfo.TYPE_MODULE); } } } } } protected boolean isSourceControlDir(File file) { if (file.isDirectory()) { String name = file.getName(); if (name.equalsIgnoreCase("CVS") || name.equalsIgnoreCase(".svn")) { return true; } } return false; } protected void loadClassPathModules() { ModuleDeployer deployer = deploymentEngine.getModuleDeployer(); // Find Modules on the class path (i.e. if classpath includes "addressing.mar" then // addressing will be available for engaging) ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Enumeration moduleURLs = loader.getResources("META-INF/module.xml"); while (moduleURLs.hasMoreElements()) { try { URL url = (URL)moduleURLs.nextElement(); String fileName = url.toString(); if (fileName.startsWith("jar")) { url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL(); fileName = url.toString(); } else if (fileName.startsWith("file")) { fileName = fileName.substring(0, fileName.lastIndexOf("/META-INF/module.xml")); } else continue; log.debug("Deploying module from classpath at '" + fileName + "'"); File f = new File(new URI(fileName)); addFileToDeploy(f, deployer, WSInfo.TYPE_MODULE); } catch (URISyntaxException e) { log.info(e); } } } catch (Exception e) { // Oh well, log the problem log.debug(e); } String classPath = getLocation(); if (classPath == null) return; int lstindex = classPath.lastIndexOf(File.separatorChar); if (lstindex > 0) { classPath = classPath.substring(0, lstindex); } else { classPath = "."; } File root = new File(classPath); File[] files = root.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { File file = files[i]; if (!file.isDirectory()) { if (DeploymentFileData.isModuleArchiveFile(file.getName())) { //adding modules in the class path addFileToDeploy(file, deployer, WSInfo.TYPE_MODULE); } } } } ClassLoader cl = deploymentEngine.getAxisConfig().getModuleClassLoader(); while (cl != null) { if (cl instanceof URLClassLoader) { URL[] urls = ((URLClassLoader)cl).getURLs(); for (int i = 0; (urls != null) && i < urls.length; i++) { String path = urls[i].getPath(); //If it is a drive letter, adjust accordingly. if (path.length() >= 3 && path.charAt(0) == '/' && path.charAt(2) == ':') { path = path.substring(1); } try { path = URLDecoder.decode(path, Utils.defaultEncoding); } catch (UnsupportedEncodingException e) { // Log this? } File file = new File(path.replace('/', File.separatorChar).replace('|', ':')); if (file.isFile()) { if (DeploymentFileData.isModuleArchiveFile(file.getName())) { //adding modules in the class path addFileToDeploy(file, deployer, WSInfo.TYPE_MODULE); } } } } cl = cl.getParent(); } deploymentEngine.doDeploy(); } /** * To get the location of the Axis2.jar from that I can drive the location of class path * * @return String (location of the axis2 jar) */ protected String getLocation() { try { Class clazz = Loader.loadClass("org.apache.axis2.engine.AxisEngine"); java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation(); String location = url.toString(); if (location.startsWith("jar")) { url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL(); location = url.toString(); } if (location.startsWith("file")) { File file = Utils.toFile(url); return file.getAbsolutePath(); } else { return url.toString(); } } catch (Throwable t) { return null; } } /** Finds a list of services in the folder and adds to wsInfoList. */ public void checkServices() { findServicesInDirectory(); loadOtherDirectories(); update(); } /** * First initializes the WSInfoList, then calls checkModule to load all the modules and calls * update() to update the Deployment engine and engine registry. */ public void init() { wsInfoList.init(); checkModules(); deploymentEngine.doDeploy(); } //This will load the files from the directories // specified by axis2.xml (As ) private void loadOtherDirectories() { Map directoryToExtensionMappingMap = deploymentEngine.getDirectoryToExtensionMappingMap(); if (directoryToExtensionMappingMap.size() > 0) { Iterator keys = directoryToExtensionMappingMap.keySet().iterator(); while (keys.hasNext()) { String s = (String)keys.next(); ArrayList list = (ArrayList)directoryToExtensionMappingMap.get(s); for (int i = 0; i < list.size(); i++) { String extension = (String)list.get(i); findFileForGivenDirectory(s, extension); } } } } private void findFileForGivenDirectory(String dir, String extension) { try { File directory = deploymentEngine.getRepositoryDir(); String[] strings = dir.split("/"); for (int i = 0; i < strings.length; i++) { directory = new File(directory, strings[i]); } if (directory.exists()) { File[] files = directory.listFiles(); if (files != null && files.length > 0) { for (int i = 0; i < files.length; i++) { File file = files[i]; if (isSourceControlDir(file)) { continue; } if (!file.isDirectory() && extension .equals(DeploymentFileData.getFileExtension(file.getName()))) { addFileToDeploy(file, deploymentEngine.getDeployerForExtension(extension), WSInfo.TYPE_CUSTOM); } } } } } catch (Exception e) { //need to log the exception } } /** Searches a given folder for jar files and adds them to a list in the WSInfolist class. */ protected void findServicesInDirectory() { File root = deploymentEngine.getServicesDir(); File[] files = root.listFiles(); if (files != null && files.length > 0) { for (int i = 0; i < files.length; i++) { File file = files[i]; if (isSourceControlDir(file)) { continue; } if (!file.isDirectory()) { if (DeploymentFileData.isServiceArchiveFile(file.getName())) { addFileToDeploy(file, deploymentEngine.getServiceDeployer(), WSInfo.TYPE_SERVICE); } else { String ext = DeploymentFileData.getFileExtension(file.getName()); Deployer deployer = deploymentEngine.getDeployerForExtension(ext); // If we found a deployer for this type of file, use it. Otherwise // ignore the file. if (deployer != null) { addFileToDeploy(file, deployer, WSInfo.TYPE_SERVICE); } } } else { if (!"lib".equalsIgnoreCase(file.getName())) { addFileToDeploy(file, deploymentEngine.getServiceDeployer(), WSInfo.TYPE_SERVICE); } } } } } /** Method invoked from the scheduler to start the listener. */ public void startListener() { checkServices(); // update(); } /** Updates WSInfoList object. */ public void update() { wsInfoList.update(); } public void updateRemote() throws Exception { findServicesInDirectory(); update(); } public void addFileToDeploy(File file, Deployer deployer, int type) { wsInfoList.addWSInfoItem(file, deployer, type); } } ./src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java0000664000175000017500000001047511767656530023675 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisConfigurator; import org.apache.axis2.util.Loader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; public class URLBasedAxisConfigurator extends DeploymentEngine implements AxisConfigurator { private static final Log log = LogFactory.getLog(URLBasedAxisConfigurator.class); private URL axis2xml; private URL repository; public URLBasedAxisConfigurator(URL axis2xml, URL repository) throws AxisFault { this.axis2xml = axis2xml; this.repository = repository; } public AxisConfiguration getAxisConfiguration() throws AxisFault { InputStream axis2xmlStream; try { if (axis2xml == null) { axis2xmlStream = Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE); } else { axis2xmlStream = axis2xml.openStream(); } axisConfig = populateAxisConfiguration(axis2xmlStream); if (repository == null) { Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO); if (axis2repoPara != null) { String repoValue = (String) axis2repoPara.getValue(); if (repoValue != null && !"".equals(repoValue.trim())) { if (repoValue.startsWith("file:/")) { // we treat this case specially , by assuming file is // located in the local machine loadRepository(repoValue); } else { loadRepositoryFromURL(new URL(repoValue)); } } } else { log.info("No repository found , module will be loaded from classpath"); loadFromClassPath(); } } else { loadRepositoryFromURL(repository); } } catch (IOException e) { throw new AxisFault(e.getMessage()); } axisConfig.setConfigurator(this); return axisConfig; } //to load services public void loadServices() { try { if (repository == null) { Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO); if (axis2repoPara != null) { String repoValue = (String) axis2repoPara.getValue(); if (repoValue != null && !"".equals(repoValue.trim())) { if (repoValue.startsWith("file://")) { // we treat this case specially , by assuming file is // locate in the local machine super.loadServices(); } else { loadServicesFromUrl(new URL(repoValue)); } } } } else { loadServicesFromUrl(repository); } } catch (MalformedURLException e) { log.info(e); } } //To engage globally listed modules public void engageGlobalModules() throws AxisFault { engageModules(); } } ./src/org/apache/axis2/deployment/axis2_default.xml0000664000175000017500000003470711767656530021501 0ustar brianbrian true false false false true false admin axis2 false 6060 HTTP/1.1 chunked HTTP/1.1 chunked ./src/org/apache/axis2/deployment/ServiceDeployer.java0000664000175000017500000001754511767656530022175 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.repository.util.ArchiveReader; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; public class ServiceDeployer implements Deployer { private static final Log log = LogFactory.getLog(ServiceDeployer.class); private AxisConfiguration axisConfig; private ConfigurationContext configCtx; //To initialize the deployer public void init(ConfigurationContext configCtx) { this.configCtx = configCtx; this.axisConfig = this.configCtx.getAxisConfiguration(); } //Will process the file and add that to axisConfig public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException { boolean isDirectory = deploymentFileData.getFile().isDirectory(); ArchiveReader archiveReader; StringWriter errorWriter = new StringWriter(); archiveReader = new ArchiveReader(); String serviceStatus = ""; try { deploymentFileData.setClassLoader(isDirectory, axisConfig.getServiceClassLoader(), (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); HashMap wsdlservice = archiveReader.processWSDLs(deploymentFileData); if (wsdlservice != null && wsdlservice.size() > 0) { Iterator services = wsdlservice.values().iterator(); while (services.hasNext()) { AxisService service = (AxisService) services.next(); Iterator operations = service.getOperations(); while (operations.hasNext()) { AxisOperation axisOperation = (AxisOperation) operations.next(); axisConfig.getPhasesInfo().setOperationPhases(axisOperation); } } } AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig); serviceGroup.setServiceGroupClassLoader(deploymentFileData.getClassLoader()); ArrayList serviceList = archiveReader.processServiceGroup( deploymentFileData.getAbsolutePath(), deploymentFileData, serviceGroup, isDirectory, wsdlservice, configCtx); URL location = deploymentFileData.getFile().toURL(); DeploymentEngine.addServiceGroup(serviceGroup, serviceList, location, deploymentFileData, axisConfig); log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS, deploymentFileData.getName(), location.toString())); } catch (DeploymentException de) { de.printStackTrace(); log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE, deploymentFileData.getName(), de.getMessage()), de); PrintWriter error_ptintWriter = new PrintWriter(errorWriter); de.printStackTrace(error_ptintWriter); serviceStatus = "Error:\n" + errorWriter.toString(); throw de; } catch (AxisFault axisFault) { log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE, deploymentFileData.getName(), axisFault.getMessage()), axisFault); PrintWriter error_ptintWriter = new PrintWriter(errorWriter); axisFault.printStackTrace(error_ptintWriter); serviceStatus = "Error:\n" + errorWriter.toString(); throw new DeploymentException(axisFault); } catch (Exception e) { if (log.isInfoEnabled()) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); log.info(Messages.getMessage( DeploymentErrorMsgs.INVALID_SERVICE, deploymentFileData.getName(), sw.getBuffer().toString())); } PrintWriter error_ptintWriter = new PrintWriter(errorWriter); e.printStackTrace(error_ptintWriter); serviceStatus = "Error:\n" + errorWriter.toString(); throw new DeploymentException(e); } catch (Throwable t) { if (log.isInfoEnabled()) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); log.info(Messages.getMessage( DeploymentErrorMsgs.INVALID_SERVICE, deploymentFileData.getName(), sw.getBuffer().toString())); } PrintWriter error_ptintWriter = new PrintWriter(errorWriter); t.printStackTrace(error_ptintWriter); serviceStatus = "Error:\n" + errorWriter.toString(); throw new DeploymentException(new Exception(t)); } finally { if (serviceStatus.startsWith("Error:")) { axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(), serviceStatus); } } } public void setDirectory(String directory) { } public void setExtension(String extension) { } public void unDeploy(String fileName) throws DeploymentException { try { fileName = Utils.getShortFileName(fileName); fileName = DeploymentEngine.getAxisServiceName(fileName); AxisServiceGroup serviceGroup = axisConfig.removeServiceGroup(fileName); if (serviceGroup != null) { configCtx.removeServiceGroupContext(serviceGroup); log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED, fileName)); } else { axisConfig.removeFaultyService(fileName); } } catch (AxisFault axisFault) { //May be a faulty service axisConfig.removeFaultyService(fileName); throw new DeploymentException(axisFault); } } } ./src/org/apache/axis2/deployment/ModuleBuilder.java0000664000175000017500000003602711767656530021621 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisOperationFactory; import org.apache.axis2.description.InOnlyAxisOperation; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.Deployable; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.modules.Module; import org.apache.axis2.phaseresolver.PhaseMetadata; import org.apache.axis2.util.Loader; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.InputStream; import java.io.StringWriter; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Iterator; /** * Builds a module description from OM */ public class ModuleBuilder extends DescriptionBuilder { private AxisModule module; public ModuleBuilder(InputStream serviceInputStream, AxisModule module, AxisConfiguration axisConfig) { super(serviceInputStream, axisConfig); this.module = module; } private void loadModuleClass(AxisModule module, String moduleClassName) throws DeploymentException { Class moduleClass; try { if ((moduleClassName != null) && !"".equals(moduleClassName)) { moduleClass = Loader.loadClass(module.getModuleClassLoader(), moduleClassName); final Class fmoduleClass = moduleClass; final AxisModule fmodule = module; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IllegalAccessException, InstantiationException { Module new_module = (Module) fmoduleClass.newInstance(); fmodule.setModule(new_module); return null; } }); } catch (PrivilegedActionException e) { throw e.getException(); } } } catch (Exception e) { throw new DeploymentException(e.getMessage(), e); } } public void populateModule() throws DeploymentException { try { OMElement moduleElement = buildOM(); // Setting Module Class , if it is there OMAttribute moduleClassAtt = moduleElement.getAttribute(new QName(TAG_CLASS_NAME)); // processing Parameters // Processing service level parameters Iterator itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, module, module.getParent()); if (moduleClassAtt != null) { String moduleClass = moduleClassAtt.getAttributeValue(); if ((moduleClass != null) && !"".equals(moduleClass)) { loadModuleClass(module, moduleClass); } } // Get our name and version. If this is NOT present, we'll try to figure it out // from the file name (e.g. "addressing-1.0.mar"). If the attribute is there, we // always respect it. //TODO: Need to check whether ths name is getting overridden by the file name of the MAR OMAttribute nameAtt = moduleElement.getAttribute(new QName("name")); if (nameAtt != null) { String moduleName = nameAtt.getAttributeValue(); if (moduleName != null && !"".equals(moduleName)){ module.setName(moduleName); } } // Process service description OMElement descriptionElement = moduleElement.getFirstChildWithName(new QName(TAG_DESCRIPTION)); if (descriptionElement != null) { OMElement descriptionValue = descriptionElement.getFirstElement(); if (descriptionValue != null) { StringWriter writer = new StringWriter(); descriptionValue.build(); descriptionValue.serialize(writer); writer.flush(); module.setModuleDescription(writer.toString()); } else { module.setModuleDescription(descriptionElement.getText()); } } else { module.setModuleDescription("module description not found"); } // Processing Dynamic Phase Iterator phaseItr = moduleElement.getChildrenWithName(new QName(TAG_PHASE)); processModulePhase(phaseItr); // setting the PolicyInclude // processing .. elements Iterator policyElements = moduleElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, module.getPolicySubject()); } // processing .. elements Iterator policyRefElements = moduleElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyElements.hasNext()) { processPolicyRefElements(policyRefElements, module.getPolicySubject()); } // process INFLOW OMElement inFlow = moduleElement.getFirstChildWithName(new QName(TAG_FLOW_IN)); if (inFlow != null) { module.setInFlow(processFlow(inFlow, module)); } OMElement outFlow = moduleElement.getFirstChildWithName(new QName(TAG_FLOW_OUT)); if (outFlow != null) { module.setOutFlow(processFlow(outFlow, module)); } OMElement inFaultFlow = moduleElement.getFirstChildWithName(new QName(TAG_FLOW_IN_FAULT)); if (inFaultFlow != null) { module.setFaultInFlow(processFlow(inFaultFlow, module)); } OMElement outFaultFlow = moduleElement.getFirstChildWithName(new QName(TAG_FLOW_OUT_FAULT)); if (outFaultFlow != null) { module.setFaultOutFlow(processFlow(outFaultFlow, module)); } OMElement supportedPolicyNamespaces = moduleElement.getFirstChildWithName(new QName(TAG_SUPPORTED_POLICY_NAMESPACES)); if (supportedPolicyNamespaces != null) { module.setSupportedPolicyNamespaces( processSupportedPolicyNamespaces(supportedPolicyNamespaces)); } /* * Module description should contain a list of QName of the assertions that are local to the system. * These assertions are not exposed to the outside. */ OMElement localPolicyAssertionElement = moduleElement.getFirstChildWithName(new QName("local-policy-assertions")); if (localPolicyAssertionElement != null) { module.setLocalPolicyAssertions( getLocalPolicyAssertionNames(localPolicyAssertionElement)); } // processing Operations Iterator op_itr = moduleElement.getChildrenWithName(new QName(TAG_OPERATION)); ArrayList operations = processOperations(op_itr); for (int i = 0; i < operations.size(); i++) { AxisOperation operation = (AxisOperation) operations.get(i); module.addOperation(operation); } } catch (XMLStreamException e) { throw new DeploymentException(e); } catch(AxisFault e) { throw new DeploymentException(e); } } private ArrayList processOperations(Iterator operationsIterator) throws DeploymentException { ArrayList operations = new ArrayList(); while (operationsIterator.hasNext()) { OMElement operation = (OMElement) operationsIterator.next(); //getting operation name OMAttribute op_name_att = operation.getAttribute(new QName(ATTRIBUTE_NAME)); if (op_name_att == null) { throw new DeploymentException( Messages.getMessage( Messages.getMessage( DeploymentErrorMsgs.INVALID_OP, "operation name missing"))); } OMAttribute op_mep_att = operation.getAttribute(new QName(TAG_MEP)); String mepURL = null; AxisOperation op_descrip; if (op_mep_att != null) { mepURL = op_mep_att.getAttributeValue(); } if (mepURL == null) { // assuming in-out MEP op_descrip = new InOnlyAxisOperation(); } else { try { op_descrip = AxisOperationFactory.getOperationDescription(mepURL); } catch (AxisFault axisFault) { throw new DeploymentException( Messages.getMessage( Messages.getMessage( DeploymentErrorMsgs.OPERATION_PROCESS_ERROR, axisFault.getMessage()))); } } String opname = op_name_att.getAttributeValue(); op_descrip.setName(new QName(opname)); // Operation Parameters Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, op_descrip, module); //To process wsamapping; processActionMappings(operation, op_descrip); // setting the MEP of the operation // loading the message receivers OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER)); if (receiverElement != null) { MessageReceiver messageReceiver = loadMessageReceiver(module.getModuleClassLoader(), receiverElement); op_descrip.setMessageReceiver(messageReceiver); } else { // setting default message receiver MessageReceiver msgReceiver = loadDefaultMessageReceiver(mepURL, null); op_descrip.setMessageReceiver(msgReceiver); } // Process Module Refs Iterator modules = operation.getChildrenWithName(new QName(TAG_MODULE)); processOperationModuleRefs(modules, op_descrip); // processing .. elements Iterator policyElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, op_descrip.getPolicySubject()); } // processing .. elements Iterator policyRefElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyRefElements.hasNext()) { processPolicyRefElements(policyRefElements, module.getPolicySubject()); } // setting Operation phase PhasesInfo info = axisConfig.getPhasesInfo(); try { info.setOperationPhases(op_descrip); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } // adding the operation operations.add(op_descrip); } return operations; } /** * This will process the phase list and then added the phases specified in module.xml to * axisConfiguration. The format of a phase element will something like * * Here before and after can be null * @param phases : OMElement iterator * @throws AxisFault : If something went wrong */ private void processModulePhase(Iterator phases) throws AxisFault { if (phases == null){ return; } while (phases.hasNext()) { OMElement element = (OMElement) phases.next(); String phaseName = element.getAttributeValue(new QName(ATTRIBUTE_NAME)); Deployable d = new Deployable(phaseName); String after = element.getAttributeValue(new QName(TAG_AFTER)); if (after != null) { String [] afters = after.split(","); for (int i = 0; i < afters.length; i++) { String s = afters[i]; d.addPredecessor(s); } } String before = element.getAttributeValue(new QName(TAG_BEFORE)); if (before != null) { String [] befores = before.split(","); for (int i = 0; i < befores.length; i++) { String s = befores[i]; d.addSuccessor(s); } } String flowName = element.getAttributeValue(new QName("flow")); int flowIndex ; if (TAG_FLOW_IN.equals(flowName)){ flowIndex = PhaseMetadata.IN_FLOW ; } else if (TAG_FLOW_OUT.equals(flowName)) { flowIndex = PhaseMetadata.OUT_FLOW ; } else if (TAG_FLOW_OUT_FAULT.equals(flowName)) { flowIndex = PhaseMetadata.FAULT_OUT_FLOW; } else if (TAG_FLOW_IN_FAULT.equals(flowName)) { flowIndex = PhaseMetadata.FAULT_IN_FLOW; } else { throw new DeploymentException(" Flow can not be null for the phase name " + phaseName); } axisConfig.insertPhase(d, flowIndex); } } } ./src/org/apache/axis2/deployment/ServiceGroupBuilder.java0000664000175000017500000001521511767656530023005 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.ModuleConfiguration; import org.apache.axis2.description.ParameterInclude; import org.apache.axis2.i18n.Messages; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; public class ServiceGroupBuilder extends DescriptionBuilder { private OMElement serviceElement; private HashMap wsdlServices; public ServiceGroupBuilder(OMElement service, HashMap wsdlServices, ConfigurationContext configCtx) { this.serviceElement = service; this.wsdlServices = wsdlServices; this.configCtx = configCtx; this.axisConfig = this.configCtx.getAxisConfiguration(); } public ArrayList populateServiceGroup(AxisServiceGroup axisServiceGroup) throws DeploymentException { ArrayList serviceList = new ArrayList(); try { // Processing service level parameters Iterator itr = serviceElement.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, axisServiceGroup, axisServiceGroup.getParent()); Iterator moduleConfigs = serviceElement.getChildrenWithName(new QName(TAG_MODULE_CONFIG)); processServiceModuleConfig(moduleConfigs, axisServiceGroup.getParent(), axisServiceGroup); // processing service-wide modules which required to engage globally Iterator moduleRefs = serviceElement.getChildrenWithName(new QName(TAG_MODULE)); processModuleRefs(moduleRefs, axisServiceGroup); Iterator serviceitr = serviceElement.getChildrenWithName(new QName(TAG_SERVICE)); while (serviceitr.hasNext()) { OMElement service = (OMElement) serviceitr.next(); OMAttribute serviceNameatt = service.getAttribute(new QName(ATTRIBUTE_NAME)); if (serviceNameatt == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.SERVICE_NAME_ERROR)); } String serviceName = serviceNameatt.getAttributeValue(); if (serviceName == null || "".equals(serviceName)) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.SERVICE_NAME_ERROR)); } else { AxisService axisService = (AxisService) wsdlServices.get(serviceName); if (axisService == null) { axisService = new AxisService(serviceName); } else { axisService.setWsdlFound(true); axisService.setCustomWsdl(true); } // the service that has to be deployed axisService.setParent(axisServiceGroup); axisService.setClassLoader(axisServiceGroup.getServiceGroupClassLoader()); ServiceBuilder serviceBuilder = new ServiceBuilder(configCtx, axisService); AxisService as = serviceBuilder.populateService(service); serviceList.add(as); } } } catch (AxisFault e) { throw new DeploymentException(e); } return serviceList; } /** * Gets the list of modules that is required to be engaged globally. * * @param moduleRefs java.util.Iterator * @throws DeploymentException DeploymentException */ protected void processModuleRefs(Iterator moduleRefs, AxisServiceGroup axisServiceGroup) throws DeploymentException { try { while (moduleRefs.hasNext()) { OMElement moduleref = (OMElement) moduleRefs.next(); OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE)); if (moduleRefAttribute != null) { String refName = moduleRefAttribute.getAttributeValue(); if (axisConfig.getModule(refName) == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, refName)); } else { axisServiceGroup.addModuleref(refName); } } } } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } protected void processServiceModuleConfig(Iterator moduleConfigs, ParameterInclude parent, AxisServiceGroup axisService) throws DeploymentException { while (moduleConfigs.hasNext()) { OMElement moduleConfig = (OMElement) moduleConfigs.next(); OMAttribute moduleName_att = moduleConfig.getAttribute(new QName(ATTRIBUTE_NAME)); if (moduleName_att == null) { throw new DeploymentException( Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG)); } else { String module = moduleName_att.getAttributeValue(); ModuleConfiguration moduleConfiguration = new ModuleConfiguration(module, parent); Iterator parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, moduleConfiguration, parent); axisService.addModuleConfig(moduleConfiguration); } } } } ./src/org/apache/axis2/deployment/scheduler/0000775000175000017500000000000011767656530020170 5ustar brianbrian./src/org/apache/axis2/deployment/scheduler/DeploymentIterator.java0000664000175000017500000000212211767656530024662 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.scheduler; import java.util.Calendar; import java.util.Date; public class DeploymentIterator { private Calendar calendar = Calendar.getInstance(); public Date next() { calendar.add(Calendar.SECOND, 10); return calendar.getTime(); } } ./src/org/apache/axis2/deployment/scheduler/SchedulerTask.java0000664000175000017500000000401411767656530023573 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.scheduler; import org.apache.axis2.deployment.RepositoryListener; import java.util.TimerTask; public class SchedulerTask implements Runnable { static final int SCHEDULED = 1; static final int CANCELLED = 2; final Object lock = new Object(); int state = 0; TimerTask timerTask; private RepositoryListener wsListener; /** * Creates a new scheduler task. */ public SchedulerTask(RepositoryListener listener) { this.wsListener = listener; } /** * Cancels this scheduler task. *

        * This method may be called repeatedly; the second and subsequent calls have no effect. * * @return Returns true if this task was already scheduled to run. */ public boolean cancel() { synchronized (lock) { if (timerTask != null) { timerTask.cancel(); } boolean result = (state == SCHEDULED); state = CANCELLED; return result; } } private void checkRepository() { wsListener.startListener(); } /** * The action to be performed by this scheduler task. */ public void run() { checkRepository(); } } ./src/org/apache/axis2/deployment/scheduler/Scheduler.java0000664000175000017500000000602411767656530022753 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.scheduler; import java.util.Date; import java.util.Timer; import java.util.TimerTask; public class Scheduler { private final Timer timer = new Timer(true); private void reschedule(SchedulerTask schedulerTask, DeploymentIterator iterator) { Date time = iterator.next(); if (time == null) { schedulerTask.cancel(); } else { synchronized (schedulerTask.lock) { if (schedulerTask.state != SchedulerTask.CANCELLED) { schedulerTask.timerTask = new SchedulerTimerTask(schedulerTask, iterator); timer.schedule(schedulerTask.timerTask, time); } } } } /** * Schedules the specified task for execution according to the specified schedule. * If times specified by the ScheduleIterator are in the past they are * scheduled for immediate execution. * * @param schedulerTask task to be scheduled * @param iterator iterator that describes the schedule * @throws IllegalStateException if task was already scheduled or cancelled, * scheduler was cancelled, or scheduler thread terminated. */ public void schedule(SchedulerTask schedulerTask, DeploymentIterator iterator) { Date time = iterator.next(); if (time == null) { schedulerTask.cancel(); } else { synchronized (schedulerTask.lock) { schedulerTask.state = SchedulerTask.SCHEDULED; schedulerTask.timerTask = new SchedulerTimerTask(schedulerTask, iterator); timer.schedule(schedulerTask.timerTask, time); } } } public void cleanup(){ timer.cancel(); } public class SchedulerTimerTask extends TimerTask { private DeploymentIterator iterator; private SchedulerTask schedulerTask; public SchedulerTimerTask(SchedulerTask schedulerTask, DeploymentIterator iterator) { this.schedulerTask = schedulerTask; this.iterator = iterator; } public void run() { schedulerTask.run(); reschedule(schedulerTask, iterator); } } } ./src/org/apache/axis2/deployment/ModuleDeployer.java0000664000175000017500000001327511767656530022016 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.repository.util.ArchiveReader; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.apache.axis2.description.AxisModule; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; public class ModuleDeployer implements Deployer { private static final Log log = LogFactory.getLog(ModuleDeployer.class); private AxisConfiguration axisConfig; public ModuleDeployer() { } public ModuleDeployer(AxisConfiguration axisConfig) { this.axisConfig = axisConfig; } //To initialize the deployer public void init(ConfigurationContext configCtx) { this.axisConfig = configCtx.getAxisConfiguration(); } //Will process the file and add that to axisConfig public void deploy(DeploymentFileData deploymentFileData) { ArchiveReader archiveReader = new ArchiveReader(); String moduleStatus = ""; StringWriter errorWriter = new StringWriter(); boolean isDirectory = deploymentFileData.getFile().isDirectory(); try { deploymentFileData.setClassLoader(isDirectory, axisConfig.getModuleClassLoader(), (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); AxisModule metaData = new AxisModule(); metaData.setModuleClassLoader(deploymentFileData.getClassLoader()); metaData.setParent(axisConfig); archiveReader.readModuleArchive(deploymentFileData, metaData, isDirectory, axisConfig); URL url = deploymentFileData.getFile().toURL(); metaData.setFileName(url); DeploymentEngine.addNewModule(metaData, axisConfig); log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE, Utils.getModuleName(metaData.getName(), metaData.getVersion()), url.toString())); } catch (DeploymentException e) { log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE, deploymentFileData.getName(), e.getMessage()), e); PrintWriter error_ptintWriter = new PrintWriter(errorWriter); e.printStackTrace(error_ptintWriter); moduleStatus = "Error:\n" + errorWriter.toString(); } catch (AxisFault axisFault) { log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE, deploymentFileData.getName(), axisFault.getMessage()), axisFault); PrintWriter error_ptintWriter = new PrintWriter(errorWriter); axisFault.printStackTrace(error_ptintWriter); moduleStatus = "Error:\n" + errorWriter.toString(); } catch (MalformedURLException e) { log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE, deploymentFileData.getName(), e.getMessage()), e); PrintWriter error_ptintWriter = new PrintWriter(errorWriter); e.printStackTrace(error_ptintWriter); moduleStatus = "Error:\n" + errorWriter.toString(); } catch (Throwable t) { if (log.isInfoEnabled()) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE, deploymentFileData.getName(), t.getMessage()), t); } PrintWriter error_ptintWriter = new PrintWriter(errorWriter); t.printStackTrace(error_ptintWriter); moduleStatus = "Error:\n" + errorWriter.toString(); } finally { if (moduleStatus.startsWith("Error:")) { axisConfig.getFaultyModules().put(DeploymentEngine.getAxisServiceName( deploymentFileData.getName()), moduleStatus); } } } public void setDirectory(String directory) { } public void setExtension(String extension) { } public void unDeploy(String fileName) { } } ./src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java0000664000175000017500000003760611767656530023771 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.repository.util.ArchiveReader; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.AxisConfigurator; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.Loader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.ServletConfig; import javax.xml.stream.XMLStreamException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; /** * Processes the init parameters for the AxisServlet. * This allows the location of the axis2.xml and the module repository to be different from the default locations. * The init parameters support alternate file, or URL values for both of these. */ public class WarBasedAxisConfigurator extends DeploymentEngine implements AxisConfigurator { private static final Log log = LogFactory.getLog(WarBasedAxisConfigurator.class); private ServletConfig config; /** * The name of the init parameter (axis2.xml.path) that can be used to override the default location for the axis2.xml file. When both this init parameter, and the axis2.xml.url init parameters are not specified in the axis servlet init-parameter, the default location of ${app}/WEB-INF/conf/axis2.xml is used. * The value of this path is interpreted as a file system absolute path. * This parameter takes precedence over the axis2.xml.url init parameter. */ public static final String PARAM_AXIS2_XML_PATH = "axis2.xml.path"; /** * The name of the init parameter (axis2.xml.url) that when specified indicates the axis2.xml should be loaded using the URL specified as the value of this init parameter. If the axis2.xml.path init parameter is present, this init parameter has no effect. */ public static final String PARAM_AXIS2_XML_URL = "axis2.xml.url"; /** * The name of the init parameter (axis2.repository.path) that when specified indicates the path to the */ public static final String PARAM_AXIS2_REPOSITORY_PATH = "axis2.repository.path"; /** * The name of the init parameter (axis2.repository.url) that when specified indicates the url to be used */ public static final String PARAM_AXIS2_REPOSITORY_URL = "axis2.repository.url"; /** * Default constructor for configurator. * This determines the axis2.xml file to be used from the init parameters for the AxisServlet in the web.xml. * The order of initialization is according the the following precedence: *

          *
        • If the parameter axis2.xml.path is present, the value is webapp relative path to be used as the location to the axis2.xml file. *
        • Otherwise, if the parameter axis2.xml.url is present, the URL is used as the location to the axis2.xml file. *
        • Otherwise, when both of the above init parameters are not present, file is attempted to be loaded from <repo>/WEB-INF/axis2.xml. *
        • When none of the above could be found, the axis2.xml is loaded from the classpath resource, the value of DeploymenConstants.AXIS2_CONFIGURATION_RESOURCE. *
        * * @param servletConfig the ServletConfig object from the AxisServlet. This method is called from the init() of the AxisServlet. */ public WarBasedAxisConfigurator(ServletConfig servletConfig) throws DeploymentException { try { this.config = servletConfig; InputStream axis2Stream = null; try { // when the module is an unpacked war file, // we can set the web location path in the deployment engine. // This will let us String webpath = config.getServletContext().getRealPath(""); if (webpath == null || webpath.length() == 0) { webpath = config.getServletContext().getRealPath("/"); } if (webpath != null && !"".equals(webpath)) { log.debug("setting web location string: " + webpath); File weblocation = new File(webpath); setWebLocationString(weblocation.getAbsolutePath()); } // if webpath not null String axis2xmlpath = config.getInitParameter(PARAM_AXIS2_XML_PATH); if (axis2xmlpath != null) { // when init parameter was present. axis2Stream = new FileInputStream(axis2xmlpath); log.debug("using axis2.xml from path: " + axis2xmlpath); } if (axis2Stream == null) { String axisurl = config.getInitParameter(PARAM_AXIS2_XML_URL); if (axisurl != null) { axis2Stream = new URL(axisurl).openStream(); axisConfig = populateAxisConfiguration(axis2Stream); log.debug("loading axis2.xml from URL: " + axisurl); } } if (axis2Stream == null) { // both the axis2.xml.path and axis2.xml.url init parameters were not present // try to find the default /WEB-INF/conf/axis2.xml axis2Stream = config.getServletContext() .getResourceAsStream("/WEB-INF/conf/axis2.xml"); log.debug("trying to load axis2.xml from module: /WEB-INF/conf/axis2.xml"); } if (axis2Stream == null) { // Simple deployment, no need for conf directory either axis2Stream = config.getServletContext() .getResourceAsStream("/WEB-INF/axis2.xml"); log.debug("trying to load axis2.xml from module: /WEB-INF/conf/axis2.xml"); } } // try catch (Exception e) { log.error(e, e); log.warn("Using default configuration: " + DeploymentConstants .AXIS2_CONFIGURATION_RESOURCE); // not there, use default configuration from class path resource. } // catch if (axis2Stream == null) { log.info("Could not find axis2.xml, loading default " + DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE + " from classpath"); axis2Stream = Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE); } axisConfig = populateAxisConfiguration(axis2Stream); if(axis2Stream != null){ axis2Stream.close(); } Parameter param = new Parameter(); param.setName(Constants.Configuration.ARTIFACTS_TEMP_DIR); File f = new File((File) config.getServletContext().getAttribute("javax.servlet.context.tempdir"), "_axis2"); if (f.exists() || f.mkdirs()) { param.setValue(f); } else { f = new File(System.getProperty("java.io.tmpdir"), "_axis2"); if (f.exists() || f.mkdirs()) { param.setValue(f); } else { throw new DeploymentException("Unable to create a temporary working directory"); } } try { axisConfig.addParameter(param); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } } catch (DeploymentException e) { log.error(e.getMessage(), e); throw e; } catch (IOException e) { log.error(e.getMessage(), e); } } /** * Gets the axis configuration object by loading the repository. * The order of initialization is according the the following precedence: *
          *
        • If the parameter axis2.repository.path is present, this folder is used as the location to the repository. *
        • Otherwise, if the parameter axis2.repository.url is present, the URL is used as the location to the repository. *
        • Otherwise, when both of the above init parameters are not present, the web applications WEB-INF folder is used as the folder for the repository. *
        * * @return the instance of the AxisConfiguration object that reflects the repository according to the rules above. * @throws AxisFault when an error occurred in the initialization of the AxisConfiguration. */ public AxisConfiguration getAxisConfiguration() throws AxisFault { try { String repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH); if (repository != null) { loadRepository(repository); log.debug("loaded repository from path: " + repository); } if (repository == null) { repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL); if (repository != null) { loadRepositoryFromURL(new URL(repository)); log.debug("loaded repository from url: " + repository); } } if (repository == null) { if (config.getServletContext().getRealPath("") != null) { // this is an unpacked war file repository = config.getServletContext().getRealPath("/WEB-INF"); } if (repository == null) { if (config.getServletContext().getRealPath("/") != null) { // this is an unpacked war file repository = config.getServletContext().getRealPath("/WEB-INF"); } } if (repository != null) { loadRepository(repository); log.debug("loaded repository from /WEB-INF folder (unpacked war)"); } } if (repository == null) { URL url = config.getServletContext().getResource("/WEB-INF/"); if (url != null) { repository = url.toString(); loadRepositoryFromURL(url); log.debug("loaded repository from /WEB-INF/ folder (URL)"); } } if (repository == null) { loadFromClassPath(); log.debug("loaded repository from classpath"); } } catch (Exception ex) { log.error(ex + ": loading repository from classpath", ex); loadFromClassPath(); } axisConfig.setConfigurator(this); return axisConfig; } //to load services /** * Loads the services within the repository. * When the axis2.repository.path init parameter was present, we just call loadServices() in the deployment engine.
        * When the axis2.repository.url init parameter was present we load services from the respective URL value of the init parameter.
        * Otherwise, try to load the services from the /WEB-INF folder within the web application. */ public void loadServices() { try { String repository; repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH); if (repository != null) { super.loadServices(); log.debug("loaded services from path: " + repository); return; } repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL); if (repository != null) { loadServicesFromUrl(new URL(repository)); log.debug("loaded services from URL: " + repository); return; } loadServicesFromWebInf(); if (config.getServletContext().getRealPath("") != null || config.getServletContext().getRealPath("/") != null) { super.loadServices(); log.debug("loaded services from webapp"); return; } URL url = config.getServletContext().getResource("/WEB-INF/"); if (url != null) { loadServicesFromUrl(url); log.debug("loaded services from /WEB-INF/ folder (URL)"); } } catch (MalformedURLException e) { log.info(e.getMessage()); } } //To engage globally listed modules public void engageGlobalModules() throws AxisFault { engageModules(); } /** * This method will look inside the web-inf directory to find services.xml * inside that , if it is there will load that and creat service group out * of that and add into axisConfig. User can drop corresponding class files * into class directory. */ private void loadServicesFromWebInf() { try { InputStream servicexml = config.getServletContext(). getResourceAsStream("/WEB-INF/services.xml"); if (servicexml != null) { HashMap wsdlServices = new HashMap(); ArchiveReader archiveReader = new ArchiveReader(); String path = config.getServletContext().getRealPath("/WEB-INF"); if (path != null) { archiveReader.processFilesInFolder(new File(path), wsdlServices); } AxisServiceGroup serviceGroup = DeploymentEngine.buildServiceGroup(servicexml, Thread.currentThread().getContextClassLoader(), "annonServiceGroup", configContext, archiveReader, wsdlServices); axisConfig.addServiceGroup(serviceGroup); } } catch (AxisFault axisFault) { log.info(axisFault); } catch (FileNotFoundException e) { log.info(e); } catch (XMLStreamException e) { log.info(e); } } public void setConfigContext(ConfigurationContext configContext) { // setting ServletContext into configctx configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, config.getServletContext()); Parameter servletConfigParam = new Parameter(); servletConfigParam.setName(HTTPConstants.HTTP_SERVLETCONFIG); servletConfigParam.setValue(config); try { configContext.getAxisConfiguration().addParameter(servletConfigParam); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } super.setConfigContext(configContext); } } ./src/org/apache/axis2/deployment/DeploymentConstants.java0000664000175000017500000001501311767656530023072 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.Constants; /** * Constants used during service/module deployment. */ public interface DeploymentConstants { public static String META_INF = "META-INF"; public static String SERVICES_XML = "META-INF/services.xml"; public static String MODULE_XML = "META-INF/module.xml"; public static String SERVICE_PATH = "services"; public static String SERVICE_DIR_PATH = "ServicesDirectory"; public static String MODULE_PATH = "modules"; public static String MODULE_DRI_PATH = "ModulesDirectory"; String TAG_AXISCONFIG = "axisconfig"; String TAG_PHASE_ORDER = "phaseOrder"; String TAG_PARAMETER = "parameter"; String TAG_MAPPING = "mapping"; String TAG_PACKAGE_NAME = "packageName"; String TAG_QNAME = "qName"; String TAG_PACKAGE2QNAME = "packageMapping"; String TAG_MODULE = "module"; String TAG_MODULE_CONFIG = "moduleConfig"; String TAG_MESSAGE = "message"; String TAG_LISTENER = "listener"; String TAG_LABEL = "label"; String TAG_HANDLER = "handler"; String TAG_TYPE = "type"; String TAG_TARGET_RESOLVERS = "targetResolvers"; String TAG_TARGET_RESOLVER = "targetResolver"; String TAG_THREAD_CONTEXT_MIGRATORS = "threadContextMigrators"; String TAG_THREAD_CONTEXT_MIGRATOR = "threadContextMigrator"; String TAG_TRANSPORT_SENDER = "transportSender"; String TAG_TRANSPORT_RECEIVER = "transportReceiver"; String TAG_SERVICE_GROUP = "serviceGroup"; String TAG_SERVICE = "service"; String TAG_REFERENCE = "ref"; String TAG_PHASE_LAST = "phaseLast"; String TAG_PHASE_FIRST = "phaseFirst"; String TAG_ORDER = "order"; // to resolve the order tag String TAG_OPERATION = "operation"; // operation start tag String TAG_PHASE = "phase"; // operation start tag String TAG_OBJECT_SUPPLIER = "ObjectSupplier"; // operation start tag String TAG_EXCLUDE_OPERATIONS = "excludeOperations"; String TAG_MESSAGE_RECEIVER = "messageReceiver"; String TAG_MESSAGE_RECEIVERS = "messageReceivers"; String TAG_TRANSPORTS = "transports"; String TAG_TRANSPORT = "transport"; String TAG_MEP = "mep"; String TAG_DEFAULT_MODULE_VERSION = "defaultModuleVersions"; String TAG_CLUSTER = "cluster"; String TAG_MESSAGE_BUILDERS = "messageBuilders"; //used to add pluggable support for diffrent wire formats String TAG_MESSAGE_BUILDER = "messageBuilder"; String TAG_CONTENT_TYPE = "contentType"; String TAG_MESSAGE_FORMATTERS = "messageFormatters"; //used to add pluggable support for diffrent wire formats String TAG_MESSAGE_FORMATTER = "messageFormatter"; String TAG_FLOW_IN = "InFlow"; // inflow start tag String TAG_FLOW_OUT = "OutFlow"; // outflow start tag String TAG_FLOW_OUT_FAULT = "OutFaultFlow"; // faultflow start tag String TAG_FLOW_IN_FAULT = "InFaultFlow"; // faultflow start tag String TAG_HOT_UPDATE = "hotupdate"; String TAG_ANTI_JAR_LOCKING = "antiJARLocking"; String TAG_HOT_DEPLOYMENT = "hotdeployment"; String TAG_EXPOSE = "expose"; String TAG_EXTRACT_SERVICE_ARCHIVE = "extractServiceArchive"; String TAG_DISPATCH_ORDER = "dispatchOrder"; String TAG_DISPATCHER = "dispatcher"; String TAG_DESCRIPTION = "Description"; String TAG_CLASS_NAME = "class"; String TAG_LIST_ID = "listId"; String TAG_EXCLUDE_PROPERTIES= "excludeProperties"; String TAG_INCLUDE_PROPERTIES= "includeProperties"; String TAG_AFTER = "after"; String TAG_BEFORE = "before"; String TAG_SUPPORTED_POLICY_NAMESPACES = "supported-policy-namespaces"; String TAG_NAMESPACES = "namespaces"; //ClusterBuilder String TAG_CONFIGURATION_MANAGER = "configurationManager"; String TAG_CONTEXT_MANAGER = "contextManager"; String TAG_REPLICATION = "replication"; String TAG_DEFAULTS = "defaults"; String TAG_CONTEXT = "context"; String TAG_EXCLUDE = "exclude"; String ATTRIBUTE_CLASS = "class"; //Deployer related cons String DIRECTORY = "directory"; String EXTENSION = "extension"; String DEPLOYER = "deployer"; //Attachments LifecycleManager String ATTACHMENTS_LIFECYCLE_MANAGER = "attachmentsLifecycleManager"; // for parameters String ATTRIBUTE_NAME = "name"; String ATTRIBUTE_WSADDRESSING = "wsaddressing"; String TARGET_NAME_SPACE = "targetNamespace"; String SCHEMA_NAME_SPACE = "schemaNamespace"; String SCHEMA_ELEMENT_QUALIFIED = "elementFormDefaultQualified"; String SCHEMA = "schema"; String MAPPING = "mapping"; String ATTRIBUTE_NAMESPACE = "namespace"; String ATTRIBUTE_PACKAGE = "package"; String ATTRIBUTE_DEFAULT_VERSION = "version"; String ATTRIBUTE_SCOPE = "scope"; String ATTRIBUTE_LOCKED = "locked"; // Whether to activate a deployed service. String ATTRIBUTE_ACTIVATE = "activate"; String PROPERTY_TEMP_DIR = "java.io.tmpdir"; String DIRECTORY_CONF = "conf"; String DIRECTORY_AXIS2_HOME = ".axis2"; String RESOURCE_MODULES = "modules/"; String SUFFIX_MAR = ".mar"; String SUFFIX_JAR = ".jar"; String SUFFIX_WSDL = ".wsdl"; /** * Resource that contains the configuration. */ String AXIS2_CONFIGURATION_RESOURCE = "org/apache/axis2/deployment/axis2_default.xml"; String AXIS2_REPO = "repository"; String AXIS2_CONFIGURATION_XML = "axis2.xml"; String BOOLEAN_TRUE = "true"; String BOOLEAN_FALSE = "false"; char SEPARATOR_DOT = '.'; char SEPARATOR_COLON = ':'; String POLICY_NS_URI = Constants.URI_POLICY; String TAG_POLICY = "Policy"; String TAG_POLICY_REF = "PolicyReference"; String TAG_POLICY_ATTACHMENT = "PolicyAttachment"; String TAG_APPLIES_TO = "AppliesTo"; } ./src/org/apache/axis2/deployment/DescriptionBuilder.java0000664000175000017500000006767511767656530022674 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.builder.Builder; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Flow; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.ParameterInclude; import org.apache.axis2.description.PhaseRule; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.description.PolicySubject; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.MessageFormatter; import org.apache.axis2.util.Loader; import org.apache.axis2.util.XMLUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Policy; import org.apache.neethi.PolicyEngine; import org.apache.neethi.PolicyReference; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.InputStream; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; /** * This class does the common tasks for all *Builder class. */ public class DescriptionBuilder implements DeploymentConstants { private static final Log log = LogFactory.getLog(DescriptionBuilder.class); protected ConfigurationContext configCtx; protected AxisConfiguration axisConfig; protected InputStream descriptionStream; public DescriptionBuilder() { } public DescriptionBuilder(InputStream serviceInputStream, ConfigurationContext configCtx) { this.configCtx = configCtx; this.descriptionStream = serviceInputStream; this.axisConfig = this.configCtx.getAxisConfiguration(); } public DescriptionBuilder(InputStream serviceInputStream, AxisConfiguration axisConfig) { this.descriptionStream = serviceInputStream; this.axisConfig = axisConfig; } /** * Creates OMElement for a given description document (axis2.xml , * services.xml and module.xml). * * @return Returns OMElement . * @throws javax.xml.stream.XMLStreamException * */ public OMElement buildOM() throws XMLStreamException { OMElement element = (OMElement) XMLUtils.toOM(descriptionStream); element.build(); return element; } /** * Loads default message receivers. First searches in Axiservice for the * given mepURL, if not found searches in AxisConfiguration with the given * mepURL. * * @param mepURL : * can be null * @param service : * This can be null AxisService */ protected MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) { MessageReceiver messageReceiver; if (mepURL == null) { mepURL = WSDL2Constants.MEP_URI_IN_OUT; } if (service != null) { messageReceiver = service.getMessageReceiver(mepURL); if (messageReceiver != null) { return messageReceiver; } } return axisConfig.getMessageReceiver(mepURL); } /** * Processes default message receivers specified either in axis2.xml or * services.xml. * */ protected HashMap processMessageReceivers(OMElement messageReceivers) throws DeploymentException { HashMap mr_mep = new HashMap(); Iterator msgReceivers = messageReceivers.getChildrenWithName(new QName( TAG_MESSAGE_RECEIVER)); while (msgReceivers.hasNext()) { OMElement msgReceiver = (OMElement) msgReceivers.next(); final OMElement tempMsgReceiver = msgReceiver; MessageReceiver receiver = null; try { receiver = (MessageReceiver) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws org.apache.axis2.deployment.DeploymentException { return loadMessageReceiver( Thread.currentThread().getContextClassLoader(), tempMsgReceiver); } }); } catch (PrivilegedActionException e) { throw (DeploymentException) e.getException(); } OMAttribute mepAtt = msgReceiver.getAttribute(new QName(TAG_MEP)); mr_mep.put(mepAtt.getAttributeValue(), receiver); } return mr_mep; } /** * Processes default message receivers specified either in axis2.xml or * services.xml. * */ protected HashMap processMessageReceivers(ClassLoader loader, OMElement element) throws DeploymentException { HashMap meps = new HashMap(); Iterator iterator = element.getChildrenWithName(new QName( TAG_MESSAGE_RECEIVER)); while (iterator.hasNext()) { OMElement receiverElement = (OMElement) iterator.next(); MessageReceiver receiver = loadMessageReceiver(loader, receiverElement); OMAttribute mepAtt = receiverElement .getAttribute(new QName(TAG_MEP)); meps.put(mepAtt.getAttributeValue(), receiver); } return meps; } protected MessageReceiver loadMessageReceiver(ClassLoader loader, OMElement element) throws DeploymentException { OMAttribute receiverName = element.getAttribute(new QName( TAG_CLASS_NAME)); String className = receiverName.getAttributeValue(); MessageReceiver receiver = null; try { Class messageReceiver; if ((className != null) && !"".equals(className)) { messageReceiver = Loader.loadClass(loader, className); receiver = (MessageReceiver) messageReceiver.newInstance(); } } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "ClassNotFoundException", className), e); } catch (IllegalAccessException e) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "IllegalAccessException", className), e); } catch (InstantiationException e) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "InstantiationException", className), e); } return receiver; } /** * Processes the message builders specified in axis2.xml or services.xml. * * @param messageBuildersElement */ protected HashMap processMessageBuilders(OMElement messageBuildersElement) throws DeploymentException { HashMap builderSelector = new HashMap(); Iterator msgBuilders = messageBuildersElement .getChildrenWithName(new QName(TAG_MESSAGE_BUILDER)); while (msgBuilders.hasNext()) { OMElement msgBuilderElement = (OMElement) msgBuilders.next(); OMAttribute builderName = msgBuilderElement.getAttribute(new QName(TAG_CLASS_NAME)); String className = builderName.getAttributeValue(); Class builderClass = null; Builder builderObject; try { builderClass = findAndValidateSelectorClass(className, DeploymentErrorMsgs.ERROR_LOADING_MESSAGE_BUILDER); builderObject = (Builder) builderClass.newInstance(); } catch (PrivilegedActionException e) { throw (DeploymentException) e.getException(); } catch (InstantiationException e) { throw new DeploymentException( "Cannot instantiate the specified Builder Class : " + builderClass.getName() + ".", e); } catch (IllegalAccessException e) { throw new DeploymentException( "Cannot instantiate the specified Builder Class : " + builderClass.getName() + ".", e); } OMAttribute contentTypeAtt = msgBuilderElement .getAttribute(new QName(TAG_CONTENT_TYPE)); builderSelector.put(contentTypeAtt.getAttributeValue(), builderObject); } return builderSelector; } /** * Processes the message builders specified in axis2.xml or services.xml. */ protected HashMap processMessageFormatters(OMElement messageFormattersElement) throws DeploymentException { HashMap messageFormatters = new HashMap(); Iterator msgFormatters = messageFormattersElement .getChildrenWithName(new QName(TAG_MESSAGE_FORMATTER)); while (msgFormatters.hasNext()) { OMElement msgFormatterElement = (OMElement) msgFormatters.next(); OMElement tempMsgFormatter = msgFormatterElement; OMAttribute formatterName = tempMsgFormatter.getAttribute(new QName(TAG_CLASS_NAME)); String className = formatterName.getAttributeValue(); MessageFormatter formatterObject; Class formatterClass = null; try { formatterClass = findAndValidateSelectorClass(className, DeploymentErrorMsgs.ERROR_LOADING_MESSAGE_FORMATTER); formatterObject = (MessageFormatter) formatterClass.newInstance(); } catch (PrivilegedActionException e) { throw (DeploymentException) e.getException(); } catch (InstantiationException e) { throw new DeploymentException( "Cannot instantiate the specified Formatter Class : " + formatterClass.getName() + ".", e); } catch (IllegalAccessException e) { throw new DeploymentException( "Cannot instantiate the specified Formatter Class : " + formatterClass.getName() + ".", e); } OMAttribute contentTypeAtt = msgFormatterElement .getAttribute(new QName(TAG_CONTENT_TYPE)); messageFormatters.put(contentTypeAtt.getAttributeValue(), formatterObject); } return messageFormatters; } protected Class findAndValidateSelectorClass(final String className, final String errorMsg) throws PrivilegedActionException { return (Class) org.apache.axis2.java.security.AccessController .doPrivileged(new PrivilegedExceptionAction() { public Object run() throws org.apache.axis2.deployment.DeploymentException { Class selectorClass; try { if ((className != null) && !"".equals(className)) { selectorClass = Loader.loadClass(Thread.currentThread() .getContextClassLoader(), className); } else { throw new DeploymentException(Messages.getMessage(errorMsg, "Invalid Class Name", className)); } } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage(errorMsg, "ClassNotFoundException", className), e); } return selectorClass; } }); } /** * Processes flow elements in services.xml . * * @param flowelement OMElement * @return Returns Flow. * @throws DeploymentException DeploymentException */ protected Flow processFlow(OMElement flowelement, ParameterInclude parent) throws DeploymentException { Flow flow = new Flow(); if (flowelement == null) { return flow; } Iterator handlers = flowelement.getChildrenWithName(new QName( TAG_HANDLER)); while (handlers.hasNext()) { OMElement handlerElement = (OMElement) handlers.next(); flow.addHandler(processHandler(handlerElement, parent)); } return flow; } protected String[] processSupportedPolicyNamespaces( OMElement supportedPolicyElements) { OMAttribute namespaces = supportedPolicyElements .getAttribute(new QName(TAG_NAMESPACES)); if (namespaces != null) { String value = namespaces.getAttributeValue(); if (value.trim().length() != 0) { return value.split(" "); } } return null; } protected QName[] getLocalPolicyAssertionNames(OMElement localPolicyAssertionsElement) { Iterator iterator = localPolicyAssertionsElement.getChildElements(); if (! iterator.hasNext()) { return null; } ArrayList qnames = new ArrayList(); OMElement childElement; for (; iterator.hasNext();) { childElement = (OMElement) iterator.next(); qnames.add(childElement.getQName()); } QName[] buffer = new QName[qnames.size()]; System.arraycopy(qnames.toArray(), 0, buffer, 0, qnames.size()); return buffer; } protected HandlerDescription processHandler(OMElement handler_element, ParameterInclude parent) throws DeploymentException { return processHandler(handler_element, parent, null); } /** * Processes Handler element. * * @param handler_element OMElement * @return Returns HandlerDescription. * @throws DeploymentException DeploymentException */ protected HandlerDescription processHandler(OMElement handler_element, ParameterInclude parent, String containingPhase) throws DeploymentException { // Setting handler name OMAttribute name_attribute = handler_element.getAttribute(new QName( ATTRIBUTE_NAME)); if (name_attribute == null || name_attribute.getAttributeValue().equals("")) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.INVALID_HANDLER, "Unknown", "Name missing")); } HandlerDescription handler = new HandlerDescription(name_attribute.getAttributeValue()); // Setting handler class name OMAttribute class_attribute = handler_element.getAttribute(new QName( TAG_CLASS_NAME)); if (class_attribute == null) { throw new DeploymentException((Messages.getMessage( DeploymentErrorMsgs.INVALID_HANDLER, name_attribute.getAttributeValue(), "class name is missing"))); } else { handler.setClassName(class_attribute.getAttributeValue()); } // processing phase rules (order) OMElement order_element = handler_element .getFirstChildWithName(new QName(TAG_ORDER)); PhaseRule rules = handler.getRules(); if (order_element == null) { if (containingPhase == null) { // TODO : Include more information (which handler?) in message! throw new DeploymentException((Messages.getMessage( DeploymentErrorMsgs.INVALID_HANDLER, name_attribute.getAttributeValue(), "phase rule has not been specified"))); } rules.setPhaseName(containingPhase); } else { Iterator order_itr = order_element.getAllAttributes(); while (order_itr.hasNext()) { OMAttribute orderAttribute = (OMAttribute) order_itr.next(); String name = orderAttribute.getQName().getLocalPart(); String value = orderAttribute.getAttributeValue(); if (TAG_AFTER.equals(name)) { rules.setAfter(value); } else if (TAG_BEFORE.equals(name)) { rules.setBefore(value); } else if (TAG_PHASE.equals(name)) { rules.setPhaseName(value); } else if (TAG_PHASE_FIRST.equals(name)) { String boolval = getValue(value); if (boolval.equals(BOOLEAN_TRUE)) { rules.setPhaseFirst(true); } else if (boolval.equals(BOOLEAN_FALSE)) { rules.setPhaseFirst(false); } } else if (TAG_PHASE_LAST.equals(name)) { String boolval = getValue(value); if (boolval.equals(BOOLEAN_TRUE)) { rules.setPhaseLast(true); } else if (boolval.equals(BOOLEAN_FALSE)) { rules.setPhaseLast(false); } } } Iterator parameters = handler_element .getChildrenWithName(new QName(TAG_PARAMETER)); try { processParameters(parameters, handler, parent); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } handler.setParent(parent); return handler; } protected void processOperationModuleRefs(Iterator moduleRefs, AxisOperation operation) throws DeploymentException { try { while (moduleRefs.hasNext()) { OMElement moduleref = (OMElement) moduleRefs.next(); OMAttribute moduleRefAttribute = moduleref .getAttribute(new QName(TAG_REFERENCE)); if (moduleRefAttribute != null) { String refName = moduleRefAttribute.getAttributeValue(); if (axisConfig.getModule(refName) == null) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.MODULE_NOT_FOUND, refName)); } else { operation.addModule(refName); } } } } catch (AxisFault axisFault) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.MODULE_NOT_FOUND, axisFault .getMessage()), axisFault); } } /** * Gets the Parameter object from the OM. * * @param parameters Parameter * @param parameterInclude ParameterInclude * @param parent ParameterInclude */ protected void processParameters(Iterator parameters, ParameterInclude parameterInclude, ParameterInclude parent) throws DeploymentException { while (parameters.hasNext()) { // this is to check whether some one has locked the parmeter at the // top level OMElement parameterElement = (OMElement) parameters.next(); Parameter parameter = new Parameter(); // setting parameterElement parameter.setParameterElement(parameterElement); // setting parameter Name OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME)); if (paramName == null) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT, parameterElement.toString())); } parameter.setName(paramName.getAttributeValue()); // setting parameter Value (the child element of the parameter) OMElement paramValue = parameterElement.getFirstElement(); if (paramValue != null) { parameter.setValue(parameterElement); parameter.setParameterType(Parameter.OM_PARAMETER); } else { String paratextValue = parameterElement.getText(); parameter.setValue(paratextValue); parameter.setParameterType(Parameter.TEXT_PARAMETER); } // setting locking attribute OMAttribute paramLocked = parameterElement.getAttribute(new QName( ATTRIBUTE_LOCKED)); Parameter parentParam = null; if (parent != null) { parentParam = parent.getParameter(parameter.getName()); } if (paramLocked != null) { String lockedValue = paramLocked.getAttributeValue(); if (BOOLEAN_TRUE.equals(lockedValue)) { // if the parameter is locked at some level parameter value // replace by that if ((parent != null) && parent.isParameterLocked(parameter.getName())) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.CONFIG_NOT_FOUND, parameter .getName())); } else { parameter.setLocked(true); } } else { parameter.setLocked(false); } } try { if (parent != null) { if ((parentParam == null) || !parent.isParameterLocked(parameter.getName())) { parameterInclude.addParameter(parameter); } } else { parameterInclude.addParameter(parameter); } } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } } /** * Populate the AxisOperation with details from the actionMapping, * outputActionMapping and faultActionMapping elements from the operation * element. * * @param operation * @param op_descrip */ protected void processActionMappings(OMElement operation, AxisOperation op_descrip) { Iterator mappingIterator = operation.getChildrenWithName(new QName( Constants.ACTION_MAPPING)); ArrayList mappingList = new ArrayList(); while (mappingIterator.hasNext()) { OMElement mappingElement = (OMElement) mappingIterator.next(); String inputActionString = mappingElement.getText().trim(); if (log.isTraceEnabled()) { log.trace("Input Action Mapping found: " + inputActionString); } if (!"".equals(inputActionString)) { mappingList.add(inputActionString); } else { if (log.isTraceEnabled()) { log.trace("Zero length input action string found. Not added to mapping"); } } } op_descrip.setWsamappingList(mappingList); OMElement outputAction = operation.getFirstChildWithName(new QName( Constants.OUTPUT_ACTION_MAPPING)); if ((outputAction != null) && (outputAction.getText() != null)) { String outputActionString = outputAction.getText().trim(); if (log.isTraceEnabled()) { log.trace("Output Action Mapping found: " + outputActionString); } op_descrip.setOutputAction(outputActionString); } Iterator faultActionsIterator = operation .getChildrenWithName(new QName(Constants.FAULT_ACTION_MAPPING)); while (faultActionsIterator.hasNext()) { OMElement faultMappingElement = (OMElement) faultActionsIterator .next(); String faultActionString = faultMappingElement.getText().trim(); String faultActionName = faultMappingElement .getAttributeValue(new QName(Constants.FAULT_ACTION_NAME)); if (faultActionName != null && faultActionString != null) { if (log.isTraceEnabled()) { log.trace("Fault Action Mapping found: " + faultActionName + ", " + faultActionString); } op_descrip.addFaultAction(faultActionName, faultActionString); } } } protected void processPolicyElements(Iterator policyElements, PolicySubject policySubject) { while (policyElements.hasNext()) { Policy p = PolicyEngine .getPolicy((OMElement) policyElements.next()); policySubject.attachPolicy(p); } } protected void processPolicyRefElements(Iterator policyRefElements, PolicySubject policySubject) { while (policyRefElements.hasNext()) { PolicyReference policyReference = PolicyEngine .getPolicyReference((OMElement) policyRefElements.next()); policySubject.attachPolicyReference(policyReference); } } /** * Gets the short file name. Short file name is the name before the dot. * * @param fileName * @return Returns String. */ public static String getShortFileName(String fileName) { char seperator = SEPARATOR_DOT; String value; int index = fileName.lastIndexOf(seperator); if (index > 0) { value = fileName.substring(0, index); return value; } return fileName; } /** * Gets the value of an attribute. eg xsd:anyVal --> anyVal * * @return Returns String. */ protected String getValue(String in) { char seperator = SEPARATOR_COLON; String value; int index = in.indexOf(seperator); if (index > 0) { value = in.substring(index + 1, in.length()); return value; } return in; } } ./src/org/apache/axis2/deployment/Deployer.java0000664000175000017500000000420511767656530020641 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.repository.util.DeploymentFileData; /** * This interface is used to provide the custom deployment mechanism , where you * can write your own Deployer to process a particular type and make that to * a service or a module. */ public interface Deployer { /** * Initialize the Deployer * @param configCtx our ConfigurationContext */ void init(ConfigurationContext configCtx); /** * Process a file and add it to the configuration * @param deploymentFileData the DeploymentFileData object to deploy * @throws DeploymentException if there is a problem */ void deploy(DeploymentFileData deploymentFileData) throws DeploymentException; /** * Set the directory * @param directory directory name */ void setDirectory(String directory); /** * Set the extension to look for * TODO: Support multiple extensions? * @param extension the file extension associated with this Deployer */ void setExtension(String extension); /** * Remove a given file from the configuration * @param fileName name of item to remove * @throws DeploymentException if there is a problem */ void unDeploy(String fileName) throws DeploymentException; } ./src/org/apache/axis2/deployment/resolver/0000775000175000017500000000000011767656530020053 5ustar brianbrian./src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java0000664000175000017500000000747411767656530025176 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.resolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; import org.xml.sax.InputSource; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URI; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * A custom URI resolver that can */ public class AARFileBasedURIResolver extends DefaultURIResolver { protected static final Log log = LogFactory .getLog(AARFileBasedURIResolver.class); private File aarFile; private URI lastImportLocation; public AARFileBasedURIResolver(File aarFile) { this.aarFile = aarFile; } public InputSource resolveEntity( String targetNamespace, String schemaLocation, String baseUri) { //no issue with if (isAbsolute(schemaLocation)) { return super.resolveEntity( targetNamespace, schemaLocation, baseUri); } else { //validate if ((baseUri == null || "".equals(baseUri)) && schemaLocation.startsWith("..")) { throw new RuntimeException( "Unsupported schema location " + schemaLocation); } lastImportLocation = URI.create(baseUri).resolve(schemaLocation); ZipInputStream zin = null; try { zin = new ZipInputStream(new FileInputStream(aarFile)); ZipEntry entry; byte[] buf = new byte[1024]; int read; ByteArrayOutputStream out; String searchingStr = lastImportLocation.toString(); while ((entry = zin.getNextEntry()) != null) { String entryName = entry.getName().toLowerCase(); if (entryName.equalsIgnoreCase(searchingStr)) { out = new ByteArrayOutputStream(); while ((read = zin.read(buf)) > 0) { out.write(buf, 0, read); } ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); InputSource inputSoruce = new InputSource(in); inputSoruce.setSystemId(lastImportLocation.getPath()); inputSoruce.setPublicId(targetNamespace); return inputSoruce; } } } catch (IOException e) { throw new RuntimeException(e); } finally { try { if (zin != null) { zin.close(); } } catch (IOException e) { log.debug(e); } } } log.info("AARFileBasedURIResolver: Unable to resolve" + lastImportLocation); return null; } } ./src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java0000664000175000017500000001217511767656530024304 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.resolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.woden.WSDLException; import org.apache.woden.resolver.URIResolver; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; import org.xml.sax.InputSource; import javax.wsdl.xml.WSDLLocator; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * Custom WSDL locator to load schemas from zip archives * Need to provide the aarFile and the baseInputStream for * the base WSDL file *

        * The logic here is that we only care about the import location * all imports must be relative to the META-INF folder */ public class AARBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator, URIResolver { protected static final Log log = LogFactory .getLog(AARBasedWSDLLocator.class); private File aarFile; private InputStream baseInputStream; private URI lastImportLocation; private String baseURI; public AARBasedWSDLLocator(String baseURI, File zipFile, InputStream baseInputStream) { this.baseURI = baseURI; this.baseInputStream = baseInputStream; this.aarFile = zipFile; } public InputSource getBaseInputSource() { return new InputSource(baseInputStream); } /** * @param parentLocation * @param importLocation */ public InputSource getImportInputSource(String parentLocation, String importLocation) { lastImportLocation = URI.create(parentLocation).resolve(importLocation); if (isAbsolute(importLocation)) { return super.resolveEntity( null, importLocation, parentLocation); } else { //we don't care about the parent location ZipInputStream zin = null; try { zin = new ZipInputStream(new FileInputStream(aarFile)); ZipEntry entry; byte[] buf = new byte[1024]; int read; ByteArrayOutputStream out; String searchingStr = lastImportLocation.toString(); while ((entry = zin.getNextEntry()) != null) { String entryName = entry.getName().toLowerCase(); if (entryName.equalsIgnoreCase(searchingStr)) { out = new ByteArrayOutputStream(); while ((read = zin.read(buf)) > 0) { out.write(buf, 0, read); } ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); return new InputSource(in); } } } catch (IOException e) { throw new RuntimeException(e); } finally { try { if (zin != null) { zin.close(); } } catch (IOException e) { log.debug(e); } } } log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation); return null; } /** * As for the zip there is no point in returning * a base URI */ public String getBaseURI() { // we don't care return baseURI; } /** * returns the latest import */ public String getLatestImportURI() { //we don't care about this either return lastImportLocation.toString(); } public void close() { //TODO: FIXME: } public URI resolveURI(URI uri) throws WSDLException, IOException { lastImportLocation = URI.create(baseURI).resolve(uri); if (isAbsolute(uri.toString())) { return uri; } else { String absolutePath = aarFile.getAbsolutePath(); try { return new URI("jar:file://" + absolutePath + "!/" + lastImportLocation); } catch (URISyntaxException e) { log.debug(e); } } log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation); return null; } }./src/org/apache/axis2/deployment/resolver/WarBasedWSDLLocator.java0000664000175000017500000000720411767656530024427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.resolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.woden.WSDLException; import org.apache.woden.resolver.URIResolver; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; import org.xml.sax.InputSource; import javax.wsdl.xml.WSDLLocator; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; public class WarBasedWSDLLocator extends DefaultURIResolver implements WSDLLocator, URIResolver { protected static final Log log = LogFactory .getLog(WarBasedWSDLLocator.class); private InputStream baseInputStream; private URI lastImportLocation; private String baseURI; private ClassLoader classLoader; public WarBasedWSDLLocator(String baseURI, ClassLoader classLoader, InputStream baseInputStream) { this.baseURI = baseURI; this.baseInputStream = baseInputStream; this.classLoader = classLoader; } public InputSource getBaseInputSource() { return new InputSource(baseInputStream); } /** * @param parentLocation * @param importLocation */ public InputSource getImportInputSource(String parentLocation, String importLocation) { lastImportLocation = URI.create(parentLocation).resolve(importLocation); if (isAbsolute(importLocation)) { return super.resolveEntity( null, importLocation, parentLocation); } else { String searchingStr = lastImportLocation.toString(); return new InputSource(classLoader.getResourceAsStream(searchingStr)); } } /** * As for the zip there is no point in returning * a base URI */ public String getBaseURI() { // we don't care return baseURI; } /** * returns the latest import */ public String getLatestImportURI() { //we don't care about this either return lastImportLocation.toString(); } public void close() { //TODO: FIXME: } public URI resolveURI(URI uri) throws WSDLException, IOException { if (isAbsolute(uri.toString())) { return uri; } else { lastImportLocation = URI.create(baseURI).resolve(uri.toString()); String searchingStr = lastImportLocation.toString(); URL resource = classLoader.getResource(searchingStr); if (resource != null) { try { return new URI(resource.toString()); } catch (URISyntaxException e) { throw new RuntimeException(e); } } log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation); return null; } } }./src/org/apache/axis2/deployment/resolver/WarFileBasedURIResolver.java0000664000175000017500000000422211767656530025310 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment.resolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; import org.xml.sax.InputSource; import java.net.URI; public class WarFileBasedURIResolver extends DefaultURIResolver { protected static final Log log = LogFactory .getLog(WarFileBasedURIResolver.class); private ClassLoader classLoader; public WarFileBasedURIResolver(ClassLoader classLoader) { this.classLoader = classLoader; } public InputSource resolveEntity( String targetNamespace, String schemaLocation, String baseUri) { //no issue with if (isAbsolute(schemaLocation)) { return super.resolveEntity( targetNamespace, schemaLocation, baseUri); } else { //validate if ((baseUri == null || "".equals(baseUri)) && schemaLocation.startsWith("..")) { throw new RuntimeException( "Unsupported schema location " + schemaLocation); } URI lastImportLocation = URI.create(baseUri).resolve(schemaLocation); String searchingStr = lastImportLocation.toString(); return new InputSource(classLoader.getResourceAsStream(searchingStr)); } } } ./src/org/apache/axis2/deployment/ServiceBuilder.java0000664000175000017500000007701011767656530021771 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.deployment; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingHelper; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.dataretrieval.DRConstants; import org.apache.axis2.deployment.util.PhasesInfo; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisOperationFactory; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.InOutAxisOperation; import org.apache.axis2.description.ModuleConfiguration; import org.apache.axis2.description.ParameterInclude; import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.description.java2wsdl.TypeTable; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.engine.ServiceLifeCycle; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.Loader; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; /** * Builds a service description from OM */ public class ServiceBuilder extends DescriptionBuilder { private static final Log log = LogFactory.getLog(ServiceBuilder.class); private AxisService service; private HashMap wsdlServiceMap = new HashMap(); public ServiceBuilder(ConfigurationContext configCtx, AxisService service) { this.service = service; this.configCtx = configCtx; this.axisConfig = this.configCtx.getAxisConfiguration(); } public ServiceBuilder(InputStream serviceInputStream, ConfigurationContext configCtx, AxisService service) { super(serviceInputStream, configCtx); this.service = service; } /** * Populates service from corresponding OM. * * @param service_element * an OMElement for the <service> tag * @return a filled-in AxisService, configured from the passed XML * @throws DeploymentException * if there is a problem */ public AxisService populateService(OMElement service_element) throws DeploymentException { try { // Determine whether service should be activated. String serviceActivate = service_element .getAttributeValue(new QName(ATTRIBUTE_ACTIVATE)); if (serviceActivate != null) { if ("true".equals(serviceActivate)) { service.setActive(true); } else if ("false".equals(serviceActivate)) { service.setActive(false); } } // Processing service level parameters OMAttribute serviceNameatt = service_element .getAttribute(new QName(ATTRIBUTE_NAME)); // If the service name is explicitly specified in the services.xml // then use that as the service name if (serviceNameatt != null) { if (!"".equals(serviceNameatt.getAttributeValue().trim())) { AxisService wsdlService = (AxisService) wsdlServiceMap .get(serviceNameatt.getAttributeValue()); if (wsdlService != null) { wsdlService.setClassLoader(service.getClassLoader()); wsdlService.setParent(service.getAxisServiceGroup()); service = wsdlService; service.setWsdlFound(true); service.setCustomWsdl(true); } service.setName(serviceNameatt.getAttributeValue()); // To be on the safe side if (service.getDocumentation() == null) { service.setDocumentation(serviceNameatt .getAttributeValue()); } } } Iterator itr = service_element.getChildrenWithName(new QName( TAG_PARAMETER)); processParameters(itr, service, service.getParent()); // If multiple services in one service group have different values // for the PARENT_FIRST // parameter then the final value become the value specified by the // last service in the group // Parameter parameter = // service.getParameter(DeploymentClassLoader.PARENT_FIRST); // if (parameter !=null && "false".equals(parameter.getValue())) { // ClassLoader serviceClassLoader = service.getClassLoader(); // ((DeploymentClassLoader)serviceClassLoader).setParentFirst(false); // } // process service description OMElement descriptionElement = service_element .getFirstChildWithName(new QName(TAG_DESCRIPTION)); if (descriptionElement != null) { OMElement descriptionValue = descriptionElement .getFirstElement(); if (descriptionValue != null) { service.setDocumentation(descriptionValue); } else { service.setDocumentation(descriptionElement.getText()); } } else { serviceNameatt = service_element.getAttribute(new QName( ATTRIBUTE_NAME)); if (serviceNameatt != null) { if (!"".equals(serviceNameatt.getAttributeValue().trim()) && service.getDocumentation() == null) { service.setDocumentation(serviceNameatt .getAttributeValue()); } } } if (service.getParameter("ServiceClass") == null) { log.debug("The Service " + service.getName() + " does not specify a Service Class"); } // Process WS-Addressing flag attribute OMAttribute addressingRequiredatt = service_element .getAttribute(new QName(ATTRIBUTE_WSADDRESSING)); if (addressingRequiredatt != null) { String addressingRequiredString = addressingRequiredatt .getAttributeValue(); AddressingHelper.setAddressingRequirementParemeterValue( service, addressingRequiredString); } // Setting service target namespace if any OMAttribute targetNameSpace = service_element .getAttribute(new QName(TARGET_NAME_SPACE)); if (targetNameSpace != null) { String nameSpeceVale = targetNameSpace.getAttributeValue(); if (nameSpeceVale != null && !"".equals(nameSpeceVale)) { service.setTargetNamespace(nameSpeceVale); } } else { if (service.getTargetNamespace() == null || "".equals(service.getTargetNamespace())) { service .setTargetNamespace(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE); } } // Processing service lifecycle attribute OMAttribute serviceLifeCycleClass = service_element .getAttribute(new QName(TAG_CLASS_NAME)); if (serviceLifeCycleClass != null) { String className = serviceLifeCycleClass.getAttributeValue(); loadServiceLifeCycleClass(className); } // Setting schema namespece if any OMElement schemaElement = service_element .getFirstChildWithName(new QName(SCHEMA)); if (schemaElement != null) { OMAttribute schemaNameSpace = schemaElement .getAttribute(new QName(SCHEMA_NAME_SPACE)); if (schemaNameSpace != null) { String nameSpeceVale = schemaNameSpace.getAttributeValue(); if (nameSpeceVale != null && !"".equals(nameSpeceVale)) { service.setSchemaTargetNamespace(nameSpeceVale); } } OMAttribute elementFormDefault = schemaElement .getAttribute(new QName(SCHEMA_ELEMENT_QUALIFIED)); if (elementFormDefault != null) { String value = elementFormDefault.getAttributeValue(); if ("true".equals(value)) { service.setElementFormDefault(true); } else if ("false".equals(value)) { service.setElementFormDefault(false); } } // package to namespace mapping. This will be an element that // maps pkg names to a namespace // when this is doing AxisService.getSchemaTargetNamespace will // be overridden // This will be with @namespace and @package Iterator mappingIterator = schemaElement .getChildrenWithName(new QName(MAPPING)); if (mappingIterator != null) { Map pkg2nsMap = new Hashtable(); while (mappingIterator.hasNext()) { OMElement mappingElement = (OMElement) mappingIterator .next(); OMAttribute namespaceAttribute = mappingElement .getAttribute(new QName(ATTRIBUTE_NAMESPACE)); OMAttribute packageAttribute = mappingElement .getAttribute(new QName(ATTRIBUTE_PACKAGE)); if (namespaceAttribute != null && packageAttribute != null) { String namespaceAttributeValue = namespaceAttribute .getAttributeValue(); String packageAttributeValue = packageAttribute .getAttributeValue(); if (namespaceAttributeValue != null && packageAttributeValue != null) { pkg2nsMap.put(packageAttributeValue.trim(), namespaceAttributeValue.trim()); } else { log .warn("Either value of @namespce or @packagename not available. Thus, generated will be selected."); } } else { log .warn("Either @namespce or @packagename not available. Thus, generated will be selected."); } } service.setP2nMap(pkg2nsMap); } } // processing Default Message receivers OMElement messageReceiver = service_element .getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVERS)); if (messageReceiver != null) { HashMap mrs = processMessageReceivers(service.getClassLoader(), messageReceiver); Iterator keys = mrs.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); service.addMessageReceiver(key, (MessageReceiver) mrs .get(key)); } } // Removing exclude operations OMElement excludeOperations = service_element .getFirstChildWithName(new QName(TAG_EXCLUDE_OPERATIONS)); ArrayList excludeops = null; if (excludeOperations != null) { excludeops = processExcludeOperations(excludeOperations); } if (excludeops == null) { excludeops = new ArrayList(); } Utils.addExcludeMethods(excludeops); // // setting the PolicyInclude // processing .. elements Iterator policyElements = service_element .getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, service.getPolicySubject()); } // processing .. elements Iterator policyRefElements = service_element .getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyRefElements.hasNext()) { processPolicyRefElements(policyRefElements, service.getPolicySubject()); } // processing service scope String sessionScope = service_element.getAttributeValue(new QName( ATTRIBUTE_SCOPE)); if (sessionScope != null) { service.setScope(sessionScope); } // processing service-wide modules which required to engage globally Iterator moduleRefs = service_element .getChildrenWithName(new QName(TAG_MODULE)); processModuleRefs(moduleRefs); // processing transports OMElement transports = service_element .getFirstChildWithName(new QName(TAG_TRANSPORTS)); if (transports != null) { Iterator transport_itr = transports .getChildrenWithName(new QName(TAG_TRANSPORT)); ArrayList trs = new ArrayList(); while (transport_itr.hasNext()) { OMElement trsEle = (OMElement) transport_itr.next(); String transportName = trsEle.getText().trim(); trs.add(transportName); if (axisConfig.getTransportIn(transportName) == null) { throw new AxisFault("Service [ " + service.getName() + "] is trying to expose in a transport : " + transports + " and which is not available in Axis2"); } } service.setExposedTransports(trs); } // processing operations Iterator operationsIterator = service_element .getChildrenWithName(new QName(TAG_OPERATION)); ArrayList ops = processOperations(operationsIterator); for (int i = 0; i < ops.size(); i++) { AxisOperation operationDesc = (AxisOperation) ops.get(i); ArrayList wsamappings = operationDesc.getWSAMappingList(); if (wsamappings == null) { continue; } if (service.getOperation(operationDesc.getName()) == null) { service.addOperation(operationDesc); } for (int j = 0; j < wsamappings.size(); j++) { String mapping = (String) wsamappings.get(j); if (mapping.length() > 0) { service.mapActionToOperation(mapping, operationDesc); } } } String objectSupplierValue = (String) service .getParameterValue(TAG_OBJECT_SUPPLIER); if (objectSupplierValue != null) { loadObjectSupplierClass(objectSupplierValue); } // Set the default message receiver for the operations that were // not listed in the services.xml setDefaultMessageReceivers(); Utils.processBeanPropertyExclude(service); if (!service.isUseUserWSDL()) { // Generating schema for the service if the impl class is Java if (!service.isWsdlFound()) { // trying to generate WSDL for the service using JAM and // Java reflection try { if (generateWsdl(service)) { Utils.fillAxisService(service, axisConfig, excludeops, null); } else { ArrayList nonRpcOperations = getNonRPCMethods(service); Utils.fillAxisService(service, axisConfig, excludeops, nonRpcOperations); } } catch (Exception e) { throw new DeploymentException(Messages.getMessage( "errorinschemagen", e.getMessage()), e); } } } if (service.isCustomWsdl()) { OMElement mappingElement = service_element .getFirstChildWithName(new QName(TAG_PACKAGE2QNAME)); if (mappingElement != null) { processTypeMappings(mappingElement); } } for (int i = 0; i < excludeops.size(); i++) { String opName = (String) excludeops.get(i); service.removeOperation(new QName(opName)); } // Need to call the same logic towice setDefaultMessageReceivers(); Iterator moduleConfigs = service_element .getChildrenWithName(new QName(TAG_MODULE_CONFIG)); processServiceModuleConfig(moduleConfigs, service, service); // Loading Data Locator(s) configured OMElement dataLocatorElement = service_element .getFirstChildWithName(new QName( DRConstants.DATA_LOCATOR_ELEMENT)); if (dataLocatorElement != null) { processDataLocatorConfig(dataLocatorElement, service); } processEndpoints(service); processPolicyAttachments(service_element, service); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } return service; } private void setDefaultMessageReceivers() { Iterator operations = service.getPublishedOperations().iterator(); while (operations.hasNext()) { AxisOperation operation = (AxisOperation) operations.next(); if (operation.getMessageReceiver() == null) { MessageReceiver messageReceiver = loadDefaultMessageReceiver( operation.getMessageExchangePattern(), service); if (messageReceiver == null && // we assume that if the MEP is ROBUST_IN_ONLY then the in-out // MR can handle that WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(operation .getMessageExchangePattern())) { messageReceiver = loadDefaultMessageReceiver( WSDL2Constants.MEP_URI_IN_OUT, service); } operation.setMessageReceiver(messageReceiver); } } } private void loadObjectSupplierClass(String objectSupplierValue) throws AxisFault { try { ClassLoader loader = service.getClassLoader(); Class objectSupplierImpl = Loader.loadClass(loader, objectSupplierValue.trim()); ObjectSupplier objectSupplier = (ObjectSupplier) objectSupplierImpl .newInstance(); service.setObjectSupplier(objectSupplier); } catch (Exception e) { throw AxisFault.makeFault(e); } } /** * Process the package name to QName mapping: * * <packageMapping> <mapping packageName="foo.bar" * qname="http://foo/bar/xsd"%gt; ...... ...... </packageMapping> * * @param packageMappingElement * OMElement for the packageMappingElement */ private void processTypeMappings(OMElement packageMappingElement) { Iterator elementItr = packageMappingElement .getChildrenWithName(new QName(TAG_MAPPING)); TypeTable typeTable = service.getTypeTable(); if (typeTable == null) { typeTable = new TypeTable(); } while (elementItr.hasNext()) { OMElement mappingElement = (OMElement) elementItr.next(); String packageName = mappingElement.getAttributeValue(new QName( TAG_PACKAGE_NAME)); String qName = mappingElement .getAttributeValue(new QName(TAG_QNAME)); if (packageName == null || qName == null) { continue; } Iterator keys = service.getNamespaceMap().keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); if (qName.equals(service.getNamespaceMap().get(key))) { typeTable.addComplexSchema(packageName, new QName(qName, packageName, key)); } } } service.setTypeTable(typeTable); } private void loadServiceLifeCycleClass(String className) throws DeploymentException { if (className != null) { try { ClassLoader loader = service.getClassLoader(); Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className); ServiceLifeCycle serviceLifeCycle = (ServiceLifeCycle) serviceLifeCycleClassImpl .newInstance(); serviceLifeCycle.startUp(configCtx, service); service.setServiceLifeCycle(serviceLifeCycle); } catch (Exception e) { throw new DeploymentException(e.getMessage(), e); } } } private boolean generateWsdl(AxisService axisService) { Iterator operatins = axisService.getOperations(); if (operatins.hasNext()) { while (operatins.hasNext()) { AxisOperation axisOperation = (AxisOperation) operatins.next(); if (axisOperation.isControlOperation()) { continue; } if (axisOperation.getMessageReceiver() == null) { continue; } String messageReceiverClass = axisOperation .getMessageReceiver().getClass().getName(); if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver" .equals(messageReceiverClass))) { return false; } } } return true; } /** * To get the methods which do not use RPC* MessageReceivers * * @param axisService * the AxisService to search * @return an ArrayList of the LOCAL PARTS of the QNames of any non-RPC * operations TODO: Why not just return the AxisOperations * themselves?? */ private ArrayList getNonRPCMethods(AxisService axisService) { ArrayList excludeOperations = new ArrayList(); Iterator operatins = axisService.getOperations(); if (operatins.hasNext()) { while (operatins.hasNext()) { AxisOperation axisOperation = (AxisOperation) operatins.next(); if (axisOperation.getMessageReceiver() == null) { continue; } String messageReceiverClass = axisOperation .getMessageReceiver().getClass().getName(); if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver" .equals(messageReceiverClass) || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver" .equals(messageReceiverClass))) { excludeOperations.add(axisOperation.getName() .getLocalPart()); } } } return excludeOperations; } /** * Process <excludeOperation> element in services.xml. Each operation * referenced will be removed from the AxisService. * * @param excludeOperations * the <excludeOperations> element from services.xml * @return an ArrayList of the String contents of the <operation> * elements */ private ArrayList processExcludeOperations(OMElement excludeOperations) { ArrayList exOps = new ArrayList(); Iterator excludeOp_itr = excludeOperations .getChildrenWithName(new QName(TAG_OPERATION)); while (excludeOp_itr.hasNext()) { OMElement opName = (OMElement) excludeOp_itr.next(); exOps.add(opName.getText().trim()); } return exOps; } private void processMessages(Iterator messages, AxisOperation operation) throws DeploymentException { while (messages.hasNext()) { OMElement messageElement = (OMElement) messages.next(); OMAttribute label = messageElement .getAttribute(new QName(TAG_LABEL)); if (label == null) { throw new DeploymentException(Messages .getMessage("messagelabelcannotfound")); } AxisMessage message = operation.getMessage(label .getAttributeValue()); Iterator parameters = messageElement.getChildrenWithName(new QName( TAG_PARAMETER)); // processing .. elements Iterator policyElements = messageElement .getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null) { processPolicyElements(policyElements, message.getPolicySubject()); } // processing .. elements Iterator policyRefElements = messageElement .getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null) { processPolicyRefElements(policyRefElements, message.getPolicySubject()); } processParameters(parameters, message, operation); } } /** * Gets the list of modules that is required to be engaged globally. * * @param moduleRefs * java.util.Iterator * @throws DeploymentException * DeploymentException */ protected void processModuleRefs(Iterator moduleRefs) throws DeploymentException { try { while (moduleRefs.hasNext()) { OMElement moduleref = (OMElement) moduleRefs.next(); OMAttribute moduleRefAttribute = moduleref .getAttribute(new QName(TAG_REFERENCE)); if (moduleRefAttribute != null) { String refName = moduleRefAttribute.getAttributeValue(); if (axisConfig.getModule(refName) == null) { throw new DeploymentException(Messages.getMessage( DeploymentErrorMsgs.MODULE_NOT_FOUND, refName)); } else { service.addModuleref(refName); } } } } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } } protected void processOperationModuleConfig(Iterator moduleConfigs, ParameterInclude parent, AxisOperation operation) throws DeploymentException { while (moduleConfigs.hasNext()) { OMElement moduleConfig = (OMElement) moduleConfigs.next(); OMAttribute moduleName_att = moduleConfig.getAttribute(new QName( ATTRIBUTE_NAME)); if (moduleName_att == null) { throw new DeploymentException(Messages .getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG)); } else { String module = moduleName_att.getAttributeValue(); ModuleConfiguration moduleConfiguration = new ModuleConfiguration( module, parent); Iterator parameters = moduleConfig .getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, moduleConfiguration, parent); operation.addModuleConfig(moduleConfiguration); } } } private ArrayList processOperations(Iterator operationsIterator) throws AxisFault { ArrayList operations = new ArrayList(); while (operationsIterator.hasNext()) { OMElement operation = (OMElement) operationsIterator.next(); // getting operation name OMAttribute op_name_att = operation.getAttribute(new QName( ATTRIBUTE_NAME)); if (op_name_att == null) { throw new DeploymentException(Messages.getMessage(Messages .getMessage(DeploymentErrorMsgs.INVALID_OP, "operation name missing"))); } // setting the MEP of the operation OMAttribute op_mep_att = operation.getAttribute(new QName(TAG_MEP)); String mepurl = null; if (op_mep_att != null) { mepurl = op_mep_att.getAttributeValue(); } String opname = op_name_att.getAttributeValue(); AxisOperation op_descrip = null; // getting the namesapce from the attribute. OMAttribute operationNamespace = operation.getAttribute(new QName( ATTRIBUTE_NAMESPACE)); if (operationNamespace != null) { String namespace = operationNamespace.getAttributeValue(); op_descrip = service.getOperation(new QName(namespace, opname)); } if (op_descrip == null) { op_descrip = service.getOperation(new QName(opname)); } if (op_descrip == null) { op_descrip = service.getOperation(new QName(service .getTargetNamespace(), opname)); } if (op_descrip == null) { if (mepurl == null) { // assumed MEP is in-out op_descrip = new InOutAxisOperation(); op_descrip.setParent(service); } else { op_descrip = AxisOperationFactory .getOperationDescription(mepurl); } op_descrip.setName(new QName(opname)); String MEP = op_descrip.getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage inaxisMessage = op_descrip .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (inaxisMessage != null) { inaxisMessage.setName(opname + Java2WSDLConstants.MESSAGE_SUFFIX); } } if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) { AxisMessage outAxisMessage = op_descrip .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outAxisMessage != null) { outAxisMessage.setName(opname + Java2WSDLConstants.RESPONSE); } } } // setting the PolicyInclude // processing .. elements Iterator policyElements = operation.getChildrenWithName(new QName( POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, op_descrip.getPolicySubject()); } // processing .. elements Iterator policyRefElements = operation .getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyRefElements.hasNext()) { processPolicyRefElements(policyRefElements, op_descrip.getPolicySubject()); } // Operation Parameters Iterator parameters = operation.getChildrenWithName(new QName( TAG_PARAMETER)); processParameters(parameters, op_descrip, service); // To process wsamapping; processActionMappings(operation, op_descrip); // loading the message receivers OMElement receiverElement = operation .getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER)); if (receiverElement != null) { MessageReceiver messageReceiver = loadMessageReceiver(service .getClassLoader(), receiverElement); op_descrip.setMessageReceiver(messageReceiver); } else { // setting default message receiver MessageReceiver msgReceiver = loadDefaultMessageReceiver( op_descrip.getMessageExchangePattern(), service); op_descrip.setMessageReceiver(msgReceiver); } // Process Module Refs Iterator modules = operation.getChildrenWithName(new QName( TAG_MODULE)); processOperationModuleRefs(modules, op_descrip); // processing Messages Iterator messages = operation.getChildrenWithName(new QName( TAG_MESSAGE)); processMessages(messages, op_descrip); // setting Operation phase if (axisConfig != null) { PhasesInfo info = axisConfig.getPhasesInfo(); info.setOperationPhases(op_descrip); } Iterator moduleConfigs = operation.getChildrenWithName(new QName( TAG_MODULE_CONFIG)); processOperationModuleConfig(moduleConfigs, op_descrip, op_descrip); // adding the operation operations.add(op_descrip); } return operations; } protected void processServiceModuleConfig(Iterator moduleConfigs, ParameterInclude parent, AxisService service) throws DeploymentException { while (moduleConfigs.hasNext()) { OMElement moduleConfig = (OMElement) moduleConfigs.next(); OMAttribute moduleName_att = moduleConfig.getAttribute(new QName( ATTRIBUTE_NAME)); if (moduleName_att == null) { throw new DeploymentException(Messages .getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG)); } else { String module = moduleName_att.getAttributeValue(); ModuleConfiguration moduleConfiguration = new ModuleConfiguration( module, parent); Iterator parameters = moduleConfig .getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, moduleConfiguration, parent); service.addModuleConfig(moduleConfiguration); } } } /* * process data locator configuration for data retrieval. */ private void processDataLocatorConfig(OMElement dataLocatorElement, AxisService service) { OMAttribute serviceOverallDataLocatorclass = dataLocatorElement .getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE)); if (serviceOverallDataLocatorclass != null) { String className = serviceOverallDataLocatorclass .getAttributeValue(); service.addDataLocatorClassNames(DRConstants.SERVICE_LEVEL, className); } Iterator iterator = dataLocatorElement.getChildrenWithName(new QName( DRConstants.DIALECT_LOCATOR_ELEMENT)); while (iterator.hasNext()) { OMElement locatorElement = (OMElement) iterator.next(); OMAttribute dialect = locatorElement.getAttribute(new QName( DRConstants.DIALECT_ATTRIBUTE)); OMAttribute dialectclass = locatorElement.getAttribute(new QName( DRConstants.CLASS_ATTRIBUTE)); service.addDataLocatorClassNames(dialect.getAttributeValue(), dialectclass.getAttributeValue()); } } public void setWsdlServiceMap(HashMap wsdlServiceMap) { this.wsdlServiceMap = wsdlServiceMap; } private void processEndpoints(AxisService axisService) throws AxisFault { String endpointName = axisService.getEndpointName(); if (endpointName == null || endpointName.length() == 0) { Utils.addEndpointsToService(axisService, service.getAxisConfiguration()); } } private void processPolicyAttachments(OMElement serviceElement, AxisService service) throws DeploymentException { Iterator attachmentElements = serviceElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_ATTACHMENT)); try { Utils.processPolicyAttachments(attachmentElements, service); } catch (Exception e) { throw new DeploymentException(e); } } } ./src/org/apache/axis2/receivers/0000775000175000017500000000000011767656530016021 5ustar brianbrian./src/org/apache/axis2/receivers/AbstractMessageReceiver.java0000664000175000017500000003350011767656530023422 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.classloader.MultiParentClassLoader; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.clustering.context.Replicator; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.InOnlyAxisOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.engine.DependencyManager; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.Loader; import org.apache.axis2.util.MessageContextBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; public abstract class AbstractMessageReceiver implements MessageReceiver { protected static final Log log = LogFactory.getLog(AbstractMessageReceiver.class); public static final String SCOPE = "scope"; protected String serviceTCCL = null; public static final String SAVED_TCCL = "_SAVED_TCCL_"; public static final String SAVED_MC = "_SAVED_MC_"; public static final String DO_ASYNC = "messageReceiver.invokeOnSeparateThread"; // Place to store previous values public static class ThreadContextDescriptor { public ClassLoader oldClassLoader; public MessageContext oldMessageContext; } protected void replicateState(MessageContext messageContext) throws ClusteringFault { Replicator.replicate(messageContext); } /** * Do the actual work of the MessageReceiver. Must be overridden by concrete subclasses. * * @param messageCtx active MessageContext * @throws AxisFault if a problem occurred */ protected abstract void invokeBusinessLogic(MessageContext messageCtx) throws AxisFault; /** * * @param messageCtx active MessageContext * @throws AxisFault if a problem occurred */ public void receive(final MessageContext messageCtx) throws AxisFault { if (messageCtx.isPropertyTrue(DO_ASYNC)) { EndpointReference replyTo = messageCtx.getReplyTo(); if (replyTo != null && !replyTo.hasAnonymousAddress()) { AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(messageCtx); messageCtx.getEnvelope().build(); messageCtx.getConfigurationContext().getThreadPool().execute(worker); return; } } ThreadContextDescriptor tc = setThreadContext(messageCtx); try { invokeBusinessLogic(messageCtx); } catch (AxisFault fault) { // If we're in-only, eat this. Otherwise, toss it upwards! if ((messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) && !WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageCtx.getAxisOperation().getMessageExchangePattern())) { log.error(fault); } else { fault.setFaultType(Constants.APPLICATION_FAULT); throw fault; } } finally { restoreThreadContext(tc); } } /** * Several pieces of information need to be available to the service * implementation class. For one, the ThreadContextClassLoader needs * to be correct, and for another we need to give the service code * access to the MessageContext (getCurrentContext()). So we toss these * things in TLS. * * @param msgContext the current MessageContext * @return a ThreadContextDescriptor containing the old values */ protected ThreadContextDescriptor setThreadContext(final MessageContext msgContext) { ThreadContextDescriptor tc = new ThreadContextDescriptor(); tc.oldMessageContext = (MessageContext) MessageContext.currentMessageContext.get(); final ClassLoader contextClassLoader = getContextClassLoader_doPriv(); tc.oldClassLoader = contextClassLoader; AxisService service = msgContext.getAxisService(); String serviceTCCL = (String) service.getParameterValue(Constants.SERVICE_TCCL); if (serviceTCCL != null) { serviceTCCL = serviceTCCL.trim().toLowerCase(); if (serviceTCCL.equals(Constants.TCCL_COMPOSITE)) { final ClassLoader loader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new MultiParentClassLoader(new URL[]{}, new ClassLoader[]{ msgContext.getAxisService().getClassLoader(), contextClassLoader }); } }); org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { Thread.currentThread().setContextClassLoader( loader); return null; } } ); } else if (serviceTCCL.equals(Constants.TCCL_SERVICE)) { org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { Thread.currentThread().setContextClassLoader( msgContext.getAxisService().getClassLoader() ); return null; } } ); } } MessageContext.setCurrentMessageContext(msgContext); return tc; } private ClassLoader getContextClassLoader_doPriv() { return (ClassLoader) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } } ); } protected void restoreThreadContext(final ThreadContextDescriptor tc) { org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedAction() { public Object run() { Thread.currentThread().setContextClassLoader(tc.oldClassLoader); return null; } } ); MessageContext.currentMessageContext.set(tc.oldMessageContext); } /** * Create a new service object. Override if you want to customize how * this happens in your own MessageReceiver. * * @param msgContext * @return Returns Object. * @throws AxisFault */ protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { try { final AxisService service = msgContext.getAxisService(); ClassLoader classLoader = service.getClassLoader(); // allow alternative definition of makeNewServiceObject if (service.getParameter(Constants.SERVICE_OBJECT_SUPPLIER) != null) { Parameter serviceObjectParam = service.getParameter(Constants.SERVICE_OBJECT_SUPPLIER); final Class serviceObjectMaker = Loader.loadClass(classLoader, ((String) serviceObjectParam.getValue()).trim()); // Find static getServiceObject() method, call it if there final Method method = (Method) org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws NoSuchMethodException { return serviceObjectMaker.getMethod("getServiceObject", new Class[]{AxisService.class}); } } ); if (method != null) { return org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws InvocationTargetException, IllegalAccessException, InstantiationException { return method.invoke(serviceObjectMaker.newInstance(), new Object[]{service}); } } ); } } Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS); if (implInfoParam != null) { final Class implClass = Loader.loadClass( classLoader, ((String) implInfoParam.getValue()).trim()); return org.apache.axis2.java.security.AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws InstantiationException, IllegalAccessException { return implClass.newInstance(); } } ); } else { throw new AxisFault( Messages.getMessage("paramIsNotSpecified", "SERVICE_OBJECT_SUPPLIER")); } } catch (Exception e) { throw AxisFault.makeFault(e); } } public SOAPFactory getSOAPFactory(MessageContext msgContext) throws AxisFault { String nsURI = msgContext.getEnvelope().getNamespace().getNamespaceURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP12Factory(); } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP11Factory(); } else { throw new AxisFault(Messages.getMessage("invalidSOAPversion")); } } /** * Retrieve the implementation object. This will either return a cached * object if present in the ServiceContext, or create a new one via * makeNewServiceObject() (and then cache that). * * @param msgContext the active MessageContext * @return the appropriate back-end service object. * @throws AxisFault if there's a problem */ protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault { ServiceContext serviceContext = msgContext.getServiceContext(); Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT); if (serviceimpl != null) { // since service impl is there in service context , take that from there return serviceimpl; } else { // create a new service impl class for that service serviceimpl = makeNewServiceObject(msgContext); //Service initialization DependencyManager.initServiceObject(serviceimpl, msgContext.getServiceContext()); serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl); return serviceimpl; } } public class AsyncMessageReceiverWorker implements Runnable { private MessageContext messageCtx; public AsyncMessageReceiverWorker(MessageContext messageCtx){ this.messageCtx = messageCtx; } public void run() { try { ThreadContextDescriptor tc = setThreadContext(messageCtx); try { invokeBusinessLogic(messageCtx); } finally { restoreThreadContext(tc); } } catch (AxisFault e) { // If we're IN-ONLY, swallow this. Otherwise, send it. if (messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) { log.debug(e.getMessage(), e); } else { try { MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(messageCtx, e); AxisEngine.sendFault(faultContext); } catch (AxisFault axisFault) { log.error(e.getMessage(), e); } log.error(e.getMessage(), e); } } } } } ./src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java0000664000175000017500000001027711767656530023716 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import java.lang.reflect.Method; /** * The RawXMLINOutMessageReceiver MessageReceiver hands over the raw request received to * the service implementation class as an OMElement. The implementation class is expected * to return back the OMElement to be returned to the caller. This is a synchronous * MessageReceiver, and finds the service implementation class to invoke by referring to * the "ServiceClass" parameter value specified in the service.xml and looking at the * methods of the form OMElement <>(OMElement request) * * @see RawXMLINOnlyMessageReceiver * @see RawXMLINOutAsyncMessageReceiver */ public class RawXMLINOutMessageReceiver extends AbstractInOutSyncMessageReceiver implements MessageReceiver { private Method findOperation(AxisOperation op, Class implClass) { Method method = (Method)(op.getParameterValue("myMethod")); if (method != null) return method; String methodName = op.getName().getLocalPart(); try { // Looking for a method of the form "OMElement method(OMElement)" method = implClass.getMethod(methodName, new Class [] { OMElement.class }); if (method.getReturnType().equals(OMElement.class)) { try { op.addParameter("myMethod", method); } catch (AxisFault axisFault) { // Do nothing here } return method; } } catch (NoSuchMethodException e) { // Fault through } return null; } /** * Invokes the bussiness logic invocation on the service implementation class * * @param msgContext the incoming message context * @param newmsgContext the response message context * @throws AxisFault on invalid method (wrong signature) or behaviour (return null) */ public void invokeBusinessLogic(MessageContext msgContext, MessageContext newmsgContext) throws AxisFault { try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); // find the WebService method Class implClass = obj.getClass(); AxisOperation opDesc = msgContext.getAxisOperation(); Method method = findOperation(opDesc, implClass); if (method == null) { throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut", opDesc.getName().toString())); } OMElement result = (OMElement) method.invoke( obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()}); SOAPFactory fac = getSOAPFactory(msgContext); SOAPEnvelope envelope = fac.getDefaultEnvelope(); if (result != null) { envelope.getBody().addChild(result); } newmsgContext.setEnvelope(envelope); } catch (Exception e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java0000664000175000017500000000207111767656530025107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; /** * This is takes care of the IN-OUT sync MEP in the server side * * @deprecated not needed, since in-only MessageReceivers can throw faults */ public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver{ } ./src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java0000664000175000017500000000350311767656530024706 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; /** * The RawXMLINOutAsyncMessageReceiver MessageReceiver hands over the raw request received to * the service implementation class as an OMElement. The implementation class is expected * to return back the OMElement to be returned to the caller. This is an asynchronous * MessageReceiver, and finds the service implementation class to invoke by referring to * the "ServiceClass" parameter value specified in the service.xml and looking at the * methods of the form OMElement <>(OMElement request) * * @see RawXMLINOnlyMessageReceiver * @see RawXMLINOutMessageReceiver * @deprecated use RawXMLINOutMessageReceiver and the DO_ASYNC property instead.... */ public class RawXMLINOutAsyncMessageReceiver extends RawXMLINOutMessageReceiver { public void receive(final MessageContext messageCtx) throws AxisFault { messageCtx.setProperty(DO_ASYNC, Boolean.TRUE); super.receive(messageCtx); } } ./src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java0000664000175000017500000000345511767656530025244 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.util.MessageContextBuilder; /** * This is the Absract IN-OUT MEP MessageReceiver. The * protected abstract methods are only for the sake of breaking down the logic * * @deprecated use AbstractInOutMessageReceiver */ public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver { public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault; public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault { MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext); outMsgContext.getOperationContext().addMessageContext(outMsgContext); invokeBusinessLogic(msgContext, outMsgContext); replicateState(msgContext); AxisEngine.send(outMsgContext); } } ./src/org/apache/axis2/receivers/AbstractInOutMessageReceiver.java0000664000175000017500000000336611767656530024410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.AxisEngine; import org.apache.axis2.util.MessageContextBuilder; /** * This is the Absract IN-OUT MEP MessageReceiver. The * protected abstract methods are only for the sake of breaking down the logic */ public abstract class AbstractInOutMessageReceiver extends AbstractMessageReceiver { public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault; public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault { MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext); outMsgContext.getOperationContext().addMessageContext(outMsgContext); invokeBusinessLogic(msgContext, outMsgContext); replicateState(msgContext); AxisEngine.send(outMsgContext); } } ./src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java0000664000175000017500000000712411767656530024065 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; import java.lang.reflect.Method; /** * The RawXMLINOnlyMessageReceiver MessageReceiver hands over the raw request received to * the service implementation class as an OMElement. The implementation class is NOT * expected to return any value, but may do so and it would be ignored. This is a * synchronous MessageReceiver, and finds the service implementation class to invoke by * referring to the "ServiceClass" parameter value specified in the service.xml and * looking at the methods of the form void <>(OMElement request) * * @see RawXMLINOutMessageReceiver * @see RawXMLINOutAsyncMessageReceiver */ public class RawXMLINOnlyMessageReceiver extends AbstractInMessageReceiver implements MessageReceiver { private Method findOperation(AxisOperation op, Class implClass) { Method method = (Method)(op.getParameterValue("myMethod")); if (method != null) return method; String methodName = op.getName().getLocalPart(); try { // Looking for a method of the form "void method(OMElement)" method = implClass.getMethod(methodName, new Class [] { OMElement.class }); if (method.getReturnType().equals(void.class)) { try { op.addParameter("myMethod", method); } catch (AxisFault axisFault) { // Do nothing here } return method; } } catch (NoSuchMethodException e) { // Fall through } return null; } /** * Invokes the business logic invocation on the service implementation class * * @param msgContext the incoming message context * @throws AxisFault on invalid method (wrong signature) */ public void invokeBusinessLogic(MessageContext msgContext) throws AxisFault { try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); // find the WebService method Class implClass = obj.getClass(); AxisOperation op = msgContext.getAxisOperation(); Method method = findOperation(op, implClass); if (method == null) { throw new AxisFault(Messages.getMessage("methodDoesNotExistInOnly")); } method.invoke(obj, new Object [] { msgContext.getEnvelope().getBody().getFirstElement() }); } catch (Exception e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/receivers/AbstractInMessageReceiver.java0000664000175000017500000000202211767656530023704 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; /** * This is takes care of the IN-ONLY MEP on the server side * * TODO: Deprecate this and use AMR directly? */ public abstract class AbstractInMessageReceiver extends AbstractMessageReceiver { } ./src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java0000664000175000017500000000245411767656530025403 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; /** * This is takes care of the IN-OUT sync MEP in the server side * * @deprecated no longer needed, going away after 1.3 */ public abstract class AbstractInOutAsyncMessageReceiver extends AbstractInOutMessageReceiver { public void receive(final MessageContext messageCtx) throws AxisFault { messageCtx.setProperty(DO_ASYNC, Boolean.TRUE); super.receive(messageCtx); } } ./src/org/apache/axis2/receivers/ServerCallback.java0000664000175000017500000000210711767656530021547 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.receivers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; public interface ServerCallback { public void handleFault(AxisFault fault) throws AxisFault; public void handleResult(MessageContext result) throws AxisFault; } ./src/org/apache/axis2/dispatchers/0000775000175000017500000000000011767656530016343 5ustar brianbrian./src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java0000664000175000017500000000575611767656530026377 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SOAPMessageBodyBasedServiceDispatcher extends AbstractServiceDispatcher { public static final String NAME = "SOAPMessageBodyBasedServiceDispatcher"; private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedServiceDispatcher.class); public AxisService findService(MessageContext messageContext) throws AxisFault { String serviceName = null; String localPart = messageContext.getEnvelope().getSOAPBodyFirstElementLocalName(); if (localPart != null) { OMNamespace ns = messageContext.getEnvelope().getSOAPBodyFirstElementNS(); if (ns != null) { String filePart = ns.getNamespaceURI(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + "Checking for Service using SOAP message body's first child's namespace : " + filePart); } String[] values = Utils.parseRequestURLForServiceAndOperation(filePart, messageContext .getConfigurationContext().getServiceContextPath()); if (values[0] != null) { serviceName = values[0]; AxisConfiguration registry = messageContext.getConfigurationContext().getAxisConfiguration(); return registry.getService(serviceName); } } } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/SOAPActionBasedDispatcher.java0000664000175000017500000000455611767656530024066 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Dispatches based on the SOAPAction. */ public class SOAPActionBasedDispatcher extends AbstractDispatcher { /** * Field NAME */ public static final String NAME = "SOAPActionBasedDispatcher"; private static final Log log = LogFactory.getLog(SOAPActionBasedDispatcher.class); private ActionBasedOperationDispatcher abod = new ActionBasedOperationDispatcher(); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { return abod.findOperation(service, messageContext); } /* * (non-Javadoc) * * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for Service using SOAPAction is a TODO item"); } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java0000664000175000017500000001160111767656530024236 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Dispatcher based on the WS-Addressing properties. */ public class AddressingBasedDispatcher extends AbstractDispatcher implements AddressingConstants { /** * Field NAME */ public static final String NAME = "AddressingBasedDispatcher"; private static final Log log = LogFactory.getLog(AddressingBasedDispatcher.class); private RequestURIBasedServiceDispatcher rubsd = new RequestURIBasedServiceDispatcher(); private ActionBasedOperationDispatcher abod = new ActionBasedOperationDispatcher(); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { return abod.findOperation(service, messageContext); } public AxisService findService(MessageContext messageContext) throws AxisFault { return rubsd.findService(messageContext); } public void initDispatcher() { init(new HandlerDescription(NAME)); } /** * @param msgctx * @throws org.apache.axis2.AxisFault * @noinspection MethodReturnOfConcreteClass */ public InvocationResponse invoke(MessageContext msgctx) throws AxisFault { // first check we can dispatch using the relates to if (msgctx.getRelatesTo() != null) { String relatesTo = msgctx.getRelatesTo().getValue(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("checkingrelatesto", relatesTo)); } if (relatesTo != null && !"".equals(relatesTo) && (msgctx.getOperationContext()==null)) { OperationContext operationContext = msgctx.getConfigurationContext() .getOperationContext(relatesTo); if (operationContext != null) //noinspection TodoComment { // if(operationContext.isComplete()){ // // If the dispatch happens because of the RelatesTo and the mep is complete // // we should throw a more descriptive fault. // throw new AxisFault(Messages.getMessage("duplicaterelatesto",relatesTo)); // } msgctx.setAxisOperation(operationContext.getAxisOperation()); msgctx.setOperationContext(operationContext); msgctx.setServiceContext((ServiceContext) operationContext.getParent()); msgctx.setAxisService( ((ServiceContext) operationContext.getParent()).getAxisService()); // TODO : Is this necessary here? msgctx.getAxisOperation().registerMessageContext(msgctx, operationContext); msgctx.setServiceGroupContextId( ((ServiceGroupContext) msgctx.getServiceContext().getParent()).getId()); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " Dispatched successfully on the RelatesTo. operation=" + operationContext.getAxisOperation()); } return InvocationResponse.CONTINUE; } } } return super.invoke(msgctx); } } ./src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java0000664000175000017500000001331611767656530025511 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.HashMap; import java.util.Map; public class RequestURIBasedServiceDispatcher extends AbstractServiceDispatcher { public static final String NAME = "RequestURIBasedServiceDispatcher"; private static final Log log = LogFactory .getLog(RequestURIBasedServiceDispatcher.class); /* * (non-Javadoc) * * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { EndpointReference toEPR = messageContext.getTo(); if (toEPR != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log .debug(messageContext.getLogIDString() + " Checking for Service using target endpoint address : " + toEPR.getAddress()); } String filePart = toEPR.getAddress(); // REVIEW: (nagy) Parsing the RequestURI will also give us the // operationName if present, so we could conceivably store it in the // MessageContext, but doing so and retrieving it is probably no // faster than simply reparsing the URI ConfigurationContext configurationContext = messageContext .getConfigurationContext(); String[] values = Utils.parseRequestURLForServiceAndOperation( filePart, messageContext.getConfigurationContext() .getServiceContextPath()); if ((values.length >= 1) && (values[0] != null)) { AxisConfiguration registry = configurationContext .getAxisConfiguration(); AxisService axisService = registry.getService(values[0]); // If the axisService is not null we get the binding that the // request came to add // add it as a property to the messageContext if (axisService != null) { Map endpoints = axisService.getEndpoints(); if (endpoints != null) { if (endpoints.size() == 1) { messageContext .setProperty( WSDL2Constants.ENDPOINT_LOCAL_NAME, endpoints.get(axisService .getEndpointName())); } else { String endpointName = values[0].substring(values[0] .indexOf(".") + 1); AxisEndpoint endpoint = (AxisEndpoint) endpoints.get(endpointName); if (endpoint != null) { messageContext.setProperty( WSDL2Constants.ENDPOINT_LOCAL_NAME, endpoint); } else { inferEndpoint(messageContext, axisService); } } } } return axisService; } else { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log .debug(messageContext.getLogIDString() + " Attempted to check for Service using target endpoint URI, but the service fragment was missing"); } return null; } } else { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log .debug(messageContext.getLogIDString() + " Attempted to check for Service using null target endpoint URI"); } return null; } } public void initDispatcher() { init(new HandlerDescription(NAME)); } private void inferEndpoint(MessageContext msgCtx, AxisService service) { if (!msgCtx.isServerSide()) { return; } String transport = null; TransportInDescription transportIn = msgCtx.getTransportIn(); if (transportIn != null) { transport = transportIn.getName(); if (transport == null) { return; } } AxisEndpoint endpoint = null; HashMap endpointMapping = service.getEpMap(); if (msgCtx.isDoingREST()) { endpoint = (AxisEndpoint) endpointMapping.get(transport + ":http"); } else { SOAPEnvelope envelope = msgCtx.getEnvelope(); String namespaceURI = envelope.getNamespace().getNamespaceURI(); if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(namespaceURI)) { endpoint = (AxisEndpoint) endpointMapping.get(transport + ":soap11"); } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(namespaceURI)) { endpoint = (AxisEndpoint) endpointMapping.get(transport + ":soap12"); } } if (endpoint != null) { msgCtx.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME, endpoint); } } } ./src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java0000664000175000017500000001313111767656530024423 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.engine.AbstractDispatcher; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Collection; import java.util.Iterator; import java.util.Map; /** * Dispatches the operation based on the information from the target endpoint URL. */ public class HTTPLocationBasedDispatcher extends AbstractDispatcher { public static final String NAME = "HTTPLocationBasedDispatcher"; private static final Log log = LogFactory.getLog(HTTPLocationBasedDispatcher.class); /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext) */ public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { AxisService axisService = messageContext.getAxisService(); if (axisService != null && messageContext.getTo() != null) { String uri = messageContext.getTo().getAddress(); String httpLocation = parseRequestURL(uri, messageContext .getConfigurationContext().getServiceContextPath()); String httpMethod = (String) messageContext.getProperty(HTTPConstants.HTTP_METHOD); if (httpLocation != null) { httpLocation = httpMethod + httpLocation; AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext .getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME); // Here we check whether the request was dispatched to the correct endpoint. If it // was we can dispatch the operation using the HTTPLocationDispatcher table of that // specific endpoint. if (axisEndpoint != null) { Map httpLocationTable = (Map) axisEndpoint.getBinding() .getProperty(WSDL2Constants.HTTP_LOCATION_TABLE); if (httpLocationTable != null) { return getOperationFromHTTPLocation(httpLocation, httpLocationTable); } } } else { log.debug("Attempt to check for Operation using HTTP Location failed"); return null; } } return null; } /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { // This Dispatcher does not need to resolve the service, as that is handled // by the RequestURIBasedDispatcher. return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } private String parseRequestURL(String path, String servicePath) { int index = path.lastIndexOf(servicePath); String service = null; if (-1 != index) { int serviceStart = index + servicePath.length(); if (path.length() > serviceStart + 1) { service = path.substring(serviceStart + 1); } } if (service != null) { index = service.indexOf("/"); if (-1 != index) { service = service.substring(index); } else { int queryIndex = service.indexOf("?"); if (queryIndex != -1) { service = service.substring(queryIndex); } } } return service; } /** * Given the requestPath that the request came to his method returns the corresponding axisOperation * * @param requestPath - Part of the request url which is the part after the service name * @param httpLocationTable - The httpLocationTable stored in the relavant binding * @return AxisOperation - The corresponding AxisOperation */ private AxisOperation getOperationFromHTTPLocation(String requestPath, Map httpLocationTable) { Collection httpLocations = httpLocationTable.keySet(); Iterator iter = httpLocations.iterator(); while (iter.hasNext()) { String location = (String) iter.next(); int index = requestPath.indexOf(location); if (index == 0) { return (AxisOperation) httpLocationTable.get(location); } } return null; } }./src/org/apache/axis2/dispatchers/RequestURIOperationDispatcher.java0000664000175000017500000000441411767656530025111 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; /** * Dispatches the operation based on the information from the target endpoint URL. */ public class RequestURIOperationDispatcher extends AbstractDispatcher { public static final String NAME = "RequestURIOperationDispatcher"; private RequestURIBasedOperationDispatcher rubod = new RequestURIBasedOperationDispatcher(); /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext) */ public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { return rubod.findOperation(service, messageContext); } /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { // This Dispatcher does not need to resolve the service, as that is handled // by the RequestURIBasedDispatcher. return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java0000664000175000017500000000606411767656530025260 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; public class ActionBasedOperationDispatcher extends AbstractOperationDispatcher { public static final String NAME = "ActionBasedOperationDispatcher"; private static final Log log = LogFactory.getLog(ActionBasedOperationDispatcher.class); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { String action = messageContext.getSoapAction(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for Operation using Action : " + action); } if (action != null) { // REVIEW: Should we FIRST try to find an operation that explicitly mapped this // SOAPAction as an alias by calling: // AxisOperation op = service.getOperationByAction(action); // And THEN, if we didn't find an explicit mapping of this action, see if there's an // operation that has the same name as the action, and route to that by calling: // service.getOperationBySOAPAction(action); AxisOperation op = service.getOperationBySOAPAction(action); if (op == null) { op = service.getOperationByAction(action); } /* * HACK: Please remove this when we add support for custom action * uri */ if ((op == null) && (action.lastIndexOf('/') != -1)) { op = service.getOperation(new QName(action.substring(action.lastIndexOf('/'), action.length()))); } return op; } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java0000664000175000017500000000541311767656530026725 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; public class SOAPMessageBodyBasedOperationDispatcher extends AbstractOperationDispatcher { public static final String NAME = "SOAPMessageBodyBasedOperationDispatcher"; private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedOperationDispatcher.class); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { String localPart = messageContext.getEnvelope().getSOAPBodyFirstElementLocalName(); if (localPart == null) { return null; } if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for Operation using SOAP message body's first child's local name : " + localPart); } AxisOperation axisOperation = service.getOperation(new QName(localPart)); if (axisOperation == null) { OMNamespace ns = messageContext.getEnvelope().getSOAPBodyFirstElementNS(); if (ns != null) { QName qName = new QName(ns.getNamespaceURI(), localPart); axisOperation = service.getOperationByMessageElementQName(qName); } if (axisOperation == null) { QName qName = new QName(localPart); axisOperation = service.getOperation(qName); } } return axisOperation; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java0000664000175000017500000000525511767656530025406 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class RelatesToBasedServiceDispatcher extends AbstractServiceDispatcher { public static final String NAME = "RelatesToBasedServiceDispatcher"; private static final Log log = LogFactory.getLog(RelatesToBasedServiceDispatcher.class); public AxisService findService(MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getServiceContext().getAxisService(); } } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java0000664000175000017500000000537311767656530025747 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class RelatesToBasedOperationDispatcher extends AbstractOperationDispatcher { public static final String NAME = "RelatesToBasedOperationDispatcher"; private static final Log log = LogFactory.getLog(RelatesToBasedOperationDispatcher.class); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getAxisOperation(); } } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/RequestURIBasedDispatcher.java0000664000175000017500000000437511767656530024175 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; /** * Dispatches the service based on the information from the target endpoint URL. */ public class RequestURIBasedDispatcher extends AbstractDispatcher { public static final String NAME = "RequestURIBasedDispatcher"; private RequestURIBasedServiceDispatcher rubsd = new RequestURIBasedServiceDispatcher(); /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext) */ public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { // This Dispatcher does not need to resolve the operation, as that is handled // by the RequestURIOperationDispatcher. return null; } /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { return rubsd.findService(messageContext); } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java0000664000175000017500000000512611767656530024305 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.LoggingControl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractServiceDispatcher extends AbstractHandler { public static final String NAME = "AbstractServiceDispatcher"; private static final Log log = LogFactory.getLog(AbstractServiceDispatcher.class); public AbstractServiceDispatcher() { init(new HandlerDescription(NAME)); } /** * Called by Axis Engine to find the service. * * @param messageContext * @return Returns AxisService. * @throws AxisFault */ public abstract AxisService findService(MessageContext messageContext) throws AxisFault; public abstract void initDispatcher(); /** * @param msgctx * @throws org.apache.axis2.AxisFault */ public InvocationResponse invoke(MessageContext msgctx) throws AxisFault { AxisService axisService = msgctx.getAxisService(); if (axisService == null) { axisService = findService(msgctx); if (axisService != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("servicefound", axisService.getName())); } msgctx.setAxisService(axisService); } } return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedDispatcher.java0000664000175000017500000001043011767656530025037 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; /** * Dispatches based on the namespace URI of the first child of * the body. */ public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher { /** * Field NAME */ public static final String NAME = "SOAPMessageBodyBasedDispatcher"; private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedDispatcher.class); public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { String localName = messageContext.getEnvelope().getSOAPBodyFirstElementLocalName(); AxisOperation axisOperation = null; if (localName != null){ OMNamespace ns = messageContext.getEnvelope().getSOAPBodyFirstElementNS(); QName qName = null; if (ns != null) { qName = new QName(ns.getNamespaceURI(), localName); axisOperation = service.getOperationByMessageElementQName(qName); } // this is required for services uses the RPC message receiver if (axisOperation == null){ QName operationName = new QName(localName); axisOperation = service.getOperation(operationName); } } return axisOperation; } /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) */ public AxisService findService(MessageContext messageContext) throws AxisFault { String serviceName; String localPart = messageContext.getEnvelope().getSOAPBodyFirstElementLocalName(); if (localPart != null) { OMNamespace ns = messageContext.getEnvelope().getSOAPBodyFirstElementNS(); if (ns != null) { String filePart = ns.getNamespaceURI(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for Service using SOAP message body's first child's namespace : " + filePart); } ConfigurationContext configurationContext = messageContext.getConfigurationContext(); String[] values = Utils.parseRequestURLForServiceAndOperation(filePart, configurationContext.getServiceContextPath()); if (values[0] != null) { serviceName = values[0]; AxisConfiguration registry = configurationContext.getAxisConfiguration(); return registry.getService(serviceName); } } } return null; } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java0000664000175000017500000000611711767656530024646 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.handlers.AbstractHandler; import org.apache.axis2.i18n.Messages; import org.apache.axis2.util.LoggingControl; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractOperationDispatcher extends AbstractHandler { public static final String NAME = "AbstractOperationDispatcher"; private static final Log log = LogFactory.getLog(AbstractOperationDispatcher.class); public AbstractOperationDispatcher() { init(new HandlerDescription(NAME)); } /** * Called by Axis Engine to find the operation. * * @param service * @param messageContext * @return Returns AxisOperation. * @throws AxisFault */ public abstract AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault; public abstract void initDispatcher(); /** * @param msgctx * @throws org.apache.axis2.AxisFault */ public InvocationResponse invoke(MessageContext msgctx) throws AxisFault { if ((msgctx.getAxisService() != null) && (msgctx.getAxisOperation() == null)) { AxisOperation axisOperation = findOperation(msgctx.getAxisService(), msgctx); if (axisOperation != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("operationfound", axisOperation .getName().getLocalPart())); } msgctx.setAxisOperation(axisOperation); //setting axisMessage into messageContext msgctx.setAxisMessage(axisOperation.getMessage( WSDLConstants.MESSAGE_LABEL_IN_VALUE)); } } return InvocationResponse.CONTINUE; } } ./src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java0000664000175000017500000000637511767656530026060 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dispatchers; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; /** * Dispatches the operation based on the information from the target endpoint URL. */ public class RequestURIBasedOperationDispatcher extends AbstractOperationDispatcher { public static final String NAME = "RequestURIBasedOperationDispatcher"; private static final Log log = LogFactory.getLog(RequestURIBasedOperationDispatcher.class); /* * (non-Javadoc) * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext) */ public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { EndpointReference toEPR = messageContext.getTo(); if (toEPR != null) { String filePart = toEPR.getAddress(); String[] values = Utils.parseRequestURLForServiceAndOperation(filePart, messageContext .getConfigurationContext().getServiceContextPath()); if ((values.length >= 2) && (values[1] != null)) { QName operationName = new QName(values[1]); log.debug(messageContext.getLogIDString() + " Checking for Operation using QName(target endpoint URI fragment) : " + operationName); return service.getOperation(operationName); } else { log.debug(messageContext.getLogIDString() + " Attempted to check for Operation using target endpoint URI, but the operation fragment was missing"); return null; } } else { log.debug(messageContext.getLogIDString() + " Attempted to check for Operation using null target endpoint URI"); return null; } } public void initDispatcher() { init(new HandlerDescription(NAME)); } } ./src/org/apache/axis2/rpc/0000775000175000017500000000000011767656530014616 5ustar brianbrian./src/org/apache/axis2/rpc/client/0000775000175000017500000000000011767656530016074 5ustar brianbrian./src/org/apache/axis2/rpc/client/RPCServiceClient.java0000664000175000017500000001547511767656530022057 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.client; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.DefaultObjectSupplier; import javax.xml.namespace.QName; import java.net.URL; public class RPCServiceClient extends ServiceClient { private boolean notNullService; public RPCServiceClient(ConfigurationContext configContext, AxisService service) throws AxisFault { super(configContext, service); if (service != null) { notNullService = true; } } public RPCServiceClient() throws AxisFault { super(); } public RPCServiceClient(ConfigurationContext configContext, URL wsdlURL, QName wsdlServiceName, String portName) throws AxisFault { super(configContext, wsdlURL, wsdlServiceName, portName); notNullService = true; } /** * Return value can be a single a object or an object array (itself an object) , but it is * difficulty to figure the return object correctly unless we have TyepMapping in the client * side too. Until it is finalized lets return OMElement as return value. And the retuen value * will be the body first element user has to deal with that and create his own object out of * that. * * @param opName Operation QName (to get the body wrapper element) * @param args Arraylist of objects * @return Response OMElement * @throws AxisFault in case of a problem - this can either be a processing fault or a received * on-the-wire fault. */ public OMElement invokeBlocking(QName opName, Object [] args) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); if (notNullService) { return super.sendReceive(opName, omElement); } return super.sendReceive(omElement); } /** * @param opName Operation QName (to get the body wrapper element) * @param args Arraylist of objects * @param returnTypes , this array contains the JavaTypes for the return object , it could be * one or more depending on the return type , most of the type array will * contain just one element It should be noted that the array should only * contains JavaTypes NOT real object , what this methods does is , get the * body first element , and if it contains more than one childern take ith * element and convert that to ith javatype and fill the return arrya the * array will look like as follows [Integer, String, MyBean , etc] * @return Object array , whic will contains real object , but the object can either be simple * type object or the JavaBeans, thats what this method can handle right now the return * array will contains [10, "Axis2Echo", {"foo","baa","11"}] * @throws AxisFault a problem occurred, either locally or on the other side of the wire */ public Object[] invokeBlocking(QName opName, Object [] args, Class [] returnTypes) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); OMElement response; if (notNullService) { response = super.sendReceive(opName, omElement); } else { response = super.sendReceive(omElement); } return BeanUtil.deserialize(response, returnTypes, new DefaultObjectSupplier()); } /** * Invoke the nonblocking/Asynchronous call * * @param opName Operation QName (to get the body wrapper element) * @param args an array of argument Objects * @param callback object extending Callback which will receive notifications * @throws AxisFault in case of a local processing error * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated */ public void invokeNonBlocking(QName opName, Object [] args, Callback callback) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); // call the underlying implementation if (notNullService) { super.sendReceiveNonBlocking(opName, omElement, callback); } else { super.sendReceiveNonBlocking(omElement, callback); } } /** * Invoke the nonblocking/Asynchronous call * * @param opName Operation QName (to get the body wrapper element) * @param args an array of argument Objects * @param callback object implementing AxisCallback which will receive notifications * @throws AxisFault in case of a local processing error */ public void invokeNonBlocking(QName opName, Object [] args, AxisCallback callback) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); // call the underlying implementation if (notNullService) { super.sendReceiveNonBlocking(opName, omElement, callback); } else { super.sendReceiveNonBlocking(omElement, callback); } } public void invokeRobust(QName opName, Object [] args) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); //call the underline implementation if (notNullService) { super.sendRobust(opName, omElement); } else { super.sendRobust(omElement); } } } ./src/org/apache/axis2/rpc/receivers/0000775000175000017500000000000011767656530016605 5ustar brianbrian./src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java0000664000175000017500000001600511767656530023070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /* * Reflection based RPCMessageReceiver , request will be processed by looking at the method signature * of the invocation method */ package org.apache.axis2.rpc.receivers; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.receivers.AbstractInOutMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class RPCMessageReceiver extends AbstractInOutMessageReceiver { private static Log log = LogFactory.getLog(RPCMessageReceiver.class); /** * reflect and get the Java method - for each i'th param in the java method - get the first * child's i'th child -if the elem has an xsi:type attr then find the deserializer for it - if * not found, lookup deser for th i'th param (java type) - error if not found - deserialize & * save in an object array - end for *

        * - invoke method and get the return value *

        * - look up serializer for return value based on the value and type *

        * - create response msg and add return value as grand child of * * @param inMessage incoming MessageContext * @param outMessage outgoing MessageContext * @throws AxisFault */ public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault { Method method = null; try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(inMessage); Class ImplClass = obj.getClass(); AxisOperation op = inMessage.getOperationContext().getAxisOperation(); method = (Method)(op.getParameterValue("myMethod")); AxisService service = inMessage.getAxisService(); OMElement methodElement = inMessage.getEnvelope().getBody() .getFirstElement(); AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); String messageNameSpace = null; if (method == null) { String methodName = op.getName().getLocalPart(); Method[] methods = ImplClass.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { method = methods[i]; op.addParameter("myMethod", method); break; } } if (method == null) { throw new AxisFault("No such method '" + methodName + "' in class " + ImplClass.getName()); } } Object resObject = null; if (inAxisMessage != null) { resObject = RPCUtil.invokeServiceClass(inAxisMessage, method, obj, messageNameSpace, methodElement,inMessage); } SOAPFactory fac = getSOAPFactory(inMessage); // Handling the response AxisMessage outaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outaxisMessage != null && outaxisMessage.getElementQName() !=null) { messageNameSpace = outaxisMessage.getElementQName().getNamespaceURI(); } else { messageNameSpace = service.getTargetNamespace(); } OMNamespace ns = fac.createOMNamespace(messageNameSpace, service.getSchemaTargetNamespacePrefix()); SOAPEnvelope envelope = fac.getDefaultEnvelope(); OMElement bodyContent = null; if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals( op.getMessageExchangePattern())){ OMElement bodyChild = fac.createOMElement(outMessage.getAxisMessage().getName(), ns); envelope.getBody().addChild(bodyChild); outMessage.setEnvelope(envelope); return; } Parameter generateBare = service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER); if (generateBare!=null && "true".equals(generateBare.getValue())) { RPCUtil.processResonseAsDocLitBare(resObject, service, envelope, fac, ns, bodyContent, outMessage); } else { RPCUtil.processResponseAsDocLitWrapped(resObject, service, method, envelope, fac, ns, bodyContent, outMessage); } outMessage.setEnvelope(envelope); } catch (InvocationTargetException e) { String msg = null; Throwable cause = e.getCause(); if (cause != null) { msg = cause.getMessage(); } if (msg == null) { msg = "Exception occurred while trying to invoke service method " + (method != null ? method.getName() : "null"); } if (cause instanceof AxisFault) { log.debug(msg, cause); throw (AxisFault)cause; } log.error(msg, e); throw new AxisFault(msg, e); } catch(RuntimeException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } catch (Exception e) { String msg = "Exception occurred while trying to invoke service method " + (method != null ? method.getName() : "null"); log.error(msg, e); throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java0000664000175000017500000000671011767656530024223 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.receivers.AbstractInMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class RPCInOnlyMessageReceiver extends AbstractInMessageReceiver { private static Log log = LogFactory.getLog(RPCInOnlyMessageReceiver.class); public void invokeBusinessLogic(MessageContext inMessage) throws AxisFault { Method method = null; try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(inMessage); Class ImplClass = obj.getClass(); AxisOperation op = inMessage.getOperationContext().getAxisOperation(); OMElement methodElement = inMessage.getEnvelope().getBody() .getFirstElement(); AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); String messageNameSpace = null; String methodName = op.getName().getLocalPart(); Method[] methods = ImplClass.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { method = methods[i]; break; } } if (inAxisMessage != null) { RPCUtil.invokeServiceClass(inAxisMessage, method, obj, messageNameSpace, methodElement,inMessage); } replicateState(inMessage); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause != null) { String msg = cause.getMessage(); if (msg == null) { msg = "Exception occurred while trying to invoke service method " + method.getName(); } log.error(msg, cause); } else { cause = e; } throw AxisFault.makeFault(cause); } catch (Exception e) { String msg = "Exception occurred while trying to invoke service method " + method.getName(); log.error(msg, e); throw new AxisFault(msg, e); } } } ./src/org/apache/axis2/rpc/receivers/ejb/0000775000175000017500000000000011767656530017345 5ustar brianbrian./src/org/apache/axis2/rpc/receivers/ejb/EJBInOnlyMessageReceiver.java0000664000175000017500000000230711767656530024735 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers.ejb; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver; public class EJBInOnlyMessageReceiver extends RPCInOnlyMessageReceiver { protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { return EJBUtil.makeNewServiceObject(msgContext); } } ./src/org/apache/axis2/rpc/receivers/ejb/EJBMessageReceiver.java0000664000175000017500000000226511767656530023607 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers.ejb; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.rpc.receivers.RPCMessageReceiver; public class EJBMessageReceiver extends RPCMessageReceiver { protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { return EJBUtil.makeNewServiceObject(msgContext); } } ./src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java0000664000175000017500000003221011767656530021444 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers.ejb; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.util.threadpool.DefaultThreadFactory; import javax.naming.Context; import javax.naming.InitialContext; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; public class EJBUtil { public static final java.lang.String EJB_JNDI_NAME = "beanJndiName"; public static final java.lang.String EJB_HOME_INTERFACE_NAME = "homeInterfaceName"; public static final java.lang.String EJB_REMOTE_INTERFACE_NAME = "remoteInterfaceName"; public static final java.lang.String EJB_LOCAL_HOME_INTERFACE_NAME = "localHomeInterfaceName"; public static final java.lang.String EJB_LOCAL_INTERFACE_NAME = "localInterfaceName"; public static final java.lang.String EJB_INITIAL_CONTEXT_FACTORY = "jndiContextClass"; public static final java.lang.String EJB_PROVIDER_URL = "providerUrl"; public static final java.lang.String EJB_JNDI_USERNAME = "jndiUser"; public static final java.lang.String EJB_JNDI_PASSWORD = "jndiPassword"; private static ExecutorService workerPool = null; static { workerPool = new ThreadPoolExecutor(1, 50, 150L, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DefaultThreadFactory( new ThreadGroup("EJB provider thread group"), "EJBProvider")); } /** * Return a object which implements the service. * * @param msgContext the message context * @return an object that implements the service * @throws AxisFault if fails */ protected static Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { CountDownLatch startLatch = new CountDownLatch(1); CountDownLatch stopLatch = new CountDownLatch(1); EJBClientWorker worker = new EJBClientWorker(msgContext, startLatch, stopLatch); workerPool.execute(worker); startLatch.countDown(); try { stopLatch.await(); } catch (InterruptedException e) { throw AxisFault.makeFault(e); } if (worker.getException() != null) { throw AxisFault.makeFault(worker.getException()); } return worker.getReturnedValue(); } private static class EJBClientWorker implements Runnable { private MessageContext msgContext = null; private CountDownLatch startLatch = null; private CountDownLatch stopLatch = null; protected static final Class[] empty_class_array = new Class[0]; protected static final Object[] empty_object_array = new Object[0]; private static InitialContext cached_context = null; private Exception exception = null; private Object returnedValue = null; public EJBClientWorker(MessageContext msgContext, CountDownLatch startLatch, CountDownLatch stopLatch) { this.msgContext = msgContext; this.startLatch = startLatch; this.stopLatch = stopLatch; } public void run() { try { startLatch.await(); final AxisService service = msgContext.getAxisService(); AccessController.doPrivileged( new PrivilegedAction() { public Object run() { Thread.currentThread() .setContextClassLoader(service.getClassLoader()); return null; } } ); Parameter remoteHomeName = service.getParameter(EJB_HOME_INTERFACE_NAME); Parameter localHomeName = service.getParameter(EJB_LOCAL_HOME_INTERFACE_NAME); Parameter jndiName = service.getParameter(EJB_JNDI_NAME); Parameter homeName = (remoteHomeName != null ? remoteHomeName : localHomeName); if (jndiName == null || jndiName.getValue() == null) { throw new AxisFault("jndi name is not specified"); } else if (homeName == null || homeName.getValue() == null) { // cannot find both remote home and local home throw new AxisFault("ejb remote/local home class name is not specified"); } // we create either the ejb using either the RemoteHome or LocalHome object if (remoteHomeName != null) returnedValue = createRemoteEJB(msgContext, ((String)jndiName.getValue()).trim(), ((String)homeName.getValue()).trim()); else returnedValue = createLocalEJB(msgContext, ((String)jndiName.getValue()).trim(), ((String)homeName.getValue()).trim()); } catch (Exception e) { e.printStackTrace(); exception = e; } finally { stopLatch.countDown(); } } /** * Create an EJB using a remote home object * * @param msgContext the message context * @param beanJndiName The JNDI name of the EJB remote home class * @param homeName the name of the home interface class * @return an EJB * @throws Exception If fails */ private Object createRemoteEJB(MessageContext msgContext, String beanJndiName, String homeName) throws Exception { // Get the EJB Home object from JNDI Object ejbHome = getEJBHome(msgContext.getAxisService(), beanJndiName); Class cls = getContextClassLoader().loadClass(homeName); Object ehome = javax.rmi.PortableRemoteObject.narrow(ejbHome, cls); // Invoke the create method of the ejbHome class without actually // touching any EJB classes (i.e. no cast to EJBHome) Method createMethod = cls.getMethod("create", empty_class_array); return createMethod.invoke(ehome, empty_object_array); } /** * Create an EJB using a local home object * * @param msgContext the message context * @param beanJndiName The JNDI name of the EJB local home class * @param homeName the name of the home interface class * @return an EJB * @throws Exception if fails */ private Object createLocalEJB(MessageContext msgContext, String beanJndiName, String homeName) throws Exception { // Get the EJB Home object from JNDI Object ejbHome = getEJBHome(msgContext.getAxisService(), beanJndiName); // the home object is a local home object Object ehome; Class cls = getContextClassLoader().loadClass(homeName); if (cls.isInstance(ejbHome)) ehome = ejbHome; else { throw new ClassCastException("bad ejb home type"); } // Invoke the create method of the ejbHome class without actually // touching any EJB classes (i.e. no cast to EJBLocalHome) Method createMethod = cls.getMethod("create", empty_class_array); return createMethod.invoke(ehome, empty_object_array); } /** * Common routine to do the JNDI lookup on the Home interface object username and password * for jndi lookup are got from the configuration or from the messageContext if not found in * the configuration * * @param service AxisService object * @param beanJndiName JNDI name of the EJB home object * @return EJB home object * @throws AxisFault If fals */ private Object getEJBHome(AxisService service, String beanJndiName) throws AxisFault { Object ejbHome; // Set up an InitialContext and use it get the beanJndiName from JNDI try { Properties properties = null; // collect all the properties we need to access JNDI: // username, password, factoryclass, contextUrl // username Parameter username = service.getParameter(EJB_JNDI_USERNAME); if (username != null) { if (properties == null) properties = new Properties(); properties.setProperty(Context.SECURITY_PRINCIPAL, ((String)username.getValue()).trim()); } // password Parameter password = service.getParameter(EJB_JNDI_PASSWORD); if (password != null) { if (properties == null) properties = new Properties(); properties.setProperty(Context.SECURITY_CREDENTIALS, ((String)password.getValue()).trim()); } // factory class Parameter factoryClass = service.getParameter(EJB_INITIAL_CONTEXT_FACTORY); if (factoryClass != null) { if (properties == null) properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, ((String)factoryClass.getValue()).trim()); } // contextUrl Parameter contextUrl = service.getParameter(EJB_PROVIDER_URL); if (contextUrl != null) { if (properties == null) properties = new Properties(); properties.setProperty(Context.PROVIDER_URL, ((String)contextUrl.getValue()).trim()); } // get context using these properties InitialContext context = getContext(properties); // if we didn't get a context, fail if (context == null) throw new AxisFault("cannot create initial context"); ejbHome = getEJBHome(context, beanJndiName); if (ejbHome == null) throw new AxisFault("cannot find jndi home"); } catch (Exception exception) { throw AxisFault.makeFault(exception); } return ejbHome; } private InitialContext getCachedContext() throws javax.naming.NamingException { if (cached_context == null) cached_context = new InitialContext(); return cached_context; } private InitialContext getContext(Properties properties) throws AxisFault, javax.naming.NamingException { return ((properties == null) ? getCachedContext() : new InitialContext(properties)); } private Object getEJBHome(InitialContext context, String beanJndiName) throws AxisFault, javax.naming.NamingException { return context.lookup(beanJndiName); } private ClassLoader getContextClassLoader() { return (ClassLoader)AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } } ); } public Exception getException() { return exception; } public Object getReturnedValue() { return returnedValue; } } } ./src/org/apache/axis2/rpc/receivers/ejb/EJBInOutAsyncMessageReceiver.java0000664000175000017500000000271511767656530025564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers.ejb; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.rpc.receivers.RPCMessageReceiver; /** * An EJBInOutAsyncMessageReceiver * * @deprecated you can just use EJBMessageReceiver */ public class EJBInOutAsyncMessageReceiver extends RPCMessageReceiver { public void receive(final MessageContext messageCtx) throws AxisFault { messageCtx.setProperty(DO_ASYNC, Boolean.TRUE); super.receive(messageCtx); } protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { return EJBUtil.makeNewServiceObject(msgContext); } } ./src/org/apache/axis2/rpc/receivers/RPCUtil.java0000664000175000017500000005274711767656530020751 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory; import org.apache.axiom.om.util.Base64; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.databinding.typemapping.SimpleTypeMapper; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.databinding.utils.reader.NullXMLStreamReader; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.java2wsdl.TypeTable; import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.util.StreamWrapper; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; import java.util.Iterator; public class RPCUtil { private static String RETURN_WRAPPER = "return"; public static void processResponse(SOAPFactory fac, Object resObject, OMElement bodyContent, OMNamespace ns, SOAPEnvelope envelope, Method method, boolean qualified, TypeTable typeTable) { if (resObject != null) { //simple type if (resObject instanceof OMElement) { OMElement result = (OMElement) resObject; bodyContent = fac.createOMElement( method.getName() + "Response", ns); OMElement resWrapper; if (qualified) { resWrapper = fac.createOMElement(RETURN_WRAPPER, ns.getNamespaceURI(), ns.getPrefix()); } else { resWrapper = fac.createOMElement(RETURN_WRAPPER, null); } resWrapper.addChild(result); bodyContent.addChild(resWrapper); } else if (SimpleTypeMapper.isSimpleType(resObject)) { bodyContent = fac.createOMElement( method.getName() + "Response", ns); OMElement child; if (qualified) { child = fac.createOMElement(RETURN_WRAPPER, ns); } else { child = fac.createOMElement(RETURN_WRAPPER, null); } child.addChild(fac.createOMText(child, SimpleTypeMapper.getStringValue(resObject))); bodyContent.addChild(child); } else { bodyContent = fac.createOMElement( method.getName() + "Response", ns); // Java Beans QName returnWrapper; if (qualified) { returnWrapper = new QName(ns.getNamespaceURI(), RETURN_WRAPPER, ns.getPrefix()); } else { returnWrapper = new QName(RETURN_WRAPPER); } XMLStreamReader xr = BeanUtil.getPullParser(resObject, returnWrapper, typeTable, qualified, false); StAXOMBuilder stAXOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getOMFactory(), new StreamWrapper(xr)); OMElement documentElement = stAXOMBuilder.getDocumentElement(); if (documentElement != null) { bodyContent.addChild(documentElement); } } } if (bodyContent != null) { envelope.getBody().addChild(bodyContent); } } public static void processObjectAsDocLitBare(SOAPFactory fac, Object resObject, OMElement bodyContent, OMNamespace ns, SOAPEnvelope envelope, boolean qualified, TypeTable typeTable, String partName) { if (resObject instanceof OMElement) { OMElement result = (OMElement) resObject; bodyContent = fac.createOMElement( partName, ns); bodyContent.addChild(result); } else if (SimpleTypeMapper.isSimpleType(resObject)) { bodyContent = fac.createOMElement( partName, ns); bodyContent.addChild(fac.createOMText(bodyContent, SimpleTypeMapper.getStringValue(resObject))); } else { QName returnWrapper = new QName(ns.getNamespaceURI(), partName, ns.getPrefix()); XMLStreamReader xr = BeanUtil.getPullParser(resObject, returnWrapper, typeTable, qualified, true); StAXOMBuilder stAXOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getOMFactory(), new StreamWrapper(xr)); OMElement documentElement = stAXOMBuilder.getDocumentElement(); if (documentElement != null) { envelope.getBody().addChild(documentElement); } } if (bodyContent != null) { envelope.getBody().addChild(bodyContent); } } public static Object[] processRequest(OMElement methodElement, Method method, ObjectSupplier objectSupplier) throws AxisFault { Class[] parameters = method.getParameterTypes(); return BeanUtil.deserialize(methodElement, parameters, objectSupplier); } public static Object invokeServiceClass(AxisMessage inAxisMessage, Method method, Object implClass, String messageNameSpace, OMElement methodElement, MessageContext inMessage) throws AxisFault, IllegalAccessException, InvocationTargetException { if (inAxisMessage.getElementQName() == null) { // method accept empty SOAPbody return method.invoke(implClass, new Object[0]); } else { QName elementQName = inAxisMessage.getElementQName(); messageNameSpace = elementQName.getNamespaceURI(); OMNamespace namespace = methodElement.getNamespace(); if (messageNameSpace != null) { if (namespace == null) { throw new AxisFault("namespace mismatch require " + messageNameSpace + " found none"); } if (!messageNameSpace.equals(namespace.getNamespaceURI())) { throw new AxisFault("namespace mismatch require " + messageNameSpace + " found " + methodElement.getNamespace().getNamespaceURI()); } } else if (namespace != null) { throw new AxisFault( "namespace mismatch. Axis Oepration expects non-namespace " + "qualified element. But received a namespace qualified element"); } Object[] objectArray; if (inAxisMessage.isWrapped()) { objectArray = RPCUtil.processRequest(methodElement, method, inMessage.getAxisService().getObjectSupplier()); } else { objectArray = RPCUtil.processRequest((OMElement) methodElement.getParent(), method, inMessage.getAxisService().getObjectSupplier()); } return method.invoke(implClass, objectArray); } } public static OMElement getResponseElement(QName resname, Object[] objs, boolean qualified, TypeTable typeTable) { if (qualified) { return BeanUtil.getOMElement(resname, objs, new QName(resname.getNamespaceURI(), RETURN_WRAPPER, resname.getPrefix()), qualified, typeTable); } else { return BeanUtil.getOMElement(resname, objs, new QName(RETURN_WRAPPER), qualified, typeTable); } } public static void processResonseAsDocLitBare(Object resObject, AxisService service, SOAPEnvelope envelope, SOAPFactory fac, OMNamespace ns, OMElement bodyContent, MessageContext outMessage ) throws Exception { QName elementQName = outMessage.getAxisMessage().getElementQName(); String partName = outMessage.getAxisMessage().getPartName(); if (resObject == null) { processNullReturns(service, envelope, partName); } else { if (resObject instanceof Object[]) { QName resName = new QName(elementQName.getNamespaceURI(), partName, elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, (Object[]) resObject, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else { if (resObject.getClass().isArray()) { int length = Array.getLength(resObject); Object objArray[]; if (resObject instanceof byte[]) { objArray = new Object[1]; objArray[0] = Base64.encode((byte[]) resObject); } else { objArray = new Object[length]; for (int i = 0; i < length; i++) { objArray[i] = Array.get(resObject, i); } } QName resName = new QName(elementQName.getNamespaceURI(), partName, elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, objArray, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else { if (SimpleTypeMapper.isCollection(resObject.getClass())) { Collection collection = (Collection) resObject; int size = collection.size(); Object values[] = new Object[size]; int count = 0; for (Iterator iterator = collection.iterator(); iterator.hasNext();) { values[count] = iterator.next(); count++; } QName resName = new QName(elementQName.getNamespaceURI(), partName, elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, values, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else if (SimpleTypeMapper.isDataHandler(resObject.getClass())) { OMElement resElemt; if (service.isElementFormDefault()) { resElemt = fac.createOMElement(partName, ns); } else { resElemt = fac.createOMElement(partName, null); } OMText text = fac.createOMText(resObject, true); resElemt.addChild(text); envelope.getBody().addChild(resElemt); } else { if (service.isElementFormDefault()) { RPCUtil.processObjectAsDocLitBare(fac, resObject, bodyContent, ns, envelope, service.isElementFormDefault(), service.getTypeTable(), partName); } else { RPCUtil.processObjectAsDocLitBare(fac, resObject, bodyContent, ns, envelope, service.isElementFormDefault(), null, partName); } } } } } outMessage.setEnvelope(envelope); } /** * This method is use to to crete the reposne when , the return value is null * * @param service Current AxisService * @param envelope response enevelop */ private static void processNullReturns(AxisService service, SOAPEnvelope envelope, String partName) { QName resName; if (service.isElementFormDefault()) { resName = new QName(service.getSchemaTargetNamespace(), partName, service.getSchemaTargetNamespacePrefix()); } else { resName = new QName(partName); } XMLStreamReader xr = new NullXMLStreamReader(resName); StreamWrapper parser = new StreamWrapper(xr); StAXOMBuilder stAXOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getSOAP11Factory(), parser); envelope.getBody().addChild(stAXOMBuilder.getDocumentElement()); } public static void processResponseAsDocLitWrapped(Object resObject, AxisService service, Method method, SOAPEnvelope envelope, SOAPFactory fac, OMNamespace ns, OMElement bodyContent, MessageContext outMessage ) throws Exception { QName elementQName = outMessage.getAxisMessage().getElementQName(); if (resObject == null) { QName resName; if (service.isElementFormDefault()) { resName = new QName(service.getSchemaTargetNamespace(), RETURN_WRAPPER, service.getSchemaTargetNamespacePrefix()); } else { resName = new QName(RETURN_WRAPPER); } XMLStreamReader xr = new NullXMLStreamReader(resName); StreamWrapper parser = new StreamWrapper(xr); StAXOMBuilder stAXOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getSOAP11Factory(), parser); ns = fac.createOMNamespace(service.getSchemaTargetNamespace(), service.getSchemaTargetNamespacePrefix()); OMElement bodyChild = fac.createOMElement(method.getName() + "Response", ns); bodyChild.addChild(stAXOMBuilder.getDocumentElement()); envelope.getBody().addChild(bodyChild); } else { if (resObject instanceof Object[]) { QName resName = new QName(elementQName.getNamespaceURI(), method.getName() + "Response", elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, (Object[]) resObject, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else { if (resObject.getClass().isArray()) { int length = Array.getLength(resObject); Object objArray[]; if (resObject instanceof byte[]) { objArray = new Object[1]; objArray[0] = Base64.encode((byte[]) resObject); } else { objArray = new Object[length]; for (int i = 0; i < length; i++) { objArray[i] = Array.get(resObject, i); } } QName resName = new QName(elementQName.getNamespaceURI(), method.getName() + "Response", elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, objArray, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else { if (SimpleTypeMapper.isCollection(resObject.getClass())) { Collection collection = (Collection) resObject; int size = collection.size(); Object values[] = new Object[size]; int count = 0; for (Iterator iterator = collection.iterator(); iterator.hasNext();) { values[count] = iterator.next(); count++; } QName resName = new QName(elementQName.getNamespaceURI(), method.getName() + "Response", elementQName.getPrefix()); OMElement bodyChild = RPCUtil.getResponseElement(resName, values, service.isElementFormDefault(), service.getTypeTable()); envelope.getBody().addChild(bodyChild); } else if (SimpleTypeMapper.isDataHandler(resObject.getClass())) { OMElement resElemt = fac.createOMElement(method.getName() + "Response", ns); OMText text = fac.createOMText(resObject, true); OMElement returnElement; if (service.isElementFormDefault()) { returnElement = fac.createOMElement(RETURN_WRAPPER, ns); } else { returnElement = fac.createOMElement(RETURN_WRAPPER, null); } returnElement.addChild(text); resElemt.addChild(returnElement); envelope.getBody().addChild(resElemt); } else { if (service.isElementFormDefault()) { RPCUtil.processResponse(fac, resObject, bodyContent, ns, envelope, method, service.isElementFormDefault(), service.getTypeTable()); } else { RPCUtil.processResponse(fac, resObject, bodyContent, ns, envelope, method, service.isElementFormDefault(), null); } } } } } outMessage.setEnvelope(envelope); } } ./src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java0000664000175000017500000001441111767656530025044 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.rpc.receivers; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class RPCInOutAsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver { private static Log log = LogFactory.getLog(RPCInOnlyMessageReceiver.class); /** * reflect and get the Java method - for each i'th param in the java method - get the first * child's i'th child -if the elem has an xsi:type attr then find the deserializer for it - if * not found, lookup deser for th i'th param (java type) - error if not found - deserialize & * save in an object array - end for *

        * - invoke method and get the return value *

        * - look up serializer for return value based on the value and type *

        * - create response msg and add return value as grand child of * * @param inMessage * @param outMessage * @throws AxisFault */ public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault { Method method = null; try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(inMessage); Class ImplClass = obj.getClass(); AxisOperation op = inMessage.getOperationContext().getAxisOperation(); AxisService service = inMessage.getAxisService(); OMElement methodElement = inMessage.getEnvelope().getBody() .getFirstElement(); AxisMessage inaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); String messageNameSpace = null; String methodName = op.getName().getLocalPart(); Method[] methods = ImplClass.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { method = methods[i]; break; } } Object resObject = null; if (inaxisMessage != null) { resObject = RPCUtil.invokeServiceClass(inaxisMessage, method, obj, messageNameSpace, methodElement,inMessage); } SOAPFactory fac = getSOAPFactory(inMessage); // Handling the response AxisMessage outaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); if (outaxisMessage != null && outaxisMessage.getElementQName() !=null) { messageNameSpace = outaxisMessage.getElementQName().getNamespaceURI(); } else { messageNameSpace = service.getTargetNamespace(); } OMNamespace ns = fac.createOMNamespace(messageNameSpace, service.getSchemaTargetNamespacePrefix()); SOAPEnvelope envelope = fac.getDefaultEnvelope(); OMElement bodyContent = null; if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals( op.getMessageExchangePattern())){ OMElement bodyChild = fac.createOMElement(outMessage.getAxisMessage().getName(), ns); envelope.getBody().addChild(bodyChild); outMessage.setEnvelope(envelope); return; } Parameter generateBare = service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER); if (generateBare!=null && "true".equals(generateBare.getValue())) { RPCUtil.processResonseAsDocLitBare(resObject, service, envelope, fac, ns, bodyContent, outMessage); } else { RPCUtil.processResponseAsDocLitWrapped(resObject, service, method, envelope, fac, ns, bodyContent, outMessage); } outMessage.setEnvelope(envelope); } catch (InvocationTargetException e) { String msg = null; Throwable cause = e.getCause(); if (cause != null) { msg = cause.getMessage(); } if (msg == null) { msg = "Exception occurred while trying to invoke service method " + method.getName(); } log.error(msg, e); if (cause instanceof AxisFault) { throw (AxisFault)cause; } throw new AxisFault(msg); } catch (Exception e) { String msg = "Exception occurred while trying to invoke service method " + method.getName(); log.error(msg, e); throw new AxisFault(msg, e); } } } ./src/org/apache/axis2/dataretrieval/0000775000175000017500000000000011767656530016661 5ustar brianbrian./src/org/apache/axis2/dataretrieval/client/0000775000175000017500000000000011767656530020137 5ustar brianbrian./src/org/apache/axis2/dataretrieval/client/MexClient.java0000664000175000017500000000637111767656530022701 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval.client; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.dataretrieval.DRConstants; import org.apache.axis2.description.AxisService; import javax.wsdl.Definition; import javax.xml.namespace.QName; import java.net.URL; public class MexClient extends ServiceClient { public MexClient(ConfigurationContext configContext, AxisService axisService) throws AxisFault { super(configContext, axisService); } public MexClient(ConfigurationContext configContext, Definition wsdl4jDefinition, QName wsdlServiceName, String portName) throws AxisFault { super(configContext, wsdl4jDefinition, wsdlServiceName, portName); } public MexClient(ConfigurationContext configContext, URL wsdlURL, QName wsdlServiceName, String portName) throws AxisFault { super(configContext, wsdlURL, wsdlServiceName, portName); } public MexClient() throws AxisFault { } /** * Builds OMElement that makes up of SOAP body. */ public OMElement setupGetMetadataRequest(String dialect, String identifier) throws AxisFault { // Attempt to engage MEX module /* try{ super.engageModule("metadataExchange"); } catch (Exception e){ throw new AxisFault ("Unable to proceed with GetMetadata Request!", e); } */ OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace(DRConstants.SPEC.NS_URI, DRConstants.SPEC.NS_PREFIX); OMElement method = fac.createOMElement(DRConstants.SPEC.GET_METADATA, omNs); if (dialect != null) { OMElement dialectElem = fac.createOMElement(DRConstants.SPEC.DIALET, omNs); dialectElem.setText(dialect); method.addChild(dialectElem); } // create Identifier element if (identifier != null) { OMElement id_Elem = fac.createOMElement(DRConstants.SPEC.IDENTIFIER, omNs); id_Elem.setText(identifier); method.addChild(id_Elem); } return method; } } ./src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.java0000664000175000017500000001177111767656530023377 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMElement; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; /** * The Default Axis2 Data Locator implementation */ public class AxisDataLocatorImpl implements AxisDataLocator { private static final Log log = LogFactory.getLog(AxisDataLocatorImpl.class); // HashMap to cache Data elements defined in ServiceData. private HashMap dataMap = new HashMap(); private AxisService axisService; /** * Constructor * * @throws DataRetrievalException */ public AxisDataLocatorImpl(AxisService in_axisService) throws DataRetrievalException { super(); axisService = in_axisService; } /** * Retrieves and returns data based on the specified request. */ public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException { Data[] data = null; String dialect = request.getDialect(); String identifier = request.getIdentifier(); String key = dialect; ArrayList dataList = new ArrayList(); if (identifier != null) { key = key + identifier; if (dataMap.get(key) != null) { dataList.add(dataMap.get(key)); } } else { dataList = getDataList(dialect); } AxisDataLocator dataLocator = DataLocatorFactory .createDataLocator(dialect, (ServiceData[]) dataList.toArray(new ServiceData[0])); if (dataLocator != null) { try { data = dataLocator.getData(request, msgContext); } catch (Throwable e) { log.info("getData request failed for dialect, " + dialect, e); throw new DataRetrievalException(e); } } else { String message = "Failed to instantiate Data Locator for dialect, " + dialect; log.info(message); throw new DataRetrievalException(message); } return data; } /* * For AxisService use only! */ public void loadServiceData() { DataRetrievalUtil util = DataRetrievalUtil.getInstance(); OMElement serviceData = null; String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME; try { serviceData = util.buildOM(axisService.getClassLoader(), "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME); } catch (DataRetrievalException e) { // It is not required to define ServiceData for a Service, just log a warning message String message = "Check loading failure for file, " + file; log.debug(message + ".Message = " + e.getMessage()); log.debug(message, e); } if (serviceData != null) { cachingServiceData(serviceData); } } /* * caching ServiceData for Axis2 Data Locators */ private void cachingServiceData(OMElement e) { Iterator i = e.getChildrenWithName(new QName( DRConstants.SERVICE_DATA.DATA)); String saveKey = ""; while (i.hasNext()) { ServiceData data = new ServiceData((OMElement) i.next()); saveKey = data.getDialect(); String identifier = data.getIdentifier(); if (identifier != null) { saveKey = saveKey + identifier; } dataMap.put(saveKey, data); } } /* * Return ServiceData for specified dialect */ private ArrayList getDataList(String dialect) { ArrayList dataList = new ArrayList(); Iterator keys = dataMap.keySet().iterator(); while (keys.hasNext()) { String keyStr = (String) keys.next(); // get all Data element that matching the dialect if (keyStr.indexOf(dialect) == 0) { dataList.add(dataMap.get(keyStr)); } } return dataList; } }./src/org/apache/axis2/dataretrieval/WSDLSupplier.java0000664000175000017500000000260111767656530022020 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisService; import javax.wsdl.Definition; /** * Return a WSDL as an OMElement. This is used by any AxisService that wishes * to override the standard AxisService2WSDL (see the org.apache.axis2.description * package) method of getting WSDL. If one of these is present in the AxisService * Parameters under the name "WSDLSupplier", it will be queried. */ public interface WSDLSupplier { Definition getWSDL(AxisService service) throws AxisFault; } ./src/org/apache/axis2/dataretrieval/DataRetrievalException.java0000664000175000017500000000246311767656530024137 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axis2.AxisFault; /** * Exception class for reporting Data Retrieval problems */ public class DataRetrievalException extends AxisFault { private static final long serialVersionUID = -374933082062124908L; public DataRetrievalException(String message) { super(message); } public DataRetrievalException(Throwable e) { super(e); } public DataRetrievalException(String message, Throwable e) { super(message, e); } } ./src/org/apache/axis2/dataretrieval/DataRetrievalRequest.java0000664000175000017500000000671711767656530023637 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import java.util.HashMap; /** * Allow to specify options/parameters for getData request. The list is extensible * based on the information needed for the Data Locator to process the request. */ public class DataRetrievalRequest extends HashMap { private static final long serialVersionUID = -374933082062124908L; /** * Key used to define Dialect of data to be retrieved. */ public final static String DIALET = "Dialect"; /** * Key used to defined Identify of data to be retrieved. */ public final static String IDENTIFIER = "Identifier"; /** * Key used to define the output format of retrieved data to be returned. */ public final static String OUTPUT_FORM = "OutputForm"; /** * Returns the Dialect value specified in the request. * * @return a String that has dialect info. */ public String getDialect() throws DataRetrievalException { String dialect = (String) (get(DIALET)); if (dialect == null || dialect.length() == 0) { throw new DataRetrievalException( "Empty dialect was detected. Dialect must have value."); } return (dialect); } /** * Returns the Identifier value specified in the request. * * @return a String that has Identifier info. */ public String getIdentifier() { return (String) (get(IDENTIFIER)); } /** * Returns the output format specified in the request. * * @return output format of data retrieved. */ public OutputForm getOutputForm() { return (OutputForm) (get(OUTPUT_FORM)); } /** * Allow to set the dialect of data to retrieve * * @param dialect - Valid dialect value supported by the Data Locator. * @throws DataRetrievalException */ public void putDialect(String dialect) throws DataRetrievalException { if (dialect == null || dialect.length() == 0) { throw new DataRetrievalException( "Empty dialect was detected. Dialect must have value."); } put(DIALET, dialect); } /** * Allow to set the identifier of data to retrieve * * @param identifier - identifier value * @throws DataRetrievalException */ public void putIdentifier(String identifier) { put(IDENTIFIER, identifier); } /** * Allow to set the output format of the data retrieved. * * @param form - Valid output format types supported by the Data Locator. * @throws DataRetrievalException */ public void putOutputForm(OutputForm form) { put(OUTPUT_FORM, form); } } ./src/org/apache/axis2/dataretrieval/Data.java0000664000175000017500000000311611767656530020376 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; /** * Data contains instance of the data Object for the specified identifier if applicable. */ public class Data { Object data; String identifier; /** * Constructor * * @param in_data instance of Object about the data * @param in_identifier identifier of the data instance. */ public Data(Object in_data, String in_identifier) { super(); data = in_data; identifier = in_identifier; } /** * Returns data * * @return data Object */ public Object getData() { return data; } /** * Returns string representing identifier of this data object. * * @return */ public String getIdentifier() { return identifier; } } ./src/org/apache/axis2/dataretrieval/PolicyDataLocator.java0000664000175000017500000000243111767656530023101 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; /** * Axis 2 Data Locator responsibles for retrieving Policy metadata. The class is * created as model for policy specific data locator; and also easier for any * future implementation policy specific data retrieval logic. */ public class PolicyDataLocator extends BaseAxisDataLocator implements AxisDataLocator { protected PolicyDataLocator() { } /** * Constructor */ protected PolicyDataLocator(ServiceData[] data) { dataList = data; } } ./src/org/apache/axis2/dataretrieval/DataRetrievalUtil.java0000664000175000017500000000715411767656530023120 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.InputStream; public class DataRetrievalUtil { private static final Log log = LogFactory.getLog(DataRetrievalUtil.class); private static DataRetrievalUtil instance = null; public static DataRetrievalUtil getInstance() { if (instance == null) { instance = new DataRetrievalUtil(); } return instance; } /** * Loading xml file content and convert to OMElement. * * @param file - file path relative to the Service Repository * @return OMElement format of the xml file content * @throws DataRetrievalException */ public OMElement buildOM(ClassLoader classLoader, String file) throws DataRetrievalException { OMElement element = null; InputStream servicexmlStream = null; try { servicexmlStream = getInputStream(classLoader, file); element = convertToOMElement(servicexmlStream); } catch (Exception e) { throw new DataRetrievalException("Failed to load from file, " + file, e); } return element; } /** * Convert servicexmlStream to OMElement * * @param servicexmlStream InputStream contain xml content * @return OMElement format of the xml content * @throws XMLStreamException */ public static OMElement convertToOMElement(InputStream servicexmlStream) throws XMLStreamException, OMException{ OMElement element = null; XMLStreamReader xmlReader = StAXUtils .createXMLStreamReader(servicexmlStream); OMFactory fac = OMAbstractFactory.getOMFactory(); StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader); element = staxOMBuilder.getDocumentElement(); element.build(); return element; } private static InputStream getInputStream(ClassLoader classLoader, String file) throws XMLStreamException { InputStream servicexmlStream = classLoader.getResourceAsStream(file); if (servicexmlStream == null) { String message = "File does not exist in the Service Repository! File=" + file; if (log.isDebugEnabled()) { log.debug(message); } throw new XMLStreamException(message); } return servicexmlStream; } }./src/org/apache/axis2/dataretrieval/DRConstants.java0000664000175000017500000000573611767656530021741 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; /** * Defines constants referenced in data retrieval classes. */ public interface DRConstants { public interface SPEC_VERSIONS { String v1_0 = "Spec_2004_09"; } public interface SOAPVersion { int v1_1 = 1; int v1_2 = 2; } /** * Defines contants references in WS-Mex specification */ public interface SPEC { String NS_URI = "http://schemas.xmlsoap.org/ws/2004/09/mex"; public interface Actions { String GET_METADATA_REQUEST = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request"; String GET_METADATA_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Response"; } String NS_PREFIX = "mex"; String GET_METADATA = "GetMetadata"; String DIALET = "Dialect"; String IDENTIFIER = "Identifier"; String METADATA = "Metadata"; String METADATA_SECTION = "MetadataSection"; String METADATA_REFERENCE = "MetadataReference"; String LOCATION = "Location"; String TYPE = "type"; String DIALECT_TYPE_WSDL = "http://schemas.xmlsoap.org/wsdl/"; String DIALECT_TYPE_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy"; String DIALECT_TYPE_SCHEMA = "http://www.w3.org/2001/XMLSchema"; } // Following constants used for configuring Data Locator in axis.xml and services.xml String DATA_LOCATOR_ELEMENT = "dataLocator"; String DIALECT_LOCATOR_ELEMENT = "dialectLocator"; String DIALECT_ATTRIBUTE = "dialect"; String CLASS_ATTRIBUTE = "class"; // Service level and Global level type Data Locator String SERVICE_LEVEL = "ServiceLevel"; String GLOBAL_LEVEL = "GlobalLevel"; /** * Defines contants references in Service Data */ public interface SERVICE_DATA { String FILE_NAME = "ServiceData.xml"; String FILE_TYPE = "svcData"; String DATA = "Data"; String ENDPOINT_REFERENCE = "EndpointReference"; String URL = "URL"; String FILE = "file"; String DIALECT = "dialect"; String IDENTIFIER = "identifier"; } } ./src/org/apache/axis2/dataretrieval/SchemaSupplier.java0000664000175000017500000000264511767656530022457 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisService; import org.apache.ws.commons.schema.XmlSchema; /** * Return a XMLSchema as an OMElement. This is used by any AxisService that wishes * to override the standard AxisService2WSDL (see the org.apache.axis2.description * package) method of getting XSD. If one of these is present in the AxisService * Parameters under the name "SchemaSupplier", it will be queried. */ public interface SchemaSupplier { XmlSchema getSchema(AxisService service, String xsd) throws AxisFault; } ./src/org/apache/axis2/dataretrieval/DataLocatorFactory.java0000664000175000017500000000534211767656530023255 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; /** * Factory to constructor Axis2 Data Locators based on the specified * Dialect. */ public class DataLocatorFactory { private static org.apache.axis2.dataretrieval.WSDLDataLocator wsdlDataLocator = null; private static org.apache.axis2.dataretrieval.PolicyDataLocator policyDataLocator = null; private static org.apache.axis2.dataretrieval.SchemaDataLocator schemaDataLocator = null; /* * Return instance of default Data Locator for the dialect. */ public static AxisDataLocator createDataLocator(String dialect) { return (createDataLocator(dialect, null)); } public static AxisDataLocator createDataLocator(String dialect, ServiceData[] serviceDataArray) { AxisDataLocator dataLocator; if (dialect.equals(DRConstants.SPEC.DIALECT_TYPE_WSDL)) { dataLocator = getWsdlDataLocator(serviceDataArray); } else if (dialect.trim().equals(DRConstants.SPEC.DIALECT_TYPE_POLICY)) { if (policyDataLocator == null) { dataLocator = new PolicyDataLocator(serviceDataArray); } else { dataLocator = policyDataLocator; } } else if (dialect.equals(DRConstants.SPEC.DIALECT_TYPE_SCHEMA)) { if (schemaDataLocator == null) { dataLocator = new SchemaDataLocator(serviceDataArray); } else { dataLocator = schemaDataLocator; } } else { dataLocator = null; } return dataLocator; } protected static AxisDataLocator getWsdlDataLocator(ServiceData[] serviceDataArray) { if (wsdlDataLocator == null) { wsdlDataLocator = new org.apache.axis2.dataretrieval.WSDLDataLocator(serviceDataArray); } else { wsdlDataLocator.setServiceData(serviceDataArray); } return wsdlDataLocator; } } ./src/org/apache/axis2/dataretrieval/BaseAxisDataLocator.java0000664000175000017500000001216311767656530023344 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMElement; import org.apache.axis2.context.MessageContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.ArrayList; /** * BaseAxisDataLocator implements common code and serves as a base class * for the supported default Axis2 dialect data locators. */ public abstract class BaseAxisDataLocator { private static final Log log = LogFactory.getLog(BaseAxisDataLocator.class); protected ServiceData[] dataList = null; private OutputForm outputform = OutputForm.INLINE_FORM; /** * The default Axis2 Data locator getData API * Checks data information configured in ServiceData.xml for the supported * output forms: inline, url, EndpointReference. *

        * Note: Subclass that has its implementation of outInlineForm, outputLocationForm, * and outputReferenceForm logic must implement the getData API. */ public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException { log.trace("Default Base DataLocator getData starts"); OutputForm outputform = (OutputForm) request.getOutputForm(); if (outputform == null) { // not defined, defualt to inline outputform = OutputForm.INLINE_FORM; } Data[] output = null; String outputFormString = outputform.getType(); if (outputform == OutputForm.INLINE_FORM) { output = outputInlineForm(msgContext, dataList); } else if (outputform == OutputForm.LOCATION_FORM) { output = outputLocationForm(dataList); } else if (outputform == OutputForm.REFERENCE_FORM) { output = outputReferenceForm(msgContext, dataList); } else { output = outputInlineForm(msgContext, dataList); } if (output == null) { log.info( "Null data return! Data Locator does not know how to handle request for dialect= " + (String) request.getDialect() + " in the form of " + outputFormString); } log.trace("Default Base DataLocator getData ends"); return output; } /* * WSDL or a policy document */ protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] serviceData) throws DataRetrievalException { OMElement metaElement = null; ArrayList result = new ArrayList(); if (serviceData != null) { int size = serviceData.length; for (int i = 0; i < size; i++) { metaElement = serviceData[i].getFileContent(msgContext .getAxisService().getClassLoader()); if (metaElement != null) { result.add(new Data(metaElement, serviceData[i].getIdentifier())); } } } return (Data[]) result.toArray(new Data[0]); } protected Data[] outputLocationForm(ServiceData[] serviceData) throws DataRetrievalException { ArrayList result = new ArrayList(); if (serviceData != null) { for (int i = 0; i < serviceData.length; i++) { String urlValue = serviceData[i].getURL(); if (urlValue != null) { result.add(new Data(urlValue, serviceData[i].getIdentifier())); } } } return (Data[]) result.toArray(new Data[0]); } protected Data[] outputReferenceForm(MessageContext msgContext, ServiceData[] serviceData) throws DataRetrievalException { OMElement epr = null; ArrayList result = new ArrayList(); if (serviceData != null) { for (int i = 0; i < serviceData.length; i++) { epr = serviceData[i].getEndpointReference(); if (epr != null) { result.add(new Data((epr), serviceData[i].getIdentifier())); } } } return (Data[]) result.toArray(new Data[0]); } protected void setServiceData(ServiceData[] inServiceData) { this.dataList = inServiceData; } protected OutputForm getOutputForm() { return outputform; } } ./src/org/apache/axis2/dataretrieval/AxisDataLocator.java0000664000175000017500000000362511767656530022554 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axis2.context.MessageContext; /** *

        AxisDataLocator interface defines getData API for retrieving data particularly * metadata like WSDL, Policy, Schema. Web Service engines that have different methods in * storing metadata or different types of data to retrieve may code their version of * Data Locator(s)by implementing the AxisDataLocator interface. Axis 2 support * Data Locator plugin by configuring in Axis2.xml or services.xml.

        */ public interface AxisDataLocator { /** * Retrieves and returns data based on the specified request. * * @param request The {@link DataRetrievalRequest} allow to specify parameters * about the request, and additional information to process the * request. * @param msgContext The {@link MessageContext} from the original request. * @return {@link Data}[] for the request. * @throws DataRetrievalException */ public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException; } ./src/org/apache/axis2/dataretrieval/LocatorType.java0000664000175000017500000000377211767656530022002 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; /** * Defines Data Locator types as described below: * DEFAULT_AXIS - Default Axis2 data locator * GLOBAL_LEVEL - Global level data locator i.e.,plug-in data locator registered * using element in axis2.xml. * GLOBAL_DIALECT - Global level dialect specfic data locator i.e.,plug-in * data locator registered using element in axis2.xml. * SERVICE_LEVEL - Service level data locator i.e. plug-in data locator registered * using element in services.xml. * SERVICE_DIALECT - Service level dialect specific data locator i.e. plug-in data locator registered * using element in services.xml. */ public class LocatorType { int type; public final static LocatorType DEFAULT_AXIS = new LocatorType(0); public final static LocatorType GLOBAL_LEVEL = new LocatorType(1); public final static LocatorType GLOBAL_DIALECT = new LocatorType(2); public final static LocatorType SERVICE_LEVEL = new LocatorType(3); public final static LocatorType SERVICE_DIALECT = new LocatorType(4); protected LocatorType(int intype) { this.type = intype; } public int getType() { return type; } } ./src/org/apache/axis2/dataretrieval/ServiceData.java0000664000175000017500000000631111767656530021717 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import javax.xml.namespace.QName; /** * This represents the service data for a dialect and identifier if specified. * Basically, the Data element defined in the ServiceData.xml packaged in * a Web Service's achieve file. */ public class ServiceData { OMElement data; String identifier; String dialect; String fileName; /** * Constructor * * @param in_data an Data element in the ServiceData. */ public ServiceData(OMElement in_data) { data = in_data; identifier = getAttributeValue(DRConstants.SERVICE_DATA.IDENTIFIER); dialect = getAttributeValue(DRConstants.SERVICE_DATA.DIALECT); fileName = getAttributeValue(DRConstants.SERVICE_DATA.FILE); } public String getAttributeValue(String qName) { String value = null; OMAttribute attribute = data.getAttribute(new QName(qName)); if (attribute != null) { value = attribute.getAttributeValue(); } return value; } // return identifier for this Data element public String getIdentifier() { return identifier; } // return dialect for this Data element public String getDialect() { return dialect; } // return the Data ELement public OMElement getOMData() { return data; } // Get URL from data Element public String getURL() { String urlValue = null; OMElement url = data.getFirstChildWithName(new QName( DRConstants.SERVICE_DATA.URL)); if (url != null) { urlValue = url.getText(); } return urlValue; } // Get ENDPOINT_REFERENCE from Data Element public OMElement getEndpointReference() { OMElement epr = data.getFirstChildWithName(new QName( DRConstants.SERVICE_DATA.ENDPOINT_REFERENCE)); return epr; } // Load the file content of the file specified in the file attribute // in the data element. public OMElement getFileContent(ClassLoader classloader) throws DataRetrievalException { OMElement metaElement = null; if (fileName != null) { DataRetrievalUtil util = DataRetrievalUtil.getInstance(); metaElement = util.buildOM(classloader, fileName); } return metaElement; } } ./src/org/apache/axis2/dataretrieval/WSDLDataLocator.java0000664000175000017500000001330011767656530022410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMElement; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisService2WSDL11; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Axis 2 Data Locator responsibles for retrieving WSDL metadata. */ public class WSDLDataLocator extends BaseAxisDataLocator implements AxisDataLocator { private static final Log log = LogFactory.getLog(WSDLDataLocator.class); String serviceURL = null; AxisService theService = null; String request_Identifier = null; protected WSDLDataLocator() { } /** * Constructor * * @param data an array of ServiceData instance defined in the * ServiceData.xml for the WSDL dialect. */ protected WSDLDataLocator(ServiceData[] data) { dataList = data; } /** * getData API * Implement data retrieval logic for WSDL dialect */ public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException { log.trace("Default WSDL DataLocator getData starts"); request_Identifier = request.getIdentifier(); serviceURL = msgContext.getTo().getAddress(); OutputForm outputform = request.getOutputForm(); if (outputform == null) { // not defined, defualt to inline outputform = OutputForm.INLINE_FORM; } Data[] output; String outputFormString = outputform.getType(); if (outputform == OutputForm.INLINE_FORM) { output = outputInlineForm(msgContext, dataList); } else if (outputform == OutputForm.LOCATION_FORM) { output = outputLocationForm(dataList); } else if (outputform == OutputForm.REFERENCE_FORM) { output = outputReferenceForm(msgContext, dataList); } else { output = outputInlineForm(msgContext, dataList); } if (output == null) { if (log.isTraceEnabled()) { log.trace( "Null data return! Data Locator does not know how to handle request for dialect= " + request.getDialect() + " in the form of " + outputFormString); } } log.trace("Default WSDL DataLocator getData ends"); return output; } /* * (non-Javadoc) * @see org.apache.axis2.dataretrieval.BaseAxisDataLocator#outputInlineForm(org.apache.axis2.context.MessageContext, org.apache.axis2.dataretrieval.ServiceData[]) */ protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] dataList) throws DataRetrievalException { Data[] result = super.outputInlineForm(msgContext, dataList); // Do not generate WSDL if Identifier was specified in the request as // (1) this is to support ?wsdl request; // (2) Data for specified Identifier must be available to satisfy the GetMetadata request. if (result.length == 0) { log.trace("Default WSDL DataLocator attempt to generates WSDL."); if (msgContext != null) { theService = msgContext.getAxisService(); serviceURL = msgContext.getTo().getAddress(); } else { throw new DataRetrievalException("MessageContext was not set!"); } if (request_Identifier == null || request_Identifier.equals(theService.getTargetNamespace())) { AxisService2WSDL11 axisService2WOM; OMElement wsdlElement; try { axisService2WOM = new AxisService2WSDL11(theService); wsdlElement = axisService2WOM.generateOM(); } catch (Exception e) { log.debug(e); throw new DataRetrievalException(e); } if (wsdlElement != null) { log.trace("Default WSDL DataLocator successfully generated WSDL."); result = new Data[1]; result[0] = new Data(wsdlElement, null); } } } return result; } /* * */ protected Data[] outputLocationForm(ServiceData[] serviceData) throws DataRetrievalException { Data[] result = super.outputLocationForm(serviceData); // Do not generate URL if Identifier was specified in the request as // (1) Axis2 ?wsdl URL request is not supporting Identifier; // (2) URL data for specified Identifier must be available to satisfy // the GetMetadata request. if (result.length == 0 && request_Identifier == null) { result = new Data[1]; result[0] = new Data(serviceURL + "?wsdl", null); } return result; } } ./src/org/apache/axis2/dataretrieval/OutputForm.java0000664000175000017500000000257711767656530021663 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; public class OutputForm { String type; /** * Possible Output formats as stated in of * in the WS-MEX specification. */ public final static OutputForm INLINE_FORM = new OutputForm("INLINE_FORM"); public final static OutputForm LOCATION_FORM = new OutputForm("LOCATION_FORM"); public final static OutputForm REFERENCE_FORM = new OutputForm("REFERENCE_FORM"); protected OutputForm(String intype) { this.type = intype; } public String getType() { return type; } } ./src/org/apache/axis2/dataretrieval/SchemaDataLocator.java0000664000175000017500000001075411767656530023051 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.dataretrieval; import org.apache.axiom.om.OMNode; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.util.XMLUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; import javax.xml.stream.XMLStreamException; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.Iterator; /** * Axis 2 Data Locator responsibles for retrieving Schema metadata. The class is * created as model for schema specific data locator; and also easier for any * future implementation schema specific data retrieval logic. */ public class SchemaDataLocator extends BaseAxisDataLocator implements AxisDataLocator { private String requestIdentifier = null; private String serviceEPR = null; /** * */ private static final Log LOG = LogFactory.getLog(SchemaDataLocator.class .getClass().getName()); protected SchemaDataLocator() { } /** * Constructor */ protected SchemaDataLocator(ServiceData[] data) { dataList = data; } public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException { requestIdentifier = request.getIdentifier(); serviceEPR = msgContext.getTo().getAddress(); OutputForm outputForm = request.getOutputForm(); if (outputForm == null) { outputForm = OutputForm.INLINE_FORM; } Data[] data; if (outputForm == OutputForm.INLINE_FORM) { data = outputInlineForm(msgContext, dataList); } else if (outputForm == OutputForm.LOCATION_FORM) { data = outputLocationForm(dataList); } else { data = outputReferenceForm(msgContext, dataList); } return data; } protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] serviceData) throws DataRetrievalException { Data[] data = super.outputInlineForm(msgContext, serviceData); if (data.length != 0) { return data; } AxisService axisService = msgContext.getAxisService(); ArrayList schemaList = axisService.getSchema(); ArrayList results = new ArrayList(); XmlSchema schema; for (Iterator iterator = schemaList.iterator(); iterator.hasNext();) { schema = (XmlSchema) iterator.next(); if (requestIdentifier != null) { if (requestIdentifier.equals(schema.getTargetNamespace())) { results.add(new Data(convertToOM(schema), requestIdentifier)); } } else { results.add(new Data(convertToOM(schema), null)); } } return (Data[]) results.toArray(new Data[results.size()]); } protected Data[] outputLocationForm(ServiceData[] serviceData) throws DataRetrievalException { Data[] data = super.outputLocationForm(serviceData); if (data != null && data.length != 0) { return data; } return new Data[] { new Data(serviceEPR + "?xsd", requestIdentifier) }; } private OMNode convertToOM(XmlSchema schema) throws DataRetrievalException { StringWriter writer = new StringWriter(); schema.write(writer); StringReader reader = new StringReader(writer.toString()); try { return XMLUtils.toOM(reader); } catch (XMLStreamException e) { throw new DataRetrievalException( "Can't convert XmlSchema object to an OMElement", e); } } } ./src/org/apache/axis2/databinding/0000775000175000017500000000000011767656530016276 5ustar brianbrian./src/org/apache/axis2/databinding/ADBBean.java0000664000175000017500000000436711767656530020327 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import org.apache.axiom.om.OMFactory; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.Serializable; /* * ADBBean - Axis Data Binding Bean. This will be implemented by all the beans that are being generated by * Axis2 data binding framework */ public interface ADBBean extends Serializable { /** * Serializes an ADBBean. Gets the pull parser and fetches the XML pull events to represent the * bean. * * @param adbBeanQName the name of the element to be generated for this ADBBean. * @return Returns a pull parser for this ADBBean. */ public XMLStreamReader getPullParser(QName adbBeanQName) throws XMLStreamException; public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException; public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException; /** * There will be a self factory in every generated data bound class XXX: * public static XXX read (XMLStreamReader); */ } ./src/org/apache/axis2/databinding/ADBDataSource.java0000664000175000017500000001457111767656530021512 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.StAXUtils; import org.apache.axis2.databinding.utils.writer.MTOMAwareOMBuilder; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.HashMap; public abstract class ADBDataSource implements OMDataSourceExt { protected QName parentQName; private ADBBean bean; HashMap map = null; // Map of properties /** * Constructor taking in an ADBBean * * @param bean */ protected ADBDataSource(ADBBean bean, QName parentQName) { this.bean = bean; this.parentQName = parentQName; } /** * @param output * @param format * @throws XMLStreamException * @see OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat) */ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); serialize(xmlStreamWriter); xmlStreamWriter.flush(); } /** * @param writer * @param format * @throws XMLStreamException * @see OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat) */ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); serialize(xmlStreamWriter); xmlStreamWriter.flush(); } /** * This needs to be generated inside the ADB bean * * @param xmlWriter * @throws XMLStreamException * @see OMDataSource#serialize(javax.xml.stream.XMLStreamWriter) */ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException{ MTOMAwareXMLStreamWriter mtomAwareXMLStreamWriter = new MTOMAwareXMLSerializer(xmlWriter); serialize(mtomAwareXMLStreamWriter); mtomAwareXMLStreamWriter.flush(); } public abstract void serialize(MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException; /** * @throws XMLStreamException * @see org.apache.axiom.om.OMDataSource#getReader() */ public XMLStreamReader getReader() throws XMLStreamException { // since only ADBBeans related to elements can be serialized // we are safe in passing null here. MTOMAwareOMBuilder mtomAwareOMBuilder = new MTOMAwareOMBuilder(); serialize(mtomAwareOMBuilder); return mtomAwareOMBuilder.getOMElement().getXMLStreamReader(); } /** * Returns the backing Object. * @return Object */ public Object getObject() { return bean; } /** * Returns true if reading the backing object is destructive. * An example of an object with a destructive read is an InputSteam. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when reading the OMDataSourceExt. * @return boolean */ public boolean isDestructiveRead() { return false; } /** * Returns true if writing the backing object is destructive. * An example of an object with a destructive write is an InputStream. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when writing the OMDataSourceExt. * @return boolean */ public boolean isDestructiveWrite() { return false; } /** * Returns a InputStream representing the xml data * @param encoding String encoding of InputStream * @return InputStream */ public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException { return new ByteArrayInputStream(getXMLBytes(encoding)); } /** * Returns a byte[] representing the xml data * @param encoding String encoding of InputStream * @return byte[] * @see getXMLInputStream */ public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); try { serialize(baos, format); } catch (XMLStreamException e) { new OMException(e); } return baos.toByteArray(); } /** * Close the DataSource and free its resources. */ public void close() { parentQName = null; bean = null; } public OMDataSourceExt copy() { return null; } public Object getProperty(String key) { if (map == null) { return null; } return map.get(key); } public Object setProperty(String key, Object value) { if (map == null) { map = new HashMap(); } return map.put(key, value); } public boolean hasProperty(String key) { if (map == null) { return false; } return map.containsKey(key); } } ./src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java0000664000175000017500000001636211767656530022512 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import org.apache.axiom.om.OMFactory; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter; import org.apache.axis2.util.StreamWrapper; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** Builds a SOAPEnvelope around an ADB pull parser */ public class ADBSOAPModelBuilder extends StAXSOAPModelBuilder { public ADBSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory) { super(new Envelope(parser). getPullParser( new QName(factory.getSoapVersionURI(), SOAPConstants.SOAPENVELOPE_LOCAL_NAME, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX)), factory, factory.getSoapVersionURI()); } public SOAPEnvelope getEnvelope() { return getSOAPEnvelope(); } public static class Envelope implements org.apache.axis2.databinding.ADBBean { Body body; Envelope(XMLStreamReader parser) { body = new Body(parser); } public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { java.util.ArrayList elementList = new java.util.ArrayList(); elementList.add(new QName(qName.getNamespaceURI(), "Header", SOAPConstants.BODY_NAMESPACE_PREFIX)); elementList.add(new Header()); elementList.add(new QName(qName.getNamespaceURI(), "Body", SOAPConstants.BODY_NAMESPACE_PREFIX)); elementList.add(body); return new StreamWrapper(new org.apache.axis2.databinding.utils.reader. ADBXMLStreamReaderImpl(qName, elementList.toArray(), null)); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException { serialize(parentQName,factory,xmlWriter,false); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException { throw new UnsupportedOperationException("Un implemented method"); } } protected void identifySOAPVersion(String soapVersionURIFromTransport) { //Do nothing } public static class Body implements org.apache.axis2.databinding.ADBBean { Child child; Body(XMLStreamReader parser) { child = new Child(parser); } public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { java.util.ArrayList elementList = new java.util.ArrayList(); elementList.add(qName); elementList.add(child); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), null); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException { serialize(parentQName,factory,xmlWriter,false); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException { throw new UnsupportedOperationException("Un implemented method"); } } public static class Header implements org.apache.axis2.databinding.ADBBean { public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { java.util.ArrayList elementList = new java.util.ArrayList(); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), null); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException { serialize(parentQName,factory,xmlWriter,false); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException { throw new UnsupportedOperationException("Un implemented method"); } } public static class Child implements org.apache.axis2.databinding.ADBBean { XMLStreamReader parser; Child(XMLStreamReader parser) { this.parser = parser; } public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { return parser; } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException { serialize(parentQName,factory,xmlWriter,false); } public void serialize(final QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException { throw new UnsupportedOperationException("Un implemented method"); } } } ./src/org/apache/axis2/databinding/typemapping/0000775000175000017500000000000011767656530020633 5ustar brianbrian./src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java0000664000175000017500000002645211767656530024747 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.typemapping; import org.apache.axiom.attachments.utils.DataHandlerUtils; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axis2.databinding.utils.ConverterUtil; import javax.activation.DataHandler; import javax.xml.namespace.QName; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import java.util.TimeZone; public class SimpleTypeMapper { private static final String STRING = "java.lang.String"; private static final String W_INT = "java.lang.Integer"; private static final String W_DOUBLE = "java.lang.Double"; private static final String W_LONG = "java.lang.Long"; private static final String W_BYTE = "java.lang.Byte"; private static final String W_SHORT = "java.lang.Short"; private static final String W_BOOLEAN = "java.lang.Boolean"; private static final String W_CHAR = "java.lang.Character"; private static final String W_FLOAT = "java.lang.Float"; private static final String W_CALENDAR = "java.util.Calendar"; private static final String W_DATE = "java.util.Date"; private static final String INT = "int"; private static final String BOOLEAN = "boolean"; private static final String BYTE = "byte"; private static final String DOUBLE = "double"; private static final String SHORT = "short"; private static final String LONG = "long"; private static final String FLOAT = "float"; private static final String CHAR = "char"; /* * To support deserialize BigDecimal, BigInteger * Day, Duration, Month, MonthDay, Time, Year, YearMonth */ private static final String BIG_DECIMAL = "java.math.BigDecimal"; private static final String BIG_INTEGER = "java.math.BigInteger"; private static final String DAY = "org.apache.axis2.databinding.types.Day"; private static final String DURATION = "org.apache.axis2.databinding.types.Duration"; private static final String MONTH = "org.apache.axis2.databinding.types.Month"; private static final String MONTH_DAY = "org.apache.axis2.databinding.types.MonthDay"; private static final String TIME = "org.apache.axis2.databinding.types.Time"; private static final String YEAR = "org.apache.axis2.databinding.types.Year"; private static final String YEAR_MONTH = "org.apache.axis2.databinding.types.YearMonth"; public static Object getSimpleTypeObject(Class parameter, OMElement value) { String name = parameter.getName(); String text = value.getText(); if(name.equals(STRING)) { return text; } else if (text == null || text.length() == 0) { return null; } else if (name.equals(INT)) { return new Integer(text); } else if (name.equals(BOOLEAN)) { return new Boolean(ConverterUtil.convertToBoolean(text)); } else if (name.equals(BYTE)) { return new Byte(text); } else if (name.equals(DOUBLE)) { return new Double(text); } else if (name.equals(SHORT)) { return new Short(text); } else if (name.equals(LONG)) { return new Long(text); } else if (name.equals(FLOAT)) { return new Float(text); } else if (name.equals(CHAR)) { return new Character(text.toCharArray()[0]); } else if (name.equals(W_INT)) { return new Integer(text); } else if (name.equals(W_BOOLEAN)) { return Boolean.valueOf(text); } else if (name.equals(W_BYTE)) { return new Byte(text); } else if (name.equals(W_DOUBLE)) { return new Double(text); } else if (name.equals(W_SHORT)) { return new Short(text); } else if (name.equals(W_LONG)) { return new Long(text); } else if (name.equals(W_FLOAT)) { return new Float(text); } else if (name.equals(W_CHAR)) { return new Character(text.toCharArray()[0]); } else if (name.equals(W_CALENDAR)) { return makeCalendar(text); } else if (name.equals(W_DATE)) { return makeDate(text); }/* * return the correpsonding object for adding data type */ else if(name.equals(BIG_DECIMAL)) { return new java.math.BigDecimal(text); } else if(name.equals(BIG_INTEGER)) { return new java.math.BigInteger(text); } else if(name.equals(DAY)) { return new org.apache.axis2.databinding.types.Day(text); } else if(name.equals(DURATION)) { return new org.apache.axis2.databinding.types.Duration(text); } else if(name.equals(MONTH)) { return new org.apache.axis2.databinding.types.Month(text); } else if(name.equals(MONTH_DAY)) { return new org.apache.axis2.databinding.types.MonthDay(text); } else if(name.equals(TIME)) { return new org.apache.axis2.databinding.types.Time(text); } else if(name.equals(YEAR)) { return new org.apache.axis2.databinding.types.Year(text); } else if(name.equals(YEAR_MONTH)) { return new org.apache.axis2.databinding.types.YearMonth(text); } else { return null; } } public static ArrayList getArrayList(OMElement element, String localName) { Iterator childitr = element.getChildrenWithName(new QName(localName)); ArrayList list = new ArrayList(); while (childitr.hasNext()) { Object o = childitr.next(); list.add(o); } return list; } public static DataHandler getDataHandler(OMElement element) { OMNode node = element.getFirstOMChild(); if (node instanceof OMText) { OMText txt = (OMText)node; if (txt.isOptimized()) { return (DataHandler)txt.getDataHandler(); } else { return (DataHandler)DataHandlerUtils.getDataHandlerFromText(txt.getText(), null); } } return null; } public static ArrayList getArrayList(OMElement element) { Iterator childitr = element.getChildren(); ArrayList list = new ArrayList(); while (childitr.hasNext()) { Object o = childitr.next(); list.add(o); } return list; } public static boolean isSimpleType(Object obj) { String objClassName = obj.getClass().getName(); if (obj instanceof Calendar) { return true; } else if (obj instanceof Date) { return true; } else { return isSimpleType(objClassName); } } public static boolean isSimpleType(Class obj) { String objClassName = obj.getName(); return isSimpleType(objClassName); } public static boolean isDataHandler(Class obj) { return obj.isAssignableFrom(DataHandler.class); } public static boolean isCollection(Class obj) { return java.util.Collection.class.isAssignableFrom(obj); } public static boolean isSimpleType(String objClassName) { if (objClassName.equals(STRING)) { return true; } else if (objClassName.equals(INT)) { return true; } else if (objClassName.equals(BOOLEAN)) { return true; } else if (objClassName.equals(BYTE)) { return true; } else if (objClassName.equals(DOUBLE)) { return true; } else if (objClassName.equals(SHORT)) { return true; } else if (objClassName.equals(LONG)) { return true; } else if (objClassName.equals(FLOAT)) { return true; } else if (objClassName.equals(CHAR)) { return true; } else if (objClassName.equals(W_INT)) { return true; } else if (objClassName.equals(W_BOOLEAN)) { return true; } else if (objClassName.equals(W_BYTE)) { return true; } else if (objClassName.equals(W_DOUBLE)) { return true; } else if (objClassName.equals(W_SHORT)) { return true; } else if (objClassName.equals(W_LONG)) { return true; } else if (objClassName.equals(W_FLOAT)) { return true; } else if (objClassName.equals(W_CALENDAR)) { return true; } else if (objClassName.equals(W_DATE)) { return true; } /* * consider BigDecimal, BigInteger, Day, Duration, Month * MonthDay, Time, Year, YearMonth as simple type */ else if(objClassName.equals(BIG_DECIMAL) || objClassName.equals(BIG_INTEGER) || objClassName.equals(DAY) || objClassName.equals(DURATION) || objClassName.equals(MONTH) || objClassName.equals(MONTH_DAY) || objClassName.equals(TIME) || objClassName.equals(YEAR) || objClassName.equals(YEAR_MONTH)) { return true; } else { return objClassName.equals(W_CHAR); } } public static String getStringValue(Object obj) { if (obj instanceof Float || obj instanceof Double) { double data; if (obj instanceof Float) { data = ((Float)obj).doubleValue(); } else { data = ((Double)obj).doubleValue(); } if (Double.isNaN(data)) { return "NaN"; } else if (data == Double.POSITIVE_INFINITY) { return "INF"; } else if (data == Double.NEGATIVE_INFINITY) { return "-INF"; } else { return obj.toString(); } } else if (obj instanceof Calendar) { SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); zulu.setTimeZone(TimeZone.getTimeZone("GMT")); return zulu.format(((Calendar)obj).getTime()); } else if (obj instanceof Date) { SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); zulu.setTimeZone(TimeZone.getTimeZone("GMT")); return zulu.format(obj); } return obj.toString(); } public static Object makeCalendar(String source) { return ConverterUtil.convertToDateTime(source); } public static Object makeDate(String source) { return ConverterUtil.convertToDateTime(source).getTime(); } } ./src/org/apache/axis2/databinding/utils/0000775000175000017500000000000011767656530017436 5ustar brianbrian./src/org/apache/axis2/databinding/utils/Converter.java0000664000175000017500000001537311767656530022261 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.Set; /** Converter */ public class Converter { public static Object convert(Object arg, Class destClass) { if (destClass == null) { return arg; } Class argHeldType = null; if (arg != null) { argHeldType = getHolderValueType(arg.getClass()); } if (arg != null && argHeldType == null && destClass.isAssignableFrom(arg.getClass())) { return arg; } // See if a previously converted value is stored in the argument. Object destValue = null; // Get the destination held type or the argument held type if they exist Class destHeldType = getHolderValueType(destClass); // Convert between Calendar and Date if (arg instanceof Calendar && destClass == Date.class) { return ((Calendar)arg).getTime(); } if (arg instanceof Date && destClass == Calendar.class) { Calendar calendar = Calendar.getInstance(); calendar.setTime((Date)arg); return calendar; } // Convert between Calendar and java.sql.Date if (arg instanceof Calendar && destClass == java.sql.Date.class) { return new java.sql.Date(((Calendar)arg).getTime().getTime()); } // Convert between HashMap and Hashtable if (arg instanceof HashMap && destClass == Hashtable.class) { return new Hashtable((HashMap)arg); } // If the destination is an array and the source // is a suitable component, return an array with // the single item. if (arg != null && destClass.isArray() && !destClass.getComponentType().equals(Object.class) && destClass.getComponentType().isAssignableFrom(arg.getClass())) { Object array = Array.newInstance(destClass.getComponentType(), 1); Array.set(array, 0, arg); return array; } // Return if no conversion is available if (!(arg instanceof Collection || (arg != null && arg.getClass().isArray())) && ((destHeldType == null && argHeldType == null) || (destHeldType != null && argHeldType != null))) { return arg; } // Flow to here indicates that neither arg or destClass is a Holder if (arg == null) { return arg; } // The arg may be an array or List int length = 0; if (arg.getClass().isArray()) { length = Array.getLength(arg); } else { length = ((Collection)arg).size(); } if (destClass.isArray()) { if (destClass.getComponentType().isPrimitive()) { Object array = Array.newInstance(destClass.getComponentType(), length); // Assign array elements if (arg.getClass().isArray()) { for (int i = 0; i < length; i++) { Array.set(array, i, Array.get(arg, i)); } } else { int idx = 0; for (Iterator i = ((Collection)arg).iterator(); i.hasNext();) { Array.set(array, idx++, i.next()); } } destValue = array; } else { Object [] array; try { array = (Object [])Array.newInstance(destClass.getComponentType(), length); } catch (Exception e) { return arg; } // Use convert to assign array elements. if (arg.getClass().isArray()) { for (int i = 0; i < length; i++) { array[i] = convert(Array.get(arg, i), destClass.getComponentType()); } } else { int idx = 0; for (Iterator i = ((Collection)arg).iterator(); i.hasNext();) { array[idx++] = convert(i.next(), destClass.getComponentType()); } } destValue = array; } } else if (Collection.class.isAssignableFrom(destClass)) { Collection newList = null; try { // if we are trying to create an interface, build something // that implements the interface if (destClass == Collection.class || destClass == java.util.List.class) { newList = new ArrayList(); } else if (destClass == Set.class) { newList = new HashSet(); } else { newList = (Collection)destClass.newInstance(); } } catch (Exception e) { // Couldn't build one for some reason... so forget it. return arg; } if (arg.getClass().isArray()) { for (int j = 0; j < length; j++) { newList.add(Array.get(arg, j)); } } else { for (Iterator j = ((Collection)arg).iterator(); j.hasNext();) { newList.add(j.next()); } } destValue = newList; } else { destValue = arg; } return destValue; } private static Class getHolderValueType(Class aClass) { return null; } } ./src/org/apache/axis2/databinding/utils/SimpleElementReaderStateMachine.java0000664000175000017500000001666211767656530026470 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * A state machine to read elements with simple content. Returns the text of the element and the * stream reader will be one event beyond the end element at return */ public class SimpleElementReaderStateMachine implements States, Constants { private QName elementNameToTest = null; private int currentState = INIT_STATE; private boolean nillable = false; private String text = ""; private String errorMessage = ""; private boolean elementSkipped = false; public boolean isElementSkipped() { return elementSkipped; } /** * */ public String getText() { return text; } /** sets the nillable flag */ public void setNillable() { nillable = true; } /** * the Qname of the element to be tested * * @param elementNameToTest */ public void setElementNameToTest(QName elementNameToTest) { this.elementNameToTest = elementNameToTest; } /** * Resets the state machine. Once the reset is called the state machine is good enough for a * fresh run */ public void reset() { elementNameToTest = null; currentState = INIT_STATE; nillable = false; text = ""; errorMessage = ""; } /** * public read method - reads a given reader to extract the text value * * @param reader */ public void read(XMLStreamReader reader) throws XMLStreamException { do { updateState(reader); //test for the nillable attribute if (currentState == START_ELEMENT_FOUND_STATE && nillable) { if (TRUE.equals(reader.getAttributeValue(XSI_NAMESPACE, NIL))) { text = null; //force the state to be null found currentState = NULLED_STATE; } } if (currentState == TEXT_FOUND_STATE) { //read the text value and store it text = reader.getText(); } if (currentState != FINISHED_STATE && currentState != ILLEGAL_STATE) { reader.next(); } } while (currentState != FINISHED_STATE && currentState != ILLEGAL_STATE); if (currentState == ILLEGAL_STATE) { throw new RuntimeException("Illegal state!" + errorMessage); } } /** * Updates the state depending on the parser * * @param reader */ private void updateState(XMLStreamReader reader) throws XMLStreamException { int event = reader.getEventType(); switch (currentState) { case INIT_STATE: if (event == XMLStreamConstants.START_DOCUMENT) { currentState = STARTED_STATE; //start element found at init } else if (event == XMLStreamConstants.START_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = START_ELEMENT_FOUND_STATE; } else { currentState = STARTED_STATE; } } else if (event == XMLStreamConstants.END_ELEMENT) { // an end element is found at the init state // we should break the process here ? currentState = FINISHED_STATE; elementSkipped = true; } break; case STARTED_STATE: if (event == XMLStreamConstants.START_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = START_ELEMENT_FOUND_STATE; } } break; case START_ELEMENT_FOUND_STATE: if (event == XMLStreamConstants.CHARACTERS) { currentState = TEXT_FOUND_STATE; } else if (event == XMLStreamConstants.END_ELEMENT) { //force the text to be empty! text = ""; if (elementNameToTest.equals(reader.getName())) { currentState = END_ELEMENT_FOUND_STATE; } else { currentState = ILLEGAL_STATE; errorMessage = "Wrong element name " + reader.getName(); //todo I18n this } } break; case TEXT_FOUND_STATE: if (event == XMLStreamConstants.END_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = END_ELEMENT_FOUND_STATE; } else { currentState = ILLEGAL_STATE; //set the error message errorMessage = "Wrong element name " + reader.getName(); //todo I18n this } } else if (event == XMLStreamConstants.CHARACTERS) { text = text + reader.getText(); //append the text //do not change the state } break; case END_ELEMENT_FOUND_STATE: currentState = FINISHED_STATE; break; //the element was found to be null and this state was forced. //we are sure here that the parser was at the //START_ELEMENT_FOUND_STATE before //being forced. Hence we need to advance the parser upto the // end element and set the state to be end element found case NULLED_STATE: while (event != XMLStreamConstants.END_ELEMENT) { event = reader.next(); } currentState = END_ELEMENT_FOUND_STATE; break; default: if (event == XMLStreamConstants.CHARACTERS) { if (reader.getText().trim().length() == 0) { //the text is empty - don't change the state } else { //we do NOT handle mixed content currentState = ILLEGAL_STATE; errorMessage = "Mixed Content " + reader.getText(); } } else { currentState = ILLEGAL_STATE; errorMessage = "Current state is " + currentState; } break; } } } ./src/org/apache/axis2/databinding/utils/reader/0000775000175000017500000000000011767656530020700 5ustar brianbrian./src/org/apache/axis2/databinding/utils/reader/NameValueArrayStreamReader.java0000664000175000017500000002625111767656530026724 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; public class NameValueArrayStreamReader implements ADBXMLStreamReader { private static final int START_ELEMENT_STATE = 0; private static final int TEXT_STATE = 1; private static final int END_ELEMENT_STATE = 2; private static final int FINAL_END_ELEMENT_STATE = 3; private static final int START_ELEMENT_STATE_WITH_NULL = 4; private static final QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi"); private static final String NIL_VALUE_TRUE = "true"; private ADBNamespaceContext namespaceContext = new ADBNamespaceContext(); //the index of the array private int arrayIndex = 0; private QName name; private String[] values; //start element is the default state private int state = START_ELEMENT_STATE; public NameValueArrayStreamReader(QName name, String[] values) { this.name = name; this.values = values; } public void addNamespaceContext(NamespaceContext nsContext) { this.namespaceContext.setParentNsContext(nsContext); } public void init() { //todo what if the Qname namespace has not been declared } public Object getProperty(String string) throws IllegalArgumentException { return null; } /** @throws XMLStreamException */ public int next() throws XMLStreamException { switch (state) { case START_ELEMENT_STATE: if (values.length > 0) { state = TEXT_STATE; return CHARACTERS; } else { state = FINAL_END_ELEMENT_STATE; return END_ELEMENT; } case START_ELEMENT_STATE_WITH_NULL: if (arrayIndex == (values.length - 1)) { state = FINAL_END_ELEMENT_STATE; } else { state = END_ELEMENT_STATE; } return END_ELEMENT; case FINAL_END_ELEMENT_STATE: //oops, not supposed to happen! throw new XMLStreamException("end already reached!"); case END_ELEMENT_STATE: //we've to have more values since this is not the //last value //increment the counter arrayIndex++; if (values[arrayIndex] == null) { state = START_ELEMENT_STATE_WITH_NULL; } else { state = START_ELEMENT_STATE; } return START_ELEMENT; case TEXT_STATE: if (arrayIndex == (values.length - 1)) { state = FINAL_END_ELEMENT_STATE; return END_ELEMENT; } else { state = END_ELEMENT_STATE; return END_ELEMENT; } default: throw new XMLStreamException("unknown event type!"); } } public void require(int i, String string, String string1) throws XMLStreamException { //nothing done here } public String getElementText() throws XMLStreamException { return null; //not implemented } public int nextTag() throws XMLStreamException { return 0; //not implemented } public String getAttributeValue(String string, String string1) { if (state == TEXT_STATE) { //todo something return null; } else { return null; } } public int getAttributeCount() { if (state == START_ELEMENT_STATE_WITH_NULL) return 1; if (state == START_ELEMENT_STATE) { return 0; } else { throw new IllegalStateException(); } } public QName getAttributeName(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) return NIL_QNAME; if (state == START_ELEMENT_STATE) { return null; } else { throw new IllegalStateException(); } } public String getAttributeNamespace(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) return NIL_QNAME.getNamespaceURI(); if (state == START_ELEMENT_STATE) { return null; } else { throw new IllegalStateException(); } } public String getAttributeLocalName(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) return NIL_QNAME.getLocalPart(); if (state == START_ELEMENT_STATE) { return null; } else { throw new IllegalStateException(); } } public String getAttributePrefix(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) return NIL_QNAME.getPrefix(); if (state == START_ELEMENT_STATE) { return null; } else { throw new IllegalStateException(); } } public String getAttributeType(int i) { return null; //not implemented } public String getAttributeValue(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) return NIL_VALUE_TRUE; if (state == START_ELEMENT_STATE) { return null; } else { throw new IllegalStateException(); } } public boolean isAttributeSpecified(int i) { return false; //not supported } public int getNamespaceCount() { if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent()) return 1; else return 0; } public String getNamespacePrefix(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) return NIL_QNAME.getPrefix(); else return null; } public String getNamespaceURI(int i) { if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) return NIL_QNAME.getNamespaceURI(); else return null; } public NamespaceContext getNamespaceContext() { return this.namespaceContext; } public boolean isDone() { return (state == FINAL_END_ELEMENT_STATE); } public int getEventType() { switch (state) { case START_ELEMENT_STATE: return START_ELEMENT; case END_ELEMENT_STATE: return END_ELEMENT; case TEXT_STATE: return CHARACTERS; case FINAL_END_ELEMENT_STATE: return END_ELEMENT; default: throw new UnsupportedOperationException(); //we've no idea what this is!!!!! } } public String getText() { if (state == TEXT_STATE) { return values[arrayIndex]; } else { throw new IllegalStateException(); } } public char[] getTextCharacters() { if (state == TEXT_STATE) { return values[arrayIndex].toCharArray(); } else { throw new IllegalStateException(); } } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { //not implemented throw new UnsupportedOperationException(); } public int getTextStart() { if (state == TEXT_STATE) { return 0; } else { throw new IllegalStateException(); } } public int getTextLength() { if (state == TEXT_STATE) { return values[arrayIndex].length(); } else { throw new IllegalStateException(); } } public String getEncoding() { return null; } public boolean hasText() { return (state == TEXT_STATE); } public Location getLocation() { return null; //not supported } public QName getName() { if (state != TEXT_STATE) { return name; } else { return null; } } public String getLocalName() { if (state != TEXT_STATE) { return name.getLocalPart(); } else { return null; } } public boolean hasName() { return (state != TEXT_STATE); } public String getNamespaceURI() { if (state != TEXT_STATE) { return name.getNamespaceURI(); } else { return null; } } public String getPrefix() { if (state != TEXT_STATE) { return name.getPrefix(); } else { return null; } } public String getVersion() { return null; //todo 1.0 ? } public boolean isStandalone() { return false; } public boolean standaloneSet() { return false; } public String getCharacterEncodingScheme() { return null; } public String getPITarget() { return null; } public String getPIData() { return null; } public boolean hasNext() throws XMLStreamException { return (state != FINAL_END_ELEMENT_STATE); } public void close() throws XMLStreamException { //Do nothing - we've nothing to free here } public String getNamespaceURI(String prefix) { return namespaceContext.getNamespaceURI(prefix); } public boolean isStartElement() { return (state == START_ELEMENT_STATE); } public boolean isEndElement() { return (state == END_ELEMENT_STATE); } public boolean isCharacters() { return (state == TEXT_STATE); } public boolean isWhiteSpace() { return false; //no whitespaces here } /** * @param prefix * @param uri */ private void addToNsMap(String prefix, String uri) { //todo - need to fix this up to cater for cases where //namespaces are having no prefixes if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) { //this namespace is not there. Need to declare it namespaceContext.pushNamespace(prefix, uri); } } /** Test whether the xsi namespace is present */ private boolean isXsiNamespacePresent() { return (namespaceContext.getNamespaceURI(NIL_QNAME.getPrefix()) != null); } } ./src/org/apache/axis2/databinding/utils/reader/ADBDataHandlerStreamReader.java0000664000175000017500000002341111767656530026521 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import org.apache.axis2.databinding.utils.ConverterUtil; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; public class ADBDataHandlerStreamReader implements ADBXMLStreamReader { private static final int START_ELEMENT_STATE = 0; private static final int TEXT_STATE = 1; private static final int END_ELEMENT_STATE = 2; private ADBNamespaceContext namespaceContext = new ADBNamespaceContext(); private QName name; private DataHandler value; private int state = START_ELEMENT_STATE; //initiate at the start element state //keeps track whether the namespace is declared //false by default private boolean nsDeclared = false; public ADBDataHandlerStreamReader(QName name, DataHandler value) { this.name = name; this.value = value; } private String convertedText = null; /** * Return the right properties for the optimization * * @param propKey * @throws IllegalArgumentException */ public Object getProperty(String propKey) throws IllegalArgumentException { if (OPTIMIZATION_ENABLED.equals(propKey)) { return Boolean.TRUE; } if (state == TEXT_STATE) { if (IS_BINARY.equals(propKey)) { return Boolean.TRUE; } else if (DATA_HANDLER.equals(propKey)) { return value; } } return null; } public int next() throws XMLStreamException { //no need to handle null here. it should have been handled //already switch (state) { case START_ELEMENT_STATE: state = TEXT_STATE; return CHARACTERS; case END_ELEMENT_STATE: //oops, not supposed to happen! throw new XMLStreamException("end already reached!"); case TEXT_STATE: state = END_ELEMENT_STATE; return END_ELEMENT; default: throw new XMLStreamException("unknown event type!"); } } public void require(int i, String string, String string1) throws XMLStreamException { //not implemented } public String getElementText() throws XMLStreamException { if (state == START_ELEMENT) { //move to the end state and return the value state = END_ELEMENT_STATE; if (convertedText == null) { convertedText = ConverterUtil.getStringFromDatahandler(value); } return convertedText; } else { throw new XMLStreamException(); } } public int nextTag() throws XMLStreamException { return 0;//todo } public boolean hasNext() throws XMLStreamException { return (state != END_ELEMENT_STATE); } public void close() throws XMLStreamException { //Do nothing - we've nothing to free here } public String getNamespaceURI(String prefix) { return namespaceContext.getNamespaceURI(prefix); } public boolean isStartElement() { return (state == START_ELEMENT_STATE); } public boolean isEndElement() { return (state == END_ELEMENT_STATE); } public boolean isCharacters() { return (state == TEXT_STATE); } public boolean isWhiteSpace() { return false; //no whitespaces here } public String getAttributeValue(String string, String string1) { return null; } public int getAttributeCount() { return 0; } public QName getAttributeName(int i) { return null; } public String getAttributeNamespace(int i) { return null; } public String getAttributeLocalName(int i) { return null; } public String getAttributePrefix(int i) { return null; } public String getAttributeType(int i) { return null; } public String getAttributeValue(int i) { return null; } public boolean isAttributeSpecified(int i) { return false; //no attribs here } public int getNamespaceCount() { return (nsDeclared) ? 1 : 0; } public String getNamespacePrefix(int i) { return (nsDeclared && i == 0) ? name.getPrefix() : null; } public String getNamespaceURI(int i) { return (nsDeclared && i == 0) ? name.getNamespaceURI() : null; } public NamespaceContext getNamespaceContext() { return this.namespaceContext; } public int getEventType() { switch (state) { case START_ELEMENT_STATE: return START_ELEMENT; case END_ELEMENT_STATE: return END_ELEMENT; case TEXT_STATE: return CHARACTERS; default: throw new UnsupportedOperationException(); //we've no idea what this is!!!!! } } public String getText() { if (state == TEXT_STATE) { if (convertedText == null) { convertedText = ConverterUtil.getStringFromDatahandler(value); } return convertedText; } else { throw new IllegalStateException(); } } public char[] getTextCharacters() { if (state == TEXT_STATE) { if (convertedText == null) { convertedText = ConverterUtil.getStringFromDatahandler(value); } return convertedText.toCharArray(); } else { throw new IllegalStateException(); } } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { //not implemented throw new UnsupportedOperationException(); } public int getTextStart() { if (state == TEXT_STATE) { return 0; } else { throw new IllegalStateException(); } } public int getTextLength() { if (state == TEXT_STATE) { if (convertedText == null) { convertedText = ConverterUtil.getStringFromDatahandler(value); } return convertedText.length(); } else { throw new IllegalStateException(); } } public String getEncoding() { return null; } public boolean hasText() { return (state == TEXT_STATE); } public Location getLocation() { return new Location() { public int getLineNumber() { return 0; } public int getColumnNumber() { return 0; } public int getCharacterOffset() { return 0; } public String getPublicId() { return null; } public String getSystemId() { return null; } }; } public QName getName() { if (state != TEXT_STATE) { return name; } else { return null; } } public String getLocalName() { if (state != TEXT_STATE) { return name.getLocalPart(); } else { return null; } } public boolean hasName() { return (state != TEXT_STATE); } public String getNamespaceURI() { if (state != TEXT_STATE) { return name.getNamespaceURI(); } else { return null; } } public String getPrefix() { if (state != TEXT_STATE) { return name.getPrefix(); } else { return null; } } public String getVersion() { return null; //todo 1.0 ? } public boolean isStandalone() { return false; } public boolean standaloneSet() { return false; } public String getCharacterEncodingScheme() { return null; } public String getPITarget() { return null; } public String getPIData() { return null; } public boolean isDone() { return (state == END_ELEMENT_STATE); } public void addNamespaceContext(NamespaceContext nsContext) { this.namespaceContext.setParentNsContext(nsContext); } public void init() { //just add the current elements namespace and prefix to the this //elements nscontext addToNsMap(name.getPrefix(), name.getNamespaceURI()); } /** * @param prefix * @param uri */ private void addToNsMap(String prefix, String uri) { //todo - need to fix this up to cater for cases where //namespaces are having no prefixes if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) { //this namespace is not there. Need to declare it namespaceContext.pushNamespace(prefix, uri); nsDeclared = true; } } } ./src/org/apache/axis2/databinding/utils/reader/ADBNamespaceContext.java0000664000175000017500000001036111767656530025314 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import org.apache.axis2.util.ArrayStack; import javax.xml.namespace.NamespaceContext; import java.util.ArrayList; import java.util.Iterator; public class ADBNamespaceContext implements NamespaceContext { private NamespaceContext parentNsContext; public NamespaceContext getParentNsContext() { return parentNsContext; } public void setParentNsContext(NamespaceContext parentNsContext) { this.parentNsContext = parentNsContext; } //Keep two arraylists for the prefixes and namespaces. They should be in sync //since the index of the entry will be used to relate them //use the minimum initial capacity to let things handle memory better private ArrayStack prefixStack = new ArrayStack(); private ArrayStack uriStack = new ArrayStack(); /** * Register a namespace in this context * * @param prefix * @param uri */ public void pushNamespace(String prefix, String uri) { prefixStack.push(prefix); uriStack.push(uri); } /** Pop a namespace */ public void popNamespace() { prefixStack.pop(); uriStack.pop(); } public String getNamespaceURI(String prefix) { //do the corrections as per the javadoc if (prefixStack.contains(prefix)) { int index = prefixStack.indexOf(prefix); return (String)uriStack.get(index); } if (parentNsContext != null) { return parentNsContext.getPrefix(prefix); } return null; } public String getPrefix(String uri) { //do the corrections as per the javadoc int index = uriStack.indexOf(uri); if (index != -1) { return (String)prefixStack.get(index); } if (parentNsContext != null) { return parentNsContext.getPrefix(uri); } return null; } public Iterator getPrefixes(String uri) { //create an arraylist that contains the relevant prefixes String[] uris = (String[])uriStack.toArray(new String[uriStack.size()]); ArrayList tempList = new ArrayList(); for (int i = 0; i < uris.length; i++) { if (uris[i].equals(uri)) { tempList.add(prefixStack.get(i)); //we assume that array conversion preserves the order } } //by now all the relevant prefixes are collected //make a new iterator and provide a wrapper iterator to //obey the contract on the API return new WrappingIterator(tempList.iterator()); } private class WrappingIterator implements Iterator { private Iterator containedIterator = null; public WrappingIterator(Iterator containedIterator) { this.containedIterator = containedIterator; } public Iterator getContainedIterator() { return containedIterator; } public void setContainedIterator(Iterator containedIterator) { this.containedIterator = containedIterator; } /** * As per the contract on the API of Namespace context the returned iterator should be * immutable */ public void remove() { throw new UnsupportedOperationException(); } public boolean hasNext() { return containedIterator.hasNext(); } public Object next() { return containedIterator.next(); } } } ./src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReader.java0000664000175000017500000000337211767656530025016 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import org.apache.axis2.databinding.utils.Constants; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamReader; public interface ADBXMLStreamReader extends XMLStreamReader, Constants { // this will help to handle Text within the current element. // user should pass the element text to the property list as this // ELEMENT_TEXT as the key. This key deliberately has a space in it // so that it is not a valid XML name static final String ELEMENT_TEXT = "Element Text"; /** Extra method to query the state of the pullparser */ boolean isDone(); /** add the parent namespace context to this parser */ void addNamespaceContext(NamespaceContext nsContext); /** * Initiate the parser - this will do whatever the needed tasks to initiate the parser and must * be called before attempting any specific parsing using this parser */ void init(); } ./src/org/apache/axis2/databinding/utils/reader/OMElementKey.java0000664000175000017500000000175111767656530024045 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; /** * A dummy class that creates nothing but a key for the OMElement when it is passed to the * ADBPullparser */ public class OMElementKey { } ./src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java0000664000175000017500000011053011767656530025633 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axis2.databinding.ADBBean; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.databinding.utils.ConverterUtil; import org.apache.axis2.description.java2wsdl.TypeTable; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * This is the new implementation of the ADBpullaparser. The approach here is simple When the pull * parser needs to generate events for a particular name-value(s) pair it always handes over * (delegates) the task to another pull parser which knows how to deal with it The common types of * name value pairs we'll come across are 1. String name/QName name - String value 2. String * name/QName name - String[] value 3. OMElementkey - OMElement value 4. QName name/String name - * ADBBean value 5. QName name/String name - Java bean 5. QName name/String name - Datahandler *

        * As for the attributes, these are the possible combinations in the array 1. String name/QName name * - String value 2. OMAttributeKey - OMAttribute *

        * Note that certain array methods have been deliberately removed to avoid complications. The * generated code will take the trouble to lay the elements of the array in the correct order *

        *

        * Hence there will be a parser impl that knows how to handle these types, and this parent parser * will always delegate these tasks to the child pullparasers in effect this is one huge state * machine that has only a few states and delegates things down to the child parsers whenever * possible *

        */ public class ADBXMLStreamReaderImpl implements ADBXMLStreamReader { private Object[] properties; private Object[] attributes; private QName elementQName; //This is to store the QName which are in the typeTable after setting the correct prefix private HashMap qnameMap = new HashMap(); //we always create a new namespace context private ADBNamespaceContext namespaceContext = new ADBNamespaceContext(); private Map declaredNamespaceMap = new HashMap(); //states for this pullparser - it can only have four states private static final int START_ELEMENT_STATE = 0; private static final int END_ELEMENT_STATE = 1; private static final int DELEGATED_STATE = 2; private static final int TEXT_STATE = 3; //integer field that keeps the state of this //parser. private int state = START_ELEMENT_STATE; //reference to the child reader private ADBXMLStreamReader childReader; //current property index //initialized at zero private int currentPropertyIndex = 0; //To keep element formdefault qualified or not private boolean qualified = false; //to keep the current types which are in AxisService private TypeTable typeTable = null; /* * we need to pass in a namespace context since when delegated, we've no * idea of the current namespace context. So it needs to be passed on * here! */ public ADBXMLStreamReaderImpl(QName adbBeansQName, Object[] properties, Object[] attributes) { //validate the lengths, since both the arrays are supposed //to have this.properties = properties; this.elementQName = adbBeansQName; this.attributes = attributes; } public ADBXMLStreamReaderImpl(QName adbBeansQName, Object[] properties, Object[] attributes, TypeTable typeTable, boolean qualified) { this(adbBeansQName, properties, attributes); this.qualified = qualified; this.typeTable = typeTable; if(this.typeTable!=null){ Map complexTypeMap = this.typeTable.getComplexSchemaMap(); if(complexTypeMap !=null){ Iterator keys = complexTypeMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); QName qname = (QName) complexTypeMap.get(key); if(qname !=null){ String prefix =qname.getPrefix(); if(prefix ==null && "".equals(prefix)){ prefix = OMSerializerUtil.getNextNSPrefix(); } qname = new QName(qname.getNamespaceURI(),qname.getLocalPart(),prefix); this.typeTable.getComplexSchemaMap().put(key,qname); qnameMap.put(qname.getNamespaceURI(),prefix); addToNsMap(prefix, qname.getNamespaceURI()); } } } } } /** add the namespace context */ public void addNamespaceContext(NamespaceContext nsContext) { // register the namespace context passed in to this this.namespaceContext.setParentNsContext(nsContext); } /** * we need to split out the calling to the populate namespaces seperately since this needs to be * done *after* setting the parent namespace context. We cannot assume it will happen at * construction! */ public void init() { // here we have an extra issue to attend to. we need to look at the // prefixes and uris (the combination) and populate a hashmap of // namespaces. The hashmap of namespaces will be used to serve the // namespace context populateNamespaceContext(); } /** * @param key * @throws IllegalArgumentException */ public Object getProperty(String key) throws IllegalArgumentException { if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) { if (OPTIMIZATION_ENABLED.equals(key)) { return Boolean.TRUE; } else { return null; } } else if (state == TEXT_STATE) { if (IS_BINARY.equals(key)) { return Boolean.FALSE; } else { return null; } } else if (state == DELEGATED_STATE) { return childReader.getProperty(key); } else { return null; } } public void require(int i, String string, String string1) throws XMLStreamException { throw new UnsupportedOperationException(); } /** * todo implement the right contract for this * * @throws XMLStreamException */ public String getElementText() throws XMLStreamException { if (state == DELEGATED_STATE) { return childReader.getElementText(); } else { return null; } } /** * todo implement this * * @throws XMLStreamException */ public int nextTag() throws XMLStreamException { return 0; } /** @throws XMLStreamException */ public boolean hasNext() throws XMLStreamException { if (state == DELEGATED_STATE) { if (childReader.isDone()) { //the child reader is done. We shouldn't be getting the //hasnext result from the child pullparser then return true; } else { return childReader.hasNext(); } } else { return (state == START_ELEMENT_STATE || state == TEXT_STATE); } } public void close() throws XMLStreamException { //do nothing here - we have no resources to free } public String getNamespaceURI(String prefix) { return namespaceContext.getNamespaceURI(prefix); } public boolean isStartElement() { if (state == START_ELEMENT_STATE) { return true; } else if (state == END_ELEMENT_STATE) { return false; } return childReader.isStartElement(); } public boolean isEndElement() { if (state == START_ELEMENT_STATE) { return false; } else if (state == END_ELEMENT_STATE) { return true; } return childReader.isEndElement(); } public boolean isCharacters() { if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) { return false; } return childReader.isCharacters(); } public boolean isWhiteSpace() { if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) { return false; } return childReader.isWhiteSpace(); } /////////////////////////////////////////////////////////////////////////// /// attribute handling /////////////////////////////////////////////////////////////////////////// public String getAttributeValue(String nsUri, String localName) { int attribCount = getAttributeCount(); String returnValue = null; QName attribQualifiedName; for (int i = 0; i < attribCount; i++) { attribQualifiedName = getAttributeName(i); if (nsUri == null) { if (localName.equals(attribQualifiedName.getLocalPart())) { returnValue = getAttributeValue(i); break; } } else { if (localName.equals(attribQualifiedName.getLocalPart()) && nsUri.equals(attribQualifiedName.getNamespaceURI())) { returnValue = getAttributeValue(i); break; } } } return returnValue; } public int getAttributeCount() { return (state == DELEGATED_STATE) ? childReader.getAttributeCount() : ((attributes != null) && (state == START_ELEMENT_STATE) ? attributes.length / 2 : 0); } /** @param i */ public QName getAttributeName(int i) { if (state == DELEGATED_STATE) { return childReader.getAttributeName(i); } else if (state == START_ELEMENT_STATE) { if (attributes == null) { return null; } else { if ((i >= (attributes.length / 2)) || i < 0) { //out of range return null; } else { //get the attribute pointer Object attribPointer = attributes[i * 2]; //case one - attrib name is null //this should be the pointer to the OMAttribute then if (attribPointer == null) { Object omAttribObj = attributes[(i * 2) + 1]; if (omAttribObj == null || !(omAttribObj instanceof OMAttribute)) { // wrong object set to have in the attrib array - // this should have been detected by now but just be // sure throw new UnsupportedOperationException(); } OMAttribute att = (OMAttribute)omAttribObj; return att.getQName(); } else if (attribPointer instanceof OMAttribKey) { Object omAttribObj = attributes[(i * 2) + 1]; if (omAttribObj == null || !(omAttribObj instanceof OMAttribute)) { // wrong object set to have in the attrib array - // this should have been detected by now but just be // sure throw new UnsupportedOperationException(); } OMAttribute att = (OMAttribute)omAttribObj; return att.getQName(); //case two - attrib name is a plain string } else if (attribPointer instanceof String) { return new QName((String)attribPointer); } else if (attribPointer instanceof QName) { return (QName)attribPointer; } else { return null; } } } } else { throw new IllegalStateException();//as per the api contract } } public String getAttributeNamespace(int i) { if (state == DELEGATED_STATE) { return childReader.getAttributeNamespace(i); } else if (state == START_ELEMENT_STATE) { QName name = getAttributeName(i); if (name == null) { return null; } else { return name.getNamespaceURI(); } } else { throw new IllegalStateException(); } } public String getAttributeLocalName(int i) { if (state == DELEGATED_STATE) { return childReader.getAttributeLocalName(i); } else if (state == START_ELEMENT_STATE) { QName name = getAttributeName(i); if (name == null) { return null; } else { return name.getLocalPart(); } } else { throw new IllegalStateException(); } } public String getAttributePrefix(int i) { if (state == DELEGATED_STATE) { return childReader.getAttributePrefix(i); } else if (state == START_ELEMENT_STATE) { QName name = getAttributeName(i); if (name == null) { return null; } else { return name.getPrefix(); } } else { throw new IllegalStateException(); } } public String getAttributeType(int i) { return null; //not supported } public String getAttributeValue(int i) { if (state == DELEGATED_STATE) { return childReader.getAttributeValue(i); } else if (state == START_ELEMENT_STATE) { if (attributes == null) { return null; } else { if ((i >= (attributes.length / 2)) || i < 0) { //out of range return null; } else { //get the attribute pointer Object attribPointer = attributes[i * 2]; Object omAttribObj = attributes[(i * 2) + 1]; //case one - attrib name is null //this should be the pointer to the OMAttribute then if (attribPointer == null) { if (omAttribObj == null || !(omAttribObj instanceof OMAttribute)) { // wrong object set to have in the attrib array - // this should have been detected by now but just be // sure throw new UnsupportedOperationException(); } OMAttribute att = (OMAttribute)omAttribObj; return att.getAttributeValue(); } else if (attribPointer instanceof OMAttribKey) { if (omAttribObj == null || !(omAttribObj instanceof OMAttribute)) { // wrong object set to have in the attrib array - // this should have been detected by now but just be // sure throw new UnsupportedOperationException(); } OMAttribute att = (OMAttribute)omAttribObj; return att.getAttributeValue(); //case two - attrib name is a plain string } else if (attribPointer instanceof String) { return (String)omAttribObj; } else if (attribPointer instanceof QName) { if (omAttribObj instanceof QName){ QName attributeQName = (QName) omAttribObj; // first check it is already there if not add the namespace. String prefix = namespaceContext.getPrefix(attributeQName.getNamespaceURI()); if (prefix == null){ prefix = OMSerializerUtil.getNextNSPrefix(); addToNsMap(prefix,attributeQName.getNamespaceURI()); } String attributeValue = null; if (prefix.equals("")){ // i.e. this is the default namespace attributeValue = attributeQName.getLocalPart(); } else { attributeValue = prefix + ":" + attributeQName.getLocalPart(); } return attributeValue; } else { return (String)omAttribObj; } } else { return null; } } } } else { throw new IllegalStateException(); } } public boolean isAttributeSpecified(int i) { return false; //not supported } /////////////////////////////////////////////////////////////////////////// ////////////// end of attribute handling /////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// ////////////// namespace handling //////////////////////////////////////////////////////////////////////////// public int getNamespaceCount() { if (state == DELEGATED_STATE) { return childReader.getNamespaceCount(); } else { return declaredNamespaceMap.size(); } } /** @param i */ public String getNamespacePrefix(int i) { if (state == DELEGATED_STATE) { return childReader.getNamespacePrefix(i); } else if (state != TEXT_STATE) { //order the prefixes String[] prefixes = makePrefixArray(); if ((i >= prefixes.length) || (i < 0)) { return null; } else { return prefixes[i]; } } else { throw new IllegalStateException(); } } /** Get the prefix list from the hastable and take that into an array */ private String[] makePrefixArray() { String[] prefixes = (String[])declaredNamespaceMap.keySet(). toArray(new String[declaredNamespaceMap.size()]); Arrays.sort(prefixes); return prefixes; } public String getNamespaceURI(int i) { if (state == DELEGATED_STATE) { return childReader.getNamespaceURI(i); } else if (state != TEXT_STATE) { String namespacePrefix = getNamespacePrefix(i); return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix); } else { throw new IllegalStateException(); } } public NamespaceContext getNamespaceContext() { if (state == DELEGATED_STATE) { return childReader.getNamespaceContext(); } else { return namespaceContext; } } /////////////////////////////////////////////////////////////////////////// ///////// end of namespace handling /////////////////////////////////////////////////////////////////////////// public int getEventType() { if (state == START_ELEMENT_STATE) { return START_ELEMENT; } else if (state == END_ELEMENT_STATE) { return END_ELEMENT; } else { // this is the delegated state return childReader.getEventType(); } } public String getText() { if (state == DELEGATED_STATE) { return childReader.getText(); } else if (state == TEXT_STATE) { Object property = properties[currentPropertyIndex - 1]; if (property instanceof DataHandler){ return ConverterUtil.getStringFromDatahandler((DataHandler)property); } else { return (String)properties[currentPropertyIndex - 1]; } } else { throw new IllegalStateException(); } } public char[] getTextCharacters() { if (state == DELEGATED_STATE) { return childReader.getTextCharacters(); } else if (state == TEXT_STATE) { return properties[currentPropertyIndex - 1] == null ? new char[0] : ((String)properties[currentPropertyIndex - 1]).toCharArray(); } else { throw new IllegalStateException(); } } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { if (state == DELEGATED_STATE) { return childReader.getTextCharacters(i, chars, i1, i2); } else if (state == TEXT_STATE) { //todo - implement this return 0; } else { throw new IllegalStateException(); } } public int getTextStart() { if (state == DELEGATED_STATE) { return childReader.getTextStart(); } else if (state == TEXT_STATE) { return 0;//assume text always starts at 0 } else { throw new IllegalStateException(); } } public int getTextLength() { if (state == DELEGATED_STATE) { return childReader.getTextLength(); } else if (state == TEXT_STATE) { return 0;//assume text always starts at 0 } else { throw new IllegalStateException(); } } public String getEncoding() { if (state == DELEGATED_STATE) { return childReader.getEncoding(); } else { //we've no idea what the encoding is going to be in this case //perhaps we ought to return some constant here, which the user might //have access to change! return null; } } /** check the validity of this implementation */ public boolean hasText() { if (state == DELEGATED_STATE) { return childReader.hasText(); } else return state == TEXT_STATE; } /** */ public Location getLocation() { //return a default location return new Location() { public int getLineNumber() { return 0; } public int getColumnNumber() { return 0; } public int getCharacterOffset() { return 0; } public String getPublicId() { return null; } public String getSystemId() { return null; } }; } public QName getName() { if (state == DELEGATED_STATE) { return childReader.getName(); } else if (state != TEXT_STATE) { return elementQName; } else { throw new IllegalStateException(); } } public String getLocalName() { if (state == DELEGATED_STATE) { return childReader.getLocalName(); } else if (state != TEXT_STATE) { return elementQName.getLocalPart(); } else { throw new IllegalStateException(); } } public boolean hasName() { //since this parser always has a name, the hasname //has to return true if we are still navigating this element //if not we should ask the child reader for it. if (state == DELEGATED_STATE) { return childReader.hasName(); } else return state != TEXT_STATE; } public String getNamespaceURI() { if (state == DELEGATED_STATE) { return childReader.getNamespaceURI(); } else if (state == TEXT_STATE) { return null; } else { return elementQName.getNamespaceURI(); } } public String getPrefix() { if (state == DELEGATED_STATE) { return childReader.getPrefix(); } else if (state == TEXT_STATE) { return null; } else { String prefix = elementQName.getPrefix(); return "".equals(prefix) ? null : prefix; } } public String getVersion() { return null; } public boolean isStandalone() { return true; } public boolean standaloneSet() { return true; } public String getCharacterEncodingScheme() { return null; //todo - should we return something for this ? } public String getPITarget() { throw new UnsupportedOperationException("Yet to be implemented !!"); } public String getPIData() { throw new UnsupportedOperationException("Yet to be implemented !!"); } /////////////////////////////////////////////////////////////////////////// /// Other utility methods ////////////////////////////////////////////////////////////////////////// /** Populates a namespace context */ private void populateNamespaceContext() { //first add the current element namespace to the namespace context //declare it if not found addToNsMap(elementQName.getPrefix(), elementQName.getNamespaceURI()); //traverse through the attributes and populate the namespace context //the attrib list can be of many combinations // the valid combinations are // String - String // QName - QName // null - OMAttribute if (attributes != null) { for (int i = 0; i < attributes.length; i = i + 2) { //jump in two Object attribName = attributes[i]; if (attribName == null) { //this should be the OMAttrib case! OMAttribute OMAttrib = (OMAttribute)attributes[i + 1]; OMNamespace namespace = OMAttrib.getNamespace(); if (namespace != null) { addToNsMap(namespace.getPrefix(), namespace.getNamespaceURI()); } } else if (attribName instanceof OMAttribKey) { //this is definitely the OMAttribute case OMAttribute OMAttrib = (OMAttribute)attributes[i + 1]; OMNamespace namespace = OMAttrib.getNamespace(); if (namespace != null) { addToNsMap(namespace.getPrefix(), namespace.getNamespaceURI()); } } else if (attribName instanceof String) { //ignore this case - Nothing to do } else if (attribName instanceof QName) { QName attribQName = ((QName)attribName); addToNsMap(attribQName.getPrefix(), attribQName.getNamespaceURI()); } } } } /** * @param prefix * @param uri */ private void addToNsMap(String prefix, String uri) { if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) { namespaceContext.pushNamespace(prefix, uri); declaredNamespaceMap.put(prefix, uri); } } /** * By far this should be the most important method in this class this method changes the state * of the parser */ public int next() throws XMLStreamException { int returnEvent = -1; //invalid state is the default state switch (state) { case START_ELEMENT_STATE: //current element is start element. We should be looking at the //property list and making a pullparser for the property value if (properties == null || properties.length == 0) { //no properties - move to the end element state straightaway state = END_ELEMENT_STATE; returnEvent = END_ELEMENT; } else { //there are properties. now we should delegate this task to a //child reader depending on the property type returnEvent = processProperties(); } break; case END_ELEMENT_STATE: //we've reached the end element already. If the user tries to push // further ahead then it is an exception throw new XMLStreamException( "Trying to go beyond the end of the pullparser"); case DELEGATED_STATE: if (childReader.isDone()) { //we've reached the end! if (currentPropertyIndex > (properties.length - 1)) { state = END_ELEMENT_STATE; returnEvent = END_ELEMENT; } else { returnEvent = processProperties(); } } else { returnEvent = childReader.next(); } break; case TEXT_STATE: // if there are any more event we should be delegating to // processProperties. if not we just return an end element if (currentPropertyIndex > (properties.length - 1)) { state = END_ELEMENT_STATE; returnEvent = END_ELEMENT; } else { returnEvent = processProperties(); } break; } return returnEvent; } /** * A convenient method to reuse the properties * * @return event to be thrown * @throws XMLStreamException */ private int processProperties() throws XMLStreamException { //move to the next property depending on the current property //index Object propPointer = properties[currentPropertyIndex]; QName propertyQName = null; boolean textFound = false; if (propPointer == null) { throw new XMLStreamException("property key cannot be null!"); } else if (propPointer instanceof String) { // propPointer being a String has a special case // that is it can be a the special constant ELEMENT_TEXT that // says this text event if (ELEMENT_TEXT.equals(propPointer)) { textFound = true; } else { propertyQName = new QName((String)propPointer); } } else if (propPointer instanceof QName) { propertyQName = (QName)propPointer; } else if (propPointer instanceof OMElementKey) { // ah - in this case there's nothing to be done //about the propertyQName in this case - we'll just leave //it as it is } else { //oops - we've no idea what kind of key this is throw new XMLStreamException( "unidentified property key!!!" + propPointer); } if(propertyQName!=null){ String prefix = (String) qnameMap.get(propertyQName.getNamespaceURI()); if(prefix!=null){ propertyQName = new QName(propertyQName.getNamespaceURI(),propertyQName.getLocalPart(),prefix); } } //ok! we got the key. Now look at the value Object propertyValue = properties[currentPropertyIndex + 1]; //cater for the special case now if (textFound) { //no delegation here - make the parser null and immediately //return with the event characters childReader = null; state = TEXT_STATE; currentPropertyIndex = currentPropertyIndex + 2; return CHARACTERS; } else if (propertyValue == null) { //if the value is null we delegate the work to a nullable // parser childReader = new NullXMLStreamReader(propertyQName); childReader.addNamespaceContext(this.namespaceContext); childReader.init(); //we've a special pullparser for a datahandler! } else if (propertyValue instanceof DataHandler) { childReader = new ADBDataHandlerStreamReader(propertyQName, (DataHandler)propertyValue); childReader.addNamespaceContext(this.namespaceContext); childReader.init(); } else if (propertyValue instanceof String) { //strings are handled by the NameValuePairStreamReader childReader = new NameValuePairStreamReader(propertyQName, (String)propertyValue); childReader.addNamespaceContext(this.namespaceContext); childReader.init(); } else if (propertyValue instanceof String[]) { //string[] are handled by the NameValueArrayStreamReader //if the array is empty - skip it if (((String[])propertyValue).length == 0) { //advance the index currentPropertyIndex = currentPropertyIndex + 2; return processProperties(); } else { childReader = new NameValueArrayStreamReader(propertyQName, (String[])propertyValue); childReader.addNamespaceContext(this.namespaceContext); childReader.init(); } } else if (propertyValue instanceof ADBBean) { //ADBbean has it's own method to get a reader XMLStreamReader reader = ((ADBBean)propertyValue). getPullParser(propertyQName); // we know for sure that this is an ADB XMLStreamreader. // However we need to make sure that it is compatible if (reader instanceof ADBXMLStreamReader) { childReader = (ADBXMLStreamReader)reader; childReader.addNamespaceContext(this.namespaceContext); childReader.init(); } else { //wrap it to make compatible childReader = new WrappingXMLStreamReader( reader); } } else if (propertyValue instanceof OMElement) { //OMElements do not provide the kind of parser we need //there is no other option than wrapping childReader = new WrappingXMLStreamReader( ((OMElement)propertyValue).getXMLStreamReader()); //we cannot register the namespace context here!! } else { //all special possiblilities has been tried! Let's treat //the thing as a bean and try generating events from it childReader = new WrappingXMLStreamReader (BeanUtil.getPullParser(propertyValue, propertyQName, typeTable, qualified, false)); //we cannot register the namespace context here } //set the state here state = DELEGATED_STATE; //we are done with the delegation //increment the property index currentPropertyIndex = currentPropertyIndex + 2; return childReader.getEventType(); } /** are we done ? */ public boolean isDone() { return (state == END_ELEMENT_STATE); } } ./src/org/apache/axis2/databinding/utils/reader/OMAttribKey.java0000664000175000017500000000200311767656530023670 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; /** * A dummy object that acts as the key for the OMAttribute in the attribute array - this will be * provided as part of the constants */ public class OMAttribKey { } ./src/org/apache/axis2/databinding/utils/reader/NullXMLStreamReader.java0000664000175000017500000001653611767656530025350 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; public class NullXMLStreamReader implements ADBXMLStreamReader { private QName outerQName = null; private static final int START_ELEMENT_STATE = 1; private static final int END_ELEMENT_STATE = 2; private static final QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi"); private static final String NIL_VALUE_TRUE = "true"; private int currentState = START_ELEMENT; public NullXMLStreamReader(QName outerQName) { this.outerQName = outerQName; } public Object getProperty(String key) throws IllegalArgumentException { //since optimization is a global property //we've to implement it everywhere if (OPTIMIZATION_ENABLED.equals(key)) { return Boolean.TRUE; } else { return null; } } public int next() throws XMLStreamException { int returnEvent = START_DOCUMENT; switch (currentState) { case START_ELEMENT_STATE: currentState = END_ELEMENT_STATE; returnEvent = END_ELEMENT; break; case END_ELEMENT_STATE: throw new XMLStreamException("parser completed!"); } return returnEvent; } public void require(int i, String string, String string1) throws XMLStreamException { //nothing } public String getElementText() throws XMLStreamException { return null; } public int nextTag() throws XMLStreamException { throw new UnsupportedOperationException(); } public boolean hasNext() throws XMLStreamException { return (currentState != END_ELEMENT_STATE); } public void close() throws XMLStreamException { //do nothing } public String getNamespaceURI(String string) { if (outerQName.getPrefix() != null && outerQName.getPrefix().equals(string)) { return outerQName.getNamespaceURI(); } else { return null; } } public boolean isStartElement() { return (currentState == START_ELEMENT_STATE); } public boolean isEndElement() { return (currentState == END_ELEMENT_STATE); } public boolean isCharacters() { return false; } public boolean isWhiteSpace() { return false; } public String getAttributeValue(String string, String string1) { if (string == null) {//null namespace - ignore it if (NIL_QNAME.getLocalPart().equals(string1)) { return NIL_VALUE_TRUE; } } return null; } public int getAttributeCount() { return 1; } public QName getAttributeName(int i) { return (i == 0) ? NIL_QNAME : null; } public String getAttributeNamespace(int i) { return (i == 0) ? NIL_QNAME.getNamespaceURI() : null; } public String getAttributeLocalName(int i) { return (i == 0) ? NIL_QNAME.getLocalPart() : null; } public String getAttributePrefix(int i) { return (i == 0) ? NIL_QNAME.getPrefix() : null; } public String getAttributeType(int i) { throw new UnsupportedOperationException(); } public String getAttributeValue(int i) { return (i == 0) ? NIL_VALUE_TRUE : null; } public boolean isAttributeSpecified(int i) { return (i == 0); } public int getNamespaceCount() { return 0; } public String getNamespacePrefix(int i) { return null; } public String getNamespaceURI(int i) { return null; } public NamespaceContext getNamespaceContext() { throw new UnsupportedOperationException(); } public int getEventType() { int returnEvent = START_DOCUMENT; switch (currentState) { case START_ELEMENT_STATE: returnEvent = START_ELEMENT; break; case END_ELEMENT_STATE: returnEvent = END_ELEMENT; break; } return returnEvent; } public String getText() { return null; } public char[] getTextCharacters() { return new char[0]; //To change body of implemented methods use File | Settings | File Templates. } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { return 0; } public int getTextStart() { return 0; } public int getTextLength() { return 0; } public String getEncoding() { return null; } public boolean hasText() { return false; } public Location getLocation() { return new Location() { public int getLineNumber() { return 0; } public int getColumnNumber() { return 0; } public int getCharacterOffset() { return 0; } public String getPublicId() { return null; } public String getSystemId() { return null; } }; } public QName getName() { return outerQName; } public String getLocalName() { return outerQName.getLocalPart(); } public boolean hasName() { return true; } public String getNamespaceURI() { return outerQName.getNamespaceURI(); } public String getPrefix() { return outerQName.getPrefix(); } public String getVersion() { throw new UnsupportedOperationException(); } public boolean isStandalone() { throw new UnsupportedOperationException(); } public boolean standaloneSet() { throw new UnsupportedOperationException(); } public String getCharacterEncodingScheme() { throw new UnsupportedOperationException(); } public String getPITarget() { throw new UnsupportedOperationException(); } public String getPIData() { throw new UnsupportedOperationException(); } public boolean isDone() { return (currentState == END_ELEMENT_STATE); } public void addNamespaceContext(NamespaceContext nsContext) { //To change body of implemented methods use File | Settings | File Templates. } public void init() { //To change body of implemented methods use File | Settings | File Templates. } } ./src/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.java0000664000175000017500000001312011767656530026207 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class WrappingXMLStreamReader implements ADBXMLStreamReader { private XMLStreamReader reader; public WrappingXMLStreamReader(XMLStreamReader reader) { this.reader = reader; } public boolean isDone() { try { return !hasNext(); } catch (XMLStreamException e) { throw new RuntimeException(e); } } public Object getProperty(String string) throws IllegalArgumentException { return reader.getProperty(string); } public int next() throws XMLStreamException { return reader.next(); } public void require(int i, String string, String string1) throws XMLStreamException { //nothing to do } public String getElementText() throws XMLStreamException { return reader.getElementText(); } public int nextTag() throws XMLStreamException { return reader.nextTag(); } public boolean hasNext() throws XMLStreamException { return reader.hasNext(); } public void close() throws XMLStreamException { reader.close(); } public String getNamespaceURI(String string) { return reader.getNamespaceURI(string); } public boolean isStartElement() { return reader.isStartElement(); } public boolean isEndElement() { return reader.isEndElement(); } public boolean isCharacters() { return reader.isCharacters(); } public boolean isWhiteSpace() { return reader.isWhiteSpace(); } public String getAttributeValue(String string, String string1) { return reader.getAttributeValue(string, string1); } public int getAttributeCount() { return reader.getAttributeCount(); } public QName getAttributeName(int i) { return reader.getAttributeName(i); } public String getAttributeNamespace(int i) { return reader.getAttributeNamespace(i); } public String getAttributeLocalName(int i) { return reader.getAttributeLocalName(i); } public String getAttributePrefix(int i) { return reader.getAttributePrefix(i); } public String getAttributeType(int i) { return reader.getAttributeType(i); } public String getAttributeValue(int i) { return reader.getAttributeValue(i); } public boolean isAttributeSpecified(int i) { return reader.isAttributeSpecified(i); } public int getNamespaceCount() { return reader.getNamespaceCount(); } public String getNamespacePrefix(int i) { return reader.getNamespacePrefix(i); } public String getNamespaceURI(int i) { return reader.getNamespaceURI(i); } public NamespaceContext getNamespaceContext() { return reader.getNamespaceContext(); } public int getEventType() { return reader.getEventType(); } public String getText() { return reader.getText(); } public char[] getTextCharacters() { return reader.getTextCharacters(); } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { return reader.getTextCharacters(i, chars, i1, i2); } public int getTextStart() { return reader.getTextStart(); } public int getTextLength() { return reader.getTextLength(); } public String getEncoding() { return reader.getEncoding(); } public boolean hasText() { return reader.hasText(); } public Location getLocation() { return reader.getLocation(); } public QName getName() { return reader.getName(); } public String getLocalName() { return reader.getLocalName(); } public boolean hasName() { return reader.hasName(); } public String getNamespaceURI() { return reader.getNamespaceURI(); } public String getPrefix() { return reader.getPrefix(); } public String getVersion() { return reader.getVersion(); } public boolean isStandalone() { return reader.isStandalone(); } public boolean standaloneSet() { return reader.standaloneSet(); } public String getCharacterEncodingScheme() { return reader.getCharacterEncodingScheme(); } public String getPITarget() { return reader.getPITarget(); } public String getPIData() { return reader.getPIData(); } public void addNamespaceContext(NamespaceContext nsContext) { //nothing to do here } public void init() { //Nothing to do here } } ./src/org/apache/axis2/databinding/utils/reader/NameValuePairStreamReader.java0000664000175000017500000002164711767656530026545 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.reader; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; public class NameValuePairStreamReader implements ADBXMLStreamReader { private static final int START_ELEMENT_STATE = 0; private static final int TEXT_STATE = 1; private static final int END_ELEMENT_STATE = 2; private ADBNamespaceContext namespaceContext = new ADBNamespaceContext(); private QName name; private String value; private int state = START_ELEMENT_STATE; //initiate at the start element state //keeps track whether the namespace is declared //false by default private boolean nsDeclared = false; public NameValuePairStreamReader(QName name, String value) { this.name = name; this.value = value; } public Object getProperty(String key) throws IllegalArgumentException { //since optimization is a global property //we've to implement it everywhere if (OPTIMIZATION_ENABLED.equals(key)) { return Boolean.TRUE; } else if (state == TEXT_STATE) { if (IS_BINARY.equals(key)) { return Boolean.FALSE; } else { return null; } } else { return null; } } public int next() throws XMLStreamException { //no need to handle null here. it should have been handled //already switch (state) { case START_ELEMENT_STATE: state = TEXT_STATE; return CHARACTERS; case END_ELEMENT_STATE: //oops, not supposed to happen! throw new XMLStreamException("end already reached!"); case TEXT_STATE: state = END_ELEMENT_STATE; return END_ELEMENT; default: throw new XMLStreamException("unknown event type!"); } } public void require(int i, String string, String string1) throws XMLStreamException { //not implemented } public String getElementText() throws XMLStreamException { if (state == START_ELEMENT) { //move to the end state and return the value state = END_ELEMENT_STATE; return value; } else { throw new XMLStreamException(); } } public int nextTag() throws XMLStreamException { return 0;//todo } public boolean hasNext() throws XMLStreamException { return (state != END_ELEMENT_STATE); } public void close() throws XMLStreamException { //Do nothing - we've nothing to free here } public String getNamespaceURI(String prefix) { return namespaceContext.getNamespaceURI(prefix); } public boolean isStartElement() { return (state == START_ELEMENT_STATE); } public boolean isEndElement() { return (state == END_ELEMENT_STATE); } public boolean isCharacters() { return (state == TEXT_STATE); } public boolean isWhiteSpace() { return false; //no whitespaces here } public String getAttributeValue(String string, String string1) { return null; } public int getAttributeCount() { return 0; } public QName getAttributeName(int i) { return null; } public String getAttributeNamespace(int i) { return null; } public String getAttributeLocalName(int i) { return null; } public String getAttributePrefix(int i) { return null; } public String getAttributeType(int i) { return null; } public String getAttributeValue(int i) { return null; } public boolean isAttributeSpecified(int i) { return false; //no attribs here } public int getNamespaceCount() { return (nsDeclared) ? 1 : 0; } public String getNamespacePrefix(int i) { return (nsDeclared && i == 0) ? name.getPrefix() : null; } public String getNamespaceURI(int i) { return (nsDeclared && i == 0) ? name.getNamespaceURI() : null; } public NamespaceContext getNamespaceContext() { return this.namespaceContext; } public int getEventType() { switch (state) { case START_ELEMENT_STATE: return START_ELEMENT; case END_ELEMENT_STATE: return END_ELEMENT; case TEXT_STATE: return CHARACTERS; default: throw new UnsupportedOperationException(); //we've no idea what this is!!!!! } } public String getText() { if (state == TEXT_STATE) { return value; } else { throw new IllegalStateException(); } } public char[] getTextCharacters() { if (state == TEXT_STATE) { return value.toCharArray(); } else { throw new IllegalStateException(); } } public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { //not implemented throw new UnsupportedOperationException(); } public int getTextStart() { if (state == TEXT_STATE) { return 0; } else { throw new IllegalStateException(); } } public int getTextLength() { if (state == TEXT_STATE) { return value.length(); } else { throw new IllegalStateException(); } } public String getEncoding() { return null; } public boolean hasText() { return (state == TEXT_STATE); } public Location getLocation() { return new Location() { public int getLineNumber() { return 0; } public int getColumnNumber() { return 0; } public int getCharacterOffset() { return 0; } public String getPublicId() { return null; } public String getSystemId() { return null; } }; } public QName getName() { if (state != TEXT_STATE) { return name; } else { return null; } } public String getLocalName() { if (state != TEXT_STATE) { return name.getLocalPart(); } else { return null; } } public boolean hasName() { return (state != TEXT_STATE); } public String getNamespaceURI() { if (state != TEXT_STATE) { return name.getNamespaceURI(); } else { return null; } } public String getPrefix() { if (state != TEXT_STATE) { return name.getPrefix(); } else { return null; } } public String getVersion() { return null; //todo 1.0 ? } public boolean isStandalone() { return false; } public boolean standaloneSet() { return false; } public String getCharacterEncodingScheme() { return null; } public String getPITarget() { return null; } public String getPIData() { return null; } public boolean isDone() { return (state == END_ELEMENT_STATE); } public void addNamespaceContext(NamespaceContext nsContext) { this.namespaceContext.setParentNsContext(nsContext); } public void init() { //just add the current elements namespace and prefix to the this //elements nscontext addToNsMap(name.getPrefix(), name.getNamespaceURI()); } /** * @param prefix * @param uri */ private void addToNsMap(String prefix, String uri) { //todo - need to fix this up to cater for cases where //namespaces are having no prefixes if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) { //this namespace is not there. Need to declare it namespaceContext.pushNamespace(prefix, uri); nsDeclared = true; } } } ./src/org/apache/axis2/databinding/utils/States.java0000664000175000017500000000227511767656530021552 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; public interface States { static int INIT_STATE = -1; static int STARTED_STATE = 0; static int START_ELEMENT_FOUND_STATE = 1; static int TEXT_FOUND_STATE = 2; static int END_ELEMENT_FOUND_STATE = 3; static int FINISHED_STATE = 4; static int ILLEGAL_STATE = 5; static int CONTENT_FOUND_STATE = 6; static int NULLED_STATE = 7; } ./src/org/apache/axis2/databinding/utils/Constants.java0000664000175000017500000000305311767656530022256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import org.apache.axiom.om.OMConstants; import org.apache.axis2.databinding.utils.reader.OMAttribKey; import org.apache.axis2.databinding.utils.reader.OMElementKey; public interface Constants { static String NIL = "nil"; static String TRUE = "true"; static String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance"; static String XSD_NAMESPACE = "http://www.w3.org/2001/XMLSchema"; static Object OM_ATTRIBUTE_KEY = new OMAttribKey(); static Object OM_ELEMENT_KEY = new OMElementKey(); static final String IS_BINARY = OMConstants.IS_BINARY; static final String DATA_HANDLER = OMConstants.DATA_HANDLER; static final String OPTIMIZATION_ENABLED = OMConstants.IS_DATA_HANDLERS_AWARE; } ./src/org/apache/axis2/databinding/utils/SimpleArrayReaderStateMachine.java0000664000175000017500000001725011767656530026147 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.util.ArrayList; import java.util.List; /** A state machine that reads arrays with simple content. returns a string array */ public class SimpleArrayReaderStateMachine implements States, Constants { private QName elementNameToTest = null; private int currentState = INIT_STATE; private boolean nillable = false; private boolean canbeAbsent = false; private List list = new ArrayList(); /** @return an array of strings */ public String[] getTextArray() { return (String[])list.toArray(new String[list.size()]); } public void setNillable() { nillable = true; } public boolean isCanbeAbsent() { return canbeAbsent; } public void setCanbeAbsent(boolean canbeAbsent) { this.canbeAbsent = canbeAbsent; } /** * Resets the state machine. Once the reset is called the state machine is good enough for a * fresh run */ public void reset() { elementNameToTest = null; currentState = INIT_STATE; nillable = false; list = new ArrayList(); } public void setElementNameToTest(QName elementNameToTest) { this.elementNameToTest = elementNameToTest; } /** * public read method - reads a given reader to extract the text value * * @param reader */ public void read(XMLStreamReader reader) throws XMLStreamException { do { updateState(reader); //test for the nillable attribute if (currentState == START_ELEMENT_FOUND_STATE && nillable) { if (TRUE.equals(reader.getAttributeValue(XSI_NAMESPACE, NIL))) { list.add(null); //force the state to be null found currentState = NULLED_STATE; } } if (currentState == TEXT_FOUND_STATE) { //read the text value and store it in the list list.add(reader.getText()); } //increment the parser only if the state is //not finished if (currentState != FINISHED_STATE && currentState != ILLEGAL_STATE) { reader.next(); } } while (currentState != FINISHED_STATE && currentState != ILLEGAL_STATE); if (currentState == ILLEGAL_STATE) { throw new RuntimeException("Illegal state!"); } } private void updateState(XMLStreamReader reader) throws XMLStreamException { int event = reader.getEventType(); switch (currentState) { case INIT_STATE: if (event == XMLStreamConstants.START_DOCUMENT) { currentState = STARTED_STATE; } else if (event == XMLStreamConstants.START_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = START_ELEMENT_FOUND_STATE; } else { //we found a start element that does not have //the name of the element currentState = canbeAbsent ? FINISHED_STATE : STARTED_STATE; } } else if (event == XMLStreamConstants.END_ELEMENT) { // an end element is found at the init state // we should break the process here ? if (!elementNameToTest.equals(reader.getName())) { currentState = FINISHED_STATE; } } break; case STARTED_STATE: if (event == XMLStreamConstants.END_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = ILLEGAL_STATE; } else { currentState = FINISHED_STATE; } } else if (event == XMLStreamConstants.START_ELEMENT) { QName name = reader.getName(); if (elementNameToTest.equals(name)) { currentState = START_ELEMENT_FOUND_STATE; } } break; case START_ELEMENT_FOUND_STATE: if (event == XMLStreamConstants.CHARACTERS) { currentState = TEXT_FOUND_STATE; } break; case TEXT_FOUND_STATE: if (event == XMLStreamConstants.END_ELEMENT) { if (elementNameToTest.equals(reader.getName())) { currentState = END_ELEMENT_FOUND_STATE; } else { currentState = ILLEGAL_STATE; } } else if (event == XMLStreamConstants.CHARACTERS) { //another char event - //so append it to the current text } break; case NULLED_STATE: //read upto the end and set the state to END_ELEMENT_FOUND_STATE while (event != XMLStreamConstants.END_ELEMENT) { event = reader.next(); } currentState = END_ELEMENT_FOUND_STATE; break; case END_ELEMENT_FOUND_STATE: if (event == XMLStreamConstants.START_ELEMENT) { //restart the parsing if (elementNameToTest.equals(reader.getName())) { currentState = START_ELEMENT_FOUND_STATE; } else { currentState = FINISHED_STATE; } //another end element found after end-element } else if (event == XMLStreamConstants.END_ELEMENT) { currentState = FINISHED_STATE; //end document found } break; default: //characters found - if this is a characters event that was in the correct place then //it would have been handled already. we need to check whether this is a ignorable //whitespace and if not push the state machine to a illegal state. if (event == XMLStreamConstants.CHARACTERS) { if (reader.getText().trim().length() == 0) { //the text is empty - don't change the state } else { //we do NOT handle mixed content currentState = ILLEGAL_STATE; } } else { currentState = ILLEGAL_STATE; } } } } ./src/org/apache/axis2/databinding/utils/NamedStaxOMBuilder.java0000664000175000017500000000430011767656530023725 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamReader; public class NamedStaxOMBuilder { //wrap a StAXOMBuilder private StAXOMBuilder builder; private XMLStreamReader reader; private QName nameToMatch; /** * @param xmlStreamReader * @param nameToMatch */ public NamedStaxOMBuilder(XMLStreamReader xmlStreamReader, QName nameToMatch) { reader = xmlStreamReader; builder = new StAXOMBuilder(xmlStreamReader); this.nameToMatch = nameToMatch; } /** * */ public OMElement getOMElement() { //force to build within the given QName boolean done = false; int depth = 0; while (!done) { if (reader.getEventType() == XMLStreamConstants.END_ELEMENT) { depth--; } else if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) { depth++; } if (depth == 0 && reader.getEventType() == XMLStreamConstants.END_ELEMENT && nameToMatch.equals(reader.getName())) { done = true; } else { builder.next(); } } return builder.getDocumentElement(); } } ./src/org/apache/axis2/databinding/utils/ConverterUtil.java0000664000175000017500000017032011767656530023111 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.MTOMConstants; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.OMStAXWrapper; import org.apache.axiom.om.util.Base64; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder; import org.apache.axis2.databinding.ADBBean; import org.apache.axis2.databinding.ADBException; import org.apache.axis2.databinding.i18n.ADBMessages; import org.apache.axis2.databinding.types.Day; import org.apache.axis2.databinding.types.Duration; import org.apache.axis2.databinding.types.Entities; import org.apache.axis2.databinding.types.Entity; import org.apache.axis2.databinding.types.HexBinary; import org.apache.axis2.databinding.types.IDRef; import org.apache.axis2.databinding.types.IDRefs; import org.apache.axis2.databinding.types.Id; import org.apache.axis2.databinding.types.Language; import org.apache.axis2.databinding.types.Month; import org.apache.axis2.databinding.types.MonthDay; import org.apache.axis2.databinding.types.NCName; import org.apache.axis2.databinding.types.NMToken; import org.apache.axis2.databinding.types.NMTokens; import org.apache.axis2.databinding.types.Name; import org.apache.axis2.databinding.types.NegativeInteger; import org.apache.axis2.databinding.types.NonNegativeInteger; import org.apache.axis2.databinding.types.NonPositiveInteger; import org.apache.axis2.databinding.types.NormalizedString; import org.apache.axis2.databinding.types.Notation; import org.apache.axis2.databinding.types.PositiveInteger; import org.apache.axis2.databinding.types.Time; import org.apache.axis2.databinding.types.Token; import org.apache.axis2.databinding.types.URI; import org.apache.axis2.databinding.types.UnsignedByte; import org.apache.axis2.databinding.types.UnsignedInt; import org.apache.axis2.databinding.types.UnsignedLong; import org.apache.axis2.databinding.types.UnsignedShort; import org.apache.axis2.databinding.types.Year; import org.apache.axis2.databinding.types.YearMonth; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.TimeZone; /** * Converter methods to go from 1. simple type -> String 2. simple type -> Object 3. String -> * simpletype 4. Object list -> array */ public class ConverterUtil { private static Log log = LogFactory.getLog(ConverterUtil.class); private static final String POSITIVE_INFINITY = "INF"; private static final String NEGATIVE_INFINITY = "-INF"; public static final String SYSTEM_PROPERTY_ADB_CONVERTERUTIL = "adb.converterutil"; private static boolean isCustomClassPresent; private static Class customClass; /* String conversion methods */ public static String convertToString(int i) { return Integer.toString(i); } public static String convertToString(float i) { return Float.toString(i); } public static String convertToString(long i) { return Long.toString(i); } public static String convertToString(double i) { return Double.toString(i); } public static String convertToString(byte i) { return Byte.toString(i); } public static String convertToString(char i) { return Character.toString(i); } public static String convertToString(short i) { return Short.toString(i); } public static String convertToString(boolean i) { return Boolean.toString(i); } public static String convertToString(Date value) { if (isCustomClassPresent) { // this means user has define a seperate converter util class return invokeToStringMethod(value,Date.class); } else { // lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz? Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.setTime(value); if (!calendar.isSet(Calendar.ZONE_OFFSET)){ calendar.setTimeZone(TimeZone.getDefault()); } StringBuffer dateString = new StringBuffer(16); appendDate(dateString, calendar); appendTimeZone(calendar, dateString); return dateString.toString(); } } public static void appendTimeZone(Calendar calendar, StringBuffer dateString) { int timezoneOffSet = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET); int timezoneOffSetInMinits = timezoneOffSet / 60000; if (timezoneOffSetInMinits < 0){ dateString.append("-"); timezoneOffSetInMinits = timezoneOffSetInMinits * -1; } else { dateString.append("+"); } int hours = timezoneOffSetInMinits / 60; int minits = timezoneOffSetInMinits % 60; if (hours < 10) { dateString.append("0"); } dateString.append(hours).append(":"); if (minits < 10){ dateString.append("0"); } dateString.append(minits); } public static void appendDate(StringBuffer dateString, Calendar calendar) { int year = calendar.get(Calendar.YEAR); if (year < 1000){ dateString.append("0"); } if (year < 100){ dateString.append("0"); } if (year < 10) { dateString.append("0"); } dateString.append(year).append("-"); // xml date month is started from 1 and calendar month is // started from 0. so have to add one int month = calendar.get(Calendar.MONTH) + 1; if (month < 10){ dateString.append("0"); } dateString.append(month).append("-"); if (calendar.get(Calendar.DAY_OF_MONTH) < 10){ dateString.append("0"); } dateString.append(calendar.get(Calendar.DAY_OF_MONTH)); } private static String invokeToStringMethod(Object value, Class type) { try { Method method = customClass.getMethod("convertToString", new Class[]{type}); String result = (String) method.invoke(null,new Object[]{value}); return result; } catch (NoSuchMethodException e) { throw new RuntimeException("can not find the method convertToString(" + type.getName() + ") in converter util class " + customClass.getName(), e); } catch (IllegalAccessException e) { throw new RuntimeException("can not access the method convertToString(" + type.getName() + ") in converter util class " + customClass.getName(), e); } catch (InvocationTargetException e) { throw new RuntimeException("can not invocate the method convertToString(" + type.getName() + ") in converter util class " + customClass.getName(), e); } } public static String convertToString(Calendar value) { if (isCustomClassPresent) { return invokeToStringMethod(value,Calendar.class); } else { // lexical form of the calendar is '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)? if (!value.isSet(Calendar.ZONE_OFFSET)){ value.setTimeZone(TimeZone.getDefault()); } StringBuffer dateString = new StringBuffer(28); appendDate(dateString, value); dateString.append("T"); //adding hours appendTime(value, dateString); appendTimeZone(value, dateString); return dateString.toString(); } } public static void appendTime(Calendar value, StringBuffer dateString) { if (value.get(Calendar.HOUR_OF_DAY) < 10) { dateString.append("0"); } dateString.append(value.get(Calendar.HOUR_OF_DAY)).append(":"); if (value.get(Calendar.MINUTE) < 10) { dateString.append("0"); } dateString.append(value.get(Calendar.MINUTE)).append(":"); if (value.get(Calendar.SECOND) < 10) { dateString.append("0"); } dateString.append(value.get(Calendar.SECOND)).append("."); if (value.get(Calendar.MILLISECOND) < 10) { dateString.append("0"); } if (value.get(Calendar.MILLISECOND) < 100) { dateString.append("0"); } dateString.append(value.get(Calendar.MILLISECOND)); } public static String convertToString(Day o) { return o.toString(); } public static String convertToString(YearMonth o) { return o.toString(); } public static String convertToString(Year o) { return o.toString(); } public static String convertToString(HexBinary o) { return o.toString(); } public static String convertToString(MonthDay o) { return o.toString(); } public static String convertToString(Time o) { return o.toString(); } public static String convertToString(Byte o) { return o.toString(); } public static String convertToString(BigInteger o) { return o.toString(); } public static String convertToString(Integer o) { return o.toString(); } public static String convertToString(Long o) { return o.toString(); } public static String convertToString(Short o) { return o.toString(); } public static String convertToString(UnsignedByte o) { return o.toString(); } public static String convertToString(UnsignedInt o) { return o.toString(); } public static String convertToString(UnsignedLong o) { return o.toString(); } public static String convertToString(QName o) { if (o != null) { return o.getLocalPart(); } else { return ""; } } public static String convertToString(Object o) { return o.toString(); } public static String convertToString(Double o) { return o.toString(); } public static String convertToString(Duration o) { return o.toString(); } public static String convertToString(Float o) { return o.toString(); } public static String convertToString(Month o) { return o.toString(); } public static String convertToString(byte[] bytes) { return Base64.encode(bytes); } public static String convertToString(javax.activation.DataHandler handler) { return getStringFromDatahandler(handler); } /* ################################################################################ */ /* String to java type conversions These methods have a special signature structure convertTo followed by the schema type name Say for int, convertToint(String) is the converter method Not very elegant but it seems to be the only way! */ public static int convertToInt(String s) { if ((s == null) || s.equals("")){ return Integer.MIN_VALUE; } if (s.startsWith("+")) { s = s.substring(1); } return Integer.parseInt(s); } public static BigDecimal convertToBigDecimal(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new BigDecimal(s); } public static double convertToDouble(String s) { if ((s == null) || s.equals("")){ return Double.NaN; } if (s.startsWith("+")) { s = s.substring(1); } if (POSITIVE_INFINITY.equals(s)) { return Double.POSITIVE_INFINITY; } else if (NEGATIVE_INFINITY.equals(s)) { return Double.NEGATIVE_INFINITY; } return Double.parseDouble(s); } public static BigDecimal convertToDecimal(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new BigDecimal(s); } public static float convertToFloat(String s) { if ((s == null) || s.equals("")){ return Float.NaN; } if (s.startsWith("+")) { s = s.substring(1); } if (POSITIVE_INFINITY.equals(s)) { return Float.POSITIVE_INFINITY; } else if (NEGATIVE_INFINITY.equals(s)) { return Float.NEGATIVE_INFINITY; } return Float.parseFloat(s); } public static String convertToString(String s) { return s; } public static long convertToLong(String s) { if ((s == null) || s.equals("")){ return Long.MIN_VALUE; } if (s.startsWith("+")) { s = s.substring(1); } return Long.parseLong(s); } public static short convertToShort(String s) { if ((s == null) || s.equals("")){ return Short.MIN_VALUE; } if (s.startsWith("+")) { s = s.substring(1); } return Short.parseShort(s); } public static boolean convertToBoolean(String s) { boolean returnValue = false; if ((s != null) && (s.length() > 0)) { if ("1".equals(s) || s.toLowerCase().equals("true")) { returnValue = true; } else if (!"0".equals(s) && !s.toLowerCase().equals("false")) { throw new RuntimeException("in valid string -" + s + " for boolean value"); } } return returnValue; } public static String convertToAnySimpleType(String s) { return s; } public static OMElement convertToAnyType(String s) { try { XMLStreamReader r = StAXUtils.createXMLStreamReader( new ByteArrayInputStream(s.getBytes())); StAXOMBuilder builder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), r); return builder.getDocumentElement(); } catch (XMLStreamException e) { return null; } } public static YearMonth convertToGYearMonth(String s) { if ((s == null) || s.equals("")){ return null; } return new YearMonth(s); } public static MonthDay convertToGMonthDay(String s) { if ((s == null) || s.equals("")){ return null; } return new MonthDay(s); } public static Year convertToGYear(String s) { if ((s == null) || s.equals("")){ return null; } return new Year(s); } public static Month convertToGMonth(String s) { if ((s == null) || s.equals("")){ return null; } return new Month(s); } public static Day convertToGDay(String s) { if ((s == null) || s.equals("")){ return null; } return new Day(s); } public static Duration convertToDuration(String s) { if ((s == null) || s.equals("")){ return null; } return new Duration(s); } public static HexBinary convertToHexBinary(String s) { if ((s == null) || s.equals("")){ return null; } return new HexBinary(s); } public static javax.activation.DataHandler convertToBase64Binary(String s) { // reusing the byteArrayDataSource from the Axiom classes if ((s == null) || s.equals("")){ return null; } ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource( Base64.decode(s) ); return new DataHandler(byteArrayDataSource); } public static javax.activation.DataHandler convertToDataHandler(String s) { return convertToBase64Binary(s); } /** * Converts a given string into a date. Code from Axis1 DateDeserializer. * * @param source * @return Returns Date. */ public static Date convertToDate(String source) { // the lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz? if ((source == null) || source.trim().equals("")) { return null; } source = source.trim(); boolean bc = false; if (source.startsWith("-")) { source = source.substring(1); bc = true; } int year = 0; int month = 0; int day = 0; int timeZoneOffSet = TimeZone.getDefault().getRawOffset(); if (source.length() >= 10) { //first 10 numbers must give the year if ((source.charAt(4) != '-') || (source.charAt(7) != '-')){ throw new RuntimeException("invalid date format (" + source + ") wiht out - s at correct place "); } year = Integer.parseInt(source.substring(0,4)); month = Integer.parseInt(source.substring(5,7)); day = Integer.parseInt(source.substring(8,10)); if (source.length() > 10) { String restpart = source.substring(10); if (restpart.startsWith("Z")) { // this is a gmt time zone value timeZoneOffSet = 0; } else if (restpart.startsWith("+") || restpart.startsWith("-")) { // this is a specific time format string if (restpart.charAt(3) != ':'){ throw new RuntimeException("invalid time zone format (" + source + ") without : at correct place"); } int hours = Integer.parseInt(restpart.substring(1,3)); int minits = Integer.parseInt(restpart.substring(4,6)); timeZoneOffSet = ((hours * 60) + minits) * 60000; if (restpart.startsWith("-")){ timeZoneOffSet = timeZoneOffSet * -1; } } else { throw new RuntimeException("In valid string sufix"); } } } else { throw new RuntimeException("In valid string to parse"); } Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, year); //xml month stars from the 1 and calendar month is starts with 0 calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet); calendar.set(Calendar.DST_OFFSET, 0); calendar.getTimeInMillis(); if (bc){ calendar.set(Calendar.ERA, GregorianCalendar.BC); } return calendar.getTime(); } public static Time convertToTime(String s) { if ((s == null) || s.equals("")){ return null; } return new Time(s); } public static Token convertToToken(String s) { if ((s == null) || s.equals("")){ return null; } return new Token(s); } public static NormalizedString convertToNormalizedString(String s) { if ((s == null) || s.equals("")){ return null; } return new NormalizedString(s); } public static UnsignedLong convertToUnsignedLong(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new UnsignedLong(s); } public static UnsignedInt convertToUnsignedInt(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new UnsignedInt(s); } public static UnsignedShort convertToUnsignedShort(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new UnsignedShort(s); } public static UnsignedByte convertToUnsignedByte(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new UnsignedByte(s); } public static NonNegativeInteger convertToNonNegativeInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new NonNegativeInteger(s); } public static NegativeInteger convertToNegativeInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new NegativeInteger(s); } public static PositiveInteger convertToPositiveInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new PositiveInteger(s); } public static NonPositiveInteger convertToNonPositiveInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new NonPositiveInteger(s); } public static Name convertToName(String s) { if ((s == null) || s.equals("")){ return null; } return new Name(s); } public static NCName convertToNCName(String s) { if ((s == null) || s.equals("")){ return null; } return new NCName(s); } public static Id convertToID(String s) { if ((s == null) || s.equals("")){ return null; } return new Id(s); } public static Id convertToId(String s) { return convertToID(s); } public static Language convertToLanguage(String s) { if ((s == null) || s.equals("")){ return null; } return new Language(s); } public static NMToken convertToNMTOKEN(String s) { if ((s == null) || s.equals("")){ return null; } return new NMToken(s); } public static NMTokens convertToNMTOKENS(String s) { if ((s == null) || s.equals("")){ return null; } return new NMTokens(s); } public static Notation convertToNOTATION(String s) { return null; //todo Need to fix this // return new Notation(s); } public static Entity convertToENTITY(String s) { if ((s == null) || s.equals("")){ return null; } return new Entity(s); } public static Entities convertToENTITIES(String s) { if ((s == null) || s.equals("")){ return null; } return new Entities(s); } public static IDRef convertToIDREF(String s) { if ((s == null) || s.equals("")){ return null; } return new IDRef(s); } public static IDRefs convertToIDREFS(String s) { if ((s == null) || s.equals("")){ return null; } return new IDRefs(s); } public static URI convertToURI(String s){ if ((s == null) || s.equals("")){ return null; } return convertToAnyURI(s); } public static URI convertToAnyURI(String s) { if ((s == null) || s.equals("")){ return null; } try { return new URI(s); } catch (URI.MalformedURIException e) { throw new ObjectConversionException( ADBMessages.getMessage("converter.cannotParse", s), e); } } public static BigInteger convertToInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return new BigInteger(s); } public static BigInteger convertToBigInteger(String s) { if ((s == null) || s.equals("")){ return null; } if (s.startsWith("+")) { s = s.substring(1); } return convertToInteger(s); } public static byte convertToByte(String s) { if ((s == null) || s.equals("")){ return Byte.MIN_VALUE; } return Byte.parseByte(s); } /** * Code from Axis1 code base Note - We only follow the convention in the latest schema spec * * @param source * @return Returns Calendar. */ public static Calendar convertToDateTime(String source) { if ((source == null) || source.trim().equals("")) { return null; } source = source.trim(); // the lexical representation of the date time as follows // '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)? Date date = null; Calendar calendar = Calendar.getInstance(); calendar.clear(); if (source.startsWith("-")) { source = source.substring(1); calendar.set(Calendar.ERA, GregorianCalendar.BC); } int year = 0; int month = 0; int day = 0; int hour = 0; int minite = 0; int second = 0; int miliSecond = 0; int timeZoneOffSet = TimeZone.getDefault().getRawOffset(); if ((source != null) && (source.length() >= 19)) { if ((source.charAt(4) != '-') || (source.charAt(7) != '-') || (source.charAt(10) != 'T') || (source.charAt(13) != ':') || (source.charAt(16) != ':')) { throw new RuntimeException("invalid date format (" + source + ") wiht out - s at correct place "); } year = Integer.parseInt(source.substring(0, 4)); month = Integer.parseInt(source.substring(5, 7)); day = Integer.parseInt(source.substring(8, 10)); hour = Integer.parseInt(source.substring(11, 13)); minite = Integer.parseInt(source.substring(14, 16)); second = Integer.parseInt(source.substring(17, 19)); int milliSecondPartLength = 0; if (source.length() > 19) { String rest = source.substring(19); if (rest.startsWith(".")) { // i.e this have the ('.'s+) part if (rest.endsWith("Z")) { // this is in gmt time zone timeZoneOffSet = 0; calendar.setTimeZone(TimeZone.getTimeZone("GMT")); miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("Z"))); milliSecondPartLength = rest.substring(1,rest.lastIndexOf("Z")).trim().length(); } else if ((rest.lastIndexOf("+") > 0) || (rest.lastIndexOf("-") > 0)) { // this is given in a general time zione String timeOffSet = null; if (rest.lastIndexOf("+") > 0) { timeOffSet = rest.substring(rest.lastIndexOf("+") + 1); miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("+"))); milliSecondPartLength = rest.substring(1, rest.lastIndexOf("+")).trim().length(); // we keep +1 or -1 to finally calculate the value timeZoneOffSet = 1; } else if (rest.lastIndexOf("-") > 0) { timeOffSet = rest.substring(rest.lastIndexOf("-") + 1); miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("-"))); milliSecondPartLength = rest.substring(1, rest.lastIndexOf("-")).trim().length(); // we keep +1 or -1 to finally calculate the value timeZoneOffSet = -1; } if (timeOffSet.charAt(2) != ':') { throw new RuntimeException("invalid time zone format (" + source + ") without : at correct place"); } int hours = Integer.parseInt(timeOffSet.substring(0, 2)); int minits = Integer.parseInt(timeOffSet.substring(3, 5)); timeZoneOffSet = ((hours * 60) + minits) * 60000 * timeZoneOffSet; } else { // i.e it does not have time zone miliSecond = Integer.parseInt(rest.substring(1)); milliSecondPartLength = rest.substring(1).trim().length(); } } else { if (rest.startsWith("Z")) { calendar.setTimeZone(TimeZone.getTimeZone("GMT")); // this is in gmt time zone timeZoneOffSet = 0; } else if (rest.startsWith("+") || rest.startsWith("-")) { // this is given in a general time zione if (rest.charAt(3) != ':') { throw new RuntimeException("invalid time zone format (" + source + ") without : at correct place"); } int hours = Integer.parseInt(rest.substring(1, 3)); int minits = Integer.parseInt(rest.substring(4, 6)); timeZoneOffSet = ((hours * 60) + minits) * 60000; if (rest.startsWith("-")) { timeZoneOffSet = timeZoneOffSet * -1; } } else { throw new NumberFormatException("in valid time zone attribute"); } } } calendar.set(Calendar.YEAR, year); // xml month is started from 1 and calendar month is started from 0 calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minite); calendar.set(Calendar.SECOND, second); if (milliSecondPartLength != 3){ // milisecond part represenst the fraction of the second so we have to // find the fraction and multiply it by 1000. So if milisecond part // has three digits nothing required miliSecond = miliSecond * 1000; for (int i = 0; i < milliSecondPartLength; i++) { miliSecond = miliSecond / 10; } } calendar.set(Calendar.MILLISECOND, miliSecond); calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet); calendar.set(Calendar.DST_OFFSET, 0); } else { throw new NumberFormatException("date string can not be less than 19 charactors"); } return calendar; } /** * Code from Axis1 code base * * @param source * @return Returns QName. */ public static QName convertToQName(String source, String nameSpaceuri) { source = source.trim(); int colon = source.lastIndexOf(":"); //context.getNamespaceURI(source.substring(0, colon)); String localPart = colon < 0 ? source : source.substring(colon + 1); String perfix = colon <= 0 ? "" : source.substring(0, colon); return new QName(nameSpaceuri, localPart, perfix); } /* ################################################################# */ /* java Primitive types to Object conversion methods */ public static Object convertToObject(String i) { return i; } public static Object convertToObject(boolean i) { return Boolean.valueOf(i); } public static Object convertToObject(double i) { return new Double(i); } public static Object convertToObject(byte i) { return new Byte(i); } public static Object convertToObject(char i) { return new Character(i); } public static Object convertToObject(short i) { return new Short(i); } /* list to array conversion methods */ public static Object convertToArray(Class baseArrayClass, String[] valueArray) { //create a list using the string array List valuesList = new ArrayList(valueArray.length); for (int i = 0; i < valueArray.length; i++) { valuesList.add(valueArray[i]); } return convertToArray(baseArrayClass, valuesList); } /** * @param baseArrayClass * @param objectList -> for primitive type array conversion we assume the content to be * strings! * @return Returns Object. */ public static Object convertToArray(Class baseArrayClass, List objectList) { int listSize = objectList.size(); Object returnArray = null; if (int.class.equals(baseArrayClass)) { int[] array = new int[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Integer.parseInt(o.toString()); } else { array[i] = Integer.MIN_VALUE; } } returnArray = array; } else if (float.class.equals(baseArrayClass)) { float[] array = new float[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Float.parseFloat(o.toString()); } else { array[i] = Float.NaN; } } returnArray = array; } else if (short.class.equals(baseArrayClass)) { short[] array = new short[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Short.parseShort(o.toString()); } else { array[i] = Short.MIN_VALUE; } } returnArray = array; } else if (byte.class.equals(baseArrayClass)) { byte[] array = new byte[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Byte.parseByte(o.toString()); } else { array[i] = Byte.MIN_VALUE; } } returnArray = array; } else if (long.class.equals(baseArrayClass)) { long[] array = new long[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Long.parseLong(o.toString()); } else { array[i] = Long.MIN_VALUE; } } returnArray = array; } else if (boolean.class.equals(baseArrayClass)) { boolean[] array = new boolean[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = o.toString().equalsIgnoreCase("true"); } } returnArray = array; } else if (char.class.equals(baseArrayClass)) { char[] array = new char[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = o.toString().toCharArray()[0]; } } returnArray = array; } else if (double.class.equals(baseArrayClass)) { double[] array = new double[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Double.parseDouble(o.toString()); } else { array[i] = Double.NaN; } } returnArray = array; } else if (Calendar.class.equals(baseArrayClass)) { Calendar[] array = new Calendar[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { if (o instanceof String){ array[i] = ConverterUtil.convertToDateTime(o.toString()); } else if (o instanceof Calendar) { array[i] = (Calendar) o; } } } returnArray = array; } else { returnArray = Array.newInstance(baseArrayClass, listSize); ConvertToArbitraryObjectArray(returnArray, baseArrayClass, objectList); } return returnArray; } /** * @param returnArray * @param baseArrayClass * @param objectList */ private static void ConvertToArbitraryObjectArray(Object returnArray, Class baseArrayClass, List objectList) { if (!(ADBBean.class.isAssignableFrom(baseArrayClass))) { try { for (int i = 0; i < objectList.size(); i++) { Object o = objectList.get(i); if (o == null) { // if the string is null the object value must be null Array.set(returnArray, i, null); } else { Array.set(returnArray, i, getObjectForClass( baseArrayClass, o.toString())); } } return; } catch (Exception e) { //oops! - this cannot be converted fall through and //try the other alternative } } try { objectList.toArray((Object[])returnArray); } catch (Exception e) { //we are over with alternatives - throw the //converison exception throw new ObjectConversionException(e); } } /** * We could have used the Arraya.asList() method but that returns an *immutable* list !!!!! * * @param array * @return list */ public static List toList(Object[] array) { if (array == null) { return new ArrayList(); } else { ArrayList list = new ArrayList(); for (int i = 0; i < array.length; i++) { list.add(array[i]); } return list; } } /** * @param intValue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static int compare(int intValue, String value) { return intValue - Integer.parseInt(value); } /** * @param doubleValue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static double compare(double doubleValue, String value) { return doubleValue - Double.parseDouble(value); } /** * @param floatValue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static float compare(float floatValue, String value) { return floatValue - Float.parseFloat(value); } /** * @param longValue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static long compare(long longValue, String value) { return longValue - Long.parseLong(value); } /** * @param shortValue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static int compare(short shortValue, String value) { return shortValue - Short.parseShort(value); } /** * @param byteVlaue * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static int compare(byte byteVlaue, String value) { return byteVlaue - Byte.parseByte(value); } /** * @param binBigInteger * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static int compare(BigInteger binBigInteger, String value) { return binBigInteger.intValue() - Integer.parseInt(value); } /** * @param binBigDecimal * @param value * @return 0 if equal , + value if greater than , - value if less than */ public static double compare(BigDecimal binBigDecimal, String value) { return binBigDecimal.doubleValue() - Double.parseDouble(value); } public static long compare(Duration duration, String value) { Duration compareValue = new Duration(value); return duration.compare(compareValue); } public static long compare(Date date, String value) { Date newDate = convertToDate(value); return date.getTime() - newDate.getTime(); } public static long compare(Time time, String value) { Time newTime = new Time(value); return time.getAsCalendar().getTimeInMillis() - newTime.getAsCalendar().getTimeInMillis(); } public static long compare(Calendar calendar, String value) { Calendar newCalendar = convertToDateTime(value); return calendar.getTimeInMillis() - newCalendar.getTimeInMillis(); } /** * Converts the given .datahandler to a string * * @return string */ public static String getStringFromDatahandler(DataHandler dataHandler) { try { InputStream inStream; if (dataHandler == null) { return ""; } inStream = dataHandler.getDataSource().getInputStream(); byte[] data = IOUtils.getStreamAsByteArray(inStream); return Base64.encode(data); } catch (Exception e) { throw new RuntimeException(e); } } /** * A reflection based method to generate an instance of a given class and populate it with a * given value * * @param clazz * @param value * @return object */ public static Object getObjectForClass(Class clazz, String value) { //first see whether this class has a constructor that can //take the string as an argument. try { Constructor stringConstructor = clazz.getConstructor(new Class[] { String.class }); return stringConstructor.newInstance(new Object[] { value }); } catch (NoSuchMethodException e) { //oops - no such constructors - continue with the //parse method } catch (Exception e) { throw new ObjectConversionException( ADBMessages.getMessage("converter.cannotGenerate", clazz.getName()), e); } try { Method parseMethod = clazz.getMethod("parse", new Class[] { String.class }); Object instance = clazz.newInstance(); return parseMethod.invoke(instance, new Object[] { value }); } catch (NoSuchMethodException e) { throw new ObjectConversionException(e); } catch (Exception e) { throw new ObjectConversionException( ADBMessages.getMessage("converter.cannotGenerate", clazz.getName()), e); } } /** A simple exception that is thrown when the conversion fails */ public static class ObjectConversionException extends RuntimeException { public ObjectConversionException() { } public ObjectConversionException(String message) { super(message); } public ObjectConversionException(Throwable cause) { super(cause); } public ObjectConversionException(String message, Throwable cause) { super(message, cause); } } // serialization methods for xsd any type public static void serializeAnyType(Object value, XMLStreamWriter xmlStreamWriter) throws XMLStreamException { if (value instanceof String) { serializeAnyType("string", value.toString(), xmlStreamWriter); } else if (value instanceof Integer) { serializeAnyType("int", value.toString(), xmlStreamWriter); } else if (value instanceof Boolean) { serializeAnyType("boolean", value.toString(), xmlStreamWriter); } else if (value instanceof URI) { serializeAnyType("anyURI", value.toString(), xmlStreamWriter); } else if (value instanceof Byte) { serializeAnyType("byte", value.toString(), xmlStreamWriter); } else if (value instanceof Date) { serializeAnyType("date", convertToString((Date) value), xmlStreamWriter); } else if (value instanceof Calendar) { serializeAnyType("dateTime", convertToString((Calendar) value), xmlStreamWriter); } else if (value instanceof Time) { serializeAnyType("time", convertToString((Time) value), xmlStreamWriter); } else if (value instanceof Float) { serializeAnyType("float", value.toString(), xmlStreamWriter); } else if (value instanceof Long) { serializeAnyType("long", value.toString(), xmlStreamWriter); } else if (value instanceof Double) { serializeAnyType("double", value.toString(), xmlStreamWriter); } else if (value instanceof Short) { serializeAnyType("short", value.toString(), xmlStreamWriter); } else if (value instanceof BigDecimal) { serializeAnyType("decimal", value.toString(), xmlStreamWriter); } else if (value instanceof DataHandler) { addTypeAttribute(xmlStreamWriter,"base64Binary"); MTOMAwareXMLStreamWriter mtomAwareXMLStreamWriter = (MTOMAwareXMLStreamWriter) xmlStreamWriter; mtomAwareXMLStreamWriter.writeDataHandler((DataHandler)value); } else if (value instanceof QName) { QName qNameValue = (QName) value; String prefix = xmlStreamWriter.getPrefix(qNameValue.getNamespaceURI()); if (prefix == null) { prefix = BeanUtil.getUniquePrefix(); xmlStreamWriter.writeNamespace(prefix, qNameValue.getNamespaceURI()); xmlStreamWriter.setPrefix(prefix, qNameValue.getNamespaceURI()); } String attributeValue = qNameValue.getLocalPart(); if (!prefix.equals("")) { attributeValue = prefix + ":" + attributeValue; } serializeAnyType("QName", attributeValue, xmlStreamWriter); } else if (value instanceof UnsignedByte) { serializeAnyType("unsignedByte", convertToString((UnsignedByte) value), xmlStreamWriter); } else if (value instanceof UnsignedLong) { serializeAnyType("unsignedLong", convertToString((UnsignedLong) value), xmlStreamWriter); } else if (value instanceof UnsignedShort) { serializeAnyType("unsignedShort", convertToString((UnsignedShort) value), xmlStreamWriter); } else if (value instanceof UnsignedInt) { serializeAnyType("unsignedInt", convertToString((UnsignedInt) value), xmlStreamWriter); } else if (value instanceof PositiveInteger) { serializeAnyType("positiveInteger", convertToString((PositiveInteger) value), xmlStreamWriter); } else if (value instanceof NegativeInteger) { serializeAnyType("negativeInteger", convertToString((NegativeInteger) value), xmlStreamWriter); } else if (value instanceof NonNegativeInteger) { serializeAnyType("nonNegativeInteger", convertToString((NonNegativeInteger) value), xmlStreamWriter); } else if (value instanceof NonPositiveInteger) { serializeAnyType("nonPositiveInteger", convertToString((NonPositiveInteger) value), xmlStreamWriter); } else { throw new XMLStreamException("Unknow type can not serialize"); } } /** * this method writes the xsi:type attrubte and the value to the xmlstreamwriter * to serialize the anytype object * @param type - xsd type of the attribute * @param value - string value of the object * @param xmlStreamWriter * @throws XMLStreamException */ private static void serializeAnyType(String type, String value, XMLStreamWriter xmlStreamWriter) throws XMLStreamException { addTypeAttribute(xmlStreamWriter, type); xmlStreamWriter.writeCharacters(value); } private static void addTypeAttribute(XMLStreamWriter xmlStreamWriter, String type) throws XMLStreamException { String prefix = xmlStreamWriter.getPrefix(Constants.XSI_NAMESPACE); if (prefix == null) { prefix = BeanUtil.getUniquePrefix(); xmlStreamWriter.writeNamespace(prefix, Constants.XSI_NAMESPACE); xmlStreamWriter.setPrefix(prefix, Constants.XSI_NAMESPACE); } prefix = xmlStreamWriter.getPrefix(Constants.XSD_NAMESPACE); if (prefix == null) { prefix = BeanUtil.getUniquePrefix(); xmlStreamWriter.writeNamespace(prefix, Constants.XSD_NAMESPACE); xmlStreamWriter.setPrefix(prefix, Constants.XSD_NAMESPACE); } String attributeValue = null; if (prefix.equals("")) { attributeValue = type; } else { attributeValue = prefix + ":" + type; } xmlStreamWriter.writeAttribute(Constants.XSI_NAMESPACE, "type", attributeValue); } public static Object getAnyTypeObject(XMLStreamReader xmlStreamReader, Class extensionMapperClass) throws XMLStreamException { Object returnObject = null; // make sure reader is at the first element. while(!xmlStreamReader.isStartElement()){ xmlStreamReader.next(); } // first check whether this element is null or not String nillableValue = xmlStreamReader.getAttributeValue(Constants.XSI_NAMESPACE, "nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ returnObject = null; } else { String attributeType = xmlStreamReader.getAttributeValue(Constants.XSI_NAMESPACE, "type"); if (attributeType != null) { String attributeTypePrefix = ""; if (attributeType.indexOf(":") > -1) { attributeTypePrefix = attributeType.substring(0,attributeType.indexOf(":")); attributeType = attributeType.substring(attributeType.indexOf(":") + 1); } NamespaceContext namespaceContext = xmlStreamReader.getNamespaceContext(); String attributeNameSpace = namespaceContext.getNamespaceURI(attributeTypePrefix); if (attributeNameSpace.equals(Constants.XSD_NAMESPACE)) { if ("base64Binary".equals(attributeType)) { xmlStreamReader.next(); returnObject = getDataHandlerObject(xmlStreamReader); } else { // we have to do this other wise xmlstream event type is not set. xmlStreamReader.next(); String attribValue = xmlStreamReader.getText(); xmlStreamReader.next(); if (attribValue != null) { if (attributeType.equals("string")) { returnObject = attribValue; } else if (attributeType.equals("int")) { returnObject = new Integer(attribValue); } else if (attributeType.equals("QName")) { String namespacePrefix = null; String localPart = null; if (attribValue.indexOf(":") > -1) { namespacePrefix = attribValue.substring(0, attribValue.indexOf(":")); localPart = attribValue.substring(attribValue.indexOf(":") + 1); returnObject = new QName(namespaceContext.getNamespaceURI(namespacePrefix), localPart); } } else if ("boolean".equals(attributeType)) { returnObject = new Boolean(attribValue); } else if ("anyURI".equals(attributeType)) { try { returnObject = new URI(attribValue); } catch (URI.MalformedURIException e) { throw new XMLStreamException("Invalid URI"); } } else if ("date".equals(attributeType)) { returnObject = ConverterUtil.convertToDate(attribValue); } else if ("dateTime".equals(attributeType)) { returnObject = ConverterUtil.convertToDateTime(attribValue); } else if ("time".equals(attributeType)) { returnObject = ConverterUtil.convertToTime(attribValue); } else if ("byte".equals(attributeType)) { returnObject = new Byte(attribValue); } else if ("short".equals(attributeType)) { returnObject = new Short(attribValue); } else if ("float".equals(attributeType)) { returnObject = new Float(attribValue); } else if ("long".equals(attributeType)) { returnObject = new Long(attribValue); } else if ("double".equals(attributeType)) { returnObject = new Double(attribValue); } else if ("decimal".equals(attributeType)) { returnObject = new BigDecimal(attribValue); } else if ("unsignedLong".equals(attributeType)) { returnObject = new UnsignedLong(attribValue); } else if ("unsignedInt".equals(attributeType)) { returnObject = new UnsignedInt(attribValue); } else if ("unsignedShort".equals(attributeType)) { returnObject = new UnsignedShort(attribValue); } else if ("unsignedByte".equals(attributeType)) { returnObject = new UnsignedByte(attribValue); } else if ("positiveInteger".equals(attributeType)) { returnObject = new PositiveInteger(attribValue); } else if ("negativeInteger".equals(attributeType)) { returnObject = new NegativeInteger(attribValue); } else if ("nonNegativeInteger".equals(attributeType)) { returnObject = new NonNegativeInteger(attribValue); } else if ("nonPositiveInteger".equals(attributeType)) { returnObject = new NonPositiveInteger(attribValue); } else { throw new ADBException("Unknown type ==> " + attributeType); } } else { throw new ADBException("Attribute value is null"); } } } else { try { Method getObjectMethod = extensionMapperClass.getMethod("getTypeObject", new Class[]{String.class, String.class, XMLStreamReader.class}); returnObject = getObjectMethod.invoke(null, new Object[]{attributeNameSpace, attributeType, xmlStreamReader}); } catch (NoSuchMethodException e) { throw new ADBException("Can not find the getTypeObject method in the " + "extension mapper class ", e); } catch (IllegalAccessException e) { throw new ADBException("Can not access the getTypeObject method in the " + "extension mapper class ", e); } catch (InvocationTargetException e) { throw new ADBException("Can not invoke the getTypeObject method in the " + "extension mapper class ", e); } } } else { throw new ADBException("Any type element type has not been given"); } } return returnObject; } private static Object getDataHandlerObject(XMLStreamReader reader) throws XMLStreamException { Object dataHandler = null; if (Boolean.TRUE.equals(reader.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE)) && Boolean.TRUE.equals(reader.getProperty(OMConstants.IS_BINARY))) { dataHandler = reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER); } else { if (reader.getEventType() == XMLStreamConstants.START_ELEMENT && reader.getName().equals(new QName(MTOMConstants.XOP_NAMESPACE_URI, MTOMConstants.XOP_INCLUDE))) { String id = ElementHelper.getContentID(reader, "UTF-8"); dataHandler = ((MTOMStAXSOAPModelBuilder) ((OMStAXWrapper) reader).getBuilder()).getDataHandler(id); reader.next(); } else if (reader.hasText()) { String content = reader.getText(); dataHandler = ConverterUtil.convertToBase64Binary(content); } } return dataHandler; } static { isCustomClassPresent = (System.getProperty(SYSTEM_PROPERTY_ADB_CONVERTERUTIL) != null); if (isCustomClassPresent){ String className = System.getProperty(SYSTEM_PROPERTY_ADB_CONVERTERUTIL); try { customClass = Class.forName(className); } catch (ClassNotFoundException e) { log.error("Can not load the converter util class " + className + " using default org.apache.axis2.databinding.utils.ConverterUtil class"); isCustomClassPresent = false; } } } } ./src/org/apache/axis2/databinding/utils/MultirefHelper.java0000664000175000017500000002750611767656530023242 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.databinding.typemapping.SimpleTypeMapper; import org.apache.axis2.engine.ObjectSupplier; import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class MultirefHelper { public static final String SOAP12_REF_ATTR = "ref"; public static final String SOAP11_REF_ATTR = "href"; private boolean filledTable; private OMElement parent; private HashMap objectmap = new HashMap(); private HashMap elementMap = new HashMap(); private HashMap omElementMap = new HashMap(); public MultirefHelper(OMElement parent) { this.parent = parent; } public Object getObject(String id) { return objectmap.get(id); } public OMElement getOMElement(String id) { return (OMElement)omElementMap.get(id); } public OMElement processOMElementRef(String id) throws AxisFault { if (!filledTable) { readallChildElements(); } OMElement val = (OMElement)elementMap.get(id); if (val == null) { throw new AxisFault("Invalid reference :" + id); } else { OMElement ele = processElementforRefs(val); OMElement cloneele = elementClone(ele); omElementMap.put(id, cloneele); return cloneele; } } public OMElement processElementforRefs(OMElement elemnts) throws AxisFault { Iterator itr = elemnts.getChildElements(); while (itr.hasNext()) { OMElement omElement = (OMElement)itr.next(); OMAttribute attri = processRefAtt(omElement); if (attri != null) { String ref = getAttvalue(attri); OMElement tempele = getOMElement(ref); if (tempele == null) { tempele = processOMElementRef(ref); } OMElement ele2 = elementClone(tempele); Iterator itrChild = ele2.getChildren(); while (itrChild.hasNext()) { Object obj = itrChild.next(); if (obj instanceof OMNode) { omElement.addChild((OMNode)obj); } } } } return elemnts; } private OMElement elementClone(OMElement ele) { return new StAXOMBuilder(ele.getXMLStreamReader()).getDocumentElement(); } public Object processRef(Class javatype, String id, ObjectSupplier objectSupplier) throws AxisFault { if (!filledTable) { readallChildElements(); } OMElement val = (OMElement)elementMap.get(id); if (val == null) { throw new AxisFault("Invalid reference :" + id); } else { if (SimpleTypeMapper.isSimpleType(javatype)) { /** * in this case OM element can not contains more child, that is no way to get * the value as an exp , * * foo * * the above one is not valid , that should always be like below * foo */ Object valObj = SimpleTypeMapper.getSimpleTypeObject(javatype, val); objectmap.put(id, valObj); return valObj; } else if (SimpleTypeMapper.isCollection(javatype)) { Object valobj = SimpleTypeMapper.getArrayList(val); objectmap.put(id, valobj); return valobj; } else { Object obj = BeanUtil.deserialize(javatype, val, this, objectSupplier); objectmap.put(id, obj); return obj; } } } private void readallChildElements() { Iterator childs = parent.getChildElements(); while (childs.hasNext()) { OMElement omElement = (OMElement)childs.next(); OMAttribute id = omElement.getAttribute(new QName("id")); if (id != null) { omElement.build(); elementMap.put(id.getAttributeValue(), omElement.detach()); } } filledTable = true; } public static String getAttvalue(OMAttribute omatribute) { String ref; ref = omatribute.getAttributeValue(); if (ref != null) { if (ref.charAt(0) == '#') { ref = ref.substring(1); } } return ref; } public static OMAttribute processRefAtt(OMElement omElement) { OMAttribute omatribute = omElement.getAttribute(new QName(SOAP11_REF_ATTR)); if (omatribute == null) { omatribute = omElement.getAttribute(new QName(SOAP12_REF_ATTR)); } return omatribute; } public void clean() { elementMap.clear(); objectmap.clear(); } /** * this method is used to process the href attributes which may comes with the incomming soap mesaage * * * * * * the real argument * blue * * * here we assume first child of the soap body has the main object structure and others contain the * multiref parts. * Soap spec says that those multiref parts must be top level elements. * * @param soapEnvelope */ public static void processHrefAttributes(SOAPEnvelope soapEnvelope) throws AxisFault { // first populate the multiref parts to a hash table. SOAPBody soapBody = soapEnvelope.getBody(); // first build the whole tree soapBody.build(); OMElement omElement = null; OMAttribute idAttribute = null; Map idAndOMElementMap = new HashMap(); for (Iterator iter = soapBody.getChildElements(); iter.hasNext();) { omElement = (OMElement) iter.next(); // the attribute id is an unqualified attribute idAttribute = omElement.getAttribute(new QName(null, "id")); if (idAttribute != null) { // for the first element there may not have an id idAndOMElementMap.put(idAttribute.getAttributeValue(), omElement); } } // start processing from the first child processHrefAttributes(idAndOMElementMap, soapBody.getFirstElement(), OMAbstractFactory.getOMFactory()); } public static void processHrefAttributes(Map idAndOMElementMap, OMElement elementToProcess, OMFactory omFactory) throws AxisFault { // first check whether this element has an href value. // href is also an unqualifed attribute OMAttribute hrefAttribute = elementToProcess.getAttribute(new QName(null, "href")); if (hrefAttribute != null) { // i.e this has an href attribute String hrefAttributeValue = hrefAttribute.getAttributeValue(); if (!hrefAttributeValue.startsWith("#")) { throw new AxisFault("In valid href ==> " + hrefAttributeValue + " does not starts with #"); } else { OMElement referedOMElement = (OMElement) idAndOMElementMap.get(hrefAttributeValue.substring(1)); if (referedOMElement == null) { throw new AxisFault("In valid href ==> " + hrefAttributeValue + " can not find" + "the matching element"); } else { // now we have to remove the hrefAttribute and add all the child elements to the // element being proccesed elementToProcess.removeAttribute(hrefAttribute); OMElement clonedReferenceElement = getClonedOMElement(referedOMElement, omFactory); OMNode omNode = null; for (Iterator iter = clonedReferenceElement.getChildren(); iter.hasNext();) { omNode = (OMNode) iter.next(); elementToProcess.addChild(omNode.detach()); } // add attributes OMAttribute omAttribute = null; for (Iterator iter = clonedReferenceElement.getAllAttributes(); iter.hasNext();) { omAttribute = (OMAttribute) iter.next(); // we do not have to populate the id attribute if (!omAttribute.getLocalName().equals("id")) { elementToProcess.addAttribute(omAttribute); } } } } } // call recursively to proces all elements OMElement childOMElement = null; for (Iterator iter = elementToProcess.getChildElements(); iter.hasNext();) { childOMElement = (OMElement) iter.next(); processHrefAttributes(idAndOMElementMap, childOMElement, omFactory); } } /** * returns an cloned om element for this OMElement * * @param omElement * @return cloned omElement */ public static OMElement getClonedOMElement(OMElement omElement, OMFactory omFactory) throws AxisFault { OMElement newOMElement = omFactory.createOMElement(omElement.getQName()); // copying attributes OMAttribute omAttribute = null; OMAttribute newOMAttribute = null; for (Iterator iter = omElement.getAllAttributes(); iter.hasNext();) { omAttribute = (OMAttribute) iter.next(); if (!omAttribute.getAttributeValue().equals("id")) { newOMAttribute = omFactory.createOMAttribute( omAttribute.getLocalName(), omAttribute.getNamespace(), omAttribute.getAttributeValue()); newOMElement.addAttribute(newOMAttribute); } } OMNode omNode = null; OMText omText = null; for (Iterator iter = omElement.getChildren(); iter.hasNext();) { omNode = (OMNode) iter.next(); if (omNode instanceof OMText) { omText = (OMText) omNode; newOMElement.addChild(omFactory.createOMText(omText.getText())); } else if (omNode instanceof OMElement) { newOMElement.addChild(getClonedOMElement((OMElement) omNode, omFactory)); } else { throw new AxisFault("Unknown child element type ==> " + omNode.getClass().getName()); } } return newOMElement; } } ./src/org/apache/axis2/databinding/utils/BeanUtil.java0000664000175000017500000011744111767656530022014 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory; import org.apache.axiom.om.util.Base64; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.databinding.typemapping.SimpleTypeMapper; import org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl; import org.apache.axis2.deployment.util.BeanExcludeInfo; import org.apache.axis2.deployment.util.ExcludeInfo; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.java2wsdl.TypeTable; import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.util.Loader; import org.apache.axis2.util.StreamWrapper; import org.codehaus.jam.JClass; import org.codehaus.jam.JProperty; import org.codehaus.jam.JamClassIterator; import org.codehaus.jam.JamService; import org.codehaus.jam.JamServiceFactory; import org.codehaus.jam.JamServiceParams; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; public class BeanUtil { private static int nsCount = 1; /** * To Serilize Bean object this method is used, this will create an object array using given * bean object * */ public static XMLStreamReader getPullParser(Object beanObject, QName beanName, TypeTable typeTable, boolean qualified, boolean processingDocLitBare) { try { JamServiceFactory factory = JamServiceFactory.getInstance(); JamServiceParams jam_service_parms = factory.createServiceParams(); ClassLoader cl = beanObject.getClass().getClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); jam_service_parms.addClassLoader(cl); jam_service_parms.includeClass(beanObject.getClass().getName()); JamService service = factory.createService(jam_service_parms); JamClassIterator jClassIter = service.getClasses(); JClass jClass; if (jClassIter.hasNext()) { jClass = (JClass)jClassIter.next(); } else { throw new AxisFault("No service class found , exception from JAM"); } QName elemntNameSpace = null; if (typeTable != null && qualified) { QName qNamefortheType = typeTable.getQNamefortheType(beanObject.getClass().getName()); if (qNamefortheType == null) { qNamefortheType = typeTable.getQNamefortheType( beanObject.getClass().getPackage().getName()); } if (qNamefortheType == null) { throw new AxisFault("Mapping qname not fond for the package: " + beanObject.getClass().getPackage().getName()); } elemntNameSpace = new QName(qNamefortheType.getNamespaceURI(), "elementName"); } AxisService axisService = null; if (MessageContext.getCurrentMessageContext() != null) { axisService = MessageContext.getCurrentMessageContext().getAxisService(); } BeanExcludeInfo beanExcludeInfo = null; if (axisService != null && axisService.getExcludeInfo() != null) { beanExcludeInfo = axisService.getExcludeInfo().getBeanExcludeInfoForClass( jClass.getQualifiedName()); } // properties from JAM ArrayList propertyList = new ArrayList(); JProperty properties [] = jClass.getDeclaredProperties(); for (int i = 0; i < properties.length; i++) { JProperty property = properties[i]; String propertyName = getCorrectName(property.getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)){ propertyList.add(property); } } JClass supClass = jClass.getSuperclass(); while (!supClass.getQualifiedName().startsWith("java.")) { properties = supClass.getDeclaredProperties(); ExcludeInfo excludeInfo = axisService.getExcludeInfo(); if (excludeInfo != null) { beanExcludeInfo = excludeInfo.getBeanExcludeInfoForClass(supClass.getQualifiedName()); } for (int i = 0; i < properties.length; i++) { JProperty property = properties[i]; String propertyName = getCorrectName(property.getSimpleName()); if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)) { propertyList.add(property); } } supClass = supClass.getSuperclass(); } properties = new JProperty[propertyList.size()]; for (int i = 0; i < propertyList.size(); i++) { JProperty jProperty = (JProperty)propertyList.get(i); properties[i] = jProperty; } Arrays.sort(properties); BeanInfo beanInfo = Introspector.getBeanInfo(beanObject.getClass()); PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors(); HashMap propertMap = new HashMap(); for (int i = 0; i < propDescs.length; i++) { PropertyDescriptor propDesc = propDescs[i]; if (propDesc.getName().equals("class")) { continue; } propertMap.put(propDesc.getName(), propDesc); } ArrayList object = new ArrayList(); for (int i = 0; i < properties.length; i++) { JProperty property = properties[i]; PropertyDescriptor propDesc = (PropertyDescriptor)propertMap.get( getCorrectName(property.getSimpleName())); if (propDesc == null) { propDesc = (PropertyDescriptor)propertMap.get( (property.getSimpleName())); } if (propDesc == null) { continue; } Class ptype = propDesc.getPropertyType(); if (propDesc.getName().equals("class")) { continue; } if (SimpleTypeMapper.isSimpleType(ptype)) { Method readMethod = propDesc.getReadMethod(); Object value; if(readMethod!=null){ if (property.getGetter() !=null && property.getGetter().isPublic()){ readMethod.setAccessible(true); } value = readMethod.invoke(beanObject, null); } else { throw new AxisFault("can not find read method for : " + propDesc.getName()); } addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(value == null ? null : SimpleTypeMapper.getStringValue(value)); } else if (ptype.isArray()) { if (SimpleTypeMapper.isSimpleType(ptype.getComponentType())) { Method readMethod = propDesc.getReadMethod(); Object value; if(readMethod!=null){ if (property.getGetter() !=null && property.getGetter().isPublic()){ readMethod.setAccessible(true); } value = readMethod.invoke(beanObject,null); } else { throw new AxisFault("can not find read method for : " + propDesc.getName()); } if (value != null) { if("byte".equals(ptype.getComponentType().getName())) { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(Base64.encode((byte[]) value)); } else { int i1 = Array.getLength(value); for (int j = 0; j < i1; j++) { Object o = Array.get(value, j); addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(o == null ? null : SimpleTypeMapper.getStringValue(o)); } } } else { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(value); } } else { Method readMethod = propDesc.getReadMethod(); Object value [] = null; if(readMethod!=null){ if (property.getGetter() !=null && property.getGetter().isPublic()){ readMethod.setAccessible(true); } value = (Object[])propDesc.getReadMethod().invoke(beanObject, null); } if (value != null) { for (int j = 0; j < value.length; j++) { Object o = value[j]; addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(o); } } else { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(value); } } } else if (SimpleTypeMapper.isCollection(ptype)) { Method readMethod = propDesc.getReadMethod(); if (property.getGetter() !=null && property.getGetter().isPublic()){ readMethod.setAccessible(true); } Object value = readMethod.invoke(beanObject, null); Collection objList = (Collection)value; if (objList != null && objList.size() > 0) { //this was given error , when the array.size = 0 // and if the array contain simple type , then the ADBPullParser asked // PullParser from That simpel type for (Iterator j = objList.iterator(); j.hasNext();) { Object o = j.next(); if (SimpleTypeMapper.isSimpleType(o)) { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(o); } else { addTypeQname(elemntNameSpace, object, propDesc, beanName ,processingDocLitBare); object.add(o); } } } else { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); object.add(value); } } else { addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare); Method readMethod = propDesc.getReadMethod(); if (property.getGetter() !=null && property.getGetter().isPublic()){ readMethod.setAccessible(true); } Object value = readMethod.invoke(beanObject, null); if ("java.lang.Object".equals(ptype.getName())){ if ((value instanceof Integer ) || (value instanceof Short) || (value instanceof Long) || (value instanceof Float)) { object.add(value.toString()); continue; } } object.add(value); } } // Added objectAttributes as a fix for issues AXIS2-2055 and AXIS2-1899 to // support polymorphism in POJO approach. // For some reason, using QName(Constants.XSI_NAMESPACE, "type", "xsi") does not generate // an xsi:type attribtue properly for inner objects. So just using a simple QName("type"). ArrayList objectAttributes = new ArrayList(); objectAttributes.add(new QName("type")); objectAttributes.add(beanObject.getClass().getName()); return new ADBXMLStreamReaderImpl(beanName, object.toArray(), objectAttributes.toArray(), typeTable, qualified); } catch (java.io.IOException e) { throw new RuntimeException(e); } catch (java.beans.IntrospectionException e) { throw new RuntimeException(e); } catch (java.lang.reflect.InvocationTargetException e) { throw new RuntimeException(e); } catch (java.lang.IllegalAccessException e) { throw new RuntimeException(e); } } private static void addTypeQname(QName elemntNameSpace, ArrayList object, PropertyDescriptor propDesc, QName beanName, boolean processingDocLitBare) { if (elemntNameSpace != null) { object.add(new QName(elemntNameSpace.getNamespaceURI(), getCorrectName(propDesc.getName()) , elemntNameSpace.getPrefix())); } else { if(processingDocLitBare){ object.add(new QName(getCorrectName(propDesc.getName()))); } else { object.add(new QName(beanName.getNamespaceURI(), getCorrectName(propDesc.getName()), beanName.getPrefix())); } } } /** * to get the pull parser for a given bean object , generate the wrpper element using class * name * * @param beanObject */ public static XMLStreamReader getPullParser(Object beanObject) { String className = beanObject.getClass().getName(); if (className.indexOf(".") > 0) { className = className.substring(className.lastIndexOf('.') + 1, className.length()); } return getPullParser(beanObject, new QName(className), null, false, false); } public static Object deserialize(Class beanClass, OMElement beanElement, ObjectSupplier objectSupplier, String arrayLocalName) throws AxisFault { Object beanObj =null; try { // Added this block as a fix for issues AXIS2-2055 and AXIS2-1899 // to support polymorphism in POJO approach. // Retrieve the type name of the instance from the 'type' attribute // and retrieve the class. String instanceTypeName = beanElement.getAttributeValue(new QName("type")); if ((instanceTypeName != null) && (! beanClass.isArray())) { try { beanClass = Loader.loadClass(beanClass.getClassLoader(), instanceTypeName); } catch (ClassNotFoundException ce) { throw AxisFault.makeFault(ce); } } if (beanClass.isArray()) { ArrayList valueList = new ArrayList(); Class arrayClassType = beanClass.getComponentType(); if ("byte".equals(arrayClassType.getName())) { return Base64.decode(beanElement.getFirstElement().getText()); } else { Iterator parts = beanElement.getChildElements(); OMElement omElement; while (parts.hasNext()) { Object objValue = parts.next(); if (objValue instanceof OMElement) { omElement = (OMElement)objValue; if (!arrayLocalName.equals(omElement.getLocalName())) { continue; } Object obj = deserialize(arrayClassType, omElement, objectSupplier, null); if (obj != null) { valueList.add(obj); } } } return ConverterUtil.convertToArray(arrayClassType, valueList); } } else { if (SimpleTypeMapper.isSimpleType(beanClass)) { return SimpleTypeMapper.getSimpleTypeObject(beanClass, beanElement); } else if ("java.lang.Object".equals(beanClass.getName())){ return beanElement.getFirstOMChild(); } HashMap properties = new HashMap(); BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propDescs.length; i++) { PropertyDescriptor proprty = propDescs[i]; properties.put(proprty.getName(), proprty); } Iterator elements = beanElement.getChildren(); if (beanObj == null) { beanObj = objectSupplier.getObject(beanClass); } while (elements.hasNext()) { // the beanClass could be an abstract one. // so create an instance only if there are elements, in // which case a concrete subclass is available to instantiate. OMElement parts; Object objValue = elements.next(); if (objValue instanceof OMElement) { parts = (OMElement)objValue; } else { continue; } OMAttribute attribute = parts.getAttribute( new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi")); // if parts/@href != null then need to find element with id and deserialize. // before that first check whether we already have it in the hashtable String partsLocalName = parts.getLocalName(); PropertyDescriptor prty = (PropertyDescriptor)properties.remove(partsLocalName); if (prty != null) { Class parameters = prty.getPropertyType(); if (prty.equals("class")) continue; Object partObj; if (attribute != null) { partObj = null; } else { if (SimpleTypeMapper.isSimpleType(parameters)) { partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts); } else if (SimpleTypeMapper.isCollection(parameters)) { partObj = SimpleTypeMapper.getArrayList((OMElement) parts.getParent(), prty.getName()); } else if (SimpleTypeMapper.isDataHandler(parameters)){ partObj = SimpleTypeMapper.getDataHandler(parts); } else if (parameters.isArray()) { partObj = deserialize(parameters, (OMElement)parts.getParent(), objectSupplier, prty.getName()); } else { partObj = deserialize(parameters, parts, objectSupplier, null); } } Object [] parms = new Object[] { partObj }; Method writeMethod = prty.getWriteMethod(); if (writeMethod != null) { writeMethod.setAccessible(true); writeMethod.invoke(beanObj, parms); } } } return beanObj; } } catch (IllegalAccessException e) { throw new AxisFault("IllegalAccessException : " + e); } catch (InvocationTargetException e) { throw new AxisFault("InvocationTargetException : " + e); } catch (IntrospectionException e) { throw new AxisFault("IntrospectionException : " + e); } } public static Object deserialize(Class beanClass, OMElement beanElement, MultirefHelper helper, ObjectSupplier objectSupplier) throws AxisFault { Object beanObj; try { HashMap properties = new HashMap(); BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propDescs.length; i++) { PropertyDescriptor proprty = propDescs[i]; properties.put(proprty.getName(), proprty); } beanObj = objectSupplier.getObject(beanClass); Iterator elements = beanElement.getChildren(); while (elements.hasNext()) { Object child = elements.next(); OMElement parts; if (child instanceof OMElement) { parts = (OMElement)child; } else { continue; } String partsLocalName = parts.getLocalName(); PropertyDescriptor prty = (PropertyDescriptor)properties.get( partsLocalName.toLowerCase()); if (prty != null) { Class parameters = prty.getPropertyType(); if (prty.equals("class")) continue; Object partObj; OMAttribute attr = MultirefHelper.processRefAtt(parts); if (attr != null) { String refId = MultirefHelper.getAttvalue(attr); partObj = helper.getObject(refId); if (partObj == null) { partObj = helper.processRef(parameters, refId, objectSupplier); } } else { partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts); if (partObj == null) { partObj = deserialize(parameters, parts, objectSupplier, null); } } Object [] parms = new Object[] { partObj }; Method writeMethod = prty.getWriteMethod(); if (writeMethod != null) { writeMethod.setAccessible(true); writeMethod.invoke(beanObj, parms); } } } } catch (IllegalAccessException e) { throw new AxisFault("IllegalAccessException : " + e); } catch (InvocationTargetException e) { throw new AxisFault("InvocationTargetException : " + e); } catch (IntrospectionException e) { throw new AxisFault("IntrospectionException : " + e); } return beanObj; } /** * To get JavaObjects from XML elemnt , the element most of the time contains only one element * in that case that element will be converted to the JavaType specified by the javaTypes array * The algo is as follows, get the childerns of the response element , and if it conatian more * than one element then check the retuen type of that element and conver that to corresponding * JavaType * * @param response OMElement * @param javaTypes Array of JavaTypes * @return Array of objects * @throws AxisFault */ public static Object [] deserialize(OMElement response, Object [] javaTypes, ObjectSupplier objectSupplier) throws AxisFault { /* * Take the number of parameters in the method and , only take that much of child elements * from the OMElement , other are ignore , as an example * if the method is , foo(String a , int b) * and if the OMElemet * * Val1 * Val2 * Val3 * * only the val1 and Val2 take into account */ int length = javaTypes.length; int count = 0; Object [] retObjs = new Object[length]; /* * If the body first child contains , then there can not be any other element withot * refs , so I can assume if the first child of the body first element has ref then * the message has to handle as mutiref message. * as an exmple if the body is like below * * * * * then there can not be any element without refs , meaning following we are not handling * * * absbsbs * */ Iterator parts = response.getChildren(); //to handle multirefs //have to check the instanceof MultirefHelper helper = new MultirefHelper((OMElement)response.getParent()); //to support array . if the parameter type is array , then all the omelemnts with that paramtre name // has to get and add to the list Class classType; String currentLocalName; while (parts.hasNext() && count < length) { Object objValue = parts.next(); OMElement omElement; if (objValue instanceof OMElement) { omElement = (OMElement)objValue; } else { continue; } currentLocalName = omElement.getLocalName(); classType = (Class)javaTypes[count]; omElement = ProcessElement(classType, omElement, helper, parts, currentLocalName, retObjs, count, objectSupplier); while (omElement != null) { count ++; omElement = ProcessElement((Class)javaTypes[count], omElement, helper, parts, omElement.getLocalName(), retObjs, count, objectSupplier); } count ++; } // Ensure that we have at least a zero element array for (int i = 0; i < length; i++) { Class clazz = (Class)javaTypes[i]; if (retObjs[i] == null && clazz.isArray()) { retObjs[i] = Array.newInstance(clazz.getComponentType(), 0); } } helper.clean(); return retObjs; } private static OMElement ProcessElement(Class classType, OMElement omElement, MultirefHelper helper, Iterator parts, String currentLocalName, Object[] retObjs, int count, ObjectSupplier objectSupplier) throws AxisFault { Object objValue; if (classType.isArray()) { boolean done = true; ArrayList valueList = new ArrayList(); Class arrayClassType = classType.getComponentType(); if ("byte".equals(arrayClassType.getName())) { retObjs[count] = processObject(omElement, arrayClassType, helper, true, objectSupplier); return null; } else { valueList.add(processObject(omElement, arrayClassType, helper, true, objectSupplier)); } while (parts.hasNext()) { objValue = parts.next(); if (objValue instanceof OMElement) { omElement = (OMElement)objValue; } else { continue; } if (!currentLocalName.equals(omElement.getLocalName())) { done = false; break; } Object o = processObject(omElement, arrayClassType, helper, true, objectSupplier); valueList.add(o); } if(valueList.get(0)==null){ retObjs[count] = null; } else { retObjs[count] = ConverterUtil.convertToArray(arrayClassType, valueList); } if (!done) { return omElement; } } else { //handling refs retObjs[count] = processObject(omElement, classType, helper, false, objectSupplier); } return null; } public static Object processObject(OMElement omElement, Class classType, MultirefHelper helper, boolean isArrayType, ObjectSupplier objectSupplier) throws AxisFault { boolean hasRef = false; OMAttribute omatribute = MultirefHelper.processRefAtt(omElement); String ref = null; if (omatribute != null) { hasRef = true; ref = MultirefHelper.getAttvalue(omatribute); } if (OMElement.class.isAssignableFrom(classType)) { if (hasRef) { OMElement elemnt = helper.getOMElement(ref); if (elemnt == null) { return helper.processOMElementRef(ref); } else { return elemnt; } } else return omElement; } else { if (hasRef) { if (helper.getObject(ref) != null) { return helper.getObject(ref); } else { return helper.processRef(classType, ref, objectSupplier); } } else { OMAttribute attribute = omElement.getAttribute( new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi")); if (attribute != null) { return null; } if (SimpleTypeMapper.isSimpleType(classType)) { if (isArrayType && "byte".equals(classType.getName())) { String value = omElement.getText(); return Base64.decode(value); } else { return SimpleTypeMapper.getSimpleTypeObject(classType, omElement); } } else if (SimpleTypeMapper.isCollection(classType)) { return SimpleTypeMapper.getArrayList(omElement); } else if (SimpleTypeMapper.isDataHandler(classType)) { return SimpleTypeMapper.getDataHandler(omElement); } else { return BeanUtil.deserialize(classType, omElement, objectSupplier, null); } } } } public static OMElement getOMElement(QName opName, Object [] args, QName partName, boolean qualifed, TypeTable typeTable) { ArrayList objects; objects = new ArrayList(); int argCount = 0; for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg == null) { if (partName == null) { objects.add("item" + argCount); } else { objects.add(partName); } objects.add(arg); continue; } //todo if the request parameter has name other than argi (0 1000){ nsCount = 1; } return "s" + nsCount++; } /** * JAM convert first name of an attribute into UpperCase as an example if there is a instance * variable called foo in a bean , then Jam give that as Foo so this method is to correct that * error * * @param wrongName * @return the right name, using english as the locale for case conversion */ private static String getCorrectName(String wrongName) { if (wrongName.length() > 1) { return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH) + wrongName.substring(1, wrongName.length()); } else { return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH); } } } ./src/org/apache/axis2/databinding/utils/writer/0000775000175000017500000000000011767656530020752 5ustar brianbrian./src/org/apache/axis2/databinding/utils/writer/MTOMAwareOMBuilder.java0000664000175000017500000002211211767656530025112 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.writer; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMText; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import java.util.HashMap; import java.util.Map; import java.util.Stack; public class MTOMAwareOMBuilder implements MTOMAwareXMLStreamWriter { // this is the om Element we are going to create private OMElement rootElement; private OMFactory omFactory; private OMElement currentOMElement; private Stack omElementStack; // this map contains the namespace key and OMNamespace private Map namespaceOMNamesapceMap; private int prefixNum; private OMStreamNamespaceContext omStreamNamespaceContext; public MTOMAwareOMBuilder() { omFactory = OMAbstractFactory.getOMFactory(); omElementStack = new Stack(); currentOMElement = null; omStreamNamespaceContext = new OMStreamNamespaceContext(); namespaceOMNamesapceMap = new HashMap(); prefixNum = 0; } // serailizer must have finish serializing when we call this method. public OMElement getOMElement() throws XMLStreamException { if (!omElementStack.isEmpty()) { throw new XMLStreamException("This is an invalid Xml "); } return rootElement; } private OMNamespace getOMNamespace(String namespace, String prefix) throws XMLStreamException { OMNamespace omNamespace = null; if (namespace != null) { if (namespaceOMNamesapceMap.containsKey(namespace)) { omNamespace = (OMNamespace) namespaceOMNamesapceMap.get(namespace); } else { if (prefix == null) { prefix = "ns" + ++prefixNum; } else if (this.omStreamNamespaceContext.getNamespaceURI(prefix) != null) { throw new XMLStreamException("the prefix ==> " + prefix + " Already exists for namespace ==> " + namespace); } omNamespace = omFactory.createOMNamespace(namespace, prefix); this.omStreamNamespaceContext.registerNamespace(namespace, prefix); namespaceOMNamesapceMap.put(namespace, omNamespace); } } return omNamespace; } public void writeStartElement(String localName) throws XMLStreamException { writeStartElement(null, localName, null); } public void writeStartElement(String namespace, String localName) throws XMLStreamException { writeStartElement(null, localName, namespace); } public void writeStartElement(String prefix, String localName, String namespace) throws XMLStreamException { OMNamespace omNamespace = getOMNamespace(namespace, prefix); currentOMElement = omFactory.createOMElement(localName, omNamespace); if (!omElementStack.isEmpty()) { // we always keep the parent at the top of the stack OMElement parent = (OMElement) omElementStack.peek(); parent.addChild(currentOMElement); } else { // i.e this must be an start root element rootElement = currentOMElement; } // set this as the top element omElementStack.push(currentOMElement); } public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { writeEmptyElement(null, localName, namespaceURI); } public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { writeStartElement(prefix, localName, namespaceURI); writeEndElement(); } public void writeEmptyElement(String localName) throws XMLStreamException { writeEmptyElement(null, localName, null); } public void writeEndElement() throws XMLStreamException { omElementStack.pop(); } public void writeEndDocument() throws XMLStreamException { // nothing to do } public void close() throws XMLStreamException { // nothing to do } public void flush() throws XMLStreamException { // nothing to do } public void setDataHandler(DataHandler dataHandler) { OMText omText = omFactory.createOMText(dataHandler, true); currentOMElement.addChild(omText); } public void writeAttribute(String attributeName, String attributeValue) throws XMLStreamException { writeAttribute(null, null, attributeName, attributeValue); } public void writeAttribute(String prefix, String namespace, String attributeName, String attributeValue) throws XMLStreamException { currentOMElement.addAttribute(attributeName, attributeValue, getOMNamespace(namespace, prefix)); } public void writeAttribute(String namespace, String attributeName, String attributeValue) throws XMLStreamException { writeAttribute(null, namespace, attributeName, attributeValue); } public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { if (namespaceURI != null) { OMNamespace omNamespace = getOMNamespace(namespaceURI, prefix); currentOMElement.declareNamespace(omNamespace); } } public void writeDefaultNamespace(String namespace) throws XMLStreamException { rootElement.declareDefaultNamespace(namespace); getOMNamespace(namespace, ""); } public void writeComment(String string) throws XMLStreamException { omFactory.createOMComment(currentOMElement, string); } public void writeProcessingInstruction(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeProcessingInstruction(String string, String string1) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeCData(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeDTD(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeEntityRef(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeStartDocument() throws XMLStreamException { // nothing to do } public void writeStartDocument(String string) throws XMLStreamException { // nothing to do } public void writeStartDocument(String string, String string1) throws XMLStreamException { // nothing to do } public void writeCharacters(String string) throws XMLStreamException { currentOMElement.setText(string); } public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException { writeCharacters(new String(chars, i, i1)); } public String getPrefix(String namespace) throws XMLStreamException { return this.omStreamNamespaceContext.getPrefix(namespace); } public void setPrefix(String prefix, String uri) throws XMLStreamException { // this method will add the namespace correctly. getOMNamespace(uri, prefix); } public void setDefaultNamespace(String namespace) throws XMLStreamException { rootElement.declareDefaultNamespace(namespace); getOMNamespace(namespace, ""); } public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public NamespaceContext getNamespaceContext() { return this.omStreamNamespaceContext; } public Object getProperty(String string) throws IllegalArgumentException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeDataHandler(DataHandler dataHandler) throws XMLStreamException { OMText omText = omFactory.createOMText(dataHandler, true); currentOMElement.addChild(omText); } } ./src/org/apache/axis2/databinding/utils/writer/OMStreamNamespaceContext.java0000664000175000017500000000343411767656530026472 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.writer; import javax.xml.namespace.NamespaceContext; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class OMStreamNamespaceContext implements NamespaceContext { private Map namespaceToPrefixMap; private Map prefixToNamespaceMap; public OMStreamNamespaceContext() { this.namespaceToPrefixMap = new HashMap(); this.prefixToNamespaceMap = new HashMap(); } public void registerNamespace(String namespace,String prefix){ this.namespaceToPrefixMap.put(namespace,prefix); this.prefixToNamespaceMap.put(prefix,namespace); } public String getNamespaceURI(String prefix) { return (String) prefixToNamespaceMap.get(prefix); } public String getPrefix(String namespaceURI) { return (String) namespaceToPrefixMap.get(namespaceURI); } public Iterator getPrefixes(String namespaceURI) { return prefixToNamespaceMap.keySet().iterator(); } } ./src/org/apache/axis2/databinding/utils/writer/OMElementStreamWriter.java0000664000175000017500000002164111767656530026017 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.writer; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMText; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.HashMap; import java.util.Map; import java.util.Stack; public class OMElementStreamWriter implements XMLStreamWriter { // this is the om Element we are going to create private OMElement rootElement; private OMFactory omFactory; private OMElement currentOMElement; private Stack omElementStack; // this map contains the namespace key and OMNamespace private Map namespaceOMNamesapceMap; private int prefixNum; private OMStreamNamespaceContext omStreamNamespaceContext; public OMElementStreamWriter() { omFactory = OMAbstractFactory.getOMFactory(); omElementStack = new Stack(); currentOMElement = null; omStreamNamespaceContext = new OMStreamNamespaceContext(); namespaceOMNamesapceMap = new HashMap(); prefixNum = 0; } // serailizer must have finish serializing when we call this method. public OMElement getOMElement() throws XMLStreamException { if (!omElementStack.isEmpty()) { throw new XMLStreamException("This is an invalid Xml "); } return rootElement; } private OMNamespace getOMNamespace(String namespace, String prefix) throws XMLStreamException { OMNamespace omNamespace = null; if (namespace != null) { if (namespaceOMNamesapceMap.containsKey(namespace)) { omNamespace = (OMNamespace) namespaceOMNamesapceMap.get(namespace); } else { if (prefix == null) { prefix = "ns" + ++prefixNum; } else if (this.omStreamNamespaceContext.getNamespaceURI(prefix) != null) { throw new XMLStreamException("the prefix ==> " + prefix + " Already exists for namespace ==> " + namespace); } omNamespace = omFactory.createOMNamespace(namespace, prefix); this.omStreamNamespaceContext.registerNamespace(namespace, prefix); namespaceOMNamesapceMap.put(namespace, omNamespace); } } return omNamespace; } public void writeStartElement(String localName) throws XMLStreamException { writeStartElement(null, localName, null); } public void writeStartElement(String namespace, String localName) throws XMLStreamException { writeStartElement(null, localName, namespace); } public void writeStartElement(String prefix, String localName, String namespace) throws XMLStreamException { OMNamespace omNamespace = getOMNamespace(namespace, prefix); currentOMElement = omFactory.createOMElement(localName, omNamespace); if (!omElementStack.isEmpty()) { // we always keep the parent at the top of the stack OMElement parent = (OMElement) omElementStack.peek(); parent.addChild(currentOMElement); } else { // i.e this must be an start root element rootElement = currentOMElement; } // set this as the top element omElementStack.push(currentOMElement); } public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { writeEmptyElement(null, localName, namespaceURI); } public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { writeStartElement(prefix, localName, namespaceURI); writeEndElement(); } public void writeEmptyElement(String localName) throws XMLStreamException { writeEmptyElement(null, localName, null); } public void writeEndElement() throws XMLStreamException { omElementStack.pop(); } public void writeEndDocument() throws XMLStreamException { // nothing to do } public void close() throws XMLStreamException { // nothing to do } public void flush() throws XMLStreamException { // nothing to do } public void setDataHandler(DataHandler dataHandler){ OMText omText = omFactory.createOMText(dataHandler,true); currentOMElement.addChild(omText); } public void writeAttribute(String attributeName, String attributeValue) throws XMLStreamException { writeAttribute(null, null, attributeName, attributeValue); } public void writeAttribute(String prefix, String namespace, String attributeName, String attributeValue) throws XMLStreamException { currentOMElement.addAttribute(attributeName, attributeValue, getOMNamespace(namespace, prefix)); } public void writeAttribute(String namespace, String attributeName, String attributeValue) throws XMLStreamException { writeAttribute(null, namespace, attributeName, attributeValue); } public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { if (namespaceURI != null) { OMNamespace omNamespace = getOMNamespace(namespaceURI, prefix); currentOMElement.declareNamespace(omNamespace); } } public void writeDefaultNamespace(String namespace) throws XMLStreamException { rootElement.declareDefaultNamespace(namespace); getOMNamespace(namespace, ""); } public void writeComment(String string) throws XMLStreamException { omFactory.createOMComment(currentOMElement,string); } public void writeProcessingInstruction(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeProcessingInstruction(String string, String string1) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeCData(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeDTD(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeEntityRef(String string) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public void writeStartDocument() throws XMLStreamException { // nothing to do } public void writeStartDocument(String string) throws XMLStreamException { // nothing to do } public void writeStartDocument(String string, String string1) throws XMLStreamException { // nothing to do } public void writeCharacters(String string) throws XMLStreamException { currentOMElement.setText(string); } public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException { writeCharacters(new String(chars, i, i1)); } public String getPrefix(String namespace) throws XMLStreamException { return this.omStreamNamespaceContext.getPrefix(namespace); } public void setPrefix(String prefix, String uri) throws XMLStreamException { // this method will add the namespace correctly. getOMNamespace(uri, prefix); } public void setDefaultNamespace(String namespace) throws XMLStreamException { rootElement.declareDefaultNamespace(namespace); getOMNamespace(namespace,""); } public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException { throw new UnsupportedOperationException("this method has not yet been implemented"); } public NamespaceContext getNamespaceContext() { return this.omStreamNamespaceContext; } public Object getProperty(String string) throws IllegalArgumentException { throw new UnsupportedOperationException("this method has not yet been implemented"); } } ./src/org/apache/axis2/databinding/utils/writer/MTOMAwareXMLStreamWriter.java0000664000175000017500000000215511767656530026306 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.writer; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public interface MTOMAwareXMLStreamWriter extends XMLStreamWriter { public void writeDataHandler(DataHandler dataHandler) throws XMLStreamException; } ./src/org/apache/axis2/databinding/utils/writer/MTOMAwareXMLSerializer.java0000664000175000017500000001445011767656530025770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.utils.writer; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.impl.llom.OMTextImpl; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * this class wrapps the existing xmlStreamWriter and implements the new method * writeDataHandler */ public class MTOMAwareXMLSerializer implements MTOMAwareXMLStreamWriter { private XMLStreamWriter xmlStreamWriter; public MTOMAwareXMLSerializer(XMLStreamWriter xmlStreamWriter) { this.xmlStreamWriter = xmlStreamWriter; } public void writeStartElement(String string) throws XMLStreamException { this.xmlStreamWriter.writeStartElement(string); } public void writeStartElement(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeStartElement(string, string1); } public void writeStartElement(String string, String string1, String string2) throws XMLStreamException { this.xmlStreamWriter.writeStartElement(string, string1, string2); } public void writeEmptyElement(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeEmptyElement(string, string1); } public void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException { this.xmlStreamWriter.writeEmptyElement(string, string1, string2); } public void writeEmptyElement(String string) throws XMLStreamException { this.xmlStreamWriter.writeEmptyElement(string); } public void writeEndElement() throws XMLStreamException { this.xmlStreamWriter.writeEndElement(); } public void writeEndDocument() throws XMLStreamException { this.xmlStreamWriter.writeEndDocument(); } public void close() throws XMLStreamException { this.xmlStreamWriter.close(); } public void flush() throws XMLStreamException { this.xmlStreamWriter.flush(); } public void writeAttribute(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeAttribute(string, string1); } public void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException { this.xmlStreamWriter.writeAttribute(string, string1, string2, string3); } public void writeAttribute(String string, String string1, String string2) throws XMLStreamException { this.xmlStreamWriter.writeAttribute(string, string1, string2); } public void writeNamespace(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeNamespace(string, string1); } public void writeDefaultNamespace(String string) throws XMLStreamException { this.xmlStreamWriter.writeDefaultNamespace(string); } public void writeComment(String string) throws XMLStreamException { this.xmlStreamWriter.writeComment(string); } public void writeProcessingInstruction(String string) throws XMLStreamException { this.xmlStreamWriter.writeProcessingInstruction(string); } public void writeProcessingInstruction(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeProcessingInstruction(string, string1); } public void writeCData(String string) throws XMLStreamException { this.xmlStreamWriter.writeCData(string); } public void writeDTD(String string) throws XMLStreamException { this.xmlStreamWriter.writeDTD(string); } public void writeEntityRef(String string) throws XMLStreamException { this.xmlStreamWriter.writeEntityRef(string); } public void writeStartDocument() throws XMLStreamException { this.xmlStreamWriter.writeStartDocument(); } public void writeStartDocument(String string) throws XMLStreamException { this.xmlStreamWriter.writeStartDocument(string); } public void writeStartDocument(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.writeStartDocument(string, string1); } public void writeCharacters(String string) throws XMLStreamException { this.xmlStreamWriter.writeCharacters(string); } public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException { this.xmlStreamWriter.writeCharacters(chars, i, i1); } public String getPrefix(String string) throws XMLStreamException { return this.xmlStreamWriter.getPrefix(string); } public void setPrefix(String string, String string1) throws XMLStreamException { this.xmlStreamWriter.setPrefix(string, string1); } public void setDefaultNamespace(String string) throws XMLStreamException { this.xmlStreamWriter.setDefaultNamespace(string); } public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException { this.xmlStreamWriter.setNamespaceContext(namespaceContext); } public NamespaceContext getNamespaceContext() { return this.xmlStreamWriter.getNamespaceContext(); } public Object getProperty(String string) throws IllegalArgumentException { return this.xmlStreamWriter.getProperty(string); } public void writeDataHandler(DataHandler dataHandler) throws XMLStreamException { OMTextImpl omText = new OMTextImpl(dataHandler, OMAbstractFactory.getOMFactory()); omText.internalSerializeAndConsume(this.xmlStreamWriter); } } ./src/org/apache/axis2/databinding/DataBindException.java0000664000175000017500000000305211767656530022466 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; /** * handles databinding exceptions */ public class DataBindException extends XMLStreamException { public DataBindException() { } public DataBindException(String string) { super(string); } public DataBindException(Throwable throwable) { super(throwable); } public DataBindException(String string, Throwable throwable) { super(string, throwable); } public DataBindException(String string, Location location, Throwable throwable) { super(string, location, throwable); } public DataBindException(String string, Location location) { super(string, location); } } ./src/org/apache/axis2/databinding/types/0000775000175000017500000000000011767656530017442 5ustar brianbrian./src/org/apache/axis2/databinding/types/NegativeInteger.java0000664000175000017500000000647711767656530023403 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.ObjectStreamException; import java.math.BigInteger; import java.util.Random; /** * Custom class for supporting primitive XSD data type negativeinteger *

        * negativeInteger is derived from nonPositiveInteger by setting the value of maxInclusive to be -1. * This results in the standard mathematical concept of the negative integers. The value space of * negativeInteger is the infinite set {...,-2,-1}. The base type of negativeInteger is * nonPositiveInteger. * * @see XML Schema 3.3.15 */ public class NegativeInteger extends NonPositiveInteger { private static final long serialVersionUID = -2295928715693639427L; public NegativeInteger(byte[] val) { super(val); checkValidity(); } // ctor public NegativeInteger(int signum, byte[] magnitude) { super(signum, magnitude); checkValidity(); } // ctor public NegativeInteger(int bitLength, int certainty, Random rnd) { super(bitLength, certainty, rnd); checkValidity(); } // ctor public NegativeInteger(int numBits, Random rnd) { super(numBits, rnd); checkValidity(); } // ctor public NegativeInteger(String val) { super(val); checkValidity(); } public NegativeInteger(String val, int radix) { super(val, radix); checkValidity(); } // ctor /** validate the value against the xsd definition */ private BigInteger zero = new BigInteger("0"); private void checkValidity() { if (compareTo(zero) >= 0) { throw new NumberFormatException( // Messages.getMessage("badnegInt00") + ": " + this); } } // checkValidity /** * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html * * @return BigIntegerRep * @throws java.io.ObjectStreamException */ public Object writeReplace() throws ObjectStreamException { return new BigIntegerRep(toByteArray()); } protected static class BigIntegerRep implements java.io.Serializable { private static final long serialVersionUID = 1209618487031404110L; private byte[] array; protected BigIntegerRep(byte[] array) { this.array = array; } protected Object readResolve() throws java.io.ObjectStreamException { return new NegativeInteger(array); } } } // class NonNegativeInteger ./src/org/apache/axis2/databinding/types/NMTokens.java0000664000175000017500000000635411767656530022013 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; /** Custom class for supporting XSD data type NMTokens */ public class NMTokens extends NCName { private static final long serialVersionUID = -2435854824216181165L; private NMToken[] tokens; public NMTokens() { super(); } /** * ctor for NMTokens * * @throws IllegalArgumentException will be thrown if validation fails */ public NMTokens(String stValue) throws IllegalArgumentException { setValue(stValue); } public void setValue(String stValue) { StringTokenizer tokenizer = new StringTokenizer(stValue); int count = tokenizer.countTokens(); tokens = new NMToken[count]; for (int i = 0; i < count; i++) { tokens[i] = new NMToken(tokenizer.nextToken()); } } public String toString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < tokens.length; i++) { NMToken token = tokens[i]; if (i > 0) buf.append(" "); buf.append(token.toString()); } return buf.toString(); } /** * NMTokens can be equal without having identical ordering because they represent a set of * references. Hence we have to compare values here as a set, not a list. * * @param object an Object value * @return a boolean value */ public boolean equals(Object object) { if (object == this) { return true; // succeed quickly, when possible } if (object instanceof NMTokens) { NMTokens that = (NMTokens)object; if (this.tokens.length == that.tokens.length) { Set ourSet = new HashSet(Arrays.asList(this.tokens)); Set theirSet = new HashSet(Arrays.asList(that.tokens)); return ourSet.equals(theirSet); } else { return false; } } else { return false; } } /** * Returns the sum of the hashcodes of the underlying tokens, an operation which is not * sensitive to ordering. * * @return an int value */ public int hashCode() { int hash = 0; for (int i = 0; i < tokens.length; i++) { hash += tokens[i].hashCode(); } return hash; } } ./src/org/apache/axis2/databinding/types/UnsignedInt.java0000664000175000017500000000664211767656530022544 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting primitive XSD data type UnsignedInt * * @see XML Schema 3.3.22 */ public class UnsignedInt extends java.lang.Number { private static final long serialVersionUID = -8915204168154746305L; protected Long lValue = new Long(0); public UnsignedInt() { } /** * ctor for UnsignedInt * * @throws NumberFormatException will be thrown if validation fails */ public UnsignedInt(long iValue) throws NumberFormatException { setValue(iValue); } public UnsignedInt(String stValue) throws NumberFormatException { setValue(Long.parseLong(stValue)); } /** * validates the data and sets the value for the object. * * @param iValue value */ public void setValue(long iValue) throws NumberFormatException { if (!UnsignedInt.isValid(iValue)) throw new NumberFormatException( // Messages.getMessage("badUnsignedInt00") + String.valueOf(iValue) + "]"); lValue = new Long(iValue); } public String toString() { if (lValue != null) return lValue.toString(); else return null; } public int hashCode() { if (lValue != null) return lValue.hashCode(); else return 0; } /** validate the value against the xsd definition */ public static boolean isValid(long iValue) { return !((iValue < 0L) || (iValue > 4294967295L)); } private Object __equalsCalc = null; public synchronized boolean equals(Object obj) { if (!(obj instanceof UnsignedInt)) return false; UnsignedInt other = (UnsignedInt)obj; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = ((lValue == null && other.lValue == null) || (lValue != null && lValue.equals(other.lValue))); __equalsCalc = null; return _equals; } // Implement java.lang.Number interface public byte byteValue() { return lValue.byteValue(); } public short shortValue() { return lValue.shortValue(); } public int intValue() { return lValue.intValue(); } public long longValue() { return lValue.longValue(); } public double doubleValue() { return lValue.doubleValue(); } public float floatValue() { return lValue.floatValue(); } } ./src/org/apache/axis2/databinding/types/Union.java0000664000175000017500000001033411767656530021376 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import org.apache.axis2.databinding.utils.ConverterUtil; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.math.BigDecimal; /** this class is the super class of all the union simple types */ public abstract class Union { // object to store values protected Object localObject; public Object getObject() { return localObject; } public abstract void setObject(Object localObject); public String toString() { return this.localObject.toString(); } /** * method to parse xmlschema objects * * @param xmlStreamReader * @param namespaceURI * @param type * @throws URI.MalformedURIException * @throws XMLStreamException */ public void setObject(XMLStreamReader xmlStreamReader, String namespaceURI, String type) throws URI.MalformedURIException, XMLStreamException { String value = xmlStreamReader.getElementText(); if ("string".equals(type)) { setObject(value); } else if ("int".equals(type) || "integer".equals(type)) { setObject(new Integer(value)); } else if ("boolean".equals(type)) { setObject(new Boolean(value)); } else if ("anyURI".equals(type)) { setObject(new URI(value)); } else if ("date".equals(type)) { setObject(ConverterUtil.convertToDate(value)); } else if ("QName".equals(type)) { if (value.indexOf(":") > 0) { // i.e it has a name space String prefix = value.substring(0, value.indexOf(":")); String localPart = value.substring(value.indexOf(":") + 1); String namespace = xmlStreamReader.getNamespaceURI(prefix); setObject(new QName(namespace, localPart, prefix)); } else { setObject(new QName(value)); } } else if ("dateTime".equals(type)) { setObject(ConverterUtil.convertToDateTime(value)); } else if ("time".equals(type)) { setObject(ConverterUtil.convertToTime(value)); } else if ("float".equals(type)) { setObject(new Float(value)); } else if ("long".equals(type)) { setObject(new Long(value)); } else if ("double".equals(type)) { setObject(new Double(value)); } else if ("decimal".equals(type)) { setObject(new BigDecimal(value)); } else if ("unsignedLong".equals(type)) { setObject(new UnsignedLong(value)); } else if ("unsignedInt".equals(type)) { setObject(new UnsignedInt(value)); } else if ("unsignedShort".equals(type)) { setObject(new UnsignedShort(value)); } else if ("unsignedByte".equals(type)) { setObject(new UnsignedByte(value)); } else if ("positiveInteger".equals(type)) { setObject(new PositiveInteger(value)); } else if ("negativeInteger".equals(type)) { setObject(new NegativeInteger(value)); } else if ("nonNegativeInteger".equals(type)) { setObject(new NonNegativeInteger(value)); } else if ("nonPositiveInteger".equals(type)) { setObject(new NonPositiveInteger(value)); } else { throw new RuntimeException("Object not found"); } } } ./src/org/apache/axis2/databinding/types/IDRefs.java0000664000175000017500000000645611767656530021434 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; /** * Custom class for supporting XSD data type IDRefs * * @see XML Schema 3.3.10 IDREFS */ public class IDRefs extends NCName { private static final long serialVersionUID = 5394097798361075902L; private IDRef[] idrefs; public IDRefs() { super(); } /** * ctor for IDRefs * * @throws IllegalArgumentException will be thrown if validation fails */ public IDRefs(String stValue) throws IllegalArgumentException { setValue(stValue); } public void setValue(String stValue) { StringTokenizer tokenizer = new StringTokenizer(stValue); int count = tokenizer.countTokens(); idrefs = new IDRef[count]; for (int i = 0; i < count; i++) { idrefs[i] = new IDRef(tokenizer.nextToken()); } } public String toString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < idrefs.length; i++) { IDRef ref = idrefs[i]; if (i > 0) buf.append(" "); buf.append(ref.toString()); } return buf.toString(); } /** * IDREFs can be equal without having identical ordering because they represent a set of * references. Hence we have to compare values here as a set, not a list. * * @param object an Object value * @return a boolean value */ public boolean equals(Object object) { if (object == this) { return true; // succeed quickly, when possible } if (object instanceof IDRefs) { IDRefs that = (IDRefs)object; if (this.idrefs.length == that.idrefs.length) { Set ourSet = new HashSet(Arrays.asList(this.idrefs)); Set theirSet = new HashSet(Arrays.asList(that.idrefs)); return ourSet.equals(theirSet); } else { return false; } } else { return false; } } /** * Returns the sum of the hashcodes of the underlying idrefs, an operation which is not * sensitive to ordering. * * @return an int value */ public int hashCode() { int hash = 0; for (int i = 0; i < idrefs.length; i++) { hash += idrefs[i].hashCode(); } return hash; } } ./src/org/apache/axis2/databinding/types/UnsignedLong.java0000664000175000017500000002104511767656530022703 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; // Consider removing this. // All operations behave as if BigIntegers were represented in two's-complement notation. // In its place, consider using primitive type long (which is already the right size) to hold the data. // This class can hide the fact that the data is stored in a signed entity, by careful implementation of the class' methods. import java.math.BigInteger; /** * Custom class for supporting primitive XSD data type UnsignedLong * * @see XML Schema 3.3.21 */ public class UnsignedLong extends java.lang.Number implements Comparable { private static final long serialVersionUID = -5919942584284897583L; protected BigInteger lValue = BigInteger.ZERO; private static BigInteger MAX = new BigInteger("18446744073709551615"); // max unsigned long public UnsignedLong() { } public UnsignedLong(double value) throws NumberFormatException { setValue(new BigInteger(Double.toString(value))); } public UnsignedLong(BigInteger value) throws NumberFormatException { setValue(value); } public UnsignedLong(long lValue) throws IllegalArgumentException { // new UnsignedLong( 0xffffffffffffffffL ) // should not throw any Exception because, as an UnsignedLong, it is in range and nonnegative. setValue(BigInteger.valueOf(lValue)); } public UnsignedLong(String stValue) throws NumberFormatException { // If stValue starts with a minus sign, that will be acceptable to the BigInteger constructor, // but it is not acceptable to us. // Once encoded into binary, it is too late to detect that the client intended a negative integer. // That detection must be performed here. try { if (stValue.charAt(0) == '\u002d') { throw new NumberFormatException( "A String that starts with a minus sign is not a valid representation of an UnsignedLong."); } setValue(new BigInteger(stValue)); } catch (NumberFormatException numberFormatException) { throw numberFormatException; } catch (IndexOutOfBoundsException indexOutOfBoundsException) { // This could happen if stValue is empty when we attempt to detect a minus sign. // From the client's point of view, the empty String should cause a NumberFormatException. throw new NumberFormatException( "An empty string is not a valid representation of an UnsignedLong."); } } private void setValue(BigInteger val) { if (!UnsignedLong.isValid(val)) { throw new IllegalArgumentException( // Messages.getMessage("badUnsignedLong00") + String.valueOf(val) + "]"); } this.lValue = val; } public static boolean isValid(BigInteger value) { // Converts this BigInteger to a long. // This conversion is analogous to a narrowing primitive conversion from long to int as defined in the Java Language Specification: // if this BigInteger is too big to fit in a long, only the low-order 64 bits are returned. // Note that this conversion can lose information about the overall magnitude of the BigInteger value as well as return a result with the opposite sign. long unsignedLongValue = value.longValue(); return !(compare(unsignedLongValue, BigInteger.ZERO.longValue()) < 0 || // less than zero compare(unsignedLongValue, MAX.longValue()) > 0); } public String toString() { return lValue.toString(); } public int hashCode() { if (lValue != null) return lValue.hashCode(); else return 0; } private Object __equalsCalc = null; public synchronized boolean equals(Object obj) { if (!(obj instanceof UnsignedLong)) return false; UnsignedLong other = (UnsignedLong)obj; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = ((lValue == null && other.lValue == null) || (lValue != null && lValue.equals(other.lValue))); __equalsCalc = null; return _equals; } // Implement java.lang.Number interface public byte byteValue() { return lValue.byteValue(); } public short shortValue() { return lValue.shortValue(); } public int intValue() { return lValue.intValue(); } public long longValue() { return lValue.longValue(); } public double doubleValue() { return lValue.doubleValue(); } public float floatValue() { return lValue.floatValue(); } /** * @return the value 0 if the argument is an UnsignedLong numerically equal to this * UnsignedLong; a value less than 0 if the argument is an UnsignedLong numerically * greater than this UnsignedLong; and a value greater than 0 if the argument is an * UnsignedLong numerically less than this UnsignedLong. */ public int compareTo(Object o) { int retVal = 0; // arbitrary default value in case of exception; required return value in case this object is equal to the specified object if (o == null || !(o instanceof UnsignedLong)) { throw new ClassCastException("The argument is not an UnsignedLong."); } // Only need to change retVal if this object is not equal to the specified object. retVal = compare(longValue(), ((UnsignedLong)o).longValue()); return retVal; } /** * @return the value 0 if thatLong is a long numerically equal to thisLong; a value less than 0 * if thatLong is a long numerically greater than thisLong; and a value greater than 0 * if thatLong is a long numerically less than thisLong (unsigned comparison). */ private static int compare(long thisLong, long thatLong) { // To avoid infinite recursion, do not instantiate UnsignedLong in this method, which may be called during UnsignedLong instantiation. if (thisLong == thatLong) { return 0; } else { boolean isLessThan; // This is less than that. // Prepare the most significant half of the data for comparison. // The shift distance can be any number from 1 to 32 inclusive (1 is probably fastest). // A shift distance of one is sufficient to move the significant data off of the sign bit, allowing for a signed comparison of positive numbers (i.e. an unsigned comparison). long thisHalfLong = (thisLong & 0xffffffff00000000L) >>> 1; long thatHalfLong = (thatLong & 0xffffffff00000000L) >>> 1; if (thisHalfLong == thatHalfLong) { // We must also look at the least significant half of the data. // Prepare the least significant half of the data for comparison. thisHalfLong = (thisLong & 0x00000000ffffffffL); thatHalfLong = (thatLong & 0x00000000ffffffffL); // We already know that the data is not equal. isLessThan = thisHalfLong < thatHalfLong; } else { // The answer is in the most significant half of the data. isLessThan = thisHalfLong < thatHalfLong; } if (isLessThan) { return -1; // Returns a negative integer as this object is less than than the specified object. } else { return 1; // Returns a positive integer as this object is greater than than the specified object. } } } } ./src/org/apache/axis2/databinding/types/HexBinary.java0000664000175000017500000001561211767656530022203 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types ; import java.io.ByteArrayOutputStream; import java.io.Serializable; /** Custom class for supporting primitive XSD data type hexBinary. */ public class HexBinary implements Serializable { private static final long serialVersionUID = -5082403899986720767L; byte[] m_value; public HexBinary() { } public HexBinary(String string) { m_value = decode(string); } public HexBinary(byte[] bytes) { m_value = bytes; } public byte[] getBytes() { return m_value; } public String toString() { return encode(m_value); } public int hashCode() { //TODO: How do we hash this? return super.hashCode(); } public boolean equals(Object object) { //TODO: Is this good enough? String s1 = object.toString(); String s2 = this.toString(); return s1.equals(s2); } // public static final String ERROR_ODD_NUMBER_OF_DIGITS = //Messages.getMessage("oddDigits00"); //public static final String ERROR_BAD_CHARACTER_IN_HEX_STRING = // Messages.getMessage("badChars01"); // Code from Ajp11, from Apache's JServ // Table for HEX to DEC byte translation public static final int[] DEC = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 00, 01, 02, 03, 04, 05, 06, 07, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; /** * Convert a String of hexadecimal digits into the corresponding byte array by encoding each two * hexadecimal digits as a byte. * * @param digits Hexadecimal digits representation * @throws IllegalArgumentException if an invalid hexadecimal digit is found, or the input * string contains an odd number of hexadecimal digits */ public static byte[] decode(String digits) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int i = 0; i < digits.length(); i += 2) { char c1 = digits.charAt(i); if ((i + 1) >= digits.length()) throw new IllegalArgumentException ();//ERROR_ODD_NUMBER_OF_DIGITS); char c2 = digits.charAt(i + 1); byte b = 0; if ((c1 >= '0') && (c1 <= '9')) b += ((c1 - '0') * 16); else if ((c1 >= 'a') && (c1 <= 'f')) b += ((c1 - 'a' + 10) * 16); else if ((c1 >= 'A') && (c1 <= 'F')) b += ((c1 - 'A' + 10) * 16); else throw new IllegalArgumentException ();//ERROR_BAD_CHARACTER_IN_HEX_STRING); if ((c2 >= '0') && (c2 <= '9')) b += (c2 - '0'); else if ((c2 >= 'a') && (c2 <= 'f')) b += (c2 - 'a' + 10); else if ((c2 >= 'A') && (c2 <= 'F')) b += (c2 - 'A' + 10); else throw new IllegalArgumentException ();//ERROR_BAD_CHARACTER_IN_HEX_STRING); baos.write(b); } return (baos.toByteArray()); } /** * Convert a byte array into a printable format containing a String of hexadecimal digit * characters (two per byte). * * @param bytes Byte array representation */ public static String encode(byte bytes[]) { StringBuffer sb = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { sb.append(convertDigit(bytes[i] >> 4)); sb.append(convertDigit(bytes[i] & 0x0f)); } return (sb.toString()); } /** * Convert 4 hex digits to an int, and return the number of converted bytes. * * @param hex Byte array containing exactly four hexadecimal digits * @throws IllegalArgumentException if an invalid hexadecimal digit is included */ public static int convert2Int(byte[] hex) { // Code from Ajp11, from Apache's JServ // assert b.length==4 // assert valid data int len; if (hex.length < 4) return 0; if (DEC[hex[0]] < 0) throw new IllegalArgumentException();//ERROR_BAD_CHARACTER_IN_HEX_STRING); len = DEC[hex[0]]; len = len << 4; if (DEC[hex[1]] < 0) throw new IllegalArgumentException();//ERROR_BAD_CHARACTER_IN_HEX_STRING); len += DEC[hex[1]]; len = len << 4; if (DEC[hex[2]] < 0) throw new IllegalArgumentException();//ERROR_BAD_CHARACTER_IN_HEX_STRING); len += DEC[hex[2]]; len = len << 4; if (DEC[hex[3]] < 0) throw new IllegalArgumentException();//ERROR_BAD_CHARACTER_IN_HEX_STRING); len += DEC[hex[3]]; return len; } /** * [Private] Convert the specified value (0 .. 15) to the corresponding hexadecimal digit. * * @param value Value to be converted */ private static char convertDigit(int value) { value &= 0x0f; if (value >= 10) return ((char)(value - 10 + 'a')); else return ((char)(value + '0')); } } ./src/org/apache/axis2/databinding/types/xsd/0000775000175000017500000000000011767656530020240 5ustar brianbrian./src/org/apache/axis2/databinding/types/xsd/NegativeInteger.java0000664000175000017500000005265011767656530024173 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NegativeInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NegativeInteger bean class */ public class NegativeInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = negativeInteger Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NegativeInteger */ protected org.apache.axis2.databinding.types.NegativeInteger localNegativeInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NegativeInteger */ public org.apache.axis2.databinding.types.NegativeInteger getNegativeInteger(){ return localNegativeInteger; } /** * Auto generated setter method * @param param NegativeInteger */ public void setNegativeInteger(org.apache.axis2.databinding.types.NegativeInteger param){ this.localNegativeInteger=param; } public java.lang.String toString(){ return localNegativeInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NegativeInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":negativeInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "negativeInteger", xmlWriter); } } if (localNegativeInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("negativeInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNegativeInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNegativeInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNegativeInteger)); } else { throw new org.apache.axis2.databinding.ADBException("negativeInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NegativeInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NegativeInteger returnValue = new NegativeInteger(); returnValue.setNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNegativeInteger(value)); return returnValue; } public static NegativeInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NegativeInteger.Factory.fromString(content,namespaceUri); } else { return NegativeInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NegativeInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NegativeInteger object = new NegativeInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"negativeInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NegativeInteger)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNegativeInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/UnsignedInt.java0000664000175000017500000005241011767656530023334 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedInt.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * UnsignedInt bean class */ public class UnsignedInt implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedInt Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedInt */ protected org.apache.axis2.databinding.types.UnsignedInt localUnsignedInt ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedInt */ public org.apache.axis2.databinding.types.UnsignedInt getUnsignedInt(){ return localUnsignedInt; } /** * Auto generated setter method * @param param UnsignedInt */ public void setUnsignedInt(org.apache.axis2.databinding.types.UnsignedInt param){ this.localUnsignedInt=param; } public java.lang.String toString(){ return localUnsignedInt.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedInt.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedInt", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedInt", xmlWriter); } } if (localUnsignedInt==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedInt cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedInt)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedInt != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedInt)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedInt cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedInt fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedInt returnValue = new UnsignedInt(); returnValue.setUnsignedInt( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedInt(value)); return returnValue; } public static UnsignedInt fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedInt.Factory.fromString(content,namespaceUri); } else { return UnsignedInt.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedInt parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedInt object = new UnsignedInt(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedInt".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedInt)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedInt( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedInt(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_long.java0000664000175000017500000005100011767656530022175 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _long.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _long bean class */ public class _long implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = long Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _long */ protected long local_long ; /** * Auto generated getter method * @return long */ public long get_long(){ return local_long; } /** * Auto generated setter method * @param param _long */ public void set_long(long param){ this.local_long=param; } public java.lang.String toString(){ return local_long + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _long.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":long", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "long", xmlWriter); } } if (local_long==java.lang.Long.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("long cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_long)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_long)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _long fromString(java.lang.String value, java.lang.String namespaceURI){ _long returnValue = new _long(); returnValue.set_long( org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(value)); return returnValue; } public static _long fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _long.Factory.fromString(content,namespaceUri); } else { return _long.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _long parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _long object = new _long(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"long".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_long)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_long( org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NMTOKENS.java0000664000175000017500000005222011767656530022342 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NMTOKENS.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NMTOKENS bean class */ public class NMTOKENS implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NMTOKENS Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NMTOKENS */ protected org.apache.axis2.databinding.types.NMTokens localNMTOKENS ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NMTokens */ public org.apache.axis2.databinding.types.NMTokens getNMTOKENS(){ return localNMTOKENS; } /** * Auto generated setter method * @param param NMTOKENS */ public void setNMTOKENS(org.apache.axis2.databinding.types.NMTokens param){ this.localNMTOKENS=param; } public java.lang.String toString(){ return localNMTOKENS.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NMTOKENS.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NMTOKENS", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NMTOKENS", xmlWriter); } } if (localNMTOKENS==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NMTOKENS cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKENS)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNMTOKENS != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKENS)); } else { throw new org.apache.axis2.databinding.ADBException("NMTOKENS cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NMTOKENS fromString(java.lang.String value, java.lang.String namespaceURI){ NMTOKENS returnValue = new NMTOKENS(); returnValue.setNMTOKENS( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKENS(value)); return returnValue; } public static NMTOKENS fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NMTOKENS.Factory.fromString(content,namespaceUri); } else { return NMTOKENS.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NMTOKENS parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NMTOKENS object = new NMTOKENS(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NMTOKENS".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NMTOKENS)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNMTOKENS( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKENS(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/UnsignedLong.java0000664000175000017500000005246011767656530023506 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedLong.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * UnsignedLong bean class */ public class UnsignedLong implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedLong Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedLong */ protected org.apache.axis2.databinding.types.UnsignedLong localUnsignedLong ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedLong */ public org.apache.axis2.databinding.types.UnsignedLong getUnsignedLong(){ return localUnsignedLong; } /** * Auto generated setter method * @param param UnsignedLong */ public void setUnsignedLong(org.apache.axis2.databinding.types.UnsignedLong param){ this.localUnsignedLong=param; } public java.lang.String toString(){ return localUnsignedLong.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedLong.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedLong", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedLong", xmlWriter); } } if (localUnsignedLong==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedLong cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedLong)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedLong != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedLong)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedLong cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedLong fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedLong returnValue = new UnsignedLong(); returnValue.setUnsignedLong( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedLong(value)); return returnValue; } public static UnsignedLong fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedLong.Factory.fromString(content,namespaceUri); } else { return UnsignedLong.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedLong parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedLong object = new UnsignedLong(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedLong".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedLong)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedLong( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedLong(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_short.java0000664000175000017500000005104711767656530022410 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _short.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _short bean class */ public class _short implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = short Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _short */ protected short local_short ; /** * Auto generated getter method * @return short */ public short get_short(){ return local_short; } /** * Auto generated setter method * @param param _short */ public void set_short(short param){ this.local_short=param; } public java.lang.String toString(){ return local_short + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _short.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":short", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "short", xmlWriter); } } if (local_short==java.lang.Short.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("short cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_short)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_short)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _short fromString(java.lang.String value, java.lang.String namespaceURI){ _short returnValue = new _short(); returnValue.set_short( org.apache.axis2.databinding.utils.ConverterUtil.convertToShort(value)); return returnValue; } public static _short fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _short.Factory.fromString(content,namespaceUri); } else { return _short.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _short parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _short object = new _short(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"short".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_short)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_short( org.apache.axis2.databinding.utils.ConverterUtil.convertToShort(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/HexBinary.java0000664000175000017500000005227011767656530023002 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * HexBinary.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * HexBinary bean class */ public class HexBinary implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = hexBinary Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for HexBinary */ protected org.apache.axis2.databinding.types.HexBinary localHexBinary ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.HexBinary */ public org.apache.axis2.databinding.types.HexBinary getHexBinary(){ return localHexBinary; } /** * Auto generated setter method * @param param HexBinary */ public void setHexBinary(org.apache.axis2.databinding.types.HexBinary param){ this.localHexBinary=param; } public java.lang.String toString(){ return localHexBinary.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { HexBinary.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":hexBinary", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "hexBinary", xmlWriter); } } if (localHexBinary==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("hexBinary cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHexBinary)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localHexBinary != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHexBinary)); } else { throw new org.apache.axis2.databinding.ADBException("hexBinary cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static HexBinary fromString(java.lang.String value, java.lang.String namespaceURI){ HexBinary returnValue = new HexBinary(); returnValue.setHexBinary( org.apache.axis2.databinding.utils.ConverterUtil.convertToHexBinary(value)); return returnValue; } public static HexBinary fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return HexBinary.Factory.fromString(content,namespaceUri); } else { return HexBinary.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static HexBinary parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ HexBinary object = new HexBinary(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"hexBinary".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (HexBinary)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setHexBinary( org.apache.axis2.databinding.utils.ConverterUtil.convertToHexBinary(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Name.java0000664000175000017500000005176011767656530021774 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Name.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Name bean class */ public class Name implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = Name Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Name */ protected org.apache.axis2.databinding.types.Name localName ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Name */ public org.apache.axis2.databinding.types.Name getName(){ return localName; } /** * Auto generated setter method * @param param Name */ public void setName(org.apache.axis2.databinding.types.Name param){ this.localName=param; } public java.lang.String toString(){ return localName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Name.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":Name", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "Name", xmlWriter); } } if (localName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("Name cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName)); } else { throw new org.apache.axis2.databinding.ADBException("Name cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Name fromString(java.lang.String value, java.lang.String namespaceURI){ Name returnValue = new Name(); returnValue.setName( org.apache.axis2.databinding.utils.ConverterUtil.convertToName(value)); return returnValue; } public static Name fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Name.Factory.fromString(content,namespaceUri); } else { return Name.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Name parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Name object = new Name(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"Name".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Name)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setName( org.apache.axis2.databinding.utils.ConverterUtil.convertToName(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/DateTime.java0000664000175000017500000005205411767656530022605 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * DateTime.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * DateTime bean class */ public class DateTime implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = dateTime Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for DateTime */ protected java.util.Calendar localDateTime ; /** * Auto generated getter method * @return java.util.Calendar */ public java.util.Calendar getDateTime(){ return localDateTime; } /** * Auto generated setter method * @param param DateTime */ public void setDateTime(java.util.Calendar param){ this.localDateTime=param; } public java.lang.String toString(){ return localDateTime.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { DateTime.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":dateTime", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "dateTime", xmlWriter); } } if (localDateTime==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("dateTime cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateTime)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDateTime != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateTime)); } else { throw new org.apache.axis2.databinding.ADBException("dateTime cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static DateTime fromString(java.lang.String value, java.lang.String namespaceURI){ DateTime returnValue = new DateTime(); returnValue.setDateTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(value)); return returnValue; } public static DateTime fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return DateTime.Factory.fromString(content,namespaceUri); } else { return DateTime.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static DateTime parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ DateTime object = new DateTime(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"dateTime".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (DateTime)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDateTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_byte.java0000664000175000017500000005100011767656530022201 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _byte.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _byte bean class */ public class _byte implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = byte Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _byte */ protected byte local_byte ; /** * Auto generated getter method * @return byte */ public byte get_byte(){ return local_byte; } /** * Auto generated setter method * @param param _byte */ public void set_byte(byte param){ this.local_byte=param; } public java.lang.String toString(){ return local_byte + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _byte.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":byte", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "byte", xmlWriter); } } if (local_byte==java.lang.Byte.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("byte cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_byte)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_byte)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _byte fromString(java.lang.String value, java.lang.String namespaceURI){ _byte returnValue = new _byte(); returnValue.set_byte( org.apache.axis2.databinding.utils.ConverterUtil.convertToByte(value)); return returnValue; } public static _byte fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _byte.Factory.fromString(content,namespaceUri); } else { return _byte.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _byte parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _byte object = new _byte(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"byte".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_byte)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_byte( org.apache.axis2.databinding.utils.ConverterUtil.convertToByte(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/String.java0000664000175000017500000005163211767656530022360 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * String.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * String bean class */ public class String implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = string Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for String */ protected java.lang.String localString ; /** * Auto generated getter method * @return java.lang.String */ public java.lang.String getString(){ return localString; } /** * Auto generated setter method * @param param String */ public void setString(java.lang.String param){ this.localString=param; } public java.lang.String toString(){ return localString.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { String.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":string", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "string", xmlWriter); } } if (localString==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("string cannot be null!!"); }else{ xmlWriter.writeCharacters(localString); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localString != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localString)); } else { throw new org.apache.axis2.databinding.ADBException("string cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static String fromString(java.lang.String value, java.lang.String namespaceURI){ String returnValue = new String(); returnValue.setString( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(value)); return returnValue; } public static String fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return String.Factory.fromString(content,namespaceUri); } else { return String.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static String parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ String object = new String(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"string".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (String)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setString( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/GMonthDay.java0000664000175000017500000005226411767656530022746 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GMonthDay.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * GMonthDay bean class */ public class GMonthDay implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gMonthDay Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GMonthDay */ protected org.apache.axis2.databinding.types.MonthDay localGMonthDay ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.MonthDay */ public org.apache.axis2.databinding.types.MonthDay getGMonthDay(){ return localGMonthDay; } /** * Auto generated setter method * @param param GMonthDay */ public void setGMonthDay(org.apache.axis2.databinding.types.MonthDay param){ this.localGMonthDay=param; } public java.lang.String toString(){ return localGMonthDay.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GMonthDay.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gMonthDay", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gMonthDay", xmlWriter); } } if (localGMonthDay==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gMonthDay cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonthDay)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGMonthDay != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonthDay)); } else { throw new org.apache.axis2.databinding.ADBException("gMonthDay cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GMonthDay fromString(java.lang.String value, java.lang.String namespaceURI){ GMonthDay returnValue = new GMonthDay(); returnValue.setGMonthDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonthDay(value)); return returnValue; } public static GMonthDay fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GMonthDay.Factory.fromString(content,namespaceUri); } else { return GMonthDay.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GMonthDay parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GMonthDay object = new GMonthDay(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gMonthDay".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GMonthDay)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGMonthDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonthDay(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_boolean.java0000664000175000017500000004206011767656530022663 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _boolean.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _boolean bean class */ public class _boolean implements org.apache.axis2.databinding.ADBBean { /* This type was generated from the piece of schema that had name = boolean Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if (namespace.equals("http://www.w3.org/2001/XMLSchema")) { return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _boolean */ protected boolean local_boolean; /** * Auto generated getter method * * @return boolean */ public boolean get_boolean() { return local_boolean; } /** * Auto generated setter method * * @param param _boolean */ public void set_boolean(boolean param) { this.local_boolean = param; } public java.lang.String toString() { return local_boolean + ""; } /** * isReaderMTOMAware * * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try { isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); } catch (java.lang.IllegalArgumentException e) { isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException { org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, parentQName) { public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _boolean.this.serialize(parentQName, factory, xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName, factory, dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { serialize(parentQName, factory, xmlWriter, false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType) { java.lang.String namespacePrefix = registerPrefix(xmlWriter, "http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":boolean", xmlWriter); } else { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "boolean", xmlWriter); } } if (false) { throw new org.apache.axis2.databinding.ADBException("boolean cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_boolean)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace, attName, attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_boolean)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory { public static _boolean fromString(java.lang.String value, java.lang.String namespaceURI) { _boolean returnValue = new _boolean(); returnValue.set_boolean( org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(value)); return returnValue; } public static _boolean fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1) { java.lang.String prefix = content.substring(0, content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _boolean.Factory.fromString(content, namespaceUri); } else { return _boolean.Factory.fromString(content, ""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _boolean parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { _boolean object = new _boolean(); int event; java.lang.String nillableValue = null; java.lang.String prefix = ""; java.lang.String namespaceuri = ""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName != null) { java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1) { nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); } nsPrefix = nsPrefix == null ? "" : nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); if (!"boolean".equals(type)) { //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_boolean) org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri, type, reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while (!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()) { if (reader.isStartElement() || reader.hasText()) { java.lang.String content = reader.getElementText(); object.set_boolean( org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(content)); } // End of if for expected property start element else { // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NOTATION.java0000664000175000017500000005267311767656530022353 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NOTATION.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NOTATION bean class */ public class NOTATION implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NOTATION Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for QName */ protected javax.xml.namespace.QName localQName ; /** * Auto generated getter method * @return javax.xml.namespace.QName */ public javax.xml.namespace.QName getQName(){ return localQName; } /** * Auto generated setter method * @param param QName */ public void setQName(javax.xml.namespace.QName param){ this.localQName=param; } public java.lang.String toString(){ return localQName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NOTATION.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NOTATION", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NOTATION", xmlWriter); } } if (localQName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); }else{ writeQName(localQName,xmlWriter); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localQName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localQName)); } else { throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NOTATION fromString(java.lang.String value, java.lang.String namespaceURI){ NOTATION returnValue = new NOTATION(); returnValue.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(value,namespaceURI)); return returnValue; } public static NOTATION fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NOTATION.Factory.fromString(content,namespaceUri); } else { return NOTATION.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NOTATION parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NOTATION object = new NOTATION(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NOTATION".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NOTATION)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); if(index > 0){ prefix = content.substring(0,index); } else { prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); object.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/QName.java0000664000175000017500000005260511767656530022114 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * QName.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * QName bean class */ public class QName implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = QName Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for QName */ protected javax.xml.namespace.QName localQName ; /** * Auto generated getter method * @return javax.xml.namespace.QName */ public javax.xml.namespace.QName getQName(){ return localQName; } /** * Auto generated setter method * @param param QName */ public void setQName(javax.xml.namespace.QName param){ this.localQName=param; } public java.lang.String toString(){ return localQName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { QName.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":QName", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "QName", xmlWriter); } } if (localQName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); }else{ writeQName(localQName,xmlWriter); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localQName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localQName)); } else { throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static QName fromString(java.lang.String value, java.lang.String namespaceURI){ QName returnValue = new QName(); returnValue.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(value,namespaceURI)); return returnValue; } public static QName fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return QName.Factory.fromString(content,namespaceUri); } else { return QName.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static QName parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ QName object = new QName(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"QName".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (QName)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); if(index > 0){ prefix = content.substring(0,index); } else { prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); object.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/PositiveInteger.java0000664000175000017500000005265011767656530024233 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * PositiveInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * PositiveInteger bean class */ public class PositiveInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = positiveInteger Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for PositiveInteger */ protected org.apache.axis2.databinding.types.PositiveInteger localPositiveInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.PositiveInteger */ public org.apache.axis2.databinding.types.PositiveInteger getPositiveInteger(){ return localPositiveInteger; } /** * Auto generated setter method * @param param PositiveInteger */ public void setPositiveInteger(org.apache.axis2.databinding.types.PositiveInteger param){ this.localPositiveInteger=param; } public java.lang.String toString(){ return localPositiveInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { PositiveInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":positiveInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "positiveInteger", xmlWriter); } } if (localPositiveInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("positiveInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPositiveInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localPositiveInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPositiveInteger)); } else { throw new org.apache.axis2.databinding.ADBException("positiveInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static PositiveInteger fromString(java.lang.String value, java.lang.String namespaceURI){ PositiveInteger returnValue = new PositiveInteger(); returnValue.setPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToPositiveInteger(value)); return returnValue; } public static PositiveInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return PositiveInteger.Factory.fromString(content,namespaceUri); } else { return PositiveInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static PositiveInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ PositiveInteger object = new PositiveInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"positiveInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (PositiveInteger)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToPositiveInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Base64Binary.java0000664000175000017500000005412311767656530023301 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Base64Binary.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Base64Binary bean class */ public class Base64Binary implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = base64Binary Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Base64Binary */ protected javax.activation.DataHandler localBase64Binary ; /** * Auto generated getter method * @return javax.activation.DataHandler */ public javax.activation.DataHandler getBase64Binary(){ return localBase64Binary; } /** * Auto generated setter method * @param param Base64Binary */ public void setBase64Binary(javax.activation.DataHandler param){ this.localBase64Binary=param; } public java.lang.String toString(){ return localBase64Binary.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Base64Binary.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":base64Binary", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "base64Binary", xmlWriter); } } if (localBase64Binary!=null) { xmlWriter.writeDataHandler(localBase64Binary); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add(localBase64Binary); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Base64Binary fromString(java.lang.String value, java.lang.String namespaceURI){ Base64Binary returnValue = new Base64Binary(); returnValue.setBase64Binary( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(value)); return returnValue; } public static Base64Binary fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Base64Binary.Factory.fromString(content,namespaceUri); } else { return Base64Binary.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Base64Binary parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Base64Binary object = new Base64Binary(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"base64Binary".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Base64Binary)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object object.setBase64Binary( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); object.setBase64Binary(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.setBase64Binary( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); } } reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/ID.java0000664000175000017500000005164011767656530021405 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ID.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * ID bean class */ public class ID implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ID Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ID */ protected org.apache.axis2.databinding.types.Id localID ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Id */ public org.apache.axis2.databinding.types.Id getID(){ return localID; } /** * Auto generated setter method * @param param ID */ public void setID(org.apache.axis2.databinding.types.Id param){ this.localID=param; } public java.lang.String toString(){ return localID.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ID.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ID", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ID", xmlWriter); } } if (localID==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ID cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localID)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localID != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localID)); } else { throw new org.apache.axis2.databinding.ADBException("ID cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ID fromString(java.lang.String value, java.lang.String namespaceURI){ ID returnValue = new ID(); returnValue.setID( org.apache.axis2.databinding.utils.ConverterUtil.convertToID(value)); return returnValue; } public static ID fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ID.Factory.fromString(content,namespaceUri); } else { return ID.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ID parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ID object = new ID(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ID".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ID)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setID( org.apache.axis2.databinding.utils.ConverterUtil.convertToID(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NonPositiveInteger.java0000664000175000017500000005304011767656530024700 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NonPositiveInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NonPositiveInteger bean class */ public class NonPositiveInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = nonPositiveInteger Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NonPositiveInteger */ protected org.apache.axis2.databinding.types.NonPositiveInteger localNonPositiveInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NonPositiveInteger */ public org.apache.axis2.databinding.types.NonPositiveInteger getNonPositiveInteger(){ return localNonPositiveInteger; } /** * Auto generated setter method * @param param NonPositiveInteger */ public void setNonPositiveInteger(org.apache.axis2.databinding.types.NonPositiveInteger param){ this.localNonPositiveInteger=param; } public java.lang.String toString(){ return localNonPositiveInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NonPositiveInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":nonPositiveInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "nonPositiveInteger", xmlWriter); } } if (localNonPositiveInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("nonPositiveInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonPositiveInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNonPositiveInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonPositiveInteger)); } else { throw new org.apache.axis2.databinding.ADBException("nonPositiveInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NonPositiveInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NonPositiveInteger returnValue = new NonPositiveInteger(); returnValue.setNonPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonPositiveInteger(value)); return returnValue; } public static NonPositiveInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NonPositiveInteger.Factory.fromString(content,namespaceUri); } else { return NonPositiveInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NonPositiveInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NonPositiveInteger object = new NonPositiveInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"nonPositiveInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NonPositiveInteger)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNonPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonPositiveInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/ENTITIES.java0000664000175000017500000005222011767656530022330 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ENTITIES.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * ENTITIES bean class */ public class ENTITIES implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ENTITIES Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ENTITIES */ protected org.apache.axis2.databinding.types.Entities localENTITIES ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Entities */ public org.apache.axis2.databinding.types.Entities getENTITIES(){ return localENTITIES; } /** * Auto generated setter method * @param param ENTITIES */ public void setENTITIES(org.apache.axis2.databinding.types.Entities param){ this.localENTITIES=param; } public java.lang.String toString(){ return localENTITIES.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ENTITIES.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ENTITIES", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ENTITIES", xmlWriter); } } if (localENTITIES==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ENTITIES cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITIES)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localENTITIES != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITIES)); } else { throw new org.apache.axis2.databinding.ADBException("ENTITIES cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ENTITIES fromString(java.lang.String value, java.lang.String namespaceURI){ ENTITIES returnValue = new ENTITIES(); returnValue.setENTITIES( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITIES(value)); return returnValue; } public static ENTITIES fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ENTITIES.Factory.fromString(content,namespaceUri); } else { return ENTITIES.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ENTITIES parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ENTITIES object = new ENTITIES(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ENTITIES".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ENTITIES)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setENTITIES( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITIES(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Decimal.java0000664000175000017500000005202011767656530022440 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Decimal.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Decimal bean class */ public class Decimal implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = decimal Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Decimal */ protected java.math.BigDecimal localDecimal ; /** * Auto generated getter method * @return java.math.BigDecimal */ public java.math.BigDecimal getDecimal(){ return localDecimal; } /** * Auto generated setter method * @param param Decimal */ public void setDecimal(java.math.BigDecimal param){ this.localDecimal=param; } public java.lang.String toString(){ return localDecimal.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Decimal.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":decimal", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "decimal", xmlWriter); } } if (localDecimal==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("decimal cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDecimal)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDecimal != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDecimal)); } else { throw new org.apache.axis2.databinding.ADBException("decimal cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Decimal fromString(java.lang.String value, java.lang.String namespaceURI){ Decimal returnValue = new Decimal(); returnValue.setDecimal( org.apache.axis2.databinding.utils.ConverterUtil.convertToDecimal(value)); return returnValue; } public static Decimal fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Decimal.Factory.fromString(content,namespaceUri); } else { return Decimal.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Decimal parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Decimal object = new Decimal(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"decimal".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Decimal)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDecimal( org.apache.axis2.databinding.utils.ConverterUtil.convertToDecimal(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Token.java0000664000175000017500000005203011767656530022163 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Token.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Token bean class */ public class Token implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = token Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Token */ protected org.apache.axis2.databinding.types.Token localToken ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Token */ public org.apache.axis2.databinding.types.Token getToken(){ return localToken; } /** * Auto generated setter method * @param param Token */ public void setToken(org.apache.axis2.databinding.types.Token param){ this.localToken=param; } public java.lang.String toString(){ return localToken.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Token.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":token", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "token", xmlWriter); } } if (localToken==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("token cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localToken)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localToken != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localToken)); } else { throw new org.apache.axis2.databinding.ADBException("token cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Token fromString(java.lang.String value, java.lang.String namespaceURI){ Token returnValue = new Token(); returnValue.setToken( org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(value)); return returnValue; } public static Token fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Token.Factory.fromString(content,namespaceUri); } else { return Token.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Token parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Token object = new Token(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"token".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Token)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setToken( org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NonNegativeInteger.java0000664000175000017500000005304011767656530024640 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NonNegativeInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NonNegativeInteger bean class */ public class NonNegativeInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = nonNegativeInteger Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NonNegativeInteger */ protected org.apache.axis2.databinding.types.NonNegativeInteger localNonNegativeInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NonNegativeInteger */ public org.apache.axis2.databinding.types.NonNegativeInteger getNonNegativeInteger(){ return localNonNegativeInteger; } /** * Auto generated setter method * @param param NonNegativeInteger */ public void setNonNegativeInteger(org.apache.axis2.databinding.types.NonNegativeInteger param){ this.localNonNegativeInteger=param; } public java.lang.String toString(){ return localNonNegativeInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NonNegativeInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":nonNegativeInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "nonNegativeInteger", xmlWriter); } } if (localNonNegativeInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("nonNegativeInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonNegativeInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNonNegativeInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonNegativeInteger)); } else { throw new org.apache.axis2.databinding.ADBException("nonNegativeInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NonNegativeInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NonNegativeInteger returnValue = new NonNegativeInteger(); returnValue.setNonNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(value)); return returnValue; } public static NonNegativeInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NonNegativeInteger.Factory.fromString(content,namespaceUri); } else { return NonNegativeInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NonNegativeInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NonNegativeInteger object = new NonNegativeInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"nonNegativeInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NonNegativeInteger)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNonNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/ENTITY.java0000664000175000017500000005210011767656530022115 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ENTITY.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * ENTITY bean class */ public class ENTITY implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ENTITY Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ENTITY */ protected org.apache.axis2.databinding.types.Entity localENTITY ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Entity */ public org.apache.axis2.databinding.types.Entity getENTITY(){ return localENTITY; } /** * Auto generated setter method * @param param ENTITY */ public void setENTITY(org.apache.axis2.databinding.types.Entity param){ this.localENTITY=param; } public java.lang.String toString(){ return localENTITY.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ENTITY.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ENTITY", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ENTITY", xmlWriter); } } if (localENTITY==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ENTITY cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITY)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localENTITY != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITY)); } else { throw new org.apache.axis2.databinding.ADBException("ENTITY cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ENTITY fromString(java.lang.String value, java.lang.String namespaceURI){ ENTITY returnValue = new ENTITY(); returnValue.setENTITY( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITY(value)); return returnValue; } public static ENTITY fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ENTITY.Factory.fromString(content,namespaceUri); } else { return ENTITY.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ENTITY parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ENTITY object = new ENTITY(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ENTITY".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ENTITY)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setENTITY( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITY(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NCName.java0000664000175000017500000005210011767656530022202 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NCName.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NCName bean class */ public class NCName implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NCName Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NCName */ protected org.apache.axis2.databinding.types.NCName localNCName ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NCName */ public org.apache.axis2.databinding.types.NCName getNCName(){ return localNCName; } /** * Auto generated setter method * @param param NCName */ public void setNCName(org.apache.axis2.databinding.types.NCName param){ this.localNCName=param; } public java.lang.String toString(){ return localNCName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NCName.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NCName", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NCName", xmlWriter); } } if (localNCName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NCName cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNCName)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNCName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNCName)); } else { throw new org.apache.axis2.databinding.ADBException("NCName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NCName fromString(java.lang.String value, java.lang.String namespaceURI){ NCName returnValue = new NCName(); returnValue.setNCName( org.apache.axis2.databinding.utils.ConverterUtil.convertToNCName(value)); return returnValue; } public static NCName fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NCName.Factory.fromString(content,namespaceUri); } else { return NCName.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NCName parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NCName object = new NCName(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NCName".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NCName)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNCName( org.apache.axis2.databinding.utils.ConverterUtil.convertToNCName(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Language.java0000664000175000017500000005222011767656530022627 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Language.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Language bean class */ public class Language implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = language Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Language */ protected org.apache.axis2.databinding.types.Language localLanguage ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Language */ public org.apache.axis2.databinding.types.Language getLanguage(){ return localLanguage; } /** * Auto generated setter method * @param param Language */ public void setLanguage(org.apache.axis2.databinding.types.Language param){ this.localLanguage=param; } public java.lang.String toString(){ return localLanguage.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Language.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":language", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "language", xmlWriter); } } if (localLanguage==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("language cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localLanguage)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localLanguage != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localLanguage)); } else { throw new org.apache.axis2.databinding.ADBException("language cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Language fromString(java.lang.String value, java.lang.String namespaceURI){ Language returnValue = new Language(); returnValue.setLanguage( org.apache.axis2.databinding.utils.ConverterUtil.convertToLanguage(value)); return returnValue; } public static Language fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Language.Factory.fromString(content,namespaceUri); } else { return Language.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Language parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Language object = new Language(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"language".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Language)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setLanguage( org.apache.axis2.databinding.utils.ConverterUtil.convertToLanguage(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Duration.java0000664000175000017500000005222011767656530022671 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Duration.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Duration bean class */ public class Duration implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = duration Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Duration */ protected org.apache.axis2.databinding.types.Duration localDuration ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Duration */ public org.apache.axis2.databinding.types.Duration getDuration(){ return localDuration; } /** * Auto generated setter method * @param param Duration */ public void setDuration(org.apache.axis2.databinding.types.Duration param){ this.localDuration=param; } public java.lang.String toString(){ return localDuration.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Duration.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":duration", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "duration", xmlWriter); } } if (localDuration==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("duration cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDuration)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDuration != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDuration)); } else { throw new org.apache.axis2.databinding.ADBException("duration cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Duration fromString(java.lang.String value, java.lang.String namespaceURI){ Duration returnValue = new Duration(); returnValue.setDuration( org.apache.axis2.databinding.utils.ConverterUtil.convertToDuration(value)); return returnValue; } public static Duration fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Duration.Factory.fromString(content,namespaceUri); } else { return Duration.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Duration parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Duration object = new Duration(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"duration".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Duration)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDuration( org.apache.axis2.databinding.utils.ConverterUtil.convertToDuration(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Base64.java0000664000175000017500000004700611767656530022136 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Base64.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Base64 bean class */ public class Base64 implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://www.w3.org/2001/XMLSchema", "base64", "xsd"); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Base64 */ protected javax.activation.DataHandler localBase64 ; /** * Auto generated getter method * @return javax.activation.DataHandler */ public javax.activation.DataHandler getBase64(){ return localBase64; } /** * Auto generated setter method * @param param Base64 */ public void setBase64(javax.activation.DataHandler param){ this.localBase64=param; } public java.lang.String toString(){ return localBase64.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Base64.this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":base64", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "base64", xmlWriter); } } if (localBase64==null){ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localBase64)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localBase64) }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Base64 fromString(java.lang.String value, java.lang.String namespaceURI){ Base64 returnValue = new Base64(); returnValue.setBase64( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(value)); return returnValue; } public static Base64 fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Base64.Factory.fromString(content,namespaceUri); } else { return Base64.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Base64 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Base64 object = new Base64(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setBase64( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_int.java0000664000175000017500000005073511767656530022046 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _int.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _int bean class */ public class _int implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = int Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _int */ protected int local_int ; /** * Auto generated getter method * @return int */ public int get_int(){ return local_int; } /** * Auto generated setter method * @param param _int */ public void set_int(int param){ this.local_int=param; } public java.lang.String toString(){ return local_int + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _int.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":int", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "int", xmlWriter); } } if (local_int==java.lang.Integer.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("int cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_int)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_int)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _int fromString(java.lang.String value, java.lang.String namespaceURI){ _int returnValue = new _int(); returnValue.set_int( org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(value)); return returnValue; } public static _int fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _int.Factory.fromString(content,namespaceUri); } else { return _int.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _int parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _int object = new _int(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"int".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_int)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_int( org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/GDay.java0000664000175000017500000005175411767656530021743 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GDay.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * GDay bean class */ public class GDay implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gDay Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GDay */ protected org.apache.axis2.databinding.types.Day localGDay ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Day */ public org.apache.axis2.databinding.types.Day getGDay(){ return localGDay; } /** * Auto generated setter method * @param param GDay */ public void setGDay(org.apache.axis2.databinding.types.Day param){ this.localGDay=param; } public java.lang.String toString(){ return localGDay.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GDay.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gDay", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gDay", xmlWriter); } } if (localGDay==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gDay cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGDay)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGDay != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGDay)); } else { throw new org.apache.axis2.databinding.ADBException("gDay cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GDay fromString(java.lang.String value, java.lang.String namespaceURI){ GDay returnValue = new GDay(); returnValue.setGDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGDay(value)); return returnValue; } public static GDay fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GDay.Factory.fromString(content,namespaceUri); } else { return GDay.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GDay parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GDay object = new GDay(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gDay".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GDay)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGDay(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Time.java0000664000175000017500000005176011767656530022012 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Time.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Time bean class */ public class Time implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = time Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Time */ protected org.apache.axis2.databinding.types.Time localTime ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Time */ public org.apache.axis2.databinding.types.Time getTime(){ return localTime; } /** * Auto generated setter method * @param param Time */ public void setTime(org.apache.axis2.databinding.types.Time param){ this.localTime=param; } public java.lang.String toString(){ return localTime.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Time.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":time", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "time", xmlWriter); } } if (localTime==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("time cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localTime)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localTime != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localTime)); } else { throw new org.apache.axis2.databinding.ADBException("time cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Time fromString(java.lang.String value, java.lang.String namespaceURI){ Time returnValue = new Time(); returnValue.setTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToTime(value)); return returnValue; } public static Time fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Time.Factory.fromString(content,namespaceUri); } else { return Time.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Time parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Time object = new Time(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"time".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Time)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToTime(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NMTOKEN.java0000664000175000017500000005215011767656530022221 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NMTOKEN.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NMTOKEN bean class */ public class NMTOKEN implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NMTOKEN Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NMTOKEN */ protected org.apache.axis2.databinding.types.NMToken localNMTOKEN ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NMToken */ public org.apache.axis2.databinding.types.NMToken getNMTOKEN(){ return localNMTOKEN; } /** * Auto generated setter method * @param param NMTOKEN */ public void setNMTOKEN(org.apache.axis2.databinding.types.NMToken param){ this.localNMTOKEN=param; } public java.lang.String toString(){ return localNMTOKEN.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NMTOKEN.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NMTOKEN", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NMTOKEN", xmlWriter); } } if (localNMTOKEN==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NMTOKEN cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKEN)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNMTOKEN != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKEN)); } else { throw new org.apache.axis2.databinding.ADBException("NMTOKEN cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NMTOKEN fromString(java.lang.String value, java.lang.String namespaceURI){ NMTOKEN returnValue = new NMTOKEN(); returnValue.setNMTOKEN( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKEN(value)); return returnValue; } public static NMTOKEN fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NMTOKEN.Factory.fromString(content,namespaceUri); } else { return NMTOKEN.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NMTOKEN parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NMTOKEN object = new NMTOKEN(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NMTOKEN".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NMTOKEN)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNMTOKEN( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKEN(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Integer.java0000664000175000017500000005202011767656530022477 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Integer.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Integer bean class */ public class Integer implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = integer Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Integer */ protected java.math.BigInteger localInteger ; /** * Auto generated getter method * @return java.math.BigInteger */ public java.math.BigInteger getInteger(){ return localInteger; } /** * Auto generated setter method * @param param Integer */ public void setInteger(java.math.BigInteger param){ this.localInteger=param; } public java.lang.String toString(){ return localInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Integer.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":integer", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "integer", xmlWriter); } } if (localInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("integer cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localInteger)); } else { throw new org.apache.axis2.databinding.ADBException("integer cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Integer fromString(java.lang.String value, java.lang.String namespaceURI){ Integer returnValue = new Integer(); returnValue.setInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToInteger(value)); return returnValue; } public static Integer fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Integer.Factory.fromString(content,namespaceUri); } else { return Integer.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Integer parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Integer object = new Integer(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"integer".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Integer)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/AnyURI.java0000664000175000017500000005206411767656530022221 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * AnyURI.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * AnyURI bean class */ public class AnyURI implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = anyURI Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for AnyURI */ protected org.apache.axis2.databinding.types.URI localAnyURI ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.URI */ public org.apache.axis2.databinding.types.URI getAnyURI(){ return localAnyURI; } /** * Auto generated setter method * @param param AnyURI */ public void setAnyURI(org.apache.axis2.databinding.types.URI param){ this.localAnyURI=param; } public java.lang.String toString(){ return localAnyURI.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { AnyURI.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":anyURI", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "anyURI", xmlWriter); } } if (localAnyURI==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("anyURI cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localAnyURI)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localAnyURI != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localAnyURI)); } else { throw new org.apache.axis2.databinding.ADBException("anyURI cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static AnyURI fromString(java.lang.String value, java.lang.String namespaceURI){ AnyURI returnValue = new AnyURI(); returnValue.setAnyURI( org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(value)); return returnValue; } public static AnyURI fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return AnyURI.Factory.fromString(content,namespaceUri); } else { return AnyURI.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static AnyURI parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ AnyURI object = new AnyURI(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"anyURI".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (AnyURI)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setAnyURI( org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/IDREF.java0000664000175000017500000005203011767656530021734 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * IDREF.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * IDREF bean class */ public class IDREF implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = IDREF Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for IDREF */ protected org.apache.axis2.databinding.types.IDRef localIDREF ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.IDRef */ public org.apache.axis2.databinding.types.IDRef getIDREF(){ return localIDREF; } /** * Auto generated setter method * @param param IDREF */ public void setIDREF(org.apache.axis2.databinding.types.IDRef param){ this.localIDREF=param; } public java.lang.String toString(){ return localIDREF.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { IDREF.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":IDREF", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "IDREF", xmlWriter); } } if (localIDREF==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("IDREF cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREF)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localIDREF != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREF)); } else { throw new org.apache.axis2.databinding.ADBException("IDREF cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static IDREF fromString(java.lang.String value, java.lang.String namespaceURI){ IDREF returnValue = new IDREF(); returnValue.setIDREF( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREF(value)); return returnValue; } public static IDREF fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return IDREF.Factory.fromString(content,namespaceUri); } else { return IDREF.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static IDREF parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ IDREF object = new IDREF(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"IDREF".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (IDREF)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setIDREF( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREF(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/GMonth.java0000664000175000017500000005207411767656530022307 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GMonth.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * GMonth bean class */ public class GMonth implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gMonth Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GMonth */ protected org.apache.axis2.databinding.types.Month localGMonth ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Month */ public org.apache.axis2.databinding.types.Month getGMonth(){ return localGMonth; } /** * Auto generated setter method * @param param GMonth */ public void setGMonth(org.apache.axis2.databinding.types.Month param){ this.localGMonth=param; } public java.lang.String toString(){ return localGMonth.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GMonth.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gMonth", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gMonth", xmlWriter); } } if (localGMonth==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gMonth cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonth)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGMonth != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonth)); } else { throw new org.apache.axis2.databinding.ADBException("gMonth cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GMonth fromString(java.lang.String value, java.lang.String namespaceURI){ GMonth returnValue = new GMonth(); returnValue.setGMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonth(value)); return returnValue; } public static GMonth fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GMonth.Factory.fromString(content,namespaceUri); } else { return GMonth.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GMonth parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GMonth object = new GMonth(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gMonth".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GMonth)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonth(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/UnsignedByte.java0000664000175000017500000005246011767656530023512 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedByte.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * UnsignedByte bean class */ public class UnsignedByte implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedByte Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedByte */ protected org.apache.axis2.databinding.types.UnsignedByte localUnsignedByte ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedByte */ public org.apache.axis2.databinding.types.UnsignedByte getUnsignedByte(){ return localUnsignedByte; } /** * Auto generated setter method * @param param UnsignedByte */ public void setUnsignedByte(org.apache.axis2.databinding.types.UnsignedByte param){ this.localUnsignedByte=param; } public java.lang.String toString(){ return localUnsignedByte.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedByte.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedByte", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedByte", xmlWriter); } } if (localUnsignedByte==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedByte cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedByte)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedByte != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedByte)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedByte cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedByte fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedByte returnValue = new UnsignedByte(); returnValue.setUnsignedByte( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedByte(value)); return returnValue; } public static UnsignedByte fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedByte.Factory.fromString(content,namespaceUri); } else { return UnsignedByte.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedByte parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedByte object = new UnsignedByte(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedByte".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedByte)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedByte( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedByte(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/UnsignedShort.java0000664000175000017500000005253011767656530023704 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedShort.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * UnsignedShort bean class */ public class UnsignedShort implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedShort Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedShort */ protected org.apache.axis2.databinding.types.UnsignedShort localUnsignedShort ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedShort */ public org.apache.axis2.databinding.types.UnsignedShort getUnsignedShort(){ return localUnsignedShort; } /** * Auto generated setter method * @param param UnsignedShort */ public void setUnsignedShort(org.apache.axis2.databinding.types.UnsignedShort param){ this.localUnsignedShort=param; } public java.lang.String toString(){ return localUnsignedShort.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedShort.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedShort", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedShort", xmlWriter); } } if (localUnsignedShort==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedShort cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedShort)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedShort != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedShort)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedShort cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedShort fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedShort returnValue = new UnsignedShort(); returnValue.setUnsignedShort( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedShort(value)); return returnValue; } public static UnsignedShort fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedShort.Factory.fromString(content,namespaceUri); } else { return UnsignedShort.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedShort parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedShort object = new UnsignedShort(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedShort".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedShort)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedShort( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedShort(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_float.java0000664000175000017500000005104311767656530022352 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _float.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _float bean class */ public class _float implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = float Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _float */ protected float local_float ; /** * Auto generated getter method * @return float */ public float get_float(){ return local_float; } /** * Auto generated setter method * @param param _float */ public void set_float(float param){ this.local_float=param; } public java.lang.String toString(){ return local_float + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _float.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":float", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "float", xmlWriter); } } if (java.lang.Float.isNaN(local_float)) { throw new org.apache.axis2.databinding.ADBException("float cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_float)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_float)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _float fromString(java.lang.String value, java.lang.String namespaceURI){ _float returnValue = new _float(); returnValue.set_float( org.apache.axis2.databinding.utils.ConverterUtil.convertToFloat(value)); return returnValue; } public static _float fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _float.Factory.fromString(content,namespaceUri); } else { return _float.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _float parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _float object = new _float(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"float".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_float)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_float( org.apache.axis2.databinding.utils.ConverterUtil.convertToFloat(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/ExtensionMapper.java0000664000175000017500000003061311767656530024227 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ExtensionMapper.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * ExtensionMapper class */ public class ExtensionMapper { public static java.lang.Object getTypeObject(java.lang.String namespaceURI, java.lang.String typeName, javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { if ("http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "unsignedByte".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.UnsignedByte.Factory.parse(reader); } if ("http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "NMTOKEN".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NMTOKEN.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "duration".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Duration.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "int".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._int.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "string".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.String.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "NOTATION".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NOTATION.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "time".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Time.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "gDay".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.GDay.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "hexBinary".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.HexBinary.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "nonNegativeInteger".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NonNegativeInteger.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "NCName".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NCName.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "NMTOKENS".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NMTOKENS.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "unsignedInt".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.UnsignedInt.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "unsignedLong".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.UnsignedLong.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "negativeInteger".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NegativeInteger.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "dateTime".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.DateTime.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "unsignedShort".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.UnsignedShort.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "gYearMonth".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.GYearMonth.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "boolean".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._boolean.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "nonPositiveInteger".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NonPositiveInteger.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "base64".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Base64.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "double".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._double.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "float".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._float.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "base64Binary".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Base64Binary.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "gMonthDay".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.GMonthDay.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "Name".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Name.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "ENTITY".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.ENTITY.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "byte".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._byte.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "long".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._long.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "IDREF".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.IDREF.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "gYear".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.GYear.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "ID".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.ID.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "anyURI".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.AnyURI.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "token".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Token.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "positiveInteger".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.PositiveInteger.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "short".equals(typeName)) { return org.apache.axis2.databinding.types.xsd._short.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "language".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Language.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "ENTITIES".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.ENTITIES.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "date".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Date.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "integer".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Integer.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "QName".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.QName.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "normalizedString".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.NormalizedString.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "IDREFS".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.IDREFS.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "decimal".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.Decimal.Factory.parse(reader); } if ( "http://www.w3.org/2001/XMLSchema".equals(namespaceURI) && "gMonth".equals(typeName)) { return org.apache.axis2.databinding.types.xsd.GMonth.Factory.parse(reader); } System.out.println("Names pace ==> " + namespaceURI + " type " + typeName); throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName); } } ./src/org/apache/axis2/databinding/types/xsd/GYearMonth.java0000664000175000017500000005233411767656530023127 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GYearMonth.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * GYearMonth bean class */ public class GYearMonth implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gYearMonth Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GYearMonth */ protected org.apache.axis2.databinding.types.YearMonth localGYearMonth ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.YearMonth */ public org.apache.axis2.databinding.types.YearMonth getGYearMonth(){ return localGYearMonth; } /** * Auto generated setter method * @param param GYearMonth */ public void setGYearMonth(org.apache.axis2.databinding.types.YearMonth param){ this.localGYearMonth=param; } public java.lang.String toString(){ return localGYearMonth.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GYearMonth.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gYearMonth", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gYearMonth", xmlWriter); } } if (localGYearMonth==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gYearMonth cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYearMonth)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGYearMonth != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYearMonth)); } else { throw new org.apache.axis2.databinding.ADBException("gYearMonth cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GYearMonth fromString(java.lang.String value, java.lang.String namespaceURI){ GYearMonth returnValue = new GYearMonth(); returnValue.setGYearMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYearMonth(value)); return returnValue; } public static GYearMonth fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GYearMonth.Factory.fromString(content,namespaceUri); } else { return GYearMonth.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GYearMonth parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GYearMonth object = new GYearMonth(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gYearMonth".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GYearMonth)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGYearMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYearMonth(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/NormalizedString.java0000664000175000017500000005272011767656530024404 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NormalizedString.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * NormalizedString bean class */ public class NormalizedString implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = normalizedString Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NormalizedString */ protected org.apache.axis2.databinding.types.NormalizedString localNormalizedString ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NormalizedString */ public org.apache.axis2.databinding.types.NormalizedString getNormalizedString(){ return localNormalizedString; } /** * Auto generated setter method * @param param NormalizedString */ public void setNormalizedString(org.apache.axis2.databinding.types.NormalizedString param){ this.localNormalizedString=param; } public java.lang.String toString(){ return localNormalizedString.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NormalizedString.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":normalizedString", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "normalizedString", xmlWriter); } } if (localNormalizedString==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("normalizedString cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNormalizedString)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNormalizedString != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNormalizedString)); } else { throw new org.apache.axis2.databinding.ADBException("normalizedString cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NormalizedString fromString(java.lang.String value, java.lang.String namespaceURI){ NormalizedString returnValue = new NormalizedString(); returnValue.setNormalizedString( org.apache.axis2.databinding.utils.ConverterUtil.convertToNormalizedString(value)); return returnValue; } public static NormalizedString fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NormalizedString.Factory.fromString(content,namespaceUri); } else { return NormalizedString.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NormalizedString parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NormalizedString object = new NormalizedString(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"normalizedString".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NormalizedString)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNormalizedString( org.apache.axis2.databinding.utils.ConverterUtil.convertToNormalizedString(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/GYear.java0000664000175000017500000005202411767656530022115 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GYear.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * GYear bean class */ public class GYear implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gYear Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GYear */ protected org.apache.axis2.databinding.types.Year localGYear ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Year */ public org.apache.axis2.databinding.types.Year getGYear(){ return localGYear; } /** * Auto generated setter method * @param param GYear */ public void setGYear(org.apache.axis2.databinding.types.Year param){ this.localGYear=param; } public java.lang.String toString(){ return localGYear.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GYear.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gYear", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gYear", xmlWriter); } } if (localGYear==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gYear cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYear)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGYear != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYear)); } else { throw new org.apache.axis2.databinding.ADBException("gYear cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GYear fromString(java.lang.String value, java.lang.String namespaceURI){ GYear returnValue = new GYear(); returnValue.setGYear( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYear(value)); return returnValue; } public static GYear fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GYear.Factory.fromString(content,namespaceUri); } else { return GYear.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GYear parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GYear object = new GYear(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gYear".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GYear)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGYear( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYear(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/_double.java0000664000175000017500000005111211767656530022514 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _double.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * _double bean class */ public class _double implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = double Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _double */ protected double local_double ; /** * Auto generated getter method * @return double */ public double get_double(){ return local_double; } /** * Auto generated setter method * @param param _double */ public void set_double(double param){ this.local_double=param; } public java.lang.String toString(){ return local_double + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _double.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":double", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "double", xmlWriter); } } if (java.lang.Double.isNaN(local_double)) { throw new org.apache.axis2.databinding.ADBException("double cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_double)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_double)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _double fromString(java.lang.String value, java.lang.String namespaceURI){ _double returnValue = new _double(); returnValue.set_double( org.apache.axis2.databinding.utils.ConverterUtil.convertToDouble(value)); return returnValue; } public static _double fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _double.Factory.fromString(content,namespaceUri); } else { return _double.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _double parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _double object = new _double(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"double".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_double)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_double( org.apache.axis2.databinding.utils.ConverterUtil.convertToDouble(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/Date.java0000664000175000017500000005161411767656530021767 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Date.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * Date bean class */ public class Date implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = date Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Date */ protected java.util.Date localDate ; /** * Auto generated getter method * @return java.util.Date */ public java.util.Date getDate(){ return localDate; } /** * Auto generated setter method * @param param Date */ public void setDate(java.util.Date param){ this.localDate=param; } public java.lang.String toString(){ return localDate.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Date.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":date", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "date", xmlWriter); } } if (localDate==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("date cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDate)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDate != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDate)); } else { throw new org.apache.axis2.databinding.ADBException("date cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Date fromString(java.lang.String value, java.lang.String namespaceURI){ Date returnValue = new Date(); returnValue.setDate( org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(value)); return returnValue; } public static Date fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Date.Factory.fromString(content,namespaceUri); } else { return Date.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Date parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Date object = new Date(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"date".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Date)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDate( org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/xsd/IDREFS.java0000664000175000017500000005210011767656530022055 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * IDREFS.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.xsd; /** * IDREFS bean class */ public class IDREFS implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = IDREFS Namespace URI = http://www.w3.org/2001/XMLSchema Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.w3.org/2001/XMLSchema")){ return "xsd"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for IDREFS */ protected org.apache.axis2.databinding.types.IDRefs localIDREFS ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.IDRefs */ public org.apache.axis2.databinding.types.IDRefs getIDREFS(){ return localIDREFS; } /** * Auto generated setter method * @param param IDREFS */ public void setIDREFS(org.apache.axis2.databinding.types.IDRefs param){ this.localIDREFS=param; } public java.lang.String toString(){ return localIDREFS.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { IDREFS.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.w3.org/2001/XMLSchema"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":IDREFS", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "IDREFS", xmlWriter); } } if (localIDREFS==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("IDREFS cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREFS)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localIDREFS != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREFS)); } else { throw new org.apache.axis2.databinding.ADBException("IDREFS cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static IDREFS fromString(java.lang.String value, java.lang.String namespaceURI){ IDREFS returnValue = new IDREFS(); returnValue.setIDREFS( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREFS(value)); return returnValue; } public static IDREFS fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return IDREFS.Factory.fromString(content,namespaceUri); } else { return IDREFS.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static IDREFS parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ IDREFS object = new IDREFS(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"IDREFS".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (IDREFS)org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setIDREFS( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREFS(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/Name.java0000664000175000017500000000571711767656530021177 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import org.apache.axis2.util.XMLChar; /** * Custom class for supporting XSD data type Name Name represents XML Names. The value space of Name * is the set of all strings which match the Name production of [XML 1.0 (Second Edition)]. The base * type of Name is token. * * @see XML Schema 3.3.6 */ public class Name extends Token { private static final long serialVersionUID = -8354594301737358441L; public Name() { super(); } /** * ctor for Name * * @throws IllegalArgumentException will be thrown if validation fails */ public Name(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException( " invalid value for name " + "data=[" + stValue + "]"); } } /** * validates the data and sets the value for the object. * * @param stValue String value * @throws IllegalArgumentException if invalid format */ public void setValue(String stValue) throws IllegalArgumentException { if (!Name.isValid(stValue)) throw new IllegalArgumentException( " invalid value for name " + " data=[" + stValue + "]"); m_value = stValue; } /** * validate the value against the xsd definition Name ::= (Letter | '_' | ':') ( * NameChar)* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | * Extender */ //todo - Fix this public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) { bValid = XMLChar.isNameStart(stValue.charAt(scan)); } else { bValid = XMLChar.isName(stValue.charAt(scan)); } if (!bValid) break; } return bValid; } } ./src/org/apache/axis2/databinding/types/MonthDay.java0000664000175000017500000001345511767656530022040 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.text.NumberFormat; /** * Implementation of the XML Schema type gMonthDay * * @see XML Schema 3.2.12 */ public class MonthDay implements java.io.Serializable { private static final long serialVersionUID = -345189609825249318L; int month; int day; String timezone; /** Constructs a MonthDay with the given values No timezone is specified */ public MonthDay(int month, int day) throws NumberFormatException { setValue(month, day); } /** * Constructs a MonthDay with the given values, including a timezone string The timezone is * validated but not used. */ public MonthDay(int month, int day, String timezone) throws NumberFormatException { setValue(month, day, timezone); } /** Construct a MonthDay from a String in the format --MM-DD[timezone] */ public MonthDay(String source) throws NumberFormatException { if (source.length() < 6) { throw new NumberFormatException(); //Messages.getMessage("badMonthDay00")); } if (source.charAt(0) != '-' || source.charAt(1) != '-' || source.charAt(4) != '-') { throw new NumberFormatException(); //Messages.getMessage("badMonthDay00")); } setValue(Integer.parseInt(source.substring(2, 4)), Integer.parseInt(source.substring(5, 7)), source.substring(7)); } public int getMonth() { return month; } public void setMonth(int month) { // validate month if (month < 1 || month > 12) { throw new NumberFormatException(); //Messages.getMessage("badMonthDay00")); } this.month = month; } public int getDay() { return day; } /** Set the day NOTE: if the month isn't set yet, the day isn't validated */ public void setDay(int day) { // validate day if (day < 1 || day > 31) { throw new NumberFormatException(); //Messages.getMessage("badMonthDay00")); } // 30 days has September... All the rest have 31 (except Feb!) // NOTE: if month isn't set, we don't validate day. if ((month == 2 && day > 29) || ((month == 9 || month == 4 || month == 6 || month == 11) && day > 30)) { throw new NumberFormatException(); // Messages.getMessage("badMonthDay00")); } this.day = day; } public String getTimezone() { return timezone; } public void setTimezone(String timezone) { // validate timezone if (timezone != null && timezone.length() > 0) { // Format [+/-]HH:MM if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) { if (timezone.length() != 6 || !Character.isDigit(timezone.charAt(1)) || !Character.isDigit(timezone.charAt(2)) || timezone.charAt(3) != ':' || !Character.isDigit(timezone.charAt(4)) || !Character.isDigit(timezone.charAt(5))) throw new NumberFormatException(); // Messages.getMessage("badTimezone00")); } else if (!timezone.equals("Z")) { throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } // if we got this far, its good this.timezone = timezone; } } public void setValue(int month, int day, String timezone) throws NumberFormatException { setMonth(month); setDay(day); setTimezone(timezone); } public void setValue(int month, int day) throws NumberFormatException { setMonth(month); setDay(day); } public String toString() { // use NumberFormat to ensure leading zeros NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); // month & Day: --MM-DD nf.setMinimumIntegerDigits(2); String s = "--" + nf.format(month) + "-" + nf.format(day); // timezone if (timezone != null) { s = s + timezone; } return s; } public boolean equals(Object obj) { if (!(obj instanceof MonthDay)) return false; MonthDay other = (MonthDay)obj; if (this == obj) return true; boolean equals = (this.month == other.month && this.day == other.day); if (timezone != null) { equals = equals && timezone.equals(other.timezone); } return equals; } /** * Return the value of (month + day) XORed with the hashCode of timezone iff one is defined. * * @return an int value */ public int hashCode() { return null == timezone ? (month + day) : (month + day) ^ timezone.hashCode(); } } ./src/org/apache/axis2/databinding/types/Entities.java0000664000175000017500000000324011767656530022070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.util.StringTokenizer; /** * Custom class for supporting XSD data type Entities * * @see XML Schema 3.3.12 ENTITIES */ public class Entities extends NCName { private static final long serialVersionUID = -4511368195143560809L; private Entity[] entities; public Entities() { super(); } /** * ctor for Entities * * @throws IllegalArgumentException will be thrown if validation fails */ public Entities(String stValue) throws IllegalArgumentException { StringTokenizer tokenizer = new StringTokenizer(stValue); int count = tokenizer.countTokens(); entities = new Entity[count]; for (int i = 0; i < count; i++) { entities[i] = new Entity(tokenizer.nextToken()); } } } ./src/org/apache/axis2/databinding/types/Notation.java0000664000175000017500000000652711767656530022112 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type NOTATION. * * @see XML Schema Part 1: 3.12 * Notation Declarations */ public class Notation implements java.io.Serializable { private static final long serialVersionUID = 2393074651972192536L; NCName name; URI publicURI; URI systemURI; public Notation() { } public Notation(NCName name, URI publicURI, URI systemURI) { this.name = name; this.publicURI = publicURI; this.systemURI = systemURI; } public NCName getName() { return name; } public void setName(NCName name) { this.name = name; } public URI getPublic() { return publicURI; } public void setPublic(URI publicURI) { this.publicURI = publicURI; } public URI getSystem() { return systemURI; } public void setSystem(URI systemURI) { this.systemURI = systemURI; } public boolean equals(Object obj) { if (obj == null || !(obj instanceof Notation)) return false; Notation other = (Notation)obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (publicURI == null) { if (other.publicURI != null) { return false; } } else if (!publicURI.equals(other.publicURI)) { return false; } if (systemURI == null) { if (other.systemURI != null) { return false; } } else if (!systemURI.equals(other.systemURI)) { return false; } return true; } /** * Returns the sum of the hashcodes of {name,publicURI,systemURI} for whichever properties in * that set is non null. This is consistent with the implementation of equals, as required by * {@link Object#hashCode() Object.hashCode}. * * @return an int value */ public int hashCode() { int hash = 0; if (null != name) { hash += name.hashCode(); } if (null != publicURI) { hash += publicURI.hashCode(); } if (null != systemURI) { hash += systemURI.hashCode(); } return hash; } /** * Note - A lot of code that depended on certain descriptions has been deleted from this class */ } ./src/org/apache/axis2/databinding/types/Day.java0000664000175000017500000001132311767656530021022 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.Serializable; import java.text.NumberFormat; /** * Implementation of the XML Schema type gDay * * @see XML Schema 3.2.13 */ public class Day implements Serializable { private static final long serialVersionUID = -9024662553918598132L; int day; String timezone; /** Constructs a Day with the given values No timezone is specified */ public Day(int day) throws NumberFormatException { setValue(day); } /** * Constructs a Day with the given values, including a timezone string The timezone is validated * but not used. */ public Day(int day, String timezone) throws NumberFormatException { setValue(day, timezone); } /** Construct a Day from a String in the format ---DD[timezone] */ public Day(String source) throws NumberFormatException { if (source.length() < 5) { throw new NumberFormatException(); //Messages.getMessage("badDay00")); } if (source.charAt(0) != '-' || source.charAt(1) != '-' || source.charAt(2) != '-') { throw new NumberFormatException(); //Messages.getMessage("badDay00")); } setValue(Integer.parseInt(source.substring(3, 5)), source.substring(5)); } public int getDay() { return day; } /** Set the day */ public void setDay(int day) { // validate day if (day < 1 || day > 31) { throw new NumberFormatException(); //Messages.getMessage("badDay00")); } this.day = day; } public String getTimezone() { return timezone; } public void setTimezone(String timezone) { // validate timezone if (timezone != null && timezone.length() > 0) { // Format [+/-]HH:MM if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) { if (timezone.length() != 6 || !Character.isDigit(timezone.charAt(1)) || !Character.isDigit(timezone.charAt(2)) || timezone.charAt(3) != ':' || !Character.isDigit(timezone.charAt(4)) || !Character.isDigit(timezone.charAt(5))) throw new NumberFormatException(); // Messages.getMessage("badTimezone00")); } else if (!timezone.equals("Z")) { throw new NumberFormatException(); // Messages.getMessage("badTimezone00")); } // if we got this far, its good this.timezone = timezone; } } public void setValue(int day, String timezone) throws NumberFormatException { setDay(day); setTimezone(timezone); } public void setValue(int day) throws NumberFormatException { setDay(day); } public String toString() { // use NumberFormat to ensure leading zeros NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); // Day nf.setMinimumIntegerDigits(2); String s = "---" + nf.format(day); // timezone if (timezone != null) { s = s + timezone; } return s; } public boolean equals(Object obj) { if (!(obj instanceof Day)) return false; Day other = (Day)obj; if (this == obj) return true; boolean equals = (this.day == other.day); if (timezone != null) { equals = equals && timezone.equals(other.timezone); } return equals; } /** * Return the value of day XORed with the hashCode of timezone iff one is defined. * * @return an int value */ public int hashCode() { return null == timezone ? day : day ^ timezone.hashCode(); } } ./src/org/apache/axis2/databinding/types/PositiveInteger.java0000664000175000017500000000642611767656530023435 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.ObjectStreamException; import java.math.BigInteger; import java.util.Random; /** * Custom class for supporting primitive XSD data type positiveInteger *

        * positiveInteger is derived from nonNegativeInteger by setting the value of minInclusive to be 1. * This results in the standard mathematical concept of the positive integer numbers. The value * space of positiveInteger is the infinite set {1,2,...}. * * @see XML Schema 3.3.25 */ public class PositiveInteger extends NonNegativeInteger { private static final long serialVersionUID = -4562301423231920813L; public PositiveInteger(byte[] val) { super(val); checkValidity(); } // ctor public PositiveInteger(int signum, byte[] magnitude) { super(signum, magnitude); checkValidity(); } // ctor public PositiveInteger(int bitLength, int certainty, Random rnd) { super(bitLength, certainty, rnd); checkValidity(); } // ctor public PositiveInteger(int numBits, Random rnd) { super(numBits, rnd); checkValidity(); } // ctor public PositiveInteger(String val) { super(val); checkValidity(); } public PositiveInteger(String val, int radix) { super(val, radix); checkValidity(); } // ctor /** validate the value against the xsd definition */ private BigInteger iMinInclusive = new BigInteger("1"); private void checkValidity() { if (compareTo(iMinInclusive) < 0) { throw new NumberFormatException( //Messages.getMessage("badposInt00") ": " + this); } } // checkValidity /** * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html * * @return BigIntegerRep * @throws java.io.ObjectStreamException */ public Object writeReplace() throws ObjectStreamException { return new BigIntegerRep(toByteArray()); } protected static class BigIntegerRep implements java.io.Serializable { private static final long serialVersionUID = 1251664160936150499L; private byte[] array; protected BigIntegerRep(byte[] array) { this.array = array; } protected Object readResolve() throws java.io.ObjectStreamException { return new PositiveInteger(array); } } } // class NonNegativeInteger ./src/org/apache/axis2/databinding/types/soapencoding/0000775000175000017500000000000011767656530022113 5ustar brianbrian./src/org/apache/axis2/databinding/types/soapencoding/NegativeInteger.java0000664000175000017500000005273211767656530026047 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NegativeInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NegativeInteger bean class */ public class NegativeInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = negativeInteger Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NegativeInteger */ protected org.apache.axis2.databinding.types.NegativeInteger localNegativeInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NegativeInteger */ public org.apache.axis2.databinding.types.NegativeInteger getNegativeInteger(){ return localNegativeInteger; } /** * Auto generated setter method * @param param NegativeInteger */ public void setNegativeInteger(org.apache.axis2.databinding.types.NegativeInteger param){ this.localNegativeInteger=param; } public java.lang.String toString(){ return localNegativeInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NegativeInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":negativeInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "negativeInteger", xmlWriter); } } if (localNegativeInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("negativeInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNegativeInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNegativeInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNegativeInteger)); } else { throw new org.apache.axis2.databinding.ADBException("negativeInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NegativeInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NegativeInteger returnValue = new NegativeInteger(); returnValue.setNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNegativeInteger(value)); return returnValue; } public static NegativeInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NegativeInteger.Factory.fromString(content,namespaceUri); } else { return NegativeInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NegativeInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NegativeInteger object = new NegativeInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"negativeInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NegativeInteger)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNegativeInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/UnsignedInt.java0000664000175000017500000005247211767656530025217 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedInt.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * UnsignedInt bean class */ public class UnsignedInt implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedInt Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedInt */ protected org.apache.axis2.databinding.types.UnsignedInt localUnsignedInt ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedInt */ public org.apache.axis2.databinding.types.UnsignedInt getUnsignedInt(){ return localUnsignedInt; } /** * Auto generated setter method * @param param UnsignedInt */ public void setUnsignedInt(org.apache.axis2.databinding.types.UnsignedInt param){ this.localUnsignedInt=param; } public java.lang.String toString(){ return localUnsignedInt.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedInt.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedInt", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedInt", xmlWriter); } } if (localUnsignedInt==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedInt cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedInt)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedInt != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedInt)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedInt cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedInt fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedInt returnValue = new UnsignedInt(); returnValue.setUnsignedInt( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedInt(value)); return returnValue; } public static UnsignedInt fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedInt.Factory.fromString(content,namespaceUri); } else { return UnsignedInt.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedInt parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedInt object = new UnsignedInt(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedInt".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedInt)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedInt( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedInt(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_long.java0000664000175000017500000005106211767656530024060 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _long.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _long bean class */ public class _long implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = long Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _long */ protected long local_long ; /** * Auto generated getter method * @return long */ public long get_long(){ return local_long; } /** * Auto generated setter method * @param param _long */ public void set_long(long param){ this.local_long=param; } public java.lang.String toString(){ return local_long + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _long.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":long", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "long", xmlWriter); } } if (local_long==java.lang.Long.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("long cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_long)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_long)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _long fromString(java.lang.String value, java.lang.String namespaceURI){ _long returnValue = new _long(); returnValue.set_long( org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(value)); return returnValue; } public static _long fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _long.Factory.fromString(content,namespaceUri); } else { return _long.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _long parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _long object = new _long(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"long".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_long)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_long( org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Array.java0000664000175000017500000006453211767656530024046 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Array.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; import org.apache.axis2.databinding.ADBBean; import org.apache.axis2.databinding.ADBDataSource; import org.apache.axis2.databinding.ADBException; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.databinding.utils.ConverterUtil; import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Array bean class */ public class Array implements ADBBean { public static final java.lang.String CHILD_LOCAL_NAME = "item"; public static final java.lang.String SOAP_NAMESPACE_PREFIX = "SOAP-ENC"; public Array() { this.objectList = new ArrayList(); } private static java.lang.String generatePrefix(java.lang.String namespace) { if (namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")) { return "SOAP-ENC"; } return BeanUtil.getUniquePrefix(); } protected List objectList; public List getObjectList() { return objectList; } public void setObjectList(List objectList) { this.objectList = objectList; } public void addObject(Object object) { this.objectList.add(object); } protected javax.xml.namespace.QName arrayTypeQName; public void setArrayTypeQName(javax.xml.namespace.QName qname){ arrayTypeQName = qname; } public javax.xml.namespace.QName getArrayTypeQName(){ return arrayTypeQName; } /** * field for ArrayType * This was an Attribute! */ protected java.lang.String localArrayType; /** * Auto generated getter method * * @return java.lang.String */ public java.lang.String getArrayType() { return localArrayType; } /** * Auto generated setter method * * @param param ArrayType */ public void setArrayType(java.lang.String param) { this.localArrayType = param; } /** * field for Offset * This was an Attribute! */ protected java.lang.String localOffset; /** * Auto generated getter method * * @return java.lang.String */ public java.lang.String getOffset() { return localOffset; } /** * Auto generated setter method * * @param param Offset */ public void setOffset(java.lang.String param) { this.localOffset = param; } /** * field for Id * This was an Attribute! */ protected org.apache.axis2.databinding.types.Id localId; /** * Auto generated getter method * * @return org.apache.axis2.databinding.types.Id */ public org.apache.axis2.databinding.types.Id getId() { return localId; } /** * Auto generated setter method * * @param param Id */ public void setId(org.apache.axis2.databinding.types.Id param) { this.localId = param; } /** * field for Href * This was an Attribute! */ protected org.apache.axis2.databinding.types.URI localHref; /** * Auto generated getter method * * @return org.apache.axis2.databinding.types.URI */ public org.apache.axis2.databinding.types.URI getHref() { return localHref; } /** * Auto generated setter method * * @param param Href */ public void setHref(org.apache.axis2.databinding.types.URI param) { this.localHref = param; } /** * isReaderMTOMAware * * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try { isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); } catch (java.lang.IllegalArgumentException e) { isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public OMElement getOMElement( final javax.xml.namespace.QName parentQName, final OMFactory factory) throws ADBException { OMDataSource dataSource = new ADBDataSource(this, parentQName) { public void serialize(MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException { Array.this.serialize(parentQName, factory, xmlWriter); } }; return new OMSourcedElementImpl(parentQName, factory, dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException, ADBException { serialize(parentQName, factory, xmlWriter, false); } public void serialize(final javax.xml.namespace.QName parentQName, final OMFactory factory, MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws XMLStreamException, ADBException { java.lang.String prefix = parentQName.getPrefix(); java.lang.String namespace = parentQName.getNamespaceURI(); writeStartElement(namespace, parentQName.getLocalPart(), prefix, xmlWriter); if (serializeType) { java.lang.String namespacePrefix = registerPrefix(xmlWriter, "http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":Array", xmlWriter); } else { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "Array", xmlWriter); } } java.lang.String arrayTypePrefix = null; java.lang.String arrayType = null; if (arrayTypeQName != null){ arrayTypePrefix = registerPrefix(xmlWriter, arrayTypeQName.getNamespaceURI()); arrayType = arrayTypeQName.getLocalPart() + "[" + objectList.size() + "]"; } else { // write it as ur-type arrayTypePrefix = registerPrefix(xmlWriter, "http://www.w3.org/2001/XMLSchema"); arrayType = "ur-type[" + objectList.size() + "]"; } if ((arrayTypePrefix != null) && (arrayTypePrefix.trim().length() > 0)) { arrayType = arrayTypePrefix + ":" + arrayType; } writeAttribute(registerPrefix(xmlWriter, "http://schemas.xmlsoap.org/soap/encoding/"), "http://schemas.xmlsoap.org/soap/encoding/", "arrayType", arrayType, xmlWriter); if (localOffset != null) { writeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "offset", ConverterUtil.convertToString(localOffset), xmlWriter); } if (localId != null) { writeAttribute("", "id", ConverterUtil.convertToString(localId), xmlWriter); } if (localHref != null) { writeAttribute("", "href", ConverterUtil.convertToString(localHref), xmlWriter); } // serialize the object array // since soap encoding does not enforce the name of the children items // here we use item as the child name. // all the list objects must be ADBBeans for basic schema types such as // int,float corresponding soapencoding class must be used ADBBean adbBean; for (Iterator iter = objectList.iterator(); iter.hasNext();) { adbBean = (ADBBean) iter.next(); if (adbBean != null) { if (arrayTypeQName != null) { // if the array Type is given then each element does not have to // write the type adbBean.serialize(new javax.xml.namespace.QName("", CHILD_LOCAL_NAME), factory, xmlWriter); } else { adbBean.serialize(new javax.xml.namespace.QName("", CHILD_LOCAL_NAME), factory, xmlWriter, true); } } else { //write the null attribute writeStartElement("", CHILD_LOCAL_NAME, null, xmlWriter); writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter); xmlWriter.writeEndElement(); } } xmlWriter.writeEndElement(); } private void writeStartElement(java.lang.String namespace, java.lang.String localPart, java.lang.String prefix, MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException { if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, localPart); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, localPart, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(localPart); } } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace, attName, attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object */ public XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws ADBException { return null; } /** * Factory class that keeps the parse method */ public static class Factory { /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Array parse(XMLStreamReader reader, Class mapperClass) throws Exception { Array object = new Array(); int event; java.lang.String nillableValue = null; java.lang.String prefix = ""; java.lang.String namespaceuri = ""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { // java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", // "type"); // if (fullTypeName != null) { // java.lang.String nsPrefix = null; // if (fullTypeName.indexOf(":") > -1) { // nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); // } // nsPrefix = nsPrefix == null ? "" : nsPrefix; // // java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); // // if (!"Array".equals(type)) { // //find namespace for the prefix // java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); // return (Array) ExtensionMapper.getTypeObject(nsUri, type, reader); // } // } // } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); // handle attribute "arrayType" java.lang.String attributeType = reader.getAttributeValue("http://schemas.xmlsoap.org/soap/encoding/", "arrayType"); object.setArrayType(ConverterUtil.convertToString(attributeType)); handledAttributes.add("arrayType"); // handle attribute "offset" java.lang.String offset = reader.getAttributeValue("http://schemas.xmlsoap.org/soap/encoding/", "offset"); object.setOffset(ConverterUtil.convertToString(offset)); handledAttributes.add("offset"); // handle attribute "id" java.lang.String id = reader.getAttributeValue(null, "id"); object.setId(ConverterUtil.convertToID(id)); handledAttributes.add("id"); // handle attribute "href" java.lang.String href = reader.getAttributeValue(null, "href"); object.setHref(ConverterUtil.convertToAnyURI(href)); handledAttributes.add("href"); // at the starting point of the child elements reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); javax.xml.namespace.QName arrayElementQName = getInnerElementsQName(attributeType, reader); object.setArrayTypeQName(arrayElementQName); if (reader.isStartElement()) { boolean loopDone = false; while (!loopDone) { if (reader.isStartElement()) { // check whether is object is null or not nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)) { // move the cursor to the end element while (!reader.isEndElement()) reader.next(); object.addObject(null); } else if (arrayElementQName != null){ // i.e this array has same attribute type object.addObject(getObject(arrayElementQName,reader,mapperClass)); } else { // arrayElementQName null means this does not have an arry level // type declaration we have to check for each and every element javax.xml.namespace.QName typeQName = getTypeQName(reader); if (typeQName == null){ typeQName = reader.getName(); } object.addObject(getObject(typeQName,reader,mapperClass)); } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); reader.next(); } else if (reader.isEndElement()) { loopDone = true; } else { reader.next(); } } } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()){ // A start element we are not expecting indicates a trailing invalid property throw new ADBException("Unexpected subelement " + reader.getLocalName()); } } catch (XMLStreamException e) { throw new Exception("Exception while parsing array",e); } return object; } private static Object getObject(javax.xml.namespace.QName qName, XMLStreamReader reader, Class mapperClass) throws Exception { Object returnObject = null; if (qName.getNamespaceURI().equals("http://schemas.xmlsoap.org/soap/encoding/")){ returnObject = ExtensionMapper.getTypeObject( qName.getNamespaceURI(), qName.getLocalPart(), reader); } else if (qName.getNamespaceURI().equals("http://www.w3.org/2001/XMLSchema")){ returnObject = org.apache.axis2.databinding.types.xsd.ExtensionMapper.getTypeObject( qName.getNamespaceURI(), qName.getLocalPart(), reader); } else { // this could be a general one of have to call for the system Extension mapper // invoking the mapperclass using reflection Method getObjectMethod = mapperClass.getMethod("getTypeObject", new Class[]{java.lang.String.class, java.lang.String.class, XMLStreamReader.class}); returnObject = getObjectMethod.invoke(null, new Object[]{qName.getNamespaceURI(), qName.getLocalPart(), reader}); } return returnObject; } private static javax.xml.namespace.QName getInnerElementsQName( java.lang.String attributeType, XMLStreamReader reader){ // attribute type is similar to xsd:ur-type[4] javax.xml.namespace.QName typeQName = null; java.lang.String prefix = ""; java.lang.String type = attributeType; if (attributeType.indexOf(":") > -1){ prefix = attributeType.substring(0,attributeType.indexOf(":")); type = attributeType.substring(attributeType.indexOf(":") + 1); } java.lang.String namespace = reader.getNamespaceURI(prefix); type = type.substring(0,type.indexOf("[")); if (!type.equals("ur-type")){ typeQName = new javax.xml.namespace.QName(namespace,type); } return typeQName; } private static javax.xml.namespace.QName getTypeQName(XMLStreamReader reader) { javax.xml.namespace.QName typeQName = null; if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName != null) { java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1) { nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); } nsPrefix = nsPrefix == null ? "" : nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); typeQName = new javax.xml.namespace.QName(reader.getNamespaceURI(nsPrefix), type); } } return typeQName; } } } ./src/org/apache/axis2/databinding/types/soapencoding/NMTOKENS.java0000664000175000017500000005230211767656530024216 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NMTOKENS.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NMTOKENS bean class */ public class NMTOKENS implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NMTOKENS Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NMTOKENS */ protected org.apache.axis2.databinding.types.NMTokens localNMTOKENS ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NMTokens */ public org.apache.axis2.databinding.types.NMTokens getNMTOKENS(){ return localNMTOKENS; } /** * Auto generated setter method * @param param NMTOKENS */ public void setNMTOKENS(org.apache.axis2.databinding.types.NMTokens param){ this.localNMTOKENS=param; } public java.lang.String toString(){ return localNMTOKENS.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NMTOKENS.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NMTOKENS", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NMTOKENS", xmlWriter); } } if (localNMTOKENS==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NMTOKENS cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKENS)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNMTOKENS != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKENS)); } else { throw new org.apache.axis2.databinding.ADBException("NMTOKENS cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NMTOKENS fromString(java.lang.String value, java.lang.String namespaceURI){ NMTOKENS returnValue = new NMTOKENS(); returnValue.setNMTOKENS( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKENS(value)); return returnValue; } public static NMTOKENS fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NMTOKENS.Factory.fromString(content,namespaceUri); } else { return NMTOKENS.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NMTOKENS parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NMTOKENS object = new NMTOKENS(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NMTOKENS".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NMTOKENS)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNMTOKENS( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKENS(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/UnsignedLong.java0000664000175000017500000005254211767656530025362 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedLong.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * UnsignedLong bean class */ public class UnsignedLong implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedLong Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedLong */ protected org.apache.axis2.databinding.types.UnsignedLong localUnsignedLong ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedLong */ public org.apache.axis2.databinding.types.UnsignedLong getUnsignedLong(){ return localUnsignedLong; } /** * Auto generated setter method * @param param UnsignedLong */ public void setUnsignedLong(org.apache.axis2.databinding.types.UnsignedLong param){ this.localUnsignedLong=param; } public java.lang.String toString(){ return localUnsignedLong.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedLong.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedLong", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedLong", xmlWriter); } } if (localUnsignedLong==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedLong cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedLong)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedLong != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedLong)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedLong cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedLong fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedLong returnValue = new UnsignedLong(); returnValue.setUnsignedLong( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedLong(value)); return returnValue; } public static UnsignedLong fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedLong.Factory.fromString(content,namespaceUri); } else { return UnsignedLong.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedLong parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedLong object = new UnsignedLong(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedLong".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedLong)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedLong( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedLong(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_short.java0000664000175000017500000005113111767656530024255 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _short.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _short bean class */ public class _short implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = short Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _short */ protected short local_short ; /** * Auto generated getter method * @return short */ public short get_short(){ return local_short; } /** * Auto generated setter method * @param param _short */ public void set_short(short param){ this.local_short=param; } public java.lang.String toString(){ return local_short + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _short.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":short", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "short", xmlWriter); } } if (local_short==java.lang.Short.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("short cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_short)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_short)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _short fromString(java.lang.String value, java.lang.String namespaceURI){ _short returnValue = new _short(); returnValue.set_short( org.apache.axis2.databinding.utils.ConverterUtil.convertToShort(value)); return returnValue; } public static _short fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _short.Factory.fromString(content,namespaceUri); } else { return _short.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _short parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _short object = new _short(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"short".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_short)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_short( org.apache.axis2.databinding.utils.ConverterUtil.convertToShort(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ArrayE.java0000664000175000017500000003661511767656530024154 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ArrayE.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ArrayE bean class */ public class ArrayE implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://schemas.xmlsoap.org/soap/encoding/", "Array", "SOAP-ENC"); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Array */ protected org.apache.axis2.databinding.types.soapencoding.Array localArray ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.soapencoding.Array */ public org.apache.axis2.databinding.types.soapencoding.Array getArray(){ return localArray; } /** * Auto generated setter method * @param param Array */ public void setArray(org.apache.axis2.databinding.types.soapencoding.Array param){ this.localArray=param; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ArrayE.this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it if (localArray==null){ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!"); } localArray.serialize(MY_QNAME,factory,xmlWriter); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return localArray.getPullParser(MY_QNAME); } /** * Factory class that keeps the parse method */ public static class Factory{ /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ArrayE parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ArrayE object = new ArrayE(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() ){ if (reader.isStartElement() && new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/","Array").equals(reader.getName())){ object.setArray(org.apache.axis2.databinding.types.soapencoding.Array.Factory.parse(reader, ExtensionMapper.class)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/HexBinary.java0000664000175000017500000005235211767656530024656 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * HexBinary.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * HexBinary bean class */ public class HexBinary implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = hexBinary Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for HexBinary */ protected org.apache.axis2.databinding.types.HexBinary localHexBinary ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.HexBinary */ public org.apache.axis2.databinding.types.HexBinary getHexBinary(){ return localHexBinary; } /** * Auto generated setter method * @param param HexBinary */ public void setHexBinary(org.apache.axis2.databinding.types.HexBinary param){ this.localHexBinary=param; } public java.lang.String toString(){ return localHexBinary.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { HexBinary.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":hexBinary", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "hexBinary", xmlWriter); } } if (localHexBinary==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("hexBinary cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHexBinary)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localHexBinary != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHexBinary)); } else { throw new org.apache.axis2.databinding.ADBException("hexBinary cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static HexBinary fromString(java.lang.String value, java.lang.String namespaceURI){ HexBinary returnValue = new HexBinary(); returnValue.setHexBinary( org.apache.axis2.databinding.utils.ConverterUtil.convertToHexBinary(value)); return returnValue; } public static HexBinary fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return HexBinary.Factory.fromString(content,namespaceUri); } else { return HexBinary.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static HexBinary parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ HexBinary object = new HexBinary(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"hexBinary".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (HexBinary)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setHexBinary( org.apache.axis2.databinding.utils.ConverterUtil.convertToHexBinary(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Name.java0000664000175000017500000005204211767656530023641 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Name.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Name bean class */ public class Name implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = Name Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Name */ protected org.apache.axis2.databinding.types.Name localName ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Name */ public org.apache.axis2.databinding.types.Name getName(){ return localName; } /** * Auto generated setter method * @param param Name */ public void setName(org.apache.axis2.databinding.types.Name param){ this.localName=param; } public java.lang.String toString(){ return localName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Name.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":Name", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "Name", xmlWriter); } } if (localName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("Name cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName)); } else { throw new org.apache.axis2.databinding.ADBException("Name cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Name fromString(java.lang.String value, java.lang.String namespaceURI){ Name returnValue = new Name(); returnValue.setName( org.apache.axis2.databinding.utils.ConverterUtil.convertToName(value)); return returnValue; } public static Name fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Name.Factory.fromString(content,namespaceUri); } else { return Name.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Name parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Name object = new Name(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"Name".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Name)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setName( org.apache.axis2.databinding.utils.ConverterUtil.convertToName(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/DateTime.java0000664000175000017500000005213611767656530024461 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * DateTime.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * DateTime bean class */ public class DateTime implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = dateTime Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for DateTime */ protected java.util.Calendar localDateTime ; /** * Auto generated getter method * @return java.util.Calendar */ public java.util.Calendar getDateTime(){ return localDateTime; } /** * Auto generated setter method * @param param DateTime */ public void setDateTime(java.util.Calendar param){ this.localDateTime=param; } public java.lang.String toString(){ return localDateTime.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { DateTime.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":dateTime", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "dateTime", xmlWriter); } } if (localDateTime==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("dateTime cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateTime)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDateTime != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateTime)); } else { throw new org.apache.axis2.databinding.ADBException("dateTime cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static DateTime fromString(java.lang.String value, java.lang.String namespaceURI){ DateTime returnValue = new DateTime(); returnValue.setDateTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(value)); return returnValue; } public static DateTime fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return DateTime.Factory.fromString(content,namespaceUri); } else { return DateTime.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static DateTime parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ DateTime object = new DateTime(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"dateTime".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (DateTime)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDateTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_byte.java0000664000175000017500000005106211767656530024064 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _byte.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _byte bean class */ public class _byte implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = byte Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _byte */ protected byte local_byte ; /** * Auto generated getter method * @return byte */ public byte get_byte(){ return local_byte; } /** * Auto generated setter method * @param param _byte */ public void set_byte(byte param){ this.local_byte=param; } public java.lang.String toString(){ return local_byte + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _byte.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":byte", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "byte", xmlWriter); } } if (local_byte==java.lang.Byte.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("byte cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_byte)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_byte)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _byte fromString(java.lang.String value, java.lang.String namespaceURI){ _byte returnValue = new _byte(); returnValue.set_byte( org.apache.axis2.databinding.utils.ConverterUtil.convertToByte(value)); return returnValue; } public static _byte fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _byte.Factory.fromString(content,namespaceUri); } else { return _byte.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _byte parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _byte object = new _byte(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"byte".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_byte)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_byte( org.apache.axis2.databinding.utils.ConverterUtil.convertToByte(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/String.java0000664000175000017500000005171411767656530024234 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * String.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * String bean class */ public class String implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = string Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for String */ protected java.lang.String localString ; /** * Auto generated getter method * @return java.lang.String */ public java.lang.String getString(){ return localString; } /** * Auto generated setter method * @param param String */ public void setString(java.lang.String param){ this.localString=param; } public java.lang.String toString(){ return localString.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { String.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":string", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "string", xmlWriter); } } if (localString==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("string cannot be null!!"); }else{ xmlWriter.writeCharacters(localString); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localString != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localString)); } else { throw new org.apache.axis2.databinding.ADBException("string cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static String fromString(java.lang.String value, java.lang.String namespaceURI){ String returnValue = new String(); returnValue.setString( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(value)); return returnValue; } public static String fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return String.Factory.fromString(content,namespaceUri); } else { return String.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static String parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ String object = new String(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"string".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (String)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setString( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/GMonthDay.java0000664000175000017500000005234611767656530024622 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GMonthDay.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * GMonthDay bean class */ public class GMonthDay implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gMonthDay Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GMonthDay */ protected org.apache.axis2.databinding.types.MonthDay localGMonthDay ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.MonthDay */ public org.apache.axis2.databinding.types.MonthDay getGMonthDay(){ return localGMonthDay; } /** * Auto generated setter method * @param param GMonthDay */ public void setGMonthDay(org.apache.axis2.databinding.types.MonthDay param){ this.localGMonthDay=param; } public java.lang.String toString(){ return localGMonthDay.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GMonthDay.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gMonthDay", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gMonthDay", xmlWriter); } } if (localGMonthDay==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gMonthDay cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonthDay)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGMonthDay != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonthDay)); } else { throw new org.apache.axis2.databinding.ADBException("gMonthDay cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GMonthDay fromString(java.lang.String value, java.lang.String namespaceURI){ GMonthDay returnValue = new GMonthDay(); returnValue.setGMonthDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonthDay(value)); return returnValue; } public static GMonthDay fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GMonthDay.Factory.fromString(content,namespaceUri); } else { return GMonthDay.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GMonthDay parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GMonthDay object = new GMonthDay(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gMonthDay".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GMonthDay)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGMonthDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonthDay(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_boolean.java0000664000175000017500000005120211767656530024534 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _boolean.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _boolean bean class */ public class _boolean implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = boolean Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _boolean */ protected boolean local_boolean ; /** * Auto generated getter method * @return boolean */ public boolean get_boolean(){ return local_boolean; } /** * Auto generated setter method * @param param _boolean */ public void set_boolean(boolean param){ this.local_boolean=param; } public java.lang.String toString(){ return local_boolean + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _boolean.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":boolean", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "boolean", xmlWriter); } } if (false) { throw new org.apache.axis2.databinding.ADBException("boolean cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_boolean)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_boolean)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _boolean fromString(java.lang.String value, java.lang.String namespaceURI){ _boolean returnValue = new _boolean(); returnValue.set_boolean( org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(value)); return returnValue; } public static _boolean fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _boolean.Factory.fromString(content,namespaceUri); } else { return _boolean.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _boolean parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _boolean object = new _boolean(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"boolean".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_boolean)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_boolean( org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NOTATION.java0000664000175000017500000005275511767656530024227 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NOTATION.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NOTATION bean class */ public class NOTATION implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NOTATION Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for QName */ protected javax.xml.namespace.QName localQName ; /** * Auto generated getter method * @return javax.xml.namespace.QName */ public javax.xml.namespace.QName getQName(){ return localQName; } /** * Auto generated setter method * @param param QName */ public void setQName(javax.xml.namespace.QName param){ this.localQName=param; } public java.lang.String toString(){ return localQName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NOTATION.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NOTATION", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NOTATION", xmlWriter); } } if (localQName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); }else{ writeQName(localQName,xmlWriter); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localQName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localQName)); } else { throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NOTATION fromString(java.lang.String value, java.lang.String namespaceURI){ NOTATION returnValue = new NOTATION(); returnValue.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(value,namespaceURI)); return returnValue; } public static NOTATION fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NOTATION.Factory.fromString(content,namespaceUri); } else { return NOTATION.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NOTATION parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NOTATION object = new NOTATION(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NOTATION".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NOTATION)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); if(index > 0){ prefix = content.substring(0,index); } else { prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); object.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/QName.java0000664000175000017500000005266711767656530023777 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * QName.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * QName bean class */ public class QName implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = QName Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for QName */ protected javax.xml.namespace.QName localQName ; /** * Auto generated getter method * @return javax.xml.namespace.QName */ public javax.xml.namespace.QName getQName(){ return localQName; } /** * Auto generated setter method * @param param QName */ public void setQName(javax.xml.namespace.QName param){ this.localQName=param; } public java.lang.String toString(){ return localQName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { QName.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":QName", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "QName", xmlWriter); } } if (localQName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); }else{ writeQName(localQName,xmlWriter); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localQName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localQName)); } else { throw new org.apache.axis2.databinding.ADBException("QName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static QName fromString(java.lang.String value, java.lang.String namespaceURI){ QName returnValue = new QName(); returnValue.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(value,namespaceURI)); return returnValue; } public static QName fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return QName.Factory.fromString(content,namespaceUri); } else { return QName.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static QName parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ QName object = new QName(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"QName".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (QName)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); if(index > 0){ prefix = content.substring(0,index); } else { prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); object.setQName( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/PositiveInteger.java0000664000175000017500000005273211767656530026107 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * PositiveInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * PositiveInteger bean class */ public class PositiveInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = positiveInteger Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for PositiveInteger */ protected org.apache.axis2.databinding.types.PositiveInteger localPositiveInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.PositiveInteger */ public org.apache.axis2.databinding.types.PositiveInteger getPositiveInteger(){ return localPositiveInteger; } /** * Auto generated setter method * @param param PositiveInteger */ public void setPositiveInteger(org.apache.axis2.databinding.types.PositiveInteger param){ this.localPositiveInteger=param; } public java.lang.String toString(){ return localPositiveInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { PositiveInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":positiveInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "positiveInteger", xmlWriter); } } if (localPositiveInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("positiveInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPositiveInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localPositiveInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPositiveInteger)); } else { throw new org.apache.axis2.databinding.ADBException("positiveInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static PositiveInteger fromString(java.lang.String value, java.lang.String namespaceURI){ PositiveInteger returnValue = new PositiveInteger(); returnValue.setPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToPositiveInteger(value)); return returnValue; } public static PositiveInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return PositiveInteger.Factory.fromString(content,namespaceUri); } else { return PositiveInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static PositiveInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ PositiveInteger object = new PositiveInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"positiveInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (PositiveInteger)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToPositiveInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Base64Binary.java0000664000175000017500000005420511767656530025155 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Base64Binary.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Base64Binary bean class */ public class Base64Binary implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = base64Binary Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Base64Binary */ protected javax.activation.DataHandler localBase64Binary ; /** * Auto generated getter method * @return javax.activation.DataHandler */ public javax.activation.DataHandler getBase64Binary(){ return localBase64Binary; } /** * Auto generated setter method * @param param Base64Binary */ public void setBase64Binary(javax.activation.DataHandler param){ this.localBase64Binary=param; } public java.lang.String toString(){ return localBase64Binary.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Base64Binary.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":base64Binary", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "base64Binary", xmlWriter); } } if (localBase64Binary!=null) { xmlWriter.writeDataHandler(localBase64Binary); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add(localBase64Binary); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Base64Binary fromString(java.lang.String value, java.lang.String namespaceURI){ Base64Binary returnValue = new Base64Binary(); returnValue.setBase64Binary( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(value)); return returnValue; } public static Base64Binary fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Base64Binary.Factory.fromString(content,namespaceUri); } else { return Base64Binary.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Base64Binary parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Base64Binary object = new Base64Binary(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"base64Binary".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Base64Binary)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object object.setBase64Binary( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); object.setBase64Binary(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.setBase64Binary( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); } } reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ID.java0000664000175000017500000005172211767656530023261 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ID.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ID bean class */ public class ID implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ID Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ID */ protected org.apache.axis2.databinding.types.Id localID ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Id */ public org.apache.axis2.databinding.types.Id getID(){ return localID; } /** * Auto generated setter method * @param param ID */ public void setID(org.apache.axis2.databinding.types.Id param){ this.localID=param; } public java.lang.String toString(){ return localID.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ID.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ID", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ID", xmlWriter); } } if (localID==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ID cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localID)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localID != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localID)); } else { throw new org.apache.axis2.databinding.ADBException("ID cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ID fromString(java.lang.String value, java.lang.String namespaceURI){ ID returnValue = new ID(); returnValue.setID( org.apache.axis2.databinding.utils.ConverterUtil.convertToID(value)); return returnValue; } public static ID fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ID.Factory.fromString(content,namespaceUri); } else { return ID.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ID parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ID object = new ID(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ID".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ID)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setID( org.apache.axis2.databinding.utils.ConverterUtil.convertToID(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NonPositiveInteger.java0000664000175000017500000005312211767656530026554 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NonPositiveInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NonPositiveInteger bean class */ public class NonPositiveInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = nonPositiveInteger Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NonPositiveInteger */ protected org.apache.axis2.databinding.types.NonPositiveInteger localNonPositiveInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NonPositiveInteger */ public org.apache.axis2.databinding.types.NonPositiveInteger getNonPositiveInteger(){ return localNonPositiveInteger; } /** * Auto generated setter method * @param param NonPositiveInteger */ public void setNonPositiveInteger(org.apache.axis2.databinding.types.NonPositiveInteger param){ this.localNonPositiveInteger=param; } public java.lang.String toString(){ return localNonPositiveInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NonPositiveInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":nonPositiveInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "nonPositiveInteger", xmlWriter); } } if (localNonPositiveInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("nonPositiveInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonPositiveInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNonPositiveInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonPositiveInteger)); } else { throw new org.apache.axis2.databinding.ADBException("nonPositiveInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NonPositiveInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NonPositiveInteger returnValue = new NonPositiveInteger(); returnValue.setNonPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonPositiveInteger(value)); return returnValue; } public static NonPositiveInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NonPositiveInteger.Factory.fromString(content,namespaceUri); } else { return NonPositiveInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NonPositiveInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NonPositiveInteger object = new NonPositiveInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"nonPositiveInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NonPositiveInteger)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNonPositiveInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonPositiveInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ENTITIES.java0000664000175000017500000005230211767656530024204 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ENTITIES.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ENTITIES bean class */ public class ENTITIES implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ENTITIES Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ENTITIES */ protected org.apache.axis2.databinding.types.Entities localENTITIES ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Entities */ public org.apache.axis2.databinding.types.Entities getENTITIES(){ return localENTITIES; } /** * Auto generated setter method * @param param ENTITIES */ public void setENTITIES(org.apache.axis2.databinding.types.Entities param){ this.localENTITIES=param; } public java.lang.String toString(){ return localENTITIES.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ENTITIES.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ENTITIES", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ENTITIES", xmlWriter); } } if (localENTITIES==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ENTITIES cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITIES)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localENTITIES != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITIES)); } else { throw new org.apache.axis2.databinding.ADBException("ENTITIES cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ENTITIES fromString(java.lang.String value, java.lang.String namespaceURI){ ENTITIES returnValue = new ENTITIES(); returnValue.setENTITIES( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITIES(value)); return returnValue; } public static ENTITIES fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ENTITIES.Factory.fromString(content,namespaceUri); } else { return ENTITIES.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ENTITIES parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ENTITIES object = new ENTITIES(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ENTITIES".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ENTITIES)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setENTITIES( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITIES(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ArrayCoordinate.java0000664000175000017500000004726611767656530026063 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ArrayCoordinate.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ArrayCoordinate bean class */ public class ArrayCoordinate implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://schemas.xmlsoap.org/soap/encoding/", "arrayCoordinate", "ns1"); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ArrayCoordinate */ protected java.lang.String localArrayCoordinate ; /** * Auto generated getter method * @return java.lang.String */ public java.lang.String getArrayCoordinate(){ return localArrayCoordinate; } /** * Auto generated setter method * @param param ArrayCoordinate */ public void setArrayCoordinate(java.lang.String param){ this.localArrayCoordinate=param; } public java.lang.String toString(){ return localArrayCoordinate.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ArrayCoordinate.this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":arrayCoordinate", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "arrayCoordinate", xmlWriter); } } if (localArrayCoordinate==null){ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ xmlWriter.writeCharacters(localArrayCoordinate); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localArrayCoordinate) }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ArrayCoordinate fromString(java.lang.String value, java.lang.String namespaceURI){ ArrayCoordinate returnValue = new ArrayCoordinate(); returnValue.setArrayCoordinate( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(value)); return returnValue; } public static ArrayCoordinate fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ArrayCoordinate.Factory.fromString(content,namespaceUri); } else { return ArrayCoordinate.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ArrayCoordinate parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ArrayCoordinate object = new ArrayCoordinate(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setArrayCoordinate( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Decimal.java0000664000175000017500000005210211767656530024314 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Decimal.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Decimal bean class */ public class Decimal implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = decimal Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Decimal */ protected java.math.BigDecimal localDecimal ; /** * Auto generated getter method * @return java.math.BigDecimal */ public java.math.BigDecimal getDecimal(){ return localDecimal; } /** * Auto generated setter method * @param param Decimal */ public void setDecimal(java.math.BigDecimal param){ this.localDecimal=param; } public java.lang.String toString(){ return localDecimal.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Decimal.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":decimal", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "decimal", xmlWriter); } } if (localDecimal==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("decimal cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDecimal)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDecimal != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDecimal)); } else { throw new org.apache.axis2.databinding.ADBException("decimal cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Decimal fromString(java.lang.String value, java.lang.String namespaceURI){ Decimal returnValue = new Decimal(); returnValue.setDecimal( org.apache.axis2.databinding.utils.ConverterUtil.convertToDecimal(value)); return returnValue; } public static Decimal fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Decimal.Factory.fromString(content,namespaceUri); } else { return Decimal.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Decimal parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Decimal object = new Decimal(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"decimal".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Decimal)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDecimal( org.apache.axis2.databinding.utils.ConverterUtil.convertToDecimal(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Token.java0000664000175000017500000005211211767656530024037 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Token.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Token bean class */ public class Token implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = token Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Token */ protected org.apache.axis2.databinding.types.Token localToken ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Token */ public org.apache.axis2.databinding.types.Token getToken(){ return localToken; } /** * Auto generated setter method * @param param Token */ public void setToken(org.apache.axis2.databinding.types.Token param){ this.localToken=param; } public java.lang.String toString(){ return localToken.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Token.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":token", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "token", xmlWriter); } } if (localToken==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("token cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localToken)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localToken != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localToken)); } else { throw new org.apache.axis2.databinding.ADBException("token cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Token fromString(java.lang.String value, java.lang.String namespaceURI){ Token returnValue = new Token(); returnValue.setToken( org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(value)); return returnValue; } public static Token fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Token.Factory.fromString(content,namespaceUri); } else { return Token.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Token parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Token object = new Token(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"token".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Token)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setToken( org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NonNegativeInteger.java0000664000175000017500000005312211767656530026514 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NonNegativeInteger.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NonNegativeInteger bean class */ public class NonNegativeInteger implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = nonNegativeInteger Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NonNegativeInteger */ protected org.apache.axis2.databinding.types.NonNegativeInteger localNonNegativeInteger ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NonNegativeInteger */ public org.apache.axis2.databinding.types.NonNegativeInteger getNonNegativeInteger(){ return localNonNegativeInteger; } /** * Auto generated setter method * @param param NonNegativeInteger */ public void setNonNegativeInteger(org.apache.axis2.databinding.types.NonNegativeInteger param){ this.localNonNegativeInteger=param; } public java.lang.String toString(){ return localNonNegativeInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NonNegativeInteger.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":nonNegativeInteger", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "nonNegativeInteger", xmlWriter); } } if (localNonNegativeInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("nonNegativeInteger cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonNegativeInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNonNegativeInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNonNegativeInteger)); } else { throw new org.apache.axis2.databinding.ADBException("nonNegativeInteger cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NonNegativeInteger fromString(java.lang.String value, java.lang.String namespaceURI){ NonNegativeInteger returnValue = new NonNegativeInteger(); returnValue.setNonNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(value)); return returnValue; } public static NonNegativeInteger fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NonNegativeInteger.Factory.fromString(content,namespaceUri); } else { return NonNegativeInteger.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NonNegativeInteger parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NonNegativeInteger object = new NonNegativeInteger(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"nonNegativeInteger".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NonNegativeInteger)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNonNegativeInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ENTITY.java0000664000175000017500000005216211767656530024000 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ENTITY.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ENTITY bean class */ public class ENTITY implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = ENTITY Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ENTITY */ protected org.apache.axis2.databinding.types.Entity localENTITY ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Entity */ public org.apache.axis2.databinding.types.Entity getENTITY(){ return localENTITY; } /** * Auto generated setter method * @param param ENTITY */ public void setENTITY(org.apache.axis2.databinding.types.Entity param){ this.localENTITY=param; } public java.lang.String toString(){ return localENTITY.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { ENTITY.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":ENTITY", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "ENTITY", xmlWriter); } } if (localENTITY==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("ENTITY cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITY)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localENTITY != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localENTITY)); } else { throw new org.apache.axis2.databinding.ADBException("ENTITY cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static ENTITY fromString(java.lang.String value, java.lang.String namespaceURI){ ENTITY returnValue = new ENTITY(); returnValue.setENTITY( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITY(value)); return returnValue; } public static ENTITY fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return ENTITY.Factory.fromString(content,namespaceUri); } else { return ENTITY.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static ENTITY parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ ENTITY object = new ENTITY(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ENTITY".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (ENTITY)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setENTITY( org.apache.axis2.databinding.utils.ConverterUtil.convertToENTITY(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/AnyType.java0000664000175000017500000004501311767656530024352 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * AnyType.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * AnyType bean class */ public class AnyType implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://schemas.xmlsoap.org/soap/encoding/", "anyType", "SOAP-ENC"); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for AnyType */ protected org.apache.axiom.om.OMElement localAnyType ; /** * Auto generated getter method * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getAnyType(){ return localAnyType; } /** * Auto generated setter method * @param param AnyType */ public void setAnyType(org.apache.axiom.om.OMElement param){ this.localAnyType=param; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { AnyType.this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it java.lang.String namespace = "http://schemas.xmlsoap.org/soap/encoding/"; java.lang.String localName = "anyType"; if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":anyType", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "anyType", xmlWriter); } } if (localAnyType==null){ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ localAnyType.serialize(xmlWriter); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localAnyType) }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static AnyType parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ AnyType object = new AnyType(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() ){ if (reader.isStartElement()){ //use the QName from the parser as the name for the builder javax.xml.namespace.QName startQname1 = reader.getName(); // We need to wrap the reader so that it produces a fake START_DOCUMENT event // this is needed by the builder classes org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader),startQname1); object.setAnyType(builder1.getOMElement()); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NCName.java0000664000175000017500000005216211767656530024065 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NCName.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NCName bean class */ public class NCName implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NCName Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NCName */ protected org.apache.axis2.databinding.types.NCName localNCName ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NCName */ public org.apache.axis2.databinding.types.NCName getNCName(){ return localNCName; } /** * Auto generated setter method * @param param NCName */ public void setNCName(org.apache.axis2.databinding.types.NCName param){ this.localNCName=param; } public java.lang.String toString(){ return localNCName.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NCName.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NCName", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NCName", xmlWriter); } } if (localNCName==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NCName cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNCName)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNCName != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNCName)); } else { throw new org.apache.axis2.databinding.ADBException("NCName cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NCName fromString(java.lang.String value, java.lang.String namespaceURI){ NCName returnValue = new NCName(); returnValue.setNCName( org.apache.axis2.databinding.utils.ConverterUtil.convertToNCName(value)); return returnValue; } public static NCName fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NCName.Factory.fromString(content,namespaceUri); } else { return NCName.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NCName parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NCName object = new NCName(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NCName".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NCName)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNCName( org.apache.axis2.databinding.utils.ConverterUtil.convertToNCName(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Language.java0000664000175000017500000005230211767656530024503 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Language.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Language bean class */ public class Language implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = language Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Language */ protected org.apache.axis2.databinding.types.Language localLanguage ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Language */ public org.apache.axis2.databinding.types.Language getLanguage(){ return localLanguage; } /** * Auto generated setter method * @param param Language */ public void setLanguage(org.apache.axis2.databinding.types.Language param){ this.localLanguage=param; } public java.lang.String toString(){ return localLanguage.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Language.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":language", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "language", xmlWriter); } } if (localLanguage==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("language cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localLanguage)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localLanguage != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localLanguage)); } else { throw new org.apache.axis2.databinding.ADBException("language cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Language fromString(java.lang.String value, java.lang.String namespaceURI){ Language returnValue = new Language(); returnValue.setLanguage( org.apache.axis2.databinding.utils.ConverterUtil.convertToLanguage(value)); return returnValue; } public static Language fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Language.Factory.fromString(content,namespaceUri); } else { return Language.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Language parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Language object = new Language(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"language".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Language)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setLanguage( org.apache.axis2.databinding.utils.ConverterUtil.convertToLanguage(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Duration.java0000664000175000017500000005230211767656530024545 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Duration.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Duration bean class */ public class Duration implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = duration Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Duration */ protected org.apache.axis2.databinding.types.Duration localDuration ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Duration */ public org.apache.axis2.databinding.types.Duration getDuration(){ return localDuration; } /** * Auto generated setter method * @param param Duration */ public void setDuration(org.apache.axis2.databinding.types.Duration param){ this.localDuration=param; } public java.lang.String toString(){ return localDuration.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Duration.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":duration", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "duration", xmlWriter); } } if (localDuration==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("duration cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDuration)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDuration != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDuration)); } else { throw new org.apache.axis2.databinding.ADBException("duration cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Duration fromString(java.lang.String value, java.lang.String namespaceURI){ Duration returnValue = new Duration(); returnValue.setDuration( org.apache.axis2.databinding.utils.ConverterUtil.convertToDuration(value)); return returnValue; } public static Duration fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Duration.Factory.fromString(content,namespaceUri); } else { return Duration.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Duration parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Duration object = new Duration(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"duration".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Duration)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDuration( org.apache.axis2.databinding.utils.ConverterUtil.convertToDuration(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Base64.java0000664000175000017500000004706411767656530024015 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Base64.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Base64 bean class */ public class Base64 implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://schemas.xmlsoap.org/soap/encoding/", "base64", "SOAP-ENC"); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Base64 */ protected javax.activation.DataHandler localBase64 ; /** * Auto generated getter method * @return javax.activation.DataHandler */ public javax.activation.DataHandler getBase64(){ return localBase64; } /** * Auto generated setter method * @param param Base64 */ public void setBase64(javax.activation.DataHandler param){ this.localBase64=param; } public java.lang.String toString(){ return localBase64.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Base64.this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":base64", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "base64", xmlWriter); } } if (localBase64==null){ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localBase64)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localBase64) }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Base64 fromString(java.lang.String value, java.lang.String namespaceURI){ Base64 returnValue = new Base64(); returnValue.setBase64( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(value)); return returnValue; } public static Base64 fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Base64.Factory.fromString(content,namespaceUri); } else { return Base64.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Base64 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Base64 object = new Base64(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setBase64( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_int.java0000664000175000017500000004175111767656530023717 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _int.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _int bean class */ public class _int implements org.apache.axis2.databinding.ADBBean { /* This type was generated from the piece of schema that had name = int Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if (namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")) { return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _int */ protected int local_int; /** * Auto generated getter method * * @return int */ public int get_int() { return local_int; } /** * Auto generated setter method * * @param param _int */ public void set_int(int param) { this.local_int = param; } public java.lang.String toString() { return local_int + ""; } /** * isReaderMTOMAware * * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try { isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); } catch (java.lang.IllegalArgumentException e) { isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException { org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, parentQName) { public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _int.this.serialize(parentQName, factory, xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName, factory, dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { serialize(parentQName, factory, xmlWriter, false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType) { java.lang.String namespacePrefix = registerPrefix(xmlWriter, "http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":int", xmlWriter); } else { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "int", xmlWriter); } } if (local_int == java.lang.Integer.MIN_VALUE) { throw new org.apache.axis2.databinding.ADBException("int cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_int)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace, attName, attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_int)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory { public static _int fromString(java.lang.String value, java.lang.String namespaceURI) { _int returnValue = new _int(); returnValue.set_int( org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(value)); return returnValue; } public static _int fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1) { java.lang.String prefix = content.substring(0, content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _int.Factory.fromString(content, namespaceUri); } else { return _int.Factory.fromString(content, ""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _int parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { _int object = new _int(); int event; java.lang.String nillableValue = null; java.lang.String prefix = ""; java.lang.String namespaceuri = ""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName != null) { java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1) { nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); } nsPrefix = nsPrefix == null ? "" : nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); if (!"int".equals(type)) { //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_int) org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri, type, reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while (!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()) { if (reader.isStartElement() || reader.hasText()) { java.lang.String content = reader.getElementText(); object.set_int( org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(content)); } // End of if for expected property start element else { // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/GDay.java0000664000175000017500000005203611767656530023610 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GDay.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * GDay bean class */ public class GDay implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gDay Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GDay */ protected org.apache.axis2.databinding.types.Day localGDay ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Day */ public org.apache.axis2.databinding.types.Day getGDay(){ return localGDay; } /** * Auto generated setter method * @param param GDay */ public void setGDay(org.apache.axis2.databinding.types.Day param){ this.localGDay=param; } public java.lang.String toString(){ return localGDay.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GDay.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gDay", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gDay", xmlWriter); } } if (localGDay==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gDay cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGDay)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGDay != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGDay)); } else { throw new org.apache.axis2.databinding.ADBException("gDay cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GDay fromString(java.lang.String value, java.lang.String namespaceURI){ GDay returnValue = new GDay(); returnValue.setGDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGDay(value)); return returnValue; } public static GDay fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GDay.Factory.fromString(content,namespaceUri); } else { return GDay.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GDay parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GDay object = new GDay(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gDay".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GDay)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGDay( org.apache.axis2.databinding.utils.ConverterUtil.convertToGDay(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Time.java0000664000175000017500000005204211767656530023657 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Time.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Time bean class */ public class Time implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = time Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Time */ protected org.apache.axis2.databinding.types.Time localTime ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Time */ public org.apache.axis2.databinding.types.Time getTime(){ return localTime; } /** * Auto generated setter method * @param param Time */ public void setTime(org.apache.axis2.databinding.types.Time param){ this.localTime=param; } public java.lang.String toString(){ return localTime.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Time.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":time", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "time", xmlWriter); } } if (localTime==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("time cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localTime)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localTime != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localTime)); } else { throw new org.apache.axis2.databinding.ADBException("time cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Time fromString(java.lang.String value, java.lang.String namespaceURI){ Time returnValue = new Time(); returnValue.setTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToTime(value)); return returnValue; } public static Time fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Time.Factory.fromString(content,namespaceUri); } else { return Time.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Time parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Time object = new Time(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"time".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Time)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setTime( org.apache.axis2.databinding.utils.ConverterUtil.convertToTime(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NMTOKEN.java0000664000175000017500000005223211767656530024075 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NMTOKEN.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NMTOKEN bean class */ public class NMTOKEN implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = NMTOKEN Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NMTOKEN */ protected org.apache.axis2.databinding.types.NMToken localNMTOKEN ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NMToken */ public org.apache.axis2.databinding.types.NMToken getNMTOKEN(){ return localNMTOKEN; } /** * Auto generated setter method * @param param NMTOKEN */ public void setNMTOKEN(org.apache.axis2.databinding.types.NMToken param){ this.localNMTOKEN=param; } public java.lang.String toString(){ return localNMTOKEN.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NMTOKEN.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":NMTOKEN", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "NMTOKEN", xmlWriter); } } if (localNMTOKEN==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("NMTOKEN cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKEN)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNMTOKEN != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNMTOKEN)); } else { throw new org.apache.axis2.databinding.ADBException("NMTOKEN cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NMTOKEN fromString(java.lang.String value, java.lang.String namespaceURI){ NMTOKEN returnValue = new NMTOKEN(); returnValue.setNMTOKEN( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKEN(value)); return returnValue; } public static NMTOKEN fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NMTOKEN.Factory.fromString(content,namespaceUri); } else { return NMTOKEN.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NMTOKEN parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NMTOKEN object = new NMTOKEN(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"NMTOKEN".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NMTOKEN)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNMTOKEN( org.apache.axis2.databinding.utils.ConverterUtil.convertToNMTOKEN(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Integer.java0000664000175000017500000005210211767656530024353 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Integer.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Integer bean class */ public class Integer implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = integer Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Integer */ protected java.math.BigInteger localInteger ; /** * Auto generated getter method * @return java.math.BigInteger */ public java.math.BigInteger getInteger(){ return localInteger; } /** * Auto generated setter method * @param param Integer */ public void setInteger(java.math.BigInteger param){ this.localInteger=param; } public java.lang.String toString(){ return localInteger.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Integer.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":integer", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "integer", xmlWriter); } } if (localInteger==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("integer cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localInteger)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localInteger != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localInteger)); } else { throw new org.apache.axis2.databinding.ADBException("integer cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Integer fromString(java.lang.String value, java.lang.String namespaceURI){ Integer returnValue = new Integer(); returnValue.setInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToInteger(value)); return returnValue; } public static Integer fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Integer.Factory.fromString(content,namespaceUri); } else { return Integer.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Integer parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Integer object = new Integer(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"integer".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Integer)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setInteger( org.apache.axis2.databinding.utils.ConverterUtil.convertToInteger(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/AnyURI.java0000664000175000017500000005214611767656530024075 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * AnyURI.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * AnyURI bean class */ public class AnyURI implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = anyURI Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for AnyURI */ protected org.apache.axis2.databinding.types.URI localAnyURI ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.URI */ public org.apache.axis2.databinding.types.URI getAnyURI(){ return localAnyURI; } /** * Auto generated setter method * @param param AnyURI */ public void setAnyURI(org.apache.axis2.databinding.types.URI param){ this.localAnyURI=param; } public java.lang.String toString(){ return localAnyURI.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { AnyURI.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":anyURI", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "anyURI", xmlWriter); } } if (localAnyURI==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("anyURI cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localAnyURI)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localAnyURI != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localAnyURI)); } else { throw new org.apache.axis2.databinding.ADBException("anyURI cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static AnyURI fromString(java.lang.String value, java.lang.String namespaceURI){ AnyURI returnValue = new AnyURI(); returnValue.setAnyURI( org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(value)); return returnValue; } public static AnyURI fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return AnyURI.Factory.fromString(content,namespaceUri); } else { return AnyURI.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static AnyURI parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ AnyURI object = new AnyURI(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"anyURI".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (AnyURI)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setAnyURI( org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/IDREF.java0000664000175000017500000005211211767656530023610 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * IDREF.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * IDREF bean class */ public class IDREF implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = IDREF Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for IDREF */ protected org.apache.axis2.databinding.types.IDRef localIDREF ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.IDRef */ public org.apache.axis2.databinding.types.IDRef getIDREF(){ return localIDREF; } /** * Auto generated setter method * @param param IDREF */ public void setIDREF(org.apache.axis2.databinding.types.IDRef param){ this.localIDREF=param; } public java.lang.String toString(){ return localIDREF.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { IDREF.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":IDREF", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "IDREF", xmlWriter); } } if (localIDREF==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("IDREF cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREF)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localIDREF != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREF)); } else { throw new org.apache.axis2.databinding.ADBException("IDREF cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static IDREF fromString(java.lang.String value, java.lang.String namespaceURI){ IDREF returnValue = new IDREF(); returnValue.setIDREF( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREF(value)); return returnValue; } public static IDREF fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return IDREF.Factory.fromString(content,namespaceUri); } else { return IDREF.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static IDREF parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ IDREF object = new IDREF(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"IDREF".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (IDREF)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setIDREF( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREF(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/GMonth.java0000664000175000017500000005215611767656530024163 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GMonth.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * GMonth bean class */ public class GMonth implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gMonth Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GMonth */ protected org.apache.axis2.databinding.types.Month localGMonth ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Month */ public org.apache.axis2.databinding.types.Month getGMonth(){ return localGMonth; } /** * Auto generated setter method * @param param GMonth */ public void setGMonth(org.apache.axis2.databinding.types.Month param){ this.localGMonth=param; } public java.lang.String toString(){ return localGMonth.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GMonth.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gMonth", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gMonth", xmlWriter); } } if (localGMonth==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gMonth cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonth)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGMonth != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGMonth)); } else { throw new org.apache.axis2.databinding.ADBException("gMonth cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GMonth fromString(java.lang.String value, java.lang.String namespaceURI){ GMonth returnValue = new GMonth(); returnValue.setGMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonth(value)); return returnValue; } public static GMonth fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GMonth.Factory.fromString(content,namespaceUri); } else { return GMonth.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GMonth parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GMonth object = new GMonth(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gMonth".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GMonth)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGMonth(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/UnsignedByte.java0000664000175000017500000005254211767656530025366 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedByte.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * UnsignedByte bean class */ public class UnsignedByte implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedByte Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedByte */ protected org.apache.axis2.databinding.types.UnsignedByte localUnsignedByte ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedByte */ public org.apache.axis2.databinding.types.UnsignedByte getUnsignedByte(){ return localUnsignedByte; } /** * Auto generated setter method * @param param UnsignedByte */ public void setUnsignedByte(org.apache.axis2.databinding.types.UnsignedByte param){ this.localUnsignedByte=param; } public java.lang.String toString(){ return localUnsignedByte.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedByte.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedByte", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedByte", xmlWriter); } } if (localUnsignedByte==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedByte cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedByte)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedByte != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedByte)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedByte cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedByte fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedByte returnValue = new UnsignedByte(); returnValue.setUnsignedByte( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedByte(value)); return returnValue; } public static UnsignedByte fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedByte.Factory.fromString(content,namespaceUri); } else { return UnsignedByte.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedByte parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedByte object = new UnsignedByte(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedByte".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedByte)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedByte( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedByte(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/UnsignedShort.java0000664000175000017500000005261211767656530025560 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * UnsignedShort.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * UnsignedShort bean class */ public class UnsignedShort implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = unsignedShort Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for UnsignedShort */ protected org.apache.axis2.databinding.types.UnsignedShort localUnsignedShort ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.UnsignedShort */ public org.apache.axis2.databinding.types.UnsignedShort getUnsignedShort(){ return localUnsignedShort; } /** * Auto generated setter method * @param param UnsignedShort */ public void setUnsignedShort(org.apache.axis2.databinding.types.UnsignedShort param){ this.localUnsignedShort=param; } public java.lang.String toString(){ return localUnsignedShort.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { UnsignedShort.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":unsignedShort", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "unsignedShort", xmlWriter); } } if (localUnsignedShort==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("unsignedShort cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedShort)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localUnsignedShort != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUnsignedShort)); } else { throw new org.apache.axis2.databinding.ADBException("unsignedShort cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static UnsignedShort fromString(java.lang.String value, java.lang.String namespaceURI){ UnsignedShort returnValue = new UnsignedShort(); returnValue.setUnsignedShort( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedShort(value)); return returnValue; } public static UnsignedShort fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return UnsignedShort.Factory.fromString(content,namespaceUri); } else { return UnsignedShort.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UnsignedShort parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UnsignedShort object = new UnsignedShort(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"unsignedShort".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UnsignedShort)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setUnsignedShort( org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedShort(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Struct.java0000664000175000017500000007447611767656530024264 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Struct.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Struct bean class */ public class Struct implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = Struct Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for ExtraElement * This was an Array! */ protected org.apache.axiom.om.OMElement[] localExtraElement ; /* This tracker boolean wil be used to detect whether the user called the set method * for this attribute. It will be used to determine whether to include this field * in the serialized XML */ protected boolean localExtraElementTracker = false ; /** * Auto generated getter method * @return org.apache.axiom.om.OMElement[] */ public org.apache.axiom.om.OMElement[] getExtraElement(){ return localExtraElement; } /** * validate the array for ExtraElement */ protected void validateExtraElement(org.apache.axiom.om.OMElement[] param){ } /** * Auto generated setter method * @param param ExtraElement */ public void setExtraElement(org.apache.axiom.om.OMElement[] param){ validateExtraElement(param); if (param != null){ //update the setting tracker localExtraElementTracker = true; } else { localExtraElementTracker = false; } this.localExtraElement=param; } /** * Auto generated add method for the array for convenience * @param param org.apache.axiom.om.OMElement */ public void addExtraElement(org.apache.axiom.om.OMElement param){ if (localExtraElement == null){ localExtraElement = new org.apache.axiom.om.OMElement[]{}; } //update the setting tracker localExtraElementTracker = true; java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localExtraElement); list.add(param); this.localExtraElement = (org.apache.axiom.om.OMElement[])list.toArray( new org.apache.axiom.om.OMElement[list.size()]); } /** * field for Id * This was an Attribute! */ protected org.apache.axis2.databinding.types.Id localId ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Id */ public org.apache.axis2.databinding.types.Id getId(){ return localId; } /** * Auto generated setter method * @param param Id */ public void setId(org.apache.axis2.databinding.types.Id param){ this.localId=param; } /** * field for Href * This was an Attribute! */ protected org.apache.axis2.databinding.types.URI localHref ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.URI */ public org.apache.axis2.databinding.types.URI getHref(){ return localHref; } /** * Auto generated setter method * @param param Href */ public void setHref(org.apache.axis2.databinding.types.URI param){ this.localHref=param; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Struct.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":Struct", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "Struct", xmlWriter); } } if (localId != null){ writeAttribute("", "id", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localId), xmlWriter); } if (localHref != null){ writeAttribute("", "href", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHref), xmlWriter); } if (localExtraElementTracker){ if (localExtraElement != null){ for (int i = 0;i < localExtraElement.length;i++){ if (localExtraElement[i] != null){ localExtraElement[i].serialize(xmlWriter); } else { // we have to do nothing since minOccures zero } } } else { throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!"); } } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); if (localExtraElementTracker){ if (localExtraElement != null) { for (int i = 0;i < localExtraElement.length;i++){ if (localExtraElement[i] != null){ elementList.add(new javax.xml.namespace.QName("", "extraElement")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localExtraElement[i])); } else { // have to do nothing } } } else { throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!"); } } attribList.add( new javax.xml.namespace.QName("","id")); attribList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localId)); attribList.add( new javax.xml.namespace.QName("","href")); attribList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHref)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Struct parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Struct object = new Struct(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"Struct".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Struct)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); // handle attribute "id" java.lang.String tempAttribId = reader.getAttributeValue(null,"id"); if (tempAttribId!=null){ java.lang.String content = tempAttribId; object.setId( org.apache.axis2.databinding.utils.ConverterUtil.convertToID(tempAttribId)); } else { } handledAttributes.add("id"); // handle attribute "href" java.lang.String tempAttribHref = reader.getAttributeValue(null,"href"); if (tempAttribHref!=null){ java.lang.String content = tempAttribHref; object.setHref( org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(tempAttribHref)); } else { } handledAttributes.add("href"); reader.next(); java.util.ArrayList list1 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()){ // Process the array and step past its final element's end. boolean loopDone1=false; while (!loopDone1){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event){ // We need to wrap the reader so that it produces a fake START_DOCUEMENT event org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader), reader.getName()); list1.add(builder1.getOMElement()); reader.next(); if (reader.isEndElement()) { // we have two countinuos end elements loopDone1 = true; } }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event){ loopDone1 = true; }else{ reader.next(); } } object.setExtraElement((org.apache.axiom.om.OMElement[]) org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( org.apache.axiom.om.OMElement.class,list1)); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) // A start element we are not expecting indicates a trailing invalid property throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_float.java0000664000175000017500000005112511767656530024226 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _float.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _float bean class */ public class _float implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = float Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _float */ protected float local_float ; /** * Auto generated getter method * @return float */ public float get_float(){ return local_float; } /** * Auto generated setter method * @param param _float */ public void set_float(float param){ this.local_float=param; } public java.lang.String toString(){ return local_float + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _float.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":float", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "float", xmlWriter); } } if (java.lang.Float.isNaN(local_float)) { throw new org.apache.axis2.databinding.ADBException("float cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_float)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_float)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _float fromString(java.lang.String value, java.lang.String namespaceURI){ _float returnValue = new _float(); returnValue.set_float( org.apache.axis2.databinding.utils.ConverterUtil.convertToFloat(value)); return returnValue; } public static _float fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _float.Factory.fromString(content,namespaceUri); } else { return _float.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _float parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _float object = new _float(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"float".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_float)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_float( org.apache.axis2.databinding.utils.ConverterUtil.convertToFloat(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/ExtensionMapper.java0000664000175000017500000004356211767656530026111 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * ExtensionMapper.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * ExtensionMapper class */ public class ExtensionMapper{ public static java.lang.Object getTypeObject(java.lang.String namespaceURI, java.lang.String typeName, javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "arrayCoordinate".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.ArrayCoordinate.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "nonPositiveInteger".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NonPositiveInteger.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "int".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._int.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "NMTOKEN".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NMTOKEN.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "unsignedInt".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.UnsignedInt.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "IDREFS".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.IDREFS.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "short".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._short.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "negativeInteger".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NegativeInteger.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "normalizedString".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NormalizedString.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "boolean".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._boolean.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "unsignedLong".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.UnsignedLong.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "IDREF".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.IDREF.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "base64Binary".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Base64Binary.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "ID".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.ID.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "double".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._double.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "anyURI".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.AnyURI.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "language".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Language.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "ENTITY".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.ENTITY.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "unsignedShort".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.UnsignedShort.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "NMTOKENS".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NMTOKENS.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "NCName".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NCName.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "gMonthDay".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.GMonthDay.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "time".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Time.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "token".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Token.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "unsignedByte".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.UnsignedByte.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "nonNegativeInteger".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NonNegativeInteger.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "base64".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Base64.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "string".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.String.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "hexBinary".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.HexBinary.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "NOTATION".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.NOTATION.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "date".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Date.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "positiveInteger".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.PositiveInteger.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "Name".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Name.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "decimal".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Decimal.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "QName".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.QName.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "duration".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Duration.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "Struct".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Struct.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "gYearMonth".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.GYearMonth.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "gMonth".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.GMonth.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "long".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._long.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "gYear".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.GYear.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "integer".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.Integer.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "gDay".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.GDay.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "float".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._float.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "ENTITIES".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.ENTITIES.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "dateTime".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding.DateTime.Factory.parse(reader); } if ( "http://schemas.xmlsoap.org/soap/encoding/".equals(namespaceURI) && "byte".equals(typeName)){ return org.apache.axis2.databinding.types.soapencoding._byte.Factory.parse(reader); } throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName); } } ./src/org/apache/axis2/databinding/types/soapencoding/GYearMonth.java0000664000175000017500000005241611767656530025003 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GYearMonth.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * GYearMonth bean class */ public class GYearMonth implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gYearMonth Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GYearMonth */ protected org.apache.axis2.databinding.types.YearMonth localGYearMonth ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.YearMonth */ public org.apache.axis2.databinding.types.YearMonth getGYearMonth(){ return localGYearMonth; } /** * Auto generated setter method * @param param GYearMonth */ public void setGYearMonth(org.apache.axis2.databinding.types.YearMonth param){ this.localGYearMonth=param; } public java.lang.String toString(){ return localGYearMonth.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GYearMonth.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gYearMonth", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gYearMonth", xmlWriter); } } if (localGYearMonth==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gYearMonth cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYearMonth)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGYearMonth != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYearMonth)); } else { throw new org.apache.axis2.databinding.ADBException("gYearMonth cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GYearMonth fromString(java.lang.String value, java.lang.String namespaceURI){ GYearMonth returnValue = new GYearMonth(); returnValue.setGYearMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYearMonth(value)); return returnValue; } public static GYearMonth fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GYearMonth.Factory.fromString(content,namespaceUri); } else { return GYearMonth.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GYearMonth parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GYearMonth object = new GYearMonth(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gYearMonth".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GYearMonth)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGYearMonth( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYearMonth(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/NormalizedString.java0000664000175000017500000005300211767656530026251 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * NormalizedString.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * NormalizedString bean class */ public class NormalizedString implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = normalizedString Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for NormalizedString */ protected org.apache.axis2.databinding.types.NormalizedString localNormalizedString ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.NormalizedString */ public org.apache.axis2.databinding.types.NormalizedString getNormalizedString(){ return localNormalizedString; } /** * Auto generated setter method * @param param NormalizedString */ public void setNormalizedString(org.apache.axis2.databinding.types.NormalizedString param){ this.localNormalizedString=param; } public java.lang.String toString(){ return localNormalizedString.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { NormalizedString.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":normalizedString", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "normalizedString", xmlWriter); } } if (localNormalizedString==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("normalizedString cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNormalizedString)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localNormalizedString != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNormalizedString)); } else { throw new org.apache.axis2.databinding.ADBException("normalizedString cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static NormalizedString fromString(java.lang.String value, java.lang.String namespaceURI){ NormalizedString returnValue = new NormalizedString(); returnValue.setNormalizedString( org.apache.axis2.databinding.utils.ConverterUtil.convertToNormalizedString(value)); return returnValue; } public static NormalizedString fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return NormalizedString.Factory.fromString(content,namespaceUri); } else { return NormalizedString.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static NormalizedString parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ NormalizedString object = new NormalizedString(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"normalizedString".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (NormalizedString)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setNormalizedString( org.apache.axis2.databinding.utils.ConverterUtil.convertToNormalizedString(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/GYear.java0000664000175000017500000005210611767656530023771 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * GYear.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * GYear bean class */ public class GYear implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = gYear Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for GYear */ protected org.apache.axis2.databinding.types.Year localGYear ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.Year */ public org.apache.axis2.databinding.types.Year getGYear(){ return localGYear; } /** * Auto generated setter method * @param param GYear */ public void setGYear(org.apache.axis2.databinding.types.Year param){ this.localGYear=param; } public java.lang.String toString(){ return localGYear.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { GYear.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":gYear", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "gYear", xmlWriter); } } if (localGYear==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("gYear cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYear)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localGYear != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localGYear)); } else { throw new org.apache.axis2.databinding.ADBException("gYear cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static GYear fromString(java.lang.String value, java.lang.String namespaceURI){ GYear returnValue = new GYear(); returnValue.setGYear( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYear(value)); return returnValue; } public static GYear fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return GYear.Factory.fromString(content,namespaceUri); } else { return GYear.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GYear parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GYear object = new GYear(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"gYear".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (GYear)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setGYear( org.apache.axis2.databinding.utils.ConverterUtil.convertToGYear(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/_double.java0000664000175000017500000005117411767656530024377 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * _double.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * _double bean class */ public class _double implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = double Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for _double */ protected double local_double ; /** * Auto generated getter method * @return double */ public double get_double(){ return local_double; } /** * Auto generated setter method * @param param _double */ public void set_double(double param){ this.local_double=param; } public java.lang.String toString(){ return local_double + ""; } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { _double.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":double", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "double", xmlWriter); } } if (java.lang.Double.isNaN(local_double)) { throw new org.apache.axis2.databinding.ADBException("double cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_double)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_double)); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static _double fromString(java.lang.String value, java.lang.String namespaceURI){ _double returnValue = new _double(); returnValue.set_double( org.apache.axis2.databinding.utils.ConverterUtil.convertToDouble(value)); return returnValue; } public static _double fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return _double.Factory.fromString(content,namespaceUri); } else { return _double.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static _double parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ _double object = new _double(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"double".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (_double)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.set_double( org.apache.axis2.databinding.utils.ConverterUtil.convertToDouble(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/Date.java0000664000175000017500000005167611767656530023652 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * Date.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * Date bean class */ public class Date implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = date Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for Date */ protected java.util.Date localDate ; /** * Auto generated getter method * @return java.util.Date */ public java.util.Date getDate(){ return localDate; } /** * Auto generated setter method * @param param Date */ public void setDate(java.util.Date param){ this.localDate=param; } public java.lang.String toString(){ return localDate.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { Date.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":date", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "date", xmlWriter); } } if (localDate==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("date cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDate)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localDate != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDate)); } else { throw new org.apache.axis2.databinding.ADBException("date cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static Date fromString(java.lang.String value, java.lang.String namespaceURI){ Date returnValue = new Date(); returnValue.setDate( org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(value)); return returnValue; } public static Date fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return Date.Factory.fromString(content,namespaceUri); } else { return Date.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static Date parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ Date object = new Date(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"date".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (Date)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setDate( org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/soapencoding/IDREFS.java0000664000175000017500000005216211767656530023740 0ustar brianbrian /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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. */ /** * IDREFS.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: SNAPSHOT Built on : Dec 21, 2007 (04:03:30 LKT) */ package org.apache.axis2.databinding.types.soapencoding; /** * IDREFS bean class */ public class IDREFS implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = IDREFS Namespace URI = http://schemas.xmlsoap.org/soap/encoding/ Namespace Prefix = ns1 */ private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")){ return "SOAP-ENC"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * field for IDREFS */ protected org.apache.axis2.databinding.types.IDRefs localIDREFS ; /** * Auto generated getter method * @return org.apache.axis2.databinding.types.IDRefs */ public org.apache.axis2.databinding.types.IDRefs getIDREFS(){ return localIDREFS; } /** * Auto generated setter method * @param param IDREFS */ public void setIDREFS(org.apache.axis2.databinding.types.IDRefs param){ this.localIDREFS=param; } public java.lang.String toString(){ return localIDREFS.toString(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { IDREFS.this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://schemas.xmlsoap.org/soap/encoding/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":IDREFS", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "IDREFS", xmlWriter); } } if (localIDREFS==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("IDREFS cannot be null!!"); }else{ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREFS)); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); if (localIDREFS != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIDREFS)); } else { throw new org.apache.axis2.databinding.ADBException("IDREFS cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ public static IDREFS fromString(java.lang.String value, java.lang.String namespaceURI){ IDREFS returnValue = new IDREFS(); returnValue.setIDREFS( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREFS(value)); return returnValue; } public static IDREFS fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return IDREFS.Factory.fromString(content,namespaceUri); } else { return IDREFS.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static IDREFS parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ IDREFS object = new IDREFS(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"IDREFS".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (IDREFS)org.apache.axis2.databinding.types.soapencoding.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ if (reader.isStartElement() || reader.hasText()){ java.lang.String content = reader.getElementText(); object.setIDREFS( org.apache.axis2.databinding.utils.ConverterUtil.convertToIDREFS(content)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } ./src/org/apache/axis2/databinding/types/NonPositiveInteger.java0000664000175000017500000000643311767656530024106 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.ObjectStreamException; import java.math.BigInteger; import java.util.Random; /** * Custom class for supporting primitive XSD data type nonPositiveInteger *

        * nonPositiveInteger is derived from integer by setting the value of maxInclusive to be 0. This * results in the standard mathematical concept of the non-positive integers. The value space of * nonPositiveInteger is the infinite set {...,-2,-1,0}. * * @see XML Schema 3.3.14 */ public class NonPositiveInteger extends BigInteger { private static final long serialVersionUID = -8609051961838117600L; public NonPositiveInteger(byte[] val) { super(val); checkValidity(); } // ctor public NonPositiveInteger(int signum, byte[] magnitude) { super(signum, magnitude); checkValidity(); } // ctor public NonPositiveInteger(int bitLength, int certainty, Random rnd) { super(bitLength, certainty, rnd); checkValidity(); } // ctor public NonPositiveInteger(int numBits, Random rnd) { super(numBits, rnd); checkValidity(); } // ctor public NonPositiveInteger(String val) { super(val); checkValidity(); } public NonPositiveInteger(String val, int radix) { super(val, radix); checkValidity(); } // ctor /** validate the value against the xsd definition */ private BigInteger zero = new BigInteger("0"); private void checkValidity() { if (compareTo(zero) > 0) { throw new NumberFormatException( //Messages.getMessage("badNonPosInt00") + ": " + this); } } // checkValidity /** * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html * * @return BigIntegerRep * @throws java.io.ObjectStreamException */ public Object writeReplace() throws ObjectStreamException { return new BigIntegerRep(toByteArray()); } protected static class BigIntegerRep implements java.io.Serializable { private static final long serialVersionUID = -3601357690365698517L; private byte[] array; protected BigIntegerRep(byte[] array) { this.array = array; } protected Object readResolve() throws java.io.ObjectStreamException { return new NonPositiveInteger(array); } } } // class NonPositiveInteger ./src/org/apache/axis2/databinding/types/Id.java0000664000175000017500000000452711767656530020651 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type ID The base type of Id is NCName. * * @see XML Schema 3.3.8 */ public class Id extends NCName { private static final long serialVersionUID = -8442438083214211437L; public Id() { super(); } /** * Constructor for Id. * * @throws IllegalArgumentException will be thrown if validation fails */ public Id(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException(); //Messages.getMessage("badIdType00") + "data=[" + //stValue + "]"); } } /** * Validates the data and sets the value for the object. * * @param stValue String value * @throws IllegalArgumentException if invalid format */ public void setValue(String stValue) throws IllegalArgumentException { if (!Id.isValid(stValue)) throw new IllegalArgumentException( // Messages.getMessage("badIdType00") + " data=[" + stValue + "]"); m_value = stValue; } /** * Validates the value against the xsd definition. *

        * Same validation as NCName for the time being */ public static boolean isValid(String stValue) { return NCName.isValid(stValue); } } ./src/org/apache/axis2/databinding/types/NMToken.java0000664000175000017500000000455111767656530021625 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import org.apache.axis2.util.XMLChar; /** * Custom class for supporting XSD data type NMToken *

        * NMTOKEN represents the NMTOKEN attribute type from [XML 1.0(Second Edition)]. The value space of * NMTOKEN is the set of tokens that match the Nmtoken production in [XML 1.0 (Second Edition)]. The * base type of NMTOKEN is token. * * @see XML Schema 3.3.4 */ public class NMToken extends Token { private static final long serialVersionUID = -1319741002733174329L; public NMToken() { super(); } /** * ctor for NMToken * * @throws IllegalArgumentException will be thrown if validation fails */ public NMToken(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException( // Messages.getMessage("badNmtoken00") + "data=[" + stValue + "]"); } } /** * validate the value against the xsd definition Nmtoken ::= (NameChar)+ NameChar ::= * Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; for (scan = 0; scan < stValue.length(); scan++) { if (!XMLChar.isName(stValue.charAt(scan))) return false; } return true; } } ./src/org/apache/axis2/databinding/types/Token.java0000664000175000017500000000732611767656530021375 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting primitive XSD data type Token. token represents tokenized strings. * The base type of token is normalizedString. * * @see XML Schema 3.3.2 */ public class Token extends NormalizedString { private static final long serialVersionUID = -7370524740514465467L; public Token() { super(); } /** * ctor for Token * * @throws IllegalArgumentException will be thrown if validation fails */ public Token(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException( //Messages.getMessage("badToken00") + "data=[" + stValue + "]"); } } /** * validate the value against the xsd definition *

        * The value space of token is the set of strings that do not contain the line feed (#xA) nor * tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no * internal sequences of two or more spaces. The lexical space of token is the set of strings * that do not contain the line feed (#xA) nor tab (#x9) characters, that have no leading or * trailing spaces (#x20) and that have no internal sequences of two or more spaces. */ public static boolean isValid(String stValue) { int scan; // check to see if we have a string to review if ((stValue == null) || (stValue.length() == 0)) return true; // no leading space if (stValue.charAt(0) == 0x20) return false; // no trail space if (stValue.charAt(stValue.length() - 1) == 0x20) return false; for (scan = 0; scan < stValue.length(); scan++) { char cDigit = stValue.charAt(scan); switch (cDigit) { case 0x09: case 0x0A: return false; case 0x20: // no doublspace if (scan + 1 < stValue.length()) if (stValue.charAt(scan + 1) == 0x20) { return false; } default: break; } } return true; } /** * validates the data and sets the value for the object. * * @param stValue String value * @throws IllegalArgumentException if invalid format */ public void setValue(String stValue) throws IllegalArgumentException { if (!Token.isValid(stValue)) throw new IllegalArgumentException( //Messages.getMessage("badToken00") + " data=[" + stValue + "]"); m_value = stValue; } } ./src/org/apache/axis2/databinding/types/NonNegativeInteger.java0000664000175000017500000000577311767656530024054 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.ObjectStreamException; import java.math.BigInteger; import java.util.Random; /** * Custom class for supporting primitive XSD data type nonNegativeInteger * * @see XML Schema 3.3.20 */ public class NonNegativeInteger extends BigInteger { private static final long serialVersionUID = -484577860351406054L; public NonNegativeInteger(byte[] val) { super(val); checkValidity(); } // ctor public NonNegativeInteger(int signum, byte[] magnitude) { super(signum, magnitude); checkValidity(); } // ctor public NonNegativeInteger(int bitLength, int certainty, Random rnd) { super(bitLength, certainty, rnd); checkValidity(); } // ctor public NonNegativeInteger(int numBits, Random rnd) { super(numBits, rnd); checkValidity(); } // ctor public NonNegativeInteger(String val) { super(val); checkValidity(); } public NonNegativeInteger(String val, int radix) { super(val, radix); checkValidity(); } // ctor /** validate the value against the xsd definition */ private BigInteger zero = new BigInteger("0"); private void checkValidity() { if (compareTo(zero) < 0) { throw new NumberFormatException( // Messages.getMessage("badNonNegInt00") + ": " + this); } } // checkValidity /** * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html * * @return BigIntegerRep * @throws ObjectStreamException */ public Object writeReplace() throws ObjectStreamException { return new BigIntegerRep(toByteArray()); } protected static class BigIntegerRep implements java.io.Serializable { private static final long serialVersionUID = -6135065605514678689L; private byte[] array; protected BigIntegerRep(byte[] array) { this.array = array; } protected Object readResolve() throws java.io.ObjectStreamException { return new NonNegativeInteger(array); } } } // class NonNegativeInteger ./src/org/apache/axis2/databinding/types/NCName.java0000664000175000017500000000575111767656530021416 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import org.apache.axis2.util.XMLChar; /** * Custom class for supporting XSD data type NCName NCName represents XML "non-colonized" Names The * base type of NCName is Name. * * @see XML Schema 3.3.7 * @see NCName Production */ public class NCName extends Name { private static final long serialVersionUID = 8573451628276898297L; public NCName() { super(); } /** * ctor for NCName * * @throws IllegalArgumentException will be thrown if validation fails */ public NCName(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException( // Messages.getMessage("badNCNameType00") + "data=[" + stValue + "]"); } } /** * validates the data and sets the value for the object. * * @param stValue String value * @throws IllegalArgumentException if invalid format */ public void setValue(String stValue) throws IllegalArgumentException { if (!NCName.isValid(stValue)) throw new IllegalArgumentException( //Messages.getMessage("badNCNameType00") + " data=[" + stValue + "]"); m_value = stValue; } /** * validate the value against the xsd definition *

        * NCName ::= (Letter | '_') (NCNameChar)* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | * CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) bValid = XMLChar.isNCNameStart(stValue.charAt(scan)); else bValid = XMLChar.isNCName(stValue.charAt(scan)); if (!bValid) break; } return bValid; } } ./src/org/apache/axis2/databinding/types/Language.java0000664000175000017500000000463511767656530022040 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type language language represents natural language * identifiers as defined by [RFC 1766]. The value space of language is the set of all strings that * are valid language identifiers as defined in the language identification section of [XML 1.0 * (Second Edition)]. The lexical space of language is the set of all strings that are valid * language identifiers as defined in the language identification section of [XML 1.0 (Second * Edition)]. The base type of language is token. * * @see XML Schema 3.3.3 */ public class Language extends Token { private static final long serialVersionUID = -4105320293090087959L; public Language() { super(); } /** * ctor for Language * * @throws IllegalArgumentException will be thrown if validation fails */ public Language(String stValue) throws IllegalArgumentException { try { setValue(stValue); } catch (IllegalArgumentException e) { // recast normalizedString exception as token exception throw new IllegalArgumentException( // Messages.getMessage("badLanguage00") + "data=[" + stValue + "]"); } } /** * Validates the value against the xsd definition. Language-Tag = Primary-tag *( "-" Subtag ) * Primary-tag = 1*8ALPHA Subtag = 1*8ALPHA TODO * * @see RFC1766 */ public static boolean isValid(String stValue) { return true; } } ./src/org/apache/axis2/databinding/types/Duration.java0000664000175000017500000003401111767656530022071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.Serializable; import java.util.Calendar; /** * Implementation of the XML Schema type duration. Duration supports a minimum fractional second * precision of milliseconds. * * @see XML Schema 3.2.6 */ public class Duration implements Serializable { private static final long serialVersionUID = -3736760992541369098L; boolean isNegative; int years; int months; int days; int hours; int minutes; double seconds; /** Default no-arg constructor */ public Duration() { } /** * @param negative * @param aYears * @param aMonths * @param aDays * @param aHours * @param aMinutes * @param aSeconds */ public Duration(boolean negative, int aYears, int aMonths, int aDays, int aHours, int aMinutes, double aSeconds) { isNegative = negative; years = aYears; months = aMonths; days = aDays; hours = aHours; minutes = aMinutes; setSeconds(aSeconds); } /** * Constructs Duration from a String in an xsd:duration format - PnYnMnDTnHnMnS. * * @param duration String * @throws IllegalArgumentException if the string doesn't parse correctly. */ public Duration(String duration) throws IllegalArgumentException { int position = 1; int timePosition = duration.indexOf("T"); // P is required but P by itself is invalid if (duration.indexOf("P") == -1 || duration.equals("P")) { throw new IllegalArgumentException(); // Messages.getMessage("badDuration")); } // if present, time cannot be empty if (duration.lastIndexOf("T") == duration.length() - 1) { throw new IllegalArgumentException(); // Messages.getMessage("badDuration")); } // check the sign if (duration.startsWith("-")) { isNegative = true; position++; } // parse time part if (timePosition != -1) { parseTime(duration.substring(timePosition + 1)); } else { timePosition = duration.length(); } // parse date part if (position != timePosition) { parseDate(duration.substring(position, timePosition)); } } /** * Constructs Duration from a Calendar. * * @param calendar Calendar * @throws IllegalArgumentException if the calendar object does not represent any date nor * time. */ public Duration(boolean negative, Calendar calendar) throws IllegalArgumentException { this.isNegative = negative; this.years = calendar.get(Calendar.YEAR); this.months = calendar.get(Calendar.MONTH); this.days = calendar.get(Calendar.DATE); this.hours = calendar.get(Calendar.HOUR); this.minutes = calendar.get(Calendar.MINUTE); this.seconds = calendar.get(Calendar.SECOND); this.seconds += ((double)calendar.get(Calendar.MILLISECOND)) / 100; if (years == 0 && months == 0 && days == 0 && hours == 0 && minutes == 0 && seconds == 0) { throw new IllegalArgumentException(); //Messages.getMessage("badCalendarForDuration")); } } /** * This method parses the time portion of a String that represents xsd:duration - nHnMnS. * * @param time * @throws IllegalArgumentException if time does not match pattern */ public void parseTime(String time) throws IllegalArgumentException { if (time.length() == 0 || time.indexOf("-") != -1) { throw new IllegalArgumentException(); //Messages.getMessage("badTimeDuration")); } // check if time ends with either H, M, or S if (!time.endsWith("H") && !time.endsWith("M") && !time.endsWith("S")) { throw new IllegalArgumentException(); //Messages.getMessage("badTimeDuration")); } try { // parse string and extract hours, minutes, and seconds int start = 0; // Hours int end = time.indexOf("H"); // if there is H in a string but there is no value for hours, // throw an exception if (start == end) { throw new IllegalArgumentException(); //Messages.getMessage("badTimeDuration")); } if (end != -1) { hours = Integer.parseInt(time.substring(0, end)); start = end + 1; } // Minutes end = time.indexOf("M"); // if there is M in a string but there is no value for hours, // throw an exception if (start == end) { throw new IllegalArgumentException(); // Messages.getMessage("badTimeDuration")); } if (end != -1) { minutes = Integer.parseInt(time.substring(start, end)); start = end + 1; } // Seconds end = time.indexOf("S"); // if there is S in a string but there is no value for hours, // throw an exception if (start == end) { throw new IllegalArgumentException(); //Messages.getMessage("badTimeDuration")); } if (end != -1) { setSeconds(Double.parseDouble(time.substring(start, end))); } } catch (NumberFormatException e) { throw new IllegalArgumentException(); //Messages.getMessage("badTimeDuration")); } } /** * This method parses the date portion of a String that represents xsd:duration - nYnMnD. * * @param date * @throws IllegalArgumentException if date does not match pattern */ public void parseDate(String date) throws IllegalArgumentException { if (date.length() == 0 || date.indexOf("-") != -1) { throw new IllegalArgumentException(); //Messages.getMessage("badDateDuration")); } // check if date string ends with either Y, M, or D if (!date.endsWith("Y") && !date.endsWith("M") && !date.endsWith("D")) { throw new IllegalArgumentException(); //Messages.getMessage("badDateDuration")); } // catch any parsing exception try { // parse string and extract years, months, days int start = 0; int end = date.indexOf("Y"); // if there is Y in a string but there is no value for years, // throw an exception if (start == end) { throw new IllegalArgumentException(); // Messages.getMessage("badDateDuration")); } if (end != -1) { years = Integer.parseInt(date.substring(0, end)); start = end + 1; } // months end = date.indexOf("M"); // if there is M in a string but there is no value for months, // throw an exception if (start == end) { throw new IllegalArgumentException(); //Messages.getMessage("badDateDuration")); } if (end != -1) { months = Integer.parseInt(date.substring(start, end)); start = end + 1; } end = date.indexOf("D"); // if there is D in a string but there is no value for days, // throw an exception if (start == end) { throw new IllegalArgumentException(); // Messages.getMessage("badDateDuration")); } if (end != -1) { days = Integer.parseInt(date.substring(start, end)); } } catch (NumberFormatException e) { throw new IllegalArgumentException(); //Messages.getMessage("badDateDuration")); } } /** * */ public boolean isNegative() { return isNegative; } /** * */ public int getYears() { return years; } /** * */ public int getMonths() { return months; } /** * */ public int getDays() { return days; } /** * */ public int getHours() { return hours; } /** * */ public int getMinutes() { return minutes; } /** * */ public double getSeconds() { return seconds; } /** @param negative */ public void setNegative(boolean negative) { isNegative = negative; } /** @param years */ public void setYears(int years) { this.years = years; } /** @param months */ public void setMonths(int months) { this.months = months; } /** @param days */ public void setDays(int days) { this.days = days; } /** @param hours */ public void setHours(int hours) { this.hours = hours; } /** @param minutes */ public void setMinutes(int minutes) { this.minutes = minutes; } /** * @param seconds * @deprecated use {@link #setSeconds(double) setSeconds(double)} instead */ public void setSeconds(int seconds) { this.seconds = seconds; } /** * Sets the seconds. NOTE: The fractional value of seconds is rounded up to milliseconds. * * @param seconds double */ public void setSeconds(double seconds) { this.seconds = ((double)(Math.round(seconds * 100))) / 100; } /** This returns the xml representation of an xsd:duration object. */ public String toString() { StringBuffer duration = new StringBuffer(); duration.append("P"); if (years != 0) { duration.append(years).append("Y"); } if (months != 0) { duration.append(months).append("M"); } if (days != 0) { duration.append(days).append("D"); } if (hours != 0 || minutes != 0 || seconds != 0.0) { duration.append("T"); if (hours != 0) { duration.append(hours).append("H"); } if (minutes != 0) { duration.append(minutes).append("M"); } if (seconds != 0) { if (seconds == (int)seconds) { duration.append((int)seconds).append("S"); } else { duration.append(seconds).append("S"); } } } if (duration.length() == 1) { duration.append("T0S"); } if (isNegative) { duration.insert(0, "-"); } return duration.toString(); } /** * The equals method compares the time represented by duration object, not its string * representation. Hence, a duration object representing 65 minutes is considered equal to a * duration object representing 1 hour and 5 minutes. * * @param object */ public boolean equals(Object object) { if (!(object instanceof Duration)) { return false; } Duration duration = (Duration)object; return this.isNegative == duration.isNegative && this.getAsCalendar().equals(duration.getAsCalendar()); } public long compare(Duration duration) { return this.getAsCalendar().getTimeInMillis() - duration.getAsCalendar().getTimeInMillis(); } public int hashCode() { int hashCode = 0; if (isNegative) { hashCode++; } hashCode += years; hashCode += months; hashCode += days; hashCode += hours; hashCode += minutes; hashCode += seconds; // milliseconds hashCode += (seconds * 100) % 100; return hashCode; } /** * Returns duration as a calendar. Due to the way a Calendar class works, the values for * particular fields may not be the same as obtained through getter methods. For example, if a * duration's object getMonths returns 20, a similar call on a calendar object will return 1 * year and 8 months. * * @return Calendar */ public Calendar getAsCalendar() { return getAsCalendar(Calendar.getInstance()); } /** * Returns duration as a calendar. Due to the way a Calendar class works, the values for * particular fields may not be the same as obtained through getter methods. For example, if a * Duration's object getMonths returns 20, a similar call on a Calendar object will return 1 * year and 8 months. * * @param startTime Calendar * @return Calendar */ public Calendar getAsCalendar(Calendar startTime) { Calendar ret = (Calendar)startTime.clone(); ret.set(Calendar.YEAR, years); ret.set(Calendar.MONTH, months); ret.set(Calendar.DATE, days); ret.set(Calendar.HOUR, hours); ret.set(Calendar.MINUTE, minutes); ret.set(Calendar.SECOND, (int)seconds); ret.set(Calendar.MILLISECOND, (int)(seconds * 100 - Math.round(seconds) * 100)); return ret; } } ./src/org/apache/axis2/databinding/types/YearMonth.java0000664000175000017500000001321211767656530022212 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.Serializable; import java.text.NumberFormat; /** * Implementation of the XML Schema type gYearMonth * * @see XML Schema 3.2.10 */ public class YearMonth implements Serializable { private static final long serialVersionUID = -5510739842661690551L; int year; int month; String timezone = null; /** Constructs a YearMonth with the given values No timezone is specified */ public YearMonth(int year, int month) throws NumberFormatException { setValue(year, month); } /** * Constructs a YearMonth with the given values, including a timezone string The timezone is * validated but not used. */ public YearMonth(int year, int month, String timezone) throws NumberFormatException { setValue(year, month, timezone); } /** Construct a YearMonth from a String in the format [-]CCYY-MM */ public YearMonth(String source) throws NumberFormatException { int negative = 0; if (source.charAt(0) == '-') { negative = 1; } if (source.length() < (7 + negative)) { throw new NumberFormatException(); // Messages.getMessage("badYearMonth00")); } // look for first '-' int pos = source.substring(negative).indexOf('-'); if (pos < 0) { throw new NumberFormatException(); //Messages.getMessage("badYearMonth00")); } if (negative > 0) pos++; //adjust index for orginal string setValue(Integer.parseInt(source.substring(0, pos)), Integer.parseInt(source.substring(pos + 1, pos + 3)), source.substring(pos + 3)); } public int getYear() { return year; } public void setYear(int year) { // validate year, more than 4 digits are allowed! if (year == 0) { throw new NumberFormatException(); // Messages.getMessage("badYearMonth00")); } this.year = year; } public int getMonth() { return month; } public void setMonth(int month) { // validate month if (month < 1 || month > 12) { throw new NumberFormatException(); //Messages.getMessage("badYearMonth00")); } this.month = month; } public String getTimezone() { return timezone; } public void setTimezone(String timezone) { // validate timezone if (timezone != null && timezone.length() > 0) { // Format [+/-]HH:MM if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) { if (timezone.length() != 6 || !Character.isDigit(timezone.charAt(1)) || !Character.isDigit(timezone.charAt(2)) || timezone.charAt(3) != ':' || !Character.isDigit(timezone.charAt(4)) || !Character.isDigit(timezone.charAt(5))) throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } else if (!timezone.equals("Z")) { throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } // if we got this far, its good this.timezone = timezone; } } public void setValue(int year, int month, String timezone) throws NumberFormatException { setYear(year); setMonth(month); setTimezone(timezone); } public void setValue(int year, int month) throws NumberFormatException { setYear(year); setMonth(month); } public String toString() { // use NumberFormat to ensure leading zeros NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); // year nf.setMinimumIntegerDigits(4); String s = nf.format(year) + "-"; // month nf.setMinimumIntegerDigits(2); s += nf.format(month); // timezone if (timezone != null) { s = s + timezone; } return s; } public boolean equals(Object obj) { if (!(obj instanceof YearMonth)) return false; YearMonth other = (YearMonth)obj; if (this == obj) return true; boolean equals = (this.year == other.year && this.month == other.month); if (timezone != null) { equals = equals && timezone.equals(other.timezone); } return equals; } /** * Return the value of (month + year) XORed with the hashCode of timezone iff one is defined. * * @return an int value */ public int hashCode() { return null == timezone ? (month + year) : (month + year) ^ timezone.hashCode(); } } ./src/org/apache/axis2/databinding/types/Time.java0000664000175000017500000002245311767656530021211 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import org.apache.axis2.databinding.utils.ConverterUtil; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; /** Class that represents the xsd:time XML Schema type */ public class Time implements java.io.Serializable { private static final long serialVersionUID = -9022201555535589908L; private Calendar _value; private boolean isFromString; private String originalString; /** * a shared java.text.SimpleDateFormat instance used for parsing the basic component of the * timestamp */ /** Initializes with a Calender. Year, month and date are ignored. */ public Time(Calendar value) { this._value = value; this._value.clear(Calendar.YEAR); this._value.clear(Calendar.MONTH); this._value.clear(Calendar.DATE); } /** Converts a string formatted as HH:mm:ss[.SSS][+/-offset] */ public Time(String value) throws NumberFormatException { _value = makeValue(value); this.isFromString = true; this.originalString = value; } /** * Returns the time as a calendar. Ignores the year, month and date fields. * * @return Returns calendar value; may be null. */ public Calendar getAsCalendar() { return _value; } /** * Sets the time; ignores year, month, date * * @param date */ public void setTime(Calendar date) { this._value = date; this._value.clear(Calendar.YEAR); this._value.clear(Calendar.MONTH); this._value.clear(Calendar.DATE); } /** * Sets the time from a date instance. * * @param date */ public void setTime(Date date) { _value.setTime(date); this._value.clear(Calendar.YEAR); this._value.clear(Calendar.MONTH); this._value.clear(Calendar.DATE); } /** Utility function that parses xsd:time strings and returns a Date object */ private Calendar makeValue(String source) throws NumberFormatException { // cannonical form of the times is hh ':' mm ':' ss ('.' s+)? (zzzzzz)? if ((source == null) || (source.trim().length() == 0)){ return null; } source = source.trim(); Calendar calendar = Calendar.getInstance(); calendar.clear(); int hour = 0; int minite = 0; int second = 0; int miliSecond = 0; int timeZoneOffSet = TimeZone.getDefault().getRawOffset(); int milliSecondPartLength = 0; if (source.length() >= 8) { if ((source.charAt(2) != ':' )|| (source.charAt(5) != ':')){ throw new RuntimeException("Invalid time format (" + source + ") having : s in wrong places"); } hour = Integer.parseInt(source.substring(0, 2)); minite = Integer.parseInt(source.substring(3, 5)); second = Integer.parseInt(source.substring(6, 8)); if (source.length() > 8) { String rest = source.substring(8); if (rest.startsWith(".")) { // i.e this have the ('.'s+) part if (rest.endsWith("Z")) { // this is in gmt time zone timeZoneOffSet = 0; miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("Z"))); milliSecondPartLength = rest.substring(1,rest.lastIndexOf("Z")).trim().length(); } else if ((rest.lastIndexOf("+") > 0) || (rest.lastIndexOf("-") > 0)) { // this is given in a general time zione String timeOffSet = null; if (rest.lastIndexOf("+") > 0) { timeOffSet = rest.substring(rest.lastIndexOf("+") + 1); miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("+"))); milliSecondPartLength = rest.substring(1, rest.lastIndexOf("+")).trim().length(); // we keep +1 or -1 to finally calculate the value timeZoneOffSet = 1; } else if (rest.lastIndexOf("-") > 0) { timeOffSet = rest.substring(rest.lastIndexOf("-") + 1); miliSecond = Integer.parseInt(rest.substring(1, rest.lastIndexOf("-"))); milliSecondPartLength = rest.substring(1, rest.lastIndexOf("-")).trim().length(); // we keep +1 or -1 to finally calculate the value timeZoneOffSet = -1; } if (timeOffSet.charAt(2) != ':') { throw new RuntimeException("invalid time zone format (" + source + ") without : at correct place"); } int hours = Integer.parseInt(timeOffSet.substring(0, 2)); int minits = Integer.parseInt(timeOffSet.substring(3, 5)); timeZoneOffSet = ((hours * 60) + minits) * 60000 * timeZoneOffSet; } else { // i.e it does not have time zone miliSecond = Integer.parseInt(rest.substring(1)); milliSecondPartLength = rest.substring(1).trim().length(); } } else { if (rest.startsWith("Z")) { // this is in gmt time zone timeZoneOffSet = 0; } else if (rest.startsWith("+") || rest.startsWith("-")) { // this is given in a general time zione if (rest.charAt(3) != ':') { throw new RuntimeException("invalid time zone format (" + source + ") without : at correct place"); } int hours = Integer.parseInt(rest.substring(1, 3)); int minits = Integer.parseInt(rest.substring(4, 6)); timeZoneOffSet = ((hours * 60) + minits) * 60000; if (rest.startsWith("-")) { timeZoneOffSet = timeZoneOffSet * -1; } } else { throw new NumberFormatException("in valid time zone attribute"); } } } } else { throw new RuntimeException("invalid message string"); } calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minite); calendar.set(Calendar.SECOND, second); if (milliSecondPartLength != 3) { // milisecond part represenst the fraction of the second so we have to // find the fraction and multiply it by 1000. So if milisecond part // has three digits nothing required miliSecond = miliSecond * 1000; for (int i = 0; i < milliSecondPartLength; i++) { miliSecond = miliSecond / 10; } } calendar.set(Calendar.MILLISECOND, miliSecond); calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet); calendar.set(Calendar.DST_OFFSET, 0); return calendar; } /** * Returns the time as it would be in GMT. This is accurate to the seconds. Milliseconds * probably gets lost. * * @return Returns String. */ public String toString() { if (_value == null) { return "unassigned Time"; } if (isFromString) { return originalString; } else { StringBuffer timeString = new StringBuffer(); ConverterUtil.appendTime(_value,timeString); ConverterUtil.appendTimeZone(_value,timeString); return timeString.toString(); } } public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof Time)) return false; Time other = (Time)obj; if (this == obj) return true; boolean _equals; _equals = ((_value == null && other._value == null) || (_value != null && _value.getTime().equals(other._value.getTime()))); return _equals; } /** * Returns the hashcode of the underlying calendar. * * @return Returns an int value. */ public int hashCode() { return _value == null ? 0 : _value.hashCode(); } } ./src/org/apache/axis2/databinding/types/IDRef.java0000664000175000017500000000253311767656530021241 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type IDRef * * @see XML Schema 3.3.10 IDREFS */ public class IDRef extends NCName { private static final long serialVersionUID = 6821835065939868576L; public IDRef() { super(); } /** * ctor for IDRef * * @throws IllegalArgumentException will be thrown if validation fails */ public IDRef(String stValue) throws IllegalArgumentException { super(stValue); } } ./src/org/apache/axis2/databinding/types/package.html0000664000175000017500000000172411767656530021727 0ustar brianbrian These classes are directly salvaged from Axis 1 codebase. Original author comments have been preserved! ./src/org/apache/axis2/databinding/types/Entity.java0000664000175000017500000000254211767656530021564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type Entity * * @see XML Schema 3.3.11 ENTITY */ public class Entity extends NCName { private static final long serialVersionUID = -4868410883856961942L; public Entity() { super(); } /** * ctor for Entity * * @throws IllegalArgumentException will be thrown if validation fails */ public Entity(String stValue) throws IllegalArgumentException { super(stValue); } } ./src/org/apache/axis2/databinding/types/UnsignedByte.java0000664000175000017500000000422311767656530022706 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting primitive XSD data type UnsignedByte * * @see XML Schema 3.3.24 */ public class UnsignedByte extends UnsignedShort { private static final long serialVersionUID = 4631754787145526759L; public UnsignedByte() { } /** * ctor for UnsignedByte * * @throws Exception will be thrown if validation fails */ public UnsignedByte(long sValue) throws NumberFormatException { setValue(sValue); } public UnsignedByte(String sValue) throws NumberFormatException { setValue(Long.parseLong(sValue)); } /** * validates the data and sets the value for the object. * * @param sValue the number to set */ public void setValue(long sValue) throws NumberFormatException { if (!UnsignedByte.isValid(sValue)) throw new NumberFormatException( // Messages.getMessage("badUnsignedByte00") + String.valueOf(sValue) + "]"); lValue = new Long(sValue); } /** * validate the value against the xsd value space definition * * @param sValue number to check against range */ public static boolean isValid(long sValue) { return !((sValue < 0L) || (sValue > 255L)); } } ./src/org/apache/axis2/databinding/types/UnsignedShort.java0000664000175000017500000000411111767656530023076 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting primitive XSD data type UnsignedShort * * @see XML Schema 3.3.23 */ public class UnsignedShort extends UnsignedInt { private static final long serialVersionUID = 6822598447692816380L; public UnsignedShort() { } /** * ctor for UnsignedShort * * @throws NumberFormatException will be thrown if validation fails */ public UnsignedShort(long sValue) throws NumberFormatException { setValue(sValue); } public UnsignedShort(String sValue) throws NumberFormatException { setValue(Long.parseLong(sValue)); } /** * validates the data and sets the value for the object. * * @param sValue value */ public void setValue(long sValue) throws NumberFormatException { if (!UnsignedShort.isValid(sValue)) throw new NumberFormatException( // Messages.getMessage("badUnsignedShort00") + String.valueOf(sValue) + "]"); lValue = new Long(sValue); } /** validate the value against the xsd definition */ public static boolean isValid(long sValue) { return !((sValue < 0L) || (sValue > 65535L)); } } ./src/org/apache/axis2/databinding/types/Month.java0000664000175000017500000001144311767656530021375 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.text.NumberFormat; /** * Implementation of the XML Schema type gMonth * * @see XML Schema 3.2.14 */ public class Month implements java.io.Serializable { private static final long serialVersionUID = -7469265802807262347L; int month; String timezone; /** Constructs a Month with the given values No timezone is specified */ public Month(int month) throws NumberFormatException { setValue(month); } /** * Constructs a Month with the given values, including a timezone string The timezone is * validated but not used. */ public Month(int month, String timezone) throws NumberFormatException { setValue(month, timezone); } /** Construct a Month from a String in the format --MM--[timezone] */ public Month(String source) throws NumberFormatException { if (source.length() < (6)) { throw new NumberFormatException(); // Messages.getMessage("badMonth00")); } if (source.charAt(0) != '-' || source.charAt(1) != '-' || source.charAt(4) != '-' || source.charAt(5) != '-') { throw new NumberFormatException(); //Messages.getMessage("badMonth00")); } setValue(Integer.parseInt(source.substring(2, 4)), source.substring(6)); } public int getMonth() { return month; } public void setMonth(int month) { // validate month if (month < 1 || month > 12) { throw new NumberFormatException(); // Messages.getMessage("badMonth00")); } this.month = month; } public String getTimezone() { return timezone; } public void setTimezone(String timezone) { // validate timezone if (timezone != null && timezone.length() > 0) { // Format [+/-]HH:MM if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) { if (timezone.length() != 6 || !Character.isDigit(timezone.charAt(1)) || !Character.isDigit(timezone.charAt(2)) || timezone.charAt(3) != ':' || !Character.isDigit(timezone.charAt(4)) || !Character.isDigit(timezone.charAt(5))) throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } else if (!timezone.equals("Z")) { throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } // if we got this far, its good this.timezone = timezone; } } public void setValue(int month, String timezone) throws NumberFormatException { setMonth(month); setTimezone(timezone); } public void setValue(int month) throws NumberFormatException { setMonth(month); } public String toString() { // use NumberFormat to ensure leading zeros NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); // month nf.setMinimumIntegerDigits(2); String s = "--" + nf.format(month) + "--"; // timezone if (timezone != null) { s = s + timezone; } return s; } public boolean equals(Object obj) { if (!(obj instanceof Month)) return false; Month other = (Month)obj; if (this == obj) return true; boolean equals = (this.month == other.month); if (timezone != null) { equals = equals && timezone.equals(other.timezone); } return equals; } /** * Return the value of month XORed with the hashCode of timezone iff one is defined. * * @return an int value */ public int hashCode() { return null == timezone ? month : month ^ timezone.hashCode(); } } ./src/org/apache/axis2/databinding/types/URI.java0000664000175000017500000021306111767656530020747 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.IOException; import java.io.Serializable; /** * ******************************************************************* Axis Note: This class was * 'borrowed' from Xerces 2.0.2 *

        * A class to represent a Uniform Resource Identifier (URI). This class is designed to handle the * parsing of URIs and provide access to the various components (scheme, host, port, userinfo, * path, query string and fragment) that may constitute a URI. *

        * Parsing of a URI specification is done according to the URI syntax described in RFC 2396, and amended by RFC 2732. *

        * Every absolute URI consists of a scheme, followed by a colon (':'), followed by a * scheme-specific part. For URIs that follow the "generic URI" syntax, the scheme-specific part * begins with two slashes ("//") and may be followed by an authority segment (comprised of user * information, host, and port), path segment, query segment and fragment. Note that RFC 2396 no * longer specifies the use of the parameters segment and excludes the "user:password" syntax as * part of the authority segment. If "user:password" appears in a URI, the entire user/password * string is stored as userinfo. *

        * For URIs that do not follow the "generic URI" syntax (e.g. mailto), the entire scheme-specific * part is treated as the "path" portion of the URI. *

        * Note that, unlike the java.net.URL class, this class does not provide any built-in network * access functionality nor does it provide any scheme-specific functionality (for example, it does * not know a default port for a specific scheme). Rather, it only knows the grammar and basic set * of operations that can be applied to a URI. *

        * ******************************************************************** */ public class URI implements Serializable { private static final long serialVersionUID = 2172306044361227627L; /** * **************************************************************** MalformedURIExceptions are * thrown in the process of building a URI or setting fields on a URI when an operation would * result in an invalid URI specification. *

        * ****************************************************************** */ public static class MalformedURIException extends IOException { private static final long serialVersionUID = -8488692760975768757L; /** * *************************************************************** Constructs a * MalformedURIException with no specified detail message. * **************************************************************** */ public MalformedURIException() { super(); } /** * ************************************************************** Constructs a * MalformedURIException with the specified detail message. * * @param p_msg the detail message. **************************************************************** */ public MalformedURIException(String p_msg) { super(p_msg); } } private static final byte [] fgLookupTable = new byte[128]; /** * Character Classes */ /** reserved characters ;/?:@&=+$,[] */ //RFC 2732 added '[' and ']' as reserved characters private static final int RESERVED_CHARACTERS = 0x01; /** * URI punctuation mark characters: -_.!~*'() - these, combined with alphanumerics, constitute the * "unreserved" characters */ private static final int MARK_CHARACTERS = 0x02; /** scheme can be composed of alphanumerics and these characters: +-. */ private static final int SCHEME_CHARACTERS = 0x04; /** userinfo can be composed of unreserved, escaped and these characters: ;:&=+$, */ private static final int USERINFO_CHARACTERS = 0x08; /** ASCII letter characters */ private static final int ASCII_ALPHA_CHARACTERS = 0x10; /** ASCII digit characters */ private static final int ASCII_DIGIT_CHARACTERS = 0x20; /** ASCII hex characters */ private static final int ASCII_HEX_CHARACTERS = 0x40; /** Path characters */ private static final int PATH_CHARACTERS = 0x80; /** Mask for alpha-numeric characters */ private static final int MASK_ALPHA_NUMERIC = ASCII_ALPHA_CHARACTERS | ASCII_DIGIT_CHARACTERS; /** Mask for unreserved characters */ private static final int MASK_UNRESERVED_MASK = MASK_ALPHA_NUMERIC | MARK_CHARACTERS; /** Mask for URI allowable characters except for % */ private static final int MASK_URI_CHARACTER = MASK_UNRESERVED_MASK | RESERVED_CHARACTERS; /** Mask for scheme characters */ private static final int MASK_SCHEME_CHARACTER = MASK_ALPHA_NUMERIC | SCHEME_CHARACTERS; /** Mask for userinfo characters */ private static final int MASK_USERINFO_CHARACTER = MASK_UNRESERVED_MASK | USERINFO_CHARACTERS; /** Mask for path characters */ private static final int MASK_PATH_CHARACTER = MASK_UNRESERVED_MASK | PATH_CHARACTERS; static { // Add ASCII Digits and ASCII Hex Numbers for (int i = '0'; i <= '9'; ++i) { fgLookupTable[i] |= ASCII_DIGIT_CHARACTERS | ASCII_HEX_CHARACTERS; } // Add ASCII Letters and ASCII Hex Numbers for (int i = 'A'; i <= 'F'; ++i) { fgLookupTable[i] |= ASCII_ALPHA_CHARACTERS | ASCII_HEX_CHARACTERS; fgLookupTable[i + 0x00000020] |= ASCII_ALPHA_CHARACTERS | ASCII_HEX_CHARACTERS; } // Add ASCII Letters for (int i = 'G'; i <= 'Z'; ++i) { fgLookupTable[i] |= ASCII_ALPHA_CHARACTERS; fgLookupTable[i + 0x00000020] |= ASCII_ALPHA_CHARACTERS; } // Add Reserved Characters fgLookupTable[';'] |= RESERVED_CHARACTERS; fgLookupTable['/'] |= RESERVED_CHARACTERS; fgLookupTable['?'] |= RESERVED_CHARACTERS; fgLookupTable[':'] |= RESERVED_CHARACTERS; fgLookupTable['@'] |= RESERVED_CHARACTERS; fgLookupTable['&'] |= RESERVED_CHARACTERS; fgLookupTable['='] |= RESERVED_CHARACTERS; fgLookupTable['+'] |= RESERVED_CHARACTERS; fgLookupTable['$'] |= RESERVED_CHARACTERS; fgLookupTable[','] |= RESERVED_CHARACTERS; fgLookupTable['['] |= RESERVED_CHARACTERS; fgLookupTable[']'] |= RESERVED_CHARACTERS; // Add Mark Characters fgLookupTable['-'] |= MARK_CHARACTERS; fgLookupTable['_'] |= MARK_CHARACTERS; fgLookupTable['.'] |= MARK_CHARACTERS; fgLookupTable['!'] |= MARK_CHARACTERS; fgLookupTable['~'] |= MARK_CHARACTERS; fgLookupTable['*'] |= MARK_CHARACTERS; fgLookupTable['\''] |= MARK_CHARACTERS; fgLookupTable['('] |= MARK_CHARACTERS; fgLookupTable[')'] |= MARK_CHARACTERS; // Add Scheme Characters fgLookupTable['+'] |= SCHEME_CHARACTERS; fgLookupTable['-'] |= SCHEME_CHARACTERS; fgLookupTable['.'] |= SCHEME_CHARACTERS; // Add Userinfo Characters fgLookupTable[';'] |= USERINFO_CHARACTERS; fgLookupTable[':'] |= USERINFO_CHARACTERS; fgLookupTable['&'] |= USERINFO_CHARACTERS; fgLookupTable['='] |= USERINFO_CHARACTERS; fgLookupTable['+'] |= USERINFO_CHARACTERS; fgLookupTable['$'] |= USERINFO_CHARACTERS; fgLookupTable[','] |= USERINFO_CHARACTERS; // Add Path Characters fgLookupTable[';'] |= PATH_CHARACTERS; fgLookupTable['/'] |= PATH_CHARACTERS; fgLookupTable[':'] |= PATH_CHARACTERS; fgLookupTable['@'] |= PATH_CHARACTERS; fgLookupTable['&'] |= PATH_CHARACTERS; fgLookupTable['='] |= PATH_CHARACTERS; fgLookupTable['+'] |= PATH_CHARACTERS; fgLookupTable['$'] |= PATH_CHARACTERS; fgLookupTable[','] |= PATH_CHARACTERS; } /** Stores the scheme (usually the protocol) for this URI. */ private String m_scheme = null; /** If specified, stores the userinfo for this URI; otherwise null */ private String m_userinfo = null; /** If specified, stores the host for this URI; otherwise null */ private String m_host = null; /** If specified, stores the port for this URI; otherwise -1 */ private int m_port = -1; /** If specified, stores the registry based authority for this URI; otherwise -1 */ private String m_regAuthority = null; /** If specified, stores the path for this URI; otherwise null */ private String m_path = null; /** If specified, stores the query string for this URI; otherwise null. */ private String m_queryString = null; /** If specified, stores the fragment for this URI; otherwise null */ private String m_fragment; /** Construct a new and uninitialized URI. */ public URI() { } /** * Construct a new URI from another URI. All fields for this URI are set equal to the fields of * the URI passed in. * * @param p_other the URI to copy (cannot be null) */ public URI(URI p_other) { initialize(p_other); } /** * Construct a new URI from a URI specification string. If the specification follows the "generic * URI" syntax, (two slashes following the first colon), the specification will be parsed * accordingly - setting the scheme, userinfo, host,port, path, query string and fragment fields * as necessary. If the specification does not follow the "generic URI" syntax, the specification * is parsed into a scheme and scheme-specific part (stored as the path) only. * * @param p_uriSpec the URI specification string (cannot be null or empty) * @throws MalformedURIException if p_uriSpec violates any syntax rules */ public URI(String p_uriSpec) throws MalformedURIException { this((URI)null, p_uriSpec); } /** * Construct a new URI from a base URI and a URI specification string. The URI specification * string may be a relative URI. * * @param p_base the base URI (cannot be null if p_uriSpec is null or empty) * @param p_uriSpec the URI specification string (cannot be null or empty if p_base is null) * @throws MalformedURIException if p_uriSpec violates any syntax rules */ public URI(URI p_base, String p_uriSpec) throws MalformedURIException { initialize(p_base, p_uriSpec); } /** * Construct a new URI that does not follow the generic URI syntax. Only the scheme and * scheme-specific part (stored as the path) are initialized. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_schemeSpecificPart the scheme-specific part (cannot be null or empty) * @throws MalformedURIException if p_scheme violates any syntax rules */ public URI(String p_scheme, String p_schemeSpecificPart) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme!"); } if (p_schemeSpecificPart == null || p_schemeSpecificPart.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme-specific part!"); } setScheme(p_scheme); setPath(p_schemeSpecificPart); } /** * Construct a new URI that follows the generic URI syntax from its component parts. Each * component is validated for syntax and some basic semantic checks are performed as well. See * the individual setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_host the hostname, IPv4 address or IPv6 reference for the URI * @param p_path the URI path - if the path contains '?' or '#', then the query string * and/or fragment will be set from the path; however, if the query and * fragment are specified both in the path and as separate parameters, an * exception is thrown * @param p_queryString the URI query string (cannot be specified if path is null) * @param p_fragment the URI fragment (cannot be specified if path is null) * @throws MalformedURIException if any of the parameters violates syntax rules or semantic rules */ public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { this(p_scheme, null, p_host, -1, p_path, p_queryString, p_fragment); } /** * Construct a new URI that follows the generic URI syntax from its component parts. Each * component is validated for syntax and some basic semantic checks are performed as well. See * the individual setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_userinfo the URI userinfo (cannot be specified if host is null) * @param p_host the hostname, IPv4 address or IPv6 reference for the URI * @param p_port the URI port (may be -1 for "unspecified"; cannot be specified if host is * null) * @param p_path the URI path - if the path contains '?' or '#', then the query string * and/or fragment will be set from the path; however, if the query and * fragment are specified both in the path and as separate parameters, an * exception is thrown * @param p_queryString the URI query string (cannot be specified if path is null) * @param p_fragment the URI fragment (cannot be specified if path is null) * @throws MalformedURIException if any of the parameters violates syntax rules or semantic rules */ public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException("Scheme is required!"); } if (p_host == null) { if (p_userinfo != null) { throw new MalformedURIException( "Userinfo may not be specified if host is not specified!"); } if (p_port != -1) { throw new MalformedURIException( "Port may not be specified if host is not specified!"); } } if (p_path != null) { if (p_path.indexOf('?') != -1 && p_queryString != null) { throw new MalformedURIException( "Query string cannot be specified in path and query string!"); } if (p_path.indexOf('#') != -1 && p_fragment != null) { throw new MalformedURIException( "Fragment cannot be specified in both the path and fragment!"); } } setScheme(p_scheme); setHost(p_host); setPort(p_port); setUserinfo(p_userinfo); setPath(p_path); setQueryString(p_queryString); setFragment(p_fragment); } /** * Initialize all fields of this URI from another URI. * * @param p_other the URI to copy (cannot be null) */ private void initialize(URI p_other) { m_scheme = p_other.getScheme(); m_userinfo = p_other.getUserinfo(); m_host = p_other.getHost(); m_port = p_other.getPort(); m_regAuthority = p_other.getRegBasedAuthority(); m_path = p_other.getPath(); m_queryString = p_other.getQueryString(); m_fragment = p_other.getFragment(); } /** * Initializes this URI from a base URI and a URI specification string. See RFC 2396 Section 4 and * Appendix B for specifications on parsing the URI and Section 5 for specifications on resolving * relative URIs and relative paths. * * @param p_base the base URI (may be null if p_uriSpec is an absolute URI) * @param p_uriSpec the URI spec string which may be an absolute or relative URI (can only be * null/empty if p_base is not null) * @throws MalformedURIException if p_base is null and p_uriSpec is not an absolute URI or if * p_uriSpec violates syntax rules */ private void initialize(URI p_base, String p_uriSpec) throws MalformedURIException { String uriSpec = p_uriSpec; int uriSpecLen = (uriSpec != null) ? uriSpec.length() : 0; if (p_base == null && uriSpecLen == 0) { throw new MalformedURIException( "Cannot initialize URI with empty parameters."); } // just make a copy of the base if spec is empty if (uriSpecLen == 0) { initialize(p_base); return; } int index = 0; // Check for scheme, which must be before '/', '?' or '#'. Also handle // names with DOS drive letters ('D:'), so 1-character schemes are not // allowed. int colonIdx = uriSpec.indexOf(':'); if (colonIdx != -1) { final int searchFrom = colonIdx - 1; // search backwards starting from character before ':'. int slashIdx = uriSpec.lastIndexOf('/', searchFrom); int queryIdx = uriSpec.lastIndexOf('?', searchFrom); int fragmentIdx = uriSpec.lastIndexOf('#', searchFrom); if (colonIdx < 2 || slashIdx != -1 || queryIdx != -1 || fragmentIdx != -1) { // A standalone base is a valid URI according to spec if (colonIdx == 0 || (p_base == null && fragmentIdx != 0)) { throw new MalformedURIException("No scheme found in URI."); } } else { initializeScheme(uriSpec); index = m_scheme.length() + 1; // Neither 'scheme:' or 'scheme:#fragment' are valid URIs. if (colonIdx == uriSpecLen - 1 || uriSpec.charAt(colonIdx + 1) == '#') { throw new MalformedURIException("Scheme specific part cannot be empty."); } } } // Two slashes means we may have authority, but definitely means we're either // matching net_path or abs_path. These two productions are ambiguous in that // every net_path (except those containing an IPv6Reference) is an abs_path. // RFC 2396 resolves this ambiguity by applying a greedy left most matching rule. // Try matching net_path first, and if that fails we don't have authority so // then attempt to match abs_path. // // net_path = "//" authority [ abs_path ] // abs_path = "/" path_segments if (((index + 1) < uriSpecLen) && (uriSpec.charAt(index) == '/' && uriSpec.charAt(index + 1) == '/')) { index += 2; int startPos = index; // Authority will be everything up to path, query or fragment char testChar = '\0'; while (index < uriSpecLen) { testChar = uriSpec.charAt(index); if (testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } // Attempt to parse authority. If the section is an empty string // this is a valid server based authority, so set the host to this // value. if (index > startPos) { // If we didn't find authority we need to back up. Attempt to // match against abs_path next. if (!initializeAuthority(uriSpec.substring(startPos, index))) { index = startPos - 2; } } else { m_host = ""; } } initializePath(uriSpec, index); // Resolve relative URI to base URI - see RFC 2396 Section 5.2 // In some cases, it might make more sense to throw an exception // (when scheme is specified is the string spec and the base URI // is also specified, for example), but we're just following the // RFC specifications if (p_base != null) { // check to see if this is the current doc - RFC 2396 5.2 #2 // note that this is slightly different from the RFC spec in that // we don't include the check for query string being null // - this handles cases where the urispec is just a query // string or a fragment (e.g. "?y" or "#s") - // see which // identified this as a bug in the RFC if (m_path.length() == 0 && m_scheme == null && m_host == null && m_regAuthority == null) { m_scheme = p_base.getScheme(); m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); m_regAuthority = p_base.getRegBasedAuthority(); m_path = p_base.getPath(); if (m_queryString == null) { m_queryString = p_base.getQueryString(); } return; } // check for scheme - RFC 2396 5.2 #3 // if we found a scheme, it means absolute URI, so we're done if (m_scheme == null) { m_scheme = p_base.getScheme(); } else { return; } // check for authority - RFC 2396 5.2 #4 // if we found a host, then we've got a network path, so we're done if (m_host == null && m_regAuthority == null) { m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); m_regAuthority = p_base.getRegBasedAuthority(); } else { return; } // check for absolute path - RFC 2396 5.2 #5 if (m_path.length() > 0 && m_path.startsWith("/")) { return; } // if we get to this point, we need to resolve relative path // RFC 2396 5.2 #6 String path = ""; String basePath = p_base.getPath(); // 6a - get all but the last segment of the base URI path if (basePath != null && basePath.length() > 0) { int lastSlash = basePath.lastIndexOf('/'); if (lastSlash != -1) { path = basePath.substring(0, lastSlash + 1); } } else if (m_path.length() > 0) { path = "/"; } // 6b - append the relative URI path path = path.concat(m_path); // 6c - remove all "./" where "." is a complete path segment index = -1; while ((index = path.indexOf("/./")) != -1) { path = path.substring(0, index + 1).concat(path.substring(index + 3)); } // 6d - remove "." if path ends with "." as a complete path segment if (path.endsWith("/.")) { path = path.substring(0, path.length() - 1); } // 6e - remove all "/../" where "" is a complete // path segment not equal to ".." index = 1; int segIndex = -1; String tempString = null; while ((index = path.indexOf("/../", index)) > 0) { tempString = path.substring(0, path.indexOf("/../")); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { if (!tempString.substring(segIndex).equals("..")) { path = path.substring(0, segIndex + 1).concat(path.substring(index + 4)); index = segIndex; } else index += 4; } else index += 4; } // 6f - remove ending "/.." where "" is a // complete path segment if (path.endsWith("/..")) { tempString = path.substring(0, path.length() - 3); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { path = path.substring(0, segIndex + 1); } } m_path = path; } } /** * Initialize the scheme for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * @throws MalformedURIException if URI does not have a conformant scheme */ private void initializeScheme(String p_uriSpec) throws MalformedURIException { int uriSpecLen = p_uriSpec.length(); int index = 0; String scheme = null; char testChar = '\0'; while (index < uriSpecLen) { testChar = p_uriSpec.charAt(index); if (testChar == ':' || testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } scheme = p_uriSpec.substring(0, index); if (scheme.length() == 0) { throw new MalformedURIException("No scheme found in URI."); } else { setScheme(scheme); } } /** * Initialize the authority (either server or registry based) for this URI from a URI string * spec. * * @param p_uriSpec the URI specification (cannot be null) * @return true if the given string matched server or registry based authority */ private boolean initializeAuthority(String p_uriSpec) { int index = 0; int start = 0; int end = p_uriSpec.length(); char testChar = '\0'; String userinfo = null; // userinfo is everything up to @ if (p_uriSpec.indexOf('@', start) != -1) { while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '@') { break; } index++; } userinfo = p_uriSpec.substring(start, index); index++; } // host is everything up to last ':', or up to // and including ']' if followed by ':'. String host = null; start = index; boolean hasPort = false; if (index < end) { if (p_uriSpec.charAt(start) == '[') { int bracketIndex = p_uriSpec.indexOf(']', start); index = (bracketIndex != -1) ? bracketIndex : end; if (index + 1 < end && p_uriSpec.charAt(index + 1) == ':') { ++index; hasPort = true; } else { index = end; } } else { int colonIndex = p_uriSpec.lastIndexOf(':', end); index = (colonIndex > start) ? colonIndex : end; hasPort = (index != end); } } host = p_uriSpec.substring(start, index); int port = -1; if (host.length() > 0) { // port if (hasPort) { index++; start = index; while (index < end) { index++; } String portStr = p_uriSpec.substring(start, index); if (portStr.length() > 0) { // REVISIT: Remove this code. /** for (int i = 0; i < portStr.length(); i++) { if (!isDigit(portStr.charAt(i))) { throw new MalformedURIException( portStr + " is invalid. Port should only contain digits!"); } }**/ // REVISIT: Remove this code. // Store port value as string instead of integer. try { port = Integer.parseInt(portStr); if (port == -1) --port; } catch (NumberFormatException nfe) { port = -2; } } } } if (isValidServerBasedAuthority(host, port, userinfo)) { m_host = host; m_port = port; m_userinfo = userinfo; return true; } // Note: Registry based authority is being removed from a // new spec for URI which would obsolete RFC 2396. If the // spec is added to XML errata, processing of reg_name // needs to be removed. - mrglavas. else if (isValidRegistryBasedAuthority(p_uriSpec)) { m_regAuthority = p_uriSpec; return true; } return false; } /** * Determines whether the components host, port, and user info are valid as a server authority. * * @param host the host component of authority * @param port the port number component of authority * @param userinfo the user info component of authority * @return true if the given host, port, and userinfo compose a valid server authority */ private boolean isValidServerBasedAuthority(String host, int port, String userinfo) { // Check if the host is well formed. if (!isWellFormedAddress(host)) { return false; } // Check that port is well formed if it exists. // REVISIT: There's no restriction on port value ranges, but // perform the same check as in setPort to be consistent. Pass // in a string to this method instead of an integer. if (port < -1 || port > 65535) { return false; } // Check that userinfo is well formed if it exists. if (userinfo != null) { // Userinfo can contain alphanumerics, mark characters, escaped // and ';',':','&','=','+','$',',' int index = 0; int end = userinfo.length(); char testChar = '\0'; while (index < end) { testChar = userinfo.charAt(index); if (testChar == '%') { if (index + 2 >= end || !isHex(userinfo.charAt(index + 1)) || !isHex(userinfo.charAt(index + 2))) { return false; } index += 2; } else if (!isUserinfoCharacter(testChar)) { return false; } ++index; } } return true; } /** * Determines whether the given string is a registry based authority. * * @param authority the authority component of a URI * @return true if the given string is a registry based authority */ private boolean isValidRegistryBasedAuthority(String authority) { int index = 0; int end = authority.length(); char testChar; while (index < end) { testChar = authority.charAt(index); // check for valid escape sequence if (testChar == '%') { if (index + 2 >= end || !isHex(authority.charAt(index + 1)) || !isHex(authority.charAt(index + 2))) { return false; } index += 2; } // can check against path characters because the set // is the same except for '/' which we've already excluded. else if (!isPathCharacter(testChar)) { return false; } ++index; } return true; } /** * Initialize the path for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * @param p_nStartIndex the index to begin scanning from * @throws MalformedURIException if p_uriSpec violates syntax rules */ private void initializePath(String p_uriSpec, int p_nStartIndex) throws MalformedURIException { if (p_uriSpec == null) { throw new MalformedURIException( "Cannot initialize path from null string!"); } int index = p_nStartIndex; int start = p_nStartIndex; int end = p_uriSpec.length(); char testChar = '\0'; // path - everything up to query string or fragment if (start < end) { // RFC 2732 only allows '[' and ']' to appear in the opaque part. if (getScheme() == null || p_uriSpec.charAt(start) == '/') { // Scan path. // abs_path = "/" path_segments // rel_path = rel_segment [ abs_path ] while (index < end) { testChar = p_uriSpec.charAt(index); // check for valid escape sequence if (testChar == '%') { if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Path contains invalid escape sequence!"); } index += 2; } // Path segments cannot contain '[' or ']' since pchar // production was not changed by RFC 2732. else if (!isPathCharacter(testChar)) { if (testChar == '?' || testChar == '#') { break; } throw new MalformedURIException( "Path contains invalid character: " + testChar); } ++index; } } else { // Scan opaque part. // opaque_part = uric_no_slash *uric while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '?' || testChar == '#') { break; } // check for valid escape sequence if (testChar == '%') { if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Opaque part contains invalid escape sequence!"); } index += 2; } // If the scheme specific part is opaque, it can contain '[' // and ']'. uric_no_slash wasn't modified by RFC 2732, which // I've interpreted as an error in the spec, since the // production should be equivalent to (uric - '/'), and uric // contains '[' and ']'. - mrglavas else if (!isURICharacter(testChar)) { throw new MalformedURIException( "Opaque part contains invalid character: " + testChar); } ++index; } } } m_path = p_uriSpec.substring(start, index); // query - starts with ? and up to fragment or end if (testChar == '?') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '#') { break; } if (testChar == '%') { if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Query string contains invalid escape sequence!"); } index += 2; } else if (!isURICharacter(testChar)) { throw new MalformedURIException( "Query string contains invalid character: " + testChar); } index++; } m_queryString = p_uriSpec.substring(start, index); } // fragment - starts with # if (testChar == '#') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '%') { if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Fragment contains invalid escape sequence!"); } index += 2; } else if (!isURICharacter(testChar)) { throw new MalformedURIException( "Fragment contains invalid character: " + testChar); } index++; } m_fragment = p_uriSpec.substring(start, index); } } /** * Get the scheme for this URI. * * @return the scheme for this URI */ public String getScheme() { return m_scheme; } /** * Get the scheme-specific part for this URI (everything following the scheme and the first * colon). See RFC 2396 Section 5.2 for spec. * * @return the scheme-specific part for this URI */ public String getSchemeSpecificPart() { StringBuffer schemespec = new StringBuffer(); if (m_host != null || m_regAuthority != null) { schemespec.append("//"); // Server based authority. if (m_host != null) { if (m_userinfo != null) { schemespec.append(m_userinfo); schemespec.append('@'); } schemespec.append(m_host); if (m_port != -1) { schemespec.append(':'); schemespec.append(m_port); } } // Registry based authority. else { schemespec.append(m_regAuthority); } } if (m_path != null) { schemespec.append((m_path)); } if (m_queryString != null) { schemespec.append('?'); schemespec.append(m_queryString); } if (m_fragment != null) { schemespec.append('#'); schemespec.append(m_fragment); } return schemespec.toString(); } /** * Get the userinfo for this URI. * * @return the userinfo for this URI (null if not specified). */ public String getUserinfo() { return m_userinfo; } /** * Get the host for this URI. * * @return the host for this URI (null if not specified). */ public String getHost() { return m_host; } /** * Get the port for this URI. * * @return the port for this URI (-1 if not specified). */ public int getPort() { return m_port; } /** * Get the registry based authority for this URI. * * @return the registry based authority (null if not specified). */ public String getRegBasedAuthority() { return m_regAuthority; } /** * Get the path for this URI (optionally with the query string and fragment). * * @param p_includeQueryString if true (and query string is not null), then a "?" followed by the * query string will be appended * @param p_includeFragment if true (and fragment is not null), then a "#" followed by the * fragment will be appended * @return the path for this URI possibly including the query string and fragment */ public String getPath(boolean p_includeQueryString, boolean p_includeFragment) { StringBuffer pathString = new StringBuffer(m_path); if (p_includeQueryString && m_queryString != null) { pathString.append('?'); pathString.append(m_queryString); } if (p_includeFragment && m_fragment != null) { pathString.append('#'); pathString.append(m_fragment); } return pathString.toString(); } /** * Get the path for this URI. Note that the value returned is the path only and does not include * the query string or fragment. * * @return the path for this URI. */ public String getPath() { return m_path; } /** * Get the query string for this URI. * * @return the query string for this URI. Null is returned if there was no "?" in the URI spec, * empty string if there was a "?" but no query string following it. */ public String getQueryString() { return m_queryString; } /** * Get the fragment for this URI. * * @return the fragment for this URI. Null is returned if there was no "#" in the URI spec, empty * string if there was a "#" but no fragment following it. */ public String getFragment() { return m_fragment; } /** * Set the scheme for this URI. The scheme is converted to lowercase before it is set. * * @param p_scheme the scheme for this URI (cannot be null) * @throws MalformedURIException if p_scheme is not a conformant scheme name */ public void setScheme(String p_scheme) throws MalformedURIException { if (p_scheme == null) { throw new MalformedURIException( "Cannot set scheme from null string!"); } if (!isConformantSchemeName(p_scheme)) { throw new MalformedURIException("The scheme is not conformant."); } m_scheme = p_scheme.toLowerCase(); } /** * Set the userinfo for this URI. If a non-null value is passed in and the host value is null, * then an exception is thrown. * * @param p_userinfo the userinfo for this URI * @throws MalformedURIException if p_userinfo contains invalid characters */ public void setUserinfo(String p_userinfo) throws MalformedURIException { if (p_userinfo == null) { m_userinfo = null; return; } else { if (m_host == null) { throw new MalformedURIException( "Userinfo cannot be set when host is null!"); } // userinfo can contain alphanumerics, mark characters, escaped // and ';',':','&','=','+','$',',' int index = 0; int end = p_userinfo.length(); char testChar = '\0'; while (index < end) { testChar = p_userinfo.charAt(index); if (testChar == '%') { if (index + 2 >= end || !isHex(p_userinfo.charAt(index + 1)) || !isHex(p_userinfo.charAt(index + 2))) { throw new MalformedURIException( "Userinfo contains invalid escape sequence!"); } } else if (!isUserinfoCharacter(testChar)) { throw new MalformedURIException( "Userinfo contains invalid character:" + testChar); } index++; } } m_userinfo = p_userinfo; } /** *

        Set the host for this URI. If null is passed in, the userinfo field is also set to null and * the port is set to -1.

        *

        *

        Note: This method overwrites registry based authority if it previously existed in this * URI.

        * * @param p_host the host for this URI * @throws MalformedURIException if p_host is not a valid IP address or DNS hostname. */ public void setHost(String p_host) throws MalformedURIException { if (p_host == null || p_host.length() == 0) { if (p_host != null) { m_regAuthority = null; } m_host = p_host; m_userinfo = null; m_port = -1; return; } else if (!isWellFormedAddress(p_host)) { throw new MalformedURIException("Host is not a well formed address!"); } m_host = p_host; m_regAuthority = null; } /** * Set the port for this URI. -1 is used to indicate that the port is not specified, otherwise * valid port numbers are between 0 and 65535. If a valid port number is passed in and the host * field is null, an exception is thrown. * * @param p_port the port number for this URI * @throws MalformedURIException if p_port is not -1 and not a valid port number */ public void setPort(int p_port) throws MalformedURIException { if (p_port >= 0 && p_port <= 65535) { if (m_host == null) { throw new MalformedURIException( "Port cannot be set when host is null!"); } } else if (p_port != -1) { throw new MalformedURIException("Invalid port number!"); } m_port = p_port; } /** *

        Sets the registry based authority for this URI.

        *

        *

        Note: This method overwrites server based authority if it previously existed in this * URI.

        * * @param authority the registry based authority for this URI * @throws MalformedURIException it authority is not a well formed registry based authority */ public void setRegBasedAuthority(String authority) throws MalformedURIException { if (authority == null) { m_regAuthority = null; return; } // reg_name = 1*( unreserved | escaped | "$" | "," | // ";" | ":" | "@" | "&" | "=" | "+" ) else if (authority.length() < 1 || !isValidRegistryBasedAuthority(authority) || authority.indexOf('/') != -1) { throw new MalformedURIException("Registry based authority is not well formed."); } m_regAuthority = authority; m_host = null; m_userinfo = null; m_port = -1; } /** * Set the path for this URI. If the supplied path is null, then the query string and fragment are * set to null as well. If the supplied path includes a query string and/or fragment, these fields * will be parsed and set as well. Note that, for URIs following the "generic URI" syntax, the * path specified should start with a slash. For URIs that do not follow the generic URI syntax, * this method sets the scheme-specific part. * * @param p_path the path for this URI (may be null) * @throws MalformedURIException if p_path contains invalid characters */ public void setPath(String p_path) throws MalformedURIException { if (p_path == null) { m_path = null; m_queryString = null; m_fragment = null; } else { initializePath(p_path, 0); } } /** * Append to the end of the path of this URI. If the current path does not end in a slash and the * path to be appended does not begin with a slash, a slash will be appended to the current path * before the new segment is added. Also, if the current path ends in a slash and the new segment * begins with a slash, the extra slash will be removed before the new segment is appended. * * @param p_addToPath the new segment to be added to the current path * @throws MalformedURIException if p_addToPath contains syntax errors */ public void appendPath(String p_addToPath) throws MalformedURIException { if (p_addToPath == null || p_addToPath.trim().length() == 0) { return; } if (!isURIString(p_addToPath)) { throw new MalformedURIException( "Path contains invalid character!"); } if (m_path == null || m_path.trim().length() == 0) { if (p_addToPath.startsWith("/")) { m_path = p_addToPath; } else { m_path = "/" + p_addToPath; } } else if (m_path.endsWith("/")) { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath.substring(1)); } else { m_path = m_path.concat(p_addToPath); } } else { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath); } else { m_path = m_path.concat("/" + p_addToPath); } } } /** * Set the query string for this URI. A non-null value is valid only if this is an URI conforming * to the generic URI syntax and the path value is not null. * * @param p_queryString the query string for this URI * @throws MalformedURIException if p_queryString is not null and this URI does not conform to the * generic URI syntax or if the path is null */ public void setQueryString(String p_queryString) throws MalformedURIException { if (p_queryString == null) { m_queryString = null; } else if (!isGenericURI()) { throw new MalformedURIException( "Query string can only be set for a generic URI!"); } else if (this.m_path == null) { throw new MalformedURIException( "Query string cannot be set when path is null!"); } else if (!isURIString(p_queryString)) { throw new MalformedURIException( "Query string contains invalid character!"); } else { m_queryString = p_queryString; } } /** * Set the fragment for this URI. A non-null value is valid only if this is a URI conforming to * the generic URI syntax and the path value is not null. * * @param p_fragment the fragment for this URI * @throws MalformedURIException if p_fragment is not null and this URI does not conform to the * generic URI syntax or if the path is null */ public void setFragment(String p_fragment) throws MalformedURIException { if (p_fragment == null) { m_fragment = null; } else if (!isGenericURI()) { throw new MalformedURIException( "Fragment can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( "Fragment cannot be set when path is null!"); } else if (!isURIString(p_fragment)) { throw new MalformedURIException( "Fragment contains invalid character!"); } else { m_fragment = p_fragment; } } /** * Determines if the passed-in Object is equivalent to this URI. * * @param p_test the Object to test for equality. * @return true if p_test is a URI with all values equal to this URI, false otherwise */ public boolean equals(Object p_test) { if (p_test instanceof URI) { URI testURI = (URI)p_test; if (((m_scheme == null && testURI.m_scheme == null) || (m_scheme != null && testURI.m_scheme != null && m_scheme.equals(testURI.m_scheme))) && ((m_userinfo == null && testURI.m_userinfo == null) || (m_userinfo != null && testURI.m_userinfo != null && m_userinfo.equals(testURI.m_userinfo))) && ((m_host == null && testURI.m_host == null) || (m_host != null && testURI.m_host != null && m_host.equals(testURI.m_host))) && m_port == testURI.m_port && ((m_path == null && testURI.m_path == null) || (m_path != null && testURI.m_path != null && m_path.equals(testURI.m_path))) && ((m_queryString == null && testURI.m_queryString == null) || (m_queryString != null && testURI.m_queryString != null && m_queryString.equals(testURI.m_queryString))) && ((m_fragment == null && testURI.m_fragment == null) || (m_fragment != null && testURI.m_fragment != null && m_fragment.equals(testURI.m_fragment)))) { return true; } } return false; } /** * Returns a hash-code value for this URI. The hash code is based upon all of the URI's * components, and satisfies the general contract of the {@link Object#hashCode() * Object.hashCode} method.

        * * @return A hash-code value for this URI */ public int hashCode() { return toString().hashCode(); } /** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ public String toString() { StringBuffer uriSpecString = new StringBuffer(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); } uriSpecString.append(getSchemeSpecificPart()); return uriSpecString.toString(); } /** * Get the indicator as to whether this URI uses the "generic URI" syntax. * * @return true if this URI uses the "generic URI" syntax, false otherwise */ public boolean isGenericURI() { // presence of the host (whether valid or empty) means // double-slashes which means generic uri return (m_host != null); } /** * Determine whether a scheme conforms to the rules for a scheme name. A scheme is conformant if * it starts with an alphanumeric, and contains only alphanumerics, '+','-' and '.'. * * @return true if the scheme is conformant, false otherwise */ public static boolean isConformantSchemeName(String p_scheme) { if (p_scheme == null || p_scheme.trim().length() == 0) { return false; } if (!isAlpha(p_scheme.charAt(0))) { return false; } char testChar; int schemeLength = p_scheme.length(); for (int i = 1; i < schemeLength; ++i) { testChar = p_scheme.charAt(i); if (!isSchemeCharacter(testChar)) { return false; } } return true; } /** * Determine whether a string is syntactically capable of representing a valid IPv4 address, IPv6 * reference or the domain name of a network host. A valid IPv4 address consists of four decimal * digit groups separated by a '.'. Each group must consist of one to three digits. See RFC 2732 * Section 3, and RFC 2373 Section 2.2, for the definition of IPv6 references. A hostname consists * of domain labels (each of which must begin and end with an alphanumeric but may contain '-') * separated & by a '.'. See RFC 2396 Section 3.2.2. * * @return true if the string is a syntactically valid IPv4 address, IPv6 reference or hostname */ public static boolean isWellFormedAddress(String address) { if (address == null) { return false; } int addrLength = address.length(); if (addrLength == 0) { return false; } // Check if the host is a valid IPv6reference. if (address.startsWith("[")) { return isWellFormedIPv6Reference(address); } // Cannot start with a '.', '-', or end with a '-'. if (address.startsWith(".") || address.startsWith("-") || address.endsWith("-")) { return false; } // rightmost domain label starting with digit indicates IP address // since top level domain label can only start with an alpha // see RFC 2396 Section 3.2.2 int index = address.lastIndexOf('.'); if (address.endsWith(".")) { index = address.substring(0, index).lastIndexOf('.'); } if (index + 1 < addrLength && isDigit(address.charAt(index + 1))) { return isWellFormedIPv4Address(address); } else { // hostname = *( domainlabel "." ) toplabel [ "." ] // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum // toplabel = alpha | alpha *( alphanum | "-" ) alphanum // RFC 2396 states that hostnames take the form described in // RFC 1034 (Section 3) and RFC 1123 (Section 2.1). According // to RFC 1034, hostnames are limited to 255 characters. if (addrLength > 255) { return false; } // domain labels can contain alphanumerics and '-" // but must start and end with an alphanumeric char testChar; int labelCharCount = 0; for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if (!isAlphanum(address.charAt(i - 1))) { return false; } if (i + 1 < addrLength && !isAlphanum(address.charAt(i + 1))) { return false; } labelCharCount = 0; } else if (!isAlphanum(testChar) && testChar != '-') { return false; } // RFC 1034: Labels must be 63 characters or less. else if (++labelCharCount > 63) { return false; } } } return true; } /** *

        Determines whether a string is an IPv4 address as defined by RFC 2373, and under the further * constraint that it must be a 32-bit address. Though not expressed in the grammar, in order to * satisfy the 32-bit address constraint, each segment of the address cannot be greater than 255 * (8 bits of information).

        *

        *

        IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT

        * * @return true if the string is a syntactically valid IPv4 address */ public static boolean isWellFormedIPv4Address(String address) { int addrLength = address.length(); char testChar; int numDots = 0; int numDigits = 0; // make sure that 1) we see only digits and dot separators, 2) that // any dot separator is preceded and followed by a digit and // 3) that we find 3 dots // // RFC 2732 amended RFC 2396 by replacing the definition // of IPv4address with the one defined by RFC 2373. - mrglavas // // IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT // // One to three digits must be in each segment. for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if ((i > 0 && !isDigit(address.charAt(i - 1))) || (i + 1 < addrLength && !isDigit(address.charAt(i + 1)))) { return false; } numDigits = 0; if (++numDots > 3) { return false; } } else if (!isDigit(testChar)) { return false; } // Check that that there are no more than three digits // in this segment. else if (++numDigits > 3) { return false; } // Check that this segment is not greater than 255. else if (numDigits == 3) { char first = address.charAt(i - 2); char second = address.charAt(i - 1); if (!(first < '2' || (first == '2' && (second < '5' || (second == '5' && testChar <= '5'))))) { return false; } } } return (numDots == 3); } /** *

        Determines whether a string is an IPv6 reference as defined by RFC 2732, where IPv6address * is defined in RFC 2373. The IPv6 address is parsed according to Section 2.2 of RFC 2373, with * the additional constraint that the address be composed of 128 bits of information.

        *

        *

        IPv6reference = "[" IPv6address "]"

        *

        *

        Note: The BNF expressed in RFC 2373 Appendix B does not accurately describe section 2.2, and * was in fact removed from RFC 3513, the successor of RFC 2373.

        * * @return true if the string is a syntactically valid IPv6 reference */ public static boolean isWellFormedIPv6Reference(String address) { int addrLength = address.length(); int index = 1; int end = addrLength - 1; // Check if string is a potential match for IPv6reference. if (!(addrLength > 2 && address.charAt(0) == '[' && address.charAt(end) == ']')) { return false; } // Counter for the number of 16-bit sections read in the address. int [] counter = new int[1]; // Scan hex sequence before possible '::' or IPv4 address. index = scanHexSequence(address, index, end, counter); if (index == -1) { return false; } // Address must contain 128-bits of information. else if (index == end) { return (counter[0] == 8); } if (index + 1 < end && address.charAt(index) == ':') { if (address.charAt(index + 1) == ':') { // '::' represents at least one 16-bit group of zeros. if (++counter[0] > 8) { return false; } index += 2; // Trailing zeros will fill out the rest of the address. if (index == end) { return true; } } // If the second character wasn't ':', in order to be valid, // the remainder of the string must match IPv4Address, // and we must have read exactly 6 16-bit groups. else { return (counter[0] == 6) && isWellFormedIPv4Address(address.substring(index + 1, end)); } } else { return false; } // 3. Scan hex sequence after '::'. int prevCount = counter[0]; index = scanHexSequence(address, index, end, counter); // We've either reached the end of the string, the address ends in // an IPv4 address, or it is invalid. scanHexSequence has already // made sure that we have the right number of bits. return (index == end) || (index != -1 && isWellFormedIPv4Address( address.substring((counter[0] > prevCount) ? index + 1 : index, end))); } /** * Helper method for isWellFormedIPv6Reference which scans the hex sequences of an IPv6 address. * It returns the index of the next character to scan in the address, or -1 if the string cannot * match a valid IPv6 address. * * @param address the string to be scanned * @param index the beginning index (inclusive) * @param end the ending index (exclusive) * @param counter a counter for the number of 16-bit sections read in the address * @return the index of the next character to scan, or -1 if the string cannot match a valid IPv6 * address */ private static int scanHexSequence(String address, int index, int end, int [] counter) { char testChar; int numDigits = 0; int start = index; // Trying to match the following productions: // hexseq = hex4 *( ":" hex4) // hex4 = 1*4HEXDIG for (; index < end; ++index) { testChar = address.charAt(index); if (testChar == ':') { // IPv6 addresses are 128-bit, so there can be at most eight sections. if (numDigits > 0 && ++counter[0] > 8) { return -1; } // This could be '::'. if (numDigits == 0 || ((index + 1 < end) && address.charAt(index + 1) == ':')) { return index; } numDigits = 0; } // This might be invalid or an IPv4address. If it's potentially an IPv4address, // backup to just after the last valid character that matches hexseq. else if (!isHex(testChar)) { if (testChar == '.' && numDigits < 4 && numDigits > 0 && counter[0] <= 6) { int back = index - numDigits - 1; return (back >= start) ? back : (back + 1); } return -1; } // There can be at most 4 hex digits per group. else if (++numDigits > 4) { return -1; } } return (numDigits > 0 && ++counter[0] <= 8) ? end : -1; } /** * Determine whether a char is a digit. * * @return true if the char is betweeen '0' and '9', false otherwise */ private static boolean isDigit(char p_char) { return p_char >= '0' && p_char <= '9'; } /** * Determine whether a character is a hexadecimal character. * * @return true if the char is betweeen '0' and '9', 'a' and 'f' or 'A' and 'F', false otherwise */ private static boolean isHex(char p_char) { return (p_char <= 'f' && (fgLookupTable[p_char] & ASCII_HEX_CHARACTERS) != 0); } /** * Determine whether a char is an alphabetic character: a-z or A-Z * * @return true if the char is alphabetic, false otherwise */ private static boolean isAlpha(char p_char) { return ((p_char >= 'a' && p_char <= 'z') || (p_char >= 'A' && p_char <= 'Z')); } /** * Determine whether a char is an alphanumeric: 0-9, a-z or A-Z * * @return true if the char is alphanumeric, false otherwise */ private static boolean isAlphanum(char p_char) { return (p_char <= 'z' && (fgLookupTable[p_char] & MASK_ALPHA_NUMERIC) != 0); } /** * Determine whether a char is a URI character (reserved or unreserved, not including '%' for * escaped octets). * * @return true if the char is a URI character, false otherwise */ private static boolean isURICharacter(char p_char) { return (p_char <= '~' && (fgLookupTable[p_char] & MASK_URI_CHARACTER) != 0); } /** * Determine whether a char is a scheme character. * * @return true if the char is a scheme character, false otherwise */ private static boolean isSchemeCharacter(char p_char) { return (p_char <= 'z' && (fgLookupTable[p_char] & MASK_SCHEME_CHARACTER) != 0); } /** * Determine whether a char is a userinfo character. * * @return true if the char is a userinfo character, false otherwise */ private static boolean isUserinfoCharacter(char p_char) { return (p_char <= 'z' && (fgLookupTable[p_char] & MASK_USERINFO_CHARACTER) != 0); } /** * Determine whether a char is a path character. * * @return true if the char is a path character, false otherwise */ private static boolean isPathCharacter(char p_char) { return (p_char <= '~' && (fgLookupTable[p_char] & MASK_PATH_CHARACTER) != 0); } /** * Determine whether a given string contains only URI characters (also * called "uric" in RFC 2396). uric consist of all reserved * characters, unreserved characters and escaped characters. * * @return true if the string is comprised of uric, false otherwise */ private static boolean isURIString(String p_uric) { if (p_uric == null) { return false; } int end = p_uric.length(); char testChar = '\0'; for (int i = 0; i < end; i++) { testChar = p_uric.charAt(i); if (testChar == '%') { if (i + 2 >= end || !isHex(p_uric.charAt(i + 1)) || !isHex(p_uric.charAt(i + 2))) { return false; } else { i += 2; continue; } } if (!isURICharacter(testChar)) { return false; } } return true; } } ./src/org/apache/axis2/databinding/types/Year.java0000664000175000017500000001156211767656530021212 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; import java.io.Serializable; import java.text.NumberFormat; /** * Implementation of the XML Schema type gYear * * @see XML Schema 3.2.11 */ public class Year implements Serializable { private static final long serialVersionUID = 7498876120334857019L; int year; String timezone = null; /** Constructs a Year with the given values No timezone is specified */ public Year(int year) throws NumberFormatException { setValue(year); } /** * Constructs a Year with the given values, including a timezone string The timezone is * validated but not used. */ public Year(int year, String timezone) throws NumberFormatException { setValue(year, timezone); } /** Construct a Year from a String in the format [-]CCYY[timezone] */ public Year(String source) throws NumberFormatException { int negative = 0; if (source.charAt(0) == '-') { negative = 1; } if (source.length() < (4 + negative)) { throw new NumberFormatException(); //Messages.getMessage("badYear00")); } // calculate how many more than 4 digits (if any) in the year int pos = 4 + negative; // skip minus sign if present while (pos < source.length() && Character.isDigit(source.charAt(pos))) { ++pos; } setValue(Integer.parseInt(source.substring(0, pos)), source.substring(pos)); } public int getYear() { return year; } public void setYear(int year) { // validate year, more than 4 digits are allowed! if (year == 0) { throw new NumberFormatException(); //Messages.getMessage("badYear00")); } this.year = year; } public String getTimezone() { return timezone; } public void setTimezone(String timezone) { // validate timezone if (timezone != null && timezone.length() > 0) { // Format [+/-]HH:MM if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) { if (timezone.length() != 6 || !Character.isDigit(timezone.charAt(1)) || !Character.isDigit(timezone.charAt(2)) || timezone.charAt(3) != ':' || !Character.isDigit(timezone.charAt(4)) || !Character.isDigit(timezone.charAt(5))) throw new NumberFormatException(); //Messages.getMessage("badTimezone00")); } else if (!timezone.equals("Z")) { throw new NumberFormatException(); // Messages.getMessage("badTimezone00")); } // if we got this far, its good this.timezone = timezone; } } public void setValue(int year, String timezone) throws NumberFormatException { setYear(year); setTimezone(timezone); } public void setValue(int year) throws NumberFormatException { setYear(year); } public String toString() { // use NumberFormat to ensure leading zeros NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); // year nf.setMinimumIntegerDigits(4); String s = nf.format(year); // timezone if (timezone != null) { s = s + timezone; } return s; } public boolean equals(Object obj) { if (!(obj instanceof Year)) return false; Year other = (Year)obj; if (this == obj) return true; boolean equals = (this.year == other.year); if (timezone != null) { equals = equals && timezone.equals(other.timezone); } return equals; } /** * Return the value of year XORed with the hashCode of timezone iff one is defined. * * @return an int value */ public int hashCode() { return null == timezone ? year : year ^ timezone.hashCode(); } } ./src/org/apache/axis2/databinding/types/NormalizedString.java0000664000175000017500000000641511767656530023606 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.types; /** * Custom class for supporting XSD data type NormalizedString. normalizedString represents white * space normalized strings. The base type of normalizedString is string. * * @see XML Schema Part 2: Datatypes * 3.3.1 */ public class NormalizedString implements java.io.Serializable { private static final long serialVersionUID = -290878151870399401L; String m_value; // JAX-RPC maps xsd:string to java.lang.String public NormalizedString() { super(); } /** * ctor for NormalizedString * * @param stValue is the String value * @throws IllegalArgumentException if invalid format */ public NormalizedString(String stValue) throws IllegalArgumentException { setValue(stValue); } /** * validates the data and sets the value for the object. * * @param stValue String value * @throws IllegalArgumentException if invalid format */ public void setValue(String stValue) throws IllegalArgumentException { if (!NormalizedString.isValid(stValue)) throw new IllegalArgumentException( // Messages.getMessage("badNormalizedString00") + " data=[" + stValue + "]"); m_value = stValue; } public String toString() { return m_value; } public int hashCode() { return m_value.hashCode(); } /** * validate the value against the xsd definition for the object *

        * The value space of normalizedString is the set of strings that do not contain the carriage * return (#xD), line feed (#xA) nor tab (#x9) characters. The lexical space of normalizedString * is the set of strings that do not contain the carriage return (#xD) nor tab (#x9) * characters. * * @param stValue the String to test * @return Returns true if valid normalizedString. */ public static boolean isValid(String stValue) { int scan; for (scan = 0; scan < stValue.length(); scan++) { char cDigit = stValue.charAt(scan); switch (cDigit) { case 0x09: case 0x0A: case 0x0D: return false; default: break; } } return true; } public boolean equals(Object object) { String s1 = object.toString(); return s1.equals(m_value); } } ./src/org/apache/axis2/databinding/i18n/0000775000175000017500000000000011767656530017055 5ustar brianbrian./src/org/apache/axis2/databinding/i18n/resource.properties0000664000175000017500000000340511767656530023024 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # # Translation instructions. # 1. Each message line is of the form key=value. # Translate the value, DO NOT translate the key. # 2. The messages may contain arguments that will be filled in # by the runtime. These are of the form: {0}, {1}, etc. # These must appear as is in the message, though the order # may be changed to support proper language syntax. # 3. If a single quote character is to appear in the resulting # message, it must appear in this file as two consecutive # single quote characters. # 4. Lines beginning with "#" (like this one) are comment lines # and may contain translation instructions. They need not be # translated unless your translated file, rather than this file, # will serve as a base for other translators. ################## Converter Util ################################################# converter.cannotGenerate=Cannot generate object for {0} converter.cannotConvert=No way to convert {0} converter.cannotParse=Unable to parse ''{0}''./src/org/apache/axis2/databinding/i18n/ADBMessages.java0000664000175000017500000001342611767656530022004 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding.i18n; import org.apache.axis2.i18n.MessageBundle; import org.apache.axis2.i18n.MessagesConstants; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; public class ADBMessages { private static Class thisClass = ADBMessages.class; private static final String PROJECT_NAME = MessagesConstants.projectName; private static final String RESOURCE_NAME = MessagesConstants.resourceName; private static final Locale LOCAL = MessagesConstants.locale; private static final String PACKAGE_NAME = getPackage(thisClass.getName()); private static final ClassLoader CLASS_LOADER = thisClass.getClassLoader(); private static final ResourceBundle PARENT = (MessagesConstants.rootPackageName.equals(PACKAGE_NAME)) ? null : MessagesConstants.rootBundle; /** ** NO NEED TO CHANGE ANYTHING BELOW **** */ private static final MessageBundle messageBundle = new MessageBundle(PROJECT_NAME, PACKAGE_NAME, RESOURCE_NAME, LOCAL, CLASS_LOADER, PARENT); /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @return Returns the formatted message. */ public static String getMessage(String key) throws MissingResourceException { return messageBundle.getMessage(key); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0) throws MissingResourceException { return messageBundle.getMessage(key, arg0); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getMessage(String key, String[] args) throws MissingResourceException { return messageBundle.getMessage(key, args); } public static ResourceBundle getResourceBundle() { return messageBundle.getResourceBundle(); } public static MessageBundle getMessageBundle() { return messageBundle; } private static String getPackage(String name) { return name.substring(0, name.lastIndexOf('.')).intern(); } } ./src/org/apache/axis2/databinding/ADBException.java0000664000175000017500000000273011767656530021410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import javax.xml.stream.Location; /** * uses to handle ADB exceptions */ public class ADBException extends DataBindException { public ADBException() { } public ADBException(String string) { super(string); } public ADBException(Throwable throwable) { super(throwable); } public ADBException(String string, Throwable throwable) { super(string, throwable); } public ADBException(String string, Location location, Throwable throwable) { super(string, location, throwable); } public ADBException(String string, Location location) { super(string, location); } } ./src/org/apache/axis2/databinding/ADBHelperDataSource.java0000664000175000017500000001507011767656530022645 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.databinding; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.StAXUtils; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; public abstract class ADBHelperDataSource implements OMDataSourceExt { protected QName parentQName; protected Object bean; protected String helperClassName; HashMap map = null; // Map of properties /** * Constructor taking in an ADBBean * * @param bean */ protected ADBHelperDataSource(Object bean, QName parentQName, String helperClassName) { this.bean = bean; this.parentQName = parentQName; this.helperClassName = helperClassName; } /** * @param output * @param format * @throws javax.xml.stream.XMLStreamException * * @see OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat) */ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); serialize(xmlStreamWriter); xmlStreamWriter.flush(); } /** * @param writer * @param format * @throws XMLStreamException * @see OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat) */ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); serialize(xmlStreamWriter); xmlStreamWriter.flush(); } /** * This needs to be generated inside the ADB bean * * @param xmlWriter * @throws XMLStreamException * @see OMDataSource#serialize(javax.xml.stream.XMLStreamWriter) */ public abstract void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException; /** * @throws XMLStreamException * @see org.apache.axiom.om.OMDataSource#getReader() */ public XMLStreamReader getReader() throws XMLStreamException { // since only ADBBeans related to elements can be serialized try { Class helperClass = Class.forName(helperClassName); Method method = helperClass.getMethod("getPullParser", new Class[] { Object.class, QName.class }); return (XMLStreamReader)method.invoke(null, new Object[] { bean, parentQName }); } catch (ClassNotFoundException e) { throw new XMLStreamException(e); } catch (NoSuchMethodException e) { throw new XMLStreamException(e); } catch (IllegalAccessException e) { throw new XMLStreamException(e); } catch (InvocationTargetException e) { throw new XMLStreamException(e); } } /** * Returns the backing Object. * @return Object */ public Object getObject() { return bean; } /** * Returns true if reading the backing object is destructive. * An example of an object with a destructive read is an InputSteam. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when reading the OMDataSourceExt. * @return boolean */ public boolean isDestructiveRead() { return false; } /** * Returns true if writing the backing object is destructive. * An example of an object with a destructive write is an InputStream. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when writing the OMDataSourceExt. * @return boolean */ public boolean isDestructiveWrite() { return false; } /** * Returns a InputStream representing the xml data * @param encoding String encoding of InputStream * @return InputStream */ public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException { return new ByteArrayInputStream(getXMLBytes(encoding)); } /** * Returns a byte[] representing the xml data * @param encoding String encoding of InputStream * @return byte[] * @see getXMLInputStream */ public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); try { serialize(baos, format); } catch (XMLStreamException e) { new OMException(e); } return baos.toByteArray(); } /** * Close the DataSource and free its resources. */ public void close() { parentQName = null; bean = null; } public OMDataSourceExt copy() { return null; } public Object getProperty(String key) { if (map == null) { return null; } return map.get(key); } public Object setProperty(String key, Object value) { if (map == null) { map = new HashMap(); } return map.put(key, value); } public boolean hasProperty(String key) { if (map == null) { return false; } return map.containsKey(key); } } ./src/org/apache/axis2/i18n/0000775000175000017500000000000011767656530014611 5ustar brianbrian./src/org/apache/axis2/i18n/RB.java0000664000175000017500000006346311767656530015773 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.i18n; import java.io.IOException; import java.io.InputStream; import java.text.MessageFormat; import java.util.Enumeration; import java.util.Hashtable; import java.util.Locale; import java.util.MissingResourceException; import java.util.Properties; /** * CURRENTLY NOT USED * KEEPING FOR REFERENCE 9/19/2002 *

        *

        Wrapper class for resource bundles. Property files are used to store * resource strings, which are the only types of resources available. * Property files can inherit properties from other files so that * a base property file can be used and a small number of properties * can be over-ridden by another property file. For example you may * create an english version of a resource file named "resource.properties". * You then decide that the British English version of all of the properties * except one are the same, so there is no need to redefine all of the * properties in "resource_en_GB", just the one that is different.

        *

        The property file lookup searches for classes with various suffixes * on the basis if the desired local and the current default local * (as returned by Local.getDefault()). As property files are found the * property values are merged so that inheritance is preserved.

        *

        The order of searching is:

        * * basename + "_" + langage + "_" + country + "_" + variant * basename + "_" + langage + "_" + country * basename + "_" + langage * basename + "_" + defaultLanguage + "_" + defaultCountry + "_" + defaultVariant * basename + "_" + defaultLanguage + "_" + defaultCountry * basename + "_" + defaultLanguage * basename * *

        The basename is the name of the property file without the ".properties" * extension.

        *

        Properties will be cached for performance.

        *

        Property values stored in the property files can also contain dynamic * variables. Any dynamic variable defined in PropertiesUtil.getVariableValue() * can be used (such as {date}), as well as arguments in the form {0}, {1}, etc. * Argument values are specified in the various overloaded getString() methods.

        */ public class RB { // The static cache of properties. The key is the basename + the local + // the default local and the element is the Properties object containing // the resources static Hashtable propertyCache = new Hashtable(); // The default base name public static final String BASE_NAME = "resource"; // The property file extension public static final String PROPERTY_EXT = ".properties"; // The name of the current base property file (with extension) protected String basePropertyFileName; // The properties for the current resource bundle protected Properties resourceProperties; /** * Construct a new RB * * @param name The name of the property file without the ".properties" extension */ public RB(String name) throws MissingResourceException { this(null, name, null); } /** * Construct a new RB * * @param caller The calling object. This is used to get the package name * to further construct the basename as well as to get the proper ClassLoader * @param name The name of the property file without the ".properties" extension */ public RB(Object caller, String name) throws MissingResourceException { this(caller, name, null); } /** * Construct a new RB * * @param caller The calling object. This is used to get the package name * to further construct the basename as well as to get the proper ClassLoader * @param name The name of the property file without the ".properties" extension * @param locale The locale */ public RB(Object caller, String name, Locale locale) throws MissingResourceException { ClassLoader cl = null; if (caller != null) { Class c; if (caller instanceof Class) { c = (Class) caller; } else { c = caller.getClass(); } // Get the appropriate class loader cl = c.getClassLoader(); if (name.indexOf("/") == -1) { // Create the full basename only if not given String fullName = c.getName(); int pos = fullName.lastIndexOf("."); if (pos > 0) { name = fullName.substring(0, pos + 1).replace('.', '/') + name; } } } else { // Try the shared default properties file... if (name.indexOf("/") == -1) { name = "org/apache/axis2/default-resource"; } } Locale defaultLocale = Locale.getDefault(); // If the locale given is the same as the default locale, ignore it if (locale != null) { if (locale.equals(defaultLocale)) { locale = null; } } // Load the properties. If no property files exist then a // MissingResourceException will be thrown loadProperties(name, cl, locale, defaultLocale); } /** * Gets a string message from the resource bundle for the given key * * @param key The resource key * @return The message */ public String getString(String key) throws MissingResourceException { return getString(key, (Object[]) null); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The message */ public String getString(String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getString(key, o); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The message */ public String getString(String key, Object arg0, Object arg1) throws MissingResourceException { Object[] o = new Object[2]; o[0] = arg0; o[1] = arg1; return getString(key, o); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {1} * @return The message */ public String getString(String key, Object arg0, Object arg1, Object arg2) throws MissingResourceException { Object[] o = new Object[3]; o[0] = arg0; o[1] = arg1; o[2] = arg2; return getString(key, o); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param array An array of objects to place in corresponding variables * @return The message */ public String getString(String key, Object[] array) throws MissingResourceException { String msg = null; if (resourceProperties != null) { msg = resourceProperties.getProperty(key); } if (msg == null) { throw new MissingResourceException("Cannot find resource key \"" + key + "\" in base name " + basePropertyFileName, basePropertyFileName, key); } msg = MessageFormat.format(msg, array); return msg; } protected void loadProperties(String basename, ClassLoader loader, Locale locale, Locale defaultLocale) throws MissingResourceException { // Check the cache first String loaderName = ""; if (loader != null) { loaderName = ":" + loader.hashCode(); } String cacheKey = basename + ":" + locale + ":" + defaultLocale + loaderName; Properties p = (Properties) propertyCache.get(cacheKey); basePropertyFileName = basename + PROPERTY_EXT; if (p == null) { // The properties were not found in the cache. Search the given locale // first if (locale != null) { p = loadProperties(basename, loader, locale, p); } // Search the default locale if (defaultLocale != null) { p = loadProperties(basename, loader, defaultLocale, p); } // Search for the basename p = merge(p, loadProperties(basePropertyFileName, loader)); if (p == null) { throw new MissingResourceException("Cannot find resource for base name " + basePropertyFileName, basePropertyFileName, ""); } // Cache the properties propertyCache.put(cacheKey, p); } resourceProperties = p; } protected Properties loadProperties(String basename, ClassLoader loader, Locale locale, Properties props) { String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); if (variant != null) { if (variant.trim().length() == 0) { variant = null; } } if (language != null) { if (country != null) { if (variant != null) { props = merge(props, loadProperties( basename + "_" + language + "_" + country + "_" + variant + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + "_" + country + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + PROPERTY_EXT, loader)); } return props; } protected Properties loadProperties(String resname, ClassLoader loader) { Properties props = null; // Attempt to open and load the properties InputStream in = null; try { if (loader != null) { in = loader.getResourceAsStream(resname); } // Either we're using the system class loader or we didn't find the // resource using the given class loader if (in == null) { in = ClassLoader.getSystemResourceAsStream(resname); } if (in != null) { props = new Properties(); try { props.load(in); } catch (IOException ex) { // On error, clear the props props = null; } } } finally { if (in != null) { try { in.close(); } catch (Exception ex) { // Ignore error on close } } } return props; } /** * Merge two Properties objects */ protected Properties merge(Properties p1, Properties p2) { if ((p1 == null) && (p2 == null)) { return null; } else if (p1 == null) { return p2; } else if (p2 == null) { return p1; } // Now merge. p1 takes precedence Enumeration enumeration = p2.keys(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); if (p1.getProperty(key) == null) { p1.put(key, p2.getProperty(key)); } } return p1; } /** * Get the underlying properties */ public Properties getProperties() { return resourceProperties; } // STATIC ACCESSORS /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @return The formatted message */ public static String getString(Object caller, String key) throws MissingResourceException { return getMessage(caller, BASE_NAME, null, key, null); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The formatted message */ public static String getString(Object caller, String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getMessage(caller, BASE_NAME, null, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The formatted message */ public static String getString(Object caller, String key, Object arg0, Object arg1) throws MissingResourceException { Object[] o = new Object[2]; o[0] = arg0; o[1] = arg1; return getMessage(caller, BASE_NAME, null, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return The formatted message */ public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2) throws MissingResourceException { Object[] o = new Object[3]; o[0] = arg0; o[1] = arg1; o[2] = arg2; return getMessage(caller, BASE_NAME, null, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return The formatted message */ public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2, Object arg3) throws MissingResourceException { Object[] o = new Object[4]; o[0] = arg0; o[1] = arg1; o[2] = arg2; o[3] = arg3; return getMessage(caller, BASE_NAME, null, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return Returns the formatted message. */ public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) throws MissingResourceException { Object[] o = new Object[5]; o[0] = arg0; o[1] = arg1; o[2] = arg2; o[3] = arg3; o[4] = arg4; return getMessage(caller, BASE_NAME, null, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getString(Object caller, String key, Object[] args) throws MissingResourceException { return getMessage(caller, BASE_NAME, null, key, args); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @return The formatted message */ public static String getString(Object caller, Locale locale, String key) throws MissingResourceException { return getMessage(caller, BASE_NAME, locale, key, null); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The formatted message */ public static String getString(Object caller, Locale locale, String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getMessage(caller, BASE_NAME, locale, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The formatted message */ public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1) throws MissingResourceException { Object[] o = new Object[2]; o[0] = arg0; o[1] = arg1; return getMessage(caller, BASE_NAME, locale, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return The formatted message */ public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2) throws MissingResourceException { Object[] o = new Object[3]; o[0] = arg0; o[1] = arg1; o[2] = arg2; return getMessage(caller, BASE_NAME, locale, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return The formatted message */ public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2, Object arg3) throws MissingResourceException { Object[] o = new Object[4]; o[0] = arg0; o[1] = arg1; o[2] = arg2; o[3] = arg3; return getMessage(caller, BASE_NAME, locale, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return Returns the formatted message. */ public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) throws MissingResourceException { Object[] o = new Object[5]; o[0] = arg0; o[1] = arg1; o[2] = arg2; o[3] = arg3; o[4] = arg4; return getMessage(caller, BASE_NAME, locale, key, o); } /** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getString(Object caller, Locale locale, String key, Object[] args) throws MissingResourceException { return getMessage(caller, BASE_NAME, locale, key, args); } // Workhorse that does the resource loading and key lookup public static String getMessage(Object caller, String basename, Locale locale, String key, Object[] args) throws MissingResourceException { String msg = null; MissingResourceException firstEx = null; String fullName = null; Class curClass = null; boolean didNull = false; if (caller != null) { if (caller instanceof Class) { curClass = (Class) caller; } else { curClass = caller.getClass(); } } while (msg == null) { // Get the full name of the resource if (curClass != null) { // Create the full basename String pkgName = curClass.getName(); int pos = pkgName.lastIndexOf("."); if (pos > 0) { fullName = pkgName.substring(0, pos + 1).replace('.', '/') + basename; } else { fullName = basename; } } else { fullName = basename; } try { RB rb = new RB(caller, fullName, locale); msg = rb.getString(key, args); } catch (MissingResourceException ex) { if (curClass == null) { throw ex; } // Save the first exception if (firstEx == null) { firstEx = ex; } // Get the superclass curClass = curClass.getSuperclass(); if (curClass == null) { if (didNull) { throw firstEx; } didNull = true; caller = null; } else { String cname = curClass.getName(); if (cname.startsWith("java.") || cname.startsWith("javax.")) { if (didNull) { throw firstEx; } didNull = true; caller = null; curClass = null; } } } } return msg; } /** * Clears the internal cache. */ public static void clearCache() { propertyCache.clear(); } } ./src/org/apache/axis2/i18n/Messages.java0000664000175000017500000003047411767656530017233 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.i18n; import java.util.HashMap; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Messages { private static final Class thisClass = Messages.class; private static final String projectName = MessagesConstants.projectName; private static final String resourceName = MessagesConstants.resourceName; private static final Locale locale = MessagesConstants.locale; public static final String DEFAULT_MESSAGE_BUNDLE_KEY = "default"; private static final String NO_MESSAGE_BUNDLE = "Message Bundle is not available"; private static final String packageName = getPackage(thisClass.getName()); private static final ClassLoader classLoader = thisClass.getClassLoader(); private static final ResourceBundle parent = (MessagesConstants.rootPackageName.equals(packageName)) ? null : MessagesConstants.rootBundle; private static HashMap messageBundleMap = new HashMap(); static { MessageBundle defaultMessageBundle = new MessageBundle(projectName, packageName, resourceName, locale, classLoader, parent); addMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY, defaultMessageBundle); } /** * To add a new Message Bundle to the MessageBundle list. * * @param messageBundleKey The key which will be used to refer to this message bundle later. * @param messageBundle The message bundle. */ public static void addMessageBundle(String messageBundleKey, MessageBundle messageBundle) { messageBundleMap.put(messageBundleKey, messageBundle); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @return The formatted message */ public static String getMessage(String key) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The formatted message */ public static String getMessage(String key, String arg0) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, arg0); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The formatted message */ public static String getMessage(String key, String arg0, String arg1) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, arg0, arg1); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return The formatted message */ public static String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, arg0, arg1, arg2); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return The formatted message */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return The formatted message */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param args An array of objects to place in corresponding variables * @return The formatted message */ public static String getMessage(String key, String[] args) throws MissingResourceException { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getMessage(key, args); } public static ResourceBundle getResourceBundle() { MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); return messageBundle.getResourceBundle(); } public static MessageBundle getMessageBundle() { return getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY); } public static MessageBundle getMessageBundle(String messageBundleKey) { return (MessageBundle) messageBundleMap.get(messageBundleKey); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key, String arg0) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key, arg0); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key, String arg0, String arg1) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key, arg0, arg1); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key, String arg0, String arg1, String arg2) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key, arg0, arg1, arg2); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); } /** * Get a message from resource.properties from the package of the given object. * * @param messageBundleKey The key for getting the correct message bundle. * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return The formatted message */ public static String getMessageFromBundle(String messageBundleKey, String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException, Exception { MessageBundle messageBundle = getMessageBundle(messageBundleKey); if (messageBundle == null) { throw new Exception(NO_MESSAGE_BUNDLE); } return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); } private static String getPackage(String name) { return name.substring(0, name.lastIndexOf('.')).intern(); } } ./src/org/apache/axis2/i18n/resource.properties0000664000175000017500000004612011767656530020561 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # # Translation instructions. # 1. Each message line is of the form key=value. # Translate the value, DO NOT translate the key. # 2. The messages may contain arguments that will be filled in # by the runtime. These are of the form: {0}, {1}, etc. # These must appear as is in the message, though the order # may be changed to support proper language syntax. # 3. If a single quote character is to appear in the resulting # message, it must appear in this file as two consecutive # single quote characters. # 4. Lines beginning with "#" (like this one) are comment lines # and may contain translation instructions. They need not be # translated unless your translated file, rather than this file, # will serve as a base for other translators. # # Do not remove the following comment line. It is a variable used by a translation tool. # NLS_MESSAGEFORMAT_VAR ############################################################################# # DO NOT TOUCH THESE PROPERTIES - THEY ARE AUTOMATICALLY UPDATED BY THE BUILD # PROCESS. axisVersion=Apache Axis2 version: @axisVersion@ axisVersionRaw=@axisVersion@ axisBuiltOnRaw=@TODAY@ axisUserAgent=Axis/@axisVersion@ builtOn=Built on @TODAY@ ############################################################################# threadpoolshutdown=Thread pool is shut down. errorWhileSafeShutDown=Error during safe shutdown invaliduser=The user name is not valid. invalidSOAPversion=The SOAP URI is not valid. Axis2 supports SOAP Version 1.1 and 1.2 only. cannotInferTransport=The system cannot infer the transport information from the {0} URL. cannotInferTransportNoAddr=Address information does not exist in the Endpoint Reference (EPR).The system cannot infer the transport mechanism. cannotBeNullAxisOperation=The Axis operation cannot be null. cannotBeNullServiceContext=The ServiceContext cannot be null. cannotBeNullConfigurationContext=The ConfigurationContext cannot be null. cannotBeNullOperationContext=The OperationContext cannot be null. nowhereToSendError=The return response path is missing and faultTo is not specified. errorwhileProcessingFault=An error occurred while processing the fault. See the previous error in the stack trace for more information. unSupportedMEP=An unsupported message exchange pattern (MEP) exists in {0}. mepClientSupportOnly=This message exchange pattern (MEP) client supports {0} only and the supplied Axis operations supports {1}. inputstreamNull=The input stream for an incoming message is null. unknownTransport=An unknown transport called {0} exists. paramIsNotSpecified=The {0} parameter is not specified. groovyNoanswer=An answer has not been received from groovy. groovyUnableToLoad=The system cannot load {0} outMessageNull=The out message is NULL, nothing to write. canNotBeNull={0} cannot be NULL. notFound={0} cannot be found. transportError=Transport error: {0} Error: {1} httpTransportError=HTTP Transport error: ''{0}'' - ''{1}'' preatureEOS=A premature end of stream has occurred. responseTimeOut=Time out while waiting for the server to send the response. callBackCompletedWithError=The callback complete, but there was no envelope element or an error. 2channelNeedAddressing=To use two transport channels you must use the WS-Addressing module. useSeparateListenerLimited=Setting useSeparateListener to false is not a valid option when the Sender is {0} and Listener is {1} replyNeedStarting=Before requesting the ReplyTo value, the system must start the TransportListener. The Transport is {0} failedToOpenSocket=The system failed to open the socket. noRecep4Email=A recipient is not specified in the e-mail message. unknownMsgLabel=An unknown message label has been encountered: {0} cannotCorrelateMsg= The system cannot correlate the {0} message operation to RelatesTo {1} addAfterInvoke00={0}: The chain already has been invoked. #AandBdonotmatch=The {0} value does not match {1} value. The system expected the {2} value, but found the {3} value. rpcNeedmatchingChild=The remote procedure call (RPC) style expects the immediate child of the SOAP body. unknownStyle=The {0} style is an unknown style. rawXmlProviderIsLimited=The XML provider supports only the methods that contain the public OMElement <method-name>(OMElement) signature where the method-name variable can be any value. methodNotImplemented=The implementation class does not define a method called methodDoesNotExistInOut=The ServiceClass object does not implement the required method in the following form: OMElement {0}(OMElement e) methodDoesNotExistInOnly=RawXMLMessageReceiver can not handle this scenario since ServiceClass has implemented to take Non OMElement as method arguments. implReturnedNull=The implementation class returned a null value. invalidMethodName=The {0} method name is not valid for the service implementation class. blockInvocationExpectsRes=The blocking invocation does not contain a response. serviceGroupIDNotFound=The SOAP session information cannot be retrieved from the correlation id that was received. # Client operationnotfound=The {0} operation cannot be found. unsupportedyype=An unsupported type exists. unknownsoapversion=The system does not recognize the SOAP version. cannotfindamoduletoprocess=The system cannot find a module to process {0} type assertions. noendpointfound=An endpoint cannot be found in the Service {0} endpointnotfound=An endpoint cannot be found. unsupportdmep=An unsupported message exchange pattern (MEP) exists. noservicefound=A service was not located. # context servicenotfound=A service cannot be located. threadpoolset=The thread pool is already set. transportiniterror=A transport-OUT initialization error: {0} invalidserviceinagroup=The {0} service, which is not valid, does not belong to the {1} service group. cannotFlushRootNull=Context cannot be flushed since the root context is null # Deployment Errors invalidWSDLFound=The WSDL file found in the service archive file is not valid. The WSDL file must have either http://www.w3.org/2006/01/wsdl or http://www.w3.org/2004/03/wsdl as the namespace of the document element. #wsdlfilenotfound=The WSDL file cannot be found for the service: {0} servicexmlnotfound=The services.xml file cannot be found for the service: {0} modulexmlnotfound=The module.xml file cannot be found for the module: {0} classnotfound=The {0} class cannot be found. fileNotFound=The {0} file cannot be found. repocannotbebull=The Axis2 repository cannot be null. confignotfound=The system cannot find the axis2.xml file. pathtoconfigcanotnull=The path to axis2.xml file cannot be NULL. modulevalfailed=Module validation failed: {0} invalidphase=Did not find the desired phase ''{0}'' while deploying handler ''{1}''. dispatchPhaseNotFoundOnInflow=The '"Dispatch'" phase is not found on the global '"InFlow'" phase of the axis2.xml file. Make sure the phase is within the axis2.xml file. #invalidmoduleref=The {0} service refers to the {1} module, which is not valid. invalidmodulerefbyop={0} operation refers to the {1} module, which is not valid. addingnewmodule=Adding new module settingcl=The service is setting the {0} class loader. deployingws=Deploying Web service: {0} - {1} invalidservice=The {0} service, which is not valid, caused {1} deployingmodule=Deploying module: {0} - {1} deployingpojo=Deploying pojo: {0} - {1} invalidmodule=The {0} module, which is not valid, caused {1} serviceremoved=Undeploying Web service: {0} typemappingnotallowed=Type Mappings are not allowed in the axis2.xml file. errorinloadingmr=A {0} error occurred in loading the message receiver {1} errorinloadingts=A {0} error occurred in loading the transport sender {1} errorloadingbuilder=A {0} error occurred while validating the message builder {1} errorloadingformatter=A {0} error occurred while validating the message formatter {1} invalidconfigattribute=Attributes exist in the axis2.xml file that are not valid. {0} {1} undefinedFlowType=An undefined flow type exists in {0} flowtypeisrequird=The flow type is a required attribute in {0} elementisnotallow=The {0} element is not allowed in the axis2.xml file. # outflownotallowedintrin is not used #outflownotallowedintrin=OUTFlow does not support in AxisTransportIN {0} unknownelement=This element is unknown: {0} inflownotallowedintrout=InFlow is not supported in TransportOutDescription {0} badarguforservice=The {0} arguments are not valid for the {1} service. typemappingnotimpl=Type mapping support is not available. beanmappingnotimpl=Bean mapping support is not available. modulenotfound=The {0} module is not valid or has not been deployed. badparaagu=bad parameter arguments. name cannot be null : {0} badlistagu=The listener arguments are not valid. # invalidhandlerdif and thisshouldbeimplement are not used. #invalidhandlerdif= The Handler cannot have both a name and a ref {0} #thisshouldbeimplment=This should be implemented {0} opnotfoundinwsdl=The {0} Operation Name cannot be found in the WSDL file. # badopeattribute and unknownelementinop are not used. #badopattribute=An attribute that is not valid was found in the operation: {0} #unknownelementinop=An unknown element exists in the operation: {0} modulecannothavrbothnameandref=A module cannot have both a name and a ref {0}. invalideleinmodule=The {0} element is not allowed in the module.xml file. # invalidphase01 is not used. #invalidphase01=Invalid Phase : {0} for the handler {1} does not exit in axis2.xml or refering to phase in different flow invalidmodulerefbyconfig=A reference by the axis2.xml file is made to the {0} module, which is not valid. phasedosenotspecified=A Phase is specified for the {0} handler. servicemodulecannothaveglobal=A service-specific module cannot refer system pre-defined phases: {0} fnf=The file cannot be found. fnf_e=The {0} file cannot be found. StreamException=XMLStreamException : {0} mnf={0} : The module cannot be found. invalid_storage=The definition of the storage class is not valid because the class name is missing. no_dispatcher_found=A dispatcher cannot be found and cannot continue. noMetaInf=Invalid service. META-INF directory not found. ivs=Invalid service. META-INF directory not found. badModuleFromOperation=An error occurred in the {0} engaging module to the {1} operation. A module reference that is not valid exists at the operation. badModuleFromService=An error occurred in the {0} engaging module to the {1} service. A module reference that is not valid exists at the service. InstantiationException=An InstantiationException error occurred in Axis storage processing {0} IllegalAccessException=An IllegalAccessException error occurred in Axis storage processing {0} transportSenderError=The TransportSender implementation class is required for the transport {0} obsererror=An implemenation class of the Observer object is required. invalidmoduleconfig=A module configuration exists that is not valid. invalidhandler=Invalid handler config! Name: {0} Reason: {1} parameterlockederror=The {0} parameter is locked at the top level and cannot be overridden. op_error=Processing Operations Modules with an error of {0} servicenameeror=A service name is required. invalid_op=The operation is not valid: {0} cannotCorrelateMsg01=Cannot correlate MessageID {1} to {0} fileExistsNoOverwrite=The {0} file cannot be overwritten. cannotConnectError=Unable to connect failedJMSConnectorShutdown=A failure occurred in the JMSConnectorShutdown errorinschemagen=The following error occurred during schema generation: {0} errorininputstreamclose=An error occurred in closing input stream. phaseclassnotfound=The system cannot find the phase class: {0} : {1} modulenamecannotbenull=The following attribute /defaultModuleVersions/module/@name is not set in axis2.xml moduleversioncannotbenull=The following attribute /defaultModuleVersions/module/@version is not set in axis2.xml # documentcreatingerror is not used. #documentcreatingerror=An exception occurred when creating the document from the WSDL file: {0} noserviceelemtfound=The javax.wsdl.Service element cannot be found. serviceporterror=The system must specify at least one port. soapbindingerror=The system must specify at least one port with a SOAP binding. axisoperationcreateerror=An exception when creating AxisOperation for the AxisService: {0} wrapperelementcreaterror=An exception occurred when creating the wrapper element. policyprocessingerror=An exception occurred when processing policy elements. bothrepoandconfignull=The repository location is not specified and the axis2.xml file is not provided. The system will use the default configuration, which uses the default_axis2.xml file. cannotfindrepo=The system cannot locate the specified repository location: {0} norepofoundinaxis2=A repository location is not found in the axis2.xml file. noservicedirfound=No services directory was found under {0}. nomoduledirfound=No modules directory was found under {0}. confdirnotfound=The conf directory cannot be found and the axis2.xml file is not provided. The system will use the default_axis2.xml file. noaxis2xmlfound=The axis2.xml file cannot be found in conf directory. The system will use the default_axis2.xml file. badelementfound=The system was looking for the ''{0}'' element, but it found ''{1}'' messagelabelcannotfound=The message label cannot be null. paramterlockedbyparent=The {0} parameter is already locked and the value cannot be overridden. modulealredyengaged=The {0} module is already engaged. The operation has been stopped. mepmappingerror=The system cannot map the message exchange pattern (MEP) URI to a constant value for the axis2 MEP. mepnotyetimplemented=The message exchange pattern (MEP) {0} has not implemented the createClient method. modulealredyengagetoservice=The system is attempting to engage a module that is already engaged: {0} invalidoperation=The following operation is not valid: {0} noschemafound=A schema cannot be found for the service. modulenotavailble=The system is attempting to engage a module that is not available: {0} modulealredyengagedtoservicegroup=The {0} module has already been engaged on the service group. The operation has been stopped. servicenotfoundinwsdl=The {0} service cannot be found in the WSDL file. noservicefoundinwsdl=The service cannot be found in the given WSDL file. noporttypefoundfor=A port cannot be found for the {0} port name. noporttypefound=A port cannot be found in the service element. modulenf=A module cannot be found. mepcompleted=A message was added that is not valid. However, the operation context was complete. invalidacess= An access occurred that is not valid. mepiscomplted=The message exchange pattern (MEP) is already complete. Use the reset method before re-running. outmsgctxnull=The out message context is null. Set the out message context before calling this method. cannotreset=The message exchange pattern (MEP) is not complete. Cannot reset cannotaddmsgctx=The system cannot add the message context again until client runs. clusterImplNotFound=Clustering implementation class {0} not found contextManagerListenerIsNull=Cluster ContextManager entry not found in axis2.xml configurationManagerListenerIsNull=Cluster ConfigurationManager entry not found in axis2.xml cannotLoadClusterImpl=Cluster implementation cannot be loaded classAttributeNotFound=The element {0} must have a attribute with the name ''class'' #Policy emptypolicy=The Policy ID is either null or empty. # outMessageNull is not used. #outMessageNull=The out message is null. malformedURLException00=MalformedURLException: exception00=Exception: #Byte code reading for Java2WSDL badClassFile00=An error occurred when looking for parameter names in the bytecode. The input might not be a valid class file. cantLoadByecode=The system cannot load the bytecode for the class "{0}" unexpectedEOF00=An error occurred when looking for the parameter names in the bytecode. The end of the file was reached unexpectedly. unexpectedBytes00=An error occurred when looking for the parameter names in the bytecode. There are unexpected bytes in the file. #description servicefound=Found AxisService : {0} operationfound=Found AxisOperation : {0} checkingoperation=The system is checking for the operation using the following WSAAction: {0} checkingserviceforepr=The system is checking for the service using the following toEPR address: {0} checkingrelatesto=The system is checking the following RelatesTo: {0} twoservicecannothavesamename=Two services cannot have same name. A service with the {0} name already exists in the system. cannotaddapplicationscopeservice=The system cannot add a service with application scope after the system has started. invalidservicegroupname=The {0} service group name is not valid. modulealredyengagedglobaly=An attempt was made to engage the {0} module, which is already engaged. refertoinvalidmodule=A reference was made to a module that has not been deployed. serviceinactive=The system is attempting to access an inactive service: {0} servicenamenotvalid=The {0} service name in not valid. enginestarted=The Axis engine started. mustunderstandfailed=Must Understand check failed for header {0} : {1} mustunderstandfailed2=Must Understand check failed for headers: {0} receivederrormessage=The system received an error message with the {0} ID. servicenotfoundforepr=The service cannot be found for the endpoint reference (EPR) {0} bindingDisabled={0} binding is disabled for this service. operationnotfoundforepr=The endpoint reference (EPR) for the Operation not found is {0} and the WSA Action = {1} unabletofindservice=The requested service could not be found -- the operation has been stopped. invalidservicegrouoid=The {0} Service Group ID is not valid. servicenotfoundinthesystem=The {0} service is not found in the system. transportnotfound=The transport is not found: {0} CannotConfigureAxis2=The system cannot configure Axis2. wsaddressingrequirednotpresent=WS-Addressing is required, but it cannot be found. nomessagereciever=Message Receiver not found for AxisOperation: {0} duplicaterelatesto=The message is a duplicate (has the same reply relationship value) of an already processed message. RelatesTo = {0} getMessageContextError=The message context could not be retrieved due to the following error: {0} mismatchedModuleVersions=Tried to deploy (to {0}) a module ''{1}'' when ''{2}'' was already deployed - version mismatch! deployingexception=Deploying Exception Occured with {0} stroringfaultyservice=Exception occured and made the service faulty with {0} jaxwsjarsmissing=JAXWS jars are missing in the classpath with {0}, switching to annongen faultyserviceremoval=Predicting faulty service with {0}, and removing it./src/org/apache/axis2/i18n/MessagesConstants.java0000664000175000017500000000312211767656530021116 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.i18n; import java.util.Locale; import java.util.ResourceBundle; public class MessagesConstants { public static final String projectName = "org.apache.axis2".intern(); public static final String resourceName = "resource".intern(); public static final Locale locale = null; public static final String rootPackageName = "org.apache.axis2.i18n".intern(); public static final ResourceBundle rootBundle = ProjectResourceBundle.getBundle(projectName, rootPackageName, resourceName, locale, MessagesConstants.class.getClassLoader(), null); } ./src/org/apache/axis2/i18n/MessageBundle.java0000664000175000017500000001702211767656530020174 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.i18n; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Accept parameters for ProjectResourceBundle, * but defer object instantiation (and therefore * resource bundle loading) until required. */ public class MessageBundle { private boolean loaded = false; private ProjectResourceBundle _resourceBundle = null; private final String projectName; private final String packageName; private final String resourceName; private final Locale locale; private final ClassLoader classLoader; private final ResourceBundle parent; public final ProjectResourceBundle getResourceBundle() { if (!loaded) { _resourceBundle = ProjectResourceBundle.getBundle(projectName, packageName, resourceName, locale, classLoader, parent); loaded = true; } return _resourceBundle; } /** * Construct a new ExtendMessages */ public MessageBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader classLoader, ResourceBundle parent) throws MissingResourceException { this.projectName = projectName; this.packageName = packageName; this.resourceName = resourceName; this.locale = locale; this.classLoader = classLoader; this.parent = parent; } /** * Gets a string message from the resource bundle for the given key * * @param key The resource key * @return The message */ public String getMessage(String key) throws MissingResourceException { return getMessage(key, (String[]) null); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The message */ public String getMessage(String key, String arg0) throws MissingResourceException { return getMessage(key, new String[]{arg0}); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The message */ public String getMessage(String key, String arg0, String arg1) throws MissingResourceException { return getMessage(key, new String[]{arg0, arg1}); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return The message */ public String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException { return getMessage(key, new String[]{arg0, arg1, arg2}); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return The message */ public String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException { return getMessage(key, new String[]{arg0, arg1, arg2, arg3}); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return The message */ public String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException { return getMessage(key, new String[]{arg0, arg1, arg2, arg3, arg4}); } /** *

        Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:

        * * This message has two variables: {0} and {1} * * * @param key The resource key * @param array An array of objects to place in corresponding variables * @return The message */ public String getMessage(String key, String[] array) throws MissingResourceException { String msg = null; if (getResourceBundle() != null) { msg = getResourceBundle().getString(key); } if (msg == null) { throw new MissingResourceException("Cannot find resource key \"" + key + "\" in base name " + getResourceBundle().getResourceName(), getResourceBundle().getResourceName(), key); } return MessageFormat.format(msg, array); } } ./src/org/apache/axis2/i18n/ProjectResourceBundle.java0000664000175000017500000004276411767656530021741 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.i18n; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** *

        Wrapper class for resource bundles. Property files are used to store * resource strings, which are the only types of resources available. * Property files can inherit properties from other files so that * a base property file can be used and a small number of properties * can be over-ridden by another property file. For example you may * create an english version of a resource file named "resource.properties". * You then decide that the British English version of all of the properties * except one are the same, so there is no need to redefine all of the * properties in "resource_en_GB", just the one that is different.

        *

        The basename is the name of the property file without the ".properties" * extension.

        *

        Properties will be cached for performance.

        *

        Property values stored in the property files can also contain dynamic * variables. Any dynamic variable defined in PropertiesUtil.getVariableValue() * can be used (such as {date}), as well as arguments in the form {0}, {1}, etc. * Argument values are specified in the various overloaded getString() methods.

        */ public class ProjectResourceBundle extends ResourceBundle { private static final Log log = LogFactory.getLog(ProjectResourceBundle.class); // The static cache of ResourceBundles. // The key is the 'basename + locale + default locale' // The element is a ResourceBundle object private static final Hashtable bundleCache = new Hashtable(); private static final Locale defaultLocale = Locale.getDefault(); private final ResourceBundle resourceBundle; private final String resourceName; protected Object handleGetObject(String key) throws MissingResourceException { if (log.isDebugEnabled()) { log.debug(this.toString() + "::handleGetObject(" + key + ")"); } Object obj; try { obj = resourceBundle.getObject(key); } catch (MissingResourceException e) { /* catch missing resource, ignore, & return null * if this method doesn't return null, then parents * are not searched */ obj = null; } return obj; } public Enumeration getKeys() { Enumeration myKeys = resourceBundle.getKeys(); if (parent == null) { return myKeys; } else { final HashSet set = new HashSet(); while (myKeys.hasMoreElements()) { set.add(myKeys.nextElement()); } Enumeration pKeys = parent.getKeys(); while (pKeys.hasMoreElements()) { set.add(pKeys.nextElement()); } return new Enumeration() { private Iterator it = set.iterator(); public boolean hasMoreElements() { return it.hasNext(); } public Object nextElement() { return it.next(); } }; } } /** * Construct a new ProjectResourceBundle * * @param projectName The name of the project to which the class belongs. * It must be a proper prefix of the caller's package. * @param packageName The package name to further construct * the basename. * @param resourceName The name of the resource without the * ".properties" extension * @throws MissingResourceException if projectName is not a prefix of * the caller's package name, or if the resource could not be * found/loaded. */ public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName) throws MissingResourceException { return getBundle(projectName, packageName, resourceName, null, null, null); } /** * Construct a new ProjectResourceBundle * * @param projectName The name of the project to which the class belongs. * It must be a proper prefix of the caller's package. * @param caller The calling class. * @param resourceName The name of the resource without the * ".properties" extension * @throws MissingResourceException if projectName is not a prefix of * the caller's package name, or if the resource could not be * found/loaded. */ public static ProjectResourceBundle getBundle(String projectName, Class caller, String resourceName, Locale locale) throws MissingResourceException { return getBundle(projectName, caller, resourceName, locale, null); } /** * Construct a new ProjectResourceBundle * * @param projectName The name of the project to which the class belongs. * It must be a proper prefix of the caller's package. * @param packageName The package name to construct base name. * @param resourceName The name of the resource without the * ".properties" extension * @param locale The locale * @throws MissingResourceException if projectName is not a prefix of * the caller's package name, or if the resource could not be * found/loaded. */ public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader loader) throws MissingResourceException { return getBundle(projectName, packageName, resourceName, locale, loader, null); } /** * Construct a new ProjectResourceBundle * * @param projectName The name of the project to which the class belongs. * It must be a proper prefix of the caller's package. * @param caller The calling class. * This is used to get the package name to further construct * the basename as well as to get the proper ClassLoader. * @param resourceName The name of the resource without the * ".properties" extension * @param locale The locale * @param extendsBundle If non-null, then this ExtendMessages will * default to extendsBundle. * @throws MissingResourceException if projectName is not a prefix of * the caller's package name, or if the resource could not be * found/loaded. */ public static ProjectResourceBundle getBundle(String projectName, Class caller, String resourceName, Locale locale, ResourceBundle extendsBundle) throws MissingResourceException { return getBundle(projectName, getPackage(caller.getClass().getName()), resourceName, locale, caller.getClass().getClassLoader(), extendsBundle); } /** * Construct a new ProjectResourceBundle * * @param projectName The name of the project to which the class belongs. * It must be a proper prefix of the caller's package. * @param packageName The package name to further construct * the basename. * @param resourceName The name of the resource without the * ".properties" extension * @param locale The locale * @param extendsBundle If non-null, then this ExtendMessages will * default to extendsBundle. * @throws MissingResourceException if projectName is not a prefix of * the caller's package name, or if the resource could not be * found/loaded. */ public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader loader, ResourceBundle extendsBundle) throws MissingResourceException { if (log.isDebugEnabled()) { log.debug("getBundle(" + projectName + "," + packageName + "," + resourceName + "," + String.valueOf(locale) + ",...)"); } Context context = new Context(); context.setLocale(locale); context.setLoader(loader); context.setProjectName(projectName); context.setResourceName(resourceName); context.setParentBundle(extendsBundle); packageName = context.validate(packageName); ProjectResourceBundle bundle = null; try { bundle = getBundle(context, packageName); } catch (RuntimeException e) { log.debug("Exception: ", e); throw e; } if (bundle == null) { throw new MissingResourceException("Cannot find resource '" + packageName + '.' + resourceName + "'", resourceName, ""); } return bundle; } /** * get bundle... * - check cache * - try up hierarchy * - if at top of hierarchy, use (link to) context.getParentBundle() */ private static synchronized ProjectResourceBundle getBundle(Context context, String packageName) throws MissingResourceException { String cacheKey = context.getCacheKey(packageName); ProjectResourceBundle prb = (ProjectResourceBundle) bundleCache.get(cacheKey); if (prb == null) { String name = packageName + '.' + context.getResourceName(); ResourceBundle rb = context.loadBundle(packageName); ResourceBundle parent = context.getParentBundle(packageName); if (rb != null) { prb = new ProjectResourceBundle(name, rb); prb.setParent(parent); if (log.isDebugEnabled()) { log.debug("Created " + prb + ", linked to parent " + String.valueOf(parent)); } } else { if (parent != null) { if (parent instanceof ProjectResourceBundle) { prb = (ProjectResourceBundle) parent; } else { prb = new ProjectResourceBundle(name, parent); } if (log.isDebugEnabled()) { log.debug("Root package not found, cross link to " + parent); } } } if (prb != null) { // Cache the resource bundleCache.put(cacheKey, prb); } } return prb; } private static String getPackage(String name) { return name.substring(0, name.lastIndexOf('.')).intern(); } /** * Construct a new ProjectResourceBundle */ private ProjectResourceBundle(String name, ResourceBundle bundle) throws MissingResourceException { this.resourceBundle = bundle; this.resourceName = name; } public String getResourceName() { return resourceName; } /** * Clears the internal cache */ // public static void clearCache() { // bundleCache.clear(); // } public String toString() { return resourceName; } private static class Context { private Locale _locale; private ClassLoader _loader; private String _projectName; private String _resourceName; private ResourceBundle _parent; void setLocale(Locale l) { /* 1. Docs indicate that if locale is not specified, * then the default local is used in it's place. * 2. A null value for locale is invalid. * * Therefore, default... */ _locale = (l == null) ? defaultLocale : l; } void setLoader(ClassLoader l) { _loader = (l != null) ? l : this.getClass().getClassLoader(); // START FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868 if (_loader == null) { _loader = ClassLoader.getSystemClassLoader(); } // END FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868 } void setProjectName(String name) { _projectName = name.intern(); } void setResourceName(String name) { _resourceName = name.intern(); } void setParentBundle(ResourceBundle b) { _parent = b; } Locale getLocale() { return _locale; } ClassLoader getLoader() { return _loader; } String getProjectName() { return _projectName; } String getResourceName() { return _resourceName; } ResourceBundle getParentBundle() { return _parent; } String getCacheKey(String packageName) { String loaderName = (_loader == null) ? "" : (":" + _loader.hashCode()); return packageName + "." + _resourceName + ":" + _locale + ":" + defaultLocale + loaderName; } ResourceBundle loadBundle(String packageName) { try { return ResourceBundle.getBundle(packageName + '.' + _resourceName, _locale, _loader); } catch (MissingResourceException e) { // Deliberately surpressing print stack.. just the string for info. log.debug("loadBundle: Ignoring MissingResourceException: " + e.getMessage()); } return null; } ResourceBundle getParentBundle(String packageName) { ResourceBundle p; if (!packageName.equals(_projectName)) { p = getBundle(this, getPackage(packageName)); } else { p = _parent; _parent = null; } return p; } String validate(String packageName) throws MissingResourceException { if (_projectName == null || _projectName.length() == 0) { log.debug("Project name not specified"); throw new MissingResourceException("Project name not specified", "", ""); } if (packageName == null || packageName.length() == 0) { log.debug("Package name not specified"); throw new MissingResourceException("Package not specified", packageName, ""); } packageName = packageName.intern(); /* Ensure that project is a proper prefix of class. * Terminate project name with '.' to ensure proper match. */ if (!packageName.equals(_projectName) && !packageName.startsWith(_projectName + '.')) { log.debug("Project not a prefix of Package"); throw new MissingResourceException("Project '" + _projectName + "' must be a prefix of Package '" + packageName + "'", packageName + '.' + _resourceName, ""); } return packageName; } } } ./src/org/apache/axis2/classloader/0000775000175000017500000000000011767656530016326 5ustar brianbrian./src/org/apache/axis2/classloader/JarFileUrlStreamHandler.java0000664000175000017500000001021311767656530023637 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.classloader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import java.util.jar.JarEntry; import java.util.jar.JarFile; /** * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ */ public class JarFileUrlStreamHandler extends URLStreamHandler { public static URL createUrl(JarFile jarFile, JarEntry jarEntry) throws MalformedURLException { return createUrl(jarFile, jarEntry, new File(jarFile.getName()).toURL()); } public static URL createUrl(JarFile jarFile, JarEntry jarEntry, URL codeSource) throws MalformedURLException { JarFileUrlStreamHandler handler = new JarFileUrlStreamHandler(jarFile, jarEntry); URL url = new URL("jar", "", -1, codeSource + "!/" + jarEntry.getName(), handler); handler.setExpectedUrl(url); return url; } private URL expectedUrl; private JarFile jarFile = null; private JarEntry jarEntry = null; public JarFileUrlStreamHandler() { } public JarFileUrlStreamHandler(JarFile jarFile, JarEntry jarEntry) { if (jarFile == null) throw new NullPointerException("jarFile is null"); if (jarEntry == null) throw new NullPointerException("jarEntry is null"); this.jarFile = jarFile; this.jarEntry = jarEntry; } public void setExpectedUrl(URL expectedUrl) { if (expectedUrl == null) throw new NullPointerException("expectedUrl is null"); this.expectedUrl = expectedUrl; } public URLConnection openConnection(URL url) throws IOException { if (expectedUrl == null || !expectedUrl.equals(url)) { // the new url is supposed to be within our context, so it must have a jar protocol if (!url.getProtocol().equals("jar")) { throw new IllegalArgumentException("Unsupported protocol " + url.getProtocol()); } // split the path at "!/" into the file part and entry part String path = url.getPath(); String[] chunks = path.split("!/", 2); // if we only got only one chunk, it didn't contain the required "!/" delimiter if (chunks.length == 1) { throw new MalformedURLException("Url does not contain a '!' character: " + url); } String file = chunks[0]; String entryPath = chunks[1]; // this handler only supports jars on the local file system if (!file.startsWith("file:")) { // let the system handler deal with this return new URL(url.toExternalForm()).openConnection(); } file = file.substring("file:".length()); File f = new File(file); if (f.exists()) { jarFile = new JarFile(f); } if (jarFile == null) { throw new FileNotFoundException("Cannot find JarFile: " + file); } // get the entry jarEntry = jarFile.getJarEntry(entryPath); if (jarEntry == null) { throw new FileNotFoundException("Entry not found: " + url); } expectedUrl = url; } return new JarFileUrlConnection(url, jarFile, jarEntry); } } ./src/org/apache/axis2/classloader/JarFileUrlConnection.java0000664000175000017500000000773511767656530023224 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.classloader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import java.security.Permission; import java.security.cert.Certificate; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; /** * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ */ public class JarFileUrlConnection extends JarURLConnection { public static final URL DUMMY_JAR_URL; static { try { DUMMY_JAR_URL = new URL("jar", "", -1, "file:dummy!/", new URLStreamHandler() { protected URLConnection openConnection(URL u) { throw new UnsupportedOperationException(); } }); } catch (Exception e) { throw new ExceptionInInitializerError(e); } } private final URL url; private final JarFile jarFile; private final JarEntry jarEntry; private final URL jarFileUrl; public JarFileUrlConnection(URL url, JarFile jarFile, JarEntry jarEntry) throws MalformedURLException { super(DUMMY_JAR_URL); if (url == null) throw new NullPointerException("url is null"); if (jarFile == null) throw new NullPointerException("jarFile is null"); if (jarEntry == null) throw new NullPointerException("jarEntry is null"); this.url = url; this.jarFile = jarFile; this.jarEntry = jarEntry; jarFileUrl = new File(jarFile.getName()).toURL(); } public JarFile getJarFile() throws IOException { return jarFile; } public synchronized void connect() { } public URL getJarFileURL() { return jarFileUrl; } public String getEntryName() { return getJarEntry().getName(); } public Manifest getManifest() throws IOException { return jarFile.getManifest(); } public JarEntry getJarEntry() { return jarEntry; } public Attributes getAttributes() throws IOException { return getJarEntry().getAttributes(); } public Attributes getMainAttributes() throws IOException { return getManifest().getMainAttributes(); } public Certificate[] getCertificates() throws IOException { return getJarEntry().getCertificates(); } public URL getURL() { return url; } public int getContentLength() { long size = getJarEntry().getSize(); if (size > Integer.MAX_VALUE) { return -1; } return (int) size; } public long getLastModified() { return getJarEntry().getTime(); } public synchronized InputStream getInputStream() throws IOException { return jarFile.getInputStream(jarEntry); } public Permission getPermission() throws IOException { URL jarFileUrl = new File(jarFile.getName()).toURL(); return jarFileUrl.openConnection().getPermission(); } public String toString() { return JarFileUrlConnection.class.getName() + ":" + url; } } ./src/org/apache/axis2/classloader/JarStreamHandlerFactory.java0000664000175000017500000000225511767656530023713 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.classloader; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; public class JarStreamHandlerFactory implements URLStreamHandlerFactory { public URLStreamHandler createURLStreamHandler(String protocol) { if("jar".equalsIgnoreCase(protocol)){ return new JarFileUrlStreamHandler(); } return null; } } ./src/org/apache/axis2/classloader/MultiParentClassLoader.java0000664000175000017500000003535511767656530023565 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.classloader; import org.apache.commons.logging.LogFactory; import java.beans.Introspector; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLStreamHandlerFactory; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.List; /** * A MultiParentClassLoader is a simple extension of the URLClassLoader that simply changes the single parent class * loader model to support a list of parent class loaders. Each operation that accesses a parent, has been replaced * with a operation that checks each parent in order. This getParent method of this class will always return null, * which may be interpreted by the calling code to mean that this class loader is a direct child of the system class * loader. * * @version $Rev$ $Date$ */ public class MultiParentClassLoader extends URLClassLoader { private final ClassLoader[] parents; private final boolean inverseClassLoading; private final String[] hiddenClasses; private final String[] nonOverridableClasses; private final String[] hiddenResources; private final String[] nonOverridableResources; private boolean destroyed = false; /** * Creates a named class loader with no parents. * * @param urls the urls from which this class loader will classes and resources */ public MultiParentClassLoader(URL[] urls) { super(urls); parents = new ClassLoader[]{ClassLoader.getSystemClassLoader()}; inverseClassLoading = false; hiddenClasses = new String[0]; nonOverridableClasses = new String[0]; hiddenResources = new String[0]; nonOverridableResources = new String[0]; } /** * Creates a named class loader as a child of the specified parent. * * @param urls the urls from which this class loader will classes and resources * @param parent the parent of this class loader */ public MultiParentClassLoader(URL[] urls, ClassLoader parent) { this(urls, new ClassLoader[]{parent}); } public MultiParentClassLoader(URL[] urls, ClassLoader parent, boolean inverseClassLoading, String[] hiddenClasses, String[] nonOverridableClasses) { this(urls, new ClassLoader[]{parent}, inverseClassLoading, hiddenClasses, nonOverridableClasses); } /** * Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory * for accessing the urls.. * * @param urls the urls from which this class loader will classes and resources * @param parent the parent of this class loader * @param factory the URLStreamHandlerFactory used to access the urls */ public MultiParentClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) { this(urls, new ClassLoader[]{parent}, factory); } /** * Creates a named class loader as a child of the specified parents. * * @param urls the urls from which this class loader will classes and resources * @param parents the parents of this class loader */ public MultiParentClassLoader(URL[] urls, ClassLoader[] parents) { super(urls); this.parents = copyParents(parents); inverseClassLoading = false; hiddenClasses = new String[0]; nonOverridableClasses = new String[0]; hiddenResources = new String[0]; nonOverridableResources = new String[0]; } public MultiParentClassLoader(URL[] urls, ClassLoader[] parents, boolean inverseClassLoading, Collection hiddenClasses, Collection nonOverridableClasses) { this(urls, parents, inverseClassLoading, (String[]) hiddenClasses.toArray(new String[hiddenClasses.size()]), (String[]) nonOverridableClasses.toArray(new String[nonOverridableClasses.size()])); } public MultiParentClassLoader(URL[] urls, ClassLoader[] parents, boolean inverseClassLoading, String[] hiddenClasses, String[] nonOverridableClasses) { super(urls); this.parents = copyParents(parents); this.inverseClassLoading = inverseClassLoading; this.hiddenClasses = hiddenClasses; this.nonOverridableClasses = nonOverridableClasses; hiddenResources = toResources(hiddenClasses); nonOverridableResources = toResources(nonOverridableClasses); } private String[] toResources(String[] classes) { String[] resources = new String[classes.length]; for (int i = 0; i < classes.length; i++) { String className = classes[i]; resources[i] = className.replace('.', '/'); } return resources; } /** * Creates a named class loader as a child of the specified parents and using the specified URLStreamHandlerFactory * for accessing the urls.. * * @param urls the urls from which this class loader will classes and resources * @param parents the parents of this class loader * @param factory the URLStreamHandlerFactory used to access the urls */ public MultiParentClassLoader(URL[] urls, ClassLoader[] parents, URLStreamHandlerFactory factory) { super(urls, null, factory); this.parents = copyParents(parents); inverseClassLoading = false; hiddenClasses = new String[0]; nonOverridableClasses = new String[0]; hiddenResources = new String[0]; nonOverridableResources = new String[0]; } private static ClassLoader[] copyParents(ClassLoader[] parents) { ClassLoader[] newParentsArray = new ClassLoader[parents.length]; for (int i = 0; i < parents.length; i++) { ClassLoader parent = parents[i]; if (parent == null) { throw new RuntimeException("parent[" + i + "] is null"); } newParentsArray[i] = parent; } return newParentsArray; } /** * Gets the parents of this class loader. * * @return the parents of this class loader */ public ClassLoader[] getParents() { return parents; } public void addURL(URL url) { // todo this needs a security check super.addURL(url); } protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // // Check if class is in the loaded classes cache // Class cachedClass = findLoadedClass(name); if (cachedClass != null) { return resolveClass(cachedClass, resolve); } // // if we are using inverse class loading, check local urls first // if (inverseClassLoading && !isDestroyed() && !isNonOverridableClass(name)) { try { Class clazz = findClass(name); return resolveClass(clazz, resolve); } catch (ClassNotFoundException ignored) { } } // // Check parent class loaders // if (!isHiddenClass(name)) { for (int i = 0; i < parents.length; i++) { ClassLoader parent = parents[i]; try { Class clazz = parent.loadClass(name); return resolveClass(clazz, resolve); } catch (ClassNotFoundException ignored) { // this parent didn't have the class; try the next one // TODO REVIEW FOR JAVA 6 // In Java 5, if you passed an array string such as "[Lcom.mypackage.MyClass;" to // loadClass, the class would indeed be loaded. // In JDK6, a ClassNotFoundException is thrown. // The work-around is to use code Class.forName instead. // Example: // try { // classLoader.loadClass(name); // } catch (ClassNotFoundException e) { // Class.forName(name, false, loader); // } } } } // // if we are not using inverse class loading, check local urls now // // don't worry about excluding non-overridable classes here... we // have alredy checked he parent and the parent didn't have the // class, so we can override now if (!isDestroyed()) { try { Class clazz = findClass(name); return resolveClass(clazz, resolve); } catch (ClassNotFoundException ignored) { } } throw new ClassNotFoundException(name); } private boolean isNonOverridableClass(String name) { for (int i = 0; i < nonOverridableClasses.length; i++) { if (name.startsWith(nonOverridableClasses[i])) { return true; } } return false; } private boolean isHiddenClass(String name) { for (int i = 0; i < hiddenClasses.length; i++) { if (name.startsWith(hiddenClasses[i])) { return true; } } return false; } private Class resolveClass(Class clazz, boolean resolve) { if (resolve) { resolveClass(clazz); } return clazz; } public URL getResource(String name) { if (isDestroyed()) { return null; } // // if we are using inverse class loading, check local urls first // if (inverseClassLoading && !isDestroyed() && !isNonOverridableResource(name)) { URL url = findResource(name); if (url != null) { return url; } } // // Check parent class loaders // if (!isHiddenResource(name)) { for (int i = 0; i < parents.length; i++) { ClassLoader parent = parents[i]; URL url = parent.getResource(name); if (url != null) { return url; } } } // // if we are not using inverse class loading, check local urls now // // don't worry about excluding non-overridable resources here... we // have alredy checked he parent and the parent didn't have the // resource, so we can override now if (!isDestroyed()) { // parents didn't have the resource; attempt to load it from my urls return findResource(name); } return null; } public Enumeration findResources(String name) throws IOException { if (isDestroyed()) { return Collections.enumeration(Collections.EMPTY_SET); } List resources = new ArrayList(); // // if we are using inverse class loading, add the resources from local urls first // if (inverseClassLoading && !isDestroyed()) { List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources); } // // Add parent resources // for (int i = 0; i < parents.length; i++) { ClassLoader parent = parents[i]; List parentResources = Collections.list(parent.getResources(name)); resources.addAll(parentResources); } // // if we are not using inverse class loading, add the resources from local urls now // if (!inverseClassLoading && !isDestroyed()) { List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources); } return Collections.enumeration(resources); } private boolean isNonOverridableResource(String name) { for (int i = 0; i < nonOverridableResources.length; i++) { if (name.startsWith(nonOverridableResources[i])) { return true; } } return false; } private boolean isHiddenResource(String name) { for (int i = 0; i < hiddenResources.length; i++) { if (name.startsWith(hiddenResources[i])) { return true; } } return false; } public String toString() { return "[" + getClass().getName() + "]"; } public synchronized boolean isDestroyed() { return destroyed; } public void destroy() { synchronized (this) { if (destroyed) { return; } destroyed = true; } LogFactory.release(this); // clearSoftCache(ObjectInputStream.class, "subclassAudits"); // clearSoftCache(ObjectOutputStream.class, "subclassAudits"); // clearSoftCache(ObjectStreamClass.class, "localDescs"); // clearSoftCache(ObjectStreamClass.class, "reflectors"); // The beanInfoCache in java.beans.Introspector will hold on to Classes which // it has introspected. If we don't flush the cache, we may run out of // Permanent Generation space. Introspector.flushCaches(); } // private static final Object lock = new Object(); // private static boolean clearSoftCacheFailed = false; // // private static void clearSoftCache(Class clazz, String fieldName) { // Map cache = null; // try { // Field f = clazz.getDeclaredField(fieldName); // f.setAccessible(true); // cache = (Map) f.get(null); // } catch (Throwable e) { // synchronized (lock) { // if (!clearSoftCacheFailed) { // clearSoftCacheFailed = true; // LogFactory.getLog(ConfigurationClassLoader.class).error("Unable to clear SoftCache field " + fieldName + " in class " + clazz); // } // } // } // // if (cache != null) { // synchronized (cache) { // cache.clear(); // } // } // } } ./src/org/apache/axis2/java/0000775000175000017500000000000011767656530014753 5ustar brianbrian./src/org/apache/axis2/java/security/0000775000175000017500000000000011767656530016622 5ustar brianbrian./src/org/apache/axis2/java/security/AccessController.java0000664000175000017500000002075711767656530022745 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.java.security; import java.security.AccessControlContext; import java.security.AccessControlException; import java.security.Permission; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; /** * This utility wrapper class is created to support AXIS2 runs * inside of Java 2 Security environment. Due to the access control * checking algorithm, for Java 2 Security to function properly, * doPrivileged() * is required in cases where there is application code on the stack frame * accessing the system resources (ie, read/write files, opening ports, and etc). * This class also improve performance no matther Security Manager is being enabled * or not. *

        * Note: This utility should be used properly, otherwise might introduce * security holes. *

        * Usage Example: * * public void changePassword() { * ... * AccessController.doPrivileged(new PrivilegedAction() { * public Object run() { * f = Util.openPasswordFile(); * ... *

        * } * }); * ... * } * */ public class AccessController { /** * Performs the specified PrivilegedAction with privileges * enabled if a security manager is present. *

        * If the action's run method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @return the value returned by the action's run method. * @see #doPrivileged(PrivilegedAction,AccessControlContext) * @see #doPrivileged(PrivilegedExceptionAction) */ public static Object doPrivileged(PrivilegedAction action) { SecurityManager sm = System.getSecurityManager(); if (sm == null) { return (action.run()); } else { return java.security.AccessController.doPrivileged(action); } } /** * Performs the specified PrivilegedAction with privileges * enabled and restricted by the specified AccessControlContext. * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified * AccessControlContext if a security manager is present. *

        *

        * If the action's run method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @param context an access control context representing the * restriction to be applied to the caller's domain's * privileges before performing the specified action. * @return the value returned by the action's run method. * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) */ public static Object doPrivileged(PrivilegedAction action, AccessControlContext context) { SecurityManager sm = System.getSecurityManager(); if (sm == null) { return action.run(); } else { return java.security.AccessController.doPrivileged(action, context); } } /** * Performs the specified PrivilegedExceptionAction with * privileges enabled. The action is performed with all of the * permissions possessed by the caller's protection domain. *

        * If the action's run method throws an unchecked * exception, it will propagate through this method. * * @param action the action to be performed. * @return the value returned by the action's run method. * @throws PrivilgedActionException the specified action's * run method threw a checked exception. * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see #doPrivileged(PrivilegedAction) */ public static Object doPrivileged(PrivilegedExceptionAction action) throws PrivilegedActionException { SecurityManager sm = System.getSecurityManager(); if (sm == null) { try { return action.run(); } catch (java.lang.RuntimeException e) { throw e; } catch (Exception e) { throw new PrivilegedActionException(e); } } else { return java.security.AccessController.doPrivileged(action); } } /** * Performs the specified PrivilegedExceptionAction with * privileges enabled and restricted by the specified * AccessControlContext. The action is performed with the * intersection of the the permissions possessed by the caller's * protection domain, and those possessed by the domains represented by the * specified AccessControlContext. *

        * If the action's run method throws an unchecked * exception, it will propagate through this method. * * @param action the action to be performed. * @param context an access control context representing the * restriction to be applied to the caller's domain's * privileges before performing the specified action. * @return the value returned by the action's run method. * @throws PrivilegedActionException the specified action's * run method * threw a checked exception. * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) */ public static Object doPrivileged(PrivilegedExceptionAction action, AccessControlContext context) throws PrivilegedActionException { SecurityManager sm = System.getSecurityManager(); if (sm == null) { try { return action.run(); } catch (java.lang.RuntimeException e) { throw e; } catch (Exception e) { throw new PrivilegedActionException(e); } } else { return java.security.AccessController.doPrivileged(action, context); } } /** * This method takes a "snapshot" of the current calling context, which * includes the current Thread's inherited AccessControlContext, * and places it in an AccessControlContext object. This context may then * be checked at a later point, possibly in another thread. * * @return the AccessControlContext based on the current context. * @see AccessControlContext */ public static AccessControlContext getContext() { return java.security.AccessController.getContext(); } /** * Determines whether the access request indicated by the * specified permission should be allowed or denied, based on * the security policy currently in effect. * This method quietly returns if the access request * is permitted, or throws a suitable AccessControlException otherwise. * * @param perm the requested permission. * @throws AccessControlException if the specified permission * is not permitted, based on the current security policy. */ public static void checkPermission(Permission perm) throws AccessControlException { java.security.AccessController.checkPermission(perm); } /** * No instantiation allowed */ private AccessController() { } } ./src/org/apache/axis2/ServiceObjectSupplier.java0000664000175000017500000000204111767656530021145 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2; import org.apache.axis2.description.AxisService; /* * */ public interface ServiceObjectSupplier { /* Deployment Engine uses this method */ public Object getServiceObject(AxisService axisService) throws AxisFault; } ./src/org/apache/axis2/service/0000775000175000017500000000000011767656530015472 5ustar brianbrian./src/org/apache/axis2/service/Lifecycle.java0000664000175000017500000000376511767656530020247 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.service; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ServiceContext; /** * The Lifecycle interface should be implemented by your back-end service * class if you wish to be notified of creation and cleanup by the Axis2 * framework. */ public interface Lifecycle { /** * init() is called when a new instance of the implementing class has been created. * This occurs in sync with session/ServiceContext creation. This method gives classes * a chance to do any setup work (grab resources, establish connections, etc) before * they are invoked by a service request. * * @param context the active ServiceContext * @throws AxisFault if something goes wrong. Throwing a fault here will result in either * failed deployment (for application-scoped services) or failed requests. */ void init(ServiceContext context) throws AxisFault; /** * destroy() is called when Axis2 decides that it is finished with a particular instance * of the back-end service class. It allows classes to clean up resources. * @param context the active ServiceContext */ void destroy(ServiceContext context); } ./src/org/apache/axis2/clustering/0000775000175000017500000000000011767656530016211 5ustar brianbrian./src/org/apache/axis2/clustering/context/0000775000175000017500000000000011767656530017675 5ustar brianbrian./src/org/apache/axis2/clustering/context/ContextClusteringCommand.java0000664000175000017500000000223611767656530025526 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.context; import org.apache.axis2.clustering.ClusteringCommand; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.context.ConfigurationContext; public abstract class ContextClusteringCommand extends ClusteringCommand { public abstract void execute(ConfigurationContext configContext) throws ClusteringFault; } ./src/org/apache/axis2/clustering/context/Replicator.java0000664000175000017500000001527511767656530022656 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.context; import org.apache.axis2.clustering.ClusterManager; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.context.AbstractContext; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; /** * Replicates serializable properties */ public final class Replicator { private static final Log log = LogFactory.getLog(Replicator.class); /** * Replicates all serializable properties in the ConfigurationContext, ServiceGroupContext & * ServiceContext * * @param msgContext The MessageContext associated with the ServiceContext, * ServiceGroupContext and ConfigurationContext to be replicated * @throws ClusteringFault If replication fails */ public static void replicate(MessageContext msgContext) throws ClusteringFault { if (!canReplicate(msgContext)) { return; } log.debug("Going to replicate state stored in ConfigurationContext," + " ServiceGroupContext, ServiceContext associated with " + msgContext + "..."); ConfigurationContext configurationContext = msgContext.getConfigurationContext(); ContextManager contextManager = getContextManager(msgContext); List contexts = new ArrayList(); // Do we need to replicate state stored in ConfigurationContext? if (!configurationContext.getPropertyDifferences().isEmpty()) { contexts.add(configurationContext); } // Do we need to replicate state stored in ServiceGroupContext? ServiceGroupContext sgContext = msgContext.getServiceGroupContext(); if (sgContext != null && !sgContext.getPropertyDifferences().isEmpty()) { contexts.add(sgContext); } // Do we need to replicate state stored in ServiceContext? ServiceContext serviceContext = msgContext.getServiceContext(); if (serviceContext != null && !serviceContext.getPropertyDifferences().isEmpty()) { contexts.add(serviceContext); } // Do the actual replication here if (!contexts.isEmpty()) { AbstractContext[] contextArray = (AbstractContext[]) contexts.toArray(new AbstractContext[contexts.size()]); contextManager.updateContexts(contextArray); } } /** * Replicate all serializable properties stored in the given abstractContext. * * @param abstractContext The AbstractContext which holds the properties to be replicated * @throws ClusteringFault If replication fails */ public static void replicate(AbstractContext abstractContext) throws ClusteringFault { if (!canReplicate(abstractContext)) { return; } log.debug("Going to replicate state in " + abstractContext + "..."); ContextManager contextManager = getContextManager(abstractContext); if (!abstractContext.getPropertyDifferences().isEmpty()) { contextManager.updateContext(abstractContext); } } /** * Replicate all the properties given in propertyNames * in the specified abstractContext * * @param abstractContext The context to be replicated * @param propertyNames The names of the properties to be replicated * @throws ClusteringFault IF replication fails */ public static void replicate(AbstractContext abstractContext, String[] propertyNames) throws ClusteringFault { if (!canReplicate(abstractContext)) { return; } log.debug("Going to replicate selected properties in " + abstractContext + "..."); ContextManager contextManager = getContextManager(abstractContext); contextManager.updateContext(abstractContext, propertyNames); } private static ClusterManager getClusterManager(AbstractContext abstractContext) { return abstractContext.getRootContext().getAxisConfiguration().getClusterManager(); } private static ContextManager getContextManager(AbstractContext abstractContext) { return getClusterManager(abstractContext).getContextManager(); } /** * Check whether the state store in the specified abstractContext can be replicated. * Also note that if there are no members, we need not do any replication * * @param abstractContext The context to be subjected to this test * @return true - State needs to be replicated * false - otherwise */ private static boolean canReplicate(AbstractContext abstractContext) { ClusterManager clusterManager = abstractContext.getRootContext().getAxisConfiguration().getClusterManager(); boolean canReplicate = false; if (clusterManager != null && clusterManager.getContextManager() != null) { canReplicate = clusterManager.getContextManager().isContextClusterable(abstractContext); } return canReplicate; } /** * Check whether the state store in the specified messageContext can be replicated. * Also note that if there are no members, we need not do any replication * * @param messageContext The MessageContext to be subjected to this test * @return true - State needs to be replicated * false - otherwise */ private static boolean canReplicate(MessageContext messageContext) { ClusterManager clusterManager = messageContext.getRootContext().getAxisConfiguration().getClusterManager(); return clusterManager != null && clusterManager.getContextManager() != null; } } ./src/org/apache/axis2/clustering/context/ContextManager.java0000664000175000017500000001156411767656530023466 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.context; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.context.AbstractContext; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.ParameterInclude; import java.util.List; import java.util.Map; public interface ContextManager extends ParameterInclude { /** * This method is called when properties in an {@link AbstractContext} are updated. * This could be addition of new properties, modifications of existing properties or * removal of properties. * * @param context The context to be replicated * @throws ClusteringFault If replication fails */ void updateContext(AbstractContext context) throws ClusteringFault; /** * This method is called when one need to update/replicate only certains properties in the * specified context * * @param context The AbstractContext containing the properties to be replicated * @param propertyNames The names of the specific properties that should be replicated * @throws ClusteringFault If replication fails */ void updateContext(AbstractContext context, String[] propertyNames) throws ClusteringFault; /** * This method is called when properties in a collection of {@link AbstractContext}s are updated. * This could be addition of new properties, modifications of existing properties or * removal of properties. * * @param contexts The AbstractContexts containing the properties to be replicated * @throws ClusteringFault If replication fails */ void updateContexts(AbstractContext[] contexts) throws ClusteringFault; /** * This method is called when {@link AbstractContext} is removed from the system * * @param context The AbstractContext to be removed * @throws ClusteringFault If context removal fails */ void removeContext(AbstractContext context) throws ClusteringFault; /** * @param context AbstractContext * @return True - if the provided {@link AbstractContext} is clusterable */ boolean isContextClusterable(AbstractContext context); /** * Indicates whether a particular message has been ACKed by all members of a cluster * * @param messageUniqueId The UUID of the message in concern * @return true - if all memebers have ACKed the message with ID messageUniqueId * false - otherwise * @throws ClusteringFault If an error occurs while checking whether a message is ACKed */ // boolean isMessageAcknowledged(String messageUniqueId) throws ClusteringFault; /** * @param listener ContextManagerListener */ void setContextManagerListener(ContextManagerListener listener); /** * @param configurationContext ConfigurationContext */ void setConfigurationContext(ConfigurationContext configurationContext); /** * All properties in the context with type contextType which have * names that match the specified pattern will be excluded from replication. *

        * Generally, we can use the context class name as the context type. * * @param contextType The type of the context such as * org.apache.axis2.context.ConfigurationContext, * org.apache.axis2.context.ServiceGroupContext & * org.apache.axis2.context.ServiceContext. * Also "defaults" is a special type, which will apply to all contexts * @param patterns The patterns */ void setReplicationExcludePatterns(String contextType, List patterns); /** * Get all the excluded context property name patterns * * @return All the excluded pattern of all the contexts. The key of the Map is the * the contextType. See {@link #setReplicationExcludePatterns(String,List)}. * The values are of type {@link List} of {@link String} Objects, * which are a collection of patterns to be excluded. */ Map getReplicationExcludePatterns(); } ./src/org/apache/axis2/clustering/context/ContextManagerListener.java0000664000175000017500000000223311767656530025165 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.context; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.context.ConfigurationContext; public interface ContextManagerListener { public void contextUpdated(ContextClusteringCommand message) throws ClusteringFault; public void setConfigurationContext(ConfigurationContext configurationContext); } ./src/org/apache/axis2/clustering/configuration/0000775000175000017500000000000011767656530021060 5ustar brianbrian./src/org/apache/axis2/clustering/configuration/ConfigurationManager.java0000664000175000017500000000674511767656530026041 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.configuration; import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.ParameterInclude; public interface ConfigurationManager extends ParameterInclude { // ###################### Configuration management methods ########################## /** * Load a set of service groups * * @param serviceGroupNames The set of service groups to be loaded * @throws ClusteringFault */ void loadServiceGroups(String[] serviceGroupNames) throws ClusteringFault; /** * Unload a set of service groups * * @param serviceGroupNames The set of service groups to be unloaded * @throws ClusteringFault */ void unloadServiceGroups(String[] serviceGroupNames) throws ClusteringFault; /** * Apply a policy to a service * * @param serviceName The name of the service to which this policy needs to be applied * @param policy The serialized policy to be applied to the service * @throws ClusteringFault */ void applyPolicy(String serviceName, String policy) throws ClusteringFault; /** * Reload the entire configuration of an Axis2 Node * * @throws ClusteringFault */ void reloadConfiguration() throws ClusteringFault; // ###################### Transaction management methods ########################## /** * First phase of the 2-phase commit protocol. * Notifies a node that it needs to prepare to switch to a new configuration. * * @throws ClusteringFault */ void prepare() throws ClusteringFault; /** * Rollback whatever was done * * @throws ClusteringFault */ void rollback() throws ClusteringFault; /** * Second phase of the 2-phase commit protocol. * Notifies a node that it needs to switch to a new configuration. * * @throws ClusteringFault */ void commit() throws ClusteringFault; // ######################## General management methods ############################ /** * To notify other nodes that an Exception occurred, during the processing * of a {@link ConfigurationClusteringCommand} * * @param throwable The throwable which has to be propogated to other nodes */ void exceptionOccurred(Throwable throwable) throws ClusteringFault; /** * For registering a configuration event listener. */ void setConfigurationManagerListener(ConfigurationManagerListener listener); /** * Set the configuration context * * @param configurationContext */ void setConfigurationContext(ConfigurationContext configurationContext); }./src/org/apache/axis2/clustering/configuration/ConfigurationManagerListener.java0000664000175000017500000000265111767656530027537 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.configuration; import org.apache.axis2.context.ConfigurationContext; public interface ConfigurationManagerListener { void serviceGroupsLoaded(ConfigurationClusteringCommand command); void serviceGroupsUnloaded(ConfigurationClusteringCommand command); void policyApplied(ConfigurationClusteringCommand command); void configurationReloaded(ConfigurationClusteringCommand command); void prepareCalled(); void rollbackCalled(); void commitCalled(); void handleException(Throwable throwable); void setConfigurationContext(ConfigurationContext configurationContext); } ./src/org/apache/axis2/clustering/configuration/ConfigurationClusteringCommand.java0000664000175000017500000000536111767656530030076 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering.configuration; import org.apache.axis2.clustering.ClusteringCommand; import org.apache.axis2.context.ConfigurationContext; /** * This class represents the 2-phase commit protocol, where an event is processed, * the system is prepared to switch to a new configuration based on the processed event, * and finally commits the new configuration (i.e. the system switches to the new configuration). * As can be seen, this is a 3-step process. */ public abstract class ConfigurationClusteringCommand extends ClusteringCommand { public static final int RELOAD_CONFIGURATION = 0; public static final int LOAD_SERVICE_GROUPS = 1; public static final int UNLOAD_SERVICE_GROUPS = 2; public static final int APPLY_SERVICE_POLICY = 3; public static final int PREPARE = 4; public static final int COMMIT = 5; public static final int EXCEPTION = 6; public static final int ROLLBACK = 7; /** * Get the command type * * @return The command type */ public abstract int getCommandType(); /** * Process the event. The implementer of this interface will * need to cache the outcome of this processing. * * @param configContext * @throws Exception */ public abstract void process(ConfigurationContext configContext) throws Exception; /** * Prepare to switch to the new configuration * * @param configContext */ public abstract void prepare(ConfigurationContext configContext); /** * Commit the new configuration. i.e. switch the system to the new configuration * * @param configContext * @throws Exception */ public abstract void commit(ConfigurationContext configContext) throws Exception; /** * Rollback any changes carried out * * @param configContext * @throws Exception */ public abstract void rollback(ConfigurationContext configContext) throws Exception; } ./src/org/apache/axis2/clustering/ClusteringConstants.java0000664000175000017500000000376611767656530023104 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; /** * All constants used by the Axis2 clustering implementation */ public final class ClusteringConstants { private ClusteringConstants() { } public static final String AVOID_INITIATION_KEY = "AvoidInitiation"; /** * The clustering domain/group. Nodes in the same group will belong to the same multicast domain. * There will not be interference between nodes in different group. */ public static final String DOMAIN = "domain"; public static final String NODE_MANAGER_SERVICE = "Axis2NodeManager"; public static final String REQUEST_BLOCKING_HANDLER = "RequestBlockingHandler"; public static final String CLUSTER_INITIALIZED = "local_cluster.initialized"; public static final String RECD_CONFIG_INIT_MSG = "local_recd.config.init.method"; public static final String RECD_STATE_INIT_MSG = "local_recd.state.init.method"; public static final String BLOCK_ALL_REQUESTS = "local_wso2wsas.block.requests"; public static final String LOCAL_IP_ADDRESS = "axis2.local.ip.address"; /** * Synchronize the states of all members in the cluster */ public static final String SYNCHRONIZE_ALL_MEMBERS = "synchronizeAll"; } ./src/org/apache/axis2/clustering/ClusteringCommand.java0000664000175000017500000000165411767656530022500 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; import java.io.Serializable; public abstract class ClusteringCommand implements Serializable { } ./src/org/apache/axis2/clustering/MessageSender.java0000664000175000017500000000202011767656530021573 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; /** * */ public interface MessageSender { public void sendToGroup(ClusteringCommand msg) throws ClusteringFault; public void sendToSelf(ClusteringCommand msg) throws ClusteringFault; } ./src/org/apache/axis2/clustering/ClusterManager.java0000664000175000017500000000414111767656530021770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; import org.apache.axis2.clustering.configuration.ConfigurationManager; import org.apache.axis2.clustering.context.ContextManager; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.ParameterInclude; /** * This is the main interface in the Axis2 clustering implementation. * In order to plug-in a new clustering implementation, this interface has to be * implmented. */ public interface ClusterManager extends ParameterInclude { /** * Initialize the ClusteManager * * @throws ClusteringFault */ void init() throws ClusteringFault; /** * @return The ContextManager */ ContextManager getContextManager(); /** * @return The ConfigurationManager */ ConfigurationManager getConfigurationManager(); /** * @param contextManager */ void setContextManager(ContextManager contextManager); /** * @param configurationManager */ void setConfigurationManager(ConfigurationManager configurationManager); /** * @throws ClusteringFault */ void shutdown() throws ClusteringFault; /** * Set the configuration context * * @param configurationContext */ void setConfigurationContext(ConfigurationContext configurationContext); }./src/org/apache/axis2/clustering/RequestBlockingHandler.java0000664000175000017500000001070411767656530023455 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.handlers.AbstractHandler; /** * */ public class RequestBlockingHandler extends AbstractHandler { public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // Handle blocking at gobal level ConfigurationContext cfgCtx = msgContext.getConfigurationContext(); Boolean isBlockingAllRequests = (Boolean) cfgCtx.getProperty(ClusteringConstants.BLOCK_ALL_REQUESTS); AxisServiceGroup serviceGroup = msgContext.getAxisServiceGroup(); // Handle blocking at service group level Boolean isBlockingServiceGroupRequests = Boolean.FALSE; if (serviceGroup != null) { Parameter blockingParam = serviceGroup.getParameter(ClusteringConstants.BLOCK_ALL_REQUESTS); if (blockingParam != null) { isBlockingServiceGroupRequests = (Boolean) blockingParam.getValue(); } } // Handle blocking at service level AxisService service = msgContext.getAxisService(); Boolean isBlockingServiceRequests = Boolean.FALSE; if (service != null) { Parameter blockingParam = service.getParameter(ClusteringConstants.BLOCK_ALL_REQUESTS); if (blockingParam != null) { isBlockingServiceRequests = (Boolean) blockingParam.getValue(); } } if (isBlockingAllRequests != null && isBlockingAllRequests.booleanValue()) { // Allow only NodeManager service commit requests to pass through. Block all others AxisService axisService = msgContext.getAxisService(); if (!axisService.getName().equals(ClusteringConstants.NODE_MANAGER_SERVICE)) { if (!msgContext.getAxisOperation().getName().getLocalPart().equals("commit")) { throw new AxisFault("System is being reinitialized. " + "Please try again in a few seconds."); } else { throw new AxisFault("NodeManager service cannot call any other " + "operation after calling prepare"); } } } else if (isBlockingServiceGroupRequests.booleanValue()) { throw new AxisFault("This service group is being initialized or unloaded. " + "Please try again in a few seconds."); } else if (isBlockingServiceRequests.booleanValue()) { throw new AxisFault("This service is being initialized. " + "Please try again in a few seconds."); } return InvocationResponse.CONTINUE; } public boolean equals(Object obj) { if(obj instanceof RequestBlockingHandler){ RequestBlockingHandler that = (RequestBlockingHandler) obj; HandlerDescription thisDesc = this.getHandlerDesc(); HandlerDescription thatDesc = that.getHandlerDesc(); if(thisDesc != null && thatDesc != null && thisDesc.getName().equals(thatDesc.getName())){ return true; } } return false; } public int hashCode() { if(this.handlerDesc != null){ return this.handlerDesc.hashCode(); } return super.hashCode(); } } ./src/org/apache/axis2/clustering/ClusteringFault.java0000664000175000017500000000215711767656530022174 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.clustering; import org.apache.axis2.AxisFault; public class ClusteringFault extends AxisFault { public ClusteringFault (String message) { super (message); } public ClusteringFault (String message, Exception e) { super (message, e); } public ClusteringFault (Exception e) { super (e); } } ./src/org/apache/axis2/schema/0000775000175000017500000000000011767656530015272 5ustar brianbrian./src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java0000664000175000017500000005642111767656530022770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; /** * This class is used as a holder to pass on the meta information to the bean writer. * This meta information is used by the writer to write the databinding conversion code. * Note - Metainfholders are not meant to be reused!!!. They are per-class basis and are strictly * not thread safe!!!! */ public class BeanWriterMetaInfoHolder { protected boolean ordered = false; protected boolean anonymous = false; protected boolean choice = false; protected boolean simple = false; protected boolean extension = false; protected boolean restriction = false; private String extensionClassName = ""; private String restrictionClassName = ""; private QName extensionBaseType = null; private QName restrictionBaseType = null; protected Map elementToSchemaQNameMap = new LinkedHashMap(); protected Map elementToJavaClassMap = new LinkedHashMap(); protected Map specialTypeFlagMap = new LinkedHashMap(); protected Map qNameMaxOccursCountMap = new LinkedHashMap(); protected Map qNameMinOccursCountMap = new LinkedHashMap(); protected Map qNameOrderMap = new LinkedHashMap(); protected QName ownQname = null; protected String ownClassName = null; protected long lengthFacet = -1; protected long maxLengthFacet = -1; protected long minLengthFacet = -1; protected ArrayList enumFacet = new ArrayList(); protected String patternFacet = null; protected String maxExclusiveFacet = null; protected String minExclusiveFacet = null; protected String maxInclusiveFacet = null; protected String minInclusiveFacet = null; protected Map memberTypes = new HashMap(); protected Map xmlNameJavaNameMap = new HashMap(); protected List memberTypesKeys = new ArrayList(); protected Map elementQNameToDefulatValueMap = new HashMap(); protected QName itemTypeQName; protected String itemTypeClassName; protected boolean isUnion; protected boolean isList; protected boolean isParticleClass; // keep whether this class has a partical class type variable protected boolean hasParticleType; protected List nillableQNameList = new ArrayList(); //the parent metainfo holder, useful in handling extensions and //restrictions protected BeanWriterMetaInfoHolder parent = null; public boolean isChoice() { return choice; } public void setChoice(boolean choice) { this.choice = choice; } public boolean isSimple() { return simple; } public void setSimple(boolean simple) { this.simple = simple; } public String getOwnClassName() { return ownClassName; } public void setOwnClassName(String ownClassName) { this.ownClassName = ownClassName; } public QName getOwnQname() { return ownQname; } public void setOwnQname(QName ownQname) { this.ownQname = ownQname; } /** * Gets the parent */ public BeanWriterMetaInfoHolder getParent() { return parent; } /** * Gets the anonymous status. * * @return Returns boolean. */ public boolean isAnonymous() { return anonymous; } /** * Sets the anonymous flag. * * @param anonymous */ public void setAnonymous(boolean anonymous) { this.anonymous = anonymous; } /** * Sets the extensions base class name. Valid only when the isExtension * returns true. * * @return Returns String. */ public String getExtensionClassName() { return extensionClassName; } /** * Sets the extensions base class name. Valid only when the isExtension * returns true. * * @param extensionClassName */ public void setExtensionClassName(String extensionClassName) { this.extensionClassName = extensionClassName; } /** * Gets the extension status. * * @return Returns boolean. */ public boolean isExtension() { return extension; } /** * Sets the extension status. * * @param extension */ public void setExtension(boolean extension) { this.extension = extension; } public String getRestrictionClassName() { return restrictionClassName; } /** * Sets the restriction base class name. Valid only when the isRestriction * returns true. * * @param restrictionClassName */ public void setRestrictionClassName(String restrictionClassName) { this.restrictionClassName = restrictionClassName; } /** * Gets the restriction status. * * @return Returns boolean. */ public boolean isRestriction() { return restriction; } /** * Sets the restriction status. * * @param restriction */ public void setRestriction(boolean restriction) { this.restriction = restriction; } /** * Sets the extension basetype. * * @param extensionBaseType */ public void setExtensionBaseType(QName extensionBaseType) { this.extensionBaseType = extensionBaseType; } /** * Checks if it is a extension base type. * * @param extensionBaseType */ public boolean isExtensionBaseType(QName extensionBaseType) { return (this.extensionBaseType == extensionBaseType); } /** * Sets the restriction basetype. * * @param restrictionBaseType */ public void setRestrictionBaseType(QName restrictionBaseType) { this.restrictionBaseType = restrictionBaseType; } /** * Checks if it is a restriction base type. * * @param restrictionBaseType */ public boolean isRestrictionBaseType(QName restrictionBaseType) { QName baseTypeQName = (QName) this.elementToSchemaQNameMap.get(restrictionBaseType); return (this.restrictionBaseType != null) && (baseTypeQName != null) && this.restrictionBaseType.equals(baseTypeQName); } /** * Gets the ordered status. * * @return Returns boolean. */ public boolean isOrdered() { return ordered; } /** * Sets the ordered flag. * * @param ordered */ public void setOrdered(boolean ordered) { this.ordered = ordered; } /** * Registers a mapping. * * @param qName * @param schemaName * @param javaClassName */ public void registerMapping(QName qName, QName schemaName, String javaClassName) { registerMapping(qName, schemaName, javaClassName, SchemaConstants.ELEMENT_TYPE); } /** * Registers a Qname as nillable * The qName better be of an element * * @param qName * @param schemaName * @param javaClassName */ public void registerNillableQName(QName eltQName) { nillableQNameList.add(eltQName); } /** * Returns whether a QName is nillable or not * * @param eltQName */ public boolean isNillable(QName eltQName) { return nillableQNameList.contains(eltQName); } /** * Registers a mapping. * * @param qName * @param schemaName * @param javaClassName * @param type */ public void registerMapping(QName qName, QName schemaName, String javaClassName, int type) { this.elementToJavaClassMap.put(qName, javaClassName); this.elementToSchemaQNameMap.put(qName, schemaName); addtStatus(qName, type); } /** * this method registers the defult value agaist the element qname. * @param qname * @param value */ public void registerDefaultValue(QName qname,String value){ this.elementQNameToDefulatValueMap.put(qname,value); } /** * * @param qname * @return is a default value available for this qname */ public boolean isDefaultValueAvailable(QName qname){ return this.elementQNameToDefulatValueMap.containsKey(qname); } /** * gets the default value for qname * @param qname * @return default value for this qname */ public String getDefaultValueForQName(QName qname){ return (String) this.elementQNameToDefulatValueMap.get(qname); } /** * Gets the schema name for the given QName. * * @param eltQName * @return Returns QName. */ public QName getSchemaQNameForQName(QName eltQName) { return (QName) this.elementToSchemaQNameMap.get(eltQName); } /** * Gets the class name for the QName. * * @param eltQName * @return Returns String. */ public String getClassNameForQName(QName eltQName) { return (String) this.elementToJavaClassMap.get(eltQName); } /** * Gets whether a given QName is an attribute * * @param qName * @return Returns boolean. */ public boolean getAttributeStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.ATTRIBUTE_TYPE); } /** * checks the element corresponds to the qName type is xsd:anyType * * @param qName * @return is element corresponds to qName has xsd:anyType */ public boolean getDefaultStatusForQName(QName qName) { boolean isDefault = false; QName schemaTypeQName = (QName) this.elementToSchemaQNameMap.get(qName); if (schemaTypeQName != null) { isDefault = schemaTypeQName.equals(SchemaConstants.XSD_ANYTYPE); } return isDefault; } /** * Gets whether a given QName represents a anyType * * @param qName * @return Returns boolean. */ public boolean getAnyStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.ANY_TYPE); } /** * Gets whether a given QName refers to an array. * * @param qName * @return Returns boolean. */ public boolean getArrayStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.ARRAY_TYPE); } /** * Gets whether a given QName refers to binary. * * @param qName * @return Returns boolean. */ public boolean getBinaryStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.BINARY_TYPE); } /** * * @param qName * @return is this a inner choice */ public boolean getInnerChoiceStatusForQName(QName qName){ Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.INNER_CHOICE_ELEMENT); } /** * Gets whether a given QName refers to Simple Type. * * @param qName * @return Returns boolean. */ public boolean getSimpleStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.SIMPLE_TYPE_OR_CONTENT); } /** * * @param qName * @return whether the attribute is a partical class or not */ public boolean getParticleTypeStatusForQName(QName qName){ Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.PARTICLE_TYPE_ELEMENT); } /** * Gets whether a given QName has the any attribute status. * * @param qName * @return Returns boolean. */ public boolean getAnyAttributeStatusForQName(QName qName) { return getArrayStatusForQName(qName) && getAnyStatusForQName(qName); } /** * Gets whether a given QName has the optional attribute status. * * @param qName QName of attribute * @return Returns true if attribute has optional status */ public boolean getOptionalAttributeStatusForQName(QName qName) { Integer state = (Integer) specialTypeFlagMap.get(qName); return state != null && getStatus(state.intValue(), SchemaConstants.OPTIONAL_TYPE); } /** * Clears the whole set of tables. */ public void clearTables() { this.elementToJavaClassMap.clear(); this.elementToSchemaQNameMap.clear(); this.elementToSchemaQNameMap.clear(); this.elementToJavaClassMap.clear(); this.specialTypeFlagMap.clear(); this.qNameMaxOccursCountMap.clear(); this.qNameMinOccursCountMap.clear(); this.qNameOrderMap.clear(); this.elementQNameToDefulatValueMap.clear(); } /** * Adds the minOccurs associated with a QName. * * @param qName * @param minOccurs */ public void addMinOccurs(QName qName, long minOccurs) { this.qNameMinOccursCountMap.put(qName, new Long(minOccurs)); } /** * Registers a QName for the order. * * @param qName * @param index */ public void registerQNameIndex(QName qName, int index) { this.qNameOrderMap.put(new Integer(index), qName); } /** * Adds the minOccurs associated with a QName. * * @param qName * @return Returns long. */ public long getMinOccurs(QName qName) { Long l = (Long) this.qNameMinOccursCountMap.get(qName); return l != null ? l.longValue() : 1; //default for min is 1 } /** * Gets the maxOccurs associated with a QName. * * @param qName * @return Returns long. */ public long getMaxOccurs(QName qName) { Long l = (Long) this.qNameMaxOccursCountMap.get(qName); return l != null ? l.longValue() : 1; //default for max is 1 } /** * Adds the maxOccurs associated with a QName. * * @param qName * @param maxOccurs */ public void addMaxOccurs(QName qName, long maxOccurs) { this.qNameMaxOccursCountMap.put(qName, new Long(maxOccurs)); } /** * @return Returns Iterator. * @deprecated Use #getQNameArray */ public Iterator getElementQNameIterator() { return elementToJavaClassMap.keySet().iterator(); } /** * Gets the QName array - may not be ordered. * * @return Returns QName[]. */ public QName[] getQNameArray() { Set keySet = elementToJavaClassMap.keySet(); return (QName[]) keySet.toArray(new QName[keySet.size()]); } /** * Gets the ordered QName array - useful in sequences where the order needs to be preserved * Note - #registerQNameIndex needs to be called if this is to work properly! * * @return Returns QName[]. */ public QName[] getOrderedQNameArray() { //get the keys of the order map Set set = qNameOrderMap.keySet(); int count = set.size(); Integer[] keys = (Integer[]) set.toArray(new Integer[count]); Arrays.sort(keys); //Now refill the Ordered QName Array List returnQNames = new ArrayList(); for (int i = 0; i < keys.length; i++) { returnQNames.add(qNameOrderMap.get(keys[i])); } //we've missed the attributes, so if there are attributes //add them explicitly to the end of this list QName[] allNames = getQNameArray(); for (int i = 0; i < allNames.length; i++) { if (getAttributeStatusForQName(allNames[i])) { returnQNames.add(allNames[i]); } } return (QName[]) returnQNames.toArray(new QName[returnQNames.size()]); } /** * Finds the starting count for the addition of new items to the order * * @return the starting number for the sequence */ public int getOrderStartPoint() { return qNameOrderMap.size(); } /** * Creates link to th * * @param metaInfo */ public void setAsParent(BeanWriterMetaInfoHolder metaInfo) { parent = metaInfo; } /** * Adds a another status to a particular Qname. * A Qname can be associated with multiple status flags * and they all will be preserved * * @param type * @param mask */ public void addtStatus(QName type, int mask) { Object obj = this.specialTypeFlagMap.get(type); if (obj != null) { int preValue = ((Integer) obj).intValue(); this.specialTypeFlagMap.put(type, new Integer((preValue | mask))); } else { this.specialTypeFlagMap.put(type, new Integer(mask)); } } private boolean getStatus(int storedStatus, int mask) { //when the mask is anded with the status then we should get //the mask it self! return (mask == (mask & storedStatus)); } /** * Sets the length facet. * * @param lengthFacet */ public void setLengthFacet(long lengthFacet) { this.lengthFacet = lengthFacet; } /** * Gets the length facet. * * @return Returns length facet. */ public long getLengthFacet() { return this.lengthFacet; } /** * Sets the maxExclusive. * * @param maxExclusiveFacet */ public void setMaxExclusiveFacet(String maxExclusiveFacet) { this.maxExclusiveFacet = maxExclusiveFacet; } /** * Gets the maxExclusive. * * @return Returns the maxExclusive. */ public String getMaxExclusiveFacet() { return this.maxExclusiveFacet; } /** * Sets the minExclusive. * * @param minExclusiveFacet */ public void setMinExclusiveFacet(String minExclusiveFacet) { this.minExclusiveFacet = minExclusiveFacet; } /** * Gets the minExclusive. * * @return Returns the minExclusive. */ public String getMinExclusiveFacet() { return this.minExclusiveFacet; } /** * Sets the maxInclusive. * * @param maxInclusiveFacet */ public void setMaxInclusiveFacet(String maxInclusiveFacet) { this.maxInclusiveFacet = maxInclusiveFacet; } /** * Gets the maxInclusive. * * @return Returns the maxInclusive. */ public String getMaxInclusiveFacet() { return this.maxInclusiveFacet; } /** * Sets the minInclusive. * * @param minInclusiveFacet */ public void setMinInclusiveFacet(String minInclusiveFacet) { this.minInclusiveFacet = minInclusiveFacet; } /** * Gets the minInclusive. * * @return Returns the minInclusive. */ public String getMinInclusiveFacet() { return this.minInclusiveFacet; } /** * Sets the maxLength. * * @param maxLengthFacet */ public void setMaxLengthFacet(long maxLengthFacet) { this.maxLengthFacet = maxLengthFacet; } /** * Gets the maxLength. * * @return Returns maxLength. */ public long getMaxLengthFacet() { return this.maxLengthFacet; } /** * Sets the minLength. * * @param minLengthFacet */ public void setMinLengthFacet(long minLengthFacet) { this.minLengthFacet = minLengthFacet; } /** * Gets the minLength. * * @return Returns minLength. */ public long getMinLengthFacet() { return this.minLengthFacet; } /** * Sets the enumeration. * * @param enumFacet */ public void setEnumFacet(ArrayList enumFacet) { this.enumFacet = enumFacet; } /** * Adds the enumeration. * * @param enumFacet */ public void addEnumFacet(String enumFacet) { this.enumFacet.add(enumFacet); } /** * Gets the enumeration. * * @return Returns enumeration. */ public List getEnumFacet() { return this.enumFacet; } /** * Sets the pattern. * * @param patternFacet */ public void setPatternFacet(String patternFacet) { this.patternFacet = patternFacet; } /** * Gets the pattern. * * @return Returns pattern. */ public String getPatternFacet() { return this.patternFacet; } /** * * @return Returns is union */ public boolean isUnion() { return isUnion; } public void setUnion(boolean union) { isUnion = union; } /** * * @return Returns memeber type in a union */ public Map getMemberTypes() { return memberTypes; } public void setMemberTypes(Map memberTypes) { this.memberTypes = memberTypes; } public List getMemberTypesKeys() { return memberTypesKeys; } public void setMemberTypesKeys(List memberTypesKeys) { this.memberTypesKeys = memberTypesKeys; } public void addMemberType(QName qname,String className){ this.memberTypes.put(qname,className); this.memberTypesKeys.add(qname); } public boolean isList() { return isList; } public void setList(boolean list) { isList = list; } public QName getItemTypeQName() { return itemTypeQName; } public void setItemTypeQName(QName itemTypeQName) { this.itemTypeQName = itemTypeQName; } public String getItemTypeClassName() { return itemTypeClassName; } public void setItemTypeClassName(String itemTypeClassName) { this.itemTypeClassName = itemTypeClassName; } public boolean isParticleClass() { return isParticleClass; } public void setParticleClass(boolean particleClass) { isParticleClass = particleClass; } public boolean isHasParticleType() { return hasParticleType; } public void setHasParticleType(boolean hasParticleType) { this.hasParticleType = hasParticleType; } public void addXmlNameJavaNameMapping(String xmlName,String javaName){ this.xmlNameJavaNameMap.put(xmlName,javaName); } public boolean isJavaNameMappingAvailable(String xmlName){ return this.xmlNameJavaNameMap.containsKey(xmlName); } public String getJavaName(String xmlName){ return (String) this.xmlNameJavaNameMap.get(xmlName); } } ./src/org/apache/axis2/schema/util/0000775000175000017500000000000011767656530016247 5ustar brianbrian./src/org/apache/axis2/schema/util/PrimitiveTypeFinder.java0000664000175000017500000000372411767656530023062 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.util; import java.util.ArrayList; import java.util.List; /** * A simple utiliy to find whether a given class name is * primitive or not */ public class PrimitiveTypeFinder { private static List primitiveClassNameList; static{ primitiveClassNameList = new ArrayList(); //add the java primitive class names primitiveClassNameList.add(int.class.getName()); primitiveClassNameList.add(long.class.getName()); primitiveClassNameList.add(byte.class.getName()); primitiveClassNameList.add(double.class.getName()); primitiveClassNameList.add(boolean.class.getName()); primitiveClassNameList.add(float.class.getName()); primitiveClassNameList.add(short.class.getName()); primitiveClassNameList.add(char.class.getName()); } /** * * @param className */ public static boolean isPrimitive(String className){ //if an array type is passed, strip out the [] part if (className.indexOf("[]")!=-1){ className = className.substring(0,className.indexOf("[]")); } return primitiveClassNameList.contains(className); } } ./src/org/apache/axis2/schema/util/SchemaPropertyLoader.java0000664000175000017500000000634011767656530023211 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.util; import org.apache.axis2.schema.SchemaCompiler; import org.apache.axis2.schema.SchemaConstants; import org.apache.axis2.schema.typemap.TypeMap; import org.apache.axis2.schema.writer.BeanWriter; import java.util.Properties; /** * Loads the properties for the schema compiler. */ public class SchemaPropertyLoader { private static String beanTemplate = null; private static BeanWriter beanWriterInstance = null; private static TypeMap typeMapperInstance = null; private static Properties propertyMap; private static final String ADB_PROPERTY_FILE_KEY = "org.apache.adb.properties"; static { try { //load the properties Properties props = new Properties(); String schemaPropFilename = System.getProperty(ADB_PROPERTY_FILE_KEY); if (schemaPropFilename==null){ // there was no system property .load the default props.load(SchemaCompiler.class.getResourceAsStream(SchemaConstants.SchemaPropertyNames.SCHEMA_COMPILER_PROPERTIES)); }else{ props.load(SchemaCompiler.class.getResourceAsStream(schemaPropFilename)); } String beanWriterClassName = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_KEY); if (beanWriterClassName != null) { beanWriterInstance = (BeanWriter) Class.forName(beanWriterClassName).newInstance(); } String typeMapperClassName = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TYPEMAP_KEY); if (typeMapperClassName != null) { typeMapperInstance = (TypeMap) Class.forName(typeMapperClassName).newInstance(); } beanTemplate = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TEMPLATE_KEY); //set the props as the property map propertyMap = props; } catch (Exception e) { throw new RuntimeException(e); } } /** * Exposes the whole property set * @return Returns Properties. */ public static Properties getPropertyMap() { return propertyMap; } public static String getBeanTemplate() { return beanTemplate; } public static BeanWriter getBeanWriterInstance() { return beanWriterInstance; } public static TypeMap getTypeMapperInstance() { return typeMapperInstance; } } ./src/org/apache/axis2/schema/util/PrimitiveTypeWrapper.java0000664000175000017500000000440611767656530023271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.util; import java.util.HashMap; import java.util.Map; public class PrimitiveTypeWrapper { private static Map primitiveTypeWrappersMap; static{ primitiveTypeWrappersMap = new HashMap(); //add the java primitive class names primitiveTypeWrappersMap.put(int.class.getName(),Integer.class.getName()); primitiveTypeWrappersMap.put(long.class.getName(),Long.class.getName()); primitiveTypeWrappersMap.put(byte.class.getName(),Byte.class.getName()); primitiveTypeWrappersMap.put(double.class.getName(),Double.class.getName()); primitiveTypeWrappersMap.put(boolean.class.getName(),Boolean.class.getName()); primitiveTypeWrappersMap.put(float.class.getName(),Float.class.getName()); primitiveTypeWrappersMap.put(short.class.getName(),Short.class.getName()); primitiveTypeWrappersMap.put(char.class.getName(),Character.class.getName()); } /** * * @param primitiveclassName */ public static String getWrapper(String primitiveclassName){ String returnClassName = null; if (primitiveclassName.trim().endsWith("[]")) { String className = primitiveclassName.substring(0, primitiveclassName.length() - 2); returnClassName = primitiveTypeWrappersMap.get(className) + "[]"; } else { returnClassName = (String) primitiveTypeWrappersMap.get(primitiveclassName); } return returnClassName; } } ./src/org/apache/axis2/schema/SchemaConstants.java0000664000175000017500000003071511767656530021240 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import org.apache.axis2.namespace.Constants; import javax.xml.namespace.QName; /** * Constants for the QNames of standard schema types */ public class SchemaConstants { public static final String URI_DEFAULT_SCHEMA_XSD = Constants.URI_2001_SCHEMA_XSD; public static final QName XSD_STRING = new QName(URI_DEFAULT_SCHEMA_XSD, "string"); public static final QName XSD_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_XSD, "boolean"); public static final QName XSD_DOUBLE = new QName(URI_DEFAULT_SCHEMA_XSD, "double"); public static final QName XSD_FLOAT = new QName(URI_DEFAULT_SCHEMA_XSD, "float"); public static final QName XSD_INT = new QName(URI_DEFAULT_SCHEMA_XSD, "int"); public static final QName XSD_INTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "integer"); public static final QName XSD_LONG = new QName(URI_DEFAULT_SCHEMA_XSD, "long"); public static final QName XSD_SHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "short"); public static final QName XSD_BYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "byte"); public static final QName XSD_DECIMAL = new QName(URI_DEFAULT_SCHEMA_XSD, "decimal"); public static final QName XSD_BASE64 = new QName(URI_DEFAULT_SCHEMA_XSD, "base64Binary"); public static final QName XSD_HEXBIN = new QName(URI_DEFAULT_SCHEMA_XSD, "hexBinary"); public static final QName XSD_ANYSIMPLETYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anySimpleType"); public static final QName XSD_ANYTYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anyType"); public static final QName XSD_ANY = new QName(URI_DEFAULT_SCHEMA_XSD, "any"); public static final QName XSD_QNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "QName"); public static final QName XSD_DATETIME = new QName(URI_DEFAULT_SCHEMA_XSD, "dateTime"); public static final QName XSD_DATE = new QName(URI_DEFAULT_SCHEMA_XSD, "date"); public static final QName XSD_TIME = new QName(URI_DEFAULT_SCHEMA_XSD, "time"); public static final QName XSD_UNSIGNEDLONG = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedLong"); public static final QName XSD_UNSIGNEDINT = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedInt"); public static final QName XSD_UNSIGNEDSHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedShort"); public static final QName XSD_UNSIGNEDBYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedByte"); public static final QName XSD_POSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "positiveInteger"); public static final QName XSD_NEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "negativeInteger"); public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "nonNegativeInteger"); public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "nonPositiveInteger"); public static final QName XSD_YEARMONTH = new QName(URI_DEFAULT_SCHEMA_XSD, "gYearMonth"); public static final QName XSD_MONTHDAY = new QName(URI_DEFAULT_SCHEMA_XSD, "gMonthDay"); public static final QName XSD_YEAR = new QName(URI_DEFAULT_SCHEMA_XSD, "gYear"); public static final QName XSD_MONTH = new QName(URI_DEFAULT_SCHEMA_XSD, "gMonth"); public static final QName XSD_DAY = new QName(URI_DEFAULT_SCHEMA_XSD, "gDay"); public static final QName XSD_DURATION = new QName(URI_DEFAULT_SCHEMA_XSD, "duration"); public static final QName XSD_NAME = new QName(URI_DEFAULT_SCHEMA_XSD, "Name"); public static final QName XSD_NCNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "NCName"); public static final QName XSD_NMTOKEN = new QName(URI_DEFAULT_SCHEMA_XSD, "NMTOKEN"); public static final QName XSD_NMTOKENS = new QName(URI_DEFAULT_SCHEMA_XSD, "NMTOKENS"); public static final QName XSD_NOTATION = new QName(URI_DEFAULT_SCHEMA_XSD, "NOTATION"); public static final QName XSD_ENTITY = new QName(URI_DEFAULT_SCHEMA_XSD, "ENTITY"); public static final QName XSD_ENTITIES = new QName(URI_DEFAULT_SCHEMA_XSD, "ENTITIES"); public static final QName XSD_IDREF = new QName(URI_DEFAULT_SCHEMA_XSD, "IDREF"); public static final QName XSD_IDREFS = new QName(URI_DEFAULT_SCHEMA_XSD, "IDREFS"); public static final QName XSD_ANYURI = new QName(URI_DEFAULT_SCHEMA_XSD, "anyURI"); public static final QName XSD_LANGUAGE = new QName(URI_DEFAULT_SCHEMA_XSD, "language"); public static final QName XSD_ID = new QName(URI_DEFAULT_SCHEMA_XSD, "ID"); public static final QName XSD_SCHEMA = new QName(URI_DEFAULT_SCHEMA_XSD, "schema"); public static final QName XSD_NORMALIZEDSTRING = new QName(URI_DEFAULT_SCHEMA_XSD, "normalizedString"); public static final QName XSD_TOKEN = new QName(URI_DEFAULT_SCHEMA_XSD, "token"); //soap encoding constants public static final String URI_DEFAULT_SCHEMA_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; public static final QName SOAP_ENCODING_ARRAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Array"); public static final QName SOAP_ENCODING_STRUCT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Struct"); public static final QName SOAP_ENCODING_BASE64 = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "base64"); public static final QName SOAP_ENCODING_DURATION = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "duration"); public static final QName SOAP_ENCODING_DATETIME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "dateTime"); public static final QName SOAP_ENCODING_NOTATION = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NOTATION"); public static final QName SOAP_ENCODING_TIME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "time"); public static final QName SOAP_ENCODING_DATE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "date"); public static final QName SOAP_ENCODING_GYEARMONTH = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gYearMonth"); public static final QName SOAP_ENCODING_GYEAR = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gYear"); public static final QName SOAP_ENCODING_GMONTHDAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gMonthDay"); public static final QName SOAP_ENCODING_GDAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gDay"); public static final QName SOAP_ENCODING_GMONTH = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gMonth"); public static final QName SOAP_ENCODING_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "boolean"); public static final QName SOAP_ENCODING_BASE64BINARY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "base64Binary"); public static final QName SOAP_ENCODING_HEXBINARY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "hexBinary"); public static final QName SOAP_ENCODING_FLOAT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "float"); public static final QName SOAP_ENCODING_DOUBLE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "double"); public static final QName SOAP_ENCODING_ANYURI = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "anyURI"); public static final QName SOAP_ENCODING_QNAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "QName"); public static final QName SOAP_ENCODING_STRING = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "string"); public static final QName SOAP_ENCODING_NORMALIZEDSTRING = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "normalizedString"); public static final QName SOAP_ENCODING_TOKEN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "token"); public static final QName SOAP_ENCODING_LANGUAGE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "language"); public static final QName SOAP_ENCODING_NAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Name"); public static final QName SOAP_ENCODING_NMTOKEN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NMTOKEN"); public static final QName SOAP_ENCODING_NCNAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NCName"); public static final QName SOAP_ENCODING_NMTOKENS = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NMTOKENS"); public static final QName SOAP_ENCODING_ID = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ID"); public static final QName SOAP_ENCODING_IDREF = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "IDREF"); public static final QName SOAP_ENCODING_ENTITY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ENTITY"); public static final QName SOAP_ENCODING_IDREFS = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "IDREFS"); public static final QName SOAP_ENCODING_ENTITIES = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ENTITIES"); public static final QName SOAP_ENCODING_DECIMAL = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "decimal"); public static final QName SOAP_ENCODING_INTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "integer"); public static final QName SOAP_ENCODING_NONPOSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "nonPositiveInteger"); public static final QName SOAP_ENCODING_NEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "negativeInteger"); public static final QName SOAP_ENCODING_LONG = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "long"); public static final QName SOAP_ENCODING_INT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "int"); public static final QName SOAP_ENCODING_SHORT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "short"); public static final QName SOAP_ENCODING_BYTE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "byte"); public static final QName SOAP_ENCODING_NONNEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "nonNegativeInteger"); public static final QName SOAP_ENCODING_UNSIGNEDLONG = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedLong"); public static final QName SOAP_ENCODING_UNSIGNEDINT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedInt"); public static final QName SOAP_ENCODING_UNSIGNEDSHORT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedShort"); public static final QName SOAP_ENCODING_UNSIGNEDBYTE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedByte"); public static final QName SOAP_ENCODING_POSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "positiveInteger"); //bit patterns for the types public static final int ATTRIBUTE_TYPE = 0x0001; public static final int ELEMENT_TYPE = 0x0002; public static final int ARRAY_TYPE = 0x0004; public static final int ANY_TYPE = 0x0008; public static final int BINARY_TYPE = 0x0010; public static final int OPTIONAL_TYPE = 0x0020; public static final int SIMPLE_TYPE_OR_CONTENT = 0x0040; public static final int INNER_CHOICE_ELEMENT = 0x0080; public static final int PARTICLE_TYPE_ELEMENT = 0x0100; public static class SchemaPropertyNames{ public static final String SCHEMA_COMPILER_PROPERTIES = "/org/apache/axis2/schema/schema-compile.properties"; public static final String BEAN_WRITER_KEY = "schema.bean.writer.class"; public static final String BEAN_WRITER_TEMPLATE_KEY = "schema.bean.writer.template"; public static final String BEAN_WRITER_TYPEMAP_KEY = "schema.bean.typemap"; } public static class SchemaCompilerArguments{ public static final String WRAP_SCHEMA_CLASSES = "w"; public static final String WRITE_SCHEMA_CLASSES = "r"; public static final String STYLE = "s"; public static final String PACKAGE = "p"; public static final String MAPPER_PACKAGE = "mp"; public static final String HELPER_MODE = "h"; // this option is used to set minOccurs =0 for all the elements public static final String OFF_STRICT_VALIDATION = "osv"; // this option is used to use Wrapper classes for primitives public static final String USE_WRAPPER_CLASSES = "uwc"; } public static class SchemaCompilerInfoHolder{ public static final String CLASSNAME_KEY = "CLASS_NAME"; public static final String CLASSNAME_PRIMITVE_KEY = "CLASS_NAME_PRIMITIVE"; public static final String FAKE_QNAME = "Q_NAME"; } } ./src/org/apache/axis2/schema/c-schema-compile.properties0000664000175000017500000000342311767656530022520 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # ############################################################################### ################### Schema Compiler properties for Axis2/C ################### ############################################################################### # # The bean writer class # The bean writer is the class used by the schema compiler to write the beans # and should implement the org.apache.axis2.schema.writer.BeanWriter # inteface # schema.bean.writer.class=org.apache.axis2.schema.writer.CStructWriter # # bean writer template # The bean writers template is it's own responsibilty. (A bean writer provider # may choose not to use a template at all!) However the property loader will # load the following templates (reference) and provide it and in the case when the # bean writer is not statically bound to a template, this'll be useful. # schema.bean.writer.template=/org/apache/axis2/schema/template/CADBBeanTemplate # # The type map to be used by the schema compiler # schema.bean.typemap=org.apache.axis2.schema.typemap.CTypeMap ./src/org/apache/axis2/schema/i18n/0000775000175000017500000000000011767656530016051 5ustar brianbrian./src/org/apache/axis2/schema/i18n/resource.properties0000664000175000017500000000556511767656530022031 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # # Translation instructions. # 1. Each message line is of the form key=value. # Translate the value, DO NOT translate the key. # 2. The messages may contain arguments that will be filled in # by the runtime. These are of the form: {0}, {1}, etc. # These must appear as is in the message, though the order # may be changed to support proper language syntax. # 3. If a single quote character is to appear in the resulting # message, it must appear in this file as two consecutive # single quote characters. # 4. Lines beginning with "#" (like this one) are comment lines # and may contain translation instructions. They need not be # translated unless your translated file, rather than this file, # will serve as a base for other translators. ################## XSD2java ################################################# schema.xsdarg1=Argument1 - Source schema file name schema.xsdarg2=Argument2 - Output folder name schema.locationNotFolder=specified location is not a folder! schema.compilerexception=Compiler caused an exception ###################Schema compiler ########################################### schema.unsupportedcontenterror=Unsupported content {0} ! schema.unknowncontenterror=Unknown content! schema.elementNull=Null element encountered! Please check your schema! schema.referencedElementNotFound=The referenced element ''{0}'' was not found! schema.elementWithNoType=Could not find any schema type associated with the Element ''{0}'' schema.emptyName=Missing name attribute! Please check your schema! ################## Options ################################################### schema.unsupportedvalue=Unsupported value! ################## Java bean writer ########################################### schema.rootnotfolderexception=Root location needs to be a directory! schema.notimplementedxception=Not implemented yet schema.templateLoadException=Error loading the template schema.templateNotFoundException=template for this writer is not found schema.typeMissing=Type {0} missing! schema.docuement.error=Error in creating the document schema.soapencoding.error={0} is not supported../src/org/apache/axis2/schema/i18n/SchemaCompilerMessages.java0000664000175000017500000001361111767656530023301 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.i18n; import org.apache.axis2.i18n.MessageBundle; import org.apache.axis2.i18n.MessagesConstants; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * @see org.apache.axis2.i18n.Messages * The implementation is the same but just thisClass static reference * has SchemaCompilerMessages.class */ public class SchemaCompilerMessages { private static Class thisClass = SchemaCompilerMessages.class; private static final String projectName = MessagesConstants.projectName; private static final String resourceName = MessagesConstants.resourceName; private static final Locale locale = MessagesConstants.locale; private static final String packageName = getPackage(thisClass.getName()); private static final ClassLoader classLoader = thisClass.getClassLoader(); private static final ResourceBundle parent = (MessagesConstants.rootPackageName.equals(packageName)) ? null : MessagesConstants.rootBundle; /** * ** NO NEED TO CHANGE ANYTHING BELOW **** */ private static final MessageBundle messageBundle = new MessageBundle(projectName, packageName, resourceName, locale, classLoader, parent); /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @return Returns the formatted message. */ public static String getMessage(String key) throws MissingResourceException { return messageBundle.getMessage(key); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0) throws MissingResourceException { return messageBundle.getMessage(key, arg0); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2); } /** * Get a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @param arg2 The argument to place in variable {2} * @param arg3 The argument to place in variable {3} * @param arg4 The argument to place in variable {4} * @return Returns the formatted message. */ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException { return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); } /** * Gets a message from resource.properties from the package of the given object. * * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getMessage(String key, String[] args) throws MissingResourceException { return messageBundle.getMessage(key, args); } public static ResourceBundle getResourceBundle() { return messageBundle.getResourceBundle(); } public static MessageBundle getMessageBundle() { return messageBundle; } private static String getPackage(String name) { return name.substring(0, name.lastIndexOf('.')).intern(); } } ./src/org/apache/axis2/schema/schema-compile.properties0000664000175000017500000000356111767656530022303 0ustar brianbrian# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to 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. # ############################################################################### ##########################Schema Compiler properties ######################## ############################################################################### # # The bean writer class # The bean writer is the class used by the schema compiler to write the beans # and should implement the org.apache.axis2.schema.writer.BeanWriter # inteface # schema.bean.writer.class=org.apache.axis2.schema.writer.JavaBeanWriter # # bean writer template # The bean writers template is it's own responsibilty. (A bean writer provider # may choose not to use a template at all!) However the property loader will # load the following templates (reference) and provide it and in the case when the # bean writer is not statically bound to a template, this'll be useful. # schema.bean.writer.template=/org/apache/axis2/schema/template/ADBBeanTemplate.xsl # schema.bean.writer.template=/org/apache/axis2/schema/template/PlainBeanTemplate.xsl # # The type map to be used by the schema compiler # schema.bean.typemap=org.apache.axis2.schema.typemap.JavaTypeMap ./src/org/apache/axis2/schema/template/0000775000175000017500000000000011767656530017105 5ustar brianbrian./src/org/apache/axis2/schema/template/PlainBeanTemplate.xsl0000664000175000017500000001206211767656530023163 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * wrapped bean classes */ public class { } /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * bean class */ public class extends { /* This type was generated from the piece of schema that had name = Namespace URI = Namespace Prefix = */ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "", "", ""); local /** * field for * This was an Attribute! * This was an Array! */ private ; /** * Auto generated getter method * @return */ public get(){ return ; } /** * Auto generated setter method * @param param */ public void set( param){ if (param.length > ){ throw new java.lang.RuntimeException(); } if (param.length < ){ throw new java.lang.RuntimeException(); } this.=param; } } ./src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl0000664000175000017500000144070411767656530022517 0ustar brianbrian /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * wrapped bean classes */ public class { } /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * bean class */ public static abstract class extends extends extends org.apache.axis2.databinding.types.Union implements org.apache.axis2.databinding.ADBBean{ /* This type was generated from the piece of schema that had name = Namespace URI = Namespace Prefix = */ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "", "", ""); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("")){ return ""; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** Whenever a new property is set ensure all others are unset * There can be only one choice and the last one wins */ private void clearAllSettingTrackers() { localTracker = false; } local localTracker /** * Auto generated getter method * Overridden from * * @throws RuntimeException */ public get(){ throw new java.lang.RuntimeException(); } /** * Auto generated setter method * Overridden from * * @param param * @throws RuntimeException */ public void set( param){ throw new java.lang.RuntimeException(); } /** * Validate the array for * Overridden from */ protected void validate( param){ if ((param != null) && (param.length > )){ throw new java.lang.RuntimeException(); } if ((param != null) && (param.length < )){ throw new java.lang.RuntimeException(); } } /** * Auto generated setter method * Overridden from * * @param param */ public void set( param){ validate(param); clearAllSettingTrackers(); // setting primitive variable always to true = true; if (param != null){ //update the setting tracker = true; } else { = true; = false; } this.=param; } /** * field for * This was an Attribute! * This was an Array! * Type of this field is a subtype of its original. * This field was an array in . */ protected = org.apache.axis2.databinding.utils.ConverterUtil.convertTo(""); protected ; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected ( value, boolean isRegisterValue) { = value; if (isRegisterValue){ _table_.put( + "", this); _table_.put(, this); } } protected ( value, boolean isRegisterValue) { super(value,false); if (isRegisterValue){ _table_.put( + "", this); _table_.put(, this); } } public static final _ = org.apache.axis2.databinding.utils.ConverterUtil.convertTo(""); public static final = new (_,true); public getValue() { return ;} public boolean equals(java.lang.Object obj) {return (obj == this);} public int hashCode() { return toString().hashCode();} public java.lang.String toString() { return + ""; return .toString(); } /* This tracker boolean wil be used to detect whether the user called the set method * for this attribute. It will be used to determine whether to include this field * in the serialized XML */ protected boolean = false ; /** * Auto generated getter method * @return */ public get(){ return ; } /** * validate the array for */ protected void validate( param){ if ((param != null) && (param.length > )){ throw new java.lang.RuntimeException(); } if ((param != null) && (param.length < )){ throw new java.lang.RuntimeException(); } } /** * Auto generated setter method * @param param */ public void set( param){ validate(param); clearAllSettingTrackers(); // setting the primitive attribute to true = true; if (param != null){ //update the setting tracker = true; } else { = true; = false; } this.=param; } /** * Auto generated add method for the array for convenience * @param param */ public void add( param){ if ( == null){ = new {}; } clearAllSettingTrackers(); //update the setting tracker = true; java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(); list.add(param); this. = ()list.toArray( new [list.size()]); } /** * Auto generated setter method * @param param */ public void set( param){ clearAllSettingTrackers(); // setting primitive attribute tracker to true if (false) { if (param==java.lang.Integer.MIN_VALUE) { if (param==java.lang.Long.MIN_VALUE) { if (param==java.lang.Byte.MIN_VALUE) { if (java.lang.Double.isNaN(param)) { if (java.lang.Float.isNaN(param)) { if (param==java.lang.Short.MIN_VALUE) { if (false) { = true; = false; } else { = true; } if (param != null){ //update the setting tracker = true; } else { = true; = false; } if (org.apache.axis2.databinding.utils.ConverterUtil.convertToString(param).matches("")) { this.=param; } else { throw new java.lang.RuntimeException(); } if (org.apache.axis2.databinding.utils.ConverterUtil.convertToString(param).length() == ) { this.=param; } else { throw new java.lang.RuntimeException(); } if ( ( <= java.lang.String.valueOf(param).length()) && (java.lang.String.valueOf(param).length() <= ) ) { this.=param; } else { throw new java.lang.RuntimeException(); } if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "") < 0){ this.=param; } else { throw new java.lang.RuntimeException(); } if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "") > 0){ this.=param; } else { throw new java.lang.RuntimeException(); } if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "") <= 0){ this.=param; } else { throw new java.lang.RuntimeException(); } if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "") >= 0){ this.=param; } else { throw new java.lang.RuntimeException(); } this.=param; this.=param; } public java.lang.String toString(){ return + ""; return .toString(); } public void setObject(java.lang.Object object){ } else if (object instanceof ){ this.localObject = object; } else { throw new java.lang.RuntimeException("Invalid object type"); } } local protected [] ; public [] get(){ return ; } public void set([] itemList){ this. = itemList; } public java.lang.String toString() { java.lang.StringBuffer outString = new java.lang.StringBuffer(); if ( != null){ for(int i = 0; i < .length;i++){ outString.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])).append(" "); outString.append([i].toString()).append(" "); } } return outString.toString().trim(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,parentQName){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { .this.serialize(parentQName,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { .this.serialize(MY_QNAME,factory,xmlWriter); } }; return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME,factory,dataSource); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,factory,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ // fist write the start element java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } } else if (localObject instanceof ){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,""); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "", xmlWriter); } writeQName((javax.xml.namespace.QName)localObject,xmlWriter); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(()localObject)); } else { throw new org.apache.axis2.databinding.ADBException("Invalid object type"); } xmlWriter.writeEndElement(); // first write the start element java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } writeQNames(local,xmlWriter); xmlWriter.writeCharacters(.this.toString()); xmlWriter.writeEndElement(); java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); if ((namespace != null) && (namespace.trim().length() > 0)) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,""); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "", xmlWriter); } } local writeAttribute(.getNamespace().getName(), .getLocalName(), .getAttributeValue(), xmlWriter); if ( != null) { for (int i=0;i <.length;i++){ writeAttribute([i].getNamespace().getName(), [i].getLocalName(), [i].getAttributeValue(),xmlWriter); } } if ( != null){ writeAttribute("", "", .toString(), xmlWriter); } else { throw new org.apache.axis2.databinding.ADBException("required attribute is null"); } if (true) { if (!=java.lang.Integer.MIN_VALUE) { if (!=java.lang.Long.MIN_VALUE) { if (!=java.lang.Byte.MIN_VALUE) { if (!java.lang.Double.isNaN()) { if (!java.lang.Float.isNaN()) { if (!=java.lang.Short.MIN_VALUE) { if (true) { if ( != null){ writeQNameAttribute("", "", , xmlWriter); writeAttribute("", "", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(), xmlWriter); } else { throw new org.apache.axis2.databinding.ADBException("required attribute is null"); } local localTracker if (){ if (==null){ java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); }else{ .serialize(new javax.xml.namespace.QName("",""), factory,xmlWriter); } if (==null){ throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } .serialize(null,factory,xmlWriter); if (==null){ throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } .serialize(new javax.xml.namespace.QName("",""), factory,xmlWriter); if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ [i].serialize(null,factory,xmlWriter); } else { // we don't have to do any thing since minOccures is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ [i].serialize(new javax.xml.namespace.QName("",""), factory,xmlWriter); } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we don't have to do any thing since minOccures is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ if ([i] instanceof org.apache.axis2.databinding.ADBBean){ ((org.apache.axis2.databinding.ADBBean)[i]).serialize( new javax.xml.namespace.QName("",""), factory,xmlWriter,true); } else { java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType([i], xmlWriter); xmlWriter.writeEndElement(); } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we have to do nothing since minOccurs is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ if ( instanceof org.apache.axis2.databinding.ADBBean){ ((org.apache.axis2.databinding.ADBBean)).serialize( new javax.xml.namespace.QName("",""), factory,xmlWriter,true); } else { java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(, xmlWriter); xmlWriter.writeEndElement(); } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null) { namespace = ""; boolean emptyNamespace = namespace == null || namespace.length() == 0; prefix = emptyNamespace ? null : xmlWriter.getPrefix(namespace); for (int i = 0;i < .length;i++){ if (true) { if ([i]!=java.lang.Integer.MIN_VALUE) { if ([i]!=java.lang.Long.MIN_VALUE) { if ([i]!=java.lang.Byte.MIN_VALUE) { if (!java.lang.Double.isNaN([i])) { if (!java.lang.Float.isNaN([i])) { if ([i]!=java.lang.Short.MIN_VALUE) { if (true) { if ([i] != null){ if (!emptyNamespace) { if (prefix == null) { java.lang.String prefix2 = generatePrefix(namespace); xmlWriter.writeStartElement(prefix2,"", namespace); xmlWriter.writeNamespace(prefix2, namespace); xmlWriter.setPrefix(prefix2, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); xmlWriter.writeEndElement(); xmlWriter.writeDataHandler([i]); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); xmlWriter.writeEndElement(); } else { // write null attribute namespace = ""; if (! namespace.equals("")) { prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we have to do nothing since minOccurs is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write the null attribute // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null){ for (int i = 0;i < .length;i++){ if ([i] != null){ [i].serialize(xmlWriter); } else { // we have to do nothing since minOccures zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null) { .serialize(xmlWriter); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } namespace = ""; if (! namespace.equals("")) { prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } if (!=null) { xmlWriter.writeDataHandler(); } if (==null){ // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); }else{ writeQName(,xmlWriter); .serialize(xmlWriter); xmlWriter.writeCharacters(); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } if (false) { if (==java.lang.Integer.MIN_VALUE) { if (==java.lang.Long.MIN_VALUE) { if (==java.lang.Byte.MIN_VALUE) { if (java.lang.Double.isNaN()) { if (java.lang.Float.isNaN()) { if (==java.lang.Short.MIN_VALUE) { if (false) { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); //We can safely assume an element has only one type associated with it local if (==null){ java.lang.String namespace = ""; if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); }else{ .serialize(MY_QNAME,factory,xmlWriter); } if (==null){ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!"); } .serialize(MY_QNAME,factory,xmlWriter); java.lang.String namespace = ""; java.lang.String localName = ""; java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,""); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "", xmlWriter); } } if (==null){ // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ writeQName(,xmlWriter); .serialize(xmlWriter); xmlWriter.writeCharacters(); org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(, xmlWriter); if (!=null) { xmlWriter.writeDataHandler(); } xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } if (false) { if (==java.lang.Integer.MIN_VALUE) { if (==java.lang.Long.MIN_VALUE) { if (==java.lang.Byte.MIN_VALUE) { if (java.lang.Double.isNaN()) { if (java.lang.Float.isNaN()) { if (==java.lang.Short.MIN_VALUE) { if (false) { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException("property value cannot be null!!"); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); attribList.add(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema-instance","type")); attribList.add(new javax.xml.namespace.QName("","")); local localTracker if (){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(==null?null: ); if (==null){ throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(); if (!=null) { for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add([i]); } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); // nothing to do throw new org.apache.axis2.databinding.ADBException(" cannot be null !!"); } } } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); // have to do nothing throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null) { for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } else { // have to do nothing throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null){ elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY); elementList.add(); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(); elementList.add(org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT); elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); elementList.add(==null?null: org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); if ( != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } local attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY); attribList.add(); for (int i=0;i <.length;i++){ attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY); attribList.add([i]); } attribList.add( new javax.xml.namespace.QName("","")); attribList.add(.toString()); attribList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, localObject.toString() }, null); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, toString() }, null); //We can safely assume an element has only one type associated with it local if (==null){ return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(MY_QNAME); }else{ return .getPullParser(MY_QNAME); } return .getPullParser(MY_QNAME); if (==null){ return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(MY_QNAME); }else{ return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString() }, null); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString() }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ public static fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String namespaceURI, java.lang.String type) throws org.apache.axis2.databinding.ADBException { object = null; try { if ("http://www.w3.org/2001/XMLSchema".equals(namespaceURI)) { object = new (); object.setObject(xmlStreamReader, namespaceURI, type); } else { object = new (); object.setObject(.getTypeObject(namespaceURI, type, xmlStreamReader)); } return object; } catch (java.lang.Exception e) { throw new org.apache.axis2.databinding.ADBException("Error in parsing value"); } } public static fromString(java.lang.String value, java.lang.String namespaceURI){ object = new (); boolean isValueSet = false; // we have to set the object with the first matching type. if (!isValueSet) { try { java.lang.reflect.Method converterMethod = org.apache.axis2.databinding.utils.ConverterUtil.class.getMethod( "convertTo", new java.lang.Class[]{java.lang.String.class}); object.setObject(converterMethod.invoke(null, new java.lang.Object[]{value})); isValueSet = true; } catch (java.lang.Exception e) { } try { object.setObject(.Factory.fromString(value, namespaceURI)); isValueSet = true; } catch (java.lang.Exception e) { } } return object; } public static fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return .Factory.fromString(content,namespaceUri); } else { return .Factory.fromString(content,""); } } public static fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) throws org.apache.axis2.databinding.ADBException { object = new (); java.lang.String[] values = content.split(" +"); [] objectValues = new [values.length]; java.lang.String prefix = null; java.lang.String namespace = null; java.lang.String valueContent = null; java.lang.String prefix = null; java.lang.String namespace = null; try { for (int i = 0; i < values.length; i++) { if (values[i].indexOf(":") > 0){ prefix = values[i].substring(0,values[i].indexOf(":")); } else { prefix = ""; } namespace = xmlStreamReader.getNamespaceURI(prefix); objectValues[i] = org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(values[i],namespace); valueContent = values[i]; if (valueContent.indexOf(":") > 0){ prefix = valueContent.substring(0,valueContent.indexOf(":")); } else { prefix = ""; } namespace = xmlStreamReader.getNamespaceURI(prefix); objectValues[i] = .Factory.fromString(valueContent,namespace); objectValues[i] = org.apache.axis2.databinding.utils.ConverterUtil.convertTo(values[i]); } object.set(objectValues); return object; } catch (java.lang.Exception e) { throw new org.apache.axis2.databinding.ADBException(); } } public static fromString(java.lang.String value, java.lang.String namespaceURI){ returnValue = new (); returnValue.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo(value,namespaceURI)); returnValue.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo(value)); return returnValue; } public static fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return .Factory.fromString(content,namespaceUri); } else { return .Factory.fromString(content,""); } } public static fromValue( value) throws java.lang.IllegalArgumentException { enumeration = () _table_.get(value + ""); _table_.get(value); if (enumeration==null) throw new java.lang.IllegalArgumentException(); return enumeration; } public static fromString(java.lang.String value,java.lang.String namespaceURI) throws java.lang.IllegalArgumentException { try { return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertTo(value)); return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(value,namespaceURI)); return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertTo(value)); } catch (java.lang.Exception e) { throw new java.lang.IllegalArgumentException(); } } public static fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return .Factory.fromString(content,namespaceUri); } else { return .Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ object = null;new (); object = null; // initialize a hash map to keep values java.util.Map attributeMap = new java.util.HashMap(); java.util.List extraAttributeList = new java.util.ArrayList(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ // Skip the element and report the null value. It cannot have subelements. while (!reader.isEndElement()) reader.next(); return null; object.set(java.lang.Integer.MIN_VALUE); object.set(java.lang.Long.MIN_VALUE); object.set(java.lang.Byte.MIN_VALUE); object.set(java.lang.Double.NaN); object.set(java.lang.Float.NaN); object.set(java.lang.Short.MIN_VALUE); return object; } if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); object = .Factory.fromString(reader,nsUri,type); if (!"".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return ().getTypeObject( nsUri,type,reader); } throw new org.apache.axis2.databinding.ADBException("The an abstract class can not be instantiated !!!"); } } else { // i.e this is an union type with out specific xsi:type java.lang.String content = reader.getElementText(); if (content.indexOf(":") > -1){ // i.e. this could be a qname prefix = content.substring(0,content.indexOf(":")); namespaceuri = reader.getNamespaceContext().getNamespaceURI(prefix); object = .Factory.fromString(content,namespaceuri); } else { object = .Factory.fromString(content,""); } } java.lang.String content = reader.getElementText(); object = .Factory.fromString(reader,content); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); tempAttrib // handle attribute "" java.lang.String = reader.getAttributeValue("",""); reader.getAttributeValue(null,""); if (!=null){ java.lang.String content = ; int index = .indexOf(":"); if(index > -1){ prefix = .substring(0,index); } else { // i.e this is in default namesace prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); attributeMap.put("", org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(,namespaceuri)); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(,namespaceuri)); attributeMap.put("", org.apache.axis2.databinding.utils.ConverterUtil.convertTo()); object.set( .Factory.fromString(reader,)); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo()); } else { object.set(java.lang.Integer.MIN_VALUE); object.set(java.lang.Long.MIN_VALUE); object.set(java.lang.Byte.MIN_VALUE); object.set(java.lang.Double.NaN); object.set(java.lang.Float.NaN); object.set(java.lang.Short.MIN_VALUE); throw new org.apache.axis2.databinding.ADBException("Required attribute is missing"); } handledAttributes.add(""); // now run through all any or extra attributes // which were not reflected until now for (int i=0; i < reader.getAttributeCount(); i++) { if (!handledAttributes.contains(reader.getAttributeLocalName(i))) { // this is an anyAttribute and we create // an OMAttribute for this org.apache.axiom.om.impl.llom.OMAttributeImpl attr = new org.apache.axiom.om.impl.llom.OMAttributeImpl( reader.getAttributeLocalName(i), new org.apache.axiom.om.impl.dom.NamespaceImpl( reader.getAttributeNamespace(i), reader.getAttributePrefix(i)), reader.getAttributeValue(i), org.apache.axiom.om.OMAbstractFactory.getOMFactory()); // and add it to the extra attributes extraAttributeList.add(attr); object.addExtraAttributes(attr); } } reader.next(); java.util.ArrayList list = new java.util.ArrayList(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ list loopDone startQname stateMachine builder new javax.xml.namespace.QName("","") else while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()){ try{ if (reader.isStartElement() || reader.hasText() && .equals(reader.getName())){ // Process the array and step past its final element's end. .add(.Factory.parse(reader)); //loop until we find a start element that is not part of this array boolean = false; while(!){ // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { .add(.Factory.parse(reader)); } } // call the converter utility to convert and set the array object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class, )); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(.Factory.parse(reader, .class)); .add(.Factory.parse(reader)); } //loop until we find a start element that is not part of this array boolean = false; while(!){ // We should be at the end element, but make sure while (!reader.isEndElement()) reader.next(); // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(.Factory.parse(reader, .class)); .add(.Factory.parse(reader)); } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class, )); boolean =false; while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event){ // We need to wrap the reader so that it produces a fake START_DOCUEMENT event org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader), reader.getName()); .add(.getOMElement()); reader.next(); if (reader.isEndElement()) { // we have two countinuos end elements = true; } }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); boolean =false; javax.xml.namespace.QName = new javax.xml.namespace.QName( "", ""); while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && .equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); }else{ .add(org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(reader, .class)); } } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(.toArray()); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object .add( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { // Step in if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && .equals(reader.getName())) { reader.next(); } if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); .add(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); .add( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } } //loop until we find a start element that is not part of this array boolean = false; while(!){ // Ensure we are at the EndElement while (!reader.isEndElement()){ reader.next(); } // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { reader.next(); if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object .add( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); .add(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); .add( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); boolean =false; javax.xml.namespace.QName = new javax.xml.namespace.QName( "", ""); while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && .equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); }else{ // We need to wrap the reader so that it produces a fake START_DOCUEMENT event org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader), ); .add(.getOMElement().getFirstElement()); } } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(String.valueOf(java.lang.Integer.MIN_VALUE)); .add(String.valueOf(java.lang.Long.MIN_VALUE)); .add(String.valueOf(java.lang.Byte.MIN_VALUE)); .add(String.valueOf(java.lang.Double.NaN)); .add(String.valueOf(java.lang.Float.NaN)); .add(String.valueOf(java.lang.Short.MIN_VALUE)); .add(null); reader.next(); } else { .add(reader.getElementText()); } //loop until we find a start element that is not part of this array boolean = false; while(!){ // Ensure we are at the EndElement while (!reader.isEndElement()){ reader.next(); } // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(String.valueOf(java.lang.Integer.MIN_VALUE)); .add(String.valueOf(java.lang.Long.MIN_VALUE)); .add(String.valueOf(java.lang.Byte.MIN_VALUE)); .add(String.valueOf(java.lang.Double.NaN)); .add(String.valueOf(java.lang.Float.NaN)); .add(String.valueOf(java.lang.Short.MIN_VALUE)); .add(null); reader.next(); } else { .add(reader.getElementText()); } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ object.set(null); reader.next(); reader.next(); }else{ object.set(.Factory.parse(reader, .class)); object.set(.Factory.parse(reader)); reader.next(); } //use the QName from the parser as the name for the builder javax.xml.namespace.QName = reader.getName(); // We need to wrap the reader so that it produces a fake START_DOCUMENT event // this is needed by the builder classes org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader),); object.set(.getOMElement()); reader.next(); object.set(org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(reader, .class)); reader.next(); reader.next(); if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object object.set( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); object.set(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } reader.next(); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); if(index > 0){ prefix = content.substring(0,index); } else { prefix = ""; } namespaceuri = reader.getNamespaceURI(prefix); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory(); org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("", ""); org.apache.axiom.om.OMElement _value = fac.createOMElement("", omNs); _value.addChild(fac.createOMText(_value, content)); object.set(_value); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo(content)); if (content.indexOf(":") > 0) { // this seems to be a Qname so find the namespace and send prefix = content.substring(0, content.indexOf(":")); namespaceuri = reader.getNamespaceURI(prefix); object = .Factory.fromString(content,namespaceuri); } else { // this seems to be not a qname send and empty namespace incase of it is // check is done in fromString method object = .Factory.fromString(content,""); } tempObjectAttrib // handle attribute "" java.lang.Object = attributeMap.get(""); if (!=null){ object.set((javax.xml.namespace.QName)); object.set(()); } for(java.util.Iterator iter = extraAttributeList.iterator();iter.hasNext();){ object.addExtraAttributes((org.apache.axiom.om.impl.llom.OMAttributeImpl)iter.next()); } } else { object.set(java.lang.Integer.MIN_VALUE); object.set(java.lang.Long.MIN_VALUE); object.set(java.lang.Byte.MIN_VALUE); object.set(java.lang.Double.NaN); object.set(java.lang.Float.NaN); object.set(java.lang.Short.MIN_VALUE); reader.getElementText(); // throw away text nodes if any. } reader.next(); } // End of if for expected property start element else { object.set(java.lang.Integer.MIN_VALUE); object.set(java.lang.Long.MIN_VALUE); object.set(java.lang.Byte.MIN_VALUE); object.set(java.lang.Double.NaN); object.set(java.lang.Float.NaN); object.set(java.lang.Short.MIN_VALUE); } else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } catch (java.lang.Exception e) {} while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) // A start element we are not expecting indicates a trailing invalid property throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class } Helper /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * bean class */ public static class extends { /* This type was generated from the piece of schema that had name = Namespace URI = Namespace Prefix = */ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "", "", ""); private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("")){ return ""; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** Whenever a new property is set ensure all others are unset * There can be only one choice and the last one wins */ private void clearAllSettingTrackers() { localTracker = false; } local localTracker /** * Auto generated getter method * Overridden from * * @throws org.apache.axis2.databinding.ADBException */ public get(){ throw new java.lang.org.apache.axis2.databinding.ADBException("property has removed"); } /** * Auto generated setter method * Overridden from * * @param param * @throws org.apache.axis2.databinding.ADBException */ public void set( param){ throw new org.apache.axis2.databinding.ADBException(); } /** * Validate the array for * Overridden from */ protected void validate( param){ if ((param != null) && (param.length > )){ throw new org.apache.axis2.databinding.ADBException(); } if ((param != null) && (param.length < )){ throw new org.apache.axis2.databinding.ADBException(); } } /** * Auto generated setter method * Overridden from * * @param param */ public void set( param){ validate(param); clearAllSettingTrackers(); // setting primitive variable always to true = true; if (param != null){ //update the setting tracker = true; } else { = true; = false; } this.=param; } /** * field for * This was an Attribute! * This was an Array! * Type of this field is a subtype of its original. * This field was an array in . */ protected ; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected ( value) { = value; _table_.put( + "", this); _table_.put(, this); } public static final _ = org.apache.axis2.databinding.utils.ConverterUtil.convertTo(""); public static final = new (_); public getValue() { return ;} public static fromValue( value) throws java.lang.IllegalArgumentException { enumeration = () _table_.get(value + ""); _table_.get(value); if (enumeration==null) throw new java.lang.IllegalArgumentException(); return enumeration; } public static fromString(java.lang.String value) throws java.lang.IllegalArgumentException { try { return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertTo(value)); return fromValue(new (value)); } catch (java.lang.Exception e) { throw new java.lang.IllegalArgumentException(); } } public boolean equals(java.lang.Object obj) {return (obj == this);} public int hashCode() { return toString().hashCode();} public java.lang.String toString() { return + ""; return .toString(); } /* This tracker boolean wil be used to detect whether the user called the set method * for this attribute. It will be used to determine whether to include this field * in the serialized XML */ protected boolean = false ; /** * Auto generated getter method * @return */ public get(){ return ; } /** * validate the array for */ protected void validate( param){ if ((param != null) && (param.length > )){ throw new org.apache.axis2.databinding.ADBException(); } if ((param != null) && (param.length < )){ throw new org.apache.axis2.databinding.ADBException(); } } /** * Auto generated setter method * @param param */ public void set( param){ validate(param); clearAllSettingTrackers(); // setting the primitive attribute to true = true; if (param != null){ //update the setting tracker = true; } else { = true; = false; } this.=param; } /** * Auto generated add method for the array for convenience * @param param */ public void add( param){ if ( == null){ = new {}; } clearAllSettingTrackers(); //update the setting tracker = true; java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(); list.add(param); this. = ()list.toArray( new [list.size()]); } /** * Auto generated setter method * @param param */ public void set( param){ clearAllSettingTrackers(); // setting primitive attribute tracker to true = true; if (param != null){ //update the setting tracker = true; } else { = true; = false; } if ( param.matches( "" )) { this.=param; } else { throw new org.apache.axis2.databinding.ADBException(); } if ( param.length() == ) { this.=param; } else { throw new org.apache.axis2.databinding.ADBException(); } if ( ( < param.length()) && (param.length() >= ) ) { this.=param; } else { throw new org.apache.axis2.databinding.ADBException(); } if ( < <= param > >= ) { this.=param; } else { throw new org.apache.axis2.databinding.ADBException(); } this.=param; this.=param; } } public static class { . . private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals(.MY_QNAME.getNamespaceURI())){ return .MY_QNAME.getPrefix(); } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * isReaderMTOMAware * @return true if the reader supports MTOM */ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { boolean isReaderMTOMAware = false; try{ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); }catch(java.lang.IllegalArgumentException e){ isReaderMTOMAware = false; } return isReaderMTOMAware; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public static org.apache.axiom.om.OMElement getOMElement( final bean, final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = getOMDataSource(bean,parentQName, factory); return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName,factory,dataSource); return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( .MY_QNAME,factory,dataSource); } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public static org.apache.axiom.om.OMDataSource getOMDataSource( final bean, final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory)throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBHelperDataSource(bean,parentQName,""){ public void serialize( javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { typedBean = ()bean; java.lang.String prefix = parentQName.getPrefix(); java.lang.String namespace = parentQName.getNamespaceURI(); if (namespace != null) { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); } else { if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } else { xmlWriter.writeStartElement(parentQName.getLocalPart()); } writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", registerPrefix(xmlWriter,"")+":", xmlWriter); typedBean.local writeAttribute(.getNamespace().getName(), .getLocalName(), .getAttributeValue(), xmlWriter); if ( != null) { for (int i=0;i <.length;i++){ writeAttribute([i].getNamespace().getName(), [i].getLocalName(), [i].getAttributeValue(),xmlWriter); } } // optional attribute try { writeAttribute("", "", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(), xmlWriter); } catch (NullPointerException e) { // If was null // it can not be serialized. } writeAttribute("", "", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(), xmlWriter); typedBean.local typedBean.localTracker if (){ if (==null){ java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); }else{ Helper.getOMDataSource(, new javax.xml.namespace.QName("",""), factory).serialize(xmlWriter); } if (==null){ throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } Helper.getOMDataSource(, new javax.xml.namespace.QName("",""), factory).serialize(xmlWriter); if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ Helper.getOMDataSource([i], new javax.xml.namespace.QName("",""), factory).serialize(xmlWriter); } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we don't have to do any thing since minOccures is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } [i].serialize(xmlWriter); xmlWriter.writeEndElement(); } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we have to do nothing since minOccurs is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } .serialize(xmlWriter); xmlWriter.writeEndElement(); } else { // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null) { namespace = ""; boolean emptyNamespace = namespace == null || namespace.length() == 0; prefix = emptyNamespace ? null : xmlWriter.getPrefix(namespace); for (int i = 0;i < .length;i++){ if (!emptyNamespace) { if (prefix == null) { java.lang.String prefix2 = generatePrefix(namespace); xmlWriter.writeStartElement(prefix2,"", namespace); xmlWriter.writeNamespace(prefix2, namespace); xmlWriter.setPrefix(prefix2, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); xmlWriter.writeEndElement(); if ([i] != null){ if (!emptyNamespace) { if (prefix == null) { java.lang.String prefix2 = generatePrefix(namespace); xmlWriter.writeStartElement(prefix2,"", namespace); xmlWriter.writeNamespace(prefix2, namespace); xmlWriter.setPrefix(prefix2, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } xmlWriter.writeCharacters([i]); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); xmlWriter.writeEndElement(); } else { // write null attribute namespace = ""; if (! namespace.equals("")) { prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); // we have to do nothing since minOccurs is zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { // write the null attribute // write null attribute java.lang.String namespace2 = ""; if (! namespace2.equals("")) { java.lang.String prefix2 = xmlWriter.getPrefix(namespace2); if (prefix2 == null) { prefix2 = generatePrefix(namespace2); xmlWriter.writeStartElement(prefix2,"", namespace2); xmlWriter.writeNamespace(prefix2, namespace2); xmlWriter.setPrefix(prefix2, namespace2); } else { xmlWriter.writeStartElement(namespace2,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null){ for (int i = 0;i < .length;i++){ if ([i] != null){ [i].serialize(xmlWriter); } else { // we have to do nothing since minOccures zero throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null) { .serialize(xmlWriter); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } namespace = ""; if (! namespace.equals("")) { prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } if (!=null) { org.apache.axiom.om.impl.llom.OMTextImpl _binary = new org.apache.axiom.om.impl.llom.OMTextImpl( , org.apache.axiom.om.OMAbstractFactory.getOMFactory()); _binary.internalSerializeAndConsume(xmlWriter); } if (==null){ // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); }else{ java.lang.String namespaceURI =.getNamespaceURI(); if(namespaceURI !=null){ prefix = .getPrefix(); if (prefix == null) { prefix = generatePrefix(namespaceURI); } xmlWriter.writeNamespace(prefix,namespaceURI ); xmlWriter.writeCharacters(prefix + ":"+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } .serialize(xmlWriter); xmlWriter.writeCharacters(); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); //We can safely assume an element has only one type associated with it typedBean.local if (==null){ java.lang.String namespace = ""; if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix,"", namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace,""); } } else { xmlWriter.writeStartElement(""); } // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); xmlWriter.writeEndElement(); }else{ Helper.getOMDataSource(, .MY_QNAME, factory).serialize(xmlWriter); } if (==null){ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!"); } Helper.getOMDataSource(, .MY_QNAME, factory).serialize(xmlWriter); java.lang.String namespace = ""; java.lang.String localName = ""; java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String localName = parentQName.getLocalPart(); if (! namespace.equals("")) { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); xmlWriter.writeStartElement(prefix, localName, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } else { xmlWriter.writeStartElement(namespace, localName); } } else { xmlWriter.writeStartElement(localName); } if (==null){ // write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!"); }else{ writeQName(,xmlWriter); .serialize(xmlWriter); xmlWriter.writeCharacters(); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); xmlWriter.writeEndElement(); } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = createPrefix(); while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = createPrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * Create a prefix */ private java.lang.String createPrefix() { return "ns" + (int)Math.random(); } }; return dataSource; } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ object = new (); object = null; int event; java.lang.String nillableValue = null; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ // Skip the element and report the null value. It cannot have subelements. while (!reader.isEndElement()) reader.next(); return null; return object; } if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return ().getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); tempAttrib // handle attribute "" java.lang.String = reader.getAttributeValue("",""); if (!=null){ java.lang.String content = ; int index = .indexOf(":"); java.lang.String prefix =""; java.lang.String namespaceuri =""; if(index >0){ prefix = .substring(0,index); namespaceuri = reader.getNamespaceURI(prefix); } object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(,namespaceuri)); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo( )); } handledAttributes.add(""); // now run through all any or extra attributes // which were not reflected until now for (int i=0; i < reader.getAttributeCount(); i++) { if (!handledAttributes.contains(reader.getAttributeLocalName(i))) { // this is an anyAttribute and we create // an OMAttribute for this org.apache.axiom.om.impl.llom.OMAttributeImpl attr = new org.apache.axiom.om.impl.llom.OMAttributeImpl( reader.getAttributeLocalName(i), new org.apache.axiom.om.impl.dom.NamespaceImpl( reader.getAttributeNamespace(i), reader.getAttributePrefix(i)), reader.getAttributeValue(i), org.apache.axiom.om.OMAbstractFactory.getOMFactory()); // and add it to the extra attributes object.addExtraAttributes(attr); } } reader.next(); java.util.ArrayList list = new java.util.ArrayList(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ list loopDone startQname stateMachine builder new javax.xml.namespace.QName("","") else while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()){ if (reader.isStartElement() || reader.hasText() && .equals(reader.getName())){ // Process the array and step past its final element's end. nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(Helper.parse(reader)); } //loop until we find a start element that is not part of this array boolean = false; while(!){ // We should be at the end element, but make sure while (!reader.isEndElement()) reader.next(); // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(Helper.parse(reader)); } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class, )); boolean =false; while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event){ // We need to wrap the reader so that it produces a fake START_DOCUEMENT event org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader), reader.getName()); .add(.getOMElement()); reader.next(); if (reader.isEndElement()) { // we have two countinuos end elements = true; } }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); boolean =false; javax.xml.namespace.QName = new javax.xml.namespace.QName( "", ""); while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && .equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); }else{ // we parse it as an omElement // We need to wrap the reader so that it produces a fake START_DOCUEMENT event // this is needed by the builder classes org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader),); .add(.getOMElement().getFirstElement()); } } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object .add( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { // Step in if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && .equals(reader.getName())) { reader.next(); } if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); .add(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); .add( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } } //loop until we find a start element that is not part of this array boolean = false; while(!){ // Ensure we are at the EndElement while (!reader.isEndElement()){ reader.next(); } // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { reader.next(); if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object .add( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); .add(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); .add( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); boolean =false; javax.xml.namespace.QName = new javax.xml.namespace.QName( "", ""); while (!){ event = reader.getEventType(); if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && .equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); }else{ // We need to wrap the reader so that it produces a fake START_DOCUEMENT event org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader), ); .add(.getOMElement().getFirstElement()); } } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event && !.equals(reader.getName())){ = true; }else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event){ = true; }else{ reader.next(); } } object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(reader.getElementText()); } //loop until we find a start element that is not part of this array boolean = false; while(!){ // Ensure we are at the EndElement while (!reader.isEndElement()){ reader.next(); } // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()){ //two continuous end elements means we are exiting the xml structure = true; } else { if (.equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ .add(null); reader.next(); } else { .add(reader.getElementText()); } }else{ = true; } } } // call the converter utility to convert and set the array object.set(() .toArray(new [.size()])); object.set(() org.apache.axis2.databinding.utils.ConverterUtil.convertToArray( .class,)); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ object.set(null); reader.next(); reader.next(); }else{ object.set(Helper.parse(reader)); reader.next(); } //use the QName from the parser as the name for the builder javax.xml.namespace.QName = reader.getName(); // We need to wrap the reader so that it produces a fake START_DOCUMENT event // this is needed by the builder classes org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader),); object.set(.getOMElement()); reader.next(); boolean = false; javax.xml.namespace.QName = new javax.xml.namespace.QName( "", ""); while(!){ if (reader.isStartElement() && .equals(reader.getName())){ = true; }else{ reader.next(); } } // We need to wrap the reader so that it produces a fake START_DOCUEMENT event // this is needed by the builder classes org.apache.axis2.databinding.utils.NamedStaxOMBuilder = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder( new org.apache.axis2.util.StreamWrapper(reader),); object.set(.getOMElement().getFirstElement()); reader.next(); reader.next(); if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) { //MTOM aware reader - get the datahandler directly and put it in the object object.set( (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER)); } else { if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) { java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8"); object.set(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id)); reader.next(); reader.next(); } else if(reader.hasText()) { //Do the usual conversion java.lang.String content = reader.getText(); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content)); reader.next(); } } reader.next(); nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); int index = content.indexOf(":"); java.lang.String prefix =""; java.lang.String namespaceuri =""; if(index >0){ prefix = content.substring(0,index); namespaceuri = reader.getNamespaceURI(prefix); } object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri)); org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory(); org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("", ""); org.apache.axiom.om.OMElement _value = fac.createOMElement("", omNs); _value.addChild(fac.createOMText(_value, content)); object.set(_value); object.set( org.apache.axis2.databinding.utils.ConverterUtil.convertTo(content)); object = .fromString(content); } else { reader.getElementText(); // throw away text nodes if any. } reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) // A start element we are not expecting indicates a trailing invalid property throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } else reader.next(); } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ . bean = (.)beanObject; java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); bean.local bean.localTracker if (){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(==null?null: ); if (==null){ throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(); if (!=null) { for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add([i]); } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); // nothing to do throw new org.apache.axis2.databinding.ADBException(" cannot be null !!"); } } } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if (!=null){ for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); // have to do nothing throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } } else { elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(null); throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null) { for (int i = 0;i < .length;i++){ if ([i] != null){ elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString([i])); } else { // have to do nothing throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } if ( != null){ elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY); elementList.add(); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } elementList.add(new javax.xml.namespace.QName("", "")); elementList.add(); elementList.add(new javax.xml.namespace.QName("", "")); elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); elementList.add(==null?null: org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); if ( != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); } else { throw new org.apache.axis2.databinding.ADBException(" cannot be null!!"); } } bean.local attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY); attribList.add(); for (int i=0;i <.length;i++){ attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY); attribList.add([i]); } attribList.add( new javax.xml.namespace.QName("","")); attribList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString()); return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); //We can safely assume an element has only one type associated with it bean.local if (==null){ return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME); }else{ return Helper.getPullParser(,bean.MY_QNAME); } return Helper.getPullParser(,bean.MY_QNAME); if (==null){ return new org.apache.axis2.databinding.utils.reader.NullXMLStreamReader(bean.MY_QNAME); }else{ return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString() }, null); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(bean.MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString() }, null); } } /** * .java * * This file was auto-generated from WSDL * by the Apache Axis2 version: #axisVersion# #today# */ package ; /** * class */ public static class { public static java.lang.Object getTypeObject(java.lang.String namespaceURI, java.lang.String typeName, javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ if ( "".equals(namespaceURI) && "".equals(typeName)){ return Helper.parse(reader); return .Factory.parse(reader); } throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName); } } ./src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl0000664000175000017500000012672411767656530023735 0ustar brianbrian adb_ ADB_ #ifndef _H #define _H /** * .h * * This file was auto-generated from WSDL * by the Apache Axis2/Java version: #axisVersion# #today# */ #include <stdio.h> #include <axiom.h> #include <axis2_util.h> #include <axiom_soap.h> #include <axis2_client.h> #ifdef __cplusplus extern "C" { #endif #define ADB_DEFAULT_DIGIT_LIMIT 64 #define ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT 64 #define ADB_DEFAULT_LIST_SEPERATOR " " /** * wrapped class classes ( structure for C ) */ #ifdef __cplusplus } #endif #endif /* _H */ adb_ ADB_ #ifndef _H #define _H /** * .h * * This file was auto-generated from WSDL * by the Apache Axis2/Java version: #axisVersion# #today# */ /** * class */ typedef struct _t; adb_ #include ".h" #include <axutil_date_time.h> #include <axutil_base64_binary.h> #include <axutil_duration.h> #include <stdio.h> #include <axiom.h> #include <axis2_util.h> #include <axiom_soap.h> #include <axis2_client.h> #ifdef __cplusplus extern "C" { #endif #define ADB_DEFAULT_DIGIT_LIMIT 64 #define ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT 64 #define ADB_DEFAULT_LIST_SEPERATOR " " /******************************* Create and Free functions *********************************/ /** * Constructor for creating _t * @param env pointer to environment struct * @return newly created _t object */ _t* AXIS2_CALL _create( const axutil_env_t *env ); /** * Free _t object * @param _ _t object to free * @param env pointer to environment struct * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _free ( _t* _, const axutil_env_t *env); /********************************** Getters and Setters **************************************/ /******** Deprecated for array types, Use 'Getters and Setters for Arrays' instead ***********/ /******** In a case of a choose among elements, the last one to set will be chooosen *********/ /******* This is a list, please use Getters and 'Setters for Array' Instead of following *****/ axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. const /** * Getter for . Deprecated for array types, Use _get__at instead * @param _ _t object * @param env pointer to environment struct * @return */ AXIS2_CALL _get_( _t* _, const axutil_env_t *env); /** * Setter for .Deprecated for array types, Use _set__at * or _add_ instead. * @param _ _t object * @param env pointer to environment struct * @param arg_ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _set_( _t* _, const axutil_env_t *env, arg_); /** * Resetter for * @param _ _t object * @param env pointer to environment struct * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _reset_( _t* _, const axutil_env_t *env); axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. const /** * Getter for . Deprecated for array types, Use _get__at instead * @param _ _t object * @param env pointer to environment struct * @return */ AXIS2_CALL _get_( _t* _, const axutil_env_t *env); /** * Setter for . Deprecated for array types, Use _set__at * or _add_ instead. * @param _ _t object * @param env pointer to environment struct * @param arg_ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _set_( _t* _, const axutil_env_t *env, arg_); /** * Resetter for * @param _ _t object * @param env pointer to environment struct * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _reset_( _t* _, const axutil_env_t *env); /****************************** Getters and Setters For Arrays **********************************/ /************ Array Specific Operations: get_at, set_at, add, remove_at, sizeof *****************/ /** * E.g. use of get_at, set_at, add and sizeof * * for(i = 0; i < adb_element_sizeof_property(adb_object, env); i ++ ) * { * // Getting ith value to property_object variable * property_object = adb_element_get_property_at(adb_object, env, i); * * // Setting ith value from property_object variable * adb_element_set_property_at(adb_object, env, i, property_object); * * // Appending the value to the end of the array from property_object variable * adb_element_add_property(adb_object, env, property_object); * * // Removing the ith value from an array * adb_element_remove_property_at(adb_object, env, i); * * } * */ axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. const /** * Get the ith element of . * @param _ _t object * @param env pointer to environment struct * @param i index of the item to return * @return ith of the array */ AXIS2_CALL _get__at( _t* _, const axutil_env_t *env, int i); /** * Set the ith element of . (If the ith already exist, it will be replaced) * @param _ _t object * @param env pointer to environment struct * @param i index of the item to return * @param arg_ element to set to the array * @return ith of the array */ axis2_status_t AXIS2_CALL _set__at( _t* _, const axutil_env_t *env, int i, arg_ ); /** * Add to . * @param _ _t object * @param env pointer to environment struct * @param arg_ element to add to the array * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _add_( _t* _, const axutil_env_t *env, arg_ ); /** * Get the size of the array. * @param _ _t object * @param env pointer to environment struct. * @return the size of the array. */ int AXIS2_CALL _sizeof_( _t* _, const axutil_env_t *env); /** * Remove the ith element of . * @param _ _t object * @param env pointer to environment struct * @param i index of the item to remove * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _remove__at( _t* _, const axutil_env_t *env, int i); axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. const /** * Get the ith element of . * @param _ _t object * @param env pointer to environment struct * @param i index of the item to return * @return ith of the array */ AXIS2_CALL _get__at( _t* _, const axutil_env_t *env, int i); /** * Set the ith element of . (If the ith already exist, it will be replaced) * @param _ _t object * @param env pointer to environment struct * @param i index of the item to return * @param arg_ element to set to the array * @return ith of the array */ axis2_status_t AXIS2_CALL _set__at( _t* _, const axutil_env_t *env, int i, arg_ ); /** * Add to . * @param _ _t object * @param env pointer to environment struct * @param arg_ element to add to the array * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _add_( _t* _, const axutil_env_t *env, arg_ ); /** * Get the size of the array. * @param _ _t object * @param env pointer to environment struct. * @return the size of the array. */ int AXIS2_CALL _sizeof_( _t* _, const axutil_env_t *env); /** * Remove the ith element of . * @param _ _t object * @param env pointer to environment struct * @param i index of the item to remove * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _remove__at( _t* _, const axutil_env_t *env, int i); /******************************* Checking and Setting NIL values *********************************/ /* Use 'Checking and Setting NIL values for Arrays' to check and set nil for individual elements */ /** * NOTE: set_nil is only available for nillable properties */ axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. /** * Check whether is nill * @param _ _t object * @param env pointer to environment struct * @return AXIS2_TRUE if the element is nil or AXIS2_FALSE otherwise */ axis2_bool_t AXIS2_CALL _is__nil( _t* _, const axutil_env_t *env); /** * Set to nill (currently the same as reset) * @param _ _t object * @param env pointer to environment struct * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _set__nil( _t* _, const axutil_env_t *env); /*************************** Checking and Setting 'NIL' values in Arrays *****************************/ /** * NOTE: You may set this to remove specific elements in the array * But you can not remove elements, if the specific property is declared to be non-nillable or sizeof(array) < minOccurs */ axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. /** * Check whether is nill at i * @param _ _t object * @param env pointer to environment struct. * @param i index of the item to return. * @return AXIS2_TRUE if the element is nil or AXIS2_FALSE otherwise */ axis2_bool_t AXIS2_CALL _is__nil_at( _t* _, const axutil_env_t *env, int i); /** * Set to nill at i * @param _ _ _t object * @param env pointer to environment struct. * @param i index of the item to set. * @return AXIS2_SUCCESS on success, or AXIS2_FAILURE otherwise. */ axis2_status_t AXIS2_CALL _set__nil_at( _t* _, const axutil_env_t *env, int i); /**************************** Serialize and Deserialize functions ***************************/ /*********** These functions are for use only inside the generated code *********************/ /** * Deserialize the content from a string to adb objects * @param _ _t object * @param env pointer to environment struct * @param node_value to deserialize * @param parent_element The parent element if it is an element, NULL otherwise * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _deserialize_from_string( _t* _, const axutil_env_t *env, axis2_char_t *node_value, axiom_node_t *parent); /** * Deserialize an XML to adb objects * @param _ _t object * @param env pointer to environment struct * @param dp_parent double pointer to the parent node to deserialize * @param dp_is_early_node_valid double pointer to a flag (is_early_node_valid?) * @param dont_care_minoccurs Dont set errors on validating minoccurs, * (Parent will order this in a case of choice) * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axis2_status_t AXIS2_CALL _deserialize( _t* _, const axutil_env_t *env, axiom_node_t** dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs); /** * Declare namespace in the most parent node * @param _ _t object * @param env pointer to environment struct * @param parent_element parent element * @param namespaces hash of namespace uri to prefix * @param next_ns_index pointer to an int which contain the next namespace index */ void AXIS2_CALL _declare_parent_namespaces( _t* _, const axutil_env_t *env, axiom_element_t *parent_element, axutil_hash_t *namespaces, int *next_ns_index); /** * Serialize to a String from the adb objects * @param _ _t object * @param env pointer to environment struct * @param namespaces hash of namespace uri to prefix * @return serialized string */ axis2_char_t* AXIS2_CALL _serialize_to_string( _t* _, const axutil_env_t *env, axutil_hash_t *namespaces); /** * Serialize to an XML from the adb objects * @param _ _t object * @param env pointer to environment struct * @param _om_node node to serialize from * @param _om_element parent element to serialize from * @param tag_closed whether the parent tag is closed or not * @param namespaces hash of namespace uri to prefix * @param next_ns_index an int which contain the next namespace index * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE */ axiom_node_t* AXIS2_CALL _serialize( _t* _, const axutil_env_t *env, axiom_node_t* _om_node, axiom_element_t *_om_element, int tag_closed, axutil_hash_t *namespaces, int *next_ns_index); /** * Check whether the is a particle class (E.g. group, inner sequence) * @return whether this is a particle class. */ axis2_bool_t AXIS2_CALL _is_particle(); #ifdef __cplusplus } #endif #endif /* _H */ ./src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl0000664000175000017500000007121111767656530024046 0ustar brianbrian private org.apache.axiom.om.OMElement toOM( param, boolean optimizeContent) throws org.apache.axis2.AxisFault { try{ return Helper.getOMElement( param, .MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory()); } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } return param; try{ return param.getOMElement(.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory()); } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } } private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, param, dummyWrappedType, boolean optimizeContent) throws org.apache.axis2.AxisFault{ try{ wrappedType = new (); wrappedComplexType = new (); wrappedComplexType.set(param); wrappedType.set(wrappedComplexType); wrappedType.set(param); org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild(Helper.getOMElement( wrappedType, .MY_QNAME,factory)); emptyEnvelope.getBody().addChild(wrappedType.getOMElement(.MY_QNAME,factory)); return emptyEnvelope; } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } } private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, param, boolean optimizeContent) throws org.apache.axis2.AxisFault{ try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild(Helper.getOMElement( param, .MY_QNAME,factory)); return emptyEnvelope; } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild(param); return emptyEnvelope; try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild(param.getOMElement(.MY_QNAME,factory)); return emptyEnvelope; } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } } /* methods to provide back word compatibility */ private get( wrappedType){ return wrappedType.get(); } private wrap( innerType){ wrappedElement = new (); wrappedElement.set(innerType); return wrappedElement; } private get( wrappedType){ return wrappedType.get().get(); return wrappedType.get(); } private get( wrappedType){ return wrappedType.get(); } private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, param, boolean optimizeContent) throws org.apache.axis2.AxisFault{ try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild( Helper.getOMElement( param, .MY_QNAME,factory)); emptyEnvelope.getBody().addChild(param.getOMElement(.MY_QNAME,factory)); return emptyEnvelope; } catch(org.apache.axis2.databinding.ADBException e){ throw org.apache.axis2.AxisFault.makeFault(e); } } private get( wrappedType){ return wrappedType.get().get(); return wrappedType.get(); } private get( wrappedType){ return wrappedType.get(); } private wrap( param){ wrappedElement = new (); innerType = new (); innerType.set(param); wrappedElement.set(innerType); wrappedElement.set(param); return wrappedElement; } private wrap( innerType){ wrappedElement = new (); wrappedElement.set(innerType); return wrappedElement; } private wrap(){ wrappedElement = new (); return wrappedElement; } /** * get the default envelope */ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){ return factory.getDefaultEnvelope(); } private java.lang.Object fromOM( org.apache.axiom.om.OMElement param, java.lang.Class type, java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{ try { if (.class.equals(type)){ return Helper.parse(param.getXMLStreamReaderWithoutCaching()); return param; return .Factory.parse(param.getXMLStreamReaderWithoutCaching()); } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } return null; } ./src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl0000664000175000017500000132554111767656530024004 0ustar brianbrian adb_ /** * .c * * This file was auto-generated from WSDL * by the Apache Axis2/Java version: #axisVersion# #today# */ #include ".h" _ adb_ /** * .c * * This file was auto-generated from WSDL * by the Apache Axis2/C version: SNAPSHOT Built on : Mar 10, 2008 (08:35:52 GMT+00:00) */ #include ".h" /* * This type was generated from the piece of schema that had * name = * Namespace URI = * Namespace Prefix = */ /* * implmentation of the | element */ struct { axutil_qname_t* qname; axutil_array_list_t* axiom_node_t* adb__t* property_; axis2_bool_t is_valid_; axutil_array_list_t* property_; axis2_bool_t is_valid_; axis2_char_t *current_choice; }; /************************* Private Function prototypes ********************************/ axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * Array of s. axis2_status_t AXIS2_CALL _set__nil_at( _t* , const axutil_env_t *env, int i); axis2_status_t AXIS2_CALL _set__nil( _t* , const axutil_env_t *env); /************************* Function Implmentations ********************************/ _t* AXIS2_CALL _create( const axutil_env_t *env) { _t * = NULL; axutil_qname_t* qname = NULL; AXIS2_ENV_CHECK(env, NULL); = (_t *) AXIS2_MALLOC(env-> allocator, sizeof(_t)); if(NULL == ) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset(, 0, sizeof(_t)); ->property_ = NULL; ->is_valid_ = AXIS2_FALSE; qname = axutil_qname_create (env, "", "", NULL); qname = axutil_qname_create (env, "", NULL, NULL); ->qname = qname; ->current_choice = ""; return ; } axis2_status_t AXIS2_CALL _free ( _t* , const axutil_env_t *env) { int i = 0; int count = 0; void *element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); _reset_(, env); _reset_(, env); if(->qname) { axutil_qname_free (->qname, env); ->qname = NULL; } if() { AXIS2_FREE(env->allocator, ); = NULL; } return AXIS2_SUCCESS; } axis2_status_t AXIS2_CALL _deserialize_from_string( _t* , const axutil_env_t *env, axis2_char_t *node_value, axiom_node_t *parent) { axis2_status_t status = AXIS2_SUCCESS; void *element = NULL; void *element = NULL; axis2_char_t *cp = NULL; axis2_bool_t prefix_found = AXIS2_FALSE; axiom_namespace_t *qname_ns; int i; axis2_char_t *token_value = NULL; axis2_char_t *original_node_value = NULL; axis2_bool_t the_last_token = AXIS2_FALSE; axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* _set_(, env, atoi(node_value)); _set_(, env, (char)(*node_value)); _set_(, env, atoi(node_value)); _set_(, env, axutil_strtol(node_value, (char**)NULL, 0)); _set_(, env, axutil_strtoul(node_value, (char**)NULL, 0)); _set_(, env, atof(node_value)); _set_(, env, atof(node_value)); _set_(, env, node_value); prefix_found = AXIS2_FALSE; for(cp = node_value; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, node_value, parent); } else { /* Then it is the default namespace */ cp = node_value; qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent); } _set_(, env, axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); _set_(, env, axutil_uri_parse_string(env, node_value)); _set_(, env, axutil_duration_create_from_string(env, node_value)); if (!axutil_strcmp(node_value, "TRUE") || !axutil_strcmp(node_value, "true")) { _set_(, env, AXIS2_TRUE); } else { _set_(, env, AXIS2_FALSE); } _set_(, env, atoi(node_value)); element = (void*)axutil_date_time_create(env); axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, node_value); _set_(, env, ()element); element = (void*)axutil_base64_binary_create(env); axutil_base64_binary_set_encoded_binary(()element, env, node_value); _set_(, env, ()element); /* can not handle the attribute type */ status = AXIS2_FAILURE; axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* * ()element element /* just to make sure we are not altering the original */ node_value = original_node_value = (axis2_char_t*)axutil_strdup(env, node_value); for(token_value = node_value, the_last_token = AXIS2_FALSE; !the_last_token; node_value ++) { if(*node_value == ' ' || *node_value == '\t' || *node_value == '\r' || *node_value == '\n' || *node_value == '\0') { if(*node_value == '\0') { the_last_token = AXIS2_TRUE; } else { *node_value = '\0'; } _add_(, env, atoi(token_value)); _add_(, env, (char)(*token_value)); _add_(, env, atoi(token_value)); _add_(, env, axutil_strtol(token_value, (char**)NULL, 0)); _add_(, env, axutil_strtoul(token_value, (char**)NULL, 0)); _add_(, env, atof(token_value)); _add_(, env, atof(token_value)); _add_(, env, token_value); prefix_found = AXIS2_FALSE; for(cp = token_value; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, token_value, parent); } else { /* Then it is the default namespace */ cp = token_value; qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent); } _add_(, env, axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); _add_(, env, axutil_uri_parse_string(env, token_value)); _add_(, env, axutil_duration_create_from_string(env, token_value)); if (!axutil_strcmp(token_value, "TRUE") || !axutil_strcmp(token_value, "true")) { _add_(, env, AXIS2_TRUE); } else { _add_(, env, AXIS2_FALSE); } _add_(, env, atoi(token_value)); element = (void*)axutil_date_time_create(env); axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, token_value); _add_(, env, ()element); element = (void*)axutil_base64_binary_create(env); axutil_base64_binary_add_encoded_binary(()element, env, token_value); _add_(, env, ()element); /* can not handle the attribute type */ status = AXIS2_FAILURE; token_value = node_value + 1; } } AXIS2_FREE(env->allocator, original_node_value); return status; } axis2_status_t AXIS2_CALL _deserialize( _t* , const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; void *element = NULL; axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axis2_char_t *cp = NULL; axis2_bool_t prefix_found = AXIS2_FALSE; axiom_namespace_t *qname_ns; axiom_element_t *text_element = NULL; axiom_node_t *text_node = NULL; status = AXIS2_FAILURE; if(parent) { text_node = axiom_node_get_first_child(parent, env); if (text_node && axiom_node_get_node_type(text_node, env) == AXIOM_TEXT) { axiom_text_t *text_element = (axiom_text_t*)axiom_node_get_data_element(text_node, env); if(text_element && axiom_text_get_value(text_element, env)) { text_value = (axis2_char_t*)axiom_text_get_value(text_element, env); status = _deserialize_from_string(, env, text_value, parent); } } } int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; yes axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } current_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); qname = axiom_element_get_qname(current_element, env, parent); if (axutil_qname_equals(qname, env, -> qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env))) { first_node = axiom_node_get_first_child(parent, env); first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for : " "Expected %s but returned %s", axutil_qname_to_string(-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } first_node = parent; first_node = axiom_node_get_first_child(parent, env); parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* ()element ->property_ element ->property_ ->property_ parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; axis2_char_t *dup_key; char *seperator = NULL; axis2_char_t *uri = NULL; axiom_namespace_t *namespace = NULL; axiom_attribute_t *new_attrib = NULL; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); dup_key = axutil_strdup(env, key); seperator = strstr(dup_key, "|"); uri = NULL; if(seperator) /* this means the attribute is qualified with a namespace */ { *seperator = '\0'; seperator ++; /* represent the namespace */ uri = seperator; } namespace = axiom_namespace_create(env, uri, NULL); parent_attri = (axiom_attribute_t*)val; attrib_text = axiom_attribute_get_value(parent_attri, env); new_attrib = axiom_attribute_create(env, dup_key, attrib_text, namespace); _add_(, env, new_attrib); AXIS2_FREE(env->allocator, dup_key); } } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "|")) if(!strcmp((axis2_char_t*)key, "")) { parent_attri = (axiom_attribute_t*)val; break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, ""); } if(attrib_text != NULL) { _set_(, env, atoi(attrib_text)); _set_(, env, (char)(*attrib_text)); _set_(, env, atoi(attrib_text)); _set_(, env, axutil_strtol(attrib_text, (char**)NULL, 0)); _set_(, env, axutil_strtoul(attrib_text, (char**)NULL, 0)); _set_(, env, atof(attrib_text)); _set_(, env, atof(attrib_text)); _set_(, env, attrib_text); prefix_found = AXIS2_FALSE; for(cp = attrib_text; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, attrib_text, parent); } else { /* Then it is the default namespace */ cp = attrib_text; qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent); } _set_(, env, axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); _set_(, env, axutil_uri_parse_string(env, attrib_text)); _set_(, env, axutil_duration_create_from_string(env, attrib_text)); if (!axutil_strcmp(attrib_text, "TRUE") || !axutil_strcmp(attrib_text, "true")) { _set_(, env, AXIS2_TRUE); } else { _set_(, env, AXIS2_FALSE); } _set_(, env, atoi(attrib_text)); element = (void*)axutil_date_time_create(env); axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, attrib_text); _set_(, env, ()element); element = (void*)axutil_base64_binary_create(env); axutil_base64_binary_set_encoded_binary(()element), env, attrib_text); _set_(, env, ()element); element = (void*)adb__create(env); adb__deserialize_from_string(()element, env, attrib_text, parent); _set_(, env, ()element); /* can not handle the attribute type */ } /* * building array */ arr_list = axutil_array_list_create(env, 10); /* * building element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; while(current_node && axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); } /* * because elements are ordered this works fine */ if(current_node != NULL && is_early_node_valid) { current_node = axiom_node_get_next_sibling(current_node, env); while(current_node && axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); } } is_early_node_valid = AXIS2_FALSE; element_qname = axutil_qname_create(env, "", "", NULL); element_qname = axutil_qname_create(env, "", NULL, NULL); /* * because elements are not ordered we should surf all the sibling to pick the right one */ for (current_node = first_node; current_node != NULL; current_node = axiom_node_get_next_sibling(current_node, env)) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); element_qname = axutil_qname_create(env, "", "", NULL); element_qname = axutil_qname_create(env, "", NULL, NULL); if (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env))) { /* found the requried element */ break; } } if (adb__is_particle() || (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } element = (void*)adb__create(env); status = adb__deserialize(()element, env, &current_node, &is_early_node_valid, AXIS2_TRUEAXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element "); } else { status = _set_(, env, ()element); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, text_value); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = _set_(, env, ""); } } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, axutil_uri_parse_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, axutil_duration_create_from_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { prefix_found = AXIS2_FALSE; for(cp = text_value; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri(current_element, env, text_value, current_node); } else { /* Then it is the default namespace */ cp = text_value; qname_ns = axiom_element_get_default_namespace(current_element, env, current_node); } status = _set_(, env, axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, (char)(*text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, atoi(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, atoi(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, atoi(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, atof(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, atof(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, axutil_strtol(text_value, (char**)NULL, 0)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = _set_(, env, axutil_strtoul(text_value, (char**)NULL, 0)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = NULL; /* just to avoid warning */ { axiom_node_t *current_property_node = current_node; current_node = axiom_node_get_next_sibling(current_node, env); axiom_node_detach(current_property_node, env); status = _set_(, env, current_property_node); } if(axiom_node_get_first_child(current_node, env)) { axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env); axiom_node_detach(current_property_node, env); status = _set_(, env, current_property_node); } else { status = _set_(, env, NULL); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { if (!axutil_strcasecmp(text_value , "true")) { status = _set_(, env, AXIS2_TRUE); } else { status = _set_(, env, AXIS2_FALSE); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = (void*)axutil_date_time_create(env); status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, text_value); if(AXIS2_FAILURE == status) { if(element != NULL) { axutil_date_time_free((axutil_date_time_t*)element, env); } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element "); } else { status = _set_(, env, ()element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = (void*)axutil_base64_binary_create(env); status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env, text_value); if(AXIS2_FAILURE == status) { if(element != NULL) { axutil_base64_binary_free((axutil_base64_binary_t*)element, env); } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element "); } else { status = _set_(, env, ()element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* Imposible to handle the request type - so please do it manually */ text_value = NULL; if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element missing"); return AXIS2_FAILURE; } /* 'any' arrays are not handling correctly when there are other elements mixed with the 'any' element. */ element_qname = axutil_qname_create(env, "", "", NULL); element_qname = axutil_qname_create(env, "", NULL, NULL); for (i = 0, sequence_broken = 0, current_node = first_node (is_early_node_valid?axiom_node_get_next_sibling(current_node, env):current_node); !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env))) { is_early_node_valid = AXIS2_TRUE; element = (void*)adb__create(env); status = adb__deserialize(()element, env, &current_node, &is_early_node_valid, AXIS2_TRUEAXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element "); } else { axutil_array_list_add_at(arr_list, env, i, element); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value)); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, "")); } } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { prefix_found = AXIS2_FALSE; for(cp = text_value; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri(current_element, env, text_value, current_node); } else { /* Then it is the default namespace */ cp = text_value; qname_ns = axiom_element_get_default_namespace(current_element, env, current_node); } axutil_array_list_add_at(arr_list, env, i, (void*) axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, (void*)axutil_uri_parse_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, (void*)axutil_duration_create_from_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, 64); (*(*)element) = (char)(*text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(int)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(axis2_byte_t)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(short)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(float)); (*(*)element) = atof(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps float in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(double)); (*(*)element) = atof(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps int64_t in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(int64_t)); (*(*)element) = axutil_strtol(text_value, (char**)NULL, 0); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps int64_t in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(uint64_t)); (*(*)element) = axutil_strtoul(text_value, (char**)NULL, 0); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = NULL; /* just to avoid warning */ { axiom_node_t *current_property_node = current_node; current_node = axiom_node_get_next_sibling(current_node, env); axiom_node_detach(current_property_node, env); axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node); } if(axiom_node_get_first_child(current_node, env)) { axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env); axiom_node_detach(current_property_node, env); axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node); } else { status = _set_(, env, NULL); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { if (!axutil_strcasecmp (text_value , "true")) { element = AXIS2_MALLOC(env->allocator,sizeof(axis2_bool_t)); (*(*)element) = AXIS2_TRUE; axutil_array_list_add_at(arr_list, env, i, (void*)element); } else { element = AXIS2_MALLOC(env->allocator,sizeof(axis2_bool_t)); (*(*)element) = AXIS2_FALSE; axutil_array_list_add_at(arr_list, env, i, (void*)element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = (void*)axutil_date_time_create(env); status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, text_value); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); } else { axutil_array_list_add_at(arr_list, env, i, element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = (void*)axutil_base64_binary_create(env); status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env, text_value); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); } else { axutil_array_list_add_at(arr_list, env, i, element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* imposible to handle the request type - so please do it manually */ text_value = NULL; if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < ) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, " (@minOccurs = '') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = _set_(, env, arr_list); } element_qname = axutil_qname_create(env, "", "", NULL); element_qname = axutil_qname_create(env, "", NULL, NULL); /* * because elements are not ordered we should surf all the sibling to pick the right one */ for (i = 0, current_node = first_node; current_node != NULL; current_node = axiom_node_get_next_sibling(current_node, env)) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("", axiom_element_get_localname(current_element, env))) { /* found the requried element */ is_early_node_valid = AXIS2_TRUE; element = (void*)adb__create(env); status = adb__deserialize(()element, env, &current_node, &is_early_node_valid, AXIS2_TRUEAXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); } else { axutil_array_list_add_at(arr_list, env, i, element); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value)); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, "")); } } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { prefix_found = AXIS2_FALSE; for(cp = text_value; *cp; cp ++) { if(*cp == ':') { *cp = '\0'; cp ++; prefix_found = AXIS2_TRUE; break; } } if(prefix_found) { /* node value contain the prefix */ qname_ns = axiom_element_find_namespace_uri(current_element, env, text_value, current_node); } else { /* Then it is the default namespace */ cp = text_value; qname_ns = axiom_element_get_default_namespace(current_element, env, current_node); } axutil_array_list_add_at(arr_list, env, i, (void*) axutil_qname_create( env, cp, /* cp contain the localname */ axiom_namespace_get_uri(qname_ns, env), axiom_namespace_get_prefix(qname_ns, env))); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, (void*)axutil_uri_parse_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, (void*)axutil_duration_create_from_string(env, text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, 64); (*(*)element) = (char)(*text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(int)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(int)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { /* we keeps ints in arrays from their pointers */ element = AXIS2_MALLOC(env-> allocator, sizeof(short)); (*(*)element) = atoi(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* we keeps float in arrays from their pointers */ text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = AXIS2_MALLOC(env-> allocator, sizeof(float)); (*(*)element) = atof(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* we keeps float in arrays from their pointers */ text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = AXIS2_MALLOC(env-> allocator, sizeof(double)); (*(*)element) = atof(text_value); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* we keeps int64_t in arrays from their pointers */ text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = AXIS2_MALLOC(env-> allocator, sizeof(int64_t)); (*(*)element) = axutil_strtol(text_value, (char**)NULL,0); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* we keeps int64_t in arrays from their pointers */ text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { element = AXIS2_MALLOC(env-> allocator, sizeof(uint64_t)); (*(*)element) = axutil_strtoul(text_value, (char**)NULL, 0); axutil_array_list_add_at(arr_list, env, i, element); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } text_value = NULL; /* just to avoid warning */ { axiom_node_t *current_property_node = current_node; current_node = axiom_node_get_next_sibling(current_node, env); axiom_node_detach(current_property_node, env); axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node); } if(axiom_node_get_first_child(current_node, env)) { axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env); axiom_node_detach(current_property_node, env); axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node); } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { if (!axutil_strcasecmp (text_value , "true")) { element = AXIS2_MALLOC(env->allocator,sizeof(axis2_bool_t)); (*(*)element) = AXIS2_TRUE; axutil_array_list_add_at(arr_list, env, i, (void*)element); } else { element = AXIS2_MALLOC(env->allocator,sizeof(axis2_bool_t)); (*(*)element) = AXIS2_FALSE; axutil_array_list_add_at(arr_list, env, i, (void*)element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } element = (void*)axutil_date_time_create(env); text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, text_value); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element "); } else { axutil_array_list_add_at(arr_list, env, i, element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } element = (void*)axutil_base64_binary_create(env); text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env, text_value); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element "); } else { axutil_array_list_add_at(arr_list, env, i, element); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element "); status = AXIS2_FAILURE; } /* imposible to handle the request type - so please do it manually */ text_value = NULL; if(AXIS2_FAILURE == status) { if(element_qname) { axutil_qname_free(element_qname, env); } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for "); return AXIS2_FAILURE; } i ++; } } status = _set_(, env, arr_list); if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } *dp_parent = current_node; *dp_is_early_node_valid = is_early_node_valid; return status; } axis2_bool_t AXIS2_CALL _is_particle() { return AXIS2_TRUE; return AXIS2_FALSE; } void AXIS2_CALL _declare_parent_namespaces( _t* , const axutil_env_t *env, axiom_element_t *parent_element, axutil_hash_t *namespaces, int *next_ns_index) { yes axiom_namespace_t *element_ns = NULL; axis2_char_t *qname_uri; axis2_char_t *qname_prefix; /* Here this is an empty function, Nothing to declare */ axiom_node_t* adb__t* ()element ->property_ qname_uri = axutil_qname_get_uri(, env); if(qname_uri && !axutil_strcmp(qname_uri, "")) { if(!(qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_KEY_STRING))) { qname_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(qname_prefix, "q%d", (*next_ns_index)++); axutil_hash_set(namespaces, qname_uri, AXIS2_HASH_KEY_STRING, qname_prefix); if(parent_element) { element_ns = axiom_namespace_create(env, qname_uri, qname_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, element_ns); } } } } axis2_char_t* AXIS2_CALL _serialize_to_string( _t* , const axutil_env_t *env, axutil_hash_t *namespaces) { axis2_char_t *text_value = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; int i; int allocated_len = 0; axis2_char_t *tmp_value; axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* ()element ->property_ element ->property_ text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%c", ); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, AXIS2_PRINTF_INT64_FORMAT_SPECIFIER, (int64_t)); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER, (uint64_t)); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%f", ); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%f", ); text_value = (axis2_char_t*)axutil_strdup(env, ); text_value = axutil_uri_to_string(, env, AXIS2_URI_UNP_OMITUSERINFO); text_value = axutil_duration_serialize_duration(, env); qname_uri = axutil_qname_get_uri(, env); if(qname_uri == NULL) { text_value = (axis2_char_t*)axutil_strdup(env, axutil_qname_get_localpart(, env)); } else { qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_STRING); if(qname_prefix != NULL) { text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(axutil_qname_get_localpart(, env)) + 2)); sprintf(text_value, "%s:%s", qname_prefix, axutil_qname_get_localpart(, env)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in serialize_to_string value for , " "Prefix is not declared beofre using"); return NULL; } } text_value = (axis2_char_t*)(axutil_strdup(env, ()?"true":"false")); text_value = axutil_date_time_serialize_date_time(, env); text_value = axutil_base64_binary_get_encoded_binary(, env); /* can not handle the property type */ text_value = NULL; axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* * ()element element for(i = 0, allocated_len = 2, text_value = (axis2_char_t*) axutil_strdup(env, ""); i < _sizeof_(, env); i ++) { element; axis2_char_t *seperator = (i == _sizeof_(, env) - 1)?"":ADB_DEFAULT_LIST_SEPERATOR; element = _get__at(, env, i); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%d%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%d%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%c%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%d%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s" AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s" AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%f%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%f%s", text_value, element, seperator); allocated_len += sizeof (axis2_char_t) * axutil_strlen(element) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, element, seperator); tmp_value = axutil_uri_to_string(element, env, AXIS2_URI_UNP_OMITUSERINFO); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); tmp_value = axutil_duration_serialize_duration(element, env); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); qname_uri = axutil_qname_get_uri(element, env); if(qname_uri == NULL) { tmp_value = axutil_qname_get_localpart(element, env); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); } else { qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_STRING); if(qname_prefix != NULL) { tmp_value = axutil_qname_get_localpart(element, env); allocated_len += sizeof (axis2_char_t) * (ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + 1 + axutil_strlen(tmp_value) + 2); text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf(text_value, "%s%s:%s%s", text_value, qname_prefix, tmp_value, seperator); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in serialize_to_string value for , " "Prefix is not declared beofre using"); return NULL; } } tmp_value = (axis2_char_t*)((element)?"true":"false"); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); tmp_value = axutil_date_time_serialize_date_time(element, env); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); tmp_value = axutil_base64_binary_get_encoded_binary(element, env); allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1; text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len); sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator); /* can not handle the property type */ } return text_value; } axiom_node_t* AXIS2_CALL _serialize( _t* , const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_attribute_t *text_attri = NULL; axis2_char_t *string_to_stream; axiom_node_t *current_node = NULL; int tag_closed = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; axis2_char_t *text_value; axiom_namespace_t *ns1 = NULL; axis2_char_t *p_prefix = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; int i = 0; int count = 0; void *element = NULL; axis2_char_t *text_value_; axis2_char_t *text_value__temp; axis2_char_t text_value_[64]; axis2_char_t *text_value = NULL; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, , NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "", "n"); axutil_hash_set(namespaces, "", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); ns1 = NULL; parent_element = axiom_element_create (env, NULL, "", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); current_node = parent; data_source = (axiom_data_source_t *)axiom_node_get_data_element(current_node, env); if (!data_source) return NULL; stream = axiom_data_source_get_stream(data_source, env); /* assume parent is of type data source */ if (!stream) return NULL; data_source = axiom_data_source_create(env, parent, &current_node); stream = axiom_data_source_get_stream(data_source, env); if(!parent_tag_closed) { axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* ()element ->property_ element ->property_ : ->property_ if(->is_valid_) { for( i = 0; i < axutil_array_list_size(, env); i ++) { axiom_attribute_t *the_attrib = NULL; axiom_attribute_t *dup_attrib = NULL; axis2_char_t *uri = NULL; axis2_char_t *p_prefix = NULL; axutil_qname_t *qname = NULL; axis2_char_t *value = NULL; axis2_char_t *local_name = NULL; the_attrib = axutil_array_list_get(, env, i); qname = axiom_attribute_get_qname(the_attrib, env); uri = axutil_qname_get_uri(qname, env); value = axiom_attribute_get_value(the_attrib, env); local_name = axutil_qname_get_localpart(qname, env); p_prefix = NULL; if(uri) /* means we have to go for a prefix */ { if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, uri, AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, uri, AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, uri, p_prefix)); } } text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(local_name) + axutil_strlen(value))); sprintf(text_value, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", local_name, value); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "", p_prefix)); } p_prefix = NULL; text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%d\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%d\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%c\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%d\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"" AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"" AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%f\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_DIGIT_LIMIT + 5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%f\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen() + axutil_strlen(""))); sprintf(text_value, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", ); axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env-> allocator, text_value); text_value = axutil_uri_to_string(, env, AXIS2_URI_UNP_OMITUSERINFO); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); text_value = axutil_duration_serialize_duration(, env); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); qname_uri = axutil_qname_get_uri(, env); if(qname_uri && !axutil_strcmp(qname_uri, "")) { if(!(qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_KEY_STRING))) { qname_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(qname_prefix, "q%d", (*next_ns_index) ++); axutil_hash_set(namespaces, qname_uri, AXIS2_HASH_KEY_STRING, qname_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, qname_uri, qname_prefix)); } text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (2 + axutil_strlen(qname_prefix) + axutil_strlen(axutil_qname_get_localpart(, env)))); sprintf(text_value, "%s%s%s", qname_prefix, (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", axutil_qname_get_localpart(, env)); } else { text_value = (axis2_char_t*)axutil_strdup(env, axutil_qname_get_localpart(, env)); } string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env->allocator, string_to_stream); AXIS2_FREE(env->allocator, text_value); text_value = (axis2_char_t*)(()?"true":"false"); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); text_value = axutil_date_time_serialize_date_time(, env); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); text_value = axutil_base64_binary_get_encoded_binary(, env); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); adb__declare_parent_namespaces(, env, parent_element, namespaces, next_ns_index); text_value = adb__serialize_to_string(, env, namespaces); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(text_value) + axutil_strlen(""))); sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"", "", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); AXIS2_FREE(env-> allocator, text_value); /* can not handle the attribute type */ text_value = NULL; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-optional attribute "); return NULL; } string_to_stream = ">"; axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); tag_closed = 1; } if(!parent_tag_closed && !tag_closed) { text_value = ">"; axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); } text_value = _serialize_to_string(, env, namespaces); if(text_value) { axutil_stream_write(stream, env, text_value, axutil_strlen(text_value)); AXIS2_FREE(env->allocator, text_value); } axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* ()element ->property_ element ->property_ ->property_ if(parent_tag_closed) { if(->is_valid_) { for( i = 0; i < axutil_array_list_size(, env); i ++) { axiom_attribute_t *the_attrib = NULL; axiom_attribute_t *dup_attrib = NULL; axis2_char_t *uri = NULL; axis2_char_t *p_prefix = NULL; axutil_qname_t *qname = NULL; axis2_char_t *value = NULL; axis2_char_t *local_name = NULL; axiom_namespace_t *ns1 = NULL; the_attrib = axutil_array_list_get(, env, i); qname = axiom_attribute_get_qname(the_attrib, env); uri = axutil_qname_get_uri(qname, env); value = axiom_attribute_get_value(the_attrib, env); local_name = axutil_qname_get_localpart(qname, env); p_prefix = NULL; if(uri) /* means we have to go for a prefix */ { if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, uri, AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, uri, AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, uri, p_prefix)); } } ns1 = axiom_namespace_create (env, uri, p_prefix); dup_attrib = axiom_attribute_create (env, local_name, value, ns1); axiom_element_add_attribute (parent_element, env, dup_attrib, parent); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "", p_prefix)); } ns1 = axiom_namespace_create (env, "", p_prefix); p_prefix = NULL; ns1 = NULL; text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%c", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%d", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, AXIS2_PRINTF_INT64_FORMAT_SPECIFIER, (int64_t)); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER, (uint64_t)); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%f", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT); sprintf (text_value, "%f", ); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); text_value = ; text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); text_value = axutil_uri_to_string(, env, AXIS2_URI_UNP_OMITUSERINFO); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); text_value = axutil_duration_serialize_duration(, env); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); qname_uri = axutil_qname_get_uri(, env); if(qname_uri) { if(!(qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_KEY_STRING))) { qname_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(qname_prefix, "q%d", (*next_ns_index) ++ ); axutil_hash_set(namespaces, qname_uri, AXIS2_HASH_KEY_STRING, qname_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, qname_uri, qname_prefix)); } } text_value = (axis2_char_t*) AXIS2_MALLOC(env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(axutil_qname_get_localpart(, env)) + 2)); sprintf(text_value, "%s%s%s", qname_uri?qname_prefix:"", qname_uri?":":"", axutil_qname_get_localpart(, env)); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env->allocator, text_value); text_value = (axis2_char_t*)(()?axutil_strdup(env, "true"):axutil_strdup(env, "false")); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env->allocator, text_value); text_value = axutil_date_time_serialize_date_time(, env); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); text_value = axutil_base64_binary_get_encoded_binary(, env); text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); adb__declare_parent_namespaces(, env, parent_element, namespaces, next_ns_index); text_value = adb__serialize_to_string(, env, namespaces); if(text_value) { text_attri = axiom_attribute_create (env, "", text_value, ns1); axiom_element_add_attribute (parent_element, env, text_attri, parent); AXIS2_FREE(env-> allocator, text_value); } /* Can not handle the attribute type */ text_value = NULL; parent_element = NULL; text_attri = NULL; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-optional attribute "); return NULL; } } if(0 == axutil_strcmp(->current_choice, ":")) { if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "", p_prefix)); } p_prefix = NULL; if (!->is_valid_) { /* no need to complain for minoccurs=0 element */ start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("") + axutil_strlen(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"1\""))); sprintf(start_input_str, "<%s%s xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"1\"/>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); axutil_stream_write(stream, env, start_input_str, axutil_strlen(start_input_str)); AXIS2_FREE(env->allocator,start_input_str); /* no need to complain for minoccurs=0 element */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property "); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen(""))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen(""))); /* axutil_strlen("</:>") + 1 = 5 */ /* * Parsing array */ if (->property_ != NULL) { sprintf(start_input_str, "<%s%s", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); sprintf(start_input_str, "<%s%s>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%s>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); count = axutil_array_list_size(->property_, env); for(i = 0; i < count; i ++) { element = axutil_array_list_get(->property_, env, i); if(NULL == element) { continue; } /* * parsing element */ sprintf(start_input_str, "<%s%s", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); sprintf(start_input_str, "<%s%s>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%s>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); if(!adb__is_particle()) { axutil_stream_write(stream, env, start_input_str, start_input_str_len); } AXIS2_FALSE AXIS2_FALSE AXIS2_TRUE adb__serialize(, env, current_node, parent_element, adb__is_particle() || , namespaces, next_ns_index); if(!adb__is_particle()) { axutil_stream_write(stream, env, end_input_str, end_input_str_len); } sprintf (text_value_, AXIS2_PRINTF_INT32_FORMAT_SPECIFIER, *((*)element)); sprintf (text_value_, AXIS2_PRINTF_INT32_FORMAT_SPECIFIER, ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER, *((*)element)); sprintf (text_value_, AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER, ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%c", *((*)element)); sprintf (text_value_, "%c", ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%c", *((*)element)); sprintf (text_value_, "%c", ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%d", *((*)element)); sprintf (text_value_, "%d", ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%d", *((*)element)); sprintf (text_value_, "%d", ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%hu", *((*)element)); sprintf (text_value_, "%hu", ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, AXIS2_PRINTF_INT64_FORMAT_SPECIFIER, (int64_t)*((*)element)); sprintf (text_value_, AXIS2_PRINTF_INT64_FORMAT_SPECIFIER, (int64_t) ); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER, (uint64_t)*((*)element)); sprintf (text_value_, AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER, (uint64_t)); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%f", (float)*((*)element)); sprintf (text_value_, "%f", (float)); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); sprintf (text_value_, "%f", (double)*((*)element)); sprintf (text_value_, "%f", (double)); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ = ; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value__temp = axutil_xml_quote_string(env, text_value_, AXIS2_TRUE); if (text_value__temp) { axutil_stream_write(stream, env, text_value__temp, axutil_strlen(text_value__temp)); AXIS2_FREE(env->allocator, text_value__temp); } else { axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ = axutil_uri_to_string(, env, AXIS2_URI_UNP_OMITUSERINFO); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ = axutil_duration_serialize_duration(, env); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); axutil_stream_write(stream, env, start_input_str, start_input_str_len); qname_uri = axutil_qname_get_uri(, env); if(qname_uri) { if(!(qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_KEY_STRING))) { qname_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(qname_prefix, "q%d", (*next_ns_index) ++ ); axutil_hash_set(namespaces, qname_uri, AXIS2_HASH_KEY_STRING, qname_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, qname_uri, qname_prefix)); } } text_value_ = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + axutil_strlen(axutil_qname_get_localpart(, env)) + 2)); sprintf(text_value_, "%s%s%s", qname_uri?qname_prefix:"", qname_uri?":":"", axutil_qname_get_localpart(, env)); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); AXIS2_FREE(env-> allocator, text_value_); axutil_stream_write(stream, env, end_input_str, end_input_str_len); strcpy(text_value_, ()?"true":"false"); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ = axiom_node_to_string(, env); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ = NULL; /* just to bypass the warning unused variable */ axiom_node_add_child(parent, env, ); text_value_ = axutil_date_time_serialize_date_time(, env); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); text_value_ =axutil_base64_binary_get_encoded_binary(, env); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_, axutil_strlen(text_value_)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); /* This is an unknown type or a primitive. handle this manually for unknown type */ } } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; } axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* axiom_node_t* adb__t* * ()element ->property_ element ->property_ const /** * getter for . */ AXIS2_CALL _get_( _t* , const axutil_env_t *env) { AXIS2_ENV_CHECK(env, ()0); AXIS2_PARAM_CHECK(env->error, , ()0); AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, , NULL); return ->property_; } /** * setter for */ axis2_status_t AXIS2_CALL _set_( _t* , const axutil_env_t *env, arg_) { int size = 0; int i = 0; axis2_bool_t non_nil_exists = AXIS2_FALSE; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(->is_valid_ && arg_ == ->property_) { ->current_choice = ":"; return AXIS2_SUCCESS; } size = axutil_array_list_size(arg_, env); if (size > ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, " has exceed the maxOccurs()"); return AXIS2_FAILURE; } if (size < ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, " has less than minOccurs()"); return AXIS2_FAILURE; } for(i = 0; i < size; i ++ ) { if(NULL != axutil_array_list_get(arg_, env, i)) { non_nil_exists = AXIS2_TRUE; break; } } if(!non_nil_exists) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "All the elements in the array of is being set to NULL, but it is not a nullable or minOccurs=0 element"); return AXIS2_FAILURE; } if(NULL == arg_) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, " is being set to NULL, but it is not a nullable element"); return AXIS2_FAILURE; } _reset_(, env); if(NULL == arg_) { /* We are already done */ return AXIS2_SUCCESS; } ->property_ = arg_; if(non_nil_exists) { ->is_valid_ = AXIS2_TRUE; } ->property_ = (axis2_char_t *)axutil_strdup(env, arg_); if(NULL == ->property_) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error allocating memeory for "); return AXIS2_FAILURE; } ->is_valid_ = AXIS2_TRUE; ->property_ = arg_; ->is_valid_ = AXIS2_TRUE; ->current_choice = ":"; return AXIS2_SUCCESS; } /** * Get ith element of . */ AXIS2_CALL _get__at( _t* , const axutil_env_t *env, int i) { ret_val; AXIS2_ENV_CHECK(env, ()0); AXIS2_PARAM_CHECK(env->error, , ()0); AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, , NULL); if(->property_ == NULL) { return ()0; } ret_val = ()axutil_array_list_get(->property_, env, i); if(ret_val) { return *ret_val; } return ()0; return ret_val; } /** * Set the ith element of . */ axis2_status_t AXIS2_CALL _set__at( _t* , const axutil_env_t *env, int i, arg_) { void *element = NULL; int size = 0; int j; int k; axis2_bool_t non_nil_exists = AXIS2_FALSE; ptr_param_; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if( ->is_valid_ && ->property_ && arg_ == *(()axutil_array_list_get(->property_, env, i))) arg_ == ()axutil_array_list_get(->property_, env, i)) { ->current_choice = ":"; return AXIS2_SUCCESS; } non_nil_exists = AXIS2_TRUE; /* no way to check for nill for each elements for primitive types */ if(NULL == arg_) { if(->property_ != NULL) { size = axutil_array_list_size(->property_, env); for(j = 0, k = 0; j < size; j ++ ) { if(i == j) continue; if(NULL != axutil_array_list_get(->property_, env, i)) { k ++; non_nil_exists = AXIS2_TRUE; if(k >= ) { break; } } } } } else { non_nil_exists = AXIS2_TRUE; } if(!non_nil_exists) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "All the elements in the array of is being set to NULL, but it is not a nullable or minOccurs=0 element"); return AXIS2_FAILURE; } if( k < ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Size of the array of is beinng set to be smaller than the specificed number of minOccurs()"); return AXIS2_FAILURE; } if(->property_ == NULL) { ->property_ = axutil_array_list_create(env, 10); } /* check whether there already exist an element */ element = axutil_array_list_get(->property_, env, i); if(NULL != element) { adb__free(, env); /* we keep primtives as pointers in arrasy, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ } if(!non_nil_exists) { ->is_valid_ = AXIS2_FALSE; axutil_array_list_set(->property_ , env, i, NULL); return AXIS2_SUCCESS; } ptr_param_ = () AXIS2_MALLOC(env->allocator, sizeof()); if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for new value of "); return AXIS2_FAILURE; } *ptr_param_ = arg_; axutil_array_list_set(->property_ , env, i, ptr_param_); axutil_array_list_set(->property_ , env, i, axutil_strdup(env, arg_)); axutil_array_list_set(->property_ , env, i, arg_); ->is_valid_ = AXIS2_TRUE; ->current_choice = ":"; return AXIS2_SUCCESS; } /** * Add to . */ axis2_status_t AXIS2_CALL _add_( _t* , const axutil_env_t *env, arg_ ) { ptr_param_; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(NULL == arg_) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "All the elements in the array of is being set to NULL, but it is not a nullable or minOccurs=0 element"); return AXIS2_FAILURE; return AXIS2_SUCCESS; } if(->property_ == NULL) { ->property_ = axutil_array_list_create(env, 10); } if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for "); return AXIS2_FAILURE; } ptr_param_ = () AXIS2_MALLOC(env->allocator, sizeof()); if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for new value of "); return AXIS2_FAILURE; } *ptr_param_ = arg_; axutil_array_list_add(->property_ , env, ptr_param_); axutil_array_list_add(->property_ , env, axutil_strdup(env, arg_)); axutil_array_list_add(->property_ , env, arg_); ->is_valid_ = AXIS2_TRUE; return AXIS2_SUCCESS; } /** * Get the size of the array. */ int AXIS2_CALL _sizeof_( _t* , const axutil_env_t *env) { AXIS2_ENV_CHECK(env, -1); AXIS2_PARAM_CHECK(env->error, , -1); if(->property_ == NULL) { return 0; } return axutil_array_list_size(->property_, env); } /** * remove the ith element, same as set_nil_at. */ axis2_status_t AXIS2_CALL _remove__at( _t* , const axutil_env_t *env, int i) { return _set__nil_at(, env, i); } /** * resetter for */ axis2_status_t AXIS2_CALL _reset_( _t* , const axutil_env_t *env) { int i = 0; int count = 0; void *element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if (->property_ != NULL) { count = axutil_array_list_size(->property_, env); for(i = 0; i < count; i ++) { element = axutil_array_list_get(->property_, env, i); if( != NULL) { adb__free(, env); /* we keep primtives as pointers in arrasy, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ = NULL; } } axutil_array_list_free(->property_, env); } ->is_valid_ = AXIS2_FALSE; return AXIS2_SUCCESS; } /** * Check whether is nill */ axis2_bool_t AXIS2_CALL _is__nil( _t* , const axutil_env_t *env) { AXIS2_ENV_CHECK(env, AXIS2_TRUE); AXIS2_PARAM_CHECK(env->error, , AXIS2_TRUE); return !->is_valid_; } /** * Set to nill (currently the same as reset) */ axis2_status_t AXIS2_CALL _set__nil( _t* , const axutil_env_t *env) { return _reset_(, env); } /** * Check whether is nill at i */ axis2_bool_t AXIS2_CALL _is__nil_at( _t* , const axutil_env_t *env, int i) { AXIS2_ENV_CHECK(env, AXIS2_TRUE); AXIS2_PARAM_CHECK(env->error, , AXIS2_TRUE); return (->is_valid_ == AXIS2_FALSE || NULL == ->property_ || NULL == axutil_array_list_get(->property_, env, i)); } /** * Set to nill at i */ axis2_status_t AXIS2_CALL _set__nil_at( _t* , const axutil_env_t *env, int i) { void *element = NULL; int size = 0; int j; axis2_bool_t non_nil_exists = AXIS2_FALSE; int k = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(->property_ == NULL || ->is_valid_ == AXIS2_FALSE) { non_nil_exists = AXIS2_FALSE; } else { size = axutil_array_list_size(->property_, env); for(j = 0, k = 0; j < size; j ++ ) { if(i == j) continue; if(NULL != axutil_array_list_get(->property_, env, i)) { k ++; non_nil_exists = AXIS2_TRUE; if( k >= ) { break; } } } } if(!non_nil_exists) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "All the elements in the array of is being set to NULL, but it is not a nullable or minOccurs=0 element"); return AXIS2_FAILURE; } if( k < ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Size of the array of is beinng set to be smaller than the specificed number of minOccurs()"); return AXIS2_FAILURE; } if(->property_ == NULL) { ->is_valid_ = AXIS2_FALSE; return AXIS2_SUCCESS; } /* check whether there already exist an element */ element = axutil_array_list_get(->property_, env, i); if(NULL != element) { adb__free(, env); /* we keep primtives as pointers in arrasy, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ } if(!non_nil_exists) { ->is_valid_ = AXIS2_FALSE; axutil_array_list_set(->property_ , env, i, NULL); return AXIS2_SUCCESS; } axutil_array_list_set(->property_ , env, i, NULL); return AXIS2_SUCCESS; } axutil_array_list_t* axiom_node_t* adb__t* axiom_node_t* adb__t* * ()element element const /** * Get the ith element of . */ AXIS2_CALL _get__at( _t* , const axutil_env_t *env, int i) { ret_val; AXIS2_ENV_CHECK(env, ()0); AXIS2_PARAM_CHECK(env->error, , ()0); AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, , NULL); if(->property_ == NULL) { return ()0; } ret_val = ()axutil_array_list_get(->property_, env, i); if(ret_val) { return *ret_val; } return ()0; return ret_val; } /** * Set the ith element of . (If the ith already exist, it will be replaced) */ axis2_status_t AXIS2_CALL _set__at( _t* , const axutil_env_t *env, int i, arg_ ) { void *element = NULL; int size = 0; int j; ptr_param_; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if( ->is_valid_ && ->property_ && arg_ == *(()axutil_array_list_get(->property_, env, i))) arg_ == ()axutil_array_list_get(->property_, env, i)) { return AXIS2_SUCCESS; } if(->property_ == NULL) { ->property_ = axutil_array_list_create(env, 10); } /* check whether there already exist an element */ element = axutil_array_list_get(->property_, env, i); if(NULL != element) { adb__free(, env); /* we keep primtives as pointers in arrasy, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ } ptr_param_ = () AXIS2_MALLOC(env->allocator, sizeof()); if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for new value of "); return AXIS2_FAILURE; } *ptr_param_ = arg_; axutil_array_list_set(->property_ , env, i, ptr_param_); axutil_array_list_set(->property_ , env, i, axutil_strdup(env, arg_)); axutil_array_list_set(->property_ , env, i, arg_); ->is_valid_ = AXIS2_TRUE; return AXIS2_SUCCESS; } /** * Add to . */ axis2_status_t AXIS2_CALL _add_( _t* , const axutil_env_t *env, arg_ ) { ptr_param_; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(->property_ == NULL) { ->property_ = axutil_array_list_create(env, 10); } if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for "); return AXIS2_FAILURE; } ptr_param_ = () AXIS2_MALLOC(env->allocator, sizeof()); if(->property_ == NULL) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in allocatting memory for new value of "); return AXIS2_FAILURE; } *ptr_param_ = arg_; axutil_array_list_add(->property_ , env, ptr_param_); axutil_array_list_add(->property_ , env, axutil_strdup(env, arg_)); axutil_array_list_add(->property_ , env, arg_); ->is_valid_ = AXIS2_TRUE; return AXIS2_SUCCESS; } /** * Get the size of the array. */ int AXIS2_CALL _sizeof_( _t* , const axutil_env_t *env) { AXIS2_ENV_CHECK(env, -1); AXIS2_PARAM_CHECK(env->error, , -1); if(->property_ == NULL) { return 0; } return axutil_array_list_size(->property_, env); } /** * Remove the ith element of . */ axis2_status_t AXIS2_CALL _remove__at( _t* , const axutil_env_t *env, int i) { void *element = NULL; int size = 0; int j; int k = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(->property_ == NULL) { ->is_valid_ = AXIS2_FALSE; return AXIS2_SUCCESS; } /* check whether there already exist an element */ element = axutil_array_list_get(->property_, env, i); if(NULL != element) { adb__free(, env); /* we keep primtives as pointers in arrasy, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ } axutil_array_list_set(->property_ , env, i, NULL); return AXIS2_SUCCESS; } /** * Getter for . */ AXIS2_CALL _get_( _t* , const axutil_env_t *env) { AXIS2_ENV_CHECK(env, ()0); AXIS2_PARAM_CHECK(env->error, , ()0); AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, , NULL); return ->property_; } /** * Setter for . */ axis2_status_t AXIS2_CALL _set_( _t* , const axutil_env_t *env, arg_) { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if(->is_valid_ && arg_ == ->property_) { ->current_choice = ":"; return AXIS2_SUCCESS; } _reset_(, env); if(NULL == arg_) { /* We are already done */ return AXIS2_SUCCESS; } ->property_ = arg_; ->is_valid_ = AXIS2_TRUE; return AXIS2_SUCCESS; } /** * Resetter for */ axis2_status_t AXIS2_CALL _reset_( _t* , const axutil_env_t *env) { int i = 0; int count = 0; void *element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, , AXIS2_FAILURE); if (->property_ != NULL) { count = axutil_array_list_size(->property_, env); for(i = 0; i < count; i ++) { element = axutil_array_list_get(->property_, env, i); if( != NULL) { adb__free(, env); /* we keep primtives as pointers in arrays, so need to free them */ AXIS2_FREE(env-> allocator, element); AXIS2_FREE(env-> allocator, ); axiom_node_free_tree (, env); axutil_qname_free(, env); axutil_uri_free(, env); axutil_duration_free(, env); axutil_date_time_free(, env); axutil_base64_binary_free (, env); axutil_duration_free (, env); /* This is an unknown type or a primitive. Please free this manually*/ = NULL; } } axutil_array_list_free(->property_, env); } ->is_valid_ = AXIS2_FALSE; return AXIS2_SUCCESS; } ./src/org/apache/axis2/schema/SchemaCompiler.java0000664000175000017500000040542011767656530021035 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import org.apache.axis2.namespace.Constants; import org.apache.axis2.schema.i18n.SchemaCompilerMessages; import org.apache.axis2.schema.util.PrimitiveTypeFinder; import org.apache.axis2.schema.util.PrimitiveTypeWrapper; import org.apache.axis2.schema.util.SchemaPropertyLoader; import org.apache.axis2.schema.writer.BeanWriter; import org.apache.axis2.util.SchemaUtil; import org.apache.axis2.util.URLProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAll; import org.apache.ws.commons.schema.XmlSchemaAny; import org.apache.ws.commons.schema.XmlSchemaAnyAttribute; import org.apache.ws.commons.schema.XmlSchemaAttribute; import org.apache.ws.commons.schema.XmlSchemaAttributeGroup; import org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef; import org.apache.ws.commons.schema.XmlSchemaChoice; import org.apache.ws.commons.schema.XmlSchemaComplexContent; import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension; import org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaContent; import org.apache.ws.commons.schema.XmlSchemaContentModel; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet; import org.apache.ws.commons.schema.XmlSchemaExternal; import org.apache.ws.commons.schema.XmlSchemaGroup; import org.apache.ws.commons.schema.XmlSchemaGroupBase; import org.apache.ws.commons.schema.XmlSchemaGroupRef; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaLengthFacet; import org.apache.ws.commons.schema.XmlSchemaMaxExclusiveFacet; import org.apache.ws.commons.schema.XmlSchemaMaxInclusiveFacet; import org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet; import org.apache.ws.commons.schema.XmlSchemaMinExclusiveFacet; import org.apache.ws.commons.schema.XmlSchemaMinInclusiveFacet; import org.apache.ws.commons.schema.XmlSchemaMinLengthFacet; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.XmlSchemaObjectTable; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaPatternFacet; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaSimpleContent; import org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension; import org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.apache.ws.commons.schema.XmlSchemaSimpleTypeContent; import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList; import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; import org.apache.ws.commons.schema.XmlSchemaSimpleTypeUnion; import org.apache.ws.commons.schema.XmlSchemaType; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; /** * Schema compiler for ADB. Based on WS-Commons schema object model. */ public class SchemaCompiler { public static final int COMPONENT_TYPE = 1; public static final int COMPONENT_ELEMENT = 2; public static final int COMPONENT_ATTRIBUTE = 3; public static final int COMPONENT_ATTRIBUTE_GROUP = 4; public static final int COMPONENT_GROUP = 5; private static final Log log = LogFactory.getLog(SchemaCompiler.class); private CompilerOptions options; private HashMap processedTypemap; // have to keep a seperate group type map since same // name can be used to group and complextype private HashMap processedGroupTypeMap; //the list of processedElements for the outer elements private HashMap processedElementMap; private HashMap processedAnonymousComplexTypesMap; //we need this map to keep the referenced elements. these elements need to be kept seperate //to avoid conflicts private HashMap processedElementRefMap; private HashMap simpleTypesMap; private HashMap changedTypeMap; private HashSet changedSimpleTypeSet; private HashSet changedComplexTypeSet; private HashSet changedElementSet; // this map is necessary to retain the metainformation of types. The reason why these // meta info 'bags' would be useful later is to cater for the extensions and restrictions // of types private HashMap processedTypeMetaInfoMap; // private ArrayList processedElementList; //a list of nillable elements - used to generate code //for nillable elements private List nillableElementList; // writee reference private BeanWriter writer = null; private Map baseSchemaTypeMap = null; //a map for keeping the already loaded schemas //the key is the targetnamespace and the value is the schema object private Map loadedSchemaMap = new HashMap(); // A map keeping the available schemas //the key is the targetnamespace and the value is the schema object //this map will be populated when multiple schemas //are fed to the schema compiler! private Map availableSchemaMap = new HashMap(); private Map loadedSourceURI = new HashMap(); // a list of externally identified QNames to be processed. This becomes // useful when only a list of external elements need to be processed public static final String ANY_ELEMENT_FIELD_NAME = "extraElement"; public static final String EXTRA_ATTRIBUTE_FIELD_NAME = "extraAttributes"; public static final String USE_OPTIONAL = "optional"; public static final String USE_REQUIRED = "required"; public static final String USE_NONE = "none"; /** * @return the processes element map * includes the Qname of the element as the key and a * String representing the fully qualified class name */ public HashMap getProcessedElementMap() { return processedElementMap; } /** * @return a map of Qname vs models. A model can be anything, * ranging from a DOM document to a stream. This is taken from the * writer and the schema compiler has no control over it */ public Map getProcessedModelMap() { return writer.getModelMap(); } /** * Constructor - Accepts a options bean * * @param options */ public SchemaCompiler(CompilerOptions options) throws SchemaCompilationException { if (options == null) { //create an empty options object this.options = new CompilerOptions(); } else { this.options = options; } //instantiate the maps processedTypemap = new HashMap(); processedGroupTypeMap = new HashMap(); processedElementMap = new HashMap(); simpleTypesMap = new HashMap(); processedElementList = new ArrayList(); processedAnonymousComplexTypesMap = new HashMap(); changedTypeMap = new HashMap(); processedTypeMetaInfoMap = new HashMap(); processedElementRefMap = new HashMap(); nillableElementList = new ArrayList(); changedComplexTypeSet = new HashSet(); changedSimpleTypeSet = new HashSet(); changedElementSet = new HashSet(); //load the writer and initiliaze the base types writer = SchemaPropertyLoader.getBeanWriterInstance(); writer.init(this.options); //load the base types baseSchemaTypeMap = SchemaPropertyLoader.getTypeMapperInstance().getTypeMap(); // adding all the soap encoding schema classes processedTypemap.putAll(SchemaPropertyLoader.getTypeMapperInstance().getSoapEncodingTypesMap()); } /** * Compile a list of schemas * This actually calls the compile (XmlSchema s) method repeatedly * * @param schemalist * @throws SchemaCompilationException * @see #compile(org.apache.ws.commons.schema.XmlSchema) */ public void compile(List schemalist) throws SchemaCompilationException { try { if (schemalist.isEmpty()) { return; } //clear the loaded and available maps loadedSchemaMap.clear(); availableSchemaMap.clear(); XmlSchema schema; // first round - populate the avaialble map for (int i = 0; i < schemalist.size(); i++) { schema = (XmlSchema) schemalist.get(i); availableSchemaMap.put( schema.getTargetNamespace(), schema); } //set a mapper package if not avaialable if (writer.getExtensionMapperPackageName() == null) { String nsp = null; //get the first schema from the list and take that namespace as the //mapper namespace for (int i = 0; nsp == null && i < schemalist.size(); i++) { nsp = ((XmlSchema) schemalist.get(i)).getTargetNamespace(); if ((nsp != null) && !nsp.equals("")){ break; } XmlSchema[] schemas = SchemaUtil.getAllSchemas((XmlSchema) schemalist.get(i)); for (int j = 0; schemas != null && j < schemas.length; j++) { nsp = schemas[j].getTargetNamespace(); if (nsp != null) break; } } if (nsp == null) { nsp = URLProcessor.DEFAULT_PACKAGE; } // if this name space exists in the ns2p list then we use it. if ((options.getNs2PackageMap() != null) && (options.getNs2PackageMap().containsKey(nsp))) { writer.registerExtensionMapperPackageName((String) options.getNs2PackageMap().get(nsp)); } else { writer.registerExtensionMapperPackageName(URLProcessor.makePackageName(nsp)); } } // second round - call the schema compiler one by one for (int i = 0; i < schemalist.size(); i++) { compile((XmlSchema) schemalist.get(i), true); } //finish up finalizeSchemaCompilation(); } catch (SchemaCompilationException e) { throw e; } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * Compile (rather codegen) a single schema element * * @param schema * @throws SchemaCompilationException */ public void compile(XmlSchema schema) throws SchemaCompilationException { compile(schema, false); } /** * Compile (rather codegen) a single schema element * * @param schema * @param isPartofGroup * @throws SchemaCompilationException */ private void compile(XmlSchema schema, boolean isPartofGroup) throws SchemaCompilationException { // some documents explicitly imports the schema of built in types. We don't actually need to compile // the built-in types. So check the target namespace here and ignore it. if (Constants.URI_2001_SCHEMA_XSD.equals(schema.getTargetNamespace())) { return; } //register the package from this namespace as the mapper classes package if (!isPartofGroup) { //set a mapper package if not avaialable if (writer.getExtensionMapperPackageName() == null) { writer.registerExtensionMapperPackageName( URLProcessor.makePackageName(schema.getTargetNamespace())); } } //First look for the schemas that are imported and process them //Note that these are processed recursively! //add the schema to the loaded schema list if (!loadedSchemaMap.containsKey(schema.getTargetNamespace())) { loadedSchemaMap.put(schema.getTargetNamespace(), schema); } // If we have/are loading a schema with a specific targetnamespace from a certain URI, // then just return back to the caller to avoid recursion. if (schema.getSourceURI() != null) { String key = schema.getTargetNamespace() + ":" + schema.getSourceURI(); if (loadedSourceURI.containsKey(key)) { return; } loadedSourceURI.put(key, key); } XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator tempIterator = includes.getIterator(); while (tempIterator.hasNext()) { Object o = tempIterator.next(); if (o instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) o).getSchema(); if (schema1 != null) compile(schema1, isPartofGroup); } if (o instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) o).getSchema(); if (schema1 != null) compile(schema1, isPartofGroup); } } } //select all the elements. We generate the code for types //only if the elements refer them!!! regardless of the fact that //we have a list of elementnames, we'll need to process all the elements XmlSchemaObjectTable elements = schema.getElements(); Iterator xmlSchemaElement1Iterator = elements.getValues(); while (xmlSchemaElement1Iterator.hasNext()) { //this is the set of outer elements so we need to generate classes //The outermost elements do not contain occurence counts (!) so we do not need //to check for arraytypes processElement((XmlSchemaElement) xmlSchemaElement1Iterator.next(), schema); } Iterator xmlSchemaElement2Iterator = elements.getValues(); // re-iterate through the elements and write them one by one // if the mode is unpack this process will not really write the // classes but will accumilate the models for a final single shot // write while (xmlSchemaElement2Iterator.hasNext()) { //this is the set of outer elements so we need to generate classes writeElement((XmlSchemaElement) xmlSchemaElement2Iterator.next()); } if (options.isGenerateAll()) { Iterator xmlSchemaTypes2Iterator = schema.getSchemaTypes().getValues(); while (xmlSchemaTypes2Iterator.hasNext()) { XmlSchemaType schemaType = (XmlSchemaType) xmlSchemaTypes2Iterator.next(); if (this.isAlreadyProcessed(schemaType.getQName())) { continue; } if (schemaType instanceof XmlSchemaComplexType) { //write classes for complex types XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType; if (complexType.getName() != null) { processNamedComplexSchemaType(complexType, schema); } } else if (schemaType instanceof XmlSchemaSimpleType) { //process simple type processSimpleSchemaType((XmlSchemaSimpleType) schemaType, null, schema, null); } } } if (!isPartofGroup) { //complete the compilation finalizeSchemaCompilation(); } } /** * Completes the schema compilation process by writing the * mappers and the classes in a batch if needed * * @throws SchemaCompilationException */ private void finalizeSchemaCompilation() throws SchemaCompilationException { //write the extension mapping class writer.writeExtensionMapper( (BeanWriterMetaInfoHolder[]) processedTypeMetaInfoMap.values().toArray( new BeanWriterMetaInfoHolder[processedTypeMetaInfoMap.size()])); if (options.isWrapClasses()) { writer.writeBatch(); } // resets the changed types XmlSchemaComplexType xmlSchemaComplexType = null; for (Iterator iter = changedComplexTypeSet.iterator();iter.hasNext();){ xmlSchemaComplexType = (XmlSchemaComplexType) iter.next(); xmlSchemaComplexType.setName(null); } XmlSchemaSimpleType xmlSchemaSimpleType = null; for (Iterator iter = changedSimpleTypeSet.iterator();iter.hasNext();){ xmlSchemaSimpleType = (XmlSchemaSimpleType) iter.next(); xmlSchemaSimpleType.setName(null); } XmlSchemaElement xmlSchemaElement = null; for (Iterator iter = changedElementSet.iterator();iter.hasNext();){ xmlSchemaElement = (XmlSchemaElement) iter.next(); xmlSchemaElement.setSchemaTypeName(null); } } /** * @return the property map of the schemacompiler. * In this case it would be the property map loaded from * the configuration file */ public Properties getCompilerProperties() { return SchemaPropertyLoader.getPropertyMap(); } /** * Writes the element * * @param xsElt * @throws SchemaCompilationException */ private void writeElement(XmlSchemaElement xsElt) throws SchemaCompilationException { if (this.processedElementMap.containsKey(xsElt.getQName())) { return; } XmlSchemaType schemaType = xsElt.getSchemaType(); BeanWriterMetaInfoHolder metainf = new BeanWriterMetaInfoHolder(); if (schemaType != null && schemaType.getName() != null) { //this is a named type QName qName = schemaType.getQName(); //find the class name String className = findClassName(qName, isArray(xsElt)); //this means the schema type actually returns a different QName if (changedTypeMap.containsKey(qName)) { metainf.registerMapping(xsElt.getQName(), (QName) changedTypeMap.get(qName), className); } else { metainf.registerMapping(xsElt.getQName(), qName, className); } // register the default value if present if (xsElt.getDefaultValue() != null){ metainf.registerDefaultValue(xsElt.getQName(),xsElt.getDefaultValue()); } if (isBinary(xsElt)) { metainf.addtStatus(xsElt.getQName(), SchemaConstants.BINARY_TYPE); } } else if (xsElt.getRefName() != null) { // Since top level elements would not have references // and we only write toplevel elements, this should // not be a problem , atleast should not occur in a legal schema } else if (xsElt.getSchemaTypeName() != null) { QName qName = xsElt.getSchemaTypeName(); String className = findClassName(qName, isArray(xsElt)); metainf.registerMapping(xsElt.getQName(), qName, className); } else if (schemaType != null) { //the named type should have been handled already //we are going to special case the anonymous complex type. Our algorithm for dealing //with it is to generate a single object that has the complex content inside. Really the //intent of the user when he declares the complexType anonymously is to use it privately //First copy the schema types content into the metainf holder metainf = (BeanWriterMetaInfoHolder) this.processedAnonymousComplexTypesMap.get(xsElt); metainf.setAnonymous(true); } else { //this means we did not find any schema type associated with the particular element. log.warn(SchemaCompilerMessages.getMessage("schema.elementWithNoType", xsElt.getQName().toString())); metainf.registerMapping(xsElt.getQName(), null, writer.getDefaultClassName(), SchemaConstants.ANY_TYPE); } if (nillableElementList.contains(xsElt.getQName())) { metainf.registerNillableQName(xsElt.getQName()); } String writtenClassName = writer.write(xsElt, processedTypemap, processedGroupTypeMap, metainf); //register the class name xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, writtenClassName); processedElementMap.put(xsElt.getQName(), writtenClassName); } /** * For inner elements * * @param xsElt * @param innerElementMap * @param parentSchema * @throws SchemaCompilationException */ private void processElement(XmlSchemaElement xsElt, Map innerElementMap, List localNillableList, XmlSchema parentSchema) throws SchemaCompilationException { processElement(xsElt, false, innerElementMap, localNillableList, parentSchema); } /** * For outer elements * * @param xsElt * @param parentSchema * @throws SchemaCompilationException */ private void processElement(XmlSchemaElement xsElt, XmlSchema parentSchema) throws SchemaCompilationException { processElement(xsElt, true, null, null, parentSchema); } /** * Process and Element * * @param xsElt * @param isOuter We need to know this since the treatment of outer elements is different that * inner elements * @throws SchemaCompilationException */ private void processElement(XmlSchemaElement xsElt, boolean isOuter, Map innerElementMap, List localNillableList, XmlSchema parentSchema) throws SchemaCompilationException { //if the element is null, which usually happens when the qname is not //proper, throw an exceptions if (xsElt == null) { throw new SchemaCompilationException( SchemaCompilerMessages.getMessage("schema.elementNull")); } //The processing element logic seems to be quite simple. Look at the relevant schema type //for each and every element and process that accordingly. //this means that any unused type definitions would not be generated! if (isOuter && processedElementList.contains(xsElt.getQName())) { return; } XmlSchemaType schemaType = xsElt.getSchemaType(); if (schemaType != null) { processSchema(xsElt, schemaType, parentSchema, false); //at this time it is not wise to directly write the class for the element //so we push the complete element to an arraylist and let the process //pass through. We'll be iterating through the elements writing them //later if (!isOuter) { if (schemaType.getName() != null) { // this element already has a name. Which means we can directly // register it String className = findClassName(schemaType.getQName(), isArray(xsElt)); innerElementMap.put(xsElt.getQName(), className); // always store the class name in the element meta Info itself // this details only needed by the unwrappig to set the complex type if (options.isUseWrapperClasses() && PrimitiveTypeFinder.isPrimitive(className) && ((xsElt.getMinOccurs() == 0) || (xsElt.isNillable()))) { className = PrimitiveTypeWrapper.getWrapper(className); } schemaType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); if (baseSchemaTypeMap.containsValue(className)) { schemaType.addMetaInfo( SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_PRIMITVE_KEY, Boolean.TRUE); } //since this is a inner element we should add it to the inner element map } else { //this is an anon type. This should have been already processed and registered at //the anon map. we've to write it just like we treat a referenced type(giving due //care that this is meant to be an attribute in some class) QName generatedTypeName = generateTypeQName(xsElt.getQName(), parentSchema); if (schemaType instanceof XmlSchemaComplexType) { //set a name schemaType.setName(generatedTypeName.getLocalPart()); changedComplexTypeSet.add(schemaType); // Must do this up front to support recursive types String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName()); processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName); BeanWriterMetaInfoHolder metaInfHolder = (BeanWriterMetaInfoHolder) processedAnonymousComplexTypesMap.get(xsElt); metaInfHolder.setOwnQname(schemaType.getQName()); metaInfHolder.setOwnClassName(fullyQualifiedClassName); writeComplexType((XmlSchemaComplexType) schemaType, metaInfHolder); //remove the reference from the anon list since we named the type processedAnonymousComplexTypesMap.remove(xsElt); String className = findClassName(schemaType.getQName(), isArray(xsElt)); innerElementMap.put( xsElt.getQName(), className); //store in the schema map to retrive in the unwrapping xsElt.addMetaInfo( SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); } else if (schemaType instanceof XmlSchemaSimpleType) { //set a name schemaType.setName(generatedTypeName.getLocalPart()); changedSimpleTypeSet.add(schemaType); // Must do this up front to support recursive types String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName()); processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName); BeanWriterMetaInfoHolder metaInfHolder = (BeanWriterMetaInfoHolder) processedAnonymousComplexTypesMap.get(xsElt); metaInfHolder.setOwnQname(schemaType.getQName()); metaInfHolder.setOwnClassName(fullyQualifiedClassName); writeSimpleType((XmlSchemaSimpleType) schemaType, metaInfHolder); //remove the reference from the anon list since we named the type processedAnonymousComplexTypesMap.remove(xsElt); String className = findClassName(schemaType.getQName(), isArray(xsElt)); innerElementMap.put( xsElt.getQName(), className); //store in the schema map xsElt.addMetaInfo( SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); } } } else { // set the binary status of this element this.processedElementList.add(xsElt.getQName()); } //referenced name } else if (xsElt.getRefName() != null) { if (xsElt.getRefName().equals(SchemaConstants.XSD_SCHEMA)) { innerElementMap.put(xsElt.getQName(), writer.getDefaultClassName()); return; } //process the referenced type. It could be thought that the referenced element replaces this //element XmlSchema resolvedSchema = getParentSchema(parentSchema,xsElt.getRefName(),COMPONENT_ELEMENT); if (resolvedSchema == null){ throw new SchemaCompilationException("can not find the element " + xsElt.getRefName() + " from the parent schema " + parentSchema.getTargetNamespace()); } XmlSchemaElement referencedElement = resolvedSchema.getElementByName(xsElt.getRefName()); if (referencedElement == null) { throw new SchemaCompilationException( SchemaCompilerMessages.getMessage("schema.referencedElementNotFound", xsElt.getRefName().toString())); } // here what we want is to set the schema type name for the element if ((referencedElement.getSchemaType() != null) && (referencedElement.getSchemaType().getQName() != null)){ // i.e this element refers to an complex type name if (!this.processedElementRefMap.containsKey(referencedElement.getQName())) { if (this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName())) { this.processedElementRefMap.put(referencedElement.getQName(), this.baseSchemaTypeMap.get(referencedElement.getSchemaTypeName())); } else { XmlSchema resolvedTypeSchema = getParentSchema(resolvedSchema, referencedElement.getSchemaTypeName(), COMPONENT_TYPE); XmlSchemaType xmlSchemaType = resolvedTypeSchema.getTypeByName( referencedElement.getSchemaTypeName().getLocalPart()); processSchema(referencedElement, xmlSchemaType, resolvedTypeSchema, true); this.processedElementRefMap.put(referencedElement.getQName(), this.processedTypemap.get(referencedElement.getSchemaTypeName())); } } String javaClassName; if (this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName())) { // here we have to do nothing since we do not generate a name } else { javaClassName = (String) this.processedTypemap.get(referencedElement.getSchemaTypeName()); referencedElement.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, javaClassName); xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, javaClassName); } } else if (referencedElement.getSchemaType() != null) { if (!this.processedElementRefMap.containsKey(referencedElement.getQName())) { processSchema(referencedElement, referencedElement.getSchemaType(), resolvedSchema, true); // if this is an anonomous complex type we have to set this this.processedElementRefMap.put(referencedElement.getQName(), this.processedTypemap.get(referencedElement.getSchemaTypeName())); } String javaClassName = (String) this.processedTypemap.get(referencedElement.getSchemaTypeName()); referencedElement.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, javaClassName); xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, javaClassName); } // schema type name is present but not the schema type object } else if (xsElt.getSchemaTypeName() != null) { //There can be instances where the SchemaType is null but the schemaTypeName is not! //this specifically happens with xsd:anyType. QName schemaTypeName = xsElt.getSchemaTypeName(); XmlSchema resolvedSchema = getParentSchema(parentSchema,schemaTypeName,COMPONENT_TYPE); XmlSchemaType typeByName = null; if (resolvedSchema != null){ typeByName = resolvedSchema.getTypeByName(schemaTypeName); } if (typeByName != null) { //this type is found in the schema so we can process it processSchema(xsElt, typeByName, resolvedSchema, false); if (!isOuter) { String className = findClassName(schemaTypeName, isArray(xsElt)); //since this is a inner element we should add it to the inner element map innerElementMap.put(xsElt.getQName(), className); // set the class name to be used in unwrapping xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); } else { this.processedElementList.add(xsElt.getQName()); } } else { //this type is not found at all. we'll just register it with whatever the class name we can comeup with if (!isOuter) { String className = findClassName(schemaTypeName, isArray(xsElt)); innerElementMap.put(xsElt.getQName(), className); // set the class name to be used in unwrapping xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); } else { this.processedElementList.add(xsElt.getQName()); } } } //add this elements QName to the nillable group if it has the nillable attribute if (xsElt.isNillable()) { if (isOuter) { this.nillableElementList.add(xsElt.getQName()); } else { localNillableList.add(xsElt.getQName()); } } } /** * Generate a unique type Qname using an element name * * @param referenceEltQName * @param parentSchema */ private QName generateTypeQName(QName referenceEltQName, XmlSchema parentSchema) { QName generatedTypeName = new QName(referenceEltQName.getNamespaceURI(), referenceEltQName.getLocalPart() + getNextTypeSuffix(referenceEltQName.getLocalPart())); while (parentSchema.getTypeByName(generatedTypeName) != null) { generatedTypeName = new QName(referenceEltQName.getNamespaceURI(), referenceEltQName.getLocalPart() + getNextTypeSuffix(referenceEltQName.getLocalPart())); } return generatedTypeName; } /** * Finds whether a given class is already made * * @param qName */ private boolean isAlreadyProcessed(QName qName) { return processedTypemap.containsKey(qName) || simpleTypesMap.containsKey(qName) || baseSchemaTypeMap.containsKey(qName) || processedGroupTypeMap.containsKey(qName); } /** * A method to pick the ref class name * * @param name * @param isArray */ private String findRefClassName(QName name, boolean isArray) { String className = null; if (processedElementRefMap.get(name) != null) { className = (String) processedElementRefMap.get(name); if (isArray) { //append the square braces that say this is an array //hope this works for all cases!!!!!!! //todo this however is a thing that needs to be //todo fixed to get complete language support className = className + "[]"; } } return className; } /** * Finds a class name from the given Qname * * @param qName * @param isArray * @return FQCN */ private String findClassName(QName qName, boolean isArray) throws SchemaCompilationException { //find the class name String className; if (processedTypemap.containsKey(qName)) { className = (String) processedTypemap.get(qName); } else if (simpleTypesMap.containsKey(qName)) { className = (String) simpleTypesMap.get(qName); } else if (baseSchemaTypeMap.containsKey(qName)) { className = (String) baseSchemaTypeMap.get(qName); } else { if (isSOAP_ENC(qName.getNamespaceURI())) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.soapencoding.error", qName.toString())); } // We seem to have failed in finding a class name for the //contained schema type. We better set the default then //however it's better if the default can be set through the //property file className = writer.getDefaultClassName(); log.warn(SchemaCompilerMessages .getMessage("schema.typeMissing", qName.toString())); } if (isArray) { //append the square braces that say this is an array //hope this works for all cases!!!!!!! //todo this however is a thing that needs to be //todo fixed to get complete language support className = className + "[]"; } return className; } /** * Returns true if SOAP_ENC Namespace. * * @param s a string representing the URI to check * @return true if s matches a SOAP ENCODING namespace URI, * false otherwise */ public static boolean isSOAP_ENC(String s) { if (s.equals(Constants.URI_SOAP11_ENC)) return true; return s.equals(Constants.URI_SOAP12_ENC); } /** * Process a schema element which has been refered to by an element * * @param schemaType * @throws SchemaCompilationException */ private void processSchema(XmlSchemaElement xsElt, XmlSchemaType schemaType, XmlSchema parentSchema, boolean isWriteAnonComplexType) throws SchemaCompilationException { if (schemaType instanceof XmlSchemaComplexType) { //write classes for complex types XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType; // complex type name may not be null if we have set it if (complexType.getName() != null && !this.changedComplexTypeSet.contains(schemaType)) { // here complex type may be in another shcema so we have to find the // correct parent schema. XmlSchema resolvedSchema = getParentSchema(parentSchema,complexType.getQName(),COMPONENT_TYPE); if (resolvedSchema == null){ throw new SchemaCompilationException("can not find the parent schema for the " + "complex type " + complexType.getQName() + " from the parent schema " + parentSchema.getTargetNamespace()); } else { processNamedComplexSchemaType(complexType, resolvedSchema); } } else { processAnonymousComplexSchemaType(xsElt, complexType, parentSchema, isWriteAnonComplexType); } } else if (schemaType instanceof XmlSchemaSimpleType) { //process simple type processSimpleSchemaType((XmlSchemaSimpleType) schemaType, xsElt, parentSchema, null); } } /** * @param complexType * @throws SchemaCompilationException */ private void processAnonymousComplexSchemaType(XmlSchemaElement elt, XmlSchemaComplexType complexType, XmlSchema parentSchema, boolean isWriteAnonComplexType) throws SchemaCompilationException { //here we have a problem when processing the circulare element // references if we differ this processing // generate a name to the complex type and register it here QName generatedTypeName = null; String javaClassName = null; if (isWriteAnonComplexType) { generatedTypeName = generateTypeQName(elt.getQName(), parentSchema); if (elt.getSchemaTypeName() == null) { elt.setSchemaTypeName(generatedTypeName); this.changedElementSet.add(elt); } //set a name complexType.setName(generatedTypeName.getLocalPart()); this.changedComplexTypeSet.add(complexType); javaClassName = writer.makeFullyQualifiedClassName(generatedTypeName); processedTypemap.put(generatedTypeName, javaClassName); this.processedElementRefMap.put(elt.getQName(), javaClassName); complexType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, javaClassName); } BeanWriterMetaInfoHolder metaInfHolder = processComplexType(elt.getQName(),complexType, parentSchema); // here the only difference is that we generate the class // irrespective of where we need it or not if (isWriteAnonComplexType) { metaInfHolder.setOwnClassName(javaClassName); metaInfHolder.setOwnQname(generatedTypeName); writeComplexType(complexType, metaInfHolder); } //since this is a special case (an unnamed complex type) we'll put the already processed //metainf holder in a special map to be used later this.processedAnonymousComplexTypesMap.put(elt, metaInfHolder); } /** * handle the complex types which are named * * @param complexType */ private void processNamedComplexSchemaType(XmlSchemaComplexType complexType, XmlSchema parentSchema) throws SchemaCompilationException { if (processedTypemap.containsKey(complexType.getQName()) || baseSchemaTypeMap.containsKey(complexType.getQName())) { return; } // Must do this up front to support recursive types String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(complexType.getQName()); processedTypemap.put(complexType.getQName(), fullyQualifiedClassName); //register that in the schema metainfo bag complexType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, fullyQualifiedClassName); BeanWriterMetaInfoHolder metaInfHolder = processComplexType(complexType.getQName(),complexType, parentSchema); //add this information to the metainfo holder metaInfHolder.setOwnQname(complexType.getQName()); metaInfHolder.setOwnClassName(fullyQualifiedClassName); //write the class. This type mapping would have been populated right now //Note - We always write classes for named complex types writeComplexType(complexType, metaInfHolder); } /** * Writes a complex type * * @param complexType * @param metaInfHolder * @throws SchemaCompilationException */ private String writeComplexType(XmlSchemaComplexType complexType, BeanWriterMetaInfoHolder metaInfHolder) throws SchemaCompilationException { String javaClassName = writer.write(complexType.getQName(), processedTypemap, processedGroupTypeMap, metaInfHolder, complexType.isAbstract()); processedTypeMetaInfoMap.put(complexType.getQName(), metaInfHolder); return javaClassName; } /** * Writes complex Sequence,Choice, all elements * @param qname complex type qname * @param metaInfHolder * @return written java class name * @throws SchemaCompilationException */ private String writeComplexParticle(QName qname,BeanWriterMetaInfoHolder metaInfHolder) throws SchemaCompilationException { String javaClassName = writer.write(qname, processedTypemap, processedGroupTypeMap, metaInfHolder,false); processedTypeMetaInfoMap.put(qname, metaInfHolder); return javaClassName; } /** * Writes a complex type * * @param simpleType * @param metaInfHolder * @throws SchemaCompilationException */ private void writeSimpleType(XmlSchemaSimpleType simpleType, BeanWriterMetaInfoHolder metaInfHolder) throws SchemaCompilationException { writer.write(simpleType, processedTypemap, processedGroupTypeMap, metaInfHolder); processedTypeMetaInfoMap.put(simpleType.getQName(), metaInfHolder); } private BeanWriterMetaInfoHolder processComplexType( QName parentElementQName, XmlSchemaComplexType complexType, XmlSchema parentSchema) throws SchemaCompilationException { XmlSchemaParticle particle = complexType.getParticle(); BeanWriterMetaInfoHolder metaInfHolder = new BeanWriterMetaInfoHolder(); if (particle != null) { //Process the particle processParticle(parentElementQName, particle, metaInfHolder, parentSchema); } //process attributes - first look for the explicit attributes processAttributes(complexType.getAttributes(),metaInfHolder,parentSchema); //process any attribute //somehow the xml schema parser does not seem to pickup the any attribute!! XmlSchemaAnyAttribute anyAtt = complexType.getAnyAttribute(); if (anyAtt != null) { processAnyAttribute(metaInfHolder, anyAtt); } //process content ,either complex or simple if (complexType.getContentModel() != null) { processContentModel(complexType.getContentModel(), metaInfHolder, parentSchema); } return metaInfHolder; } private void processAttributes(XmlSchemaObjectCollection attributes, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { Iterator attribIterator = attributes.getIterator(); while (attribIterator.hasNext()) { Object o = attribIterator.next(); if (o instanceof XmlSchemaAttribute) { processAttribute((XmlSchemaAttribute) o, metaInfHolder, parentSchema); } else if (o instanceof XmlSchemaAttributeGroupRef){ processAttributeGroupReference((XmlSchemaAttributeGroupRef)o,metaInfHolder,parentSchema); } } } private void processAttributeGroupReference(XmlSchemaAttributeGroupRef attributeGroupRef, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { QName attributeGroupRefName = attributeGroupRef.getRefName(); if (attributeGroupRefName != null){ XmlSchema resolvedSchema = getParentSchema(parentSchema,attributeGroupRefName,COMPONENT_ATTRIBUTE_GROUP); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the attribute group reference name " + attributeGroupRefName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaAttributeGroup xmlSchemaAttributeGroup = (XmlSchemaAttributeGroup) resolvedSchema.getAttributeGroups().getItem(attributeGroupRefName); if (xmlSchemaAttributeGroup != null) { processAttributes(xmlSchemaAttributeGroup.getAttributes(), metaInfHolder, resolvedSchema); } else { throw new SchemaCompilationException("Can not find an attribute group for group reference " + attributeGroupRefName.getLocalPart()); } } } else { throw new SchemaCompilationException("No group refernce has given"); } } /** * Process the content models. A content model is either simple type or a complex type * and included inside a complex content */ private void processContentModel(XmlSchemaContentModel content, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { if (content instanceof XmlSchemaComplexContent) { processComplexContent((XmlSchemaComplexContent) content, metaInfHolder, parentSchema); } else if (content instanceof XmlSchemaSimpleContent) { processSimpleContent((XmlSchemaSimpleContent) content, metaInfHolder, parentSchema); } } /** * Prcess the complex content */ private void processComplexContent(XmlSchemaComplexContent complexContent, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { XmlSchemaContent content = complexContent.getContent(); if (content instanceof XmlSchemaComplexContentExtension) { // to handle extension we need to attach the extended items to the base type // and create a new type XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension)content; //process the base type if it has not been processed yet if (!isAlreadyProcessed(extension.getBaseTypeName())) { //pick the relevant basetype from the schema and process it XmlSchema resolvedSchema = getParentSchema(parentSchema, extension.getBaseTypeName(), COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the compley type " + extension.getBaseTypeName() + " from the parent type " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(extension.getBaseTypeName()); if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getName() != null) { processNamedComplexSchemaType(complexType, resolvedSchema); } else { //this is not possible. The extension should always //have a name throw new SchemaCompilationException("Unnamed complex type used in extension");//Internationlize this } } else if (type instanceof XmlSchemaSimpleType) { //process simple type processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null); } } } // before actually processing this node, we need to recurse through the base types and add their // children (sometimes even preserving the order) to the metainfo holder of this type // the reason is that for extensions, the prefered way is to have the sequences of the base class //* before * the sequence of the child element. copyMetaInfoHierarchy(metaInfHolder, extension.getBaseTypeName(), parentSchema); //process the particle of this node if (extension.getParticle() != null) { processParticle(extension.getBaseTypeName(),extension.getParticle(), metaInfHolder, parentSchema); } // process attributes //process attributes - first look for the explicit attributes processAttributes(extension.getAttributes(),metaInfHolder,parentSchema); //process any attribute //somehow the xml schema parser does not seem to pickup the any attribute!! XmlSchemaAnyAttribute anyAtt = extension.getAnyAttribute(); if (anyAtt != null) { processAnyAttribute(metaInfHolder, anyAtt); } String className = findClassName(extension.getBaseTypeName(), false); if (!writer.getDefaultClassName().equals(className)) { //the particle has been processed, However since this is an extension we need to //add the basetype as an extension to the complex type class. // The basetype has been processed already metaInfHolder.setExtension(true); metaInfHolder.setExtensionClassName(className); //Note - this is no array! so the array boolean is false } } else if (content instanceof XmlSchemaComplexContentRestriction) { XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content; //process the base type if it has not been processed yet if (!isAlreadyProcessed(restriction.getBaseTypeName())) { //pick the relevant basetype from the schema and process it XmlSchema resolvedSchema = getParentSchema(parentSchema, restriction.getBaseTypeName(), COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the complex type " + restriction.getBaseTypeName() + " from the parent type " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(restriction.getBaseTypeName()); if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getName() != null) { processNamedComplexSchemaType(complexType, resolvedSchema); } else { //this is not possible. The restriction should always //have a name throw new SchemaCompilationException("Unnamed complex type used in restriction");//Internationlize this } } else if (type instanceof XmlSchemaSimpleType) { throw new SchemaCompilationException("Not a valid restriction, complex content restriction base type cannot be a simple type."); } } } copyMetaInfoHierarchy(metaInfHolder, restriction.getBaseTypeName(), parentSchema); //process the particle of this node processParticle(restriction.getBaseTypeName(),restriction.getParticle(), metaInfHolder, parentSchema); //process attributes - first look for the explicit attributes processAttributes(restriction.getAttributes(),metaInfHolder,parentSchema); //process any attribute //somehow the xml schema parser does not seem to pickup the any attribute!! XmlSchemaAnyAttribute anyAtt = restriction.getAnyAttribute(); if (anyAtt != null) { processAnyAttribute(metaInfHolder, anyAtt); } String className = findClassName(restriction.getBaseTypeName(), false); if (!writer.getDefaultClassName().equals(className)) { metaInfHolder.setRestriction(true); metaInfHolder.setRestrictionClassName(findClassName(restriction.getBaseTypeName(), false)); //Note - this is no array! so the array boolean is false } } } /** * Recursive method to populate the metainfo holders with info from the base types * * @param metaInfHolder * @param baseTypeName * @param parentSchema */ private void copyMetaInfoHierarchy(BeanWriterMetaInfoHolder metaInfHolder, QName baseTypeName, XmlSchema parentSchema) throws SchemaCompilationException { XmlSchema resolvedSchema = getParentSchema(parentSchema,baseTypeName,COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find type " + baseTypeName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(baseTypeName); BeanWriterMetaInfoHolder baseMetaInfoHolder = (BeanWriterMetaInfoHolder) processedTypeMetaInfoMap.get(baseTypeName); if (baseMetaInfoHolder != null) { // see whether this type is also extended from some other type first // if so proceed to set their parents as well. if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getContentModel() != null) { XmlSchemaContentModel content = complexType.getContentModel(); if (content instanceof XmlSchemaComplexContent) { XmlSchemaComplexContent complexContent = (XmlSchemaComplexContent) content; if (complexContent.getContent() instanceof XmlSchemaComplexContentExtension) { XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) complexContent.getContent(); //recursively call the copyMetaInfoHierarchy method copyMetaInfoHierarchy(baseMetaInfoHolder, extension.getBaseTypeName(), resolvedSchema); } else if (complexContent.getContent() instanceof XmlSchemaComplexContentRestriction) { XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) complexContent.getContent(); //recursively call the copyMetaInfoHierarchy method copyMetaInfoHierarchy(baseMetaInfoHolder, restriction.getBaseTypeName(), resolvedSchema); } else { throw new SchemaCompilationException( SchemaCompilerMessages.getMessage("schema.unknowncontenterror")); } } else if (content instanceof XmlSchemaSimpleContent) { throw new SchemaCompilationException( SchemaCompilerMessages.getMessage("schema.unsupportedcontenterror", "Simple Content")); } else { throw new SchemaCompilationException( SchemaCompilerMessages.getMessage("schema.unknowncontenterror")); } } //Do the actual parent setting metaInfHolder.setAsParent(baseMetaInfoHolder); } else if (type instanceof XmlSchemaSimpleType) { // we have to copy the uion data if the parent simple type restriction // is an union // this union attribute is copied from the child to parent to genrate the parent // code as union if (baseMetaInfoHolder.isUnion()) { metaInfHolder.setUnion(true); Map memberTypes = baseMetaInfoHolder.getMemberTypes(); Object qname; for (Iterator iter = memberTypes.keySet().iterator(); iter.hasNext();) { qname = iter.next(); metaInfHolder.addMemberType((QName) qname, (String) memberTypes.get(qname)); } } // we have to copy the list type data to parent if it is a list if (baseMetaInfoHolder.isList()) { metaInfHolder.setList(true); metaInfHolder.setItemTypeQName(baseMetaInfoHolder.getItemTypeQName()); metaInfHolder.setItemTypeClassName(baseMetaInfoHolder.getItemTypeClassName()); } metaInfHolder.setAsParent(baseMetaInfoHolder); } } } } /** * @param simpleContent * @param metaInfHolder * @throws SchemaCompilationException */ private void processSimpleContent(XmlSchemaSimpleContent simpleContent, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { XmlSchemaContent content; content = simpleContent.getContent(); if (content instanceof XmlSchemaSimpleContentExtension) { XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content; //process the base type if it has not been processed yet if (!isAlreadyProcessed(extension.getBaseTypeName())) { //pick the relevant basetype from the schema and process it XmlSchema resolvedSchema = getParentSchema(parentSchema, extension.getBaseTypeName(), COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find type " + extension.getBaseTypeName() + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(extension.getBaseTypeName()); if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getName() != null) { processNamedComplexSchemaType(complexType, resolvedSchema); } else { //this is not possible. The extension should always //have a name throw new SchemaCompilationException("Unnamed complex type used in extension");//Internationlize this } } else if (type instanceof XmlSchemaSimpleType) { //process simple type processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null); } } } //process extension base type processSimpleExtensionBaseType(extension.getBaseTypeName(), metaInfHolder, parentSchema); //process attributes XmlSchemaObjectCollection attribs = extension.getAttributes(); Iterator attribIterator = attribs.getIterator(); while (attribIterator.hasNext()) { Object attr = attribIterator.next(); if (attr instanceof XmlSchemaAttribute) { processAttribute((XmlSchemaAttribute) attr, metaInfHolder, parentSchema); } } //process any attribute XmlSchemaAnyAttribute anyAtt = extension.getAnyAttribute(); if (anyAtt != null) { processAnyAttribute(metaInfHolder, anyAtt); } } else if (content instanceof XmlSchemaSimpleContentRestriction) { XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content; //process the base type if it has not been processed yet if (!isAlreadyProcessed(restriction.getBaseTypeName())) { //pick the relevant basetype from the schema and process it XmlSchema resolvedSchema = getParentSchema(parentSchema, restriction.getBaseTypeName(), COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find type " + restriction.getBaseTypeName() + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(restriction.getBaseTypeName()); if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getName() != null) { processNamedComplexSchemaType(complexType, resolvedSchema); } else { //this is not possible. The extension should always //have a name throw new SchemaCompilationException("Unnamed complex type used in restriction");//Internationlize this } } else if (type instanceof XmlSchemaSimpleType) { //process simple type processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null); } } } //process restriction base type processSimpleRestrictionBaseType(restriction.getBaseTypeName(), restriction.getBaseTypeName(), metaInfHolder, parentSchema); metaInfHolder.setSimple(true); } } /** * Process Simple Extension Base Type. * * @param extBaseType * @param metaInfHolder */ public void processSimpleExtensionBaseType(QName extBaseType, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { //find the class name String className = findClassName(extBaseType, false); // if the base type is an primitive then we do not have to extend them // and it is considered as a property // on the otherhand if the base type is an generated class then we have to // extend from it if (baseSchemaTypeMap.containsKey(extBaseType)) { //this means the schema type actually returns a different QName if (changedTypeMap.containsKey(extBaseType)) { metaInfHolder.registerMapping(extBaseType, (QName) changedTypeMap.get(extBaseType), className, SchemaConstants.ELEMENT_TYPE); } else { metaInfHolder.registerMapping(extBaseType, extBaseType, className, SchemaConstants.ELEMENT_TYPE); } metaInfHolder.setSimple(true); // we have already process when it comes to this place } else if (processedTypemap.containsKey(extBaseType)) { //set the extension base class name XmlSchema resolvedSchema = getParentSchema(parentSchema,extBaseType,COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the type " + extBaseType + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(extBaseType); if (type instanceof XmlSchemaSimpleType) { metaInfHolder.setSimple(true); metaInfHolder.setExtension(true); metaInfHolder.setExtensionClassName(className); copyMetaInfoHierarchy(metaInfHolder, extBaseType, resolvedSchema); } else if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; if (complexType.getContentModel() == null) { // do not set as a simple type since we want to // print the element names metaInfHolder.setExtension(true); metaInfHolder.setExtensionClassName(className); copyMetaInfoHierarchy(metaInfHolder, extBaseType, resolvedSchema); } } } } else { metaInfHolder.setSimple(true); } //get the binary state and add that to the status map if (isBinary(extBaseType)) { metaInfHolder.addtStatus(extBaseType, SchemaConstants.BINARY_TYPE); } } /** * Process Simple Restriction Base Type. * * @param resBaseType * @param metaInfHolder */ public void processSimpleRestrictionBaseType(QName qName, QName resBaseType, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) throws SchemaCompilationException { //find the class name String className = findClassName(resBaseType, false); //this means the schema type actually returns a different QName if (baseSchemaTypeMap.containsKey(resBaseType)) { if (changedTypeMap.containsKey(resBaseType)) { metaInfHolder.registerMapping(qName, (QName) changedTypeMap.get(resBaseType), className, SchemaConstants.ELEMENT_TYPE); } else { metaInfHolder.registerMapping(qName, resBaseType, className, SchemaConstants.ELEMENT_TYPE); } } else if (processedTypemap.containsKey(resBaseType)) { //this is not a standared type // so the parent class must extend it metaInfHolder.setSimple(true); metaInfHolder.setRestriction(true); metaInfHolder.setRestrictionClassName(className); copyMetaInfoHierarchy(metaInfHolder, resBaseType, parentSchema); } metaInfHolder.setRestrictionBaseType(resBaseType); } /** * Process Facets. * * @param metaInfHolder */ private void processFacets(XmlSchemaSimpleTypeRestriction restriction, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema) { XmlSchemaObjectCollection facets = restriction.getFacets(); Iterator facetIterator = facets.getIterator(); while (facetIterator.hasNext()) { Object obj = facetIterator.next(); if (obj instanceof XmlSchemaPatternFacet) { XmlSchemaPatternFacet pattern = (XmlSchemaPatternFacet) obj; // some patterns contain \ so we have to replace them String patternString = pattern.getValue().toString(); // replace backword slashes patternString = patternString.replaceAll("\\\\", "\\\\\\\\"); if ((metaInfHolder.getPatternFacet() != null) && (metaInfHolder.getPatternFacet().trim().length() > 0)){ // i.e there is a pattern faceset patternString = metaInfHolder.getPatternFacet().trim() + "|" + patternString; } metaInfHolder.setPatternFacet(patternString); } else if (obj instanceof XmlSchemaEnumerationFacet) { XmlSchemaEnumerationFacet enumeration = (XmlSchemaEnumerationFacet) obj; if (restriction.getBaseTypeName().equals(SchemaConstants.XSD_QNAME)) { // we have to process the qname here and shoud find the local part and namespace uri String value = enumeration.getValue().toString(); String prefix = value.substring(0, value.indexOf(":")); String localPart = value.substring(value.indexOf(":") + 1); String namespaceUri = parentSchema.getNamespaceContext().getNamespaceURI(prefix); // set the string to suite for the convertQname method String qNameString = value + "\", \"" + namespaceUri; metaInfHolder.addEnumFacet(qNameString); } else { metaInfHolder.addEnumFacet(enumeration.getValue().toString()); } } else if (obj instanceof XmlSchemaLengthFacet) { XmlSchemaLengthFacet length = (XmlSchemaLengthFacet) obj; metaInfHolder.setLengthFacet(Integer.parseInt(length.getValue().toString())); } else if (obj instanceof XmlSchemaMaxExclusiveFacet) { XmlSchemaMaxExclusiveFacet maxEx = (XmlSchemaMaxExclusiveFacet) obj; metaInfHolder.setMaxExclusiveFacet(maxEx.getValue().toString()); } else if (obj instanceof XmlSchemaMinExclusiveFacet) { XmlSchemaMinExclusiveFacet minEx = (XmlSchemaMinExclusiveFacet) obj; metaInfHolder.setMinExclusiveFacet(minEx.getValue().toString()); } else if (obj instanceof XmlSchemaMaxInclusiveFacet) { XmlSchemaMaxInclusiveFacet maxIn = (XmlSchemaMaxInclusiveFacet) obj; metaInfHolder.setMaxInclusiveFacet(maxIn.getValue().toString()); } else if (obj instanceof XmlSchemaMinInclusiveFacet) { XmlSchemaMinInclusiveFacet minIn = (XmlSchemaMinInclusiveFacet) obj; metaInfHolder.setMinInclusiveFacet(minIn.getValue().toString()); } else if (obj instanceof XmlSchemaMaxLengthFacet) { XmlSchemaMaxLengthFacet maxLen = (XmlSchemaMaxLengthFacet) obj; metaInfHolder.setMaxLengthFacet(Integer.parseInt(maxLen.getValue().toString())); } else if (obj instanceof XmlSchemaMinLengthFacet) { XmlSchemaMinLengthFacet minLen = (XmlSchemaMinLengthFacet) obj; metaInfHolder.setMinLengthFacet(Integer.parseInt(minLen.getValue().toString())); } } } /** * Handle any attribute * * @param metainf */ private void processAnyAttribute(BeanWriterMetaInfoHolder metainf, XmlSchemaAnyAttribute anyAtt) { //The best thing we can do here is to add a set of OMAttributes //since attributes do not have the notion of minoccurs/maxoccurs the //safest option here is to have an OMAttribute array QName qName = new QName(EXTRA_ATTRIBUTE_FIELD_NAME); metainf.registerMapping(qName, null, writer.getDefaultAttribArrayClassName(),//always generate an array of //OMAttributes SchemaConstants.ANY_TYPE); metainf.addtStatus(qName, SchemaConstants.ATTRIBUTE_TYPE); metainf.addtStatus(qName, SchemaConstants.ARRAY_TYPE); } /** * Process the attribute * * @param att * @param metainf */ public void processAttribute(XmlSchemaAttribute att, BeanWriterMetaInfoHolder metainf, XmlSchema parentSchema) throws SchemaCompilationException { QName schemaTypeName = att.getSchemaTypeName(); if (schemaTypeName != null) { if (att.getQName() != null) { if (baseSchemaTypeMap.containsKey(schemaTypeName)) { metainf.registerMapping(att.getQName(), schemaTypeName, baseSchemaTypeMap.get(schemaTypeName).toString(), SchemaConstants.ATTRIBUTE_TYPE); // add optional attribute status if set String use = att.getUse().getValue(); if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) { metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE); } String className = findClassName(schemaTypeName, false); att.addMetaInfo( SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); // set the default value if (att.getDefaultValue() != null){ metainf.registerDefaultValue(att.getQName(),att.getDefaultValue()); } // after } else { XmlSchema resolvedSchema = getParentSchema(parentSchema,schemaTypeName,COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the type " + schemaTypeName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(schemaTypeName); if (type instanceof XmlSchemaSimpleType) { XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) type; if (simpleType != null) { if (!isAlreadyProcessed(schemaTypeName)) { //process simple type processSimpleSchemaType(simpleType, null, resolvedSchema, null); } metainf.registerMapping(att.getQName(), schemaTypeName, processedTypemap.get(schemaTypeName).toString(), SchemaConstants.ATTRIBUTE_TYPE); // add optional attribute status if set String use = att.getUse().getValue(); if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) { metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE); } } } } } } else { // this attribute has a type but does not have a name, seems to be invalid } } else if (att.getRefName() != null) { XmlSchema resolvedSchema = getParentSchema(parentSchema,att.getRefName(),COMPONENT_ATTRIBUTE); if (resolvedSchema == null){ throw new SchemaCompilationException("can not find the attribute " + att.getRefName() + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute) resolvedSchema.getAttributes().getItem(att.getRefName()); if (xmlSchemaAttribute != null) { // call recursively to process the schema processAttribute(xmlSchemaAttribute, metainf, resolvedSchema); } else { throw new SchemaCompilationException("Attribute QName reference refer to an invalid attribute " + att.getRefName()); } } } else { // this attribute refers to a custom type, probably one of the extended simple types. // with the inline schema definition QName attributeQName = att.getQName(); if (attributeQName != null) { XmlSchemaSimpleType attributeSimpleType = att.getSchemaType(); XmlSchema resolvedSchema = parentSchema; if (attributeSimpleType == null) { // try to get the schema for using qname QName attributeSchemaQname = att.getSchemaTypeName(); if (attributeSchemaQname != null) { resolvedSchema = getParentSchema(parentSchema,attributeSchemaQname,COMPONENT_TYPE); if (resolvedSchema == null){ throw new SchemaCompilationException("can not find the type " + attributeSchemaQname + " from the parent schema " + parentSchema.getTargetNamespace()); } else { attributeSimpleType = (XmlSchemaSimpleType) resolvedSchema.getTypeByName(attributeSchemaQname); } } } if (attributeSimpleType != null) { QName schemaTypeQName = att.getSchemaTypeName(); if (schemaTypeQName == null) { // set the parent schema target name space since attribute Qname uri is "" if (attributeSimpleType.getQName() != null) { schemaTypeQName = attributeSimpleType.getQName(); } else { schemaTypeQName = new QName(parentSchema.getTargetNamespace(), attributeQName.getLocalPart() + getNextTypeSuffix(attributeQName.getLocalPart())); } } if (!isAlreadyProcessed(schemaTypeQName)){ // we have to process only if it has not processed processSimpleSchemaType(attributeSimpleType, null, resolvedSchema, schemaTypeQName); } metainf.registerMapping(att.getQName(), schemaTypeQName, processedTypemap.get(schemaTypeQName).toString(), SchemaConstants.ATTRIBUTE_TYPE); // add optional attribute status if set String use = att.getUse().getValue(); if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) { metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE); } } else { // TODO: handle the case when no attribute type specifed log.warn("No attribute type has defined to the Attribute " + attributeQName); } } else { throw new SchemaCompilationException("Attribute QName reference refer to an invalid attribute " + attributeQName); } } } /** * Process a particle- A particle may be a sequence,all or a choice * @param parentElementQName - this can either be parent element QName or parent Complex type qname * @param particle - particle being processed * @param metainfHolder - * @param parentSchema * @throws SchemaCompilationException */ private void processParticle(QName parentElementQName, XmlSchemaParticle particle, BeanWriterMetaInfoHolder metainfHolder , XmlSchema parentSchema) throws SchemaCompilationException { if (particle instanceof XmlSchemaSequence) { XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; XmlSchemaObjectCollection items = xmlSchemaSequence.getItems(); if ((xmlSchemaSequence.getMaxOccurs() > 1) && (parentElementQName != null)) { // we have to process many sequence types BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); process(parentElementQName, items, beanWriterMetaInfoHolder, true, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); QName sequenceQName = new QName(parentElementQName.getNamespaceURI(), parentElementQName.getLocalPart() + "Sequence"); String javaClassName = writeComplexParticle(sequenceQName,beanWriterMetaInfoHolder); processedTypemap.put(sequenceQName, javaClassName); // add this as an array to the original class metainfHolder.registerMapping(sequenceQName, sequenceQName, findClassName(sequenceQName,true), SchemaConstants.ARRAY_TYPE); metainfHolder.setOrdered(true); metainfHolder.registerQNameIndex(sequenceQName,metainfHolder.getOrderStartPoint() + 1); metainfHolder.setHasParticleType(true); metainfHolder.addtStatus(sequenceQName,SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(sequenceQName,xmlSchemaSequence.getMaxOccurs()); metainfHolder.addMinOccurs(sequenceQName,xmlSchemaSequence.getMinOccurs()); } else { if (options.isBackwordCompatibilityMode()) { process(parentElementQName,items, metainfHolder, false, parentSchema); } else { process(parentElementQName,items, metainfHolder, true, parentSchema); } } } else if (particle instanceof XmlSchemaAll) { XmlSchemaObjectCollection items = ((XmlSchemaAll) particle).getItems(); process(parentElementQName,items, metainfHolder, false, parentSchema); } else if (particle instanceof XmlSchemaChoice) { XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) particle; XmlSchemaObjectCollection items = ((XmlSchemaChoice) particle).getItems(); if ((xmlSchemaChoice.getMaxOccurs() > 1)) { // we have to process many sequence types BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); beanWriterMetaInfoHolder.setChoice(true); process(parentElementQName,items, beanWriterMetaInfoHolder, false, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); QName choiceQName = new QName(parentElementQName.getNamespaceURI(), parentElementQName.getLocalPart() + "Choice"); String javaClassName = writeComplexParticle(choiceQName,beanWriterMetaInfoHolder); processedTypemap.put(choiceQName, javaClassName); // add this as an array to the original class metainfHolder.registerMapping(choiceQName, choiceQName, findClassName(choiceQName,true), SchemaConstants.ARRAY_TYPE); metainfHolder.setOrdered(true); metainfHolder.setHasParticleType(true); metainfHolder.registerQNameIndex(choiceQName,metainfHolder.getOrderStartPoint() + 1); metainfHolder.addtStatus(choiceQName,SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(choiceQName,xmlSchemaChoice.getMaxOccurs()); metainfHolder.addMinOccurs(choiceQName,xmlSchemaChoice.getMinOccurs()); } else { metainfHolder.setChoice(true); process(parentElementQName,items, metainfHolder, false, parentSchema); } } else if (particle instanceof XmlSchemaGroupRef){ XmlSchemaGroupRef xmlSchemaGroupRef = (XmlSchemaGroupRef) particle; QName groupQName = xmlSchemaGroupRef.getRefName(); if (groupQName != null) { if (!processedGroupTypeMap.containsKey(groupQName)) { // processe the schema here XmlSchema resolvedParentSchema = getParentSchema(parentSchema,groupQName,COMPONENT_GROUP); if (resolvedParentSchema == null){ throw new SchemaCompilationException("can not find the group " + groupQName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaGroup xmlSchemaGroup = (XmlSchemaGroup) resolvedParentSchema.getGroups().getItem(groupQName); processGroup(xmlSchemaGroup, groupQName, resolvedParentSchema); } } } else { throw new SchemaCompilationException("Referenced name is null"); } boolean isArray = xmlSchemaGroupRef.getMaxOccurs() > 1; // add this as an array to the original class String groupClassName = (String) processedGroupTypeMap.get(groupQName); if (isArray){ groupClassName = groupClassName + "[]"; } metainfHolder.registerMapping(groupQName, groupQName, groupClassName); if (isArray) { metainfHolder.addtStatus(groupQName, SchemaConstants.ARRAY_TYPE); } metainfHolder.addtStatus(groupQName, SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(groupQName, xmlSchemaGroupRef.getMaxOccurs()); metainfHolder.addMinOccurs(groupQName, xmlSchemaGroupRef.getMinOccurs()); metainfHolder.setHasParticleType(true); metainfHolder.setOrdered(true); metainfHolder.registerQNameIndex(groupQName,metainfHolder.getOrderStartPoint() + 1); } } /** * * @param parentElementQName - this could either be the complex type parentElementQName or element parentElementQName * @param items * @param metainfHolder * @param order * @param parentSchema * @throws SchemaCompilationException */ private void process(QName parentElementQName, XmlSchemaObjectCollection items, BeanWriterMetaInfoHolder metainfHolder, boolean order, XmlSchema parentSchema) throws SchemaCompilationException { int count = items.getCount(); Map processedElementArrayStatusMap = new LinkedHashMap(); Map processedElementTypeMap = new LinkedHashMap(); List localNillableList = new ArrayList(); Map particleQNameMap = new HashMap(); // this list is used to keep the details of the // elements within a choice withing sequence List innerChoiceElementList = new ArrayList(); Map elementOrderMap = new HashMap(); int sequenceCounter = 0; for (int i = 0; i < count; i++) { XmlSchemaObject item = items.getItem(i); if (item instanceof XmlSchemaElement) { //recursively process the element XmlSchemaElement xsElt = (XmlSchemaElement) item; boolean isArray = isArray(xsElt); processElement(xsElt, processedElementTypeMap, localNillableList, parentSchema); //we know for sure this is not an outer type processedElementArrayStatusMap.put(xsElt, (isArray) ? Boolean.TRUE : Boolean.FALSE); if (order) { //we need to keep the order of the elements. So push the elements to another //hashmap with the order number elementOrderMap.put(xsElt, new Integer(sequenceCounter)); } //handle xsd:any ! We place an OMElement (or an array of OMElements) in the generated class } else if (item instanceof XmlSchemaAny) { XmlSchemaAny any = (XmlSchemaAny) item; processedElementTypeMap.put(new QName(ANY_ELEMENT_FIELD_NAME), any); //any can also be inside a sequence if (order) { elementOrderMap.put(any, new Integer(sequenceCounter)); } //we do not register the array status for the any type processedElementArrayStatusMap.put(any, isArray(any) ? Boolean.TRUE : Boolean.FALSE); } else if (item instanceof XmlSchemaSequence) { // we have to process many sequence types XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) item; if (xmlSchemaSequence.getItems().getCount() > 0) { BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); process(parentElementQName, xmlSchemaSequence.getItems(), beanWriterMetaInfoHolder, true, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); String localName = parentElementQName.getLocalPart() + "Sequence"; QName sequenceQName = new QName(parentElementQName.getNamespaceURI(), localName + getNextTypeSuffix(localName)); String javaClassName = writeComplexParticle(sequenceQName, beanWriterMetaInfoHolder); processedTypemap.put(sequenceQName, javaClassName); //put the partical to array Boolean isArray = xmlSchemaSequence.getMaxOccurs() > 1 ? Boolean.TRUE : Boolean.FALSE; processedElementArrayStatusMap.put(item, isArray); particleQNameMap.put(item, sequenceQName); if (order) { elementOrderMap.put(item, new Integer(sequenceCounter)); } } } else if (item instanceof XmlSchemaChoice) { // we have to process many sequence types XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) item; if (xmlSchemaChoice.getItems().getCount() > 0) { BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); beanWriterMetaInfoHolder.setChoice(true); process(parentElementQName, xmlSchemaChoice.getItems(), beanWriterMetaInfoHolder, false, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); String localName = parentElementQName.getLocalPart() + "Choice"; QName choiceQName = new QName(parentElementQName.getNamespaceURI(), localName + getNextTypeSuffix(localName)); String javaClassName = writeComplexParticle(choiceQName, beanWriterMetaInfoHolder); processedTypemap.put(choiceQName, javaClassName); //put the partical to array Boolean isArray = xmlSchemaChoice.getMaxOccurs() > 1 ? Boolean.TRUE : Boolean.FALSE; processedElementArrayStatusMap.put(item, isArray); particleQNameMap.put(item, choiceQName); if (order) { elementOrderMap.put(item, new Integer(sequenceCounter)); } } } else if (item instanceof XmlSchemaGroupRef) { XmlSchemaGroupRef xmlSchemaGroupRef = (XmlSchemaGroupRef) item; QName groupQName = xmlSchemaGroupRef.getRefName(); if (groupQName != null){ if (!processedGroupTypeMap.containsKey(groupQName)){ // processe the schema here XmlSchema resolvedParentSchema = getParentSchema(parentSchema,groupQName,COMPONENT_GROUP); if (resolvedParentSchema == null){ throw new SchemaCompilationException("Can not find the group with the qname" + groupQName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaGroup xmlSchemaGroup = (XmlSchemaGroup) resolvedParentSchema.getGroups().getItem(groupQName); if (xmlSchemaGroup != null){ processGroup(xmlSchemaGroup, groupQName, resolvedParentSchema); } } } Boolean isArray = xmlSchemaGroupRef.getMaxOccurs() > 1 ? Boolean.TRUE : Boolean.FALSE; processedElementArrayStatusMap.put(item,isArray); particleQNameMap.put(item,groupQName); if (order){ elementOrderMap.put(item, new Integer(sequenceCounter)); } } else { throw new SchemaCompilationException("Referenced name is null"); } } else { //there may be other types to be handled here. Add them //when we are ready } sequenceCounter++; } // loop through the processed items and add them to the matainf object Iterator processedElementsIterator = processedElementArrayStatusMap.keySet().iterator(); int startingItemNumberOrder = metainfHolder.getOrderStartPoint(); while (processedElementsIterator.hasNext()) { Object child = processedElementsIterator.next(); // process the XmlSchemaElement if (child instanceof XmlSchemaElement) { XmlSchemaElement elt = (XmlSchemaElement) child; QName referencedQName = null; if (elt.getQName() != null) { referencedQName = elt.getQName(); QName schemaTypeQName = elt.getSchemaType() != null ? elt.getSchemaType().getQName() : elt.getSchemaTypeName(); if (schemaTypeQName != null) { String clazzName = (String) processedElementTypeMap.get(elt.getQName()); metainfHolder.registerMapping(referencedQName, schemaTypeQName, clazzName, ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue() ? SchemaConstants.ARRAY_TYPE : SchemaConstants.ELEMENT_TYPE); if (innerChoiceElementList.contains(referencedQName)){ metainfHolder.addtStatus(referencedQName,SchemaConstants.INNER_CHOICE_ELEMENT); } // register the default value as well if (elt.getDefaultValue() != null){ metainfHolder.registerDefaultValue(referencedQName,elt.getDefaultValue()); } } } if (elt.getRefName() != null) { //probably this is referenced referencedQName = elt.getRefName(); boolean arrayStatus = ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue(); String clazzName = findRefClassName(referencedQName, arrayStatus); if (clazzName == null) { clazzName = findClassName(referencedQName, arrayStatus); } XmlSchema resolvedParentSchema = getParentSchema(parentSchema,referencedQName,COMPONENT_ELEMENT); if (resolvedParentSchema == null) { throw new SchemaCompilationException("Can not find the element " + referencedQName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaElement refElement = resolvedParentSchema.getElementByName(referencedQName); // register the mapping if we found the referenced element // else throw an exception if (refElement != null) { metainfHolder.registerMapping(referencedQName, refElement.getSchemaTypeName() , clazzName, arrayStatus ? SchemaConstants.ARRAY_TYPE : SchemaConstants.ELEMENT_TYPE); } else { if (referencedQName.equals(SchemaConstants.XSD_SCHEMA)) { metainfHolder.registerMapping(referencedQName, null, writer.getDefaultClassName(), SchemaConstants.ANY_TYPE); } else { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.referencedElementNotFound", referencedQName.toString())); } } } } if (referencedQName == null) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.emptyName")); } //register the occurence counts metainfHolder.addMaxOccurs(referencedQName, elt.getMaxOccurs()); // if the strict validation off then we consider all elements have minOccurs zero on it if (this.options.isOffStrictValidation()){ metainfHolder.addMinOccurs(referencedQName, 0); } else { metainfHolder.addMinOccurs(referencedQName, elt.getMinOccurs()); } //we need the order to be preserved. So record the order also if (order) { //record the order in the metainf holder Integer integer = (Integer) elementOrderMap.get(elt); metainfHolder.registerQNameIndex(referencedQName, startingItemNumberOrder + integer.intValue()); } //get the nillable state and register that on the metainf holder if (localNillableList.contains(elt.getQName())) { metainfHolder.registerNillableQName(elt.getQName()); } //get the binary state and add that to the status map if (isBinary(elt)) { metainfHolder.addtStatus(elt.getQName(), SchemaConstants.BINARY_TYPE); } // process the XMLSchemaAny } else if (child instanceof XmlSchemaAny) { XmlSchemaAny any = (XmlSchemaAny) child; //since there is only one element here it does not matter //for the constant. However the problem occurs if the users //uses the same name for an element decalration QName anyElementFieldName = new QName(ANY_ELEMENT_FIELD_NAME); //this can be an array or a single element boolean isArray = ((Boolean) processedElementArrayStatusMap.get(any)).booleanValue(); metainfHolder.registerMapping(anyElementFieldName, null, isArray ? writer.getDefaultClassArrayName() : writer.getDefaultClassName(), SchemaConstants.ANY_TYPE); //if it's an array register an extra status flag with the system if (isArray) { metainfHolder.addtStatus(anyElementFieldName, SchemaConstants.ARRAY_TYPE); } metainfHolder.addMaxOccurs(anyElementFieldName, any.getMaxOccurs()); metainfHolder.addMinOccurs(anyElementFieldName, any.getMinOccurs()); if (order) { //record the order in the metainf holder for the any Integer integer = (Integer) elementOrderMap.get(any); metainfHolder.registerQNameIndex(anyElementFieldName, startingItemNumberOrder + integer.intValue()); } } else if (child instanceof XmlSchemaSequence) { XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) child; QName sequenceQName = (QName) particleQNameMap.get(child); boolean isArray = xmlSchemaSequence.getMaxOccurs() > 1; // add this as an array to the original class metainfHolder.registerMapping(sequenceQName, sequenceQName, findClassName(sequenceQName, isArray)); if (isArray) { metainfHolder.addtStatus(sequenceQName, SchemaConstants.ARRAY_TYPE); } metainfHolder.addtStatus(sequenceQName, SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(sequenceQName, xmlSchemaSequence.getMaxOccurs()); metainfHolder.addMinOccurs(sequenceQName, xmlSchemaSequence.getMinOccurs()); metainfHolder.setHasParticleType(true); if (order) { //record the order in the metainf holder for the any Integer integer = (Integer) elementOrderMap.get(child); metainfHolder.registerQNameIndex(sequenceQName, startingItemNumberOrder + integer.intValue()); } } else if (child instanceof XmlSchemaChoice) { XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) child; QName choiceQName = (QName) particleQNameMap.get(child); boolean isArray = xmlSchemaChoice.getMaxOccurs() > 1; // add this as an array to the original class metainfHolder.registerMapping(choiceQName, choiceQName, findClassName(choiceQName, isArray)); if (isArray) { metainfHolder.addtStatus(choiceQName, SchemaConstants.ARRAY_TYPE); } metainfHolder.addtStatus(choiceQName, SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(choiceQName, xmlSchemaChoice.getMaxOccurs()); metainfHolder.addMinOccurs(choiceQName, xmlSchemaChoice.getMinOccurs()); metainfHolder.setHasParticleType(true); if (order) { //record the order in the metainf holder for the any Integer integer = (Integer) elementOrderMap.get(child); metainfHolder.registerQNameIndex(choiceQName, startingItemNumberOrder + integer.intValue()); } } else if (child instanceof XmlSchemaGroupRef) { XmlSchemaGroupRef xmlSchemaGroupRef = (XmlSchemaGroupRef) child; QName groupQName = (QName) particleQNameMap.get(child); boolean isArray = xmlSchemaGroupRef.getMaxOccurs() > 1; // add this as an array to the original class String groupClassName = (String) processedGroupTypeMap.get(groupQName); if (isArray){ groupClassName = groupClassName + "[]"; } metainfHolder.registerMapping(groupQName, groupQName, groupClassName); if (isArray) { metainfHolder.addtStatus(groupQName, SchemaConstants.ARRAY_TYPE); } metainfHolder.addtStatus(groupQName, SchemaConstants.PARTICLE_TYPE_ELEMENT); metainfHolder.addMaxOccurs(groupQName, xmlSchemaGroupRef.getMaxOccurs()); metainfHolder.addMinOccurs(groupQName, xmlSchemaGroupRef.getMinOccurs()); metainfHolder.setHasParticleType(true); if (order) { //record the order in the metainf holder for the any Integer integer = (Integer) elementOrderMap.get(child); metainfHolder.registerQNameIndex(groupQName, startingItemNumberOrder + integer.intValue()); } } } //set the ordered flag in the metainf holder metainfHolder.setOrdered(order); } /** * * @param xmlSchemaGroup * @param schemaGroupQName- we have to pass this since xml schema does not provide * this properly * @param parentSchema * @throws SchemaCompilationException */ private void processGroup(XmlSchemaGroup xmlSchemaGroup, QName schemaGroupQName, XmlSchema parentSchema) throws SchemaCompilationException { // find the group base item XmlSchemaGroupBase xmlSchemaGroupBase = xmlSchemaGroup.getParticle(); if (xmlSchemaGroupBase != null){ if (xmlSchemaGroupBase instanceof XmlSchemaSequence){ XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaGroupBase; if (xmlSchemaSequence.getItems().getCount() > 0) { BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); process(schemaGroupQName, xmlSchemaSequence.getItems(), beanWriterMetaInfoHolder, true, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); String javaClassName = writeComplexParticle(schemaGroupQName, beanWriterMetaInfoHolder); processedGroupTypeMap.put(schemaGroupQName, javaClassName); // processedTypemap.put(schemaGroupQName, javaClassName); } } else if (xmlSchemaGroupBase instanceof XmlSchemaChoice){ XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) xmlSchemaGroupBase; if (xmlSchemaChoice.getItems().getCount() > 0) { BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder(); beanWriterMetaInfoHolder.setChoice(true); process(schemaGroupQName, xmlSchemaChoice.getItems(), beanWriterMetaInfoHolder, false, parentSchema); beanWriterMetaInfoHolder.setParticleClass(true); String javaClassName = writeComplexParticle(schemaGroupQName, beanWriterMetaInfoHolder); processedGroupTypeMap.put(schemaGroupQName, javaClassName); // processedTypemap.put(schemaGroupQName, javaClassName); } } } } /** * Checks whether a given element is a binary element * * @param elt */ private boolean isBinary(XmlSchemaElement elt) { return elt.getSchemaType() != null && SchemaConstants.XSD_BASE64.equals(elt.getSchemaType().getQName()); } /** * Checks whether a given qname is a binary * * @param qName */ private boolean isBinary(QName qName) { return qName != null && SchemaConstants.XSD_BASE64.equals(qName); } /** * @param simpleType * @param xsElt * @param parentSchema * @param qname - fake Qname to use if the xsElt is null. * @throws SchemaCompilationException */ private void processSimpleSchemaType(XmlSchemaSimpleType simpleType, XmlSchemaElement xsElt, XmlSchema parentSchema, QName qname) throws SchemaCompilationException { String fullyQualifiedClassName = null; if (simpleType.getQName() != null) { if (processedTypemap.containsKey(simpleType.getQName()) || baseSchemaTypeMap.containsKey(simpleType.getQName())) { return; } // Must do this up front to support recursive types fullyQualifiedClassName = writer.makeFullyQualifiedClassName(simpleType.getQName()); // we put the qname to processed type map it is only named type // otherwise we have to any way process that element. processedTypemap.put(simpleType.getQName(), fullyQualifiedClassName); } else { QName fakeQname; if (xsElt != null) { fakeQname = new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart() + getNextTypeSuffix(xsElt.getQName().getLocalPart())); // we have to set this otherwise the ours attribute would not set properly if refered to this simple // type from any other element xsElt.setSchemaTypeName(fakeQname); changedElementSet.add(xsElt); } else { fakeQname = qname; } if (processedTypemap.containsKey(fakeQname) || baseSchemaTypeMap.containsKey(fakeQname)) { return; } fullyQualifiedClassName = writer.makeFullyQualifiedClassName(fakeQname); simpleType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME, fakeQname); // should put this to the processedTypemap to generate the code correctly processedTypemap.put(fakeQname, fullyQualifiedClassName); } //register that in the schema metainfo bag simpleType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, fullyQualifiedClassName); BeanWriterMetaInfoHolder metaInfHolder = processSimpleType(simpleType, parentSchema); metaInfHolder.setSimple(true); if (simpleType.getQName() == null) { this.processedAnonymousComplexTypesMap.put(xsElt, metaInfHolder); QName fakeQname; if (xsElt != null) { fakeQname = new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart()); } else { fakeQname = qname; simpleType.setName(fakeQname.getLocalPart()); changedSimpleTypeSet.add(simpleType); simpleType.setSourceURI(fakeQname.getNamespaceURI()); } simpleTypesMap.put(fakeQname, fullyQualifiedClassName); } //add this information to the metainfo holder metaInfHolder.setOwnQname(simpleType.getQName()); if (fullyQualifiedClassName != null) { metaInfHolder.setOwnClassName(fullyQualifiedClassName); } //write the class. This type mapping would have been populated right now //Note - We always write classes for named complex types writeSimpleType(simpleType, metaInfHolder); } private BeanWriterMetaInfoHolder processSimpleType(XmlSchemaSimpleType simpleType, XmlSchema parentSchema) throws SchemaCompilationException { BeanWriterMetaInfoHolder metaInfHolder = new BeanWriterMetaInfoHolder(); // handle the restriction XmlSchemaSimpleTypeContent content = simpleType.getContent(); QName parentSimpleTypeQname = simpleType.getQName(); if (parentSimpleTypeQname == null) { parentSimpleTypeQname = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME); } if (content != null) { if (content instanceof XmlSchemaSimpleTypeRestriction) { XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content; QName baseTypeName = restriction.getBaseTypeName(); //check whether the base type is one of the base schema types if (baseSchemaTypeMap.containsKey(baseTypeName)) { //process restriction base type processSimpleRestrictionBaseType(parentSimpleTypeQname, restriction.getBaseTypeName(), metaInfHolder, parentSchema); //process facets if (!SchemaConstants.XSD_BOOLEAN.equals(baseTypeName)){ processFacets(restriction, metaInfHolder, parentSchema); } } else { //recurse // this must be a xmlschema bug // it should return the schematype for restriction.getBaseType(): XmlSchema resolvedSchema = getParentSchema(parentSchema, baseTypeName, COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the type " + baseTypeName + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType restrictionBaseType = resolvedSchema.getTypeByName(baseTypeName); if (restrictionBaseType instanceof XmlSchemaSimpleType) { if ((restrictionBaseType != null) && (!isAlreadyProcessed(baseTypeName))) { processSimpleSchemaType((XmlSchemaSimpleType) restrictionBaseType, null, resolvedSchema, null); } // process restriction processSimpleRestrictionBaseType(parentSimpleTypeQname, restriction.getBaseTypeName(), metaInfHolder, resolvedSchema); } } } } else if (content instanceof XmlSchemaSimpleTypeUnion) { XmlSchemaSimpleTypeUnion simpleTypeUnion = (XmlSchemaSimpleTypeUnion) content; QName[] qnames = simpleTypeUnion.getMemberTypesQNames(); if (qnames != null) { QName qname; for (int i = 0; i < qnames.length; i++) { qname = qnames[i]; if (baseSchemaTypeMap.containsKey(qname)) { metaInfHolder.addMemberType(qname, (String) baseSchemaTypeMap.get(qname)); } else { XmlSchema resolvedSchema = getParentSchema(parentSchema, qname, COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the type " + qname + " from the parent schema " + parentSchema.getTargetNamespace()); } else { XmlSchemaType type = resolvedSchema.getTypeByName(qname); if (type instanceof XmlSchemaSimpleType) { XmlSchemaSimpleType memberSimpleType = (XmlSchemaSimpleType) type; if (!isAlreadyProcessed(qname)) { processSimpleSchemaType(memberSimpleType, null, resolvedSchema, null); } metaInfHolder.addMemberType(qname, (String) processedTypemap.get(qname)); } else { throw new SchemaCompilationException("Unions can not have complex types as a member type"); } } } } } else { XmlSchemaObjectCollection xmlSchemaObjectCollection = simpleTypeUnion.getBaseTypes(); XmlSchemaObject xmlSchemaObject; QName childQname; int i = 1; for (Iterator iter = xmlSchemaObjectCollection.getIterator(); iter.hasNext();) { xmlSchemaObject = (XmlSchemaObject) iter.next(); i++; if (xmlSchemaObject instanceof XmlSchemaSimpleType) { XmlSchemaSimpleType unionSimpleType = (XmlSchemaSimpleType) xmlSchemaObject; childQname = unionSimpleType.getQName(); if (childQname == null) { // we create a fake Qname for all these simple types since most propably they don't have one childQname = new QName(parentSimpleTypeQname.getNamespaceURI(), parentSimpleTypeQname.getLocalPart() + getNextTypeSuffix(parentSimpleTypeQname.getLocalPart())); } // this is an inner simple type of the union so it shold not have // processed processSimpleSchemaType(unionSimpleType, null, parentSchema, childQname); metaInfHolder.addMemberType(childQname, (String) processedTypemap.get(childQname)); } } } metaInfHolder.setUnion(true); } else if (content instanceof XmlSchemaSimpleTypeList) { XmlSchemaSimpleTypeList simpleTypeList = (XmlSchemaSimpleTypeList) content; QName itemTypeQName = simpleTypeList.getItemTypeName(); if (itemTypeQName != null) { if (!isAlreadyProcessed(itemTypeQName)) { XmlSchema resolvedSchema = getParentSchema(parentSchema, itemTypeQName, COMPONENT_TYPE); if (resolvedSchema == null) { throw new SchemaCompilationException("can not find the type " + itemTypeQName + " from the parent type " + parentSchema.getTargetNamespace()); } else { XmlSchemaType simpleSchemaType = resolvedSchema.getTypeByName(itemTypeQName); if (simpleSchemaType instanceof XmlSchemaSimpleType) { processSimpleSchemaType((XmlSchemaSimpleType) simpleSchemaType, null, resolvedSchema, null); } } } } else { XmlSchemaSimpleType listSimpleType = simpleTypeList.getItemType(); itemTypeQName = listSimpleType.getQName(); if (itemTypeQName == null) { // we create a fake Qname for all these simple types since most propably they don't have one itemTypeQName = new QName(parentSimpleTypeQname.getNamespaceURI(), parentSimpleTypeQname.getLocalPart() + "_type0"); } processSimpleSchemaType(listSimpleType, null, parentSchema, itemTypeQName); } String className = findClassName(itemTypeQName, false); metaInfHolder.setList(true); metaInfHolder.setItemTypeQName(itemTypeQName); metaInfHolder.setItemTypeClassName(className); } } return metaInfHolder; } /** * Find whether a given particle is an array. The logic for deciding * whether a given particle is an array is depending on their minOccurs * and maxOccurs counts. If Maxoccurs is greater than one (1) then the * content is an array. * Also no higher level element will have the maxOccurs greater than one * * @param particle * @throws SchemaCompilationException */ private boolean isArray(XmlSchemaParticle particle) throws SchemaCompilationException { long minOccurs = particle.getMinOccurs(); long maxOccurs = particle.getMaxOccurs(); if (maxOccurs < minOccurs) { throw new SchemaCompilationException(); } else { return (maxOccurs > 1); } } HashMap mapTypeCount = new HashMap(); private String getNextTypeSuffix(String localName) { Integer typeCounter = (Integer) mapTypeCount.get(localName); int count = 0; if (typeCounter != null) { if(typeCounter.intValue() == Integer.MAX_VALUE) { count = 0; } else { count = typeCounter.intValue(); } } mapTypeCount.put(localName, new Integer(count+1)); return ("_type" + count); } /** * returns the parent schema of the componet having QName compoentTypeQName. * withe the componet type. * @param parentSchema - parent schema of the given componet * @param componentQName - qname of the componet, of which we want to get the parent schema * @param componetType - type of the componet. this can either be type,element,attribute or attribute group * @return parent schema. */ private XmlSchema getParentSchema(XmlSchema parentSchema, QName componentQName, int componetType) throws SchemaCompilationException { // if the componet do not have a propernamesapce or // it is equals to the xsd schema namesapce // we do not have to do any thing. if ((componentQName == null) || (componentQName.getNamespaceURI() == null) || Constants.URI_2001_SCHEMA_XSD.equals(componentQName.getNamespaceURI())){ return parentSchema; } List visitedSchemas = new ArrayList(); visitedSchemas.add(parentSchema); XmlSchema newParentSchema = getParentSchemaFromIncludes(parentSchema, componentQName,componetType,visitedSchemas); if (newParentSchema == null){ String targetNamespace = componentQName.getNamespaceURI(); if (loadedSchemaMap.containsKey(targetNamespace)){ XmlSchema tempSchema = (XmlSchema) loadedSchemaMap.get(targetNamespace); if (isComponetExists(tempSchema,componentQName,componetType)){ newParentSchema = tempSchema; } } else if (availableSchemaMap.containsKey(targetNamespace)){ XmlSchema tempSchema = (XmlSchema) availableSchemaMap.get(targetNamespace); if (isComponetExists(tempSchema,componentQName,componetType)){ compile(tempSchema); newParentSchema = tempSchema; } } } return newParentSchema; } private XmlSchema getParentSchemaFromIncludes(XmlSchema parentSchema, QName componentQName, int componetType, List visitedSchemas) throws SchemaCompilationException { XmlSchema newParentSchema = null; if (isComponetExists(parentSchema, componentQName, componetType)) { newParentSchema = parentSchema; } else { // this componet must either be in a import or and include XmlSchemaObjectCollection includes = parentSchema.getIncludes(); if (includes != null) { Object externalComponet = null; XmlSchema externalSchema = null; for (Iterator iter = includes.getIterator(); iter.hasNext();) { externalComponet = iter.next(); if (externalComponet instanceof XmlSchemaExternal) { externalSchema = ((XmlSchemaExternal) externalComponet).getSchema(); // if this is an inline import without a schema location // xmlschema does not load the schema. // so we try to figure out it either from the available schemas // or from the laded schemas. if ((externalSchema == null) && externalComponet instanceof XmlSchemaImport){ XmlSchemaImport xmlSchemaImport = (XmlSchemaImport) externalComponet; String importNamespce = xmlSchemaImport.getNamespace(); if ((importNamespce != null) && !importNamespce.equals(Constants.URI_2001_SCHEMA_XSD)) { if (loadedSchemaMap.containsKey(importNamespce)) { externalSchema = (XmlSchema) loadedSchemaMap.get(importNamespce); } else if (availableSchemaMap.containsKey(importNamespce)) { XmlSchema tempSchema = (XmlSchema) availableSchemaMap.get(importNamespce); compile(tempSchema); externalSchema = tempSchema; } } } if (externalSchema != null) { // find the componet in the new external schema. if (!visitedSchemas.contains(externalSchema)){ visitedSchemas.add(externalSchema); newParentSchema = getParentSchemaFromIncludes(externalSchema, componentQName, componetType, visitedSchemas); } } if (newParentSchema != null) { // i.e we have found the schema break; } } } } } return newParentSchema; } private boolean isComponetExists(XmlSchema schema, QName componentQName, int componetType) { boolean isExists = false; if (!schema.getTargetNamespace().equals(componentQName.getNamespaceURI())){ return false; } switch (componetType) { case COMPONENT_TYPE : { isExists = (schema.getTypeByName(componentQName.getLocalPart()) != null); break; } case COMPONENT_ELEMENT : { isExists = (schema.getElementByName(componentQName.getLocalPart()) != null); break; } case COMPONENT_ATTRIBUTE : { isExists = (schema.getAttributes().getItem(componentQName) != null); break; } case COMPONENT_ATTRIBUTE_GROUP : { isExists = (schema.getAttributeGroups().getItem(componentQName) != null); break; } case COMPONENT_GROUP : { isExists = (schema.getGroups().getItem(componentQName) != null); break; } } return isExists; } } ./src/org/apache/axis2/schema/typemap/0000775000175000017500000000000011767656530016751 5ustar brianbrian./src/org/apache/axis2/schema/typemap/CTypeMap.java0000664000175000017500000002666611767656530021316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.typemap; import org.apache.axis2.schema.SchemaConstants; import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; /** * The C type map. uses a static map for caching */ public class CTypeMap implements TypeMap{ private static Map typeMap = new HashMap(); // Type map for the standard schema types public Map getTypeMap(){ return typeMap; } static { // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives. CTypeMap.addTypemapping(SchemaConstants.XSD_STRING, "axis2_char_t*"); // The XSD Primitives are mapped to axis2/c primitives. CTypeMap.addTypemapping(SchemaConstants.XSD_BOOLEAN, "axis2_bool_t"); CTypeMap.addTypemapping(SchemaConstants.XSD_DOUBLE, "double"); CTypeMap.addTypemapping(SchemaConstants.XSD_FLOAT, "float"); CTypeMap.addTypemapping(SchemaConstants.XSD_INT, "int"); CTypeMap.addTypemapping(SchemaConstants.XSD_INTEGER, "int"); CTypeMap.addTypemapping(SchemaConstants.XSD_LONG, "int64_t"); CTypeMap.addTypemapping(SchemaConstants.XSD_SHORT, "short"); CTypeMap.addTypemapping(SchemaConstants.XSD_BYTE, "axis2_byte_t"); CTypeMap.addTypemapping(SchemaConstants.XSD_ANY, "axiom_node_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_DECIMAL, "double"); CTypeMap.addTypemapping(SchemaConstants.XSD_ANYTYPE, "axiom_node_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_QNAME, "axutil_qname_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_DATE, "axutil_date_time_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_TIME, "axutil_date_time_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_DATETIME, "axutil_date_time_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_BASE64, "axutil_base64_binary_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_HEXBIN, "axiom_node_t*"); // These are the g* types (gYearMonth, etc) which map to Axis types // These types are mapped to an integer CTypeMap.addTypemapping(SchemaConstants.XSD_YEARMONTH, "axutil_date_time_t*"); CTypeMap.addTypemapping(SchemaConstants.XSD_YEAR, "int"); CTypeMap.addTypemapping(SchemaConstants.XSD_MONTH, "int"); CTypeMap.addTypemapping(SchemaConstants.XSD_DAY, "int"); CTypeMap.addTypemapping(SchemaConstants.XSD_MONTHDAY, "axutil_date_time_t*"); // xsd:token CTypeMap.addTypemapping(SchemaConstants.XSD_TOKEN, "axis2_char_t*"); // a xsd:normalizedString CTypeMap.addTypemapping(SchemaConstants.XSD_NORMALIZEDSTRING, "axis2_char_t*"); // a xsd:unsignedLong CTypeMap.addTypemapping(SchemaConstants.XSD_UNSIGNEDLONG, "uint64_t"); // a xsd:unsignedInt CTypeMap.addTypemapping(SchemaConstants.XSD_UNSIGNEDINT, "unsigned int"); // a xsd:unsignedShort CTypeMap.addTypemapping(SchemaConstants.XSD_UNSIGNEDSHORT, "unsigned short"); // a xsd:unsignedByte CTypeMap.addTypemapping(SchemaConstants.XSD_UNSIGNEDBYTE, "axis2_byte_t"); // a xsd:nonNegativeInteger CTypeMap.addTypemapping(SchemaConstants.XSD_NONNEGATIVEINTEGER, "unsigned int"); // a xsd:negativeInteger CTypeMap.addTypemapping(SchemaConstants.XSD_NEGATIVEINTEGER, "int"); // a xsd:positiveInteger CTypeMap.addTypemapping(SchemaConstants.XSD_POSITIVEINTEGER, "unsigned int"); // a xsd:nonPositiveInteger CTypeMap.addTypemapping(SchemaConstants.XSD_NONPOSITIVEINTEGER, "unsigned int"); // a xsd:Name CTypeMap.addTypemapping(SchemaConstants.XSD_NAME, "axis2_char_t*"); // a xsd:NCName CTypeMap.addTypemapping(SchemaConstants.XSD_NCNAME, "axis2_char_t*"); // a xsd:ID CTypeMap.addTypemapping(SchemaConstants.XSD_ID, "axis2_char_t*"); // a xsd:language CTypeMap.addTypemapping(SchemaConstants.XSD_LANGUAGE, "axis2_char_t*"); // a xsd:NmToken CTypeMap.addTypemapping(SchemaConstants.XSD_NMTOKEN, "axis2_char_t*"); // a xsd:NmTokens CTypeMap.addTypemapping(SchemaConstants.XSD_NMTOKENS, "axis2_char_t*"); // a xsd:NOTATION CTypeMap.addTypemapping(SchemaConstants.XSD_NOTATION, "axiom_node_t*"); // a xsd:XSD_ENTITY CTypeMap.addTypemapping(SchemaConstants.XSD_ENTITY, "axis2_char_t*"); // a xsd:XSD_ENTITIES CTypeMap.addTypemapping(SchemaConstants.XSD_ENTITIES, "axis2_char_t*"); // a xsd:XSD_IDREF CTypeMap.addTypemapping(SchemaConstants.XSD_IDREF, "axis2_char_t*"); // a xsd:XSD_XSD_IDREFS CTypeMap.addTypemapping(SchemaConstants.XSD_IDREFS, "axis2_char_t*"); // a xsd:Duration CTypeMap.addTypemapping(SchemaConstants.XSD_DURATION, "axutil_duration_t*"); // a xsd:anyURI CTypeMap.addTypemapping(SchemaConstants.XSD_ANYURI, "axutil_uri_t*"); } private static void addTypemapping(QName name, String str) { CTypeMap.typeMap.put(name, str); } // Type map for the soap encoding types public Map getSoapEncodingTypesMap() { return soapEncodingTypeMap; } private static Map soapEncodingTypeMap = new HashMap(); static { // populate the soapEncodingTypeMap addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ARRAY, "axutil_array_list_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_STRUCT, "axiom_node_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BASE64, "axutil_base64_binary_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DURATION, "axutil_duration_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DATETIME, "axutil_date_time_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NOTATION, "axiom_node_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_TIME, "axutil_date_time_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DATE, "axutil_date_time_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GYEARMONTH, "axutil_date_time_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GYEAR, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GMONTHDAY, "axutil_date_time_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GDAY, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GMONTH, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BOOLEAN, "axis2_bool_t"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BASE64BINARY, "axutil_base64_binary_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_HEXBINARY, "axiom_node_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_FLOAT, "float"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DOUBLE, "double"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ANYURI, "axutil_uri_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_QNAME, "axutil_qname_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_STRING, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NORMALIZEDSTRING, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_TOKEN, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_LANGUAGE, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NAME, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NMTOKEN, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NCNAME, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ID, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_IDREF, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ENTITY, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_IDREFS, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ENTITIES, "axis2_char_t*"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DECIMAL, "double"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_INTEGER, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NONPOSITIVEINTEGER, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NEGATIVEINTEGER, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_LONG, "int64_t"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_INT, "int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_SHORT, "short"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BYTE, "axis2_byte_t"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NONNEGATIVEINTEGER, "unsigned int"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDLONG, "uint64_t"); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDINT, "unsigned int"); } private static void addSoapEncodingTypeMapping(QName name, String className) { soapEncodingTypeMap.put(name, className); } } ./src/org/apache/axis2/schema/typemap/JavaTypeMap.java0000664000175000017500000004027511767656530022005 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.typemap; import org.apache.axiom.om.OMElement; import org.apache.axis2.databinding.types.Day; import org.apache.axis2.databinding.types.Duration; import org.apache.axis2.databinding.types.Entities; import org.apache.axis2.databinding.types.Entity; import org.apache.axis2.databinding.types.HexBinary; import org.apache.axis2.databinding.types.IDRef; import org.apache.axis2.databinding.types.IDRefs; import org.apache.axis2.databinding.types.Id; import org.apache.axis2.databinding.types.Language; import org.apache.axis2.databinding.types.Month; import org.apache.axis2.databinding.types.MonthDay; import org.apache.axis2.databinding.types.NCName; import org.apache.axis2.databinding.types.NMToken; import org.apache.axis2.databinding.types.NMTokens; import org.apache.axis2.databinding.types.Name; import org.apache.axis2.databinding.types.NegativeInteger; import org.apache.axis2.databinding.types.NonNegativeInteger; import org.apache.axis2.databinding.types.NonPositiveInteger; import org.apache.axis2.databinding.types.NormalizedString; import org.apache.axis2.databinding.types.Notation; import org.apache.axis2.databinding.types.PositiveInteger; import org.apache.axis2.databinding.types.Time; import org.apache.axis2.databinding.types.Token; import org.apache.axis2.databinding.types.URI; import org.apache.axis2.databinding.types.UnsignedByte; import org.apache.axis2.databinding.types.UnsignedInt; import org.apache.axis2.databinding.types.UnsignedLong; import org.apache.axis2.databinding.types.UnsignedShort; import org.apache.axis2.databinding.types.Year; import org.apache.axis2.databinding.types.YearMonth; import org.apache.axis2.schema.SchemaConstants; import javax.xml.namespace.QName; import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; /** * The java type map. uses a static map for caching * Most code from Axis 1 Codebase */ public class JavaTypeMap implements TypeMap { public Map getTypeMap() { return typeMap; } private static Map typeMap = new HashMap(); static { // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives. addTypemapping(SchemaConstants.XSD_STRING, java.lang.String.class.getName()); // The XSD Primitives are mapped to java primitives. addTypemapping(SchemaConstants.XSD_BOOLEAN, boolean.class.getName()); addTypemapping(SchemaConstants.XSD_DOUBLE, double.class.getName()); addTypemapping(SchemaConstants.XSD_FLOAT, float.class.getName()); addTypemapping(SchemaConstants.XSD_INT, int.class.getName()); addTypemapping(SchemaConstants.XSD_INTEGER, java.math.BigInteger.class.getName()); addTypemapping(SchemaConstants.XSD_LONG, long.class.getName()); addTypemapping(SchemaConstants.XSD_SHORT, short.class.getName()); addTypemapping(SchemaConstants.XSD_BYTE, byte.class.getName()); addTypemapping(SchemaConstants.XSD_ANY, OMElement.class.getName()); addTypemapping(SchemaConstants.XSD_DECIMAL, BigDecimal.class.getName()); //anytype is mapped to the OMElement instead of the java.lang.Object addTypemapping(SchemaConstants.XSD_ANYTYPE, Object.class.getName()); //Qname maps to jax rpc QName class addTypemapping(SchemaConstants.XSD_QNAME, javax.xml.namespace.QName.class.getName()); //xsd Date is mapped to the java.util.date! addTypemapping(SchemaConstants.XSD_DATE, java.util.Date.class.getName()); // Mapping for xsd:time. Map to Axis type Time addTypemapping(SchemaConstants.XSD_TIME, Time.class.getName()); addTypemapping(SchemaConstants.XSD_DATETIME, java.util.Calendar.class.getName()); //as for the base 64 encoded binary stuff we map it to a javax. // activation.Datahandler object addTypemapping(SchemaConstants.XSD_BASE64, javax.activation.DataHandler.class.getName()); addTypemapping(SchemaConstants.XSD_HEXBIN, HexBinary.class.getName()); // These are the g* types (gYearMonth, etc) which map to Axis types addTypemapping(SchemaConstants.XSD_YEARMONTH, YearMonth.class.getName()); addTypemapping(SchemaConstants.XSD_YEAR, Year.class.getName()); addTypemapping(SchemaConstants.XSD_MONTH, Month.class.getName()); addTypemapping(SchemaConstants.XSD_DAY, Day.class.getName()); addTypemapping(SchemaConstants.XSD_MONTHDAY, MonthDay.class.getName()); // xsd:token addTypemapping(SchemaConstants.XSD_TOKEN, Token.class.getName()); // a xsd:normalizedString addTypemapping(SchemaConstants.XSD_NORMALIZEDSTRING, NormalizedString.class.getName()); // a xsd:unsignedLong addTypemapping(SchemaConstants.XSD_UNSIGNEDLONG, UnsignedLong.class.getName()); // a xsd:unsignedInt addTypemapping(SchemaConstants.XSD_UNSIGNEDINT, UnsignedInt.class.getName()); // a xsd:unsignedShort addTypemapping(SchemaConstants.XSD_UNSIGNEDSHORT, UnsignedShort.class.getName()); // a xsd:unsignedByte addTypemapping(SchemaConstants.XSD_UNSIGNEDBYTE, UnsignedByte.class.getName()); // a xsd:nonNegativeInteger addTypemapping(SchemaConstants.XSD_NONNEGATIVEINTEGER, NonNegativeInteger.class.getName()); // a xsd:negativeInteger addTypemapping(SchemaConstants.XSD_NEGATIVEINTEGER, NegativeInteger.class.getName()); // a xsd:positiveInteger addTypemapping(SchemaConstants.XSD_POSITIVEINTEGER, PositiveInteger.class.getName()); // a xsd:nonPositiveInteger addTypemapping(SchemaConstants.XSD_NONPOSITIVEINTEGER, NonPositiveInteger.class.getName()); // a xsd:Name addTypemapping(SchemaConstants.XSD_NAME, Name.class.getName()); // a xsd:NCName addTypemapping(SchemaConstants.XSD_NCNAME, NCName.class.getName()); // a xsd:ID addTypemapping(SchemaConstants.XSD_ID, Id.class.getName()); // a xml:lang // addTypemapping(SchemaConstants.XML_LANG,Language.class.getName()); // a xsd:language addTypemapping(SchemaConstants.XSD_LANGUAGE, Language.class.getName()); // a xsd:NmToken addTypemapping(SchemaConstants.XSD_NMTOKEN, NMToken.class.getName()); // a xsd:NmTokens addTypemapping(SchemaConstants.XSD_NMTOKENS, NMTokens.class.getName()); // a xsd:NOTATION addTypemapping(SchemaConstants.XSD_NOTATION, Notation.class.getName()); // a xsd:XSD_ENTITY addTypemapping(SchemaConstants.XSD_ENTITY, Entity.class.getName()); // a xsd:XSD_ENTITIES addTypemapping(SchemaConstants.XSD_ENTITIES, Entities.class.getName()); // a xsd:XSD_IDREF addTypemapping(SchemaConstants.XSD_IDREF, IDRef.class.getName()); // a xsd:XSD_XSD_IDREFS addTypemapping(SchemaConstants.XSD_IDREFS, IDRefs.class.getName()); // a xsd:Duration addTypemapping(SchemaConstants.XSD_DURATION, Duration.class.getName()); // a xsd:anyURI addTypemapping(SchemaConstants.XSD_ANYURI, URI.class.getName()); } private static void addTypemapping(QName name, String str) { typeMap.put(name, str); } public Map getSoapEncodingTypesMap() { return soapEncodingTypeMap; } private static Map soapEncodingTypeMap = new HashMap(); static { // populate the soapEncodingTypeMap addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ARRAY, org.apache.axis2.databinding.types.soapencoding.Array.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_STRUCT, org.apache.axis2.databinding.types.soapencoding.Struct.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BASE64, org.apache.axis2.databinding.types.soapencoding.Base64.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DURATION, org.apache.axis2.databinding.types.soapencoding.Duration.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DATETIME, org.apache.axis2.databinding.types.soapencoding.DateTime.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NOTATION, org.apache.axis2.databinding.types.soapencoding.NOTATION.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_TIME, org.apache.axis2.databinding.types.soapencoding.Time.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DATE, org.apache.axis2.databinding.types.soapencoding.Date.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GYEARMONTH, org.apache.axis2.databinding.types.soapencoding.GYearMonth.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GYEAR, org.apache.axis2.databinding.types.soapencoding.GYear.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GMONTHDAY, org.apache.axis2.databinding.types.soapencoding.GMonthDay.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GDAY, org.apache.axis2.databinding.types.soapencoding.GDay.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_GMONTH, org.apache.axis2.databinding.types.soapencoding.GMonth.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BOOLEAN, org.apache.axis2.databinding.types.soapencoding._boolean.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BASE64BINARY, org.apache.axis2.databinding.types.soapencoding.Base64Binary.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_HEXBINARY, org.apache.axis2.databinding.types.soapencoding.HexBinary.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_FLOAT, org.apache.axis2.databinding.types.soapencoding._float.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DOUBLE, org.apache.axis2.databinding.types.soapencoding._double.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ANYURI, org.apache.axis2.databinding.types.soapencoding.AnyURI.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_QNAME, org.apache.axis2.databinding.types.soapencoding.QName.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_STRING, org.apache.axis2.databinding.types.soapencoding.String.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NORMALIZEDSTRING, org.apache.axis2.databinding.types.soapencoding.NormalizedString.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_TOKEN, org.apache.axis2.databinding.types.soapencoding.Token.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_LANGUAGE, org.apache.axis2.databinding.types.soapencoding.Language.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NAME, org.apache.axis2.databinding.types.soapencoding.Name.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NMTOKEN, org.apache.axis2.databinding.types.soapencoding.NMTOKEN.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NCNAME, org.apache.axis2.databinding.types.soapencoding.NCName.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NMTOKENS, org.apache.axis2.databinding.types.soapencoding.NMTOKENS.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ID, org.apache.axis2.databinding.types.soapencoding.ID.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_IDREF, org.apache.axis2.databinding.types.soapencoding.IDREF.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ENTITY, org.apache.axis2.databinding.types.soapencoding.ENTITY.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_IDREFS, org.apache.axis2.databinding.types.soapencoding.IDREFS.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_ENTITIES, org.apache.axis2.databinding.types.soapencoding.ENTITIES.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_DECIMAL, org.apache.axis2.databinding.types.soapencoding.Decimal.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_INTEGER, org.apache.axis2.databinding.types.soapencoding.Integer.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NONPOSITIVEINTEGER, org.apache.axis2.databinding.types.soapencoding.NonPositiveInteger.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NEGATIVEINTEGER, org.apache.axis2.databinding.types.soapencoding.NegativeInteger.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_LONG, org.apache.axis2.databinding.types.soapencoding._long.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_INT, org.apache.axis2.databinding.types.soapencoding._int.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_SHORT, org.apache.axis2.databinding.types.soapencoding._short.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_BYTE, org.apache.axis2.databinding.types.soapencoding._byte.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_NONNEGATIVEINTEGER, org.apache.axis2.databinding.types.soapencoding.NonNegativeInteger.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDLONG, org.apache.axis2.databinding.types.soapencoding.UnsignedLong.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDINT, org.apache.axis2.databinding.types.soapencoding.UnsignedInt.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDSHORT, org.apache.axis2.databinding.types.soapencoding.UnsignedShort.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_UNSIGNEDBYTE, org.apache.axis2.databinding.types.soapencoding.UnsignedByte.class.getName()); addSoapEncodingTypeMapping(SchemaConstants.SOAP_ENCODING_POSITIVEINTEGER, org.apache.axis2.databinding.types.soapencoding.PositiveInteger.class.getName()); } private static void addSoapEncodingTypeMapping(QName name, String className) { soapEncodingTypeMap.put(name, className); } } ./src/org/apache/axis2/schema/typemap/TypeMap.java0000664000175000017500000000200411767656530021167 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.typemap; import java.util.Map; /** * This is a typemapper for the bean writer */ public interface TypeMap { public Map getTypeMap(); public Map getSoapEncodingTypesMap(); } ./src/org/apache/axis2/schema/XSD2Java.java0000664000175000017500000000727011767656530017465 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import org.apache.axis2.schema.i18n.SchemaCompilerMessages; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; import java.io.IOException; public class XSD2Java { /** * for now the arguments this main method accepts is the source schema and the output * location * * @param args */ public static void main(String[] args) throws Exception { if (args.length != 2) { // printout the options System.out.println(SchemaCompilerMessages.getMessage("schema.xsdarg1")); System.out.println(SchemaCompilerMessages.getMessage("schema.xsdarg2")); } else { compile(args[0], args[1]); } } /** * @param xsdName * @param outputLocation */ private static void compile(String xsdName, String outputLocation) throws Exception { //load the current Schema through a file //first read the file into a DOM DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder(); Document doc = builder.parse(new File(xsdName)); //now read it to a schema XmlSchemaCollection schemaCol = new XmlSchemaCollection(); XmlSchema currentSchema = schemaCol.read(doc, null); File outputFolder = new File(outputLocation); if (outputFolder.exists()) { if (outputFolder.isFile()) { throw new IOException(SchemaCompilerMessages.getMessage("schema.locationNotFolder")); } } else { outputFolder.mkdirs(); } CompilerOptions compilerOptions = new CompilerOptions(); compilerOptions.setOutputLocation(outputFolder); compilerOptions.setGenerateAll(true); // Map namespace2PackageMap = new HashMap(); // namespace2PackageMap.put("http://www.w3.org/2001/XMLSchema/schema", // "org.apache.axis2.databinding.types.xsd"); // compilerOptions.setNs2PackageMap(namespace2PackageMap); // compilerOptions.setMapperClassPackage("org.apache.axis2.databinding.types.xsd"); //todo - this should come from the users preferences compilerOptions.setWrapClasses(false); //there's no point in not writing the classes here. compilerOptions.setWriteOutput(true); // compilerOptions.setUseWrapperClasses(true); SchemaCompiler compiler = new SchemaCompiler(compilerOptions); compiler.compile(currentSchema); } } ./src/org/apache/axis2/schema/CompilerOptions.java0000664000175000017500000001337011767656530021267 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import org.apache.axis2.schema.i18n.SchemaCompilerMessages; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This is a bean class that captures all the compiler options. * Right now the compiler options consist of the following * 1. output file location - A folder with necessary rights for the * schema compiler to write the files * 2.package name * 3.namespace to package map * 4.boolean flag marking whether to wrap or unwrap * 4.boolean flag marking whether to write classes or not */ public class CompilerOptions { /** * Generated output file */ private File outputLocation; private String packageName = null; private boolean generateAll = false; private boolean offStrictValidation = false; private boolean isUseWrapperClasses = false; /** * Package for the mapper */ private String mapperClassPackage = null; public String getMapperClassPackage() { return mapperClassPackage; } public void setMapperClassPackage(String mapperClassPackage) { this.mapperClassPackage = mapperClassPackage; } /** * get whether the mapper class package * name is present */ public boolean isMapperClassPackagePresent(){ return (mapperClassPackage!=null && !"".equals(mapperClassPackage)); } /** * The flag keeping whether seperate helpers * need to be generated or not */ private boolean helperMode = false; public boolean isHelperMode() { return helperMode; } public void setHelperMode(boolean helperMode) { this.helperMode = helperMode; } /** * Keep track of the namespace and packages mapping */ private Map ns2PackageMap = new HashMap(); public Map getNs2PackageMap() { return ns2PackageMap; } public void setNs2PackageMap(Map ns2PackageMap) { this.ns2PackageMap = ns2PackageMap; } /** * This flag tells the databinder to either write the output or * not. if this is set to true it will write the output at once. * if not the outputter will populate the */ private boolean writeOutput = false; /** * This flag determines whether the generated classes are wrapped or not * if the wrapper flag is true, then only a single file will be generated */ private boolean wrapClasses = false; public boolean isWriteOutput() { return writeOutput; } public void setWriteOutput(boolean writeOutput) { this.writeOutput = writeOutput; } public boolean isWrapClasses() { return wrapClasses; } public void setWrapClasses(boolean wrapClasses) { this.wrapClasses = wrapClasses; } public String getPackageName() { return packageName; } public CompilerOptions setPackageName(String packageName) { // Validate the package name. if (packageName != null && testValue(packageName)) { this.packageName = packageName; } else { throw new RuntimeException(SchemaCompilerMessages.getMessage("schema.unsupportedvalue")); } return this; } public File getOutputLocation() { return outputLocation; } public CompilerOptions setOutputLocation(File outputLocation) { this.outputLocation = outputLocation; return this; } private boolean testValue(String wordToMatch) { Pattern pat = Pattern.compile("^(\\w+\\.)+$"); Matcher m = pat.matcher(wordToMatch); return m.matches(); } public boolean isGenerateAll() { return generateAll; } public void setGenerateAll(boolean generateAll) { this.generateAll = generateAll; } /** * This flag determines whether the generated classes are expected to be * backword compatible with Axis 1.x */ private boolean backwordCompatibilityMode = false; public boolean isBackwordCompatibilityMode() { return backwordCompatibilityMode; } public void setBackwordCompatibilityMode(boolean backwordCompatibilityMode) { this.backwordCompatibilityMode = backwordCompatibilityMode; } /** * Should we suppress namespace prefixes */ private boolean suppressPrefixesMode = false; public boolean isSuppressPrefixesMode() { return suppressPrefixesMode; } public void setSuppressPrefixesMode(boolean suppressPrefixesMode) { this.suppressPrefixesMode = suppressPrefixesMode; } public boolean isOffStrictValidation() { return offStrictValidation; } public void setOffStrictValidation(boolean offStrictValidation) { this.offStrictValidation = offStrictValidation; } public boolean isUseWrapperClasses() { return isUseWrapperClasses; } public void setUseWrapperClasses(boolean useWrapperClasses) { this.isUseWrapperClasses = useWrapperClasses; } } ./src/org/apache/axis2/schema/writer/0000775000175000017500000000000011767656530016606 5ustar brianbrian./src/org/apache/axis2/schema/writer/BeanWriter.java0000664000175000017500000001104611767656530021515 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.writer; import org.apache.axis2.schema.BeanWriterMetaInfoHolder; import org.apache.axis2.schema.CompilerOptions; import org.apache.axis2.schema.SchemaCompilationException; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import javax.xml.namespace.QName; import java.io.IOException; import java.util.Map; /** * The bean writer interface. The schema compiler expects one of these to be * presented to it and calls the appropriate methods */ public interface BeanWriter { /** * Initializes the writer with compiler options. * * @param options * @throws IOException */ public void init(CompilerOptions options) throws SchemaCompilationException; /** * Writes a wrapped class. This will have effect only if the CompilerOptions wrapclassses * returns true. */ public void writeBatch() throws SchemaCompilationException; /** * Gets a map of models. This is useful for tight integrations where the internal workings * of the schema compiler may be exposed. */ public Map getModelMap(); /** Make the fully qualified class name for an element or named type * @param qName the qualified Name for this element or type in the schema * @return the appropriate fully qualified class name to use in generated code */ public String makeFullyQualifiedClassName(QName qName); /** * Write a complex type * * @param complexType * @param typeMap * @param metainf * @param fullyQualifiedClassName the name returned by makeFullyQualifiedClassName() or null if it wasn't called * @return Returns String. * @throws SchemaCompilationException */ public String write(QName qname, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract) throws SchemaCompilationException; /** * Write a element * * @param element * @param typeMap * @param metainf * @return Returns String. * @throws SchemaCompilationException */ public String write(XmlSchemaElement element, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException; /** * Write a simple type * * @param simpleType * @param typeMap * @param metainf * @return Returns String. * @throws SchemaCompilationException */ public String write(XmlSchemaSimpleType simpleType, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException; /** * Find whether the mapper class name is present * @param mapperPackageName */ public String getExtensionMapperPackageName(); /** * Registers the mapper package name - this is relevant to languages * that enforce packaging such as Java or C#. May be ignored in other * languages * @param mapperPackageName */ public void registerExtensionMapperPackageName(String mapperPackageName); /** * Write the extensions mapper component - this is relevant to only the OOP languages * and a particular implementation may ignore this * @param metainfArray * @param namespaceToUse */ public void writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray) throws SchemaCompilationException; public String getDefaultClassName(); public String getDefaultClassArrayName(); public String getDefaultAttribClassName(); public String getDefaultAttribArrayClassName(); } ./src/org/apache/axis2/schema/writer/JavaBeanWriter.java0000664000175000017500000015355411767656530022332 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.writer; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axis2.schema.BeanWriterMetaInfoHolder; import org.apache.axis2.schema.CompilerOptions; import org.apache.axis2.schema.SchemaCompilationException; import org.apache.axis2.schema.SchemaConstants; import org.apache.axis2.schema.i18n.SchemaCompilerMessages; import org.apache.axis2.schema.typemap.JavaTypeMap; import org.apache.axis2.schema.util.PrimitiveTypeFinder; import org.apache.axis2.schema.util.PrimitiveTypeWrapper; import org.apache.axis2.schema.util.SchemaPropertyLoader; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.PrettyPrinter; import org.apache.axis2.util.URLProcessor; import org.apache.axis2.util.XSLTTemplateProcessor; import org.apache.axis2.util.XSLTUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Java Bean writer for the schema compiler. */ public class JavaBeanWriter implements BeanWriter { private static final Log log = LogFactory.getLog(JavaBeanWriter.class); public static final String WRAPPED_DATABINDING_CLASS_NAME = "WrappedDatabinder"; private String javaBeanTemplateName = null; private boolean templateLoaded = false; private Templates templateCache; private List nameList; private Map packageNameToClassNamesMap; private static int count = 0; private boolean wrapClasses = false; private boolean writeClasses = false; private boolean isUseWrapperClasses = false; private String packageName = null; private File rootDir; private Document globalWrappedDocument; private Map modelMap = new HashMap(); private static final String DEFAULT_PACKAGE = "adb"; private Map baseTypeMap = new JavaTypeMap().getTypeMap(); private Map ns2packageNameMap = new HashMap(); private boolean isHelperMode = false; private boolean isSuppressPrefixesMode = false; /** * package for the mapping class */ private String mappingClassPackage = null; public static final String EXTENSION_MAPPER_CLASSNAME = "ExtensionMapper"; // a list of externally identified QNames to be processed. This becomes // useful when only a list of external elements need to be processed public static final String DEFAULT_CLASS_NAME = OMElement.class.getName(); public static final String DEFAULT_CLASS_ARRAY_NAME = "org.apache.axiom.om.OMElement[]"; public static final String DEFAULT_ATTRIB_CLASS_NAME = OMAttribute.class.getName(); public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME = "org.apache.axiom.om.OMAttribute[]"; /** * Default constructor */ public JavaBeanWriter() { } /** * This returns a map of Qnames vs DOMDocument models. One can use this * method to obtain the raw DOMmodels used to write the classes. This has no * meaning when the classes are supposed to be wrapped so the * * @return Returns Map. * @see BeanWriter#getModelMap() */ public Map getModelMap() { return modelMap; } public String getDefaultClassName() { return DEFAULT_CLASS_NAME; } public String getDefaultClassArrayName() { return DEFAULT_CLASS_ARRAY_NAME; } public String getDefaultAttribClassName() { return DEFAULT_ATTRIB_CLASS_NAME; } public String getDefaultAttribArrayClassName() { return DEFAULT_ATTRIB_ARRAY_CLASS_NAME; } public void init(CompilerOptions options) throws SchemaCompilationException { try { // set all state variables to default values modelMap = new HashMap(); ns2packageNameMap = new HashMap(); mappingClassPackage = null; initWithFile(options.getOutputLocation()); packageName = options.getPackageName(); writeClasses = options.isWriteOutput(); isUseWrapperClasses = options.isUseWrapperClasses(); if (!writeClasses) { wrapClasses = false; } else { wrapClasses = options.isWrapClasses(); } // if the wrap mode is set then create a global document to keep the // wrapped // element models if (options.isWrapClasses()) { globalWrappedDocument = XSLTUtils.getDocument(); Element rootElement = XSLTUtils.getElement( globalWrappedDocument, "beans"); globalWrappedDocument.appendChild(rootElement); XSLTUtils.addAttribute(globalWrappedDocument, "name", WRAPPED_DATABINDING_CLASS_NAME, rootElement); String tempPackageName; if (packageName != null && packageName.endsWith(".")) { tempPackageName = this.packageName.substring(0, this.packageName.lastIndexOf(".")); } else { tempPackageName = DEFAULT_PACKAGE; } XSLTUtils.addAttribute(globalWrappedDocument, "package", tempPackageName, rootElement); } // add the ns mappings this.ns2packageNameMap = options.getNs2PackageMap(); //set helper mode this.isHelperMode = options.isHelperMode(); // set suppress prefixes mode this.isSuppressPrefixesMode = options.isSuppressPrefixesMode(); //set mapper class package if present if (options.isMapperClassPackagePresent()) { this.mappingClassPackage = options.getMapperClassPackage(); } } catch (IOException e) { throw new SchemaCompilationException(e); } catch (ParserConfigurationException e) { throw new SchemaCompilationException(e); // todo need to put // correct error // messages } } /** * @param element * @param typeMap * @param metainf * @return Returns String. * @throws SchemaCompilationException */ public String write(XmlSchemaElement element, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { try { QName qName = element.getQName(); return process(qName, metainf, typeMap, groupTypeMap, true, false); } catch (Exception e) { e.printStackTrace(); throw new SchemaCompilationException(e); } } /** * ` * @param qName * @param typeMap * @param metainf * @param isAbstract * @return * @throws SchemaCompilationException */ public String write(QName qName, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract) throws SchemaCompilationException { try { // determine the package for this type. return process(qName, metainf, typeMap, groupTypeMap, false,isAbstract); } catch (SchemaCompilationException e) { throw e; } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @throws Exception * @see BeanWriter#writeBatch() */ public void writeBatch() throws SchemaCompilationException { try { if (wrapClasses) { String tempPackage; if (packageName == null) { tempPackage = DEFAULT_PACKAGE; } else { tempPackage = packageName; } File out = createOutFile(tempPackage, WRAPPED_DATABINDING_CLASS_NAME); // parse with the template and create the files parse(globalWrappedDocument, out); } } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @param simpleType * @param typeMap * @param metainf * @return Returns String. * @throws SchemaCompilationException */ public String write(XmlSchemaSimpleType simpleType, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { try { QName qName = simpleType.getQName(); if (qName == null) { qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME); } metainf.addtStatus(qName, SchemaConstants.SIMPLE_TYPE_OR_CONTENT); return process(qName, metainf, typeMap, groupTypeMap, true, false); } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @param rootDir * @throws IOException * @see BeanWriter#init(java.io.File) */ private void initWithFile(File rootDir) throws IOException { if (rootDir == null) { this.rootDir = new File("."); } else if (!rootDir.isDirectory()) { throw new IOException(SchemaCompilerMessages .getMessage("schema.rootnotfolderexception")); } else { this.rootDir = rootDir; } this.nameList = new ArrayList(); this.packageNameToClassNamesMap = new HashMap(); javaBeanTemplateName = SchemaPropertyLoader.getBeanTemplate(); } /** * Make the fully qualified class name for an element or named type * * @param qName the qualified Name for this element or type in the schema * @return the appropriate fully qualified class name to use in generated * code */ public String makeFullyQualifiedClassName(QName qName) { String namespaceURI = qName.getNamespaceURI(); String basePackageName; String packageName = getPackage(namespaceURI); String originalName = qName.getLocalPart(); String className = null; // when wrapping classes all the data binding and exception class should have // a unique name since package name is not being applied. // otherewise we can make unique with the package name if (!wrapClasses){ className = makeUniqueJavaClassName(this.nameList, originalName); } else { if (!this.packageNameToClassNamesMap.containsKey(packageName)) { this.packageNameToClassNamesMap.put(packageName, new ArrayList()); } className = makeUniqueJavaClassName((List) this.packageNameToClassNamesMap.get(packageName), originalName); } String packagePrefix = null; String fullyqualifiedClassName; if (wrapClasses) packagePrefix = (this.packageName == null ? DEFAULT_PACKAGE + "." : this.packageName) + WRAPPED_DATABINDING_CLASS_NAME; else if (writeClasses) packagePrefix = packageName; if (packagePrefix != null) fullyqualifiedClassName = packagePrefix + (packagePrefix.endsWith(".") ? "" : ".") + className; else fullyqualifiedClassName = className; // return the fully qualified class name return fullyqualifiedClassName; } private String getPackage(String namespaceURI) { String basePackageName; if ((ns2packageNameMap != null) && ns2packageNameMap.containsKey(namespaceURI)) { basePackageName = (String) ns2packageNameMap.get(namespaceURI); } else { basePackageName = URLProcessor.makePackageName(namespaceURI); } return this.packageName == null ? basePackageName : this.packageName + basePackageName; } /** * A util method that holds common code for the complete schema that the * generated XML complies to look under other/beanGenerationSchema.xsd * * @param qName * @param metainf * @param typeMap * @param isElement * @param fullyQualifiedClassName the name returned by makeFullyQualifiedClassName() or null if * it wasn't called * @return Returns String. * @throws Exception */ private String process(QName qName, BeanWriterMetaInfoHolder metainf, Map typeMap, Map groupTypeMap, boolean isElement, boolean isAbstract) throws Exception { String fullyQualifiedClassName = metainf.getOwnClassName(); if (fullyQualifiedClassName == null) fullyQualifiedClassName = makeFullyQualifiedClassName(qName); String className = fullyQualifiedClassName .substring(1 + fullyQualifiedClassName.lastIndexOf('.')); String basePackageName; if (fullyQualifiedClassName.lastIndexOf('.') == -1) {// no 'dots' so // the package // is not there basePackageName = ""; } else { basePackageName = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf('.')); } String originalName = qName == null ? "" : qName.getLocalPart(); ArrayList propertyNames = new ArrayList(); if (!templateLoaded) { loadTemplate(); } // if wrapped then do not write the classes now but add the models to a // global document. However in order to write the // global class that is generated, one needs to call the writeBatch() // method if (wrapClasses) { globalWrappedDocument.getDocumentElement().appendChild( getBeanElement(globalWrappedDocument, className, originalName, basePackageName, qName, isElement,isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); } else { // create the model Document model = XSLTUtils.getDocument(); // make the XML model.appendChild(getBeanElement(model, className, originalName, basePackageName, qName, isElement,isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); if (writeClasses) { // create the file File out = createOutFile(basePackageName, className); // parse with the template and create the files if (isHelperMode) { XSLTUtils.addAttribute(model, "helperMode", "yes", model.getDocumentElement()); // Generate bean classes parse(model, out); // Generating the helper classes out = createOutFile(basePackageName, className + "Helper"); XSLTUtils.addAttribute(model, "helper", "yes", model .getDocumentElement()); parse(model, out); } else { //No helper mode - just generate the classes parse(model, out); } } // add the model to the model map modelMap.put(new QName(qName.getNamespaceURI(), className), model); } // return the fully qualified class name return fullyQualifiedClassName; } /** * @param model * @param className * @param originalName * @param packageName * @param qName * @param isElement * @param metainf * @param propertyNames * @param typeMap * @return Returns Element. * @throws SchemaCompilationException */ private Element getBeanElement(Document model, String className, String originalName, String packageName, QName qName, boolean isElement, boolean isAbstract, BeanWriterMetaInfoHolder metainf, ArrayList propertyNames, Map typeMap, Map groupTypeMap) throws SchemaCompilationException { Element rootElt = XSLTUtils.getElement(model, "bean"); XSLTUtils.addAttribute(model, "name", className, rootElt); XSLTUtils.addAttribute(model, "originalName", originalName, rootElt); XSLTUtils.addAttribute(model, "package", packageName, rootElt); XSLTUtils.addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt); XSLTUtils.addAttribute(model, "nsprefix", isSuppressPrefixesMode ? "" : getPrefixForURI(qName .getNamespaceURI(), qName.getPrefix()), rootElt); if (!wrapClasses) { XSLTUtils.addAttribute(model, "unwrapped", "yes", rootElt); } if (isAbstract){ XSLTUtils.addAttribute(model, "isAbstract", "yes", rootElt); } if (!writeClasses) { XSLTUtils.addAttribute(model, "skip-write", "yes", rootElt); } if (!isElement) { XSLTUtils.addAttribute(model, "type", "yes", rootElt); } if (metainf.isAnonymous()) { XSLTUtils.addAttribute(model, "anon", "yes", rootElt); } if (isUseWrapperClasses){ XSLTUtils.addAttribute(model, "usewrapperclasses", "yes", rootElt); } if (metainf.isExtension()) { XSLTUtils.addAttribute(model, "extension", metainf .getExtensionClassName(), rootElt); } if (metainf.isRestriction()) { XSLTUtils.addAttribute(model, "restriction", metainf .getRestrictionClassName(), rootElt); } //add the mapper class name XSLTUtils.addAttribute(model, "mapperClass", getFullyQualifiedMapperClassName(), rootElt); if (metainf.isChoice()) { XSLTUtils.addAttribute(model, "choice", "yes", rootElt); } if (metainf.isSimple()) { XSLTUtils.addAttribute(model, "simple", "yes", rootElt); } if (metainf.isUnion()) { XSLTUtils.addAttribute(model, "union", "yes", rootElt); } if (metainf.isList()) { XSLTUtils.addAttribute(model, "list", "yes", rootElt); } if (metainf.isOrdered()) { XSLTUtils.addAttribute(model, "ordered", "yes", rootElt); } if (isElement && metainf.isNillable(qName)) { XSLTUtils.addAttribute(model, "nillable", "yes", rootElt); } if (metainf.isParticleClass()) { XSLTUtils.addAttribute(model, "particleClass", "yes", rootElt); } if (metainf.isHasParticleType()){ XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt); } // populate all the information populateInfo(metainf, model, rootElt, propertyNames, typeMap, groupTypeMap, false); if (metainf.isSimple() && metainf.isUnion()) { populateMemberInfo(metainf, model, rootElt, typeMap); } if (metainf.isSimple() && metainf.isList()) { populateListInfo(metainf, model, rootElt, typeMap, groupTypeMap); } ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElt)); //////////////////////////////////////////////////////////// return rootElt; } protected void populateListInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map typeMap, Map groupTypeMap) { String javaName = makeUniqueJavaClassName(new ArrayList(), metainf.getItemTypeQName().getLocalPart()); Element itemType = XSLTUtils.addChildElement(model, "itemtype", rootElement); XSLTUtils.addAttribute(model, "type", metainf.getItemTypeClassName(), itemType); XSLTUtils.addAttribute(model, "nsuri", metainf.getItemTypeQName().getNamespaceURI(), itemType); XSLTUtils.addAttribute(model, "originalName", metainf.getItemTypeQName().getLocalPart(), itemType); XSLTUtils.addAttribute(model, "javaname", javaName, itemType); if (typeMap.containsKey(metainf.getItemTypeQName()) || groupTypeMap.containsKey(metainf.getItemTypeClassName())) { XSLTUtils.addAttribute(model, "ours", "true", itemType); } if (PrimitiveTypeFinder.isPrimitive(metainf.getItemTypeClassName())) { XSLTUtils.addAttribute(model, "primitive", "yes", itemType); } String shortTypeName = getShortTypeName(metainf.getItemTypeClassName()); XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, itemType); } protected void populateMemberInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map typeMap) { Map memberTypes = metainf.getMemberTypes(); QName memberQName; for (Iterator iter = metainf.getMemberTypesKeys().iterator(); iter.hasNext();) { memberQName = (QName) iter.next(); String memberClass = (String) memberTypes.get(memberQName); if (PrimitiveTypeFinder.isPrimitive(memberClass)) { memberClass = PrimitiveTypeWrapper.getWrapper(memberClass); } // add member type element Element memberType = XSLTUtils.addChildElement(model, "memberType", rootElement); XSLTUtils.addAttribute(model, "type", memberClass, memberType); XSLTUtils.addAttribute(model, "nsuri", memberQName.getNamespaceURI(), memberType); XSLTUtils.addAttribute(model, "originalName", memberQName.getLocalPart(), memberType); if (typeMap.containsKey(memberQName)) { XSLTUtils.addAttribute(model, "ours", "true", memberType); } String shortTypeName = getShortTypeName(memberClass); XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, memberType); } } /** * @param metainf * @param model * @param rootElt * @param propertyNames * @param typeMap * @throws SchemaCompilationException */ private void populateInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElt, ArrayList propertyNames, Map typeMap, Map groupTypeMap, boolean isInherited) throws SchemaCompilationException { // we should add parent class details only if it is // an extension or simple restriction // should not in complex restrictions if (metainf.getParent() != null && (!metainf.isRestriction() || (metainf.isRestriction() && metainf.isSimple()))) { populateInfo(metainf.getParent(), model, rootElt, propertyNames, typeMap, groupTypeMap, true); } addPropertyEntries(metainf, model, rootElt, propertyNames, typeMap, groupTypeMap, isInherited); } /** * @param metainf * @param model * @param rootElt * @param propertyNames * @param typeMap * @throws SchemaCompilationException */ private void addPropertyEntries(BeanWriterMetaInfoHolder metainf, Document model, Element rootElt, ArrayList propertyNames, Map typeMap, Map groupTypeMap, boolean isInherited) throws SchemaCompilationException { // go in the loop and add the part elements QName[] qName; String javaClassNameForElement; ArrayList missingQNames = new ArrayList(); ArrayList qNames = new ArrayList(); BeanWriterMetaInfoHolder parentMetaInf = metainf.getParent(); if (metainf.isOrdered()) { qName = metainf.getOrderedQNameArray(); } else { qName = metainf.getQNameArray(); } for (int i = 0; i < qName.length; i++) { qNames.add(qName[i]); } //adding missing QNames to the end, including elements & attributes. // for the simple types we have already add the parent elements // it is almost consider as an extension if (metainf.isRestriction() && !metainf.isSimple()) { addMissingQNames(metainf, qNames, missingQNames); } QName name; for (int i = 0; i < qNames.size(); i++) { name = (QName) qNames.get(i); Element property = XSLTUtils.addChildElement(model, "property", rootElt); String xmlName = name.getLocalPart(); XSLTUtils.addAttribute(model, "name", xmlName, property); XSLTUtils.addAttribute(model, "nsuri", name.getNamespaceURI(), property); String javaName; if (metainf.isJavaNameMappingAvailable(xmlName)) { javaName = metainf.getJavaName(xmlName); } else { javaName = makeUniqueJavaClassName(propertyNames, xmlName); // in a restriction if this element already there and array status have changed // then we have to generate a new name for this if (parentMetaInf != null && metainf.isRestriction() && !missingQNames.contains(name) && (parentMetaInf.getArrayStatusForQName(name) && !metainf.getArrayStatusForQName(name))) { javaName = makeUniqueJavaClassName(propertyNames, xmlName); } metainf.addXmlNameJavaNameMapping(xmlName,javaName); } XSLTUtils.addAttribute(model, "javaname", javaName, property); if (parentMetaInf != null && metainf.isRestriction() && missingQNames.contains(name)) { javaClassNameForElement = parentMetaInf.getClassNameForQName(name); } else { javaClassNameForElement = metainf.getClassNameForQName(name); } if (javaClassNameForElement == null) { javaClassNameForElement = getDefaultClassName(); log.warn(SchemaCompilerMessages .getMessage("schema.typeMissing", name.toString())); } if (metainf.isRestriction() && typeChanged(name, missingQNames, metainf)) { XSLTUtils.addAttribute(model, "typeChanged", "yes", property); //XSLTUtils.addAttribute(model, "restricted", "yes", property); } long minOccurs = metainf.getMinOccurs(name); if (PrimitiveTypeFinder.isPrimitive(javaClassNameForElement) && isUseWrapperClasses && ((minOccurs == 0) || metainf.isNillable(name))) { // if this is an primitive class and user wants to use the // wrapper type we change the type to wrapper type. javaClassNameForElement = PrimitiveTypeWrapper.getWrapper(javaClassNameForElement); } XSLTUtils.addAttribute(model, "type", javaClassNameForElement, property); if (PrimitiveTypeFinder.isPrimitive(javaClassNameForElement)) { XSLTUtils.addAttribute(model, "primitive", "yes", property); } // add the default value if (metainf.isDefaultValueAvailable(name)){ QName schemaQName = metainf.getSchemaQNameForQName(name); if (baseTypeMap.containsKey(schemaQName)){ XSLTUtils.addAttribute(model, "defaultValue", metainf.getDefaultValueForQName(name), property); } } //in the case the original element is an array but the derived one is not. if (parentMetaInf != null && metainf.isRestriction() && !missingQNames.contains(name) && (parentMetaInf.getArrayStatusForQName(name) && !metainf.getArrayStatusForQName(name))) { XSLTUtils.addAttribute(model, "rewrite", "yes", property); XSLTUtils.addAttribute(model, "occuranceChanged", "yes", property); } else if (metainf.isRestriction() && !missingQNames.contains(name) && (minOccursChanged(name, missingQNames, metainf) || maxOccursChanged(name, missingQNames, metainf))) { XSLTUtils.addAttribute(model, "restricted", "yes", property); XSLTUtils.addAttribute(model, "occuranceChanged", "yes", property); } // set the is particle class if (metainf.getParticleTypeStatusForQName(name)){ XSLTUtils.addAttribute(model, "particleClassType", "yes", property); } // if we have an particle class in a extension class then we have // to consider the whole class has a particle type. if (metainf.isHasParticleType()) { XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt); } // what happed if this contain attributes // TODO: check the meaning of this removed property if (metainf.isRestriction() && missingQNames.contains(name) && !metainf.isSimple()) { //XSLTUtils.addAttribute(model, "restricted", "yes", property); XSLTUtils.addAttribute(model, "removed", "yes", property); } if (isInherited) { XSLTUtils.addAttribute(model, "inherited", "yes", property); } if (metainf.getInnerChoiceStatusForQName(name)){ XSLTUtils.addAttribute(model, "innerchoice", "yes", property); } if ((parentMetaInf != null) && metainf.isRestriction() && missingQNames.contains(name)) { // this element details should be there with the parent meta Inf addAttributesToProperty( parentMetaInf, name, model, property, typeMap, groupTypeMap, javaClassNameForElement); } else { addAttributesToProperty( metainf, name, model, property, typeMap, groupTypeMap, javaClassNameForElement); } } // end of foo } private void addAttributesToProperty(BeanWriterMetaInfoHolder metainf, QName name, Document model, Element property, Map typeMap, Map groupTypeMap, String javaClassNameForElement) { // add an attribute that says the type is default if (metainf.getDefaultStatusForQName(name)) { XSLTUtils.addAttribute(model, "default", "yes", property); } if (typeMap.containsKey(metainf.getSchemaQNameForQName(name)) || groupTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) { XSLTUtils.addAttribute(model, "ours", "yes", property); } if (metainf.getAttributeStatusForQName(name)) { XSLTUtils.addAttribute(model, "attribute", "yes", property); } if (metainf.isNillable(name)) { XSLTUtils.addAttribute(model, "nillable", "yes", property); } if (metainf.getOptionalAttributeStatusForQName(name)) { XSLTUtils.addAttribute(model, "optional", "yes", property); } String shortTypeName; if (metainf.getSchemaQNameForQName(name) != null) { // see whether the QName is a basetype if (baseTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) { shortTypeName = metainf.getSchemaQNameForQName(name).getLocalPart(); } else { shortTypeName = getShortTypeName(javaClassNameForElement); } } else { shortTypeName = getShortTypeName(javaClassNameForElement); } XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, property); if (metainf.getAnyStatusForQName(name)) { XSLTUtils.addAttribute(model, "any", "yes", property); } if (metainf.getBinaryStatusForQName(name)) { XSLTUtils.addAttribute(model, "binary", "yes", property); } if (metainf.isSimple() || metainf.getSimpleStatusForQName(name)) { XSLTUtils.addAttribute(model, "simple", "yes", property); } // put the min occurs count irrespective of whether it's an array or // not long minOccurs = metainf.getMinOccurs(name); XSLTUtils.addAttribute(model, "minOccurs", minOccurs + "", property); if (metainf.getArrayStatusForQName(name)) { XSLTUtils.addAttribute(model, "array", "yes", property); int endIndex = javaClassNameForElement.indexOf("["); if (endIndex >= 0) { XSLTUtils.addAttribute(model, "arrayBaseType", javaClassNameForElement.substring(0, endIndex), property); } else { XSLTUtils.addAttribute(model, "arrayBaseType", javaClassNameForElement, property); } long maxOccurs = metainf.getMaxOccurs(name); if (maxOccurs == Long.MAX_VALUE) { XSLTUtils.addAttribute(model, "unbound", "yes", property); } else { XSLTUtils.addAttribute(model, "maxOccurs", maxOccurs + "", property); } } if (metainf.isRestrictionBaseType(name)) { XSLTUtils.addAttribute(model, "restrictionBaseType", "yes", property); } if (metainf.isExtensionBaseType(name)) { XSLTUtils.addAttribute(model, "extensionBaseType", "yes", property); } if (metainf.isRestrictionBaseType(name) && metainf.getLengthFacet() != -1) { XSLTUtils.addAttribute(model, "lenFacet", metainf.getLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxLengthFacet() != -1) { XSLTUtils.addAttribute(model, "maxLenFacet", metainf.getMaxLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinLengthFacet() != -1) { XSLTUtils.addAttribute(model, "minLenFacet", metainf.getMinLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxExclusiveFacet() != null) { XSLTUtils.addAttribute(model, "maxExFacet", metainf.getMaxExclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinExclusiveFacet() != null) { XSLTUtils.addAttribute(model, "minExFacet", metainf.getMinExclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxInclusiveFacet() != null) { XSLTUtils.addAttribute(model, "maxInFacet", metainf.getMaxInclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinInclusiveFacet() != null) { XSLTUtils.addAttribute(model, "minInFacet", metainf.getMinInclusiveFacet() + "", property); } if (!metainf.getEnumFacet().isEmpty()) { boolean validJava = true; // Assume all enum values are valid ids Iterator iterator = metainf.getEnumFacet().iterator(); // Walk the values looking for invalid ids while (iterator.hasNext()) { String value = (String) iterator.next(); if (!JavaUtils.isJavaId(value)) { validJava = false; } } int id = 0; iterator = metainf.getEnumFacet().iterator(); while (iterator.hasNext()) { Element enumFacet = XSLTUtils.addChildElement(model, "enumFacet", property); String attribValue = (String) iterator.next(); XSLTUtils.addAttribute(model, "value", attribValue, enumFacet); if (validJava) { XSLTUtils.addAttribute(model, "id", attribValue, enumFacet); } else { id++; XSLTUtils.addAttribute(model, "id", "value" + id, enumFacet); } } } if (metainf.isRestrictionBaseType(name) && metainf.getPatternFacet() != null) { XSLTUtils.addAttribute(model, "patternFacet", metainf.getPatternFacet(), property); } } private void addMissingQNames(BeanWriterMetaInfoHolder metainf, ArrayList qName, ArrayList missingQNames) { QName[] qNames = null; QName[] pQNames = null; BeanWriterMetaInfoHolder parentMetaInf = metainf.getParent(); if (metainf.isOrdered()) { qNames = metainf.getOrderedQNameArray(); } else { qNames = metainf.getQNameArray(); } if (parentMetaInf != null) { if (parentMetaInf.isOrdered()) { pQNames = parentMetaInf.getOrderedQNameArray(); } else { pQNames = parentMetaInf.getQNameArray(); } } for (int i = 0; pQNames != null && i < pQNames.length; i++) { if (qNameNotFound(pQNames[i], metainf)) { missingQNames.add(pQNames[i]); } } //adding missing QNames to the end of list. if (!missingQNames.isEmpty()) { for (int i = 0; i < missingQNames.size(); i++) { qName.add(missingQNames.get(i)); } } } private boolean qNameNotFound(QName qname, BeanWriterMetaInfoHolder metainf) { boolean found = false; QName[] qNames; if (metainf.isOrdered()) { qNames = metainf.getOrderedQNameArray(); } else { qNames = metainf.getQNameArray(); } for (int j = 0; j < qNames.length; j++) { if (qname.getLocalPart().equals(qNames[j].getLocalPart())) { found = true; } } return !found; } private boolean typeChanged(QName qname, ArrayList missingQNames, BeanWriterMetaInfoHolder metainf) { boolean typeChanged = false; QName[] pQNames; BeanWriterMetaInfoHolder parentMetainf = metainf.getParent(); if (parentMetainf != null && !missingQNames.contains(qname)) { if (parentMetainf.isOrdered()) { pQNames = parentMetainf.getOrderedQNameArray(); } else { pQNames = parentMetainf.getQNameArray(); } for (int j = 0; j < pQNames.length; j++) { if (qname.getLocalPart().equals(pQNames[j].getLocalPart())) { String javaClassForParentElement = parentMetainf.getClassNameForQName(pQNames[j]); String javaClassForElement = metainf.getClassNameForQName(qname); if (!javaClassForParentElement.equals(javaClassForElement)) { if (javaClassForParentElement.endsWith("[]")) { if ((javaClassForParentElement.substring(0, javaClassForParentElement.indexOf('['))).equals(javaClassForElement)) { continue; } } else if (javaClassForElement.endsWith("[]")) { if ((javaClassForElement.substring(0, javaClassForElement.indexOf('['))).equals(javaClassForParentElement)) { continue; } } else { typeChanged = true; } } } } } return typeChanged; } private boolean minOccursChanged(QName qname, ArrayList missingQNames, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { boolean minChanged = false; QName[] pQNames; BeanWriterMetaInfoHolder parentMetainf = metainf.getParent(); if (parentMetainf != null && !missingQNames.contains(qname)) { if (parentMetainf.isOrdered()) { pQNames = parentMetainf.getOrderedQNameArray(); } else { pQNames = parentMetainf.getQNameArray(); } for (int j = 0; j < pQNames.length; j++) { if (qname.getLocalPart().equals(pQNames[j].getLocalPart())) { if (metainf.getMinOccurs(qname) > parentMetainf.getMinOccurs(pQNames[j])) { minChanged = true; } else if (metainf.getMinOccurs(qname) < parentMetainf.getMinOccurs(pQNames[j])) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("minOccurs Wrong!")); } } } } return minChanged; } private boolean maxOccursChanged(QName qname, ArrayList missingQNames, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { boolean maxChanged = false; QName[] pQNames; BeanWriterMetaInfoHolder parentMetainf = metainf.getParent(); if (parentMetainf != null && !missingQNames.contains(qname)) { if (parentMetainf.isOrdered()) { pQNames = parentMetainf.getOrderedQNameArray(); } else { pQNames = parentMetainf.getQNameArray(); } for (int j = 0; j < pQNames.length; j++) { if (qname.getLocalPart().equals(pQNames[j].getLocalPart())) { if (metainf.getMaxOccurs(qname) < parentMetainf.getMaxOccurs(pQNames[j])) { maxChanged = true; } else if (metainf.getMaxOccurs(qname) > parentMetainf.getMaxOccurs(pQNames[j])) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("maxOccurs Wrong!")); } } } } return maxChanged; } /** * Test whether the given class name matches the default * * @param javaClassNameForElement */ private boolean isDefault(String javaClassNameForElement) { return getDefaultClassName() .equals(javaClassNameForElement) || getDefaultClassArrayName() .equals(javaClassNameForElement); } /** * Given the xml name, make a unique class name taking into account that * some file systems are case sensitive and some are not. -Consider the * Jax-WS spec for this * * @param listOfNames * @param xmlName * @return Returns String. */ private String makeUniqueJavaClassName(List listOfNames, String xmlName) { String javaName; if (JavaUtils.isJavaKeyword(xmlName)) { javaName = JavaUtils.makeNonJavaKeyword(xmlName); } else { javaName = JavaUtils.capitalizeFirstChar(JavaUtils .xmlNameToJava(xmlName)); } while (listOfNames.contains(javaName.toLowerCase())) { if (!listOfNames.contains((javaName + "E").toLowerCase())){ javaName = javaName + "E"; } else { javaName = javaName + count++; } } listOfNames.add(javaName.toLowerCase()); return javaName; } /** * A bit of code from the old code generator. We are better off using the * template engines and such stuff that's already there. But the class * writers are hard to be reused so some code needs to be repeated (atleast * a bit) */ private void loadTemplate() throws SchemaCompilationException { // first get the language specific property map Class clazz = this.getClass(); InputStream xslStream; String templateName = javaBeanTemplateName; if (templateName != null) { try { xslStream = clazz.getResourceAsStream(templateName); templateCache = TransformerFactory.newInstance().newTemplates( new StreamSource(xslStream)); templateLoaded = true; } catch (TransformerConfigurationException e) { throw new SchemaCompilationException(SchemaCompilerMessages .getMessage("schema.templateLoadException"), e); } } else { throw new SchemaCompilationException(SchemaCompilerMessages .getMessage("schema.templateNotFoundException")); } } /** * Creates the output file * * @param packageName * @param fileName * @throws Exception */ private File createOutFile(String packageName, String fileName) throws Exception { return org.apache.axis2.util.FileWriter.createClassFile(this.rootDir, packageName, fileName, ".java"); } /** * Writes the output file * * @param doc * @param outputFile * @throws Exception */ private void parse(Document doc, File outputFile) throws Exception { OutputStream outStream = new FileOutputStream(outputFile); XSLTTemplateProcessor.parse(outStream, doc, getTransformer()); outStream.flush(); outStream.close(); PrettyPrinter.prettify(outputFile); } private Transformer getTransformer() throws TransformerConfigurationException, SchemaCompilationException { try { return this.templateCache .newTransformer(); } catch (Exception e){ // Under some peculiar conditions (classloader issues), just scrap the old templateCache, // create a new one and try again. loadTemplate(); return this.templateCache .newTransformer(); } } /** * Get a prefix for a namespace URI. This method will ALWAYS return a valid * prefix - if the given URI is already mapped in this serialization, we * return the previous prefix. If it is not mapped, we will add a new * mapping and return a generated prefix of the form "ns". * * @param uri is the namespace uri * @return Returns prefix. */ public String getPrefixForURI(String uri) { return getPrefixForURI(uri, null); } /** * Last used index suffix for "ns" */ private int lastPrefixIndex = 1; /** * Map of namespaces URI to prefix(es) */ HashMap mapURItoPrefix = new HashMap(); HashMap mapPrefixtoURI = new HashMap(); /** * Get a prefix for the given namespace URI. If one has already been defined * in this serialization, use that. Otherwise, map the passed default prefix * to the URI, and return that. If a null default prefix is passed, use one * of the form "ns" */ public String getPrefixForURI(String uri, String defaultPrefix) { if ((uri == null) || (uri.length() == 0)) return null; String prefix = (String) mapURItoPrefix.get(uri); if (prefix == null) { if (defaultPrefix == null || defaultPrefix.length() == 0) { prefix = "ns" + lastPrefixIndex++; while (mapPrefixtoURI.get(prefix) != null) { prefix = "ns" + lastPrefixIndex++; } } else { prefix = defaultPrefix; } mapPrefixtoURI.put(prefix, uri); mapURItoPrefix.put(uri, prefix); } return prefix; } private String getShortTypeName(String typeClassName) { if (typeClassName.endsWith("[]")) { typeClassName = typeClassName.substring(0, typeClassName .lastIndexOf("[")); } return typeClassName.substring(typeClassName.lastIndexOf(".") + 1, typeClassName.length()); } /** * Get the mapper class name - there is going to be only one * mapper class for the whole */ private String getFullyQualifiedMapperClassName() { if (wrapClasses || !writeClasses) { return EXTENSION_MAPPER_CLASSNAME; } else { return mappingClassPackage + "." + EXTENSION_MAPPER_CLASSNAME; } } /** * get the mapper class package name * May be ignored by the implementer */ public String getExtensionMapperPackageName() { return mappingClassPackage; } /** * Sets the mapping class name of this writer. A mapping class * package set by the options may be overridden at the this point * * @param mapperPackageName */ public void registerExtensionMapperPackageName(String mapperPackageName) { this.mappingClassPackage = mapperPackageName; } /** * Write the extension classes - this is needed to process * the hierarchy of classes * * @param metainfArray */ public void writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray) throws SchemaCompilationException { //generate the element try { String mapperClassName = getFullyQualifiedMapperClassName(); Document model = XSLTUtils.getDocument(); Element rootElt = XSLTUtils.getElement(model, "mapper"); String mapperName = mapperClassName.substring(mapperClassName.lastIndexOf(".") + 1); XSLTUtils.addAttribute(model, "name", mapperName, rootElt); String basePackageName = ""; if (mapperClassName.indexOf(".") != -1) { basePackageName = mapperClassName.substring(0, mapperClassName.lastIndexOf(".")); XSLTUtils.addAttribute(model, "package", basePackageName, rootElt); } else { XSLTUtils.addAttribute(model, "package", "", rootElt); } if (!wrapClasses) { XSLTUtils.addAttribute(model, "unwrapped", "yes", rootElt); } if (!writeClasses) { XSLTUtils.addAttribute(model, "skip-write", "yes", rootElt); } if (isHelperMode) { XSLTUtils.addAttribute(model, "helpermode", "yes", rootElt); } for (int i = 0; i < metainfArray.length; i++) { QName ownQname = metainfArray[i].getOwnQname(); String className = metainfArray[i].getOwnClassName(); //do not add when the qname is not availble if (ownQname != null) { Element typeChild = XSLTUtils.addChildElement(model, "type", rootElt); XSLTUtils.addAttribute(model, "nsuri", ownQname.getNamespaceURI(), typeChild); XSLTUtils.addAttribute(model, "classname", className == null ? "" : className, typeChild); XSLTUtils.addAttribute(model, "shortname", ownQname == null ? "" : ownQname.getLocalPart(), typeChild); } } model.appendChild(rootElt); if (!templateLoaded) { loadTemplate(); } if (wrapClasses) { rootElt = (Element) globalWrappedDocument.importNode(rootElt, true); //add to the global wrapped document globalWrappedDocument.getDocumentElement().appendChild(rootElt); } else { if (writeClasses) { // create the file File out = createOutFile(basePackageName, mapperName); // parse with the template and create the files parse(model, out); } // add the model to the model map modelMap.put(new QName(mapperName), model); } } catch (ParserConfigurationException e) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.docuement.error"), e); } catch (Exception e) { e.printStackTrace(); throw new SchemaCompilationException(e); } } }./src/org/apache/axis2/schema/writer/CStructWriter.java0000664000175000017500000012675611767656530022256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema.writer; import org.apache.axis2.schema.BeanWriterMetaInfoHolder; import org.apache.axis2.schema.CompilerOptions; import org.apache.axis2.schema.SchemaCompilationException; import org.apache.axis2.schema.SchemaConstants; import org.apache.axis2.schema.i18n.SchemaCompilerMessages; import org.apache.axis2.schema.typemap.JavaTypeMap; import org.apache.axis2.schema.util.PrimitiveTypeFinder; import org.apache.axis2.schema.util.PrimitiveTypeWrapper; import org.apache.axis2.schema.util.SchemaPropertyLoader; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.XSLTTemplateProcessor; import org.apache.axis2.util.XSLTUtils; import org.apache.axis2.wsdl.databinding.CUtils; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Templates; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Java Bean writer for the schema compiler. */ public class CStructWriter implements BeanWriter { public static final String WRAPPED_DATABINDING_CLASS_NAME = "WrappedDatabinder"; public static final String AXIS2_PREFIX = "adb_"; private String javaBeanTemplateName = null; private boolean templateLoaded = false; private Templates sourceTemplateCache; private Templates headerTemplateCache; private List namesList; private static int count = 0; private boolean wrapClasses = false; private boolean writeClasses = false; protected File rootDir; private Document globalWrappedSourceDocument; private Document globalWrappedHeaderDocument; private Map modelMap = new HashMap(); private static final String DEFAULT_PACKAGE = "adb"; private static final String DEFAULT_C_CLASS_NAME = "axiom_node_t*"; private Map baseTypeMap = new JavaTypeMap().getTypeMap(); // a list of externally identified QNames to be processed. This becomes // useful when only a list of external elements need to be processed public static final String DEFAULT_CLASS_NAME = "axiom_node_t*"; public static final String DEFAULT_CLASS_ARRAY_NAME = "axiom_node_t*"; public static final String DEFAULT_ATTRIB_CLASS_NAME = "axiom_attribute_t*"; public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME = "axiom_attribute_t*"; public static final String DEFAULT_TYPE_NS = "http://www.w3.org/2001/XMLSchema"; /** * Default constructor */ public CStructWriter() { } /** * This returns a map of Qnames vs DOMDocument models. One can use this method to * obtain the raw DOMmodels used to write the classes. * This has no meaning when the classes are supposed to be wrapped so the * * @return Returns Map. * @see BeanWriter#getModelMap() */ public Map getModelMap() { return modelMap; } public String getDefaultClassName() { return DEFAULT_CLASS_NAME; } public String getDefaultClassArrayName() { return DEFAULT_CLASS_ARRAY_NAME; } public String getDefaultAttribClassName() { return DEFAULT_ATTRIB_CLASS_NAME; } public String getDefaultAttribArrayClassName() { return DEFAULT_ATTRIB_ARRAY_CLASS_NAME; } public void init(CompilerOptions options) throws SchemaCompilationException { try { initWithFile(options.getOutputLocation()); writeClasses = options.isWriteOutput(); if (!writeClasses) { wrapClasses = false; } else { wrapClasses = options.isWrapClasses(); } //if the wrap mode is set then create a global document to keep the wrapped //element models if (options.isWrapClasses()) { globalWrappedSourceDocument = XSLTUtils.getDocument(); Element rootElement = XSLTUtils.getElement(globalWrappedSourceDocument, "beans"); globalWrappedSourceDocument.appendChild(rootElement); XSLTUtils.addAttribute(globalWrappedSourceDocument, "name", CStructWriter.WRAPPED_DATABINDING_CLASS_NAME, rootElement); globalWrappedHeaderDocument = XSLTUtils.getDocument(); rootElement = XSLTUtils.getElement(globalWrappedHeaderDocument, "beans"); globalWrappedHeaderDocument.appendChild(rootElement); XSLTUtils.addAttribute(globalWrappedHeaderDocument, "name", CStructWriter.WRAPPED_DATABINDING_CLASS_NAME, rootElement); } } catch (IOException e) { throw new SchemaCompilationException(e); } catch (ParserConfigurationException e) { throw new SchemaCompilationException(e); //todo need to put correct error messages } } /** * @param element * @param typeMap * @param metainf * @return Returns String. * @throws org.apache.axis2.schema.SchemaCompilationException * */ public String write(XmlSchemaElement element, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { try { QName qName = element.getQName(); return process(qName, metainf, typeMap, groupTypeMap, true, false); } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @param qName * @param typeMap * @param metainf * @param isAbstract * @throws org.apache.axis2.schema.SchemaCompilationException * * @see org.apache.axis2.schema.writer.BeanWriter */ public String write(QName qName, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract) throws SchemaCompilationException { try { //determine the package for this type. return process(qName, metainf, typeMap, groupTypeMap, false, isAbstract); } catch (SchemaCompilationException e) { throw e; } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @throws SchemaCompilationException * @see org.apache.axis2.schema.writer.BeanWriter#writeBatch() */ public void writeBatch() throws SchemaCompilationException { try { if (wrapClasses) { File outSource = createOutFile(CStructWriter.WRAPPED_DATABINDING_CLASS_NAME, ".c"); File outHeader = createOutFile(CStructWriter.WRAPPED_DATABINDING_CLASS_NAME, ".h"); //parse with the template and create the files parseSource(globalWrappedSourceDocument, outSource); parseHeader(globalWrappedHeaderDocument, outHeader); } } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @param simpleType * @param typeMap * @param metainf * @return Returns String. * @throws org.apache.axis2.schema.SchemaCompilationException * * @see BeanWriter#write(org.apache.ws.commons.schema.XmlSchemaSimpleType, java.util.Map, org.apache.axis2.schema.BeanWriterMetaInfoHolder) */ public String write(XmlSchemaSimpleType simpleType, Map typeMap, Map groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException { try { //determine the package for this type. QName qName = simpleType.getQName(); if (qName == null) { qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME); } metainf.addtStatus(qName, SchemaConstants.SIMPLE_TYPE_OR_CONTENT); return process(qName, metainf, typeMap, groupTypeMap, true, false); } catch (SchemaCompilationException e) { throw e; } catch (Exception e) { throw new SchemaCompilationException(e); } } /** * @param rootDir * @throws java.io.IOException * @see org.apache.axis2.schema.writer.BeanWriter */ private void initWithFile(File rootDir) throws IOException { if (rootDir == null) { this.rootDir = new File("."); } else if (!rootDir.isDirectory()) { throw new IOException(SchemaCompilerMessages.getMessage("schema.rootnotfolderexception")); } else { this.rootDir = rootDir; } namesList = new ArrayList(); javaBeanTemplateName = SchemaPropertyLoader.getBeanTemplate(); } /** * Make the fully qualified class name for an element or named type * * @param qName the qualified Name for this element or type in the schema * @return the appropriate fully qualified class name to use in generated code */ public String makeFullyQualifiedClassName(QName qName) { String originalName = qName.getLocalPart(); return makeUniqueCStructName(this.namesList, originalName); } /** * A util method that holds common code * for the complete schema that the generated XML complies to * look under other/beanGenerationSchema.xsd * * @param qName * @param metainf * @param typeMap * @param isElement * @return Returns String. * @throws Exception */ private String process(QName qName, BeanWriterMetaInfoHolder metainf, Map typeMap, Map groupTypeMap, boolean isElement, boolean isAbstract) throws Exception { String fullyQualifiedClassName = metainf.getOwnClassName(); if (fullyQualifiedClassName == null) fullyQualifiedClassName = makeFullyQualifiedClassName(qName); String className = fullyQualifiedClassName; String originalName = qName == null? "" : qName.getLocalPart(); ArrayList propertyNames = new ArrayList(); if (!templateLoaded) { loadTemplate(); } //if wrapped then do not write the classes now but add the models to a global document. However in order to write the //global class that is generated, one needs to call the writeBatch() method if (wrapClasses) { globalWrappedSourceDocument.getDocumentElement().appendChild( getBeanElement(globalWrappedSourceDocument, className, originalName, qName, isElement, isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); globalWrappedHeaderDocument.getDocumentElement().appendChild( getBeanElement(globalWrappedHeaderDocument, className, originalName, qName, isElement, isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); } else { //create the model Document modelSource = XSLTUtils.getDocument(); Document modelHeader = XSLTUtils.getDocument(); //make the XML modelSource.appendChild(getBeanElement(modelSource, className, originalName, qName, isElement, isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); modelHeader.appendChild(getBeanElement(modelHeader, className, originalName, qName, isElement, isAbstract, metainf, propertyNames, typeMap, groupTypeMap)); if (writeClasses) { //create the file File outSource = createOutFile(className, ".c"); File outHeader = createOutFile(className, ".h"); //parse with the template and create the files parseSource(modelSource, outSource); parseHeader(modelHeader, outHeader); } //add the model to the model map modelMap.put( new QName(qName.getNamespaceURI(), className) , modelSource); modelMap.put( new QName(qName.getNamespaceURI(), className) , modelHeader); ///////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(modelSource.getFirstChild())); ///////////////////////////////////////////////////// } //return the fully qualified class name return fullyQualifiedClassName; } /** * @param model * @param className * @param originalName * @param qName * @param isElement * @param metainf * @param propertyNames * @param typeMap * @return Returns Element. * @throws org.apache.axis2.schema.SchemaCompilationException * */ private Element getBeanElement( Document model, String className, String originalName, QName qName, boolean isElement, boolean isAbstract, BeanWriterMetaInfoHolder metainf, ArrayList propertyNames, Map typeMap, Map groupTypeMap) throws SchemaCompilationException { Element rootElt = XSLTUtils.getElement(model, "class"); XSLTUtils.addAttribute(model, "name", className, rootElt); XSLTUtils.addAttribute(model, "caps-name", className.toUpperCase(), rootElt); XSLTUtils.addAttribute(model, "originalName", originalName, rootElt); XSLTUtils.addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt); XSLTUtils.addAttribute(model, "nsprefix", getPrefixForURI(qName.getNamespaceURI(), qName.getPrefix()), rootElt); /* use caps for macros */ String capsName = className.toUpperCase(); XSLTUtils.addAttribute(model, "caps-name", capsName, rootElt); if (!wrapClasses) { XSLTUtils.addAttribute(model, "unwrapped", "yes", rootElt); } if (isAbstract) { XSLTUtils.addAttribute(model, "isAbstract", "yes", rootElt); } if (!writeClasses) { XSLTUtils.addAttribute(model, "skip-write", "yes", rootElt); } if (!isElement) { XSLTUtils.addAttribute(model, "type", "yes", rootElt); } if (metainf.isAnonymous()) { XSLTUtils.addAttribute(model, "anon", "yes", rootElt); } if (metainf.isExtension()) { XSLTUtils.addAttribute(model, "extension", metainf.getExtensionClassName(), rootElt); } if (metainf.isRestriction()) { XSLTUtils.addAttribute(model, "restriction", metainf .getRestrictionClassName(), rootElt); } if (metainf.isChoice()) { XSLTUtils.addAttribute(model, "choice", "yes", rootElt); } if (metainf.isSimple()) { XSLTUtils.addAttribute(model, "simple", "yes", rootElt); } if (metainf.isUnion()) { XSLTUtils.addAttribute(model, "union", "yes", rootElt); } if (metainf.isList()) { XSLTUtils.addAttribute(model, "list", "yes", rootElt); } if (metainf.isOrdered()) { XSLTUtils.addAttribute(model, "ordered", "yes", rootElt); } if (isElement && metainf.isNillable(qName)) { XSLTUtils.addAttribute(model, "nillable", "yes", rootElt); } if (metainf.isParticleClass()) { XSLTUtils.addAttribute(model, "particleClass", "yes", rootElt); } if (metainf.isHasParticleType()){ XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt); } //populate all the information populateInfo(metainf, model, rootElt, propertyNames, typeMap, groupTypeMap, false); if (metainf.isSimple() && metainf.isUnion()) { populateMemberInfo(metainf, model, rootElt, typeMap); } if (metainf.isSimple() && metainf.isList()) { populateListInfo(metainf, model, rootElt, typeMap, groupTypeMap); } return rootElt; } protected void populateListInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map typeMap, Map groupTypeMap) { String cName = makeUniqueCStructName(new ArrayList(), metainf.getItemTypeQName().getLocalPart()); Element itemType = XSLTUtils.addChildElement(model, "itemtype", rootElement); XSLTUtils.addAttribute(model, "type", metainf.getItemTypeClassName(), itemType); XSLTUtils.addAttribute(model, "nsuri", metainf.getItemTypeQName().getNamespaceURI(), itemType); XSLTUtils.addAttribute(model, "originalName", metainf.getItemTypeQName().getLocalPart(), itemType); XSLTUtils.addAttribute(model, "cname", cName, itemType); if (typeMap.containsKey(metainf.getItemTypeQName()) || groupTypeMap.containsKey(metainf.getItemTypeClassName())) { XSLTUtils.addAttribute(model, "ours", "true", itemType); } if (PrimitiveTypeFinder.isPrimitive(metainf.getItemTypeClassName())) { XSLTUtils.addAttribute(model, "primitive", "yes", itemType); } } protected void populateMemberInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map typeMap) { Map memberTypes = metainf.getMemberTypes(); QName memberQName; for (Iterator iter = memberTypes.keySet().iterator(); iter.hasNext();) { memberQName = (QName) iter.next(); String memberClass = (String) memberTypes.get(memberQName); if (PrimitiveTypeFinder.isPrimitive(memberClass)) { memberClass = PrimitiveTypeWrapper.getWrapper(memberClass); } // add member type element Element memberType = XSLTUtils.addChildElement(model, "memberType", rootElement); XSLTUtils.addAttribute(model, "type", memberClass, memberType); XSLTUtils.addAttribute(model, "nsuri", memberQName.getNamespaceURI(), memberType); XSLTUtils.addAttribute(model, "originalName", memberQName.getLocalPart(), memberType); XSLTUtils.addAttribute(model, "caps-originalName", memberQName.getLocalPart().toUpperCase(), memberType); if (typeMap.containsKey(memberQName)) { XSLTUtils.addAttribute(model, "ours", "true", memberType); } } } /** * @param metainf * @param model * @param rootElt * @param propertyNames * @param typeMap * @throws org.apache.axis2.schema.SchemaCompilationException * */ private void populateInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElt, ArrayList propertyNames, Map typeMap, Map groupTypeMap, boolean isInherited) throws SchemaCompilationException { if (metainf.getParent() != null && (!metainf.isRestriction() || (metainf.isRestriction() && metainf.isSimple()))) { populateInfo(metainf.getParent(), model, rootElt, propertyNames, typeMap, groupTypeMap, true); } addPropertyEntries(metainf, model, rootElt, propertyNames, typeMap, groupTypeMap, isInherited); } /** * @param metainf * @param model * @param rootElt * @param propertyNames * @param typeMap * @throws org.apache.axis2.schema.SchemaCompilationException - * */ private void addPropertyEntries(BeanWriterMetaInfoHolder metainf, Document model, Element rootElt, ArrayList propertyNames, Map typeMap, Map groupTypeMap, boolean isInherited) throws SchemaCompilationException { // go in the loop and add the part elements QName[] qName; ArrayList missingQNames = new ArrayList(); ArrayList qNames = new ArrayList(); BeanWriterMetaInfoHolder parentMetaInf = metainf.getParent(); if (metainf.isOrdered()) { qName = metainf.getOrderedQNameArray(); } else { qName = metainf.getQNameArray(); } for (int i = 0; i < qName.length; i++) { qNames.add(qName[i]); } //adding missing QNames to the end, including elements & attributes. // for the simple types we have already add the parent elements // it is almost consider as an extension if (metainf.isRestriction() && !metainf.isSimple()) { addMissingQNames(metainf, qNames, missingQNames); } QName name; for (int i = 0; i < qName.length; i++) { Element property = XSLTUtils.addChildElement(model, "property", rootElt); name = qName[i]; String xmlName = makeUniqueCStructName(new ArrayList(), name.getLocalPart()); XSLTUtils.addAttribute(model, "name", name.getLocalPart(), property); XSLTUtils.addAttribute(model, "originalName", name.getLocalPart(), property); XSLTUtils.addAttribute(model, "nsuri", name.getNamespaceURI(), property); XSLTUtils.addAttribute(model, "prefix", name.getPrefix(), property); XSLTUtils.addAttribute(model, "cname", xmlName, property); String CClassNameForElement = metainf.getClassNameForQName(name); if (CClassNameForElement == null) { CClassNameForElement = CStructWriter.DEFAULT_C_CLASS_NAME; } CClassNameForElement = getShortTypeName(CClassNameForElement); XSLTUtils.addAttribute(model, "type", CClassNameForElement, property); /** * Caps for use in C macros */ XSLTUtils.addAttribute(model, "caps-cname", xmlName.toUpperCase(), property); XSLTUtils.addAttribute(model, "caps-type", CClassNameForElement.toUpperCase(), property); if (PrimitiveTypeFinder.isPrimitive(CClassNameForElement)) { XSLTUtils.addAttribute(model, "primitive", "yes", property); } //add an attribute that says the type is default if (isDefault(CClassNameForElement)) { XSLTUtils.addAttribute(model, "default", "yes", property); } // add the default value if (metainf.isDefaultValueAvailable(name)){ QName schemaQName = metainf.getSchemaQNameForQName(name); if (baseTypeMap.containsKey(schemaQName)){ XSLTUtils.addAttribute(model, "defaultValue", metainf.getDefaultValueForQName(name), property); } } if (typeMap.containsKey(metainf.getSchemaQNameForQName(name)) || (metainf.getSchemaQNameForQName(name) == null || !metainf.getSchemaQNameForQName(name).getNamespaceURI().equals(DEFAULT_TYPE_NS)) && !CClassNameForElement.equals(DEFAULT_C_CLASS_NAME) && !CClassNameForElement.equals(DEFAULT_ATTRIB_CLASS_NAME)) { XSLTUtils.addAttribute(model, "ours", "yes", property); } if (metainf.getAttributeStatusForQName(name)) { XSLTUtils.addAttribute(model, "attribute", "yes", property); }else{ XSLTUtils.addAttribute(model, "notattribute", "yes", property); } if (metainf.isNillable(name)) { XSLTUtils.addAttribute(model, "nillable", "yes", property); } String shortTypeName; if (metainf.getSchemaQNameForQName(name) != null) { //see whether the QName is a basetype if (baseTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) { shortTypeName = metainf.getSchemaQNameForQName(name).getLocalPart(); } else { shortTypeName = getShortTypeName(CClassNameForElement); } } else { shortTypeName = getShortTypeName(CClassNameForElement); } XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, property); if (isInherited) { XSLTUtils.addAttribute(model, "inherited", "yes", property); } if (metainf.getAnyStatusForQName(name)) { XSLTUtils.addAttribute(model, "any", "yes", property); } if (metainf.getBinaryStatusForQName(name)) { XSLTUtils.addAttribute(model, "binary", "yes", property); } if (metainf.getSimpleStatusForQName(name)) { XSLTUtils.addAttribute(model, "simple", "yes", property); } //put the min occurs count irrespective of whether it's an array or not long minOccurs = metainf.getMinOccurs(name); XSLTUtils.addAttribute(model, "minOccurs", minOccurs + "", property); if (metainf.getArrayStatusForQName(name)) { String attrName = name.getLocalPart(); int arrayTokenStart = attrName.indexOf("Array"); if (arrayTokenStart >= 0) { String arrayEle = attrName.substring(0, arrayTokenStart); XSLTUtils.addAttribute(model, "arrayele", arrayEle, property); } XSLTUtils.addAttribute(model, "isarray", "yes", property); XSLTUtils.addAttribute( model, "arrayBaseType", CClassNameForElement, property); long maxOccurs = metainf.getMaxOccurs(name); if (maxOccurs == Long.MAX_VALUE) { XSLTUtils.addAttribute(model, "unbound", "yes", property); } XSLTUtils.addAttribute(model, "maxOccurs", maxOccurs + "", property); } if ((parentMetaInf != null) && metainf.isRestriction() && missingQNames.contains(name)) { // this element details should be there with the parent meta Inf addAttributesToProperty( parentMetaInf, name, model, property, typeMap, groupTypeMap, CClassNameForElement); } else { addAttributesToProperty( metainf, name, model, property, typeMap, groupTypeMap, CClassNameForElement); } } } private void addAttributesToProperty(BeanWriterMetaInfoHolder metainf, QName name, Document model, Element property, Map typeMap, Map groupTypeMap, String CClassNameForElement) { // add an attribute that says the type is default if (metainf.getDefaultStatusForQName(name)) { XSLTUtils.addAttribute(model, "default", "yes", property); } if (typeMap.containsKey(metainf.getSchemaQNameForQName(name)) || groupTypeMap.containsKey(metainf.getSchemaQNameForQName(name)) || (metainf.getSchemaQNameForQName(name) == null || !metainf.getSchemaQNameForQName(name).getNamespaceURI().equals(DEFAULT_TYPE_NS)) && !CClassNameForElement.equals(DEFAULT_C_CLASS_NAME) && !CClassNameForElement.equals(DEFAULT_ATTRIB_CLASS_NAME)) { XSLTUtils.addAttribute(model, "ours", "yes", property); } if (metainf.getAttributeStatusForQName(name)) { XSLTUtils.addAttribute(model, "attribute", "yes", property); } if (metainf.isNillable(name)) { XSLTUtils.addAttribute(model, "nillable", "yes", property); } if (metainf.getOptionalAttributeStatusForQName(name)) { XSLTUtils.addAttribute(model, "optional", "yes", property); } String shortTypeName; if (metainf.getSchemaQNameForQName(name) != null) { // see whether the QName is a basetype if (baseTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) { shortTypeName = metainf.getSchemaQNameForQName(name).getLocalPart(); } else { shortTypeName = getShortTypeName(CClassNameForElement); } } else { shortTypeName = getShortTypeName(CClassNameForElement); } XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, property); if (metainf.getAnyStatusForQName(name)) { XSLTUtils.addAttribute(model, "any", "yes", property); } if (metainf.getBinaryStatusForQName(name)) { XSLTUtils.addAttribute(model, "binary", "yes", property); } if (metainf.isSimple() || metainf.getSimpleStatusForQName(name)) { XSLTUtils.addAttribute(model, "simple", "yes", property); } // put the min occurs count irrespective of whether it's an array or // not long minOccurs = metainf.getMinOccurs(name); XSLTUtils.addAttribute(model, "minOccurs", minOccurs + "", property); if (metainf.getArrayStatusForQName(name)) { XSLTUtils.addAttribute(model, "array", "yes", property); int endIndex = CClassNameForElement.indexOf("["); if (endIndex >= 0) { XSLTUtils.addAttribute(model, "arrayBaseType", CClassNameForElement.substring(0, endIndex), property); } else { XSLTUtils.addAttribute(model, "arrayBaseType", CClassNameForElement, property); } long maxOccurs = metainf.getMaxOccurs(name); if (maxOccurs == Long.MAX_VALUE) { XSLTUtils.addAttribute(model, "unbound", "yes", property); } else { XSLTUtils.addAttribute(model, "maxOccurs", maxOccurs + "", property); } } if (metainf.isRestrictionBaseType(name)) { XSLTUtils.addAttribute(model, "restrictionBaseType", "yes", property); } if (metainf.isExtensionBaseType(name)) { XSLTUtils.addAttribute(model, "extensionBaseType", "yes", property); } if (metainf.isRestrictionBaseType(name) && metainf.getLengthFacet() != -1) { XSLTUtils.addAttribute(model, "lenFacet", metainf.getLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxLengthFacet() != -1) { XSLTUtils.addAttribute(model, "maxLenFacet", metainf.getMaxLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinLengthFacet() != -1) { XSLTUtils.addAttribute(model, "minLenFacet", metainf.getMinLengthFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxExclusiveFacet() != null) { XSLTUtils.addAttribute(model, "maxExFacet", metainf.getMaxExclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinExclusiveFacet() != null) { XSLTUtils.addAttribute(model, "minExFacet", metainf.getMinExclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMaxInclusiveFacet() != null) { XSLTUtils.addAttribute(model, "maxInFacet", metainf.getMaxInclusiveFacet() + "", property); } if (metainf.isRestrictionBaseType(name) && metainf.getMinInclusiveFacet() != null) { XSLTUtils.addAttribute(model, "minInFacet", metainf.getMinInclusiveFacet() + "", property); } if (!metainf.getEnumFacet().isEmpty()) { boolean validJava = true; // Assume all enum values are valid ids Iterator iterator = metainf.getEnumFacet().iterator(); // Walk the values looking for invalid ids while (iterator.hasNext()) { String value = (String) iterator.next(); if (!JavaUtils.isJavaId(value)) { validJava = false; } } int id = 0; iterator = metainf.getEnumFacet().iterator(); while (iterator.hasNext()) { Element enumFacet = XSLTUtils.addChildElement(model, "enumFacet", property); String attribValue = (String) iterator.next(); XSLTUtils.addAttribute(model, "value", attribValue, enumFacet); if (validJava) { XSLTUtils.addAttribute(model, "id", attribValue, enumFacet); } else { id++; XSLTUtils.addAttribute(model, "id", "value" + id, enumFacet); } } } if (metainf.isRestrictionBaseType(name) && metainf.getPatternFacet() != null) { XSLTUtils.addAttribute(model, "patternFacet", metainf.getPatternFacet(), property); } } private void addMissingQNames(BeanWriterMetaInfoHolder metainf, ArrayList qName, ArrayList missingQNames) { QName[] qNames = null; QName[] pQNames = null; BeanWriterMetaInfoHolder parentMetaInf = metainf.getParent(); if (metainf.isOrdered()) { qNames = metainf.getOrderedQNameArray(); } else { qNames = metainf.getQNameArray(); } if (parentMetaInf != null) { if (parentMetaInf.isOrdered()) { pQNames = parentMetaInf.getOrderedQNameArray(); } else { pQNames = parentMetaInf.getQNameArray(); } } for (int i = 0; pQNames != null && i < pQNames.length; i++) { if (qNameNotFound(pQNames[i], metainf)) { missingQNames.add(pQNames[i]); } } //adding missing QNames to the end of list. if (!missingQNames.isEmpty()) { for (int i = 0; i < missingQNames.size(); i++) { qName.add(missingQNames.get(i)); } } } private boolean qNameNotFound(QName qname, BeanWriterMetaInfoHolder metainf) { boolean found = false; QName[] qNames; if (metainf.isOrdered()) { qNames = metainf.getOrderedQNameArray(); } else { qNames = metainf.getQNameArray(); } for (int j = 0; j < qNames.length; j++) { if (qname.getLocalPart().equals(qNames[j].getLocalPart())) { found = true; } } return !found; } /** * Test whether the given class name matches the default * * @param CClassNameForElement * @return bool */ private boolean isDefault(String CClassNameForElement) { return getDefaultClassName().equals(CClassNameForElement) || getDefaultClassArrayName().equals(CClassNameForElement); } /** * Given the xml name, make a unique class name taking into account that some * file systems are case sensitive and some are not. * -Consider the Jax-WS spec for this * * @param listOfNames * @param xmlName * @return Returns String. */ private String makeUniqueCStructName(List listOfNames, String xmlName) { String cName; if (CUtils.isCKeyword(xmlName)) { cName = CUtils.makeNonCKeyword(xmlName); } else { //javaName = JavaUtils.capitalizeFirstChar(JavaUtils.xmlNameToJava(xmlName)); cName = xmlName; } while (listOfNames.contains(cName.toLowerCase())) { cName = cName + CStructWriter.count++; } String intName = cName.replace('.','_'); String outName = intName.replace('-','_'); listOfNames.add(outName.toLowerCase()); return outName; } /** * A bit of code from the old code generator. We are better off using the template * engines and such stuff that's already there. But the class writers are hard to be * reused so some code needs to be repeated (atleast a bit) */ private void loadTemplate() throws SchemaCompilationException { //first get the language specific property map Class clazz = this.getClass(); InputStream xslStream; String templateName = javaBeanTemplateName; if (templateName != null) { try { String sourceTemplateName = templateName + "Source.xsl"; xslStream = clazz.getResourceAsStream(sourceTemplateName); sourceTemplateCache = TransformerFactory.newInstance().newTemplates(new StreamSource(xslStream)); String headerTemplateName = templateName + "Header.xsl"; xslStream = clazz.getResourceAsStream(headerTemplateName); headerTemplateCache = TransformerFactory.newInstance().newTemplates(new StreamSource(xslStream)); templateLoaded = true; } catch (TransformerConfigurationException e) { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.templateLoadException"), e); } } else { throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.templateNotFoundException")); } } /** * Creates the output file * * @param fileName * @param extension * @throws Exception */ protected File createOutFile(String fileName, String extension) throws Exception { return org.apache.axis2.util.FileWriter.createClassFile(this.rootDir, "", AXIS2_PREFIX + fileName, extension); } /** * Writes the output file * * @param doc * @param outputFile * @throws Exception */ private void parseSource(Document doc, File outputFile) throws Exception { OutputStream outStream = new FileOutputStream(outputFile); XSLTTemplateProcessor.parse(outStream, doc, this.sourceTemplateCache.newTransformer()); outStream.write('\n'); outStream.write('\n'); outStream.flush(); outStream.close(); } /** * Writes the output file * * @param doc * @param outputFile * @throws Exception */ private void parseHeader(Document doc, File outputFile) throws Exception { OutputStream outStream = new FileOutputStream(outputFile); XSLTTemplateProcessor.parse(outStream, doc, this.headerTemplateCache.newTransformer()); outStream.write('\n'); outStream.write('\n'); outStream.flush(); outStream.close(); } /** * Get a prefix for a namespace URI. This method will ALWAYS * return a valid prefix - if the given URI is already mapped in this * serialization, we return the previous prefix. If it is not mapped, * we will add a new mapping and return a generated prefix of the form * "ns". * * @param uri is the namespace uri * @return Returns prefix. */ public String getPrefixForURI(String uri) { return getPrefixForURI(uri, null); } /** * Last used index suffix for "ns" */ private int lastPrefixIndex = 1; /** * Map of namespaces URI to prefix(es) */ HashMap mapURItoPrefix = new HashMap(); HashMap mapPrefixtoURI = new HashMap(); /** * Get a prefix for the given namespace URI. If one has already been * defined in this serialization, use that. Otherwise, map the passed * default prefix to the URI, and return that. If a null default prefix * is passed, use one of the form "ns" */ public String getPrefixForURI(String uri, String defaultPrefix) { if ((uri == null) || (uri.length() == 0)) return null; String prefix = (String) mapURItoPrefix.get(uri); if (prefix == null) { if (defaultPrefix == null || defaultPrefix.length() == 0) { prefix = "ns" + lastPrefixIndex++; while (mapPrefixtoURI.get(prefix) != null) { prefix = "ns" + lastPrefixIndex++; } } else { prefix = defaultPrefix; } mapPrefixtoURI.put(prefix, uri); mapURItoPrefix.put(uri, prefix); } return prefix; } private String getShortTypeName(String typeClassName) { if (typeClassName.endsWith("[]")) { typeClassName = typeClassName.substring(0, typeClassName.lastIndexOf("[")); } return typeClassName; } /** * Keep unimplemented * * @param mapperPackageName * @see BeanWriter#registerExtensionMapperPackageName(String) */ public void registerExtensionMapperPackageName(String mapperPackageName) { //unimplemented } /** * Keep unimplemented * * @param metainfArray * @see BeanWriter#writeExtensionMapper(org.apache.axis2.schema.BeanWriterMetaInfoHolder[]) */ public void writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray) throws SchemaCompilationException { //unimplemented } /** * Keep unimplemented * * @see BeanWriter#getExtensionMapperPackageName() */ public String getExtensionMapperPackageName() { return null; } } ./src/org/apache/axis2/schema/ExtensionUtility.java0000664000175000017500000007154211767656530021506 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.schema.typemap.JavaTypeMap; import org.apache.axis2.schema.typemap.TypeMap; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.databinding.CTypeMapper; import org.apache.axis2.wsdl.databinding.DefaultTypeMapper; import org.apache.axis2.wsdl.databinding.JavaTypeMapper; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.util.Constants; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaAny; import org.apache.ws.commons.schema.XmlSchemaAttribute; import org.apache.ws.commons.schema.XmlSchemaComplexContent; import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaContent; import org.apache.ws.commons.schema.XmlSchemaContentModel; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaImport; import org.apache.ws.commons.schema.XmlSchemaInclude; import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.XmlSchemaObjectCollection; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaSimpleType; import org.apache.ws.commons.schema.XmlSchemaType; import javax.xml.namespace.QName; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * This is the utility for the extension to call by reflection. */ public class ExtensionUtility { public static void invoke(CodeGenConfiguration configuration) throws Exception { List schemaList = new ArrayList(); // add all the schemas to the list List services = configuration.getAxisServices(); for (Iterator iter = services.iterator();iter.hasNext();){ schemaList.addAll(((AxisService)iter.next()).getSchema()); } //hashmap that keeps the targetnamespace and the xmlSchema object //this is a convenience to locate the relevant schema quickly //by looking at the target namespace Map schemaMap = new HashMap(); populateSchemaMap(schemaMap, schemaList); if (schemaList == null || schemaList.isEmpty()) { //there are no types to be code generated //However if the type mapper is left empty it will be a problem for the other //processes. Hence the default type mapper is set to the configuration configuration.setTypeMapper(new DefaultTypeMapper()); return; } //call the schema compiler CompilerOptions options = new CompilerOptions(); //set the default options populateDefaultOptions(options, configuration); //set the user parameters. the user parameters get the preference over //the default ones. But the user better know what he's doing if he //used module specific parameters populateUserparameters(options, configuration); SchemaCompiler schemaCompiler = new SchemaCompiler(options); // run the schema compiler schemaCompiler.compile(schemaList); //create the type mapper //First try to take the one that is already there TypeMapper mapper = configuration.getTypeMapper(); if (mapper == null) { if (configuration.getOutputLanguage() != null && !configuration.getOutputLanguage().trim().equals("") && configuration.getOutputLanguage().toLowerCase().equals("c")) { mapper = new CTypeMapper(); } else { mapper = new JavaTypeMapper(); } } if (options.isWriteOutput()) { //get the processed element map and transfer it to the type mapper Map processedMap = schemaCompiler.getProcessedElementMap(); Iterator processedkeys = processedMap.keySet().iterator(); QName qNameKey; while (processedkeys.hasNext()) { qNameKey = (QName) processedkeys.next(); mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString()); } } else { //get the processed model map and transfer it to the type mapper //since the options mentiond that its not writable, it should have //populated the model map Map processedModelMap = schemaCompiler.getProcessedModelMap(); Iterator processedkeys = processedModelMap.keySet().iterator(); QName qNameKey; while (processedkeys.hasNext()) { qNameKey = (QName) processedkeys.next(); mapper.addTypeMappingObject(qNameKey, processedModelMap.get(qNameKey)); } Map processedMap = schemaCompiler.getProcessedElementMap(); processedkeys = processedMap.keySet().iterator(); while (processedkeys.hasNext()) { qNameKey = (QName) processedkeys.next(); mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString()); } //get the ADB template from the schema compilers property bag and set the //template configuration.putProperty(Constants.EXTERNAL_TEMPLATE_PROPERTY_KEY, schemaCompiler.getCompilerProperties().getProperty( SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TEMPLATE_KEY)); } //process the unwrapped parameters if (!configuration.isParametersWrapped()) { //figure out the unwrapped operations List axisServices = configuration.getAxisServices(); AxisService axisService; for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) { axisService = (AxisService) servicesIter.next(); for (Iterator operations = axisService.getOperations(); operations.hasNext();) { AxisOperation op = (AxisOperation) operations.next(); if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) { walkSchema(op.getMessage( WSDLConstants.MESSAGE_LABEL_IN_VALUE), mapper, schemaMap, op.getName().getLocalPart(), WSDLConstants.INPUT_PART_QNAME_SUFFIX); } // TODO: support for xml beans if (configuration.getDatabindingType().equals("adb")) { if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) { walkSchema(op.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE), mapper, schemaMap, op.getName().getLocalPart(), WSDLConstants.OUTPUT_PART_QNAME_SUFFIX); } } } } } //put the complext types for the top level elements having them // this is needed in unwrapping and to provide backwordCompatibility if (!configuration.isParametersWrapped() || configuration.isBackwordCompatibilityMode()) { List axisServices = configuration.getAxisServices(); AxisService axisService; for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) { axisService = (AxisService) servicesIter.next(); AxisOperation axisOperation; AxisMessage axisMessage; for (Iterator operators = axisService.getOperations(); operators.hasNext();) { axisOperation = (AxisOperation) operators.next(); if (WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) { axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); setComplexTypeName(axisMessage); } if (WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())) { axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); setComplexTypeName(axisMessage); } } } } //set the type mapper to the config configuration.setTypeMapper(mapper); } /** * set the complext type class name as an message parameter if it exits * @param axisMessage */ private static void setComplexTypeName(AxisMessage axisMessage) throws AxisFault { if (axisMessage.getSchemaElement() != null){ XmlSchemaElement schemaElement = axisMessage.getSchemaElement(); XmlSchemaType schemaType = schemaElement.getSchemaType(); QName schemaTypeQname = schemaElement.getSchemaTypeName(); if (schemaType == null) { if (schemaTypeQname != null) { // find the schema type from all the schemas // now we need to get the schema of the extension type from the parent schema. For that let's first retrieve // the parent schema AxisService axisService = axisMessage.getAxisOperation().getAxisService(); ArrayList schemasList = axisService.getSchema(); XmlSchema schema = null; for (Iterator iter = schemasList.iterator(); iter.hasNext();) { schema = (XmlSchema) iter.next(); schemaType = getSchemaType(schema, schemaTypeQname); if (schemaType != null) { break; } } } } if (schemaType instanceof XmlSchemaComplexType){ XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType; if ((complexType.getName() != null) && (complexType.getQName() != null)) { Map metaInfo = complexType.getMetaInfoMap(); String complexTypeName = (String) metaInfo.get(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY); if (complexTypeName.endsWith("[]")){ complexTypeName = complexTypeName.substring(0,complexTypeName.length() -2); } // store the complext type name to process later axisMessage.addParameter(new Parameter(Constants.COMPLEX_TYPE, complexTypeName)); } } } } /** * Populate the schema objects into the * * @param schemaMap * @param schemaList */ private static void populateSchemaMap(Map schemaMap, List schemaList) { for (int i = 0; i < schemaList.size(); i++) { XmlSchema xmlSchema = (XmlSchema) schemaList.get(i); schemaMap.put(xmlSchema.getTargetNamespace(), xmlSchema); } } /** * @param message * @param mapper */ private static void walkSchema(AxisMessage message, TypeMapper mapper, Map schemaMap, String opName, String qnameSuffix) { if (message.getParameter(Constants.UNWRAPPED_KEY) != null) { XmlSchemaElement schemaElement = message.getSchemaElement(); XmlSchemaType schemaType = schemaElement.getSchemaType(); QName schemaTypeQname = schemaElement.getSchemaTypeName(); if (schemaType == null) { if (schemaTypeQname != null) { // find the schema type from all the schemas // now we need to get the schema of the extension type from the parent schema. For that let's first retrieve // the parent schema AxisService axisService = message.getAxisOperation().getAxisService(); ArrayList schemasList = axisService.getSchema(); XmlSchema schema = null; for (Iterator iter = schemasList.iterator(); iter.hasNext();) { schema = (XmlSchema) iter.next(); schemaType = getSchemaType(schema, schemaTypeQname); if (schemaType != null) { break; } } } } //create a type mapper TypeMap basicTypeMap = new JavaTypeMap(); if (schemaType instanceof XmlSchemaComplexType) { processXMLSchemaComplexType(schemaType, mapper, opName, schemaMap, qnameSuffix); } else if ((schemaTypeQname != null) && basicTypeMap.getTypeMap().containsKey(schemaTypeQname)){ QName partQName = WSDLUtil.getPartQName(opName, qnameSuffix, message.getElementQName().getLocalPart()); mapper.addTypeMappingName(partQName, (String)basicTypeMap.getTypeMap().get(schemaTypeQname)); } else if (schemaType instanceof XmlSchemaSimpleType) { XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) schemaType; populateClassName(xmlSchemaSimpleType.getMetaInfoMap(), mapper, opName, false, message.getElementQName().getLocalPart(), qnameSuffix); // handle xsd:anyType } } } private static void processXMLSchemaComplexType(XmlSchemaType schemaType, TypeMapper mapper, String opName, Map schemaMap, String qnameSuffix) { if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType; if (cmplxType.getContentModel() == null) { processSchemaSequence(cmplxType.getParticle(), mapper, opName, schemaMap, qnameSuffix); } else { processComplexContentModel(cmplxType, mapper, opName, schemaMap, qnameSuffix); } processAttributes(cmplxType, opName, qnameSuffix, mapper); } } private static void processAttributes(XmlSchemaComplexType complexType, String opName, String qnameSuffix, TypeMapper typeMap) { XmlSchemaObjectCollection xmlObjectCollection = complexType.getAttributes(); XmlSchemaObject item; for (Iterator iter = xmlObjectCollection.getIterator(); iter.hasNext();) { item = (XmlSchemaObject) iter.next(); XmlSchemaAttribute xmlSchemaAttribute; if (item instanceof XmlSchemaAttribute) { xmlSchemaAttribute = (XmlSchemaAttribute) item; populateClassName(xmlSchemaAttribute.getMetaInfoMap(), typeMap, opName, false, xmlSchemaAttribute.getName(), qnameSuffix); } } } private static XmlSchemaType getSchemaType(XmlSchema schema, QName typeName) { XmlSchemaType xmlSchemaType = null; if (schema != null) { xmlSchemaType = schema.getTypeByName(typeName); if (xmlSchemaType == null) { // try to find in an import or an include XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { Iterator includesIter = includes.getIterator(); Object object = null; while (includesIter.hasNext()) { object = includesIter.next(); if (object instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaType = getSchemaType(schema1,typeName); } if (object instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaType = getSchemaType(schema1,typeName); } if (xmlSchemaType != null){ break; } } } } } return xmlSchemaType; } private static void processComplexContentModel(XmlSchemaComplexType cmplxType, TypeMapper mapper, String opName, Map schemaMap, String qnameSuffix) { XmlSchemaContentModel contentModel = cmplxType.getContentModel(); if (contentModel instanceof XmlSchemaComplexContent) { XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent) contentModel; XmlSchemaContent content = xmlSchemaComplexContent.getContent(); if (content instanceof XmlSchemaComplexContentExtension) { XmlSchemaComplexContentExtension schemaExtension = (XmlSchemaComplexContentExtension) content; // process particles inside this extension, if any processSchemaSequence(schemaExtension.getParticle(), mapper, opName, schemaMap, qnameSuffix); XmlSchema xmlSchema = null; XmlSchemaType extensionSchemaType = null; for (Iterator iter = schemaMap.values().iterator();iter.hasNext();){ xmlSchema = (XmlSchema) iter.next(); extensionSchemaType = getSchemaType(xmlSchema,schemaExtension.getBaseTypeName()); if (extensionSchemaType != null){ break; } } processXMLSchemaComplexType(extensionSchemaType, mapper, opName, schemaMap, qnameSuffix); } } } private static void processSchemaSequence(XmlSchemaParticle particle, TypeMapper mapper, String opName, Map schemaMap, String qnameSuffix) { if (particle instanceof XmlSchemaSequence) { XmlSchemaObjectCollection items = ((XmlSchemaSequence) particle).getItems(); for (Iterator i = items.getIterator(); i.hasNext();) { Object item = i.next(); // get each and every element in the sequence and // traverse through them if (item instanceof XmlSchemaElement) { //populate the map with the partname - class name //attached to the schema element XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) item; boolean isArray = xmlSchemaElement.getMaxOccurs() > 1; XmlSchemaType schemaType = xmlSchemaElement.getSchemaType(); String partName = null; if (xmlSchemaElement.getRefName() != null) { partName = xmlSchemaElement.getRefName().getLocalPart(); } else { partName = xmlSchemaElement.getName(); } // get the element class name from the element and populate the mapper populateClassName(xmlSchemaElement.getMetaInfoMap(), mapper, opName, isArray, partName, qnameSuffix); } else if (item instanceof XmlSchemaAny) { // if this is an instance of xs:any, then there is no part name for it. Using ANY_ELEMENT_FIELD_NAME // for it for now XmlSchemaAny xmlSchemaAny = (XmlSchemaAny) item; boolean isArray = xmlSchemaAny.getMaxOccurs() > 1; QName partQName = WSDLUtil.getPartQName(opName, qnameSuffix, Constants.ANY_ELEMENT_FIELD_NAME); if (isArray) { mapper.addTypeMappingName(partQName, "org.apache.axiom.om.OMElement[]"); } else { mapper.addTypeMappingName(partQName, "org.apache.axiom.om.OMElement"); } } } } } // private static void /** * Util method to populate the class name into the typeMap * */ private static void populateClassName(Map metaInfoMap, TypeMapper typeMap, String opName, boolean isArray, String partName, String qnameSuffix) { if (metaInfoMap != null) { String className = (String) metaInfoMap. get(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY); // this is a temporary patch // the acual problem is keeping the class name details on the schemaType in // XmlSchema compiler. // we have to store them in XmlElement if (isArray && !className.endsWith("[]")) { className += "[]"; } else if (!isArray && className.endsWith("[]")) { className = className.substring(0, className.length() - 2); } QName partQName = WSDLUtil.getPartQName(opName, qnameSuffix, partName); typeMap.addTypeMappingName(partQName, className); if (Boolean.TRUE.equals( metaInfoMap.get(SchemaConstants. SchemaCompilerInfoHolder.CLASSNAME_PRIMITVE_KEY))) { //this type is primitive - add that to the type mapper status //for now lets add a boolean typeMap.addTypeMappingStatus(partQName, Boolean.TRUE); } } } /** * Look for a given schema type given the schema type Qname * * @param schemaMap * @return null if the schema is not found */ private static XmlSchemaType findSchemaType(Map schemaMap, QName schemaTypeName) { //find the schema XmlSchema schema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI()); if (schema != null) { return schema.getTypeByName(schemaTypeName); } return null; } /** * populate parameters from the user * * @param options */ private static void populateUserparameters(CompilerOptions options, CodeGenConfiguration configuration) { Map propertyMap = configuration.getProperties(); if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRAP_SCHEMA_CLASSES)) { if (Boolean.valueOf( propertyMap.get(SchemaConstants.SchemaCompilerArguments.WRAP_SCHEMA_CLASSES).toString()). booleanValue()) { options.setWrapClasses(true); } else { options.setWrapClasses(false); } } if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRITE_SCHEMA_CLASSES)) { if (Boolean.valueOf( propertyMap.get(SchemaConstants.SchemaCompilerArguments.WRITE_SCHEMA_CLASSES).toString()). booleanValue()) { options.setWriteOutput(true); } else { options.setWriteOutput(false); } } // add the custom package name if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.PACKAGE)) { String packageName = (String) propertyMap.get(SchemaConstants.SchemaCompilerArguments.PACKAGE); if (packageName != null || !"".equals(packageName)) { options.setPackageName(packageName); } } // set the package namespace to uri details options.setNs2PackageMap(configuration.getUri2PackageNameMap()); //add custom mapper package name if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.MAPPER_PACKAGE)) { String packageName = (String) propertyMap.get(SchemaConstants.SchemaCompilerArguments.MAPPER_PACKAGE); if (packageName != null || !"".equals(packageName)) { options.setMapperClassPackage(packageName); } } if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.OFF_STRICT_VALIDATION)){ options.setOffStrictValidation(true); } if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.USE_WRAPPER_CLASSES)){ options.setUseWrapperClasses(true); } //set helper mode //this becomes effective only if the classes are unpacked if (!options.isWrapClasses()) { if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.HELPER_MODE)) { options.setHelperMode(true); } } } /** * populate the default options - called before the applying of user parameters * * @param options */ private static void populateDefaultOptions(CompilerOptions options, CodeGenConfiguration configuration) { //create the output directory File outputDir = configuration.isFlattenFiles() ? configuration.getOutputLocation() : new File(configuration.getOutputLocation(), configuration.getSourceLocation()); if (!outputDir.exists()) { outputDir.mkdirs(); } /// these options need to be taken from the command line options.setOutputLocation(outputDir); options.setNs2PackageMap(configuration.getUri2PackageNameMap() == null ? new HashMap() : configuration.getUri2PackageNameMap()); //default setting is to set the wrap status depending on whether it's //the server side or the client side if (configuration.isServerSide()) { //for the serverside we generate unwrapped by default options.setWrapClasses(false); //for the serverside we write the output by default options.setWriteOutput(true); } else { // for the client let the users preference be the word here options.setWrapClasses(configuration.isPackClasses()); //for the client side the default setting is not to write the //output options.setWriteOutput(!configuration.isPackClasses()); } if (configuration.isGenerateAll()) { options.setGenerateAll(true); } if (configuration.isBackwordCompatibilityMode()) { options.setBackwordCompatibilityMode(true); } if (configuration.isSuppressPrefixesMode()) { options.setSuppressPrefixesMode(true); } } } ./src/org/apache/axis2/schema/SchemaCompilationException.java0000664000175000017500000000257711767656530023426 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.schema; /** * A simeple extension from the java.lang.exception to serve as the schema compilers * Exception */ public class SchemaCompilationException extends Exception { private static final long serialVersionUID = 2520939560060608157L; public SchemaCompilationException() { } public SchemaCompilationException(String message) { super(message); } public SchemaCompilationException(Throwable cause) { super(cause); } public SchemaCompilationException(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axis2/handlers/0000775000175000017500000000000011767656530015632 5ustar brianbrian./src/org/apache/axis2/handlers/AbstractHandler.java0000664000175000017500000000531711767656530021544 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.handlers; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.Handler; /** * Class AbstractHandler */ public abstract class AbstractHandler implements Handler { /** * Field handlerDesc */ protected HandlerDescription handlerDesc; /** * Constructor AbstractHandler. */ public AbstractHandler() { handlerDesc = new HandlerDescription("DefaultHandler"); } /** * Since this might change the whole behavior of Axis2 handlers, and since this is still under discussion * (http://marc.theaimsgroup.com/?l=axis-dev&m=114504084929285&w=2) implementation of this method is deferred. * Note : This method will not be automatically called, from Axis2 engine, until this is fully implemented. */ public void cleanup() { } /** * Method init. * */ public void init(HandlerDescription handlerdesc) { this.handlerDesc = handlerdesc; } /* * (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { String name = this.getName(); return (name != null) ? name : null; } /** * Gets the phaseRule of a handler. * * @return Returns HandlerDescription. */ public HandlerDescription getHandlerDesc() { return handlerDesc; } /** * Method getName. * * @return Returns QName. */ public String getName() { return handlerDesc.getName(); } /** * Method getParameter. * * @param name name of the parameter * @return Returns Parameter. */ public Parameter getParameter(String name) { return handlerDesc.getParameter(name); } public void flowComplete(MessageContext msgContext) { } } ./src/org/apache/axis2/namespace/0000775000175000017500000000000011767656530015766 5ustar brianbrian./src/org/apache/axis2/namespace/Constants.java0000664000175000017500000004412611767656530020614 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.namespace; import javax.xml.namespace.QName; public class Constants { public static final String AXIS2_NAMESPACE_URI = "http://ws.apache.org/namespaces/axis2"; public static final String AXIS2_NAMESPACE_PREFIX = "axis2"; // Namespace Prefix Constants ////////////////////////////////////////////////////////////////////////// public static final String NS_PREFIX_SOAP_ENV = "soapenv"; public static final String NS_PREFIX_SOAP_ENC = "soapenc"; public static final String NS_PREFIX_SCHEMA_XSI = "xsi"; public static final String NS_PREFIX_SCHEMA_XSD = "xsd"; public static final String NS_PREFIX_WSDL = "wsdl"; public static final String NS_PREFIX_WSDL_SOAP = "wsdlsoap"; public static final String NS_PREFIX_XML = "xml"; public static final String NS_PREFIX_XOP = "xop"; // // SOAP-ENV Namespaces // public static final String URI_SOAP11_ENV = "http://schemas.xmlsoap.org/soap/envelope/"; public static final String URI_SOAP12_ENV = "http://www.w3.org/2003/05/soap-envelope"; public static final String URI_LITERAL_ENC = ""; // // SOAP-ENC Namespaces // public static final String URI_SOAP11_ENC = "http://schemas.xmlsoap.org/soap/encoding/"; public static final String URI_SOAP12_ENC = "http://www.w3.org/2003/05/soap-encoding"; public static final String URI_SOAP12_NOENC = "http://www.w3.org/2003/05/soap-envelope/encoding/none"; // Misc SOAP Namespaces / URIs public static final String URI_SOAP11_NEXT_ACTOR = "http://schemas.xmlsoap.org/soap/actor/next"; public static final String URI_SOAP12_NEXT_ROLE = "http://www.w3.org/2003/05/soap-envelope/role/next"; /** * @deprecated use URI_SOAP12_NEXT_ROLE */ public static final String URI_SOAP12_NEXT_ACTOR = URI_SOAP12_NEXT_ROLE; public static final String URI_SOAP12_RPC = "http://www.w3.org/2003/05/soap-rpc"; public static final String URI_SOAP12_NONE_ROLE = "http://www.w3.org/2003/05/soap-envelope/role/none"; public static final String URI_SOAP12_ULTIMATE_ROLE = "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"; public static final String URI_SOAP11_HTTP = "http://schemas.xmlsoap.org/soap/http"; public static final String URI_SOAP12_HTTP = "http://www.w3.org/2003/05/http"; public static final String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/"; public static final String NS_URI_XML = "http://www.w3.org/XML/1998/namespace"; // // Schema XSD Namespaces // public static final String URI_1999_SCHEMA_XSD = "http://www.w3.org/1999/XMLSchema"; public static final String URI_2000_SCHEMA_XSD = "http://www.w3.org/2000/10/XMLSchema"; public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; public static final String URI_DEFAULT_SCHEMA_XSD = URI_2001_SCHEMA_XSD; // // Schema XSI Namespaces // public static final String URI_1999_SCHEMA_XSI = "http://www.w3.org/1999/XMLSchema-instance"; public static final String URI_2000_SCHEMA_XSI = "http://www.w3.org/2000/10/XMLSchema-instance"; public static final String URI_2001_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance"; public static final String URI_DEFAULT_SCHEMA_XSI = URI_2001_SCHEMA_XSI; public static final String URI_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy"; public static final String FORMAT_BINDING = "http://schemas.xmlsoap.org/wsdl/formatbinding/"; public static final String JAVA_NS = "http://schemas.xmlsoap.org/wsdl/java/"; /** * WSDL Namespace. */ public static final String NS_URI_WSDL11 = "http://schemas.xmlsoap.org/wsdl/"; public static final String NS_URI_WSDL20 = "http://www.w3.org/ns/wsdl"; // // WSDL extensions for SOAP in DIME // (http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm) // public static final String URI_DIME_WSDL = "http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"; public static final String URI_DIME_CONTENT = "http://schemas.xmlsoap.org/ws/2002/04/content-type/"; public static final String URI_DIME_REFERENCE = "http://schemas.xmlsoap.org/ws/2002/04/reference/"; public static final String URI_DIME_CLOSED_LAYOUT = "http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"; public static final String URI_DIME_OPEN_LAYOUT = "http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout"; // XOP/MTOM public static final String URI_XOP_INCLUDE = "http://www.w3.org/2004/08/xop/include"; public static final String ELEM_XOP_INCLUDE = "Include"; // // WSDL SOAP Namespace // public static final String URI_WSDL11_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/"; public static final String URI_WSDL12_SOAP = "http://schemas.xmlsoap.org/wsdl/soap12/"; public static final String ELEM_ENVELOPE = "Envelope"; public static final String ELEM_HEADER = "Header"; public static final String ELEM_BODY = "Body"; public static final String ELEM_FAULT = "Fault"; public static final String ELEM_NOTUNDERSTOOD = "NotUnderstood"; public static final String ELEM_UPGRADE = "Upgrade"; public static final String ELEM_SUPPORTEDENVELOPE = "SupportedEnvelope"; public static final String ELEM_FAULT_CODE = "faultcode"; public static final String ELEM_FAULT_STRING = "faultstring"; public static final String ELEM_FAULT_DETAIL = "detail"; public static final String ELEM_FAULT_ACTOR = "faultactor"; public static final String ELEM_FAULT_CODE_SOAP12 = "Code"; public static final String ELEM_FAULT_VALUE_SOAP12 = "Value"; public static final String ELEM_FAULT_SUBCODE_SOAP12 = "Subcode"; public static final String ELEM_FAULT_REASON_SOAP12 = "Reason"; public static final String ELEM_FAULT_NODE_SOAP12 = "Node"; public static final String ELEM_FAULT_ROLE_SOAP12 = "Role"; public static final String ELEM_FAULT_DETAIL_SOAP12 = "Detail"; public static final String ELEM_TEXT_SOAP12 = "Text"; public static final String ATTR_MUST_UNDERSTAND = "mustUnderstand"; public static final String ATTR_ENCODING_STYLE = "encodingStyle"; public static final String ATTR_ACTOR = "actor"; public static final String ATTR_ROLE = "role"; public static final String ATTR_RELAY = "relay"; public static final String ATTR_ROOT = "root"; public static final String ATTR_ID = "id"; public static final String ATTR_HREF = "href"; public static final String ATTR_REF = "ref"; public static final String ATTR_QNAME = "qname"; public static final String ATTR_ARRAY_TYPE = "arrayType"; public static final String ATTR_ITEM_TYPE = "itemType"; public static final String ATTR_ARRAY_SIZE = "arraySize"; public static final String ATTR_OFFSET = "offset"; public static final String ATTR_POSITION = "position"; public static final String ATTR_TYPE = "type"; public static final String ATTR_HANDLERINFOCHAIN = "handlerInfoChain"; // Fault Codes ////////////////////////////////////////////////////////////////////////// public static final String FAULT_CLIENT = "Client"; public static final String FAULT_SERVER_GENERAL = "Server.generalException"; public static final String FAULT_SERVER_USER = "Server.userException"; public static final QName FAULT_VERSIONMISMATCH = new QName(URI_SOAP11_ENV, "VersionMismatch"); public static final QName FAULT_MUSTUNDERSTAND = new QName(URI_SOAP11_ENV, "MustUnderstand"); public static final QName FAULT_SOAP12_MUSTUNDERSTAND = new QName(URI_SOAP12_ENV, "MustUnderstand"); public static final QName FAULT_SOAP12_VERSIONMISMATCH = new QName(URI_SOAP12_ENV, "VersionMismatch"); public static final QName FAULT_SOAP12_DATAENCODINGUNKNOWN = new QName(URI_SOAP12_ENV, "DataEncodingUnknown"); public static final QName FAULT_SOAP12_SENDER = new QName(URI_SOAP12_ENV, "Sender"); public static final QName FAULT_SOAP12_RECEIVER = new QName(URI_SOAP12_ENV, "Receiver"); // SOAP 1.2 Fault subcodes public static final QName FAULT_SUBCODE_BADARGS = new QName(URI_SOAP12_RPC, "BadArguments"); public static final QName FAULT_SUBCODE_PROC_NOT_PRESENT = new QName(URI_SOAP12_RPC, "ProcedureNotPresent"); // QNames ////////////////////////////////////////////////////////////////////////// public static final QName QNAME_FAULTCODE = new QName("", ELEM_FAULT_CODE); public static final QName QNAME_FAULTSTRING = new QName("", ELEM_FAULT_STRING); public static final QName QNAME_FAULTACTOR = new QName("", ELEM_FAULT_ACTOR); public static final QName QNAME_FAULTDETAILS = new QName("", ELEM_FAULT_DETAIL); public static final QName QNAME_FAULTCODE_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_CODE_SOAP12); public static final QName QNAME_FAULTVALUE_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_VALUE_SOAP12); public static final QName QNAME_FAULTSUBCODE_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_SUBCODE_SOAP12); public static final QName QNAME_FAULTREASON_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_REASON_SOAP12); public static final QName QNAME_TEXT_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_TEXT_SOAP12); public static final QName QNAME_FAULTNODE_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_NODE_SOAP12); public static final QName QNAME_FAULTROLE_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_ROLE_SOAP12); public static final QName QNAME_FAULTDETAIL_SOAP12 = new QName(URI_SOAP12_ENV, ELEM_FAULT_DETAIL_SOAP12); public static final QName QNAME_NOTUNDERSTOOD = new QName(URI_SOAP12_ENV, ELEM_NOTUNDERSTOOD); // Define qnames for the all of the XSD and SOAP-ENC encodings public static final QName XSD_STRING = new QName(URI_DEFAULT_SCHEMA_XSD, "string"); public static final QName XSD_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_XSD, "boolean"); public static final QName XSD_DOUBLE = new QName(URI_DEFAULT_SCHEMA_XSD, "double"); public static final QName XSD_FLOAT = new QName(URI_DEFAULT_SCHEMA_XSD, "float"); public static final QName XSD_INT = new QName(URI_DEFAULT_SCHEMA_XSD, "int"); public static final QName XSD_INTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "integer"); public static final QName XSD_LONG = new QName(URI_DEFAULT_SCHEMA_XSD, "long"); public static final QName XSD_SHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "short"); public static final QName XSD_BYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "byte"); public static final QName XSD_DECIMAL = new QName(URI_DEFAULT_SCHEMA_XSD, "decimal"); public static final QName XSD_BASE64 = new QName(URI_DEFAULT_SCHEMA_XSD, "base64Binary"); public static final QName XSD_HEXBIN = new QName(URI_DEFAULT_SCHEMA_XSD, "hexBinary"); public static final QName XSD_ANYSIMPLETYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anySimpleType"); public static final QName XSD_ANYTYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anyType"); public static final QName XSD_ANY = new QName(URI_DEFAULT_SCHEMA_XSD, "any"); public static final QName AXIS2_NONE = new QName("http://org.apache.axis2", "none"); public static final QName XSD_QNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "QName"); public static final QName XSD_DATETIME = new QName(URI_DEFAULT_SCHEMA_XSD, "dateTime"); public static final QName XSD_DATE = new QName(URI_DEFAULT_SCHEMA_XSD, "date"); public static final QName XSD_TIME = new QName(URI_DEFAULT_SCHEMA_XSD, "time"); public static final QName XSD_TIMEINSTANT1999 = new QName(URI_1999_SCHEMA_XSD, "timeInstant"); public static final QName XSD_TIMEINSTANT2000 = new QName(URI_2000_SCHEMA_XSD, "timeInstant"); public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString"); public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token"); public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong"); public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt"); public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort"); public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte"); public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger"); public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger"); public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger"); public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger"); public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth"); public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay"); public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear"); public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth"); public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay"); public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration"); public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name"); public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName"); public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN"); public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS"); public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION"); public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY"); public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES"); public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF"); public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS"); public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI"); public static final QName XSD_LANGUAGE = new QName(URI_2001_SCHEMA_XSD, "language"); public static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD, "ID"); public static final QName XSD_SCHEMA = new QName(URI_2001_SCHEMA_XSD, "schema"); public static final QName XML_LANG = new QName(NS_URI_XML, "lang"); public static final QName SOAP_BASE64 = new QName(URI_SOAP11_ENC, "base64"); public static final QName SOAP_BASE64BINARY = new QName(URI_SOAP11_ENC, "base64Binary"); public static final QName SOAP_STRING = new QName(URI_SOAP11_ENC, "string"); public static final QName SOAP_BOOLEAN = new QName(URI_SOAP11_ENC, "boolean"); public static final QName SOAP_DOUBLE = new QName(URI_SOAP11_ENC, "double"); public static final QName SOAP_FLOAT = new QName(URI_SOAP11_ENC, "float"); public static final QName SOAP_INT = new QName(URI_SOAP11_ENC, "int"); public static final QName SOAP_LONG = new QName(URI_SOAP11_ENC, "long"); public static final QName SOAP_SHORT = new QName(URI_SOAP11_ENC, "short"); public static final QName SOAP_BYTE = new QName(URI_SOAP11_ENC, "byte"); public static final QName SOAP_INTEGER = new QName(URI_SOAP11_ENC, "integer"); public static final QName SOAP_DECIMAL = new QName(URI_SOAP11_ENC, "decimal"); public static final QName SOAP_ARRAY = new QName(URI_SOAP11_ENC, "Array"); public static final QName SOAP_COMMON_ATTRS11 = new QName(URI_SOAP11_ENC, "commonAttributes"); public static final QName SOAP_COMMON_ATTRS12 = new QName(URI_SOAP12_ENC, "commonAttributes"); public static final QName SOAP_ARRAY_ATTRS11 = new QName(URI_SOAP11_ENC, "arrayAttributes"); public static final QName SOAP_ARRAY_ATTRS12 = new QName(URI_SOAP12_ENC, "arrayAttributes"); public static final QName SOAP_ARRAY12 = new QName(URI_SOAP12_ENC, "Array"); public static final QName QNAME_LITERAL_ITEM = new QName(URI_LITERAL_ENC, "item"); public static final QName QNAME_RPC_RESULT = new QName(URI_SOAP12_RPC, "result"); public static final String MIME_CT_APPLICATION_OCTETSTREAM = "application/octet-stream"; public static final String MIME_CT_TEXT_PLAIN = "text/plain"; public static final String MIME_CT_IMAGE_JPEG = "image/jpeg"; public static final String MIME_CT_IMAGE_GIF = "image/gif"; public static final String MIME_CT_TEXT_XML = "text/xml"; public static final String MIME_CT_APPLICATION_XML = "application/xml"; public static final String MIME_CT_MULTIPART_PREFIX = "multipart/"; public static final QName BASE_64_CONTENT_QNAME = new QName(URI_2001_SCHEMA_XSD, "base64Binary"); public static final QName XMIME_CONTENT_TYPE_QNAME = new QName("http://www.w3.org/2004/06/xmlmime", "contentType"); public static final String URI_SECURITYPOLICY = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"; } ./src/org/apache/axis2/AxisFault.java0000664000175000017500000005173511767656530016610 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axis2.context.MessageContext; import javax.xml.namespace.QName; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.UndeclaredThrowableException; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; /** * An exception which maps cleanly to a SOAP fault. * This is a base class for exceptions which are mapped to faults. * * @see * SOAP1.2 specification * @see SOAP1.1 Faults *

        * SOAP faults contain *

          *
        1. A fault string *
        2. A fault code *
        3. A fault actor *
        4. Fault details; an xml tree of fault specific elements *
        *

        * As SOAP1.2 faults are a superset of SOAP1.1 faults, this type holds soap1.2 fault information. When * a SOAP1.1 fault is created, spurious information can be discarded. * Mapping *

         *                                                             SOAP1.2              SOAP1.1
         *                                                             node                 faultactor
         *                                                             reason(0).text       faultstring
         *                                                             faultcode.value      faultcode
         *                                                             faultcode.subcode    (discarded)
         *                                                             detail               detail
         *                                                             role                 (discarded)
         *                                                             
        */ public class AxisFault extends RemoteException { private static final long serialVersionUID = -374933082062124907L; /** * assume headers are not used very often */ private List headers = new ArrayList(0); private String message; private List faultReasonList = new ArrayList(1); private QName faultCode; private List faultSubCodes; private String faultNode; private String faultRole; private OMElement detail; private SOAPFaultCode soapFaultCode; private SOAPFaultReason soapFaultReason; private SOAPFaultNode soapFaultNode; private SOAPFaultRole soapFaultRole; private SOAPFaultDetail soapFaultDetail; /** * If not null, this MessageContext represents the fault as it * should be returned. This is used by higher-level layers * that want to generate the message themselves so that * processing may take place before they return control (e.g. JAX-WS.) */ private MessageContext faultMessageContext; /** * SOAP1.2: URI of faulting node. Null for unknown. *

        * The value of the Node element information item is the URI that * identifies the SOAP node that generated the fault. * SOAP nodes that do not act as the ultimate SOAP receiver MUST include this element * information item. * An ultimate SOAP receiver MAY include this element information item to * indicate explicitly that it generated the fault. */ private String nodeURI; private String faultAction; /** * Constructor. * * @param message the human-readable text describing the fault */ public AxisFault(String message) { this.message = message; addReason(message); } /** * Constructor * * @param faultCode - fault code of the message as a QName * @param faultReason - the reason for the fault. The language will be defaulted to 'en' * @param cause embedded fault which caused this one */ public AxisFault(QName faultCode, String faultReason, Throwable cause) { this(faultReason, cause); setFaultCode(faultCode); } /** * Constructor * * @param faultCode - fault code of the message as a QName * @param faultSubCodes - list sub fault codes as a list if QNames * @param faultReason - the reason for the fault. The language will be defaulted to 'en' * @param cause embedded fault which caused this one */ public AxisFault(QName faultCode,List faultSubCodes, String faultReason, Throwable cause) { this(faultReason, cause); setFaultCode(faultCode); setFaultSubCodes(faultSubCodes); } /** * Constructor * * @param faultCode a QName for the fault code * @param faultReason the reason for the fault. The language will be defaulted to 'en' * @param faultNode a URL identifying the SOAP node generating this fault, or null * @param faultRole a URL identifying the SOAP role active when generating this fault, or null * @param faultDetail arbitrary XML containing application-specific fault data */ public AxisFault(QName faultCode, String faultReason, String faultNode, String faultRole, OMElement faultDetail) { this(faultReason, faultCode); this.faultNode = faultNode; this.faultRole = faultRole; setDetail(faultDetail); } /** * This is just a convenience method for the user. If you set these, do not use other methods * in this class to get and set things. * Any of the parameters can be null * * @param soapFaultCode the fault code * @param soapFaultReason the fault reason * @param soapFaultNode the SOAPFaultNode representing the source node for this fault * @param soapFaultRole the SOAPFaultRole representing the source role for this fault * @param soapFaultDetail the SOAPFaultDetail containing any application-specific info */ public AxisFault(SOAPFaultCode soapFaultCode, SOAPFaultReason soapFaultReason, SOAPFaultNode soapFaultNode, SOAPFaultRole soapFaultRole, SOAPFaultDetail soapFaultDetail) { initializeValues(soapFaultCode, soapFaultReason, soapFaultNode, soapFaultRole, soapFaultDetail); } public AxisFault(SOAPFault fault) { initializeValues(fault); } public AxisFault(SOAPFault fault, MessageContext faultCtx) { initializeValues(fault); faultMessageContext = faultCtx; } private void initializeValues(SOAPFault fault) { if (fault != null) { initializeValues(fault.getCode(), fault.getReason(), fault.getNode(), fault.getRole(), fault.getDetail()); } } private void initializeValues(SOAPFaultCode soapFaultCode, SOAPFaultReason soapFaultReason, SOAPFaultNode soapFaultNode, SOAPFaultRole soapFaultRole, SOAPFaultDetail soapFaultDetail) { this.soapFaultCode = soapFaultCode; this.soapFaultReason = soapFaultReason; this.soapFaultNode = soapFaultNode; this.soapFaultRole = soapFaultRole; this.soapFaultDetail = soapFaultDetail; if (soapFaultDetail != null) { // OMElement exceptionElement = soapFaultDetail.getFirstChildWithName( // new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY)); // if (exceptionElement != null && exceptionElement.getText() != null) { // cause = new Exception(exceptionElement.getText()); // } // TODO - Wha? Details can have multiple elements, why take the first child here? // TODO - Review the API for details // setting the first child element of the fault detail as this.detail this.detail = soapFaultDetail.getFirstElement(); } if (soapFaultReason != null) { message = soapFaultReason.getText(); } if (soapFaultCode != null) { // This works the same regardless of SOAP version faultCode = soapFaultCode.getTextAsQName(); SOAPFaultSubCode subCode = soapFaultCode.getSubCode(); if (subCode != null) { faultSubCodes = new ArrayList(); while (subCode != null) { faultSubCodes.add(subCode.getValue().getTextAsQName()); subCode = subCode.getSubCode(); } } } } /** * Construct a fault from a Throwable. This is a protected constructor - in general * to make an AxisFault from an Exception, you should be calling AxisFault.makeFault(e), * which prevents AxisFaults within AxisFaults. * * @param cause the Throwable that caused the problem */ protected AxisFault(Throwable cause) { this((cause != null) ? cause.getMessage() : null, cause); } /** * Constructor. * * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault */ public AxisFault(String messageText, String faultCode) { this(messageText); setFaultCode(faultCode); } /** * Constructor * * @param messageText this will appear as the Text in the Reason information item of SOAP Fault * @param faultCode this will appear as the Value in the Code information item of SOAP Fault */ public AxisFault(String messageText, QName faultCode) { this(messageText); setFaultCode(faultCode); } /** * Constructor * * @param message this will appear as the Text in the Reason information item of SOAP Fault * @param cause the embedded Throwable that caused this fault */ public AxisFault(String message, Throwable cause) { super(message, cause); if (message != null) { addReason(message); this.message = message; } } /** * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault * @param cause - this will appear under the Detail information item of SOAP Fault */ public AxisFault(String messageText, QName faultCode, Throwable cause) { this(messageText, cause); setFaultCode(faultCode); } /** * @param message * @param faultMessageContext * @param cause */ public AxisFault(String message, MessageContext faultMessageContext, Throwable cause) { super(message, cause); this.faultMessageContext = faultMessageContext; } /** * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault * @param cause - this will appear under the Detail information item of SOAP Fault */ public AxisFault(String messageText, String faultCode, Throwable cause) { this(messageText, cause); setFaultCode(faultCode); } /** * Create an AxisFault by providing a textual message and a MessageContext * that contains the actual fault representation. * * @param message A string that's really only useful for logging. * @param faultMessageContext A MessageContext which must contain SOAP fault info */ public AxisFault(String message, MessageContext faultMessageContext) { this(message); this.faultMessageContext = faultMessageContext; } /** * Add a header to the list of fault headers * * @param header to add. */ public void addHeader(SOAPHeaderBlock header) { headers.add(header); } /** * Add a reason for the fault in the empty "" language * * @param text text message */ public void addReason(String text) { faultReasonList.add(new FaultReason(text, "")); } /** * Add a reason for the fault * * @param text text message * @param language language */ public void addReason(String text, String language) { faultReasonList.add(new FaultReason(text, language)); } /** * Returns the first fault reason, if available. If not found, returns null. * * @return faultReason */ public String getReason() { if (faultReasonList.size() >= 1) { return ((FaultReason) faultReasonList.get(0)).getText(); } else if (soapFaultReason != null) { return soapFaultReason.getText(); } return null; } /** * Iterate over all of the headers * * @return iterator */ public ListIterator headerIterator() { return headers.listIterator(); } /** * Get at the headers. Useful for java1.5 iteration. * * @return the headers for this fault */ public List headers() { return headers; } /** * Make an AxisFault based on a passed Exception. If the Exception is * already an AxisFault, simply use that. Otherwise, wrap it in an * AxisFault. If the Exception is an InvocationTargetException (which * already wraps another Exception), get the wrapped Exception out from * there and use that instead of the passed one. * * @param e the Exception to build a fault for * @return an AxisFault representing e */ public static AxisFault makeFault(Throwable e) { if (e instanceof InvocationTargetException) { return makeFault(((InvocationTargetException) e).getTargetException()); } else if (e instanceof UndeclaredThrowableException) { Throwable t = ((UndeclaredThrowableException) e).getCause(); if (t instanceof Exception) { e = (Exception) t; } } if (e instanceof AxisFault) { return (AxisFault) e; } return new AxisFault(e); } /** * Get the current fault detail * * @return om element */ public OMElement getDetail() { return detail; } public QName getFaultCode() { return faultCode; } public List getFaultSubCodes() { return faultSubCodes; } /** * @return SOAPFaultCode if, user has set a {@link SOAPFaultCode} element when constructing the * {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault} */ public SOAPFaultCode getFaultCodeElement() { return soapFaultCode; } /** * @return SOAPFaultCode if, user has set a {@link SOAPFaultReason} element when constructing the * {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault} */ public SOAPFaultReason getFaultReasonElement() { return soapFaultReason; } /** * @return SOAPFaultCode if, user has set a {@link SOAPFaultNode} element when constructing the * {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault} */ public SOAPFaultNode getFaultNodeElement() { return soapFaultNode; } /** * @return SOAPFaultCode if, user has set a {@link SOAPFaultRole} element when constructing the * {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault} */ public SOAPFaultRole getFaultRoleElement() { return soapFaultRole; } /** * @return SOAPFaultCode if, user has set a {@link SOAPFaultDetail} element when constructing the * {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault} */ public SOAPFaultDetail getFaultDetailElement() { return soapFaultDetail; } /** * Get the faulting node uri. * SOAP1.2 * * @return URI as a string or null */ public String getNodeURI() { return nodeURI; } /** * Set the entire detail element of the fault * * @param detail an OMElement which MUST be */ public void setDetail(OMElement detail) { this.detail = detail; } public void setFaultCode(QName soapFaultCode) { this.faultCode = soapFaultCode; } public void setFaultSubCodes(List faultSubCodes) { this.faultSubCodes = faultSubCodes; } public void setFaultCode(String soapFaultCode) { // TODO: is it really safe to assume that the passed string is always the localpart? // What if someone passes soapenv:Sender? faultCode = new QName(soapFaultCode); } /** * Set the faulting node uri. (SOAP1.2) * * @param nodeURI a String containing a URI indicating which SOAP Node faulted */ public void setNodeURI(String nodeURI) { this.nodeURI = nodeURI; } public String getFaultNode() { return faultNode; } public String getFaultRole() { return faultRole; } /** * Returns the MessageContext representation of the fault if the fault * was created by providing that. * * @return The MessageContext representing the fault message or null if the * fault was not created with MessageContext representation. */ public MessageContext getFaultMessageContext() { return faultMessageContext; } class FaultReason implements Serializable{ /** * Language of the reason. * xml:lang="en" "en-GB" or just "" */ private String language = ""; /** * env:reasontext */ private String text; public FaultReason() { } public FaultReason(String text, String language) { this.text = text; this.language = language; } /** * Returns a string representation of the object. * * @return the text value */ public String toString() { return text; } public String getLanguage() { return language; } public String getText() { return text; } public void setLanguage(String language) { this.language = language; } public void setText(String text) { this.text = text; } } /** * @return the action value set for the fault message */ public String getFaultAction() { return faultAction; } /** * Set the (OPTIONAL) action value for the fault message * * @param faultAction a String containing an action URI for the fault */ public void setFaultAction(String faultAction) { this.faultAction = faultAction; } /** * Returns the detail message, including the message from the cause, if any, of this exception. * * @return the detail message */ public String getMessage() { return message; } /** * this field is used to identify the axis2 fault type */ private int faultType; public int getFaultType() { return faultType; } public void setFaultType(int faultType) { this.faultType = faultType; } } ./src/org/apache/axis2/builder/0000775000175000017500000000000011767656530015460 5ustar brianbrian./src/org/apache/axis2/builder/MTOMBuilder.java0000664000175000017500000000621511767656530020412 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; public class MTOMBuilder implements Builder { public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { XMLStreamReader streamReader; try { Attachments attachments = messageContext.getAttachmentMap(); String charSetEncoding = (String) messageContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); // Get the actual encoding by looking at the BOM of the InputStream PushbackInputStream pis = BuilderUtil.getPushbackInputStream(inputStream); String actualCharSetEncoding = BuilderUtil.getCharSetEncoding(pis, charSetEncoding); // Get the XMLStreamReader for this input stream streamReader = StAXUtils.createXMLStreamReader(pis, actualCharSetEncoding); StAXBuilder builder = new MTOMStAXSOAPModelBuilder(streamReader, attachments); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); BuilderUtil .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); //Overriding the earlier setting by MIMEBuilder messageContext.setDoingSwA(false); messageContext.setDoingMTOM(true); return envelope; } catch (IOException e) { throw AxisFault.makeFault(e); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/builder/SOAPBuilder.java0000664000175000017500000000550511767656530020401 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; public class SOAPBuilder implements Builder { public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { XMLStreamReader streamReader; try { String charSetEncoding = (String) messageContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); // Get the actual encoding by looking at the BOM of the InputStream PushbackInputStream pis = BuilderUtil.getPushbackInputStream(inputStream); String actualCharSetEncoding = BuilderUtil.getCharSetEncoding(pis, charSetEncoding); // Get the XMLStreamReader for this input stream streamReader = StAXUtils.createXMLStreamReader(pis, actualCharSetEncoding); StAXBuilder builder = new StAXSOAPModelBuilder(streamReader); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); BuilderUtil .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); return envelope; } catch (IOException e) { throw AxisFault.makeFault(e); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } } } ./src/org/apache/axis2/builder/MultipartFormDataBuilder.java0000664000175000017500000001235311767656530023235 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import java.io.InputStream; import java.util.Iterator; import java.util.List; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.servlet.http.HttpServletRequest; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.MultipleEntryHashMap; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.servlet.ServletRequestContext; public class MultipartFormDataBuilder implements Builder { /** * @return Returns the document element. */ public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { MultipleEntryHashMap parameterMap; HttpServletRequest request = (HttpServletRequest) messageContext .getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST); if (request == null) { throw new AxisFault("Cannot create DocumentElement without HttpServletRequest"); } // TODO: Do check ContentLength for the max size, // but it can't be configured anywhere. // I think that it cant be configured at web.xml or axis2.xml. String charSetEncoding = (String)messageContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); if (charSetEncoding == null) { charSetEncoding = request.getCharacterEncoding(); } try { parameterMap = getParameterMap(request, charSetEncoding); return BuilderUtil.buildsoapMessage(messageContext, parameterMap, OMAbstractFactory.getSOAP12Factory()); } catch (FileUploadException e) { throw AxisFault.makeFault(e); } } private MultipleEntryHashMap getParameterMap(HttpServletRequest request, String charSetEncoding) throws FileUploadException { MultipleEntryHashMap parameterMap = new MultipleEntryHashMap(); List items = parseRequest(new ServletRequestContext(request)); Iterator iter = items.iterator(); while (iter.hasNext()) { DiskFileItem diskFileItem = (DiskFileItem)iter.next(); boolean isFormField = diskFileItem.isFormField(); Object value; try { if (isFormField) { value = getTextParameter(diskFileItem, charSetEncoding); } else { value = getFileParameter(diskFileItem); } } catch (Exception ex) { throw new FileUploadException(ex.getMessage()); } parameterMap.put(diskFileItem.getFieldName(), value); } return parameterMap; } private static List parseRequest(ServletRequestContext requestContext) throws FileUploadException { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request return upload.parseRequest(requestContext); } private String getTextParameter(DiskFileItem diskFileItem, String characterEncoding) throws Exception { String encoding = diskFileItem.getCharSet(); if (encoding == null) { encoding = characterEncoding; } String textValue; if (encoding == null) { textValue = new String(diskFileItem.get()); } else { textValue = new String(diskFileItem.get(), encoding); } return textValue; } private DataHandler getFileParameter(DiskFileItem diskFileItem) throws Exception { DataSource dataSource = new DiskFileDataSource(diskFileItem); DataHandler dataHandler = new DataHandler(dataSource); return dataHandler; } } ./src/org/apache/axis2/builder/DiskFileDataSource.java0000664000175000017500000000325611767656530021776 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataSource; import org.apache.commons.fileupload.disk.DiskFileItem; public class DiskFileDataSource implements DataSource { private DiskFileItem diskFileItem; public DiskFileDataSource(DiskFileItem diskFileItem) { this.diskFileItem = diskFileItem; } public String getContentType() { return this.diskFileItem.getContentType(); } public InputStream getInputStream() throws IOException { return this.diskFileItem.getInputStream(); } public String getName() { return this.diskFileItem.getName(); } public OutputStream getOutputStream() throws IOException { return this.diskFileItem.getOutputStream(); } public void delete() { this.diskFileItem.delete(); } }./src/org/apache/axis2/builder/BuilderUtil.java0000664000175000017500000010626211767656530020556 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.MTOMConstants; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.context.MessageContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.Parameter; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.JavaUtils; import org.apache.axis2.util.MultipleEntryHashMap; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchemaAll; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; import org.apache.ws.commons.schema.XmlSchemaGroupBase; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaType; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PushbackInputStream; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.Map; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; public class BuilderUtil { private static final Log log = LogFactory.getLog(BuilderUtil.class); public static final int BOM_SIZE = 4; public static SOAPEnvelope buildsoapMessage(MessageContext messageContext, MultipleEntryHashMap requestParameterMap, SOAPFactory soapFactory) throws AxisFault { SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope(); SOAPBody body = soapEnvelope.getBody(); XmlSchemaElement xmlSchemaElement = null; AxisOperation axisOperation = messageContext.getAxisOperation(); if (axisOperation != null) { AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); xmlSchemaElement = axisMessage.getSchemaElement(); if (xmlSchemaElement == null) { OMElement bodyFirstChild = soapFactory.createOMElement(messageContext.getAxisOperation().getName(), body); // if there is no schema its piece of cake !! add these to the soap body in any order you like. // Note : if there are parameters in the path of the URL, there is no way this can add them // to the message. createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild, requestParameterMap); } else { // first get the target namespace from the schema and the wrapping element. // create an OMElement out of those information. We are going to extract parameters from // url, create OMElements and add them as children to this wrapping element. String targetNamespace = xmlSchemaElement.getQName().getNamespaceURI(); QName bodyFirstChildQName; if (targetNamespace != null && !"".equals(targetNamespace)) { bodyFirstChildQName = new QName(targetNamespace, xmlSchemaElement.getName()); } else { bodyFirstChildQName = new QName(xmlSchemaElement.getName()); } OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body); // Schema should adhere to the IRI style in this. So assume IRI style and dive in to // schema XmlSchemaType schemaType = xmlSchemaElement.getSchemaType(); if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType); XmlSchemaParticle particle = complexType.getParticle(); if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) { XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) particle; Iterator iterator = xmlSchemaGroupBase.getItems().getIterator(); // now we need to know some information from the binding operation. while (iterator.hasNext()) { XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next(); QName qName = innerElement.getQName(); if (qName ==null && innerElement.getSchemaTypeName().equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) { createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild, requestParameterMap); break; } long minOccurs = innerElement.getMinOccurs(); boolean nillable = innerElement.isNillable(); String name = qName != null ? qName.getLocalPart() : innerElement.getName(); Object value; OMNamespace ns = (qName == null || qName.getNamespaceURI() == null || qName.getNamespaceURI().length() == 0) ? null : soapFactory.createOMNamespace( qName.getNamespaceURI(), null); // FIXME changed while ((value = requestParameterMap.get(name)) != null) { addRequestParameter(soapFactory, bodyFirstChild, ns, name, value); minOccurs--; } if (minOccurs > 0) { if (nillable) { OMNamespace xsi = soapFactory.createOMNamespace( Constants.URI_DEFAULT_SCHEMA_XSI, Constants.NS_PREFIX_SCHEMA_XSI); OMAttribute omAttribute = soapFactory.createOMAttribute("nil", xsi, "true"); soapFactory.createOMElement(name, ns, bodyFirstChild) .addAttribute(omAttribute); } else { throw new AxisFault("Required element " + qName + " defined in the schema can not be found in the request"); } } } } } } } return soapEnvelope; } private static void createSOAPMessageWithoutSchema(SOAPFactory soapFactory, MessageContext messageContext, OMElement bodyFirstChild, MultipleEntryHashMap requestParameterMap) { // first add the parameters in the URL if (requestParameterMap != null) { Iterator requestParamMapIter = requestParameterMap.keySet().iterator(); while (requestParamMapIter.hasNext()) { String key = (String) requestParamMapIter.next(); Object value = requestParameterMap.get(key); if (value != null) { addRequestParameter(soapFactory, bodyFirstChild, null, key, value); } } } } private static void addRequestParameter(SOAPFactory soapFactory, OMElement bodyFirstChild, OMNamespace ns, String key, Object parameter) { if (parameter instanceof DataHandler) { DataHandler dataHandler = (DataHandler)parameter; OMText dataText = bodyFirstChild.getOMFactory().createOMText( dataHandler, true); soapFactory.createOMElement(key, ns, bodyFirstChild).addChild( dataText); } else { String textValue = parameter.toString(); soapFactory.createOMElement(key, ns, bodyFirstChild).setText( textValue); } } public static StAXBuilder getPOXBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException { StAXBuilder builder; XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(inStream, charSetEnc); builder = new StAXOMBuilder(xmlreader); return builder; } /** * Use the BOM Mark to identify the encoding to be used. Fall back to * default encoding specified * * @param is * @param charSetEncoding * @throws java.io.IOException */ public static Reader getReader(final InputStream is, final String charSetEncoding) throws IOException { final PushbackInputStream is2 = getPushbackInputStream(is); final String encoding = getCharSetEncoding(is2, charSetEncoding); InputStreamReader inputStreamReader = null; try { inputStreamReader = (InputStreamReader) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws UnsupportedEncodingException { return new InputStreamReader(is2, encoding); } } ); } catch (PrivilegedActionException e) { throw (UnsupportedEncodingException) e.getException(); } return new BufferedReader(inputStreamReader); } /** * Convenience method to get a PushbackInputStream so that we can read the BOM * @param is * @return PushbackInputStream */ public static PushbackInputStream getPushbackInputStream(InputStream is) { return new PushbackInputStream(is, BOM_SIZE); } /** * Use the BOM Mark to identify the encoding to be used. Fall back to * default encoding specified * * @param is2 PushBackInputStream (it must be a pushback input stream so that we can unread the BOM) * @param defaultEncoding * @throws java.io.IOException */ public static String getCharSetEncoding(PushbackInputStream is2, String defaultEncoding) throws IOException { String encoding; byte bom[] = new byte[BOM_SIZE]; int n, unread; n = is2.read(bom, 0, bom.length); if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) { encoding = "UTF-8"; if (log.isDebugEnabled()) { log.debug("char set encoding set from BOM =" + encoding); } unread = n - 3; } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) { encoding = "UTF-16BE"; if (log.isDebugEnabled()) { log.debug("char set encoding set from BOM =" + encoding); } unread = n - 2; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) { encoding = "UTF-16LE"; if (log.isDebugEnabled()) { log.debug("char set encoding set from BOM =" + encoding); } unread = n - 2; } else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) { encoding = "UTF-32BE"; if (log.isDebugEnabled()) { log.debug("char set encoding set from BOM =" + encoding); } unread = n - 4; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) { encoding = "UTF-32LE"; if (log.isDebugEnabled()) { log.debug("char set encoding set from BOM =" + encoding); } unread = n - 4; } else { // Unicode BOM mark not found, unread all bytes encoding = defaultEncoding; if (log.isDebugEnabled()) { log.debug("char set encoding set from default =" + encoding); } unread = n; } if (unread > 0) { is2.unread(bom, (n - unread), unread); } return encoding; } public static String getEnvelopeNamespace(String contentType) { String soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; if (contentType != null) { if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) { // it is SOAP 1.2 soapNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) { // SOAP 1.1 soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } } return soapNS; } /** * Extracts and returns the character set encoding from the * Content-type header * Example: * Content-Type: text/xml; charset=utf-8 * * @param contentType */ public static String getCharSetEncoding(String contentType) { if (log.isDebugEnabled()) { log.debug("Input contentType (" + contentType + ")"); } if (contentType == null) { // Using the default UTF-8 if (log.isDebugEnabled()) { log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")"); } return MessageContext.DEFAULT_CHAR_SET_ENCODING; } int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING); if (index == -1) { // Charset encoding not found in the content-type header // Using the default UTF-8 if (log.isDebugEnabled()) { log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")"); } return MessageContext.DEFAULT_CHAR_SET_ENCODING; } // If there are spaces around the '=' sign int indexOfEq = contentType.indexOf("=", index); // There can be situations where "charset" is not the last parameter of the Content-Type header int indexOfSemiColon = contentType.indexOf(";", indexOfEq); String value; if (indexOfSemiColon > 0) { value = (contentType.substring(indexOfEq + 1, indexOfSemiColon)); } else { value = (contentType.substring(indexOfEq + 1, contentType.length())).trim(); } // There might be "" around the value - if so remove them if (value.indexOf('\"') != -1) { value = value.replaceAll("\"", ""); } value = value.trim(); if (log.isDebugEnabled()) { log.debug("CharSetEncoding from content-type (" + value + ")"); } return value; } public static StAXBuilder getAttachmentsBuilder(MessageContext msgContext, InputStream inStream, String contentTypeString, boolean isSOAP) throws OMException, XMLStreamException, FactoryConfigurationError { StAXBuilder builder = null; XMLStreamReader streamReader; Attachments attachments = createAttachmentsMap(msgContext, inStream, contentTypeString); String charSetEncoding = getCharSetEncoding(attachments.getSOAPPartContentType()); if ((charSetEncoding == null) || "null".equalsIgnoreCase(charSetEncoding)) { charSetEncoding = MessageContext.UTF_8; } msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); try { PushbackInputStream pis = getPushbackInputStream(attachments.getSOAPPartInputStream()); String actualCharSetEncoding = getCharSetEncoding(pis, charSetEncoding); streamReader = StAXUtils.createXMLStreamReader(pis, actualCharSetEncoding); } catch (IOException e) { throw new XMLStreamException(e); } // Put a reference to Attachments Map in to the message context For // backword compatibility with Axis2 1.0 msgContext.setProperty(MTOMConstants.ATTACHMENTS, attachments); // Setting the Attachments map to new SwA API msgContext.setAttachmentMap(attachments); String soapEnvelopeNamespaceURI = getEnvelopeNamespace(contentTypeString); if (isSOAP) { if (attachments.getAttachmentSpecType().equals( MTOMConstants.MTOM_TYPE)) { //Creates the MTOM specific MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(streamReader, attachments, soapEnvelopeNamespaceURI); msgContext.setDoingMTOM(true); } else if (attachments.getAttachmentSpecType().equals( MTOMConstants.SWA_TYPE)) { builder = new StAXSOAPModelBuilder(streamReader, soapEnvelopeNamespaceURI); } else if (attachments.getAttachmentSpecType().equals( MTOMConstants.SWA_TYPE_12)) { builder = new StAXSOAPModelBuilder(streamReader, soapEnvelopeNamespaceURI); } } // To handle REST XOP case else { if (attachments.getAttachmentSpecType().equals( MTOMConstants.MTOM_TYPE)) { XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder( streamReader, attachments); builder = stAXOMBuilder; } else if (attachments.getAttachmentSpecType().equals( MTOMConstants.SWA_TYPE)) { builder = new StAXOMBuilder(streamReader); } else if (attachments.getAttachmentSpecType().equals( MTOMConstants.SWA_TYPE_12)) { builder = new StAXOMBuilder(streamReader); } } return builder; } protected static Attachments createAttachmentsMap(MessageContext msgContext, InputStream inStream, String contentTypeString) { boolean fileCacheForAttachments = isAttachmentsCacheEnabled(msgContext); String attachmentRepoDir = null; String attachmentSizeThreshold = null; if (fileCacheForAttachments) { Object attachmentRepoDirProperty = msgContext .getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR); if (attachmentRepoDirProperty != null) { attachmentRepoDir = (String) attachmentRepoDirProperty; } else { Parameter attachmentRepoDirParameter = msgContext .getParameter(Constants.Configuration.ATTACHMENT_TEMP_DIR); attachmentRepoDir = (attachmentRepoDirParameter != null) ? (String) attachmentRepoDirParameter .getValue() : null; } Object attachmentSizeThresholdProperty = msgContext .getProperty(Constants.Configuration.FILE_SIZE_THRESHOLD); if (attachmentSizeThresholdProperty != null && attachmentSizeThresholdProperty instanceof String) { attachmentSizeThreshold = (String) attachmentSizeThresholdProperty; } else { Parameter attachmentSizeThresholdParameter = msgContext .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD); attachmentSizeThreshold = attachmentSizeThresholdParameter .getValue().toString(); } } // Get the content-length if it is available int contentLength = 0; Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (headers != null) { String contentLengthValue = (String) headers.get(HTTPConstants.HEADER_CONTENT_LENGTH); if (contentLengthValue != null) { try { contentLength = new Integer(contentLengthValue).intValue(); } catch (NumberFormatException e) { if (log.isDebugEnabled()) { log.debug("Content-Length is not a valid number. Will assume it is not set:" + e); } } } } if (log.isDebugEnabled()) { if (contentLength > 0) { log.debug("Creating an Attachments map. The content-length is" + contentLength); } else { log.debug("Creating an Attachments map."); } } return createAttachments(msgContext, inStream, contentTypeString, fileCacheForAttachments, attachmentRepoDir, attachmentSizeThreshold, contentLength); } public static boolean isAttachmentsCacheEnabled(MessageContext msgContext) { Object cacheAttachmentProperty = msgContext .getProperty(Constants.Configuration.CACHE_ATTACHMENTS); String cacheAttachmentString = null; boolean fileCacheForAttachments; if (cacheAttachmentProperty != null && cacheAttachmentProperty instanceof String) { cacheAttachmentString = (String) cacheAttachmentProperty; fileCacheForAttachments = (Constants.VALUE_TRUE .equals(cacheAttachmentString)); } else { Parameter parameter_cache_attachment = msgContext .getParameter(Constants.Configuration.CACHE_ATTACHMENTS); cacheAttachmentString = (parameter_cache_attachment != null) ? (String) parameter_cache_attachment .getValue() : null; } fileCacheForAttachments = (Constants.VALUE_TRUE .equals(cacheAttachmentString)); return fileCacheForAttachments; } public static Attachments createAttachments(MessageContext msgContext, InputStream inStream, String contentTypeString, boolean fileCacheForAttachments, String attachmentRepoDir, String attachmentSizeThreshold, int contentLength) { LifecycleManager manager = null; try { AxisConfiguration configuration = msgContext.getRootContext().getAxisConfiguration(); manager = (LifecycleManager) configuration .getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER); if(manager == null){ manager = new LifecycleManagerImpl(); configuration.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } } catch (Exception e){ if(log.isDebugEnabled()){ log.debug("Exception getting Attachments LifecycleManager", e); } } return new Attachments(manager, inStream, contentTypeString, fileCacheForAttachments, attachmentRepoDir, attachmentSizeThreshold, contentLength); } /** * @param in * @return * @throws XMLStreamException * @deprecated If some one really need this method, please shout. */ public static StAXBuilder getBuilder(Reader in) throws XMLStreamException { XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in); StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, null); return builder; } /** * Creates an OMBuilder for a plain XML message. Default character set encording is used. * * @param inStream InputStream for a XML message * @return Handler to a OMBuilder implementation instance * @throws XMLStreamException */ public static StAXBuilder getBuilder(InputStream inStream) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream); return new StAXOMBuilder(xmlReader); } /** * Creates an OMBuilder for a plain XML message. * * @param inStream InputStream for a XML message * @param charSetEnc Character set encoding to be used * @return Handler to a OMBuilder implementation instance * @throws XMLStreamException */ public static StAXBuilder getBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc); try { StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader); return builder; } catch (OMException e){ log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc)+ "]"); } catch (IOException e1) { } throw e; } } /** * Creates an OMBuilder for a SOAP message. Default character set encording is used. * * @param inStream InputStream for a SOAP message * @return Handler to a OMBuilder implementation instance * @throws XMLStreamException */ public static StAXBuilder getSOAPBuilder(InputStream inStream) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream); try { StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader); return builder; } catch (OMException e){ log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream))+ "]"); } catch (IOException e1) { } throw e; } } /** * Creates an OMBuilder for a SOAP message. * * @param inStream InputStream for a SOAP message * @param charSetEnc Character set encoding to be used * @return Handler to a OMBuilder implementation instance * @throws XMLStreamException */ public static StAXBuilder getSOAPBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc); try { StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader); return builder; } catch (OMException e){ log.info("OMException in getSOAPBuilder", e); try { log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc)+ "]"); } catch (IOException e1) { } throw e; } } public static StAXBuilder getBuilder(SOAPFactory soapFactory, InputStream in, String charSetEnc) throws XMLStreamException { StAXBuilder builder; XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in, charSetEnc); builder = new StAXOMBuilder(soapFactory, xmlreader); return builder; } /** * Initial work for a builder selector which selects the builder for a given * message format based on the the content type of the recieved message. * content-type to builder mapping can be specified through the Axis2.xml. * * @param type * @param msgContext * @return the builder registered against the given content-type * @throws AxisFault */ public static Builder getBuilderFromSelector(String type, MessageContext msgContext) throws AxisFault { AxisConfiguration configuration = msgContext.getConfigurationContext().getAxisConfiguration(); Builder builder = configuration .getMessageBuilder(type); if (builder == null) { builder = configuration.getMessageBuilder(type.toLowerCase()); } if (builder != null) { // Check whether the request has a Accept header if so use that as the response // message type. // If thats not present, // Setting the received content-type as the messageType to make // sure that we respond using the received message serialisation // format. Object contentNegotiation = configuration .getParameterValue(Constants.Configuration.ENABLE_HTTP_CONTENT_NEGOTIATION); if (JavaUtils.isTrueExplicitly(contentNegotiation)) { Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS); if (transportHeaders != null) { String acceptHeader = (String) transportHeaders.get(HTTPConstants.HEADER_ACCEPT); if (acceptHeader != null) { int index = acceptHeader.indexOf(";"); if (index > 0) { acceptHeader = acceptHeader.substring(0, index); } String[] strings = acceptHeader.split(","); for (int i = 0; i < strings.length; i++) { String accept = strings[i].trim(); // We dont want dynamic content negotoatin to work on text.xml as its // ambiguos as to whether the user requests SOAP 1.1 or POX response if (!HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(accept) && configuration.getMessageFormatter(accept) != null) { type = strings[i]; break; } } } } } msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type); } return builder; } public static void validateSOAPVersion(String soapNamespaceURIFromTransport, SOAPEnvelope envelope) { if (soapNamespaceURIFromTransport != null) { OMNamespace envelopeNamespace = envelope.getNamespace(); String namespaceName = envelopeNamespace.getNamespaceURI(); if (!(soapNamespaceURIFromTransport.equals(namespaceName))) { throw new SOAPProcessingException( "Transport level information does not match with SOAP" + " Message namespace URI", envelopeNamespace.getPrefix() + ":" + SOAPConstants.FAULT_CODE_VERSION_MISMATCH); } } } public static void validateCharSetEncoding(String charsetEncodingFromTransport, String charsetEncodingFromXML, String soapNamespaceURI) throws AxisFault { if ((charsetEncodingFromXML != null) && !"".equals(charsetEncodingFromXML) && (charsetEncodingFromTransport != null) && !charsetEncodingFromXML.equalsIgnoreCase(charsetEncodingFromTransport) && !isValidPair(charsetEncodingFromXML, charsetEncodingFromTransport)) { String faultCode; if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) { faultCode = SOAP12Constants.FAULT_CODE_SENDER; } else { faultCode = SOAP11Constants.FAULT_CODE_SENDER; } throw new AxisFault("Character Set Encoding from " + "transport information [" + charsetEncodingFromTransport + "] does not match with " + "character set encoding in the received SOAP message [" + charsetEncodingFromXML + "]", faultCode); } } /** * check if the pair is [UTF-16,UTF-16LE] [UTF-32, UTF-32LE],[UTF-16,UTF-16BE] [UTF-32, UTF-32BE] etc. * * @param enc1 * @param enc2 * @return */ private static boolean isValidPair(String enc1, String enc2) { enc1 = enc1.toLowerCase(); enc2 = enc2.toLowerCase(); if (enc1.endsWith("be") || enc1.endsWith("le")) { enc1 = enc1.substring(0, enc1.length() - 2); } if (enc2.endsWith("be") || enc2.endsWith("le")) { enc2 = enc2.substring(0, enc2.length() - 2); } return enc1.equals(enc2); } } ./src/org/apache/axis2/builder/ApplicationXMLBuilder.java0000664000175000017500000000567411767656530022472 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; /** * This builder is used when the serialization of the message is application/xml. */ public class ApplicationXMLBuilder implements Builder { /** * @return Returns the document element. */ public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope(); if (inputStream != null) { try { PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream); int b; if ((b = pushbackInputStream.read()) > 0) { pushbackInputStream.unread(b); StAXBuilder builder = BuilderUtil.getPOXBuilder(pushbackInputStream, (String) messageContext.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING)); OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement(); documentElement.setParent(null); SOAPBody body = soapEnvelope.getBody(); body.addChild(documentElement); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (IOException e) { throw AxisFault.makeFault(e); } } return soapEnvelope; } } ./src/org/apache/axis2/builder/Builder.java0000664000175000017500000000234011767656530017710 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import java.io.InputStream; public interface Builder { /** * @return Returns the document element. */ public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault; } ./src/org/apache/axis2/builder/MIMEBuilder.java0000664000175000017500000000533111767656530020363 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.MTOMConstants; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.context.MessageContext; import javax.xml.stream.XMLStreamReader; import java.io.InputStream; public class MIMEBuilder implements Builder { public OMElement processDocument(InputStream inputStream, String contentType, MessageContext msgContext) throws AxisFault { XMLStreamReader streamReader; Attachments attachments = BuilderUtil.createAttachmentsMap(msgContext, inputStream, contentType); String charSetEncoding = BuilderUtil.getCharSetEncoding(attachments.getSOAPPartContentType()); if ((charSetEncoding == null) || "null".equalsIgnoreCase(charSetEncoding)) { charSetEncoding = MessageContext.UTF_8; } msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); // Put a reference to Attachments Map in to the message context For // backword compatibility with Axis2 1.0 msgContext.setProperty(MTOMConstants.ATTACHMENTS, attachments); // Setting the Attachments map to new SwA API msgContext.setAttachmentMap(attachments); // We set the following for all the MIME messages.. Will be overridden // by subsequent builders(eg:MTOMBuilder) if needed.. msgContext.setDoingSwA(true); Builder builder = BuilderUtil.getBuilderFromSelector(attachments.getAttachmentSpecType(), msgContext); OMElement element = builder.processDocument(attachments.getSOAPPartInputStream(), contentType, msgContext); return element; } } ./src/org/apache/axis2/builder/XFormURLEncodedBuilder.java0000664000175000017500000004026111767656530022535 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axis2.builder; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.java.security.AccessController; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisBinding; import org.apache.axis2.description.AxisBindingOperation; import org.apache.axis2.description.AxisEndpoint; import org.apache.axis2.description.WSDL20DefaultValueHolder; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.i18n.Messages; import org.apache.axis2.transport.http.util.URIEncoderDecoder; import org.apache.axis2.util.MultipleEntryHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; public class XFormURLEncodedBuilder implements Builder { private static final Log log = LogFactory.getLog(XFormURLEncodedBuilder.class); /** * @return Returns the document element. */ public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { MultipleEntryHashMap parameterMap = new MultipleEntryHashMap(); SOAPFactory soapFactory; AxisBindingOperation axisBindingOperation = (AxisBindingOperation) messageContext.getProperty( Constants.AXIS_BINDING_OPERATION); String queryParameterSeparator = null; String templatedPath = null; if (axisBindingOperation != null) { queryParameterSeparator = (String) axisBindingOperation .getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR); templatedPath = (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION); } if (queryParameterSeparator == null) { queryParameterSeparator = WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT; } AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME); if (axisEndpoint != null) { AxisBinding axisBinding = axisEndpoint.getBinding(); String soapVersion = (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION); soapFactory = getSOAPFactory(soapVersion); } else { soapFactory = getSOAPFactory(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } EndpointReference endpointReference = messageContext.getTo(); if (endpointReference == null) { throw new AxisFault("Cannot create DocumentElement without destination EPR"); } String requestURL = endpointReference.getAddress(); try { requestURL = extractParametersUsingHttpLocation(templatedPath, parameterMap, requestURL, queryParameterSeparator); } catch (UnsupportedEncodingException e) { throw AxisFault.makeFault(e); } String query = requestURL; int index; if ((index = requestURL.indexOf("?")) > -1) { query = requestURL.substring(index + 1); } extractParametersFromRequest(parameterMap, query, queryParameterSeparator, (String) messageContext.getProperty( Constants.Configuration.CHARACTER_SET_ENCODING), inputStream); return BuilderUtil.buildsoapMessage(messageContext, parameterMap, soapFactory); } protected void extractParametersFromRequest(MultipleEntryHashMap parameterMap, String query, String queryParamSeparator, final String charsetEncoding, final InputStream inputStream) throws AxisFault { if (query != null && !"".equals(query)) { String parts[] = query.split(queryParamSeparator); for (int i = 0; i < parts.length; i++) { int separator = parts[i].indexOf("="); if (separator > 0) { String value = parts[i].substring(separator + 1); try { value = URIEncoderDecoder.decode(value); } catch (UnsupportedEncodingException e) { throw AxisFault.makeFault(e); } parameterMap .put(parts[i].substring(0, separator), value); } } } if (inputStream != null) { try { InputStreamReader inputStreamReader = null; try { inputStreamReader = (InputStreamReader) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws UnsupportedEncodingException { return new InputStreamReader(inputStream, charsetEncoding); } } ); } catch (PrivilegedActionException e) { throw (UnsupportedEncodingException) e.getException(); } BufferedReader bufferedReader = new BufferedReader(inputStreamReader); while (true) { String line = bufferedReader.readLine(); if (line != null) { String parts[] = line.split( WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT); for (int i = 0; i < parts.length; i++) { int separator = parts[i].indexOf("="); String value = parts[i].substring(separator + 1); parameterMap.put(parts[i].substring(0, separator), URIEncoderDecoder.decode(value)); } } else { break; } } } catch (IOException e) { throw AxisFault.makeFault(e); } } } /** * Here is what I will try to do here. I will first try to identify the location of the first * template element in the request URI. I am trying to deduce the location of that location * using the httpLocation element of the binding (it is passed in to this * method). * If there is a contant part in the httpLocation, then I will identify it. For this, I get * the index of {, from httpLocation param, and whatever to the left of it is the contant part. * Then I search for this constant part inside the url. This will give us the access to the first * template parameter. * To find the end of this parameter, we need to get the index of the next constant, from * httpLocation attribute. Likewise we keep on discovering parameters. *

        * Assumptions : * 1. User will always append the value of httpLocation to the address given in the * endpoint. * 2. I was talking about the constants in the httpLocation. Those constants will not occur, * to a reasonable extend, before the constant we are looking for. * * @param templatedPath * @param parameterMap */ protected String extractParametersUsingHttpLocation(String templatedPath, MultipleEntryHashMap parameterMap, String requestURL, String queryParameterSeparator) throws AxisFault, UnsupportedEncodingException { if (templatedPath != null && !"".equals(templatedPath) && templatedPath.indexOf("{") > -1) { StringBuffer pathTemplate = new StringBuffer(templatedPath); // this will hold the index, from which we need to process the request URI int startIndex = 0; int templateStartIndex = 0; int templateEndIndex = 0; int indexOfNextConstant = 0; StringBuffer requestURIBuffer = new StringBuffer(requestURL); while (startIndex < requestURIBuffer.length()) { // this will always hold the starting index of a template parameter templateStartIndex = pathTemplate.indexOf("{", templateStartIndex); if (templateStartIndex > 0) { // get the preceding constant part from the template String constantPart = pathTemplate.substring(templateEndIndex + 1, templateStartIndex); constantPart = constantPart.replaceAll("\\{\\{","{"); constantPart = constantPart.replaceAll("}}","}"); // get the index of the end of this template param templateEndIndex = pathTemplate.indexOf("}", templateStartIndex); if ((pathTemplate.length() -1) > templateEndIndex && pathTemplate.charAt(templateEndIndex +1) == '}') { templateEndIndex = pathTemplate.indexOf("}", templateEndIndex +2); } String parameterName = pathTemplate.substring(templateStartIndex + 1, templateEndIndex); // next try to find the next constant templateStartIndex = pathTemplate.indexOf("{", templateEndIndex); if (pathTemplate.charAt(templateStartIndex +1) == '{') { templateStartIndex = pathTemplate.indexOf("{", templateStartIndex +2); } int endIndexOfConstant = requestURIBuffer .indexOf(constantPart, indexOfNextConstant) + constantPart.length(); if (templateStartIndex == -1) { if (templateEndIndex == pathTemplate.length() - 1) { // We may have occations where we have templates of the form foo/{name}. // In this case the next connstant will be ? and not the // queryParameterSeparator indexOfNextConstant = requestURIBuffer .indexOf("?", endIndexOfConstant); if (indexOfNextConstant == -1) { indexOfNextConstant = requestURIBuffer .indexOf(queryParameterSeparator, endIndexOfConstant); } if (indexOfNextConstant > 0) { addParameterToMap(parameterMap, parameterName, requestURIBuffer.substring(endIndexOfConstant, indexOfNextConstant)); return requestURL.substring(indexOfNextConstant); } else { addParameterToMap(parameterMap, parameterName, requestURIBuffer.substring( endIndexOfConstant)); return ""; } } else { constantPart = pathTemplate.substring(templateEndIndex + 1, pathTemplate.length()); constantPart = constantPart.replaceAll("\\{\\{","{"); constantPart = constantPart.replaceAll("}}","}"); indexOfNextConstant = requestURIBuffer.indexOf(constantPart, endIndexOfConstant); addParameterToMap(parameterMap, parameterName, requestURIBuffer.substring( endIndexOfConstant, indexOfNextConstant)); if (requestURIBuffer.length() > indexOfNextConstant + 1) { return requestURIBuffer.substring(indexOfNextConstant + 1); } return ""; } } else { // this is the next constant from the template constantPart = pathTemplate .substring(templateEndIndex + 1, templateStartIndex); constantPart = constantPart.replaceAll("\\{\\{","{"); constantPart = constantPart.replaceAll("}}","}"); indexOfNextConstant = requestURIBuffer.indexOf(constantPart, endIndexOfConstant); addParameterToMap(parameterMap, parameterName, requestURIBuffer.substring( endIndexOfConstant, indexOfNextConstant)); startIndex = indexOfNextConstant; } } } } return requestURL; } private void addParameterToMap(MultipleEntryHashMap parameterMap, String paramName, String paramValue) throws UnsupportedEncodingException, AxisFault { try { paramValue = URIEncoderDecoder.decode(paramValue); } catch (UnsupportedEncodingException e) { throw AxisFault.makeFault(e); } if (paramName.startsWith(WSDL2Constants.TEMPLATE_ENCODE_ESCAPING_CHARACTER)) { parameterMap.put(paramName.substring(1), paramValue); } else { parameterMap.put(paramName, paramValue); } } private SOAPFactory getSOAPFactory(String nsURI) throws AxisFault { if (nsURI == null) { return OMAbstractFactory.getSOAP12Factory(); } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP12Factory(); } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) { return OMAbstractFactory.getSOAP11Factory(); } else { throw new AxisFault(Messages.getMessage("invalidSOAPversion")); } } }./src/org/apache/axiom/0000775000175000017500000000000011767656530014121 5ustar brianbrian./src/org/apache/axiom/attachments/0000775000175000017500000000000011767656530016434 5ustar brianbrian./src/org/apache/axiom/attachments/BoundaryDelimitedStream.java0000664000175000017500000004156111767656530024066 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import org.apache.axiom.om.OMException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** This class takes the input stream and turns it multiple streams. */ public class BoundaryDelimitedStream extends java.io.FilterInputStream { /** The Log that this class should log all events to. */ protected static Log log = LogFactory.getLog(BoundaryDelimitedStream.class.getName()); protected byte[] boundary = null; /** The boundary length. */ int boundaryLen = 0; /** The boundary length plus crlf. */ int boundaryBufLen = 0; /** The source input stream. */ java.io.InputStream is = null; /** The stream has been closed. */ boolean closed = true; /** eof has been detected. */ boolean eos = false; /** There are no more streams left. */ boolean theEnd = false; /** Minimum to read at one time. */ int readbufsz = 0; /** The buffer we are reading. */ byte[] readbuf = null; /** Where we have read so far in the stream. */ int readBufPos = 0; /** The number of bytes in array. */ int readBufEnd = 0; /** Field BOUNDARY_NOT_FOUND. */ protected static final int BOUNDARY_NOT_FOUND = Integer.MAX_VALUE; // Where in the stream a boundary is located. /** Field boundaryPos. */ int boundaryPos = BOUNDARY_NOT_FOUND; /** The number of streams produced. */ static int streamCount = 0; /** Signal that a new stream has been created. */ protected static synchronized int newStreamNo() { log.debug("streamNo" + (streamCount + 1)); return ++streamCount; } /** Field streamNo. */ protected int streamNo = -1; // Keeps track of stream /** Field isDebugEnabled. */ static boolean isDebugEnabled = false; /** * Gets the next stream. From the previous using the same buffer size to read. * * @return the boundary delmited stream, null if there are no more streams. * @throws java.io.IOException if there was an error loading the data for the next stream */ public synchronized BoundaryDelimitedStream getNextStream() throws java.io.IOException { return getNextStream(readbufsz); } /** * Gets the next stream. From the previous using new buffer reading size. * * @param readbufsz * @return the boundary delmited stream, null if there are no more streams. * @throws java.io.IOException if there was an error loading the data for the next stream */ protected synchronized BoundaryDelimitedStream getNextStream( int readbufsz) throws java.io.IOException { BoundaryDelimitedStream ret = null; if (!theEnd) { // Create an new boundary stream that comes after this one. ret = new BoundaryDelimitedStream(this, readbufsz); } return ret; } /** * Constructor to create the next stream from the previous one. * * @param prev the previous stream * @param readbufsz how many bytes to make the read buffer * @throws java.io.IOException if there was a problem reading data from prev */ protected BoundaryDelimitedStream(BoundaryDelimitedStream prev, int readbufsz) throws java.io.IOException { super(null); streamNo = newStreamNo(); boundary = prev.boundary; boundaryLen = prev.boundaryLen; boundaryBufLen = prev.boundaryBufLen; skip = prev.skip; is = prev.is; closed = false; // The new one is not closed. eos = false; // Its not at th EOS. this.readbufsz = readbufsz; readbuf = prev.readbuf; // Move past the old boundary. readBufPos = prev.readBufPos + boundaryBufLen; readBufEnd = prev.readBufEnd; // find the new boundary. boundaryPos = boundaryPosition(readbuf, readBufPos, readBufEnd); prev.theEnd = theEnd; // The stream. } /** * Create a new boundary stream. * * @param is * @param boundary is the boundary that separates the individual streams. * @param readbufsz lets you have some control over the amount of buffering. by buffering you * can some effiency in searching. * @throws OMException */ BoundaryDelimitedStream( java.io.InputStream is, byte[] boundary, int readbufsz) throws OMException { // super (is); super(null); // we handle everything so this is not necessary, don't won't to hang on to a reference. isDebugEnabled = log.isDebugEnabled(); streamNo = newStreamNo(); closed = false; this.is = is; // Copy the boundary array to make certain it is never altered. this.boundary = new byte[boundary.length]; System.arraycopy(boundary, 0, this.boundary, 0, boundary.length); this.boundaryLen = this.boundary.length; // 2 for preceeding, and 2 for proceeding CRLF's this.boundaryBufLen = boundaryLen + 4; // allways leave room for at least a 2x boundary // Most mime boundaries are 40 bytes or so. this.readbufsz = Math.max((boundaryBufLen) * 2, readbufsz); } private int readFromStream(final byte[] b) throws java.io.IOException { return readFromStream(b, 0, b.length); } private int readFromStream( final byte[] b, final int start, final int length) throws java.io.IOException { int minRead = Math.max(boundaryBufLen * 2, length); minRead = Math.min(minRead, length - start); int br = 0; int brTotal = 0; do { br = is.read(b, brTotal + start, length - brTotal); if (br > 0) { brTotal += br; } } while ((br > -1) && (brTotal < minRead)); return (brTotal != 0) ? brTotal : br; } /** * Read from the boundary delimited stream. * * @param b is the array to read into. * @param off is the offset * @param len * @return the number of bytes read. -1 if endof stream. * @throws java.io.IOException */ public synchronized int read(byte[] b, final int off, final int len) throws java.io.IOException { if (closed) { throw new java.io.IOException("streamClosed"); } if (eos) { return -1; } if (readbuf == null) { // Allocate the buffer. readbuf = new byte[Math.max(len, readbufsz)]; readBufEnd = readFromStream(readbuf); if (readBufEnd < 0) { readbuf = null; closed = true; finalClose(); throw new java.io.IOException("eosBeforeMarker"); } readBufPos = 0; // Finds the boundary pos. boundaryPos = boundaryPosition(readbuf, 0, readBufEnd); } int bwritten = 0; // Number of bytes written. // read and copy bytes in. do { // Always allow to have a boundary length left in the buffer. int bcopy = Math.min(readBufEnd - readBufPos - boundaryBufLen, len - bwritten); // never go past the boundary. bcopy = Math.min(bcopy, boundaryPos - readBufPos); if (bcopy > 0) { System.arraycopy(readbuf, readBufPos, b, off + bwritten, bcopy); bwritten += bcopy; readBufPos += bcopy; } if (readBufPos == boundaryPos) { eos = true; // hit the boundary so it the end of the stream. log.debug("atEOS" + streamNo); } else if (bwritten < len) { // need to get more data. byte[] dstbuf = readbuf; if (readbuf.length < len) { dstbuf = new byte[len]; } int movecnt = readBufEnd - readBufPos; // copy what was left over. System.arraycopy(readbuf, readBufPos, dstbuf, 0, movecnt); // Read in the new data. int readcnt = readFromStream(dstbuf, movecnt, dstbuf.length - movecnt); if (readcnt < 0) { readbuf = null; closed = true; finalClose(); throw new java.io.IOException("eosBeforeMarker"); } readBufEnd = readcnt + movecnt; readbuf = dstbuf; readBufPos = 0; // start at the begining. // just move the boundary by what we moved if (BOUNDARY_NOT_FOUND != boundaryPos) { boundaryPos -= movecnt; } else { boundaryPos = boundaryPosition( readbuf, readBufPos, readBufEnd); // See if the boundary is now there. } } } // read till we get the amount or the stream is finished. while (!eos && (bwritten < len)); if (log.isDebugEnabled()) { if (bwritten > 0) { byte tb[] = new byte[bwritten]; System.arraycopy(b, off, tb, 0, bwritten); log.debug("readBStream" + new String[] { "" + bwritten, "" + streamNo, new String(tb) }); } } if (eos && theEnd) { readbuf = null; // dealloc even in Java. } return bwritten; } /** * Read from the boundary delimited stream. * * @param b is the array to read into. Read as much as possible into the size of this array. * @return the number of bytes read. -1 if endof stream. * @throws java.io.IOException */ public int read(byte[] b) throws java.io.IOException { return read(b, 0, b.length); } /** * Read from the boundary delimited stream. * * @return The byte read, or -1 if endof stream. * @throws java.io.IOException */ public int read() throws java.io.IOException { byte[] b = new byte[1]; // quick and dirty. //for now int read = read(b); if (read < 0) { return -1; } else { return b[0] & 0xff; } } /** * Closes the stream. * * @throws java.io.IOException */ public synchronized void close() throws java.io.IOException { if (closed) { return; } log.debug("bStreamClosed" + streamNo); closed = true; // mark it closed. if (!eos) { // We need get this off the stream. // Easy way to flush through the stream; byte[] readrest = new byte[1024 * 16]; int bread; do { bread = read(readrest); } while (bread > -1); } } /** * mark the stream. This is not supported. * * @param readlimit */ public void mark(int readlimit) { // do nothing } /** * reset the stream. This is not supported. * * @throws java.io.IOException */ public void reset() throws java.io.IOException { throw new java.io.IOException("attach.bounday.mns"); } /** markSupported return false; */ public boolean markSupported() { return false; } public int available() throws java.io.IOException { int bcopy = readBufEnd - readBufPos - boundaryBufLen; // never go past the boundary. bcopy = Math.min(bcopy, boundaryPos - readBufPos); return Math.max(0, bcopy); } /** * Read from the boundary delimited stream. * * @param searchbuf buffer to read from * @param start starting index * @param end ending index * @return The position of the boundary. Detects the end of the source stream. * @throws java.io.IOException if there was an error manipulating the underlying stream */ protected int boundaryPosition(byte[] searchbuf, int start, int end) throws java.io.IOException { int foundAt = boundarySearch(searchbuf, start, end); // First find the boundary marker if (BOUNDARY_NOT_FOUND != foundAt) { // Something was found. if (foundAt + boundaryLen + 2 > end) { foundAt = BOUNDARY_NOT_FOUND; } else { // If the marker has a "--" at the end then this is the last boundary. if ((searchbuf[foundAt + boundaryLen] == '-') && (searchbuf[foundAt + boundaryLen + 1] == '-')) { finalClose(); } else if ((searchbuf[foundAt + boundaryLen] != 13) || (searchbuf[foundAt + boundaryLen + 1] != 10)) { // If there really was no crlf at then end then this is not a boundary. foundAt = BOUNDARY_NOT_FOUND; } if ((foundAt != BOUNDARY_NOT_FOUND) && (searchbuf[foundAt - 2] == 13) && (searchbuf[foundAt - 1] == 10)) { // Section 7.2.1 of the MIME RFC (#1521) states that CRLF // preceeding boundary is part of the encapsulation // boundary foundAt -= 2; } } } return foundAt; } /* The below uses a standard textbook Boyer-Moore pattern search. */ private int[] skip = null; private int boundarySearch(final byte[] text, final int start, final int end) { // log.debug(">>>>" + start + "," + end); int i = 0, j = 0, k = 0; if (boundaryLen > (end - start)) { return BOUNDARY_NOT_FOUND; } if (null == skip) { skip = new int[256]; java.util.Arrays.fill(skip, boundaryLen); for (k = 0; k < boundaryLen - 1; k++) { skip[boundary[k]] = boundaryLen - k - 1; } } for (k = start + boundaryLen - 1; k < end; k += skip[text[k] & (0xff)]) { // log.debug(">>>>" + k); // printarry(text, k-boundaryLen+1, end); try { for (j = boundaryLen - 1, i = k; (j >= 0) && (text[i] == boundary[j]); j--) { i--; } } catch (ArrayIndexOutOfBoundsException e) { StringBuffer sb = new StringBuffer(); sb.append(">>>").append(e); // rr temporary till a boundary issue is resolved. sb.append("start=").append(start); sb.append("k=").append(k); sb.append("text.length=").append(text.length); sb.append("i=").append(i); sb.append("boundary.length=").append(boundary.length); sb.append("j=").append(j); sb.append("end=").append(end); log.warn("exception01" + sb.toString()); throw e; } if (j == (-1)) { return i + 1; } } // log.debug(">>>> not found" ); return BOUNDARY_NOT_FOUND; } /** * Close the underlying stream and remove all references to it. * * @throws java.io.IOException if the stream could not be closed */ protected void finalClose() throws java.io.IOException { if (theEnd) return; theEnd = true; is.close(); is = null; } /** * Method printarry * * @param b * @param start * @param end */ public static void printarry(byte[] b, int start, int end) { if (log.isDebugEnabled()) { byte tb[] = new byte[end - start]; System.arraycopy(b, start, tb, 0, end - start); log.debug("\"" + new String(tb) + "\""); } } } ./src/org/apache/axiom/attachments/AttachmentCacheMonitor.java0000664000175000017500000002315611767656530023672 0ustar brianbrian/* * Copyright 2004, 2009 The Apache Software Foundation. * * Licensed 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.axiom.attachments; import java.util.HashMap; import java.util.Iterator; import java.util.Timer; import java.util.TimerTask; import java.io.File; import java.security.AccessController; import java.security.PrivilegedAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The CacheMonitor is responsible for deleting temporary attachment files * after a timeout period has expired. * * The register method is invoked when the attachment file is created. * The access method is invoked whenever the attachment file is accessed. * The checkForAgedFiles method is invoked whenever the monitor should look for * files to cleanup (delete). * */ public final class AttachmentCacheMonitor { static Log log = LogFactory.getLog(AttachmentCacheMonitor.class.getName()); // Setting this property puts a limit on the lifetime of a cache file // The default is "0", which is interpreted as forever // The suggested value is 300 seconds private int attachmentTimeoutSeconds = 0; // Default is 0 (forever) private int refreshSeconds = 0; public static final String ATTACHMENT_TIMEOUT_PROPERTY = "org.apache.axiom.attachments.tempfile.expiration"; // HashMap // Key String = Absolute file name // Value Long = Last Access Time private HashMap files = new HashMap(); // Delete detection is batched private Long priorDeleteMillis = getTime(); private Timer timer = null; private static AttachmentCacheMonitor _singleton = null; /** * Get or Create an AttachmentCacheMonitor singleton * @return TODO */ public static synchronized AttachmentCacheMonitor getAttachmentCacheMonitor() { if (_singleton == null) { _singleton = new AttachmentCacheMonitor(); } return _singleton; } /** * Constructor * Intentionally private. Callers should use getAttachmentCacheMonitor * @see getAttachmentCacheMonitor */ private AttachmentCacheMonitor() { String value = ""; try { value = System.getProperty(ATTACHMENT_TIMEOUT_PROPERTY, "0"); attachmentTimeoutSeconds = Integer.valueOf(value).intValue(); } catch (Throwable t) { // Swallow exception and use default, but log a warning message if (log.isDebugEnabled()) { log.debug("The value of " + value + " was not valid. The default " + attachmentTimeoutSeconds + " will be used instead."); } } refreshSeconds = attachmentTimeoutSeconds / 2; if (log.isDebugEnabled()) { log.debug("Custom Property Key = " + ATTACHMENT_TIMEOUT_PROPERTY); log.debug(" Value = " + attachmentTimeoutSeconds); } if (refreshSeconds > 0) { timer = new Timer( true ); timer.schedule( new CleanupFilesTask(), refreshSeconds * 1000, refreshSeconds * 1000 ); } } /** * @return timeout value in seconds */ public synchronized int getTimeout() { return attachmentTimeoutSeconds; } /** * This method should * Set a new timeout value * @param timeout new timeout value in seconds */ public synchronized void setTimeout(int timeout) { // If the setting to the same value, simply return if (timeout == attachmentTimeoutSeconds) { return; } attachmentTimeoutSeconds = timeout; // Reset the refresh refreshSeconds = attachmentTimeoutSeconds / 2; // Make sure to cancel the prior timer if (timer != null) { timer.cancel(); // Remove scheduled tasks from the prior timer timer = null; } // Make a new timer if necessary if (refreshSeconds > 0) { timer = new Timer( true ); timer.schedule( new CleanupFilesTask(), refreshSeconds * 1000, refreshSeconds * 1000 ); } if (log.isDebugEnabled()) { log.debug("New timeout = " + attachmentTimeoutSeconds); log.debug("New refresh = " + refreshSeconds); } } /** * Register a file name with the monitor. * This will allow the Monitor to remove the file after * the timeout period. * @param fileName */ public void register(String fileName) { if (attachmentTimeoutSeconds > 0) { _register(fileName); _checkForAgedFiles(); } } /** * Indicates that the file was accessed. * @param fileName */ public void access(String fileName) { if (attachmentTimeoutSeconds > 0) { _access(fileName); _checkForAgedFiles(); } } /** * Check for aged files and remove the aged ones. */ public void checkForAgedFiles() { if (attachmentTimeoutSeconds > 0) { _checkForAgedFiles(); } } private synchronized void _register(String fileName) { Long currentTime = getTime(); if (log.isDebugEnabled()) { log.debug("Register file " + fileName); log.debug("Time = " + currentTime); } files.put(fileName, currentTime); } private synchronized void _access(String fileName) { Long currentTime = getTime(); Long priorTime = (Long) files.get(fileName); if (priorTime != null) { files.put(fileName, currentTime); if (log.isDebugEnabled()) { log.debug("Access file " + fileName); log.debug("Old Time = " + priorTime); log.debug("New Time = " + currentTime); } } else { if (log.isDebugEnabled()) { log.debug("The following file was already deleted and is no longer available: " + fileName); log.debug("The value of " + ATTACHMENT_TIMEOUT_PROPERTY + " is " + attachmentTimeoutSeconds); } } } private synchronized void _checkForAgedFiles() { Long currentTime = getTime(); // Don't keep checking the map, only trigger // the checking if it is plausible that // files will need to be deleted. // I chose a value of ATTACHMENTT_TIMEOUT_SECONDS/4 if (isExpired(priorDeleteMillis, currentTime, refreshSeconds)) { Iterator it = files.keySet().iterator(); while (it.hasNext()) { String fileName = (String) it.next(); Long lastAccess = (Long) files.get(fileName); if (isExpired(lastAccess, currentTime, attachmentTimeoutSeconds)) { if (log.isDebugEnabled()) { log.debug("Expired file " + fileName); log.debug("Old Time = " + lastAccess); log.debug("New Time = " + currentTime); log.debug("Elapsed Time (ms) = " + (currentTime.longValue() - lastAccess.longValue())); } deleteFile(fileName); // Use the iterator to remove this // file from the map (this avoids // the dreaded ConcurrentModificationException it.remove(); } } // Reset the prior delete time priorDeleteMillis = currentTime; } } private boolean deleteFile(final String fileName ) { Boolean privRet = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return _deleteFile(fileName); } }); return privRet.booleanValue(); } private Boolean _deleteFile(String fileName) { boolean ret = false; File file = new File(fileName); if (file.exists()) { ret = file.delete(); if (log.isDebugEnabled()) { log.debug("Deletion Successful ? " + ret); } } else { if (log.isDebugEnabled()) { log.debug("This file no longer exists = " + fileName); } } return new Boolean(ret); } private Long getTime() { return new Long(System.currentTimeMillis()); } private boolean isExpired (Long oldTimeMillis, Long newTimeMillis, int thresholdSecs) { long elapse = newTimeMillis.longValue() - oldTimeMillis.longValue(); return (elapse > (thresholdSecs*1000)); } private class CleanupFilesTask extends TimerTask { /** * Trigger a checkForAgedFiles event */ public void run() { checkForAgedFiles(); } } } ./src/org/apache/axiom/attachments/IncomingAttachmentStreams.java0000664000175000017500000000400411767656530024410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import org.apache.axiom.om.OMException; /** * Container for AttachmentStream s. This class provides an SwA like access mechanism, allowing * applications to access the streams directly. Access it intentionally restrictred to either SwA * like (stream access), or MTOM like (part/data handler access via blob id), not both. */ public abstract class IncomingAttachmentStreams { /** * Boolean indicating weather or not the next stream can be read (next stream cannot be read until * previous is consumed */ protected boolean _readyToGetNextStream = true; /** @return True if the next stream can be read, false otherwise. */ public final boolean isReadyToGetNextStream() { return _readyToGetNextStream; } /** * Set the ready flag. Intended for the inner class to use. * * @param ready */ protected final void setReadyToGetNextStream(boolean ready) { _readyToGetNextStream = ready; } /** * Returns the next attachment stream in sequence. * * @return The next stream or null if no additional streams are left. */ public abstract IncomingAttachmentInputStream getNextStream() throws OMException; }./src/org/apache/axiom/attachments/lifecycle/0000775000175000017500000000000011767656530020373 5ustar brianbrian./src/org/apache/axiom/attachments/lifecycle/impl/0000775000175000017500000000000011767656530021334 5ustar brianbrian./src/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java0000664000175000017500000001545411767656530026224 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; import java.io.File; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Hashtable; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.util.UIDGenerator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LifecycleManagerImpl implements LifecycleManager { private static final Log log = LogFactory.getLog(LifecycleManagerImpl.class); //Hashtable to store file accessors. private static Hashtable table = new Hashtable(); private VMShutdownHook hook = null; public LifecycleManagerImpl() { super(); } /* (non-Javadoc) * @see org.apache.axiom.lifecycle.LifecycleManager#create(java.lang.String) */ public FileAccessor create(String attachmentDir) throws IOException { if(log.isDebugEnabled()){ log.debug("Start Create()"); } File file = null; File dir = null; if (attachmentDir != null) { dir = new File(attachmentDir); if (!dir.exists()) { dir.mkdirs(); } } if (!dir.isDirectory()) { throw new IllegalArgumentException("Given Axis2 Attachment File Cache Location " + dir + " should be a directory."); } // Generate unique id. The UID generator is used so that we can limit // synchronization with the java random number generator. String id = UIDGenerator.generateUID(); String fileString = "Axis2" + id + ".att"; file = new File(dir, fileString); FileAccessor fa = new FileAccessor(this, file); //add the fileAccesor to table table.put(fileString, fa); //Default behaviour deleteOnExit(file); if(log.isDebugEnabled()){ log.debug("End Create()"); } return fa; } /* (non-Javadoc) * @see org.apache.axiom.lifecycle.LifecycleManager#delete(java.io.File) */ public void delete(File file) throws IOException { if(log.isDebugEnabled()){ log.debug("Start delete()"); } if(file!=null && file.exists()){ table.remove(file); if(log.isDebugEnabled()){ log.debug("invoking file.delete()"); } if(file.delete()){ if(log.isDebugEnabled()){ log.debug("delete() successful"); } }else{ if(log.isDebugEnabled()){ log.debug("Cannot delete file, set to delete on VM shutdown"); } deleteOnExit(file); } } if(log.isDebugEnabled()){ log.debug("End delete()"); } } /* (non-Javadoc) * @see org.apache.axiom.lifecycle.LifecycleManager#deleteOnExit(java.io.File) */ public void deleteOnExit(File file) throws IOException { if(log.isDebugEnabled()){ log.debug("Start deleteOnExit()"); } if(hook == null){ hook = RegisterVMShutdownHook(); } if(file!=null){ if(log.isDebugEnabled()){ log.debug("Invoking deleteOnExit() for file = "+file.getAbsolutePath()); } hook.add(file); table.remove(file); } if(log.isDebugEnabled()){ log.debug("End deleteOnExit()"); } } /* (non-Javadoc) * @see org.apache.axiom.lifecycle.LifecycleManager#deleteOnTimeInterval(int) */ public void deleteOnTimeInterval(int interval, File file) throws IOException { if(log.isDebugEnabled()){ log.debug("Start deleteOnTimeInterval()"); } Thread t = new Thread(new LifecycleManagerImpl.FileDeletor(interval, file)); t.setDaemon(true); t.start(); if(log.isDebugEnabled()){ log.debug("End deleteOnTimeInterval()"); } } private VMShutdownHook RegisterVMShutdownHook() throws RuntimeException{ if(log.isDebugEnabled()){ log.debug("Start RegisterVMShutdownHook()"); } try{ hook = (VMShutdownHook)AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws SecurityException, IllegalStateException, IllegalArgumentException { VMShutdownHook hook = VMShutdownHook.hook(); if(!hook.isRegistered()){ Runtime.getRuntime().addShutdownHook(hook); hook.setRegistered(true); } return hook; } }); }catch (PrivilegedActionException e) { if (log.isDebugEnabled()) { log.debug("Exception thrown from AccessController: " + e); log.debug("VM Shutdown Hook not registered."); } throw new RuntimeException(e); } if(log.isDebugEnabled()){ log.debug("Exit RegisterVMShutdownHook()"); } return hook; } public class FileDeletor implements Runnable{ int interval; File _file; public FileDeletor(int interval, File file) { super(); this.interval = interval; this._file = file; } public void run() { try{ Thread.sleep(interval*1000); if(_file.exists()){ table.remove(_file); _file.delete(); } }catch(InterruptedException e){ //Log Exception if(log.isDebugEnabled()){ log.warn("InterruptedException occured "+e.getMessage()); } } } } public FileAccessor getFileAccessor(String fileName) throws IOException { return (FileAccessor)table.get(fileName); } } ./src/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java0000664000175000017500000000736011767656530025657 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; import java.io.File; import java.io.IOException; import java.util.Observable; import java.util.Observer; import javax.activation.DataHandler; import javax.activation.DataSource; import org.apache.axiom.attachments.CachedFileDataSource; import org.apache.axiom.attachments.lifecycle.DataHandlerExt; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DataHandlerExtImpl extends DataHandler implements DataHandlerExt, Observer { private static final Log log = LogFactory.getLog(DataHandlerExtImpl.class); private DataHandler dataHandler = null; private LifecycleManager manager = null; private static int READ_COUNT = 1; private boolean deleteOnreadOnce = false; public DataHandlerExtImpl(DataHandler dataHandler, LifecycleManager manager){ super(dataHandler.getDataSource()); this.dataHandler = dataHandler; this.manager = manager; } public void deleteWhenReadOnce() throws IOException { deleteOnreadOnce = true; FileAccessor fa =manager.getFileAccessor(getName()); if(fa==null){ log.warn("Could not find FileAccessor, delete on readOnce Failed"); return; } if(fa.getAccessCount() >= READ_COUNT){ purgeDataSource(); }else{ fa.addObserver(this); } } public void purgeDataSource() throws IOException { if(log.isDebugEnabled()){ log.debug("Start purgeDataSource"); } File file = getFile(); if(file!=null){ //Invoke delete from LifecycleManager manager.delete(file); //If file was registered with VMShutdown hook //lets remove it from the list to be deleted on VMExit. VMShutdownHook hook =VMShutdownHook.hook(); if(hook.isRegistered()){ hook.remove(file); } if(log.isDebugEnabled()){ log.debug("File Purged and removed from Shutdown Hook Collection"); } }else{ if(log.isDebugEnabled()){ log.debug("DataSource is not a CachedFileDataSource, Unable to Purge."); } } if(log.isDebugEnabled()){ log.debug("End purgeDataSource"); } } public void update(Observable o, Object arg) { try{ if(log.isDebugEnabled()){ log.debug("Start update in Observer"); } if(o instanceof FileAccessor){ FileAccessor fa = (FileAccessor)o; if(deleteOnreadOnce && fa.getAccessCount()>=READ_COUNT){ purgeDataSource(); } } }catch(IOException e){ if(log.isDebugEnabled()){ log.debug("delete on readOnce Failed"); } log.warn("delete on readOnce Failed with IOException in Observer"+e.getMessage()); } if(log.isDebugEnabled()){ log.debug("End update in Observer"); } } private File getFile(){ //get DataSource from DataHandler DataSource dataSource = dataHandler.getDataSource(); if(dataSource instanceof CachedFileDataSource){ CachedFileDataSource cds = (CachedFileDataSource)dataSource; //get the file object from data source. return cds.getFile(); } return null; } } ./src/org/apache/axiom/attachments/lifecycle/impl/FileAccessor.java0000664000175000017500000000660111767656530024544 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Observable; import javax.activation.DataHandler; import javax.mail.MessagingException; import org.apache.axiom.attachments.CachedFileDataSource; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FileAccessor wraps the attachment temp file. It is created from PartOnFile. * The idea behind wrapping the file is to give rumtime an ability to track * when the file is accessed with streams or data handler and accordingly trigger * events to handle the the files lifecycle. * */ public class FileAccessor extends Observable{ private static final Log log = LogFactory.getLog(FileAccessor.class); File file = null; LifecycleManager manager; private int accessCount = 0; public FileAccessor(LifecycleManager manager, File file) { super(); this.manager = manager; this.file = file; } public DataHandler getDataHandler(String contentType) throws MessagingException { if(log.isDebugEnabled()){ log.debug("getDataHandler()"); log.debug("accessCount =" +accessCount); } CachedFileDataSource dataSource = new CachedFileDataSource(file); dataSource.setContentType(contentType); accessCount++; setChanged(); notifyObservers(); DataHandler dataHandler = new DataHandler(dataSource); return new DataHandlerExtImpl(dataHandler, manager); } public String getFileName() throws MessagingException { if(log.isDebugEnabled()){ log.debug("getFileName()"); } return file.getAbsolutePath(); } public InputStream getInputStream() throws IOException, MessagingException { if(log.isDebugEnabled()){ log.debug("getInputStream()"); } return new FileInputStream(file); } public OutputStream getOutputStream() throws FileNotFoundException{ if(log.isDebugEnabled()){ log.debug("getOutputStream()"); } return new FileOutputStream(file); } public long getSize() { return file.length(); } public File getFile() { return file; } public void setFile(File file) { this.file = file; } public int getAccessCount() { return accessCount; } } ./src/org/apache/axiom/attachments/lifecycle/impl/VMShutdownHook.java0000664000175000017500000000652211767656530025103 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; import java.io.File; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /* * VMShutdown Hook will be registered with Runtime object to be invoked * when Virutal Machine is shutdown. * This class will be used to delete any cached attachments file that where * added by runtime to be deleted on VM shutdown. */ public class VMShutdownHook extends Thread { private static final Log log = LogFactory.getLog(VMShutdownHook.class); private static VMShutdownHook instance = null; private static Set files = Collections.synchronizedSet(new HashSet()); private boolean isRegistered = false; static VMShutdownHook hook() { if (instance == null){ if(log.isDebugEnabled()){ log.debug("creating VMShutdownHook"); } instance = new VMShutdownHook(); } if(log.isDebugEnabled()){ log.debug("returning VMShutdownHook instance"); } return instance; } private VMShutdownHook(){} void remove(File file){ if(file == null){ return; } if(log.isDebugEnabled()){ log.debug("Removing File to Shutdown Hook Collection"); } files.remove(file); } void add(File file) { if(file == null){ return; } if(log.isDebugEnabled()){ log.debug("Adding File to Shutdown Hook Collection"); } files.add(file); } public void run() { if(log.isDebugEnabled()){ log.debug("JVM running VM Shutdown Hook"); } Iterator iter = files.iterator(); while(iter.hasNext()){ File file = (File)iter.next(); if(log.isDebugEnabled()){ log.debug("Deleting File from Shutdown Hook Collection"+file.getAbsolutePath()); } file.delete(); } if(log.isDebugEnabled()){ log.debug("JVM Done running VM Shutdown Hook"); } } public boolean isRegistered() { if(log.isDebugEnabled()){ if(!isRegistered){ log.debug("hook isRegistered= false"); }else{ log.debug("hook isRegistered= true"); } } return isRegistered; } public void setRegistered(boolean isRegistered) { this.isRegistered = isRegistered; } } ./src/org/apache/axiom/attachments/lifecycle/impl/LifecycleEventDefinitions.java0000664000175000017500000000204411767656530027274 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; public class LifecycleEventDefinitions { public static final int DELETE_ON_EXIT = 1; public static final int READ_ONCE_AND_DELETE = 2; public static final int DELETE_ON_TIME_INTERVAL = 3; } ./src/org/apache/axiom/attachments/lifecycle/impl/LifecycleEventHandler.java0000664000175000017500000000357511767656530026410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle.impl; import java.io.IOException; /** * The attachment life cycle manager supports create and delete operations on the FileAccessor(which holds attachment file). * These operations are coupled to events, the LifecycleManager needs to execute an operation when an even * causes that operation to trigger. For example a delete operation should execute when a deleteOnExit * or deleteOnTimeInterval event occur on FileAccessor. * * The LifecycleManager should execute operation on FileAccessor based on the Events that trigger them. * EventHandler defines methods to execute LifecycleManager operation when a event occurs. * */ public interface LifecycleEventHandler { /** * When a Event occurs in FileAccessor, execute the LifecycleManager Operation * For example, if the delete behaviour is readOnce and if the inputstream on attachment is read * and closed the first time, the delete operation in LifecycleManager should be executed. * @param eventId */ public void handleEvent(int eventId) throws IOException; } ./src/org/apache/axiom/attachments/lifecycle/DataHandlerExt.java0000664000175000017500000000367511767656530024101 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle; import java.io.IOException; public interface DataHandlerExt { /** * This method will give users an option to trigger a purge * on temporary attachment files. Temp files are created for * attachment data that is greater than a threshold limit. * On client side These temp attachment files are not deleted * untilthe virtual machine exits as user can choose to read * this dataHandler. So if user is not going to use the data * handlers provided on this temproray files they can choose * to purge the file. */ public void purgeDataSource() throws IOException; /** * This method will give users an option to trigger a delete on * temporary attachment file when DataHandler associated with the * attachment is read once. Temp files are created for * attachment data that is greater than a threshold limit. * On client side These temp attachment files are not deleted untill * the virtual machine exits. This method gives options to user to * trigger a delete on attachment files when they read the dataHandler * once. */ public void deleteWhenReadOnce() throws IOException; } ./src/org/apache/axiom/attachments/lifecycle/LifecycleManager.java0000664000175000017500000000474411767656530024441 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.lifecycle; import java.io.File; import java.io.IOException; import org.apache.axiom.attachments.lifecycle.impl.FileAccessor; /** * Lifecycle Manager will be used to manage the lifecycle of attachment files. * * Axiom forks attachment processing based on the size of attachment to be processed. * Attachments are either processed by storing them in memory or by storing them in * file system based on the size of the attachment file. * * Lifecycle Manager provides and organized way of managing attachments, by providing * calls to create and delete attachments. */ public interface LifecycleManager { /** * Create a unique file in the designated directory * @param attachmentDir * @return TODO * @throws IOException */ public FileAccessor create(String attachmentDir) throws IOException; /** * Deletes attachment file * @param file * @throws IOException */ public void delete(File file) throws IOException; /** * Mark the file for deletion on application/VM exit * @param file * @throws IOException */ public void deleteOnExit(File file) throws IOException; /** * Mark attachment file for deletion when designated time interval in seconds * has elapsed. * @param interval * @param file * @throws IOException */ public void deleteOnTimeInterval(int interval, File file) throws IOException; /** * This method will return the file accessor associated with this file. * @param file * @return TODO * @throws IOException */ public FileAccessor getFileAccessor(String file) throws IOException; } ./src/org/apache/axiom/attachments/impl/0000775000175000017500000000000011767656530017375 5ustar brianbrian./src/org/apache/axiom/attachments/impl/AbstractPart.java0000664000175000017500000001152311767656530022634 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import org.apache.axiom.attachments.Part; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.mail.Header; import javax.mail.MessagingException; import javax.mail.internet.HeaderTokenizer; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Hashtable; /** * AbstractPart is a base class for the actual * Part implementations. The primary purpose of AbstractPart is * to define some of the common methods to promote code reuse. */ abstract class AbstractPart implements Part { private static Log log = LogFactory.getLog(AbstractPart.class); // Key is the lower-case name. // Value is a javax.mail.Header object private Hashtable headers; /** * The actual parts are constructed with the PartFactory. * @see org.apache.axiom.attachments.impl.PartFactory * @param headers */ AbstractPart(Hashtable in) { headers = in; if (headers == null) { headers = new Hashtable(); } } public void addHeader(String name, String value) { if (log.isDebugEnabled()){ log.debug("addHeader: (" + name + ") value=(" + value +")"); } Header headerObj = new Header(name, value); // Use the lower case name as the key String key = name.toLowerCase(); headers.put(key, headerObj); } public Enumeration getAllHeaders() throws MessagingException { if(log.isDebugEnabled()){ log.debug("getAllHeaders"); } return headers.elements(); } public String getHeader(String name) { String key = name.toLowerCase(); Header header = (Header) headers.get(key); String value = header == null ? null : header.getValue(); if(log.isDebugEnabled()){ log.debug("getHeader name=(" + name + ") value=(" + value +")"); } return value; } public String getContentID() throws MessagingException { return getHeader("content-id"); } public String getContentType() throws MessagingException { return getHeader("content-type"); } /** * @return contentTransferEncoding * @throws MessagingException */ public String getContentTransferEncoding() throws MessagingException { if(log.isDebugEnabled()){ log.debug("getContentTransferEncoding()"); } String cte = getHeader("content-transfer-encoding"); if(log.isDebugEnabled()){ log.debug(" CTE =" + cte); } if(cte!=null){ cte = cte.trim(); if(cte.equalsIgnoreCase("7bit") || cte.equalsIgnoreCase("8bit") || cte.equalsIgnoreCase("quoted-printable") || cte.equalsIgnoreCase("base64")){ return cte; } HeaderTokenizer ht = new HeaderTokenizer(cte, HeaderTokenizer.MIME); boolean done = false; while(!done){ HeaderTokenizer.Token token = ht.next(); switch(token.getType()){ case HeaderTokenizer.Token.EOF: if(log.isDebugEnabled()){ log.debug("HeaderTokenizer EOF"); } done = true; break; case HeaderTokenizer.Token.ATOM: return token.getValue(); } } return cte; } return null; } // The following classes must be implemented by the derived class. public abstract DataHandler getDataHandler() throws MessagingException; public abstract String getFileName() throws MessagingException; public abstract InputStream getInputStream() throws IOException, MessagingException; public abstract long getSize() throws MessagingException; } ./src/org/apache/axiom/attachments/impl/PartFactory.java0000664000175000017500000003363211767656530022505 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import org.apache.axiom.attachments.MIMEBodyPartInputStream; import org.apache.axiom.attachments.Part; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.utils.BAAInputStream; import org.apache.axiom.attachments.utils.BAAOutputStream; import org.apache.axiom.om.OMException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.mail.Header; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Hashtable; import java.util.Map; /** * The PartFactory creates an object that represents a Part * (implements the Part interface). There are different ways * to represent a part (backing file or backing array etc.). * These different implementations should not be exposed to the * other layers of the code. The PartFactory helps maintain this * abstraction, and makes it easier to add new implementations. */ public class PartFactory { private static int inflight = 0; // How many attachments are currently being built. private static String semifore = "PartFactory.semifore"; private static Log log = LogFactory.getLog(PartFactory.class); // Maximum number of threads allowed through createPart private static int INFLIGHT_MAX = 4; // Constants for dynamic threshold // Dynamic Threshold = availMemory / THRESHOLD_FACTOR private static final int THRESHOLD_FACTOR = 5; /** * Creates a part from the input stream. * The remaining parameters are used to determine if the * part should be represented in memory (byte buffers) or * backed by a file. * * @param in MIMEBodyPartInputStream * @param isSOAPPart * @param thresholdSize * @param attachmentDir * @param messageContentLength * @return Part * @throws OMException if any exception is encountered while processing. */ public static Part createPart(LifecycleManager manager, MIMEBodyPartInputStream in, boolean isSOAPPart, int thresholdSize, String attachmentDir, int messageContentLength ) throws OMException { if(log.isDebugEnabled()){ log.debug("Start createPart()"); log.debug(" isSOAPPart=" + isSOAPPart); log.debug(" thresholdSize= " + thresholdSize); log.debug(" attachmentDir=" + attachmentDir); log.debug(" messageContentLength " + messageContentLength); } try { // Read enough of the InputStream to build the headers // The readHeaders returns some extra bits that were read, but are part // of the data section. Hashtable headers = new Hashtable(); InputStream dross = readHeaders(in, headers); Part part; try { // Message throughput is increased if the number of threads in this // section is limited to INFLIGHT_MAX. Allowing more threads tends to cause // thrashing while reading from the HTTP InputStream. // Allowing fewer threads reduces the thrashing. And when the remaining threads // are notified their input (chunked) data is available. // // Note: SOAPParts are at the beginning of the message and much smaller than attachments, // so don't wait on soap parts. if (!isSOAPPart) { synchronized(semifore) { if (inflight >= INFLIGHT_MAX) { semifore.wait(); } inflight++; } } // Get new threshold based on the current available memory in the runtime. // We only use the thresholds for non-soap parts. if (!isSOAPPart && thresholdSize > 0) { thresholdSize = getRuntimeThreshold(thresholdSize, inflight); } if (isSOAPPart || thresholdSize <= 0 || (messageContentLength > 0 && messageContentLength < thresholdSize)) { // If the entire message is less than the threshold size, // keep it in memory. // If this is a SOAPPart, keep it in memory. // Get the bytes of the data without a lot // of resizing and GC. The BAAOutputStream // keeps the data in non-contiguous byte buffers. BAAOutputStream baaos = new BAAOutputStream(); BufferUtils.inputStream2OutputStream(dross, baaos); BufferUtils.inputStream2OutputStream(in, baaos); part = new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length()); } else { // We need to read the input stream to determine whether // the size is bigger or smaller than the threshold. BAAOutputStream baaos = new BAAOutputStream(); int t1 = BufferUtils.inputStream2OutputStream(dross, baaos, thresholdSize); int t2 = BufferUtils.inputStream2OutputStream(in, baaos, thresholdSize - t1); int total = t1 + t2; if (total < thresholdSize) { return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length()); } else { // A BAAInputStream is an input stream over a list of non-contiguous 4K buffers. BAAInputStream baais = new BAAInputStream(baaos.buffers(), baaos.length()); part = new PartOnFile(manager, headers, baais, in, attachmentDir); } } } finally { if (!isSOAPPart) { synchronized(semifore) { semifore.notify(); inflight--; } } } return part; } catch (Exception e) { throw new OMException(e); } } /** * The implementing class must call initHeaders prior to using * any of the Part methods. * @param is * @param headers */ private static InputStream readHeaders(InputStream in, Map headers) throws IOException { if(log.isDebugEnabled()){ log.debug("initHeaders"); } boolean done = false; final int BUF_SIZE = 1024; byte[] headerBytes = new byte[BUF_SIZE]; int size = in.read(headerBytes); int index = 0; StringBuffer sb = new StringBuffer(50); while (!done && index < size) { // Get the next byte int ch = headerBytes[index]; index++; if (index == size) { size = in.read(headerBytes); index =0; } if (ch == 13) { // Get the next byte ch = headerBytes[index]; index++; if (index == size) { size = in.read(headerBytes); index =0; } if (ch == 10) { // 13, 10 indicates we are starting a new line...thus a new header // Get the next byte ch = headerBytes[index]; index++; if (index == size) { size = in.read(headerBytes); index =0; } if (ch == 13) { // Get the next byte ch = headerBytes[index]; index++; if (index == size) { size = in.read(headerBytes); index =0; } if (ch == 10) { // Blank line indicates we are done. readHeader(sb, headers); sb.delete(0, sb.length()); // Clear the buffer for reuse done = true; } } else { // Semicolon is a continuation character String check = sb.toString().trim(); if (!check.endsWith(";")) { // now parse and add the header String readHeader(sb, headers); sb.delete(0, sb.length()); // Clear the buffer for reuse } sb.append((char) ch); } } else { sb.append(13); sb.append((char) ch); } } else { sb.append((char) ch); } } if(log.isDebugEnabled()){ log.debug("End initHeaders"); } // Return an input stream containing the dross bits if (index >= size) { index = size; } ByteArrayInputStream dross = new ByteArrayInputStream(headerBytes, index, size-index); return dross; } /** * Parse the header into a name and value pair. * Add the name value pair to the map. * @param header StringBuffer * @param headers Map */ private static void readHeader(StringBuffer header, Map headers) { int delimiter = header.indexOf(":"); String name = header.substring(0, delimiter).trim(); String value = header.substring(delimiter + 1, header.length()).trim(); if (log.isDebugEnabled()){ log.debug("addHeader: (" + name + ") value=(" + value +")"); } Header headerObj = new Header(name, value); // Use the lower case name as the key String key = name.toLowerCase(); headers.put(key, headerObj); } /** * This method checks the configured threshold and * the current runtime information. If it appears that we could * run out of memory, the threshold is reduced. * * This method allows the user to request a much larger threshold without * fear of running out of memory. Using a larger in memory threshold generally * results in better throughput. * * @param configThreshold * @param inflight * @return threshold */ private static int getRuntimeThreshold(int configThreshold, int inflight) { // Determine how much free memory is available Runtime r = Runtime.getRuntime(); long totalmem = r.totalMemory(); long maxmem = r.maxMemory(); long freemem = r.freeMemory(); // @REVIEW // If maximum is not defined...limit to 1G if (maxmem == java.lang.Long.MAX_VALUE) { maxmem = 1024*1024*1024; } long availmem = maxmem - (totalmem - freemem); // Now determine the dynamic threshold int dynamicThreshold = (int) availmem / (THRESHOLD_FACTOR * inflight); // If it appears that we might run out of memory with this // threshold, reduce the threshold size. if (dynamicThreshold < configThreshold) { if (log.isDebugEnabled()) { log.debug("Using Runtime Attachment File Threshold " + dynamicThreshold); log.debug("maxmem = " + maxmem); log.debug("totalmem = " + totalmem); log.debug("freemem = " + freemem); log.debug("availmem = " + availmem); } } else { dynamicThreshold = configThreshold; if (log.isDebugEnabled()) { log.debug("Using Configured Attachment File Threshold " + configThreshold); log.debug("maxmem = " + maxmem); log.debug("totalmem = " + totalmem); log.debug("freemem = " + freemem); log.debug("availmem = " + availmem); } } return dynamicThreshold; } /** * A normal ByteArrayOutputStream, except that it returns the buffer * directly instead of returning a copy of the buffer. */ static class BAOS extends ByteArrayOutputStream { /** * Create a BAOS with a decent sized buffer */ public BAOS() { super(16 * 1024); } public byte[] toByteArray() { return buf; } } } ./src/org/apache/axiom/attachments/impl/PartOnMemoryEnhanced.java0000664000175000017500000001155311767656530024267 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import org.apache.axiom.attachments.utils.BAAInputStream; import org.apache.axiom.om.OMException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.mail.MessagingException; import javax.mail.internet.MimeUtility; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Hashtable; /** * PartOnMemoryEnhanced stores the attachment in memory (in non-contigous byte arrays) * This implementation is used for smaller attachments to enhance * performance. * * The PartOnMemoryEnhanced object is created by the PartFactory * @see PartFactory */ public class PartOnMemoryEnhanced extends AbstractPart { private static Log log = LogFactory.getLog(PartOnMemoryEnhanced.class); ArrayList data; // Arrays of 4K buffers int length; // total length of data /** * Construct a PartOnMemory * @param headers * @param data array list of 4K byte[] * @param length (length of data in bytes) */ PartOnMemoryEnhanced(Hashtable headers, ArrayList data, int length) { super(headers); this.data = data; this.length = length; } public DataHandler getDataHandler() throws MessagingException { DataSource ds = new MyByteArrayDataSource(); return new MyDataHandler(ds); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getFileName() */ public String getFileName() throws MessagingException { // There is no file name return null; } public InputStream getInputStream() throws IOException, MessagingException { return new BAAInputStream(data, length); } public long getSize() throws MessagingException { return length; } class MyDataHandler extends DataHandler { DataSource ds; public MyDataHandler(DataSource ds) { super(ds); this.ds = ds; } public void writeTo(OutputStream os) throws IOException { InputStream is = ds.getInputStream(); if (is instanceof BAAInputStream) { ((BAAInputStream)is).writeTo(os); } else { BufferUtils.inputStream2OutputStream(is, os); } } } /** * A DataSource that is backed by the byte[] and * headers map. */ class MyByteArrayDataSource implements DataSource { /* (non-Javadoc) * @see javax.activation.DataSource#getContentType() */ public String getContentType() { String ct = getHeader("content-type"); return (ct == null) ? "application/octet-stream" : ct; } /* (non-Javadoc) * @see javax.activation.DataSource#getInputStream() */ public InputStream getInputStream() throws IOException { InputStream is = new BAAInputStream(data, length); String cte = null; try { cte = getContentTransferEncoding(); if(cte != null){ if(log.isDebugEnabled()){ log.debug("Start Decoding stream"); } return MimeUtility.decode(is, cte); } } catch (MessagingException e) { if(log.isDebugEnabled()){ log.debug("Stream Failed decoding"); } throw new OMException(e); } return is; } /* (non-Javadoc) * @see javax.activation.DataSource#getName() */ public String getName() { return "MyByteArrayDataSource"; } /* (non-Javadoc) * @see javax.activation.DataSource#getOutputStream() */ public OutputStream getOutputStream() throws IOException { throw new IOException("Not Supported"); } } } ./src/org/apache/axiom/attachments/impl/PartOnMemory.java0000664000175000017500000001031011767656530022627 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import org.apache.axiom.om.OMException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.mail.MessagingException; import javax.mail.internet.MimeUtility; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Hashtable; /** * PartOnMemory stores the attachment in memory (in a byte[]) * This implementation is used for smaller attachments to enhance * performance. * * The PartOnMemory object is created by the PartFactory * @see PartFactory */ public class PartOnMemory extends AbstractPart { private static Log log = LogFactory.getLog(PartOnMemory.class); byte[] bytes; int length; /** * Construct a PartOnMemory * @param headers * @param bytes * @param length (length of data in bytes) */ PartOnMemory(Hashtable headers, byte[] bytes, int length) { super(headers); this.bytes = bytes; this.length = length; } public DataHandler getDataHandler() throws MessagingException { DataSource ds = new MyByteArrayDataSource(); return new DataHandler(ds); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getFileName() */ public String getFileName() throws MessagingException { // There is no file name return null; } public InputStream getInputStream() throws IOException, MessagingException { return new ByteArrayInputStream(bytes, 0, length); } public long getSize() throws MessagingException { return length; } /** * A DataSource that is backed by the byte[] and * headers map. */ class MyByteArrayDataSource implements DataSource { /* (non-Javadoc) * @see javax.activation.DataSource#getContentType() */ public String getContentType() { String ct = getHeader("content-type"); return (ct == null) ? "application/octet-stream" : ct; } /* (non-Javadoc) * @see javax.activation.DataSource#getInputStream() */ public InputStream getInputStream() throws IOException { InputStream is = new ByteArrayInputStream(bytes, 0, length); String cte = null; try { cte = getContentTransferEncoding(); if(cte != null){ if(log.isDebugEnabled()){ log.debug("Start Decoding stream"); } return MimeUtility.decode(is, cte); } } catch (MessagingException e) { if(log.isDebugEnabled()){ log.debug("Stream Failed decoding"); } throw new OMException(e); } return is; } /* (non-Javadoc) * @see javax.activation.DataSource#getName() */ public String getName() { return "MyByteArrayDataSource"; } /* (non-Javadoc) * @see javax.activation.DataSource#getOutputStream() */ public OutputStream getOutputStream() throws IOException { throw new IOException("Not Supported"); } } } ./src/org/apache/axiom/attachments/impl/BufferUtils.java0000664000175000017500000002767611767656530022514 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import javax.activation.DataHandler; import org.apache.axiom.attachments.utils.BAAOutputStream; import org.apache.axiom.ext.io.ReadFromSupport; import org.apache.axiom.util.activation.DataSourceUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Attachment processing uses a lot of buffers. * The BufferUtils class attempts to reuse buffers to prevent * excessive GarbageCollection */ public class BufferUtils { private static Log log = LogFactory.getLog(BufferUtils.class); // Performance testing indicates that 4K is the best size for medium // and small payloads. And there is a neglible effect on large payloads. public final static int BUFFER_LEN = 4 * 1024; // Copy Buffer size static boolean ENABLE_FILE_CHANNEL = true; // Enable file channel optimization static boolean ENABLE_BAAOS_OPT = true; // Enable BAAOutputStream opt private static byte[] _cacheBuffer = new byte[BUFFER_LEN]; private static boolean _cacheBufferInUse = false; private static ByteBuffer _cacheByteBuffer = ByteBuffer.allocate(BUFFER_LEN); private static boolean _cacheByteBufferInUse = false; /** * Private utility to write the InputStream contents to the OutputStream. * @param is * @param os * @throws IOException */ public static void inputStream2OutputStream(InputStream is, OutputStream os) throws IOException { // If this is a FileOutputStream, use the optimized method if (ENABLE_FILE_CHANNEL && os instanceof FileOutputStream) { if (inputStream2FileOutputStream(is, (FileOutputStream) os)) { return; } } // If the stream implements ReadFromSupport, use the optimized method if (ENABLE_BAAOS_OPT && os instanceof ReadFromSupport) { ((ReadFromSupport)os).readFrom(is, Long.MAX_VALUE); return; } byte[] buffer = getTempBuffer(); try { int bytesRead = is.read(buffer); // Continue reading until no bytes are read and no // bytes are now available. while (bytesRead > 0 || is.available() > 0) { if (bytesRead > 0) { os.write(buffer, 0, bytesRead); } bytesRead = is.read(buffer); } } finally { releaseTempBuffer(buffer); } } /** * @param is InputStream * @param os OutputStream * @param limit maximum number of bytes to read * @return total bytes read * @throws IOException */ public static int inputStream2OutputStream(InputStream is, OutputStream os, int limit) throws IOException { // If the stream implements ReadFromSupport, use the optimized method if (ENABLE_BAAOS_OPT && os instanceof ReadFromSupport) { return (int) ((ReadFromSupport)os).readFrom(is, limit); } byte[] buffer = getTempBuffer(); int totalWritten = 0; int bytesRead = 0; try { do { int len = (limit-totalWritten) > BUFFER_LEN ? BUFFER_LEN : (limit-totalWritten); bytesRead = is.read(buffer, 0, len); if (bytesRead > 0) { os.write(buffer, 0, bytesRead); if (bytesRead > 0) { totalWritten += bytesRead; } } } while (totalWritten < limit && (bytesRead > 0 || is.available() > 0)); return totalWritten; } finally { releaseTempBuffer(buffer); } } /** * Opimized writing to FileOutputStream using a channel * @param is * @param fos * @return false if lock was not aquired * @throws IOException */ public static boolean inputStream2FileOutputStream(InputStream is, FileOutputStream fos) throws IOException { // See if a file channel and lock can be obtained on the FileOutputStream FileChannel channel = null; FileLock lock = null; ByteBuffer bb = null; try { channel = fos.getChannel(); if (channel != null) { lock = channel.tryLock(); } bb = getTempByteBuffer(); } catch (Throwable t) { } if (lock == null || bb == null || !bb.hasArray()) { releaseTempByteBuffer(bb); return false; // lock could not be set or bb does not have direct array access } try { // Read directly into the ByteBuffer array int bytesRead = is.read(bb.array()); // Continue reading until no bytes are read and no // bytes are now available. while (bytesRead > 0 || is.available() > 0) { if (bytesRead > 0) { int written = 0; if (bytesRead < BUFFER_LEN) { // If the ByteBuffer is not full, allocate a new one ByteBuffer temp = ByteBuffer.allocate(bytesRead); temp.put(bb.array(), 0, bytesRead); temp.position(0); written = channel.write(temp); } else { // Write to channel bb.position(0); written = channel.write(bb); bb.clear(); } } // REVIEW: Do we need to ensure that bytesWritten is // the same as the number of bytes sent ? bytesRead = is.read(bb.array()); } } finally { // Release the lock lock.release(); releaseTempByteBuffer(bb); } return true; } /** * inputStream2BAAOutputStream * @param is * @param baaos * @param limit * @return TODO */ public static long inputStream2BAAOutputStream(InputStream is, BAAOutputStream baaos, long limit) throws IOException { return baaos.receive(is, limit); } /** * Exception used by SizeLimitedOutputStream if the size limit has been exceeded. */ private static class SizeLimitExceededException extends IOException { private static final long serialVersionUID = -6644887187061182165L; } /** * An output stream that counts the number of bytes written to it and throws an * exception when the size exceeds a given limit. */ private static class SizeLimitedOutputStream extends OutputStream { private final int maxSize; private int size; public SizeLimitedOutputStream(int maxSize) { this.maxSize = maxSize; } public void write(byte[] b, int off, int len) throws IOException { size += len; checkSize(); } public void write(byte[] b) throws IOException { size += b.length; checkSize(); } public void write(int b) throws IOException { size++; checkSize(); } private void checkSize() throws SizeLimitExceededException { if (size > maxSize) { throw new SizeLimitExceededException(); } } } /** * The method checks to see if attachment is eligble for optimization. * An attachment is eligible for optimization if and only if the size of * the attachment is greated then the optimzation threshold size limit. * if the Content represented by DataHandler has size less than the * optimize threshold size, the attachment will not be eligible for * optimization, instead it will be inlined. * @param dh * @param limit * @return 1 if DataHandler data is bigger than limit, 0 if DataHandler data is smaller or * -1 if an error occurs or unsupported. * @throws IOException */ public static int doesDataHandlerExceedLimit(DataHandler dh, int limit){ //If Optimized Threshold not set return true. if(limit==0){ return -1; } long size = DataSourceUtils.getSize(dh.getDataSource()); if (size != -1) { return size > limit ? 1 : 0; } else { // In all other cases, we prefer DataHandler#writeTo over DataSource#getInputStream. // The reason is that if the DataHandler was constructed from an Object rather than // a DataSource, a call to DataSource#getInputStream() will start a new thread and // return a PipedInputStream. This is so for Geronimo's as well as Sun's JAF // implementaion. The reason is that DataContentHandler only has a writeTo and no // getInputStream method. Obviously starting a new thread just to check the size of // the data is an overhead that we should avoid. try { dh.writeTo(new SizeLimitedOutputStream(limit)); } catch (SizeLimitExceededException ex) { return 1; } catch (IOException ex) { log.warn(ex.getMessage()); return -1; } return 0; } } private static synchronized byte[] getTempBuffer() { // Try using cached buffer synchronized(_cacheBuffer) { if (!_cacheBufferInUse) { _cacheBufferInUse = true; return _cacheBuffer; } } // Cache buffer in use, create new buffer return new byte[BUFFER_LEN]; } private static void releaseTempBuffer(byte[] buffer) { // Try using cached buffer synchronized(_cacheBuffer) { if (buffer == _cacheBuffer) { _cacheBufferInUse = false; } } } private static synchronized ByteBuffer getTempByteBuffer() { // Try using cached buffer synchronized(_cacheByteBuffer) { if (!_cacheByteBufferInUse) { _cacheByteBufferInUse = true; return _cacheByteBuffer; } } // Cache buffer in use, create new buffer return ByteBuffer.allocate(BUFFER_LEN); } private static void releaseTempByteBuffer(ByteBuffer buffer) { // Try using cached buffer synchronized(_cacheByteBuffer) { if (buffer == _cacheByteBuffer) { _cacheByteBufferInUse = false; } } } } ./src/org/apache/axiom/attachments/impl/PartOnFile.java0000664000175000017500000000611211767656530022243 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.impl; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.lifecycle.impl.FileAccessor; import javax.activation.DataHandler; import javax.mail.MessagingException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Hashtable; /** * PartOnFile stores that attachment in a file. * This implementation is used for very large attachments to reduce * the in-memory footprint. * * The PartOnFile object is created by the PartFactory * @see PartFactory */ public class PartOnFile extends AbstractPart { FileAccessor fileAccessor; LifecycleManager manager; /** * Create a PartOnFile from the specified InputStream * @param headers Hashtable of javax.mail.Headers * @param in1 InputStream containing data * @param in2 InputStream containing data * @param attachmentDir String */ PartOnFile(LifecycleManager manager, Hashtable headers, InputStream is1, InputStream is2, String attachmentDir) throws IOException { super(headers); fileAccessor = manager.create(attachmentDir); // Now write the data to the backing file OutputStream fos = fileAccessor.getOutputStream(); BufferUtils.inputStream2OutputStream(is1, fos); BufferUtils.inputStream2OutputStream(is2, fos); fos.flush(); fos.close(); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getDataHandler() */ public DataHandler getDataHandler() throws MessagingException { return fileAccessor.getDataHandler(getContentType()); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getFileName() */ public String getFileName() throws MessagingException { return fileAccessor.getFileName(); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getInputStream() */ public InputStream getInputStream() throws IOException, MessagingException { return fileAccessor.getInputStream(); } /* (non-Javadoc) * @see org.apache.axiom.attachments.impl.AbstractPart#getSize() */ public long getSize() { return fileAccessor.getSize(); } } ./src/org/apache/axiom/attachments/ConfigurableDataHandler.java0000664000175000017500000000516411767656530023775 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import javax.activation.DataHandler; import javax.activation.DataSource; import java.net.URL; /** * This Axiom DataHandler inplementation allows the user to set custom values for the following MIME * body part headers.

        • content-transfer-encoding
        • content-type

        Data * written to the MIME part gets encoded by content-transfer-encoding specified as above

        *

        *

        Usage is Similar to the javax.activation.DataHandler except for the setting of the above * properties.

        eg:

        dataHandler = new ConfigurableDataHandler(new * ByteArrayDataSource(byteArray));

        dataHandler.setTransferEncoding("quoted-printable");

        *

        dataHandler.setContentType("image/jpg");

        * * @see javax.activation.DataHandler */ public class ConfigurableDataHandler extends DataHandler { private String transferEncoding; private String contentType; private String contentID; public ConfigurableDataHandler(DataSource arg0) { super(arg0); } public ConfigurableDataHandler(Object arg0, String arg1) { super(arg0, arg1); } public ConfigurableDataHandler(URL arg0) { super(arg0); } // public String getContentID() { // return contentID; // } // // public void setContentID(String contentID) { // this.contentID = contentID; // } public String getContentType() { if (contentType != null) { return contentType; } else { return super.getContentType(); } } public void setContentType(String contentType) { this.contentType = contentType; } public String getTransferEncoding() { return transferEncoding; } public void setTransferEncoding(String transferEncoding) { this.transferEncoding = transferEncoding; } } ./src/org/apache/axiom/attachments/MultipartAttachmentStreams.java0000664000175000017500000000731311767656530024634 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import org.apache.axiom.om.OMException; import javax.mail.Header; import javax.mail.MessagingException; import javax.mail.internet.InternetHeaders; import java.io.IOException; import java.util.Enumeration; /** * The MultipartAttachmentStreams class is used to create IncomingAttachmentInputStream objects when * the HTTP stream shows a marked separation between the SOAP and each attachment parts. Unlike the * DIME version, this class will use the BoundaryDelimitedStream to parse data in the SwA format. * Another difference between the two is that the MultipartAttachmentStreams class must also provide * a way to hold attachment parts parsed prior to where the SOAP part appears in the HTTP stream * (i.e. the root part of the multipart-related message). Our DIME counterpart didn't have to worry * about this since the SOAP part is guaranteed to be the first in the stream. But since SwA has no * such guarantee, we must fall back to caching these first parts. Afterwards, we can stream the * rest of the attachments that are after the SOAP part of the request message. */ public final class MultipartAttachmentStreams extends IncomingAttachmentStreams { private BoundaryDelimitedStream _delimitedStream = null; public MultipartAttachmentStreams(BoundaryDelimitedStream delimitedStream) throws OMException { this._delimitedStream = delimitedStream; } public IncomingAttachmentInputStream getNextStream() throws OMException { IncomingAttachmentInputStream stream; if (!isReadyToGetNextStream()) { throw new IllegalStateException("nextStreamNotReady"); } InternetHeaders headers; try { _delimitedStream = _delimitedStream.getNextStream(); if (_delimitedStream == null) { return null; } headers = new InternetHeaders(_delimitedStream); } catch (IOException ioe) { ioe.printStackTrace(); throw new OMException(ioe); } catch (MessagingException me) { me.printStackTrace(); throw new OMException(me); } stream = new IncomingAttachmentInputStream(_delimitedStream, this); Header header; String name; String value; Enumeration e = headers.getAllHeaders(); while (e != null && e.hasMoreElements()) { header = (Header) e.nextElement(); name = header.getName(); value = header.getValue(); if (IncomingAttachmentInputStream.HEADER_CONTENT_ID.equals(name) || IncomingAttachmentInputStream.HEADER_CONTENT_TYPE.equals(name) || IncomingAttachmentInputStream.HEADER_CONTENT_LOCATION.equals(name)) { value = value.trim(); } stream.addHeader(name, value); } setReadyToGetNextStream(false); return stream; } } ./src/org/apache/axiom/attachments/Part.java0000664000175000017500000000575111767656530020215 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import javax.activation.DataHandler; import javax.mail.MessagingException; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; /** * Abstract for Part. A Part can be the SOAP Part or an Attachment Part. * There are several implementations for part, which are optimized for * space and time. * * A Part is created with the PartFactory. * * @see org.apache.axiom.attachments.impl.PartFactory */ public interface Part { /** * @return DataHandler representing this part * @throws MessagingException */ public DataHandler getDataHandler() throws MessagingException; /** * @return size * @throws MessagingException */ public long getSize() throws MessagingException; /** * @return content type of the part * @throws MessagingException */ public String getContentType() throws MessagingException; /** * @return content id of the part * @throws MessagingException */ public String getContentID() throws MessagingException; /** * The part may be backed by a file. If that is the case, * this method returns the file name. * * @return the name of the file * @throws MessagingException * @deprecated The callers should not no how the part * is implemented. */ public String getFileName() throws MessagingException; /** * @return Get the part data as an input stream * @throws IOException * @throws MessagingException */ public InputStream getInputStream() throws IOException, MessagingException; /** * Add a Header (name, value) to the part * @param name * @param value * @throws MessagingException */ public void addHeader(String name, String value) throws MessagingException; /** * Get the value of a specific header * @param name * @return value or null * @throws MessagingException */ public String getHeader(String name) throws MessagingException; /** * @return Enumeration of javax.mail.Header * @throws MessagingException */ public Enumeration getAllHeaders() throws MessagingException; } ./src/org/apache/axiom/attachments/MIMEBodyPartInputStream.java0000664000175000017500000001065711767656530023700 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; /** * MIMEBodyPartInputStream * */ public class MIMEBodyPartInputStream extends InputStream { BoundaryPushbackInputStream bpis; PushbackInputStream inStream; Attachments parent = null; boolean done = false; /** * @param inStream * @param boundary */ public MIMEBodyPartInputStream(PushbackInputStream inStream, byte[] boundary) { this (inStream, boundary, null, boundary.length + 2); } /** * @param inStream * @param boundary * @param parent */ public MIMEBodyPartInputStream(PushbackInputStream inStream, byte[] boundary, Attachments parent) { this (inStream, boundary, parent, boundary.length + 2); } /** * @param inStream * @param boundary * @param parent * @param pushbacksize <= size of pushback buffer on inStream */ public MIMEBodyPartInputStream(PushbackInputStream inStream, byte[] boundary, Attachments parent, int pushbacksize) { bpis = new BoundaryPushbackInputStream(inStream, boundary, pushbacksize); this.inStream = inStream; this.parent = parent; } /* (non-Javadoc) * @see java.io.InputStream#read() */ public int read() throws IOException { if (done) { return -1; } int rc = bpis.read(); if (getBoundaryStatus()) { finish(); } return rc; } /* (non-Javadoc) * @see java.io.InputStream#read(byte[], int, int) */ public int read(byte[] b, int off, int len) throws IOException { if (done) { return -1; } int rc = bpis.read(b, off, len); if (getBoundaryStatus()) { finish(); } return rc; } /* (non-Javadoc) * @see java.io.InputStream#read(byte[]) */ public int read(byte[] b) throws IOException { if (done) { return -1; } int rc = bpis.read(b); if (getBoundaryStatus()) { finish(); } return rc; } /** * Called when done reading * This method detects trailing -- and alerts the parent * @throws IOException */ private void finish() throws IOException { if (!done) { int one = inStream.read(); // Accept -- if (one != -1) { int two = inStream.read(); if (two != -1) { if (one == 45 && two == 45) { // Accept -- if (parent != null) { parent.setEndOfStream(true); } } else { inStream.unread(two); inStream.unread(one); } } else { inStream.unread(one); } } one = inStream.read(); // Accept /r/n if (one != -1) { int two = inStream.read(); if (two != -1) { if (one == 13 && two == 10) { // Accept /r/n and continue } else { inStream.unread(two); inStream.unread(one); } } else { inStream.unread(one); } } } done = true; } public boolean getBoundaryStatus() { return bpis.getBoundaryStatus(); } }./src/org/apache/axiom/attachments/utils/0000775000175000017500000000000011767656530017574 5ustar brianbrian./src/org/apache/axiom/attachments/utils/ByteSearch.java0000664000175000017500000001775511767656530022507 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.utils; /** * ByteSearch * * Various byte array searching utilities. * This includes a "skip search", which is a * an optimized search for finding a byte pattern in * a large byte array. * * @author Richard Scheuerle (scheu@us.ibm.com) * */ public class ByteSearch { /** * Search a byte sequence for a given pattern. The method uses the * skip search algorithm. The search can be performed in forward * or backward direction, i.e. beginning from the start or end of the * byte sequence. * * @param pattern byte[] * @param direction true if forward, false if backward * @param buffer byte[] to search * @param start index to start search * @param end index to end search (end index is not within the search) * @param skip short[256] A skipArray generated from a call to * generateSkipArray. * @return index or -1 if not found */ public static int skipSearch(byte[] pattern, boolean direction, byte[] buffer, int start, int end, short[] skip) { int patternLength = pattern.length; // If patternLength is larger than buffer, // return not found if (patternLength > (end - start)) { return -1; } if (direction) { int k = 0; for (k = start + patternLength - 1; k < end; // end is exclusive k += skip[buffer[k] & (0xff)]) // SKIP NOTE below { try { // k is the location in the buffer // that may match the last byte in the pattern. if (isEqual(pattern, buffer, (k-patternLength)+1, end)) { return (k-patternLength)+1; } // SKIP NOTE: The next k index is calculated from // the skip array. Basically if the k byte is not // within the pattern, we skip ahead the length of the // pattern. Otherwise we skip ahead a distance less // than the length. } catch (ArrayIndexOutOfBoundsException e) { throw e; } } } else { for (int k = end - patternLength; k <= start; k -= skip[buffer[k] & (0xff)]) { try { // k is the location in the buffer // that may match the first byte in the pattern. if (isEqual(pattern, buffer, k, end)) { return k; } } catch (ArrayIndexOutOfBoundsException e) { throw e; } } } return -1; } /** * skipArray * Builds a skip array for this pattern and direction. * The skipArray is used in the optimized skipSearch * @param pattern * @param direction * @return short[256] */ public static short[] getSkipArray(byte[] pattern, boolean direction) { // The index key is a byte. // The short[key] is the number of bytes that can // be skipped that won't match the pattern short[] skip = new short[256]; // If a byte is not within pattern, then we can // skip ahead the entire length of the pattern. // So fill the skip array with the pattern length java.util.Arrays.fill(skip, (short) pattern.length); if (direction) { // If the byte is found in the pattern, // this affects how far we can skip. // The skip distance is the distance of the // character from the end of the pattern. // The last character in the pattern is excluded. for (int k = 0; k < pattern.length -1; k++) { skip[pattern[k] & (0xff)] = (short)(pattern.length - k - 1); } } else { for (int k = pattern.length-2; k >= 0; k--) { skip[pattern[k] &(0xff)] = (short)(pattern.length - k - 1); } } return skip; } /** * * isEqual * @param pattern * @param buffer * @param start index * @param end index * @return true if the bytes in buffer[start] equal pattern * */ public static boolean isEqual(byte[] pattern, byte[] buffer, int start, int end) { // if (pattern.length >= end-start) { if (pattern.length > end-start) { return false; } for (int j=0; j= end) { found = false; } else { found = (bytes[i+i2] == search[i2]); } } // If found match, set return idx if (found) { idx = i; } } } } else { for (int i=end-1; idx < 0 && i>=start; i--) { if (bytes[i] == search[0]) { // Potential match..check remaining bytes boolean found = true; // assume found for (int i2=1; found && i2= end) { found = false; } else { found = (bytes[i+i2] == search[i2]); } } // If found match, set return idx if (found) { idx = i; } } } } return idx; } } ./src/org/apache/axiom/attachments/utils/IOUtils.java0000664000175000017500000000650511767656530021775 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.utils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; /** Utility class containing IO helper methods */ public class IOUtils { private IOUtils() { } /** * Reads into a byte array. Ensures that the full buffer is read. Helper method, just calls * readFully(in, b, 0, b.length) * * @see #readFully(java.io.InputStream, byte[], int, int) */ public static int readFully(InputStream in, byte[] b) throws IOException { return readFully(in, b, 0, b.length); } /** * Same as the normal in.read(b, off, len), but tries to ensure that the entire len * number of bytes is read. * * @return Returns the number of bytes read, or -1 if the end of file is reached before any * bytes are read */ public static int readFully(InputStream in, byte[] b, int off, int len) throws IOException { int total = 0; for (; ;) { int got = in.read(b, off + total, len - total); if (got < 0) { return (total == 0) ? -1 : total; } else { total += got; if (total == len) return total; } } } /** * Returns the contents of the input stream as byte array. * * @param stream the InputStream * @return the stream content as byte array */ public static byte[] getStreamAsByteArray(InputStream stream) throws IOException { return getStreamAsByteArray(stream, -1); } /** * Returns the contents of the input stream as byte array. * * @param stream the InputStream * @param length the number of bytes to copy, if length < 0, the number is unlimited * @return the stream content as byte array */ public static byte[] getStreamAsByteArray(InputStream stream, int length) throws IOException { if (length == 0) return new byte[0]; boolean checkLength = true; if (length < 0) { length = Integer.MAX_VALUE; checkLength = false; } ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); int nextValue = stream.read(); if (checkLength) length--; while (-1 != nextValue && length >= 0) { byteStream.write(nextValue); nextValue = stream.read(); if (checkLength) length--; } return byteStream.toByteArray(); } } ./src/org/apache/axiom/attachments/utils/BAAInputStream.java0000664000175000017500000000772511767656530023231 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.utils; import org.apache.axiom.attachments.impl.BufferUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; /** * BAAInputStream is like a ByteArrayInputStream. * A ByteArrayInputStream stores the backing data in a byte[]. * BAAInputStream stores the backing data in a Array of * byte[]. Using several non-contiguous chunks reduces * memory copy and resizing. */ public class BAAInputStream extends InputStream { ArrayList data = new ArrayList(); final static int BUFFER_SIZE = BufferUtils.BUFFER_LEN; int i; int size; int currIndex; int totalIndex; int mark = 0; byte[] currBuffer = null; byte[] read_byte = new byte[1]; public BAAInputStream(ArrayList data, int size) { this.data = data; this.size = size; i = 0; currIndex = 0; totalIndex = 0; currBuffer = (byte[]) data.get(0); } public int read() throws IOException { int read = read(read_byte); if (read < 0) { return -1; } else { return read_byte[0] & 0xFF; } } public int available() throws IOException { return size - totalIndex; } public synchronized void mark(int readlimit) { mark = totalIndex; } public boolean markSupported() { return true; } public int read(byte[] b, int off, int len) throws IOException { int total = 0; if (totalIndex >= size) { return -1; } while (total < len && totalIndex < size) { int copy = Math.min(len - total, BUFFER_SIZE - currIndex); copy = Math.min(copy, size - totalIndex); System.arraycopy(currBuffer, currIndex, b, off, copy); total += copy; currIndex += copy; totalIndex += copy; off += copy; if (currIndex >= BUFFER_SIZE) { if (i+1 < data.size()) { currBuffer = (byte[]) data.get(i+1); i++; currIndex = 0; } else { currBuffer = null; currIndex = BUFFER_SIZE; } } } return total; } public int read(byte[] b) throws IOException { return this.read(b, 0, b.length); } public synchronized void reset() throws IOException { i = mark / BUFFER_SIZE; currIndex = mark - (i * BUFFER_SIZE); currBuffer = (byte[]) data.get(i); totalIndex = mark; } /** * Write all of the buffers to the output stream * @param os * @throws IOException */ public void writeTo(OutputStream os) throws IOException { if (data != null) { int numBuffers = data.size(); for (int j = 0; j < numBuffers-1; j ++) { os.write( (byte[]) data.get(j), 0, BUFFER_SIZE); } if (numBuffers > 0) { int writeLimit = size - ((numBuffers-1) * BUFFER_SIZE); os.write( (byte[]) data.get(numBuffers-1), 0, writeLimit); } } } } ./src/org/apache/axiom/attachments/utils/DataHandlerUtils.java0000775000175000017500000000271611767656530023640 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.utils; import javax.activation.DataHandler; import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.util.base64.Base64Utils; public class DataHandlerUtils { public static Object getDataHandlerFromText(String value, String mimeType) { ByteArrayDataSource dataSource; byte[] data = Base64Utils.decode(value); if (mimeType != null) { dataSource = new ByteArrayDataSource(data, mimeType); } else { // Assumes type as application/octet-stream dataSource = new ByteArrayDataSource(data); } return new DataHandler(dataSource); } } ./src/org/apache/axiom/attachments/utils/BAAOutputStream.java0000664000175000017500000001001511767656530023414 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments.utils; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.ext.io.ReadFromSupport; import org.apache.axiom.ext.io.StreamCopyException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; /** * BAAOutputStream is like a ByteArrayOutputStream. * A ByteArrayOutputStream stores the backing data in a byte[]. * BAAOutputStream stores the backing data in a Array of * byte[]. Using several non-contiguous chunks reduces * memory copy and resizing. */ public class BAAOutputStream extends OutputStream implements ReadFromSupport { ArrayList data = new ArrayList(); final static int BUFFER_SIZE = BufferUtils.BUFFER_LEN; int index = 0; byte[] currBuffer = null; public BAAOutputStream() { super(); addBuffer(); } private void addBuffer() { currBuffer = new byte[BUFFER_SIZE]; data.add(currBuffer); index = 0; } public void write(byte[] b, int off, int len) throws IOException { int total = 0; while (total < len) { int copy = Math.min(len-total, BUFFER_SIZE-index); System.arraycopy(b, off, currBuffer, index, copy); total += copy; index += copy; off += copy; if (index >= BUFFER_SIZE) { addBuffer(); } } } public void write(byte[] b) throws IOException { this.write(b, 0, b.length); } byte[] writeByte = new byte[1]; public void write(int b) throws IOException { writeByte[0] = (byte) b; this.write(writeByte, 0, 1); } public ArrayList buffers() { return data; } public int length() { return (BUFFER_SIZE * (data.size()-1)) + index; } /** * @param is InputStream containing data * @param maxRead the maximum number of bytes to receive * @return bytesReceived */ public long receive(InputStream is, long maxRead) throws IOException { return readFrom(is, maxRead); } public long readFrom(InputStream is, long maxRead) throws StreamCopyException { if (maxRead == -1) { maxRead = Long.MAX_VALUE; } long bytesReceived = 0; // Now directly write to the buffers boolean done = false; while (!done) { // Don't get more than will fit in the current buffer int len = (int) Math.min(BUFFER_SIZE - index, maxRead-bytesReceived); // Now get the bytes int bytesRead; try { bytesRead = is.read(currBuffer, index, len); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } if (bytesRead >= 0) { bytesReceived += bytesRead; index += bytesRead; if (index >= BUFFER_SIZE) { addBuffer(); } if (bytesReceived >= maxRead) { done = true; } } else { done = true; } } return bytesReceived; } } ./src/org/apache/axiom/attachments/BoundaryPushbackInputStream.java0000664000175000017500000002625111767656530024745 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import org.apache.axiom.attachments.utils.ByteSearch; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * An InputStream that reads bytes up to a boundary. * The boundary is not logically part of the bytes to read. * The wrapped PushbackInputStream is set to to the byte after * the boundary once the bytes are read. * The boundary is not logically returned. * * There are two forms that are supported, where . is a byte * * .......................boundary * * and * * ..................../r/nboundary * * In both cases, only the bytes (.) are returned. * */ public class BoundaryPushbackInputStream extends InputStream { private static Log log = LogFactory.getLog(BoundaryPushbackInputStream.class); private static boolean isDebugEnabled = log.isDebugEnabled(); PushbackInputStream is; boolean boundaryFound; byte[] boundary; int rnBoundaryLen; // '/r/nboundary' length byte[] buffer; int bufferSize; // BufferSize int numBytes; // Number of bytes in the buffer int index = -1; // Current index in buffer int bIndex = -1; // Index of boundary or /r/nboundary final int MIN_BUF_SIZE = 32; protected static final int BOUNDARY_NT_FOUND = -1; // Skip search array private short[] skip = null; // Working byte for read() private byte[] read_byte = new byte[1]; /** * @param inStream * @param boundary * @param pushBackSize */ public BoundaryPushbackInputStream(PushbackInputStream inStream, byte[] boundary, int pushBackSize) { super(); this.is = inStream; this.boundary = boundary; this.rnBoundaryLen = boundary.length + 2; // The buffer must accomodate twice the boundary length and // the maximum that we will ever push back (which is the entire buffer except for // the boundary) this.bufferSize = Math.max(rnBoundaryLen * 2, pushBackSize + boundary.length); } /** * Method readFromStream * * @param b * @param start * @param length * * @return * * @throws java.io.IOException */ private final int readFromStream( final byte[] b, final int start, final int length) throws java.io.IOException { // We need to make sure to capture enough data to // actually search for the rn + boundary int minRead = Math.max(rnBoundaryLen * 2, length); minRead = Math.min(minRead, length - start); int br = 0; int brTotal = 0; do { // Read data into the buffer br = is.read(b, brTotal + start, length - brTotal); if (br > 0) { brTotal += br; } } while ((br > 0) && (brTotal < minRead)); return (brTotal != 0) ? brTotal : br; } /** * @param b * @return * @throws java.io.IOException */ private final int readFromStream(final byte[] b) throws java.io.IOException { return readFromStream(b, 0, b.length); } /* (non-Javadoc) * @see java.io.InputStream#read(byte[]) */ public int read(byte[] b) throws java.io.IOException { return read(b, 0, b.length); } /** * Read from the boundary delimited stream. * Generally, this won't be called...callers will * most likely call the read(byte[]..) methods * @return The byte read, or -1 if endof stream. * * @throws java.io.IOException */ public int read() throws java.io.IOException { // Short cut to avoid buffer copying if (buffer != null && index > 0) { if ((bIndex > 0 && (index+1) < bIndex) || bIndex < 0 && index < (numBytes - rnBoundaryLen)) { index++; return (buffer[index-1]); } } int read = read(read_byte); if (read < 0) { return -1; } else { return read_byte[0]; } } /** * Read from the boundary delimited stream. * @param b is the array to read into. * @param off is the offset * @param len * @return the number of bytes read. -1 if endof stream. * * @throws java.io.IOException */ public int read(byte[] b, final int off, final int len) throws java.io.IOException { // If already found the buffer, then we are done if (boundaryFound) { return -1; } // The first time called, read a chunk of data if (buffer == null) { // Allocate the buffer. buffer = new byte[bufferSize]; numBytes = readFromStream(buffer); if (numBytes < 0) { buffer = null; boundaryFound = true; } index = 0; // Finds the boundary pos. bIndex = boundaryPosition(buffer, index, numBytes); if (bIndex >=0) { unread(); // Unread pushback inputstream } } int bwritten = 0; // Number of bytes written to b do { // Never read to the end of the buffer because // the boundary may span buffers. int bcopy = Math.min((numBytes - rnBoundaryLen) - index, len - bwritten); // Never read past the boundary if (bIndex >= 0) { bcopy = Math.min(bcopy, bIndex - index); } // Copy the bytes if (bcopy > 0) { System.arraycopy(buffer, index, b, off + bwritten, bcopy); bwritten += bcopy; index += bcopy; } if (index == bIndex) { boundaryFound = true; } else if (bwritten < len) { // If more data is needed, // create a temporary buffer to span // the straggling bytes in the current buffer // and the new yet unread bytes byte[] dstbuf = buffer; // Move straggling bytes from the current buffer int movecnt = numBytes - index; System.arraycopy(buffer, index, dstbuf, 0, movecnt); // Read in the new data. int readcnt = readFromStream(dstbuf, movecnt, dstbuf.length - movecnt); if (readcnt < 0) { if (log.isDebugEnabled()) { log.debug("End of Stream, but boundary not found"); log.debug(toString()); } buffer = null; boundaryFound = true; throw new java.io.IOException("End of Stream, but boundary not found"); } numBytes = readcnt + movecnt; buffer = dstbuf; index = 0; // start at the begining. // just move the boundary by what we moved if (bIndex >=0) { bIndex -= movecnt; } else { bIndex = boundaryPosition( buffer, index, numBytes); if (bIndex >= 0) { unread(); // Unread pushback inputstream } } } } // read till we get the amount or the stream is finished. while (!boundaryFound && (bwritten < len)); if (boundaryFound) { buffer = null; // GC the buffer } return bwritten; } /** * Unread the bytes past the buffer */ private void unread() throws IOException { int i = bIndex; if (buffer[i] == 13) { // If /r, must be /r/nboundary i = i + this.rnBoundaryLen; } else { i = i + boundary.length; } if (numBytes - i > 0) { is.unread(buffer, i, numBytes - i); } } /** * Read from the boundary delimited stream. * * @param searchbuf * @param start * @param end * @return The position of the boundary. * */ protected int boundaryPosition(byte[] searchbuf, int start, int end) throws java.io.IOException { if (skip == null) { skip = ByteSearch.getSkipArray(boundary, true); } int foundAt = ByteSearch.skipSearch(boundary, true,searchbuf, start, end, skip); // Backup 2 if the boundary is preceeded by /r/n // The /r/n are treated as part of the boundary if (foundAt >=2) { if (searchbuf[foundAt-2] == 13 && searchbuf[foundAt-1] == 10) { foundAt = foundAt -2; } } return foundAt; } public boolean getBoundaryStatus() { return boundaryFound; } /** * toString * dumps state information. Effective for debug trace. */ public String toString() { final String newline = "\n"; StringBuffer sb = new StringBuffer(); sb.append("========================"); sb.append(newline); sb.append("BoundaryPushbackInputStream"); sb.append(newline); sb.append(" boundary = " + new String(this.boundary) ); sb.append(newline); sb.append(" boundaryFound = " + boundaryFound); sb.append(newline); int available = 0; try { available = is.available(); } catch (Throwable t) { ; // Suppress...toString is called for debug } sb.append(" is available = " + available ); sb.append(newline); sb.append(" bufferSize = " + bufferSize); sb.append(newline); sb.append(" bufferNumBytes = " + bufferSize); sb.append(newline); sb.append(" bufferIndex = " + index); sb.append(newline); sb.append(" boundaryIndex = " + bIndex); sb.append(newline); sb.append(" buffer[0,num] = " + new String(buffer, 0, numBytes)); sb.append(newline); sb.append("========================"); return sb.toString(); } }./src/org/apache/axiom/attachments/SizeAwareDataSource.java0000664000175000017500000000202311767656530023141 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; /** * @deprecated Please implement {@link org.apache.axiom.ext.activation.SizeAwareDataSource} */ public interface SizeAwareDataSource extends org.apache.axiom.ext.activation.SizeAwareDataSource { } ./src/org/apache/axiom/attachments/Attachments.java0000664000175000017500000007231411767656530021561 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import org.apache.axiom.attachments.impl.PartFactory; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl; import org.apache.axiom.om.OMAttachmentAccessor; import org.apache.axiom.om.OMException; import org.apache.axiom.om.impl.MTOMConstants; import org.apache.axiom.om.util.DetachableInputStream; import org.apache.axiom.util.UIDGenerator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.activation.DataHandler; import javax.mail.MessagingException; import javax.mail.internet.ContentType; import javax.mail.internet.ParseException; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.TreeMap; import java.util.Map; import java.util.Collections; public class Attachments implements OMAttachmentAccessor { /** ContentType of the MIME message */ ContentType contentType; int contentLength; // Content Length /** Mime boundary which separates mime parts */ byte[] boundary; /** * applicationType used to distinguish between MTOM & SWA If the message is MTOM * optimised type is application/xop+xml If the message is SWA, type is ??have to find out */ String applicationType; /** * pushbackInStream stores the reference to the incoming stream A PushbackStream * has the ability to "push back" or "unread" one byte. */ PushbackInputStream pushbackInStream; int PUSHBACK_SIZE = 4 * 1024; DetachableInputStream filterIS = null; /** * attachmentsMap stores the Data Handlers of the already parsed Mime Body Parts. * This ordered Map is keyed using the content-ID's. */ TreeMap attachmentsMap; /** * cids stores the content ids in the order that the attachments * occur in the message */ ArrayList cids = new ArrayList(); /** partIndex- Number of Mime parts parsed */ int partIndex = 0; /** Container to hold streams for direct access */ IncomingAttachmentStreams streams = null; /** boolean Indicating if any streams have been directly requested */ private boolean streamsRequested = false; /** boolean Indicating if any data handlers have been directly requested */ private boolean partsRequested = false; /** * endOfStreamReached flag which is to be set by MIMEBodyPartStream when MIME * message terminator is found. */ private boolean endOfStreamReached; /** * noStreams flag which is to be set when this class is instantiated by the SwA API * to handle programatic added attachements. An InputStream with attachments is not present at * that occation. */ private boolean noStreams = false; private String firstPartId; private boolean fileCacheEnable; private String attachmentRepoDir; private int fileStorageThreshold; private LifecycleManager manager; protected static Log log = LogFactory.getLog(Attachments.class); public LifecycleManager getLifecycleManager() { if(manager == null) { manager = new LifecycleManagerImpl(); } return manager; } public void setLifecycleManager(LifecycleManager manager) { this.manager = manager; } /** * Moves the pointer to the beginning of the first MIME part. Reads till first MIME boundary is * found or end of stream is reached. * * @param inStream * @param contentTypeString * @param fileCacheEnable * @param attachmentRepoDir * @throws OMException */ public Attachments(LifecycleManager manager, InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold) throws OMException { this(manager, inStream, contentTypeString, fileCacheEnable, attachmentRepoDir, fileThreshold, 0); } /** * Moves the pointer to the beginning of the first MIME part. Reads * till first MIME boundary is found or end of stream is reached. * * @param inStream * @param contentTypeString * @param fileCacheEnable * @param attachmentRepoDir * @param fileThreshold * @param contentLength * @throws OMException */ public Attachments(LifecycleManager manager, InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold, int contentLength) throws OMException { this.manager = manager; this.contentLength = contentLength; this.attachmentRepoDir = attachmentRepoDir; this.fileCacheEnable = fileCacheEnable; if (log.isDebugEnabled()) { log.debug("Attachments contentLength=" + contentLength + ", contentTypeString=" + contentTypeString); } if (fileThreshold != null && (!"".equals(fileThreshold))) { this.fileStorageThreshold = Integer.parseInt(fileThreshold); } else { this.fileStorageThreshold = 1; } attachmentsMap = new TreeMap(); try { contentType = new ContentType(contentTypeString); } catch (ParseException e) { throw new OMException( "Invalid Content Type Field in the Mime Message" , e); } // REVIEW: This conversion is hard-coded to UTF-8. // The complete solution is to respect the charset setting of the message. // However this may cause problems in BoundaryDelimittedStream and other // lower level classes. // Boundary always have the prefix "--". try { String encoding = contentType.getParameter("charset"); if(encoding == null || encoding.length()==0){ encoding = "UTF-8"; } String boundaryParam = contentType.getParameter("boundary"); if (boundaryParam == null) { throw new OMException("Content-type has no 'boundary' parameter"); } this.boundary = ("--" + boundaryParam).getBytes(encoding); if (log.isDebugEnabled()) { log.debug("boundary=" + new String(this.boundary)); } } catch (UnsupportedEncodingException e) { throw new OMException(e); } // If the length is not known, install a TeeInputStream // so that we can retrieve it later. InputStream is = inStream; if (contentLength <= 0) { filterIS = new DetachableInputStream(inStream); is = filterIS; } pushbackInStream = new PushbackInputStream(is, PUSHBACK_SIZE); // Move the read pointer to the beginning of the first part // read till the end of first boundary while (true) { int value; try { value = pushbackInStream.read(); if ((byte) value == boundary[0]) { int boundaryIndex = 0; while ((boundaryIndex < boundary.length) && ((byte) value == boundary[boundaryIndex])) { value = pushbackInStream.read(); if (value == -1) { throw new OMException( "Unexpected End of Stream while searching for first Mime Boundary"); } boundaryIndex++; } if (boundaryIndex == boundary.length) { // boundary found pushbackInStream.read(); break; } } else if (value == -1) { throw new OMException( "Mime parts not found. Stream ended while searching for the boundary"); } } catch (IOException e1) { throw new OMException("Stream Error" + e1.toString(), e1); } } // Read the SOAP part and cache it getDataHandler(getSOAPPartContentID()); // Now reset partsRequested. SOAP part is a special case which is always // read beforehand, regardless of request. partsRequested = false; } /** * Moves the pointer to the beginning of the first MIME part. Reads till first MIME boundary is * found or end of stream is reached. * * @param inStream * @param contentTypeString * @param fileCacheEnable * @param attachmentRepoDir * @throws OMException */ public Attachments(InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold) throws OMException { this(null, inStream, contentTypeString, fileCacheEnable, attachmentRepoDir, fileThreshold, 0); } /** * Moves the pointer to the beginning of the first MIME part. Reads * till first MIME boundary is found or end of stream is reached. * * @param inStream * @param contentTypeString * @param fileCacheEnable * @param attachmentRepoDir * @param fileThreshold * @param contentLength * @throws OMException */ public Attachments(InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold, int contentLength) throws OMException { this(null, inStream, contentTypeString, fileCacheEnable, attachmentRepoDir, fileThreshold, contentLength); } /** * Sets file cache to false. * * @param inStream * @param contentTypeString * @throws OMException */ public Attachments(InputStream inStream, String contentTypeString) throws OMException { this(null, inStream, contentTypeString, false, null, null); } /** * Use this constructor when instantiating this to store the attachments set programatically * through the SwA API. */ public Attachments() { attachmentsMap = new TreeMap(); noStreams = true; } /** * Identify the type of message (MTOM or SOAP with attachments) represented by this * object. * * @return One of the {@link MTOMConstants#MTOM_TYPE}, {@link MTOMConstants#SWA_TYPE} * or {@link MTOMConstants#SWA_TYPE_12} constants. * @throws OMException if the message doesn't have one of the supported types, i.e. is * neither MTOM nor SOAP with attachments */ public String getAttachmentSpecType() { if (this.applicationType == null) { applicationType = contentType.getParameter("type"); if ((MTOMConstants.MTOM_TYPE).equalsIgnoreCase(applicationType)) { this.applicationType = MTOMConstants.MTOM_TYPE; } else if ((MTOMConstants.SWA_TYPE).equalsIgnoreCase(applicationType)) { this.applicationType = MTOMConstants.SWA_TYPE; } else if ((MTOMConstants.SWA_TYPE_12).equalsIgnoreCase(applicationType)) { this.applicationType = MTOMConstants.SWA_TYPE_12; } else { throw new OMException( "Invalid Application type. Support available for MTOM & SwA only."); } } return this.applicationType; } /** * Get the {@link DataHandler} object for the MIME part with a given content ID. * * @param contentID * the raw content ID (without the surrounding angle brackets and cid: * prefix) of the MIME part * @return the {@link DataHandler} of the MIME part referred by the content ID or * null if the MIME part referred by the content ID does not exist */ public DataHandler getDataHandler(String contentID) { // Check whether the MIME part is already parsed by checking the attachments HashMap. If it is // not parsed yet then call the getNextPart() till the required part is found. DataHandler dataHandler; if (attachmentsMap.containsKey(contentID)) { dataHandler = (DataHandler) attachmentsMap.get(contentID); return dataHandler; } else if (!noStreams) { //This loop will be terminated by the Exceptions thrown if the Mime // part searching was not found while ((dataHandler = this.getNextPartDataHandler()) != null) { if (attachmentsMap.containsKey(contentID)) { dataHandler = (DataHandler) attachmentsMap.get(contentID); return dataHandler; } } } return null; } /** * Programatically adding an SOAP with Attachments(SwA) Attachment. These attachments will get * serialized only if SOAP with Attachments is enabled. * * @param contentID * @param dataHandler */ public void addDataHandler(String contentID, DataHandler dataHandler) { attachmentsMap.put(contentID, dataHandler); if (!cids.contains(contentID)) { cids.add(contentID); } } /** * Removes the DataHandler corresponding to the given contenID. If it is not present, then * trying to find it calling the getNextPart() till the required part is found. * * @param blobContentID */ public void removeDataHandler(String blobContentID) { if (attachmentsMap.containsKey(blobContentID)) { attachmentsMap.remove(blobContentID); } else if (!noStreams) { //This loop will be terminated by the Exceptions thrown if the Mime // part searching was not found while (this.getNextPartDataHandler() != null) { if (attachmentsMap.containsKey(blobContentID)) { attachmentsMap.remove(blobContentID); } } } if (cids.contains(blobContentID)) { cids.remove(blobContentID); } } /** * @return the InputStream which includes the SOAP Envelope. It assumes that the root mime part * is always pointed by "start" parameter in content-type. */ public InputStream getSOAPPartInputStream() throws OMException { DataHandler dh; if (noStreams) { throw new OMException("Invalid operation. Attachments are created programatically."); } try { dh = getDataHandler(getSOAPPartContentID()); if (dh == null) { throw new OMException( "Mandatory Root MIME part containing the SOAP Envelope is missing"); } return dh.getInputStream(); } catch (IOException e) { throw new OMException( "Problem with DataHandler of the Root Mime Part. ", e); } } /** * Get the content ID of the SOAP part or the MIME message. This content ID is determined as * follows: *
          *
        • If the content type of the MIME message has a start parameter, then the content * ID will be extracted from that parameter. *
        • Otherwise the content ID of the first MIME part of the MIME message is returned. *
        * * @return the content ID of the SOAP part (without the surrounding angle brackets) */ public String getSOAPPartContentID() { if(contentType == null) { return null; } String rootContentID = contentType.getParameter("start"); if (log.isDebugEnabled()) { log.debug("getSOAPPartContentID rootContentID=" + rootContentID); } // to handle the Start parameter not mentioned situation if (rootContentID == null) { if (partIndex == 0) { getNextPartDataHandler(); } rootContentID = firstPartId; } else { rootContentID = rootContentID.trim(); if ((rootContentID.indexOf("<") > -1) & (rootContentID.indexOf(">") > -1)) { rootContentID = rootContentID.substring(1, (rootContentID .length() - 1)); } } // Strips off the "cid:" part from content-id if (rootContentID.length() > 4 && "cid:".equalsIgnoreCase(rootContentID.substring(0, 4))) { rootContentID = rootContentID.substring(4); } return rootContentID; } /** * Get the content type of the SOAP part of the MIME message. * * @return the content type of the SOAP part * @throws OMException * if the content type could not be determined */ public String getSOAPPartContentType() { if (!noStreams) { String soapPartContentID = getSOAPPartContentID(); if (soapPartContentID == null) { throw new OMException("Unable to determine the content ID of the SOAP part"); } DataHandler soapPart = getDataHandler(soapPartContentID); if (soapPart == null) { throw new OMException("Unable to locate the SOAP part; content ID was " + soapPartContentID); } return soapPart.getContentType(); } else { throw new OMException( "The attachments map was created programatically. Unsupported operation."); } } /** * Stream based access * * @return The stream container of type IncomingAttachmentStreams * @throws IllegalStateException if application has alreadt started using Part's directly */ public IncomingAttachmentStreams getIncomingAttachmentStreams() throws IllegalStateException { if (partsRequested) { throw new IllegalStateException( "The attachments stream can only be accessed once; either by using the IncomingAttachmentStreams class or by getting a " + "collection of AttachmentPart objects. They cannot both be called within the life time of the same service request."); } if (noStreams) { throw new IllegalStateException( "The attachments map was created programatically. No streams are available."); } streamsRequested = true; if (this.streams == null) { BoundaryDelimitedStream boundaryDelimitedStream = new BoundaryDelimitedStream(pushbackInStream, boundary, 1024); this.streams = new MultipartAttachmentStreams(boundaryDelimitedStream); } return this.streams; } /** * Force reading of all attachments. */ private void fetchAllParts() { DataHandler dataHandler; while (!noStreams) { dataHandler = this.getNextPartDataHandler(); if (dataHandler == null) { break; } } } /** * Get the content IDs of all MIME parts in the message. This includes the content ID of the * SOAP part as well as the content IDs of the attachments. Note that if this object has been * created from a stream, a call to this method will force reading of all MIME parts that * have not been fetched from the stream yet. * * @return an array with the content IDs in order of appearance in the message */ public String[] getAllContentIDs() { fetchAllParts(); return (String[]) cids.toArray(new String[cids.size()]); } /** * Get the content IDs of all MIME parts in the message. This includes the content ID of the * SOAP part as well as the content IDs of the attachments. Note that if this object has been * created from a stream, a call to this method will force reading of all MIME parts that * have not been fetched from the stream yet. * * @return the set of content IDs */ public Set getContentIDSet() { fetchAllParts(); return attachmentsMap.keySet(); } /** * Get a map of all MIME parts in the message. This includes the SOAP part as well as the * attachments. Note that if this object has been created from a stream, a call to this * method will force reading of all MIME parts that have not been fetched from the stream yet. * * @return A map of all MIME parts in the message, with content IDs as keys and * {@link DataHandler} objects as values. */ public Map getMap() { fetchAllParts(); return Collections.unmodifiableMap(attachmentsMap); } /** * Get the content IDs of the already loaded MIME parts in the message. This includes the * content ID of the SOAP part as well as the content IDs of the attachments. If this * object has been created from a stream, only the content IDs of the MIME parts that * have already been fetched from the stream are returned. If this is not the desired * behavior, {@link #getAllContentIDs()} or {@link #getContentIDSet()} should be used * instead. * * @return List of content IDs in order of appearance in message */ public List getContentIDList() { return cids; } /** * If the Attachments is backed by an InputStream, then this * method returns the length of the message contents * (Length of the entire message - Length of the Transport Headers) * @return length of message content or -1 if Attachments is not * backed by an InputStream */ public long getContentLength() throws IOException { if (contentLength > 0) { return contentLength; } else if (filterIS != null) { // Ensure all parts are read this.getContentIDSet(); // Now get the count from the filter return filterIS.length(); } else { return -1; // not backed by an input stream } } /** * endOfStreamReached will be set to true if the message ended in MIME Style having "--" suffix * with the last mime boundary * * @param value */ protected void setEndOfStream(boolean value) { this.endOfStreamReached = value; } /** * Returns the rest of mime stream. It will contain all attachments without * soappart (first attachment) with headers and mime boundary. Raw content! */ public InputStream getIncomingAttachmentsAsSingleStream() throws IllegalStateException { if (partsRequested) { throw new IllegalStateException( "The attachments stream can only be accessed once; either by using the IncomingAttachmentStreams class or by getting a " + "collection of AttachmentPart objects. They cannot both be called within the life time of the same service request."); } if (noStreams) { throw new IllegalStateException( "The attachments map was created programatically. No streams are available."); } streamsRequested = true; return this.pushbackInStream; } /** * @return the Next valid MIME part + store the Part in the Parts List * @throws OMException throw if content id is null or if two MIME parts contain the same * content-ID & the exceptions throws by getPart() */ private DataHandler getNextPartDataHandler() throws OMException { if (endOfStreamReached) { return null; } Part nextPart; nextPart = getPart(); if (nextPart == null) { return null; } else try { long size = nextPart.getSize(); String partContentID; DataHandler dataHandler; try { partContentID = nextPart.getContentID(); if (partContentID == null & partIndex == 1) { String id = "firstPart_" + UIDGenerator.generateContentId(); firstPartId = id; if (size > 0) { dataHandler = nextPart.getDataHandler(); } else { // Either the mime part is empty or the stream ended without having // a MIME message terminator dataHandler = new DataHandler(new ByteArrayDataSource(new byte[]{})); } addDataHandler(id, dataHandler); return dataHandler; } if (partContentID == null) { throw new OMException( "Part content ID cannot be blank for non root MIME parts"); } if ((partContentID.indexOf("<") > -1) & (partContentID.indexOf(">") > -1)) { partContentID = partContentID.substring(1, (partContentID .length() - 1)); } if (partIndex == 1) { firstPartId = partContentID; } if (attachmentsMap.containsKey(partContentID)) { throw new OMException( "Two MIME parts with the same Content-ID not allowed."); } if (size > 0) { dataHandler = nextPart.getDataHandler(); } else { // Either the mime part is empty or the stream ended without having // a MIME message terminator dataHandler = new DataHandler(new ByteArrayDataSource(new byte[]{})); } addDataHandler(partContentID, dataHandler); return dataHandler; } catch (MessagingException e) { throw new OMException("Error reading Content-ID from the Part." + e); } } catch (MessagingException e) { throw new OMException(e); } } /** * @return This will return the next available MIME part in the stream. * @throws OMException if Stream ends while reading the next part... */ private Part getPart() throws OMException { if (streamsRequested) { throw new IllegalStateException("The attachments stream can only be accessed once; either by using the IncomingAttachmentStreams class or by getting a collection of AttachmentPart objects. They cannot both be called within the life time of the same service request."); } partsRequested = true; boolean isSOAPPart = (partIndex == 0); int threshhold = (fileCacheEnable) ? fileStorageThreshold : 0; // Create a MIMEBodyPartInputStream that simulates a single stream for this MIME body part MIMEBodyPartInputStream partStream = new MIMEBodyPartInputStream(pushbackInStream, boundary, this, PUSHBACK_SIZE); // The PartFactory will determine which Part implementation is most appropriate. Part part = PartFactory.createPart(getLifecycleManager(), partStream, isSOAPPart, threshhold, attachmentRepoDir, contentLength); // content-length for the whole message partIndex++; return part; } /** * Read bytes into the buffer until full or until the EOS * @param is * @param buffer * @return number of bytes read * @throws IOException */ private static int readToBuffer(InputStream is, byte[] buffer) throws IOException { int index = 0; int remainder = buffer.length; do { int bytesRead; while ((bytesRead = is.read(buffer, index, remainder)) > 0) { index += bytesRead; remainder -= bytesRead; } } while (remainder > 0 && is.available() > 0); // repeat if more bytes are now available return index; } }./src/org/apache/axiom/attachments/ByteArrayDataSource.java0000664000175000017500000000371411767656530023161 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class ByteArrayDataSource implements org.apache.axiom.ext.activation.SizeAwareDataSource { private byte[] data; private String type; public ByteArrayDataSource(byte[] data, String type) { super(); this.data = data; this.type = type; } public ByteArrayDataSource(byte[] data) { super(); this.data = data; } public void setType(String type) { this.type = type; } public String getContentType() { if (type == null) return "application/octet-stream"; else return type; } public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(data == null ? new byte[0] : data); } public String getName() { return "ByteArrayDataSource"; } public OutputStream getOutputStream() throws IOException { throw new IOException("Not Supported"); } public long getSize() { return data == null ? 0 : data.length; } } ./src/org/apache/axiom/attachments/CachedFileDataSource.java0000775000175000017500000000507011767656530023226 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import javax.activation.FileDataSource; import java.io.File; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class CachedFileDataSource extends FileDataSource { String contentType = null; protected static Log log = LogFactory.getLog(CachedFileDataSource.class); // The AttachmentCacheMonitor is used to delete expired copies of attachment files. private static AttachmentCacheMonitor acm = AttachmentCacheMonitor.getAttachmentCacheMonitor(); // Represents the absolute pathname of cached attachment file private String cachedFileName = null; public CachedFileDataSource(File arg0) { super(arg0); if (log.isDebugEnabled()) { log.debug("Enter CachedFileDataSource ctor"); } if (arg0 != null) { try { cachedFileName = arg0.getCanonicalPath(); } catch (java.io.IOException e) { log.error("IOException caught: " + e); } } if (cachedFileName != null) { if (log.isDebugEnabled()) { log.debug("Cached file: " + cachedFileName); log.debug("Registering the file with AttachmentCacheMonitor and also marked it as being accessed"); } // Tell the monitor that the file is being accessed. acm.access(cachedFileName); // Register the file with the AttachmentCacheMonitor acm.register(cachedFileName); } } public String getContentType() { if (this.contentType != null) { return contentType; } else { return super.getContentType(); } } public void setContentType(String contentType) { this.contentType = contentType; } } ./src/org/apache/axiom/attachments/IncomingAttachmentInputStream.java0000664000175000017500000001044411767656530025252 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.attachments; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; public class IncomingAttachmentInputStream extends InputStream { private HashMap _headers = null; private HashMap _headersLowerCase = null; private InputStream _stream = null; private IncomingAttachmentStreams parentContainer; public static final String HEADER_CONTENT_DESCRIPTION = "content-description"; public static final String HEADER_CONTENT_TYPE = "content-type"; public static final String HEADER_CONTENT_TRANSFER_ENCODING = "content-transfer-encoding"; public static final String HEADER_CONTENT_TYPE_JMS = "contentType"; public static final String HEADER_CONTENT_LENGTH = "content-length"; public static final String HEADER_CONTENT_LOCATION = "content-location"; public static final String HEADER_CONTENT_ID = "content-id"; /** @param in */ public IncomingAttachmentInputStream(InputStream in, IncomingAttachmentStreams parentContainer) { _stream = in; this.parentContainer = parentContainer; } /** @return MIME headers for this attachment. May be null if no headers were set. */ public Map getHeaders() { return _headers; } /** * Add a header. * * @param name * @param value */ public void addHeader(String name, String value) { if (_headers == null) { _headers = new HashMap(); _headersLowerCase = new HashMap(); } _headers.put(name, value); _headersLowerCase.put(name.toLowerCase(), value); } /** * Get a header value. * * @param name * @return The header found or null if not found. */ public String getHeader(String name) { Object header = null; if (_headersLowerCase == null || (header = _headersLowerCase.get(name.toLowerCase())) == null) { return null; } return header.toString(); } /** @return The header with HTTPConstants.HEADER_CONTENT_ID as the key. */ public String getContentId() { return getHeader(HEADER_CONTENT_ID); } /** @return The header with HTTPConstants.HEADER_CONTENT_LOCATION as the key. */ public String getContentLocation() { return getHeader(HEADER_CONTENT_LOCATION); } /** @return The header with HTTPConstants.HEADER_CONTENT_TYPE as the key. */ public String getContentType() { return getHeader(HEADER_CONTENT_TYPE); } /** * Don't want to support mark and reset since this may get us into concurrency problem when * different pieces of software may have a handle to the underlying InputStream. */ public boolean markSupported() { return false; } public void reset() throws IOException { throw new IOException("markNotSupported"); } public void mark(int readLimit) { // do nothing } public int read() throws IOException { int retval = _stream.read(); parentContainer.setReadyToGetNextStream(retval == -1); return retval; } public int read(byte[] b) throws IOException { int retval = _stream.read(b); parentContainer.setReadyToGetNextStream(retval == -1); return retval; } public int read(byte[] b, int off, int len) throws IOException { int retval = _stream.read(b, off, len); parentContainer.setReadyToGetNextStream(retval == -1); return retval; } } ./src/org/apache/axiom/util/0000775000175000017500000000000011767656530015076 5ustar brianbrian./src/org/apache/axiom/util/UIDGenerator.java0000664000175000017500000002177511767656530020245 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util; import java.net.URI; import java.net.URISyntaxException; import java.util.Random; import java.util.UUID; /** * Contains utility methods to generate unique IDs of various kinds. *

        * Depending on the requested type of ID, this class will either use * {@link UUID#randomUUID()} or its own unique ID generator. This implementation * generates unique IDs based on the assumption that the following triplet is * unique: *

          *
        1. The thread ID. *
        2. The timestamp in milliseconds when the first UID is requested by the * thread. *
        3. A per thread sequence number that is incremented each time a UID is * requested by the thread. *
        *

        * Considering that these three numbers are represented as long * values, these assumptions are correct because: *

          *
        • The probability that two different threads with the same ID exist in the * same millisecond interval is negligibly small. *
        • One can expect that no thread will ever request more than 2^64 UIDs * during its lifetime. *
        *

        * Before building an ID from this triplet, the implementation will XOR the * three values with random values calculated once when the class is loaded. * This transformation preserves the uniqueness of the calculated triplet and * serves several purposes: *

          *
        • It reduces the probability that the same ID is produces by two different * systems, i.e. it increases global uniqueness. *
        • It adds entropy, i.e. it makes an individual ID appear as random. Indeed, * without the XOR transformation, a hexadecimal representation of the triplet * would in general contain several sequences of '0'. *
        • It prevents the implementation from leaking information about the system * state. *
        */ public final class UIDGenerator { private static final long startTimeXorOperand; private static final long threadIdXorOperand; private static final long seqXorOperand; static { Random rand = new Random(); threadIdXorOperand = rand.nextLong(); startTimeXorOperand = rand.nextLong(); seqXorOperand = rand.nextLong(); } /** * Thread local that holds the triplet described in the Javadoc of this * class. Note that we use a simple array here (instead of our own class) * to avoid class loader leaks (see AXIOM-354). */ private static final ThreadLocal/**/ triplet = new ThreadLocal() { protected Object initialValue() { long[] values = new long[3]; values[0] = Thread.currentThread().getId() ^ threadIdXorOperand; values[1] = System.currentTimeMillis() ^ startTimeXorOperand; return values; } }; private UIDGenerator() {} private static void writeReverseLongHex(long value, StringBuilder buffer) { for (int i=0; i<16; i++) { int n = (int)(value >> (4*i)) & 0xF; buffer.append((char)(n < 10 ? '0' + n : 'a' + n - 10)); } } /** * Generate a unique ID as hex value and add it to the given buffer. Note * that with respect to the triplet, the order of nibbles is reversed, i.e. * the least significant nibble of the sequence is written first. This makes * comparing two IDs for equality more efficient. * * @param buffer */ private static void generateHex(StringBuilder buffer) { long[] values = (long[])triplet.get(); writeReverseLongHex(values[2]++ ^ seqXorOperand, buffer); writeReverseLongHex(values[1], buffer); writeReverseLongHex(values[0], buffer); } /** * Generates a unique ID suitable for usage as a MIME content ID. *

        * RFC2045 (MIME) specifies that the value of the Content-ID header * must match the msg-id production, which is defined by RFC2822 as * follows: *

             * msg-id        = [CFWS] "<" id-left "@" id-right ">" [CFWS]
             * id-left       = dot-atom-text / no-fold-quote / obs-id-left
             * id-right      = dot-atom-text / no-fold-literal / obs-id-right
             * dot-atom-text = 1*atext *("." 1*atext)
             * atext         = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&"
             *                   / "'" / "*" / "+" / "-" / "/" / "=" / "?"
             *                   / "^" / "_" / "`" / "{" / "|" / "}" / "~"
        * In addition, RFC2392 specifies that when used in an URL with scheme * "cid:", the content ID must be URL encoded. Since not all implementations * handle this correctly, any characters considered "unsafe" in an URL (and * requiring encoding) should be avoided in a content ID. *

        * This method generates content IDs that satisfy these requirements. It * guarantees a high level of uniqueness, but makes no provisions to * guarantee randomness. The implementation is thread safe, but doesn't use * synchronization. * * @return The generated content ID. Note that this value does not include * the angle brackets of the msg-id production, but only * represents the bare content ID. */ public static String generateContentId() { StringBuilder buffer = new StringBuilder(); generateHex(buffer); buffer.append("@apache.org"); return buffer.toString(); } /** * Generates a MIME boundary. *

        * Valid MIME boundaries are defined by the following production in RFC2046: *

             * boundary      := 0*69<bchars> bcharsnospace
             * bchars        := bcharsnospace / " "
             * bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
             *                  "+" / "_" / "," / "-" / "." /
             *                  "/" / ":" / "=" / "?"
        *

        * It should be noted that the boundary in general will also appear as a parameter in the * content type of the MIME package. According to RFC2045 (which defines the * Content-Type header), it will require quoting if it contains characters from * the following production: *

             * tspecials := "(" / ")" / "<" / ">" / "@" /
             *              "," / ";" / ":" / "\" / <"> /
             *              "/" / "[" / "]" / "?" / "="
        *

        * This method produces a boundary that doesn't contain any of these characters and * therefore doesn't need to be quoted. To avoid accidental collisions, the returned value * is unique and doesn't overlap with any other type of unique ID returned by methods in * this class. The implementation is thread safe, but doesn't use synchronization. * * @return the generated MIME boundary */ public static String generateMimeBoundary() { StringBuilder buffer = new StringBuilder("MIMEBoundary_"); generateHex(buffer); return buffer.toString(); } /** * Generate a general purpose unique ID. The returned value is the hexadecimal representation of * a 192 bit value, i.e. it is 48 characters long. The implementation guarantees a high level of * uniqueness, but makes no provisions to guarantee randomness. It is thread safe, but doesn't * use synchronization. * * @return the generated unique ID */ public static String generateUID() { StringBuilder buffer = new StringBuilder(48); generateHex(buffer); return buffer.toString(); } /** * Generate a URN with uuid NID (namespace identifier). These URNs have the following * form: urn:uuid:dae6fae1-93df-4824-bc70-884c9edb5973. The UUID is generated using * a cryptographically strong pseudo random number generator. * * @return the generated URN */ public static String generateURNString() { return "urn:uuid:" + UUID.randomUUID(); } /** * Generate a URN with uuid NID (namespace identifier). This method does the * same as {@link #generateURNString()}, but returns a {@link URI} object. * * @return the generated URN */ public static URI generateURN() { try { return new URI(generateURNString()); } catch (URISyntaxException ex) { // If we ever get here, then if would mean that there is something badly broken... throw new Error(ex); } } } ./src/org/apache/axiom/util/base64/0000775000175000017500000000000011767656530016162 5ustar brianbrian./src/org/apache/axiom/util/base64/AbstractBase64DecodingWriter.java0000664000175000017500000001006211767656530024366 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.Writer; /** * Base class for {@link Writer} implementations that decode data in base64. */ public abstract class AbstractBase64DecodingWriter extends Writer { private final char[] in = new char[4]; private final byte[] out = new byte[3]; private int rest; // Number of characters remaining in the in buffer public final void write(char[] cbuf, int off, int len) throws IOException { if (rest > 0) { while (len > 0 && rest < 4) { in[rest++] = cbuf[off++]; len--; } if (rest == 4) { decode(in, 0); rest = 0; } } while (len >= 4) { decode(cbuf, off); off += 3; len -= 3; } while (len > 0) { in[rest++] = cbuf[off++]; len--; } } public final void write(String str, int off, int len) throws IOException { while (len > 0) { write(str.charAt(off)); off++; len--; } } public final void write(int c) throws IOException { in[rest++] = (char)c; if (rest == 4) { decode(in, 0); rest = 0; } } private int decode(char c) throws IOException { if (c == Base64Constants.S_BASE64PAD) { return -1; } else if (c < Base64Constants.S_DECODETABLE.length) { int result = Base64Constants.S_DECODETABLE[c]; if (result != Byte.MAX_VALUE) { return result; } } throw new IOException("Invalid base64 char '" + c + "'"); } private void decode(char[] data, int off) throws IOException { int outlen = 3; if (data[off+3] == Base64Constants.S_BASE64PAD) { outlen = 2; } if (data[off+2] == Base64Constants.S_BASE64PAD) { outlen = 1; } int b0 = decode(data[off]); int b1 = decode(data[off+1]); int b2 = decode(data[off+2]); int b3 = decode(data[off+3]); switch (outlen) { case 1: out[0] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); break; case 2: out[0] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); out[1] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf); break; case 3: out[0] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); out[1] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf); out[2] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f); } doWrite(out, outlen); } /** * Write base64 decoded data. If necessary, the implementation should * accumulate the data in a buffer before writing it to the underlying * stream. The maximum number of bytes passed to this method in a single * call is 3. * * @param b * the byte array containing the data to write, starting at * offset 0 * @param len * the number of bytes to write * @throws IOException * if an I/O error occurs */ protected abstract void doWrite(byte[] b, int len) throws IOException; } ./src/org/apache/axiom/util/base64/AbstractBase64EncodingOutputStream.java0000664000175000017500000001140311767656530025600 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; /** * Base class for {@link OutputStream} implementations that encode data in base64. */ public abstract class AbstractBase64EncodingOutputStream extends OutputStream { private final byte[] in = new byte[3]; private final byte[] out = new byte[4]; private int rest; // Number of bytes remaining in the inBuffer private boolean completed; public final void write(byte[] b, int off, int len) throws IOException { if (completed) { throw new IOException("Attempt to write data after base64 encoding has been completed"); } if (rest > 0) { while (len > 0 && rest < 3) { in[rest++] = b[off++]; len--; } if (rest == 3) { encode(in, 0, 3); rest = 0; } } while (len >= 3) { encode(b, off, 3); off += 3; len -= 3; } while (len > 0) { in[rest++] = b[off++]; len--; } } public final void write(int b) throws IOException { in[rest++] = (byte)b; if (rest == 3) { encode(in, 0, 3); rest = 0; } } /** * Write out any pending data, including padding if necessary. * * @throws IOException if an I/O error occurs */ public final void complete() throws IOException { if (!completed) { if (rest > 0) { encode(in, 0, rest); } flushBuffer(); completed = true; } } private void encode(byte[] data, int off, int len) throws IOException { if (len == 1) { int i = data[off] & 0xff; out[0] = Base64Constants.S_BASE64CHAR[i >> 2]; out[1] = Base64Constants.S_BASE64CHAR[(i << 4) & 0x3f]; out[2] = Base64Constants.S_BASE64PAD; out[3] = Base64Constants.S_BASE64PAD; } else if (len == 2) { int i = ((data[off] & 0xff) << 8) + (data[off + 1] & 0xff); out[0] = Base64Constants.S_BASE64CHAR[i >> 10]; out[1] = Base64Constants.S_BASE64CHAR[(i >> 4) & 0x3f]; out[2] = Base64Constants.S_BASE64CHAR[(i << 2) & 0x3f]; out[3] = Base64Constants.S_BASE64PAD; } else { int i = ((data[off] & 0xff) << 16) + ((data[off + 1] & 0xff) << 8) + (data[off + 2] & 0xff); out[0] = Base64Constants.S_BASE64CHAR[i >> 18]; out[1] = Base64Constants.S_BASE64CHAR[(i >> 12) & 0x3f]; out[2] = Base64Constants.S_BASE64CHAR[(i >> 6) & 0x3f]; out[3] = Base64Constants.S_BASE64CHAR[i & 0x3f]; } doWrite(out); } public final void flush() throws IOException { flushBuffer(); doFlush(); } public final void close() throws IOException { complete(); doClose(); } /** * Write base64 encoded data. If necessary, the implementation should accumulate * the data in a buffer before writing it to the underlying stream. * * @param b a byte array of length 4 * @throws IOException if an I/O error occurs */ protected abstract void doWrite(byte[] b) throws IOException; /** * Write any pending data to the underlying stream, if applicable. * Note that implementations should not flush the underlying stream. * * @throws IOException if an I/O error occurs */ protected abstract void flushBuffer() throws IOException; /** * Flush the underlying stream, if applicable. * * @throws IOException if an I/O error occurs */ protected abstract void doFlush() throws IOException; /** * Close the underlying stream, if applicable. * * @throws IOException if an I/O error occurs */ protected abstract void doClose() throws IOException; } ./src/org/apache/axiom/util/base64/Base64DecodingOutputStreamWriter.java0000664000175000017500000000274611767656530025311 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; /** * {@link java.io.Writer} implementation that decodes base64 data and writes it * to a an {@link OutputStream}. */ public class Base64DecodingOutputStreamWriter extends AbstractBase64DecodingWriter { private final OutputStream stream; public Base64DecodingOutputStreamWriter(OutputStream stream) { this.stream = stream; } protected void doWrite(byte[] b, int len) throws IOException { stream.write(b, 0, len); } public void flush() throws IOException { stream.flush(); } public void close() throws IOException { stream.close(); } } ./src/org/apache/axiom/util/base64/package.html0000664000175000017500000000161611767656530020447 0ustar brianbrian Contains utility classes to work with base64 encoded data. ./src/org/apache/axiom/util/base64/Base64Utils.java0000664000175000017500000003374511767656530021106 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import javax.activation.DataHandler; import org.apache.axiom.util.activation.DataSourceUtils; /** * Contains utility methods to work with base64 encoded data. */ public class Base64Utils { private static final char[] S_BASE64CHAR = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; private static final char S_BASE64PAD = '='; private static final byte[] S_DECODETABLE = new byte[128]; static { for (int i = 0; i < S_DECODETABLE.length; i++) S_DECODETABLE[i] = Byte.MAX_VALUE; // 127 for (int i = 0; i < S_BASE64CHAR.length; i++) // 0 to 63 S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i; } private static int getEncodedSize(int unencodedSize) { return (unencodedSize+2) / 3 * 4; } /** * Get a base64 representation of the content of a given {@link DataHandler}. * This method will try to carry out the encoding operation in the most efficient way. * * @param dh the data handler with the content to encode * @return the base64 encoded content * @throws IOException if an I/O error occurs when reading the content of the data handler */ public static String encode(DataHandler dh) throws IOException { long size = DataSourceUtils.getSize(dh.getDataSource()); StringBuffer buffer; if (size == -1) { // Use a reasonable default capacity (better than the default of 16). buffer = new StringBuffer(4096); } else if (size > Integer.MAX_VALUE) { throw new IllegalArgumentException("DataHandler is too large to encode to string"); } else { buffer = new StringBuffer(getEncodedSize((int)size)); } Base64EncodingStringBufferOutputStream out = new Base64EncodingStringBufferOutputStream(buffer); // Always prefer writeTo, because getInputStream will create a thread and a pipe if // the DataHandler was constructed using an object instead of a DataSource dh.writeTo(out); out.complete(); return buffer.toString(); } private static int decode0(char[] ibuf, byte[] obuf, int wp) { int outlen = 3; if (ibuf[3] == S_BASE64PAD) outlen = 2; if (ibuf[2] == S_BASE64PAD) outlen = 1; int b0 = S_DECODETABLE[ibuf[0]]; int b1 = S_DECODETABLE[ibuf[1]]; int b2 = S_DECODETABLE[ibuf[2]]; int b3 = S_DECODETABLE[ibuf[3]]; switch (outlen) { case 1: obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); return 1; case 2: obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf); return 2; case 3: obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3); obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf); obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f); return 3; default: throw new RuntimeException("internalError00"); } } /** * */ public static byte[] decode(char[] data, int off, int len) { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[len / 4 * 3 + 3]; int obufcount = 0; for (int i = off; i < off + len; i++) { char ch = data[i]; if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; obufcount += decode0(ibuf, obuf, obufcount); } } } if (obufcount == obuf.length) return obuf; byte[] ret = new byte[obufcount]; System.arraycopy(obuf, 0, ret, 0, obufcount); return ret; } /** * */ public static byte[] decode(String data) { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[data.length() / 4 * 3 + 3]; int obufcount = 0; for (int i = 0; i < data.length(); i++) { char ch = data.charAt(i); if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; obufcount += decode0(ibuf, obuf, obufcount); } } } if (obufcount == obuf.length) return obuf; byte[] ret = new byte[obufcount]; System.arraycopy(obuf, 0, ret, 0, obufcount); return ret; } /** * checks input string for invalid Base64 characters * * @param data * @return true, if String contains only valid Base64 characters. false, otherwise */ public static boolean isValidBase64Encoding(String data) { for (int i = 0; i < data.length(); i++) { char ch = data.charAt(i); if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { //valid character.Do nothing } else if (ch == '\r' || ch == '\n') { //do nothing } else { return false; } }//iterate over all characters in the string return true; } /** * */ public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[3]; for (int i = off; i < off + len; i++) { char ch = data[i]; if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; int obufcount = decode0(ibuf, obuf, 0); ostream.write(obuf, 0, obufcount); } } } } /** * */ public static void decode(String data, OutputStream ostream) throws IOException { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[3]; for (int i = 0; i < data.length(); i++) { char ch = data.charAt(i); if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { ibuf[ibufcount++] = ch; if (ibufcount == ibuf.length) { ibufcount = 0; int obufcount = decode0(ibuf, obuf, 0); ostream.write(obuf, 0, obufcount); } } } } /** Returns base64 representation of specified byte array. */ public static String encode(byte[] data) { return encode(data, 0, data.length); } /** Returns base64 representation of specified byte array. */ public static String encode(byte[] data, int off, int len) { if (len <= 0) return ""; char[] out = new char[len / 3 * 4 + 4]; int rindex = off; int windex = 0; int rest = len - off; while (rest >= 3) { int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); out[windex++] = S_BASE64CHAR[i >> 18]; out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f]; out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f]; out[windex++] = S_BASE64CHAR[i & 0x3f]; rindex += 3; rest -= 3; } if (rest == 1) { int i = data[rindex] & 0xff; out[windex++] = S_BASE64CHAR[i >> 2]; out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f]; out[windex++] = S_BASE64PAD; out[windex++] = S_BASE64PAD; } else if (rest == 2) { int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); out[windex++] = S_BASE64CHAR[i >> 10]; out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f]; out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f]; out[windex++] = S_BASE64PAD; } return new String(out, 0, windex); } /** Outputs base64 representation of the specified byte array to the specified String Buffer */ public static void encode(byte[] data, int off, int len, StringBuffer buffer) { if (len <= 0) { return; } char[] out = new char[4]; int rindex = off; int rest = len - off; while (rest >= 3) { int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); out[0] = S_BASE64CHAR[i >> 18]; out[1] = S_BASE64CHAR[(i >> 12) & 0x3f]; out[2] = S_BASE64CHAR[(i >> 6) & 0x3f]; out[3] = S_BASE64CHAR[i & 0x3f]; buffer.append(out); rindex += 3; rest -= 3; } if (rest == 1) { int i = data[rindex] & 0xff; out[0] = S_BASE64CHAR[i >> 2]; out[1] = S_BASE64CHAR[(i << 4) & 0x3f]; out[2] = S_BASE64PAD; out[3] = S_BASE64PAD; buffer.append(out); } else if (rest == 2) { int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); out[0] = S_BASE64CHAR[i >> 10]; out[1] = S_BASE64CHAR[(i >> 4) & 0x3f]; out[2] = S_BASE64CHAR[(i << 2) & 0x3f]; out[3] = S_BASE64PAD; buffer.append(out); } } /** Outputs base64 representation of the specified byte array to a byte stream. */ public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException { if (len <= 0) return; byte[] out = new byte[4]; int rindex = off; int rest = len - off; while (rest >= 3) { int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); out[0] = (byte) S_BASE64CHAR[i >> 18]; out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f]; out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f]; out[3] = (byte) S_BASE64CHAR[i & 0x3f]; ostream.write(out, 0, 4); rindex += 3; rest -= 3; } if (rest == 1) { int i = data[rindex] & 0xff; out[0] = (byte) S_BASE64CHAR[i >> 2]; out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f]; out[2] = (byte) S_BASE64PAD; out[3] = (byte) S_BASE64PAD; ostream.write(out, 0, 4); } else if (rest == 2) { int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); out[0] = (byte) S_BASE64CHAR[i >> 10]; out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f]; out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f]; out[3] = (byte) S_BASE64PAD; ostream.write(out, 0, 4); } } /** Outputs base64 representation of the specified byte array to a character stream. */ public static void encode(byte[] data, int off, int len, Writer writer) throws IOException { if (len <= 0) return; char[] out = new char[4]; int rindex = off; int rest = len - off; int output = 0; while (rest >= 3) { int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); out[0] = S_BASE64CHAR[i >> 18]; out[1] = S_BASE64CHAR[(i >> 12) & 0x3f]; out[2] = S_BASE64CHAR[(i >> 6) & 0x3f]; out[3] = S_BASE64CHAR[i & 0x3f]; writer.write(out, 0, 4); rindex += 3; rest -= 3; output += 4; if (output % 76 == 0) writer.write("\n"); } if (rest == 1) { int i = data[rindex] & 0xff; out[0] = S_BASE64CHAR[i >> 2]; out[1] = S_BASE64CHAR[(i << 4) & 0x3f]; out[2] = S_BASE64PAD; out[3] = S_BASE64PAD; writer.write(out, 0, 4); } else if (rest == 2) { int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); out[0] = S_BASE64CHAR[i >> 10]; out[1] = S_BASE64CHAR[(i >> 4) & 0x3f]; out[2] = S_BASE64CHAR[(i << 2) & 0x3f]; out[3] = S_BASE64PAD; writer.write(out, 0, 4); } } } ./src/org/apache/axiom/util/base64/Base64EncodingStringBufferOutputStream.java0000664000175000017500000000335311767656530026442 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; /** * {@link OutputStream} implementation that writes base64 encoded data to a {@link StringBuffer}. */ public class Base64EncodingStringBufferOutputStream extends AbstractBase64EncodingOutputStream { private final StringBuffer buffer; /** * Constructor. * * @param buffer the buffer to append the encoded data to */ public Base64EncodingStringBufferOutputStream(StringBuffer buffer) { this.buffer = buffer; } protected void doWrite(byte[] b) throws IOException { for (int i=0; i<4; i++) { buffer.append((char)(b[i] & 0xFF)); } } protected void flushBuffer() throws IOException { // Nothing to do } protected void doClose() throws IOException { // Nothing to do } protected void doFlush() throws IOException { // Nothing to do } } ./src/org/apache/axiom/util/base64/Base64Constants.java0000664000175000017500000000322311767656530021746 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; // For internal use only class Base64Constants { static final byte[] S_BASE64CHAR = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; static final byte S_BASE64PAD = '='; static final byte[] S_DECODETABLE = new byte[128]; static { for (int i = 0; i < S_DECODETABLE.length; i++) { S_DECODETABLE[i] = Byte.MAX_VALUE; // 127 } for (int i = 0; i < S_BASE64CHAR.length; i++) { // 0 to 63 S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i; } } } ./src/org/apache/axiom/util/base64/Base64EncodingOutputStream.java0000664000175000017500000000450411767656530024120 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; /** * {@link OutputStream} implementation that writes base64 encoded data to another * {@link OutputStream} using ASCII encoding. This class internally buffers the data before writing * it to the underlying stream. */ public class Base64EncodingOutputStream extends AbstractBase64EncodingOutputStream { private final OutputStream parent; private final byte[] buffer; private int len; /** * Constructor. * * @param parent the stream to write the encoded data to * @param bufferSize the buffer size to use */ public Base64EncodingOutputStream(OutputStream parent, int bufferSize) { this.parent = parent; buffer = new byte[bufferSize]; } /** * Constructor that sets the buffer size to its default value of 4096 characters. * * @param parent the stream to write the encoded data to */ public Base64EncodingOutputStream(OutputStream parent) { this(parent, 4096); } protected void doWrite(byte[] b) throws IOException { if (buffer.length - len < 4) { flushBuffer(); } System.arraycopy(b, 0, buffer, len, 4); len += 4; } protected void flushBuffer() throws IOException { parent.write(buffer, 0, len); len = 0; } protected void doFlush() throws IOException { parent.flush(); } protected void doClose() throws IOException { parent.close(); } } ./src/org/apache/axiom/util/base64/Base64EncodingWriterOutputStream.java0000664000175000017500000000452211767656530025315 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.base64; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; /** * {@link OutputStream} implementation that writes base64 encoded data to a {@link Writer}. * This class internally buffers the data before writing it to the underlying stream. */ public class Base64EncodingWriterOutputStream extends AbstractBase64EncodingOutputStream { private final Writer writer; private final char[] buffer; private int len; /** * Constructor. * * @param writer the stream to write the encoded data to * @param bufferSize the buffer size to use */ public Base64EncodingWriterOutputStream(Writer writer, int bufferSize) { this.writer = writer; buffer = new char[bufferSize]; } /** * Constructor that sets the buffer size to its default value of 4096 characters. * * @param writer the stream to write the encoded data to */ public Base64EncodingWriterOutputStream(Writer writer) { this(writer, 4096); } protected void doWrite(byte[] b) throws IOException { if (buffer.length - len < 4) { flushBuffer(); } for (int i=0; i<4; i++) { buffer[len++] = (char)(b[i] & 0xFF); } } protected void flushBuffer() throws IOException { writer.write(buffer, 0, len); len = 0; } protected void doFlush() throws IOException { writer.flush(); } protected void doClose() throws IOException { writer.close(); } } ./src/org/apache/axiom/util/activation/0000775000175000017500000000000011767656530017237 5ustar brianbrian./src/org/apache/axiom/util/activation/DataHandlerWrapper.java0000664000175000017500000000632611767656530023621 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.activation; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.CommandInfo; import javax.activation.CommandMap; import javax.activation.DataHandler; import javax.activation.DataSource; /** * Base class for {@link DataHandler} wrappers. */ public class DataHandlerWrapper extends DataHandler { private final DataHandler parent; public DataHandlerWrapper(DataHandler parent) { // Some JavaMail implementations allow passing null to the constructor, // but this is not the case for all implementations. We use an empty data // source to avoid this issue. This approach is known to work with Sun's // and Geronimo's JavaMail implementations. super(EmptyDataSource.INSTANCE); this.parent = parent; } public CommandInfo[] getAllCommands() { return parent.getAllCommands(); } public Object getBean(CommandInfo cmdinfo) { return parent.getBean(cmdinfo); } public CommandInfo getCommand(String cmdName) { return parent.getCommand(cmdName); } public Object getContent() throws IOException { return parent.getContent(); } public String getContentType() { return parent.getContentType(); } public DataSource getDataSource() { return parent.getDataSource(); } public InputStream getInputStream() throws IOException { return parent.getInputStream(); } public String getName() { return parent.getName(); } public OutputStream getOutputStream() throws IOException { return parent.getOutputStream(); } public CommandInfo[] getPreferredCommands() { return parent.getPreferredCommands(); } public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { return parent.getTransferData(flavor); } public DataFlavor[] getTransferDataFlavors() { return parent.getTransferDataFlavors(); } public boolean isDataFlavorSupported(DataFlavor flavor) { return parent.isDataFlavorSupported(flavor); } public void setCommandMap(CommandMap commandMap) { parent.setCommandMap(commandMap); } public void writeTo(OutputStream os) throws IOException { parent.writeTo(os); } } ./src/org/apache/axiom/util/activation/DataSourceUtils.java0000664000175000017500000000576611767656530023173 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.activation; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.util.ByteArrayDataSource; import org.apache.axiom.ext.activation.SizeAwareDataSource; /** * Contains utility methods to work with {@link DataSource} objects. */ public class DataSourceUtils { /** * Determine the size of the data represented by a {@link DataSource} object. * The method will try to determine the size without reading the data source. * It will do so by looking for the {@link SizeAwareDataSource} interface. In addition, it * supports some other well known data source implementations for which it is possible to * get the size of the data without reading it. *

        * As noted in the documentation of the {@link SizeAwareDataSource}, the returned value * may be an estimation that is not 100% accurate, and code using this method must be prepared * to receive more or less data from the data source. * * @param ds the data source * @return (an estimation of) the size of the data or -1 if the size is unknown */ public static long getSize(DataSource ds) { if (ds instanceof SizeAwareDataSource) { return ((SizeAwareDataSource)ds).getSize(); } else if (ds instanceof ByteArrayDataSource) { // Special optimization for JavaMail's ByteArrayDataSource (Axiom's ByteArrayDataSource // already implements SizeAwareDataSource and doesn't need further optimization): // we know that ByteArrayInputStream#available() directly returns the size of the // data source. try { return ((ByteArrayInputStream)ds.getInputStream()).available(); } catch (IOException ex) { // We will never get here... return -1; } } else if (ds instanceof FileDataSource) { // Special optimization for FileDataSources: no need to open and read the file // to know its size! return ((FileDataSource)ds).getFile().length(); } else { return -1; } } } ./src/org/apache/axiom/util/activation/package.html0000664000175000017500000000163011767656530021520 0ustar brianbrian Contains utility classes to work with the Java Activation Framework. ./src/org/apache/axiom/util/activation/EmptyDataSource.java0000664000175000017500000000417111767656530023156 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.activation; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.activation.SizeAwareDataSource; /** * A data source with empty (zero length) content. */ public class EmptyDataSource implements SizeAwareDataSource { /** * Empty data source instance with content type application/octet-stream. */ public static final EmptyDataSource INSTANCE = new EmptyDataSource("application/octet-stream"); private static final InputStream emptyInputStream = new InputStream() { public int read() throws IOException { return -1; } }; private final String contentType; /** * Construct an empty data source with the given content type. * * @param contentType the content type */ public EmptyDataSource(String contentType) { this.contentType = contentType; } public String getContentType() { return contentType; } public String getName() { return null; } public long getSize() { return 0; } public InputStream getInputStream() throws IOException { return emptyInputStream; } public OutputStream getOutputStream() throws IOException { throw new UnsupportedOperationException(); } } ./src/org/apache/axiom/util/sax/0000775000175000017500000000000011767656530015671 5ustar brianbrian./src/org/apache/axiom/util/sax/AbstractXMLReader.java0000664000175000017500000001026011767656530022002 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.sax; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; /** * Partial implementation of the {@link XMLReader} interface. It implements all the getters and * setters so that subclasses only need to implement {@link XMLReader#parse(InputSource)} and * {@link XMLReader#parse(String)}. Subclasses can access the various handlers and properties set on * the reader through protected attributes. */ public abstract class AbstractXMLReader implements XMLReader { private static final String URI_LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler"; protected boolean namespaces = true; protected boolean namespacePrefixes = false; protected ContentHandler contentHandler; protected LexicalHandler lexicalHandler; protected DTDHandler dtdHandler; protected EntityResolver entityResolver; protected ErrorHandler errorHandler; public ContentHandler getContentHandler() { return contentHandler; } public void setContentHandler(ContentHandler contentHandler) { this.contentHandler = contentHandler; } public DTDHandler getDTDHandler() { return dtdHandler; } public void setDTDHandler(DTDHandler dtdHandler) { this.dtdHandler = dtdHandler; } public EntityResolver getEntityResolver() { return entityResolver; } public void setEntityResolver(EntityResolver entityResolver) { this.entityResolver = entityResolver; } public ErrorHandler getErrorHandler() { return errorHandler; } public void setErrorHandler(ErrorHandler errorHandler) { this.errorHandler = errorHandler; } public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotRecognizedException(name); } public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if ("http://xml.org/sax/features/namespaces".equals(name)) { namespaces = value; } else if ("http://xml.org/sax/features/namespace-prefixes".equals(name)) { namespacePrefixes = value; } else { throw new SAXNotRecognizedException(name); } } public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if ("http://xml.org/sax/features/namespaces".equals(name)) { return Boolean.valueOf(namespaces); } else if ("http://xml.org/sax/features/namespace-prefixes".equals(name)) { return Boolean.valueOf(namespacePrefixes); } else if (URI_LEXICAL_HANDLER.equals(name)) { return lexicalHandler; } else { throw new SAXNotRecognizedException(name); } } public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (URI_LEXICAL_HANDLER.equals(name)) { lexicalHandler = (LexicalHandler)value; } else { throw new SAXNotRecognizedException(name); } } } ./src/org/apache/axiom/util/stax/0000775000175000017500000000000011767656530016055 5ustar brianbrian./src/org/apache/axiom/util/stax/XMLStreamIOException.java0000664000175000017500000000300311767656530022637 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import javax.xml.stream.XMLStreamException; /** * {@link IOException} that wraps an {@link XMLStreamException}. */ public class XMLStreamIOException extends IOException { private static final long serialVersionUID = -2209565480803762583L; /** * Constructor. * * @param cause the {@link XMLStreamException} to wrap */ public XMLStreamIOException(XMLStreamException cause) { initCause(cause); } /** * Get the wrapped {@link XMLStreamException}. * * @return the wrapped exception */ public XMLStreamException getXMLStreamException() { return (XMLStreamException)getCause(); } } ./src/org/apache/axiom/util/stax/XMLStreamWriterWriter.java0000664000175000017500000000506511767656530023134 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import java.io.Writer; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * {@link Writer} implementation that writes data as * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} events to an {@link XMLStreamWriter}. * Note that this class *

          *
        • doesn't buffer the data;
        • *
        • ignores calls to {@link #flush()} and {@link #close()};
        • *
        • is not thread-safe (synchronized).
        • *
        * Any {@link XMLStreamException} occurring in the underlying {@link XMLStreamWriter} will * be wrapped using {@link XMLStreamIOException}. */ public class XMLStreamWriterWriter extends Writer { private final XMLStreamWriter writer; /** * Constructor. * * @param writer the XML stream writer to write the events to */ public XMLStreamWriterWriter(XMLStreamWriter writer) { this.writer = writer; } public void write(char[] cbuf, int off, int len) throws IOException { try { writer.writeCharacters(cbuf, off, len); } catch (XMLStreamException ex) { throw new XMLStreamIOException(ex); } } public void write(String str, int off, int len) throws IOException { write(str.substring(off, off+len)); } public void write(String str) throws IOException { try { writer.writeCharacters(str); } catch (XMLStreamException ex) { throw new XMLStreamIOException(ex); } } public void write(int c) throws IOException { write(new char[] { (char)c }); } public void flush() throws IOException { // Do nothing } public void close() throws IOException { // Do nothing } } ./src/org/apache/axiom/util/stax/DummyLocation.java0000664000175000017500000000311211767656530021501 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import javax.xml.stream.Location; /** * Dummy {@link Location} implementation. It always returns -1 for the location * and null for the publicId and systemId. It may be used by * {@link javax.xml.stream.XMLStreamReader} implementations that don't support * the concept of location. */ public class DummyLocation implements Location { public static final DummyLocation INSTANCE = new DummyLocation(); protected DummyLocation() {} public int getLineNumber() { return -1; } public int getColumnNumber() { return -1; } public int getCharacterOffset() { return 0; } public String getPublicId() { return null; } public String getSystemId() { return null; } } ./src/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java0000664000175000017500000003244311767656530024302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import java.io.Reader; import java.util.Collections; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.util.namespace.MapBasedNamespaceContext; /** * {@link XMLStreamReader} implementation that * represents a text node wrapped inside an element. The text data is provided by a * {@link java.io.Reader Reader}. *

        * It will produce the following sequence of XML events: *

          *
        • START_DOCUMENT
        • *
        • START_ELEMENT
        • *
        • (CHARACTER)*
        • *
        • END_ELEMENT
        • *
        • END_DOCMENT
        • *
        * The class is implemented as a simple state machine, where the state is identified * by the current event type. The initial state is START_DOCUMENT and the * following transitions are triggered by {@link #next()}: *
          *
        • START_DOCUMENT → START_ELEMENT
        • *
        • START_ELEMENT → END_ELEMENT (if character stream is empty)
        • *
        • START_ELEMENT → CHARACTERS (if character stream is not empty)
        • *
        • CHARACTERS → CHARACTERS (if data available in stream)
        • *
        • CHARACTERS → END_ELEMENT (if end of stream reached)
        • *
        • END_ELEMENT → END_DOCUMENT
        • *
        * Additionally, {@link #getElementText()} triggers the following transition: *
          *
        • START_ELEMENT → END_ELEMENT
        • *
        * Note that since multiple consecutive CHARACTERS events may be returned, this * "parser" is not coalescing. * */ // TODO: this is a good candidate to implement the CharacterDataReader interface public class WrappedTextNodeStreamReader implements XMLStreamReader { /** * The qualified name of the wrapper element. */ private final QName wrapperElementName; /** * The Reader object that represents the text data. */ private final Reader reader; /** * The maximum number of characters to return for each CHARACTER event. */ private final int chunkSize; /** * The type of the current XML event. */ private int eventType = START_DOCUMENT; /** * The character data for the current event. This is only set if the current * event is a CHARACTER event. The size of the array is determined by * {@link #chunkSize} */ private char[] charData; /** * The length of the character data in {@link #charData}. */ private int charDataLength; /** * The namespace context applicable in the scope of the wrapper element. * Beside the default mappings for xml and xmlns, it only contains the * mapping for the namespace of the wrapper element. * This attribute is initialized lazily by {@link #getNamespaceContext()}. */ private NamespaceContext namespaceContext; /** * Create a new instance. * * @param wrapperElementName the qualified name of the wrapper element * @param reader the Reader object holding the character data to be wrapped * @param chunkSize the maximum number of characters that are returned for each CHARACTER event */ public WrappedTextNodeStreamReader(QName wrapperElementName, Reader reader, int chunkSize) { this.wrapperElementName = wrapperElementName; this.reader = reader; this.chunkSize = chunkSize; } /** * Create a new instance with chunk size 4096. * * @param wrapperElementName the qualified name of the wrapper element * @param reader the Reader object holding the character data to be wrapped */ public WrappedTextNodeStreamReader(QName wrapperElementName, Reader reader) { this(wrapperElementName, reader, 4096); } public Object getProperty(String name) throws IllegalArgumentException { // We don't define any properties return null; } // // Methods to manipulate the parser state // public boolean hasNext() throws XMLStreamException { return eventType != END_DOCUMENT; } public int next() throws XMLStreamException { // Determine next event type based on current event type. If current event type // is START_ELEMENT or CHARACTERS, pull new data from the reader. switch (eventType) { case START_DOCUMENT: eventType = START_ELEMENT; break; case START_ELEMENT: charData = new char[chunkSize]; // No break here! case CHARACTERS: try { charDataLength = reader.read(charData); } catch (IOException ex) { throw new XMLStreamException(ex); } if (charDataLength == -1) { charData = null; eventType = END_ELEMENT; } else { eventType = CHARACTERS; } break; case END_ELEMENT: eventType = END_DOCUMENT; break; default: throw new IllegalStateException(); } return eventType; } public int nextTag() throws XMLStreamException { // We don't have white space, comments or processing instructions throw new XMLStreamException("Current event is not white space"); } public int getEventType() { return eventType; } public boolean isStartElement() { return eventType == START_ELEMENT; } public boolean isEndElement() { return eventType == END_ELEMENT; } public boolean isCharacters() { return eventType == CHARACTERS; } public boolean isWhiteSpace() { return false; } public boolean hasText() { return eventType == CHARACTERS; } public boolean hasName() { return eventType == START_ELEMENT || eventType == END_ELEMENT; } public void require(int type, String namespaceURI, String localName) throws XMLStreamException { if (type != eventType || (namespaceURI != null && !namespaceURI.equals(getNamespaceURI())) || (localName != null && !namespaceURI.equals(getLocalName()))) { throw new XMLStreamException("Unexpected event type"); } } public Location getLocation() { // We do not support location information return DummyLocation.INSTANCE; } public void close() throws XMLStreamException { // Javadoc says that this method should not close the underlying input source, // but we need to close the reader somewhere. try { reader.close(); } catch (IOException ex) { throw new XMLStreamException(ex); } } // // Methods related to the xml declaration. // public String getEncoding() { // Encoding is not known (not relevant?) return null; } public String getCharacterEncodingScheme() { // Encoding is not known (not relevant?) return null; } public String getVersion() { // Version is not relevant return null; } public boolean standaloneSet() { return false; } public boolean isStandalone() { return true; } // // Methods related to the namespace context // public NamespaceContext getNamespaceContext() { if (namespaceContext == null) { namespaceContext = new MapBasedNamespaceContext(Collections.singletonMap(wrapperElementName.getPrefix(), wrapperElementName.getNamespaceURI())); } return namespaceContext; } public String getNamespaceURI(String prefix) { String namespaceURI = getNamespaceContext().getNamespaceURI(prefix); // NamespaceContext#getNamespaceURI and XMLStreamReader#getNamespaceURI have slightly // different semantics for unbound prefixes. return namespaceURI.equals(XMLConstants.NULL_NS_URI) ? null : prefix; } // // Methods related to elements // private void checkStartElement() { if (eventType != START_ELEMENT) { throw new IllegalStateException(); } } public String getAttributeValue(String namespaceURI, String localName) { checkStartElement(); return null; } public int getAttributeCount() { checkStartElement(); return 0; } public QName getAttributeName(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public String getAttributeLocalName(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public String getAttributePrefix(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public String getAttributeNamespace(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public String getAttributeType(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public String getAttributeValue(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } public boolean isAttributeSpecified(int index) { checkStartElement(); throw new ArrayIndexOutOfBoundsException(); } private void checkElement() { if (eventType != START_ELEMENT && eventType != END_ELEMENT) { throw new IllegalStateException(); } } public QName getName() { return null; } public String getLocalName() { checkElement(); return wrapperElementName.getLocalPart(); } public String getPrefix() { return wrapperElementName.getPrefix(); } public String getNamespaceURI() { checkElement(); return wrapperElementName.getNamespaceURI(); } public int getNamespaceCount() { checkElement(); // There is one namespace declared on the wrapper element return 1; } public String getNamespacePrefix(int index) { checkElement(); if (index == 0) { return wrapperElementName.getPrefix(); } else { throw new IndexOutOfBoundsException(); } } public String getNamespaceURI(int index) { checkElement(); if (index == 0) { return wrapperElementName.getNamespaceURI(); } else { throw new IndexOutOfBoundsException(); } } public String getElementText() throws XMLStreamException { if (eventType == START_ELEMENT) { // Actually the purpose of this class is to avoid storing // the character data entirely in memory, but if the caller // wants a String, we don't have the choice... try { StringBuffer buffer = new StringBuffer(); char[] cbuf = new char[4096]; int c; while ((c = reader.read(cbuf)) != -1) { buffer.append(cbuf, 0, c); } eventType = END_ELEMENT; return buffer.toString(); } catch (IOException ex) { throw new XMLStreamException(ex); } } else { throw new XMLStreamException("Current event is not a START_ELEMENT"); } } private void checkCharacters() { if (eventType != CHARACTERS) { throw new IllegalStateException(); } } public String getText() { checkCharacters(); return new String(charData, 0, charDataLength); } public char[] getTextCharacters() { checkCharacters(); return charData; } public int getTextStart() { checkCharacters(); return 0; } public int getTextLength() { checkCharacters(); return charDataLength; } public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { checkCharacters(); int c = Math.min(charDataLength-sourceStart, length); System.arraycopy(charData, sourceStart, target, targetStart, c); return c; } // // Methods related to processing instructions // public String getPIData() { throw new IllegalStateException(); } public String getPITarget() { throw new IllegalStateException(); } } ./src/org/apache/axiom/util/stax/TextFromElementReader.java0000664000175000017500000001223111767656530023124 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import java.io.Reader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * {@link Reader} implementation that extracts the text nodes from an element given by an * {@link XMLStreamReader}. The expected input is a document with only a document * element (as produced by {@link org.apache.axiom.om.OMElement#getXMLStreamReader()}). * The class will extract the text nodes that are direct children of that element, i.e. it uses * the same conventions as {@link org.apache.axiom.om.OMElement#getText()}. * It will call {@link XMLStreamReader#close()} when the end of the document is reached or when * {@link #close()} is called. *

        * The main purpose of this class is to provide a convenient and efficient way to get the text * content of an element without converting it first to a string, i.e. without using * {@link org.apache.axiom.om.OMElement#getText()}. This is important for potentially * large contents, for which this class guarantees constant memory usage. *

        * Note that this class should in general not be used directly. Instead, * {@link org.apache.axiom.om.util.ElementHelper#getTextAsStream(org.apache.axiom.om.OMElement)} * should be called to get the most efficient stream implementation for a given an element. */ // This class has package access -> use XMLStreamReaderUtils#getElementTextAsStream class TextFromElementReader extends Reader { private final XMLStreamReader stream; private final boolean allowNonTextChildren; /** * Flag indicating that we have reached the end of the document and that the underlying * parser has been closed. */ private boolean endOfStream; /** * The current depth relative to the document element (not the document). A value greater than * 0 indicates that we are inside a nested element and that we need to skip text nodes. */ private int skipDepth; /** * The current position in the character data of the event, or -1 if all the character data * has been consumed and a new event needs to be requested from the parser. */ private int sourceStart = -1; TextFromElementReader(XMLStreamReader stream, boolean allowNonTextChildren) { this.stream = stream; this.allowNonTextChildren = allowNonTextChildren; } public int read(char[] cbuf, int off, int len) throws IOException { if (endOfStream) { return -1; } int read = 0; try { while (true) { if (sourceStart == -1) { eventLoop: while (true) { int type = stream.next(); switch (type) { case XMLStreamReader.CHARACTERS: case XMLStreamReader.CDATA: if (skipDepth == 0) { sourceStart = 0; break eventLoop; } break; case XMLStreamReader.START_ELEMENT: if (allowNonTextChildren) { skipDepth++; } else { throw new IOException("Unexpected START_ELEMENT event"); } break; case XMLStreamReader.END_ELEMENT: if (skipDepth == 0) { endOfStream = true; return read == 0 ? -1 : read; } else { skipDepth--; } } } } int c = stream.getTextCharacters(sourceStart, cbuf, off, len); sourceStart += c; off += c; len -= c; read += c; if (len > 0) { sourceStart = -1; } else { return read; } } } catch (XMLStreamException ex) { throw new XMLStreamIOException(ex); } } public void close() throws IOException { // Do nothing } } ./src/org/apache/axiom/util/stax/AbstractXMLStreamWriter.java0000664000175000017500000002263511767656530023425 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.util.namespace.ScopedNamespaceContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Partial implementation of the {@link XMLStreamWriter} interface. It handles namespace bindings, * i.e. the methods related to the namespace context. Subclasses only need to implement write * methods that take a prefix together with the namespace URI argument. This class implements all * {@link XMLStreamWriter} methods that have a namespace URI argument, but no prefix argument. */ public abstract class AbstractXMLStreamWriter implements XMLStreamWriter { private static final Log log = LogFactory.getLog(AbstractXMLStreamWriter.class); private final ScopedNamespaceContext namespaceContext = new ScopedNamespaceContext(); private boolean inEmptyElement; public final NamespaceContext getNamespaceContext() { return namespaceContext; } public final void setNamespaceContext(NamespaceContext context) throws XMLStreamException { // We currently don't support this method throw new UnsupportedOperationException(); } public final String getPrefix(String uri) throws XMLStreamException { return namespaceContext.getPrefix(uri); } private void internalSetPrefix(String prefix, String uri) { if (inEmptyElement) { log.warn("The behavior of XMLStreamWriter#setPrefix and " + "XMLStreamWriter#setDefaultNamespace is undefined when invoked in the " + "context of an empty element"); } namespaceContext.setPrefix(prefix, uri); } public final void setDefaultNamespace(String uri) throws XMLStreamException { internalSetPrefix("", uri); } public final void setPrefix(String prefix, String uri) throws XMLStreamException { internalSetPrefix(prefix, uri); } public final void writeStartDocument() throws XMLStreamException { doWriteStartDocument(); } protected abstract void doWriteStartDocument() throws XMLStreamException; public final void writeStartDocument(String encoding, String version) throws XMLStreamException { doWriteStartDocument(encoding, version); } protected abstract void doWriteStartDocument(String encoding, String version) throws XMLStreamException; public final void writeStartDocument(String version) throws XMLStreamException { doWriteStartDocument(version); } protected abstract void doWriteStartDocument(String version) throws XMLStreamException; public final void writeDTD(String dtd) throws XMLStreamException { doWriteDTD(dtd); } protected abstract void doWriteDTD(String dtd) throws XMLStreamException; public final void writeEndDocument() throws XMLStreamException { doWriteEndDocument(); } protected abstract void doWriteEndDocument() throws XMLStreamException; private String internalGetPrefix(String namespaceURI) throws XMLStreamException { String prefix = namespaceContext.getPrefix(namespaceURI); if (prefix == null) { throw new XMLStreamException("Unbound namespace URI '" + namespaceURI + "'"); } else { return prefix; } } public final void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { doWriteStartElement(prefix, localName, namespaceURI); namespaceContext.startScope(); inEmptyElement = false; } public final void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { doWriteStartElement(internalGetPrefix(namespaceURI), namespaceURI, localName); namespaceContext.startScope(); inEmptyElement = false; } protected abstract void doWriteStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException; public final void writeStartElement(String localName) throws XMLStreamException { doWriteStartElement(localName); namespaceContext.startScope(); inEmptyElement = false; } protected abstract void doWriteStartElement(String localName) throws XMLStreamException; public final void writeEndElement() throws XMLStreamException { doWriteEndElement(); namespaceContext.endScope(); inEmptyElement = false; } protected abstract void doWriteEndElement() throws XMLStreamException; public final void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { doWriteEmptyElement(prefix, localName, namespaceURI); inEmptyElement = true; } public final void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { doWriteEmptyElement(internalGetPrefix(namespaceURI), namespaceURI, localName); inEmptyElement = true; } protected abstract void doWriteEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException; public final void writeEmptyElement(String localName) throws XMLStreamException { doWriteEmptyElement(localName); inEmptyElement = true; } protected abstract void doWriteEmptyElement(String localName) throws XMLStreamException; public final void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { doWriteAttribute(prefix, namespaceURI, localName, value); } public final void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { doWriteAttribute(internalGetPrefix(namespaceURI), namespaceURI, localName, value); } protected abstract void doWriteAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException; public final void writeAttribute(String localName, String value) throws XMLStreamException { doWriteAttribute(localName, value); } protected abstract void doWriteAttribute(String localName, String value) throws XMLStreamException; public final void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { doWriteNamespace(prefix, namespaceURI); } protected abstract void doWriteNamespace(String prefix, String namespaceURI) throws XMLStreamException; public final void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { doWriteDefaultNamespace(namespaceURI); } protected abstract void doWriteDefaultNamespace(String namespaceURI) throws XMLStreamException; public final void writeCharacters(char[] text, int start, int len) throws XMLStreamException { doWriteCharacters(text, start, len); inEmptyElement = false; } protected abstract void doWriteCharacters(char[] text, int start, int len) throws XMLStreamException; public final void writeCharacters(String text) throws XMLStreamException { doWriteCharacters(text); inEmptyElement = false; } protected abstract void doWriteCharacters(String text) throws XMLStreamException; public final void writeCData(String data) throws XMLStreamException { doWriteCData(data); inEmptyElement = false; } protected abstract void doWriteCData(String data) throws XMLStreamException; public final void writeComment(String data) throws XMLStreamException { doWriteComment(data); inEmptyElement = false; } protected abstract void doWriteComment(String data) throws XMLStreamException; public final void writeEntityRef(String name) throws XMLStreamException { doWriteEntityRef(name); inEmptyElement = false; } protected abstract void doWriteEntityRef(String name) throws XMLStreamException; public final void writeProcessingInstruction(String target, String data) throws XMLStreamException { doWriteProcessingInstruction(target, data); inEmptyElement = false; } protected abstract void doWriteProcessingInstruction(String target, String data) throws XMLStreamException; public final void writeProcessingInstruction(String target) throws XMLStreamException { doWriteProcessingInstruction(target); inEmptyElement = false; } protected abstract void doWriteProcessingInstruction(String target) throws XMLStreamException; } ./src/org/apache/axiom/util/stax/wrapper/0000775000175000017500000000000011767656530017535 5ustar brianbrian./src/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java0000664000175000017500000001364311767656530024761 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * Base class for {@link XMLStreamWriter} wrappers. The class provides default implementations for * all methods. Each of them calls the corresponding method in the parent writer. Note that in * contrast to {@link javax.xml.stream.XMLStreamReader}, for which there is a * {@link javax.xml.stream.util.StreamReaderDelegate}, no equivalent exists in the StAX API for * {@link XMLStreamWriter}. */ public class XMLStreamWriterWrapper implements XMLStreamWriter { private final XMLStreamWriter parent; /** * Constructor. * * @param parent the parent writer */ public XMLStreamWriterWrapper(XMLStreamWriter parent) { this.parent = parent; } public void close() throws XMLStreamException { parent.close(); } public void flush() throws XMLStreamException { parent.flush(); } public NamespaceContext getNamespaceContext() { return parent.getNamespaceContext(); } public String getPrefix(String uri) throws XMLStreamException { return parent.getPrefix(uri); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public void setDefaultNamespace(String uri) throws XMLStreamException { parent.setDefaultNamespace(uri); } public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { parent.setNamespaceContext(context); } public void setPrefix(String prefix, String uri) throws XMLStreamException { parent.setPrefix(prefix, uri); } public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { parent.writeAttribute(prefix, namespaceURI, localName, value); } public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { parent.writeAttribute(namespaceURI, localName, value); } public void writeAttribute(String localName, String value) throws XMLStreamException { parent.writeAttribute(localName, value); } public void writeCData(String data) throws XMLStreamException { parent.writeCData(data); } public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { parent.writeCharacters(text, start, len); } public void writeCharacters(String text) throws XMLStreamException { parent.writeCharacters(text); } public void writeComment(String data) throws XMLStreamException { parent.writeComment(data); } public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { parent.writeDefaultNamespace(namespaceURI); } public void writeDTD(String dtd) throws XMLStreamException { parent.writeDTD(dtd); } public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeEmptyElement(prefix, localName, namespaceURI); } public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { parent.writeEmptyElement(namespaceURI, localName); } public void writeEmptyElement(String localName) throws XMLStreamException { parent.writeEmptyElement(localName); } public void writeEndDocument() throws XMLStreamException { parent.writeEndDocument(); } public void writeEndElement() throws XMLStreamException { parent.writeEndElement(); } public void writeEntityRef(String name) throws XMLStreamException { parent.writeEntityRef(name); } public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { parent.writeNamespace(prefix, namespaceURI); } public void writeProcessingInstruction(String target, String data) throws XMLStreamException { parent.writeProcessingInstruction(target, data); } public void writeProcessingInstruction(String target) throws XMLStreamException { parent.writeProcessingInstruction(target); } public void writeStartDocument() throws XMLStreamException { parent.writeStartDocument(); } public void writeStartDocument(String encoding, String version) throws XMLStreamException { parent.writeStartDocument(encoding, version); } public void writeStartDocument(String version) throws XMLStreamException { parent.writeStartDocument(version); } public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeStartElement(prefix, localName, namespaceURI); } public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { parent.writeStartElement(namespaceURI, localName); } public void writeStartElement(String localName) throws XMLStreamException { parent.writeStartElement(localName); } } ./src/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java0000664000175000017500000001207511767656530025125 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import java.io.InputStream; import java.io.Reader; import javax.xml.stream.EventFilter; import javax.xml.stream.StreamFilter; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; /** * {@link XMLInputFactory} wrapper that wraps all {@link XMLEventReader} and {@link XMLStreamReader} * instances created from it. */ public class WrappingXMLInputFactory extends XMLInputFactoryWrapper { /** * Constructor. * * @param parent the parent factory */ public WrappingXMLInputFactory(XMLInputFactory parent) { super(parent); } /** * Wrap a reader created from this factory. Implementations should override this method if they * which to wrap {@link XMLEventReader} instances created from the factory. The default * implementation simply returns the unwrapped reader. * * @param reader * the reader to wrap * @return the wrapped reader */ protected XMLEventReader wrap(XMLEventReader reader) { return reader; } /** * Wrap a reader created from this factory. Implementations should override this method if they * which to wrap {@link XMLStreamReader} instances created from the factory. The default * implementation simply returns the unwrapped reader. * * @param reader * the reader to wrap * @return the wrapped reader */ protected XMLStreamReader wrap(XMLStreamReader reader) { return reader; } public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { return wrap(super.createFilteredReader(reader, filter)); } public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException { return wrap(super.createFilteredReader(reader, filter)); } public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException { return wrap(super.createXMLEventReader(stream, encoding)); } public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException { return wrap(super.createXMLEventReader(stream)); } public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException { return wrap(super.createXMLEventReader(reader)); } public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException { return wrap(super.createXMLEventReader(source)); } public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException { return wrap(super.createXMLEventReader(systemId, stream)); } public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException { return wrap(super.createXMLEventReader(systemId, reader)); } public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException { return wrap(super.createXMLEventReader(reader)); } public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException { return wrap(super.createXMLStreamReader(stream, encoding)); } public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException { return wrap(super.createXMLStreamReader(stream)); } public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return wrap(super.createXMLStreamReader(reader)); } public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException { return wrap(super.createXMLStreamReader(source)); } public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException { return wrap(super.createXMLStreamReader(systemId, stream)); } public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException { return wrap(super.createXMLStreamReader(systemId, reader)); } } ./src/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java0000664000175000017500000000725711767656530025334 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import java.io.OutputStream; import java.io.Writer; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.Result; /** * {@link XMLOutputFactory} wrapper that wraps all {@link XMLEventWriter} and {@link XMLStreamWriter} * instances created from it. */ public class WrappingXMLOutputFactory extends XMLOutputFactoryWrapper { /** * Constructor. * * @param parent the parent factory */ public WrappingXMLOutputFactory(XMLOutputFactory parent) { super(parent); } /** * Wrap a writer created from this factory. Implementations should override this method if they * which to wrap {@link XMLEventWriter} instances created from the factory. The default * implementation simply returns the unwrapped writer. * * @param writer * the writer to wrap * @return the wrapped writer */ protected XMLEventWriter wrap(XMLEventWriter writer) { return writer; } /** * Wrap a writer created from this factory. Implementations should override this method if they * which to wrap {@link XMLStreamWriter} instances created from the factory. The default * implementation simply returns the unwrapped writer. * * @param writer * the writer to wrap * @return the wrapped writer */ protected XMLStreamWriter wrap(XMLStreamWriter writer) { return writer; } public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding) throws XMLStreamException { return wrap(super.createXMLEventWriter(stream, encoding)); } public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException { return wrap(super.createXMLEventWriter(stream)); } public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException { return wrap(super.createXMLEventWriter(result)); } public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException { return wrap(super.createXMLEventWriter(stream)); } public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding) throws XMLStreamException { return wrap(super.createXMLStreamWriter(stream, encoding)); } public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException { return wrap(super.createXMLStreamWriter(stream)); } public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { return wrap(super.createXMLStreamWriter(result)); } public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException { return wrap(super.createXMLStreamWriter(stream)); } } ./src/org/apache/axiom/util/stax/wrapper/ImmutableXMLInputFactory.java0000664000175000017500000000404311767656530025251 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLReporter; import javax.xml.stream.XMLResolver; import javax.xml.stream.util.XMLEventAllocator; /** * Wraps an {@link XMLInputFactory} so that its state can no longer be changed. The state includes * the properties as well as the {@link XMLEventAllocator}, {@link XMLReporter} and * {@link XMLResolver} instances configured on the factory. */ public class ImmutableXMLInputFactory extends XMLInputFactoryWrapper { /** * Constructor. * * @param parent the parent factory */ public ImmutableXMLInputFactory(XMLInputFactory parent) { super(parent); } public void setEventAllocator(XMLEventAllocator allocator) { throw new IllegalStateException("This factory is immutable"); } public void setProperty(String name, Object value) throws IllegalArgumentException { throw new IllegalStateException("This factory is immutable"); } public void setXMLReporter(XMLReporter reporter) { throw new IllegalStateException("This factory is immutable"); } public void setXMLResolver(XMLResolver resolver) { throw new IllegalStateException("This factory is immutable"); } } ./src/org/apache/axiom/util/stax/wrapper/ImmutableXMLOutputFactory.java0000664000175000017500000000261711767656530025457 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import javax.xml.stream.XMLOutputFactory; /** * Wraps an {@link XMLOutputFactory} so that its state (i.e. its properties) can no longer be * changed. */ public class ImmutableXMLOutputFactory extends XMLOutputFactoryWrapper { /** * Constructor. * * @param parent the parent factory */ public ImmutableXMLOutputFactory(XMLOutputFactory parent) { super(parent); } public void setProperty(String name, Object value) throws IllegalArgumentException { throw new IllegalStateException("This factory is immutable"); } } ./src/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java0000664000175000017500000001237711767656530024763 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import java.io.InputStream; import java.io.Reader; import javax.xml.stream.EventFilter; import javax.xml.stream.StreamFilter; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLReporter; import javax.xml.stream.XMLResolver; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.util.XMLEventAllocator; import javax.xml.transform.Source; /** * Base class for {@link XMLInputFactory} wrappers. The class provides default implementations for * all methods. Each of them calls the corresponding method in the parent factory. */ public class XMLInputFactoryWrapper extends XMLInputFactory { private final XMLInputFactory parent; /** * Constructor. * * @param parent the parent factory */ public XMLInputFactoryWrapper(XMLInputFactory parent) { this.parent = parent; } public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { return parent.createFilteredReader(reader, filter); } public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException { return parent.createFilteredReader(reader, filter); } public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException { return parent.createXMLEventReader(stream, encoding); } public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException { return parent.createXMLEventReader(stream); } public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException { return parent.createXMLEventReader(reader); } public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException { return parent.createXMLEventReader(source); } public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException { return parent.createXMLEventReader(systemId, stream); } public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException { return parent.createXMLEventReader(systemId, reader); } public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException { return parent.createXMLEventReader(reader); } public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException { return parent.createXMLStreamReader(stream, encoding); } public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException { return parent.createXMLStreamReader(stream); } public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return parent.createXMLStreamReader(reader); } public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException { return parent.createXMLStreamReader(source); } public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException { return parent.createXMLStreamReader(systemId, stream); } public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException { return parent.createXMLStreamReader(systemId, reader); } public XMLEventAllocator getEventAllocator() { return parent.getEventAllocator(); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public XMLReporter getXMLReporter() { return parent.getXMLReporter(); } public XMLResolver getXMLResolver() { return parent.getXMLResolver(); } public boolean isPropertySupported(String name) { return parent.isPropertySupported(name); } public void setEventAllocator(XMLEventAllocator allocator) { parent.setEventAllocator(allocator); } public void setProperty(String name, Object value) throws IllegalArgumentException { parent.setProperty(name, value); } public void setXMLReporter(XMLReporter reporter) { parent.setXMLReporter(reporter); } public void setXMLResolver(XMLResolver resolver) { parent.setXMLResolver(resolver); } } ./src/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java0000664000175000017500000000630111767656530025152 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import java.io.OutputStream; import java.io.Writer; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.Result; /** * Base class for {@link XMLOutputFactory} wrappers. The class provides default implementations for * all methods. Each of them calls the corresponding method in the parent factory. */ public class XMLOutputFactoryWrapper extends XMLOutputFactory { private final XMLOutputFactory parent; /** * Constructor. * * @param parent the parent factory */ public XMLOutputFactoryWrapper(XMLOutputFactory parent) { this.parent = parent; } public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding) throws XMLStreamException { return parent.createXMLEventWriter(stream, encoding); } public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException { return parent.createXMLEventWriter(stream); } public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException { return parent.createXMLEventWriter(result); } public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException { return parent.createXMLEventWriter(stream); } public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding) throws XMLStreamException { return parent.createXMLStreamWriter(stream, encoding); } public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException { return parent.createXMLStreamWriter(stream); } public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { return parent.createXMLStreamWriter(result); } public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException { return parent.createXMLStreamWriter(stream); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public boolean isPropertySupported(String name) { return parent.isPropertySupported(name); } public void setProperty(String name, Object value) throws IllegalArgumentException { parent.setProperty(name, value); } } ./src/org/apache/axiom/util/stax/wrapper/package.html0000664000175000017500000000162011767656530022015 0ustar brianbrian Contains classes to build wrappers for various StAX objects. ./src/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java0000664000175000017500000001466711767656530024716 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.wrapper; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * Base class for {@link XMLStreamReader} wrappers. The class provides default implementations for * all methods. Each of them calls the corresponding method in the parent reader. This class is * similar to {@link javax.xml.stream.util.StreamReaderDelegate}, with the difference that it is * immutable. */ public class XMLStreamReaderWrapper implements XMLStreamReader { private final XMLStreamReader parent; /** * Constructor. * * @param parent the parent reader */ public XMLStreamReaderWrapper(XMLStreamReader parent) { this.parent = parent; } /** * Get the parent stream reader. This method is declared as protected because it should only be * used by subclasses. However, stream reader wrappers that can safely be unwrapped may * implement the {@link org.apache.axiom.ext.stax.DelegatingXMLStreamReader} interface to make * this a public method. Note that a corresponding setParent method is * intentionally omitted because {@link XMLStreamReaderWrapper} is immutable. * * @return the parent stream reader that is wrapped by this object */ protected XMLStreamReader getParent() { return parent; } public void close() throws XMLStreamException { parent.close(); } public int getAttributeCount() { return parent.getAttributeCount(); } public String getAttributeLocalName(int index) { return parent.getAttributeLocalName(index); } public QName getAttributeName(int index) { return parent.getAttributeName(index); } public String getAttributeNamespace(int index) { return parent.getAttributeNamespace(index); } public String getAttributePrefix(int index) { return parent.getAttributePrefix(index); } public String getAttributeType(int index) { return parent.getAttributeType(index); } public String getAttributeValue(int index) { return parent.getAttributeValue(index); } public String getAttributeValue(String namespaceURI, String localName) { return parent.getAttributeValue(namespaceURI, localName); } public String getCharacterEncodingScheme() { return parent.getCharacterEncodingScheme(); } public String getElementText() throws XMLStreamException { return parent.getElementText(); } public String getEncoding() { return parent.getEncoding(); } public int getEventType() { return parent.getEventType(); } public String getLocalName() { return parent.getLocalName(); } public Location getLocation() { return parent.getLocation(); } public QName getName() { return parent.getName(); } public NamespaceContext getNamespaceContext() { return parent.getNamespaceContext(); } public int getNamespaceCount() { return parent.getNamespaceCount(); } public String getNamespacePrefix(int index) { return parent.getNamespacePrefix(index); } public String getNamespaceURI() { return parent.getNamespaceURI(); } public String getNamespaceURI(int index) { return parent.getNamespaceURI(index); } public String getNamespaceURI(String prefix) { return parent.getNamespaceURI(prefix); } public String getPIData() { return parent.getPIData(); } public String getPITarget() { return parent.getPITarget(); } public String getPrefix() { return parent.getPrefix(); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public String getText() { return parent.getText(); } public char[] getTextCharacters() { return parent.getTextCharacters(); } public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { return parent.getTextCharacters(sourceStart, target, targetStart, length); } public int getTextLength() { return parent.getTextLength(); } public int getTextStart() { return parent.getTextStart(); } public String getVersion() { return parent.getVersion(); } public boolean hasName() { return parent.hasName(); } public boolean hasNext() throws XMLStreamException { return parent.hasNext(); } public boolean hasText() { return parent.hasText(); } public boolean isAttributeSpecified(int index) { return parent.isAttributeSpecified(index); } public boolean isCharacters() { return parent.isCharacters(); } public boolean isEndElement() { return parent.isEndElement(); } public boolean isStandalone() { return parent.isStandalone(); } public boolean isStartElement() { return parent.isStartElement(); } public boolean isWhiteSpace() { return parent.isWhiteSpace(); } public int next() throws XMLStreamException { return parent.next(); } public int nextTag() throws XMLStreamException { return parent.nextTag(); } public void require(int type, String namespaceURI, String localName) throws XMLStreamException { parent.require(type, namespaceURI, localName); } public boolean standaloneSet() { return parent.standaloneSet(); } } ./src/org/apache/axiom/util/stax/XMLStreamReaderUtils.java0000664000175000017500000003661011767656530022706 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import java.io.Reader; import java.io.Writer; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.CharacterDataReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.util.activation.EmptyDataSource; import org.apache.axiom.util.base64.Base64DecodingOutputStreamWriter; import org.apache.axiom.util.blob.BlobDataSource; import org.apache.axiom.util.blob.MemoryBlob; import org.apache.axiom.util.blob.WritableBlob; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Contains utility methods to work with {@link XMLStreamReader} objects, including the extension * defined by {@link DataHandlerReader}. In addition to {@link DataHandlerReader} support, this * class also provides support for the legacy extension mechanism described below. * *

        Legacy XMLStreamReader extensions for optimized base64 handling

        * *

        * {@link XMLStreamReader} instances supporting the legacy extension must conform to the following * requirements: *

        *
          *
        1. {@link XMLStreamReader#getProperty(String)} must return {@link Boolean#TRUE} for the * property identified by {@link org.apache.axiom.om.OMConstants#IS_DATA_HANDLERS_AWARE}, * regardless of the current event. The property is assumed to be immutable and its value must not * change during the lifetime of the {@link XMLStreamReader} implementation.
        2. *
        3. *

          * If the {@link XMLStreamReader} wishes to expose base64 encoded content using a * {@link javax.activation.DataHandler} object, it must do so using a single * {@link XMLStreamConstants#CHARACTERS} event. *

          *

          * To maintain compatibility with consumers that are unaware of the extensions described here, the * implementation should make sure that {@link XMLStreamReader#getText()}, * {@link XMLStreamReader#getTextStart()}, {@link XMLStreamReader#getTextLength()}, * {@link XMLStreamReader#getTextCharacters()}, * {@link XMLStreamReader#getTextCharacters(int, char[], int, int)} and * {@link XMLStreamReader#getElementText()} behave as expected for this type of event, i.e. return * the base64 representation of the binary content. *

          *
        4. *
        5. {@link XMLStreamReader#getProperty(String)} must return {@link Boolean#TRUE} for the * property identified by {@link org.apache.axiom.om.OMConstants#IS_BINARY} if the current event is * a {@link XMLStreamConstants#CHARACTERS} event representing base64 encoded binary content and for * which a {@link javax.activation.DataHandler} is available. For all other events, the returned * value must be {@link Boolean#FALSE}.
        6. *
        7. *

          * If for a given event, the implementation returned {@link Boolean#TRUE} for the * {@link org.apache.axiom.om.OMConstants#IS_BINARY} property, then a call to * {@link XMLStreamReader#getProperty(String)} with argument * {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} must return the corresponding * {@link javax.activation.DataHandler} object. *

          *

          * The {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} property is undefined for any other type * of event. This implies that the consumer of the {@link XMLStreamReader} must check the * {@link org.apache.axiom.om.OMConstants#IS_BINARY} property before retrieving the * {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} property. *

          *
        8. *
        * The extension mechanism described here has been deprecated mainly because it doesn't support * deferred loading of the binary content. */ public class XMLStreamReaderUtils { // Legacy property names; should be removed in Axiom 1.3 private static final String IS_BINARY = "Axiom.IsBinary"; private static final String DATA_HANDLER = "Axiom.DataHandler"; private static final String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing"; private static Log log = LogFactory.getLog(XMLStreamReaderUtils.class); private XMLStreamReaderUtils() {} /** * Get the {@link DataHandlerReader} extension for a given {@link XMLStreamReader}, if * available. If the {@link XMLStreamReader} only supports the legacy extension (as described * above), then this method will return a compatibility wrapper. Note that this wrapper doesn't * support deferred loading of the binary content. * * @param reader * the stream reader to get the {@link DataHandlerReader} extension from * @return the implementation of the extension, or null if the * {@link XMLStreamReader} doesn't expose base64 encoded binary content as * {@link DataHandler} objects. */ public static DataHandlerReader getDataHandlerReader(final XMLStreamReader reader) { try { DataHandlerReader dhr = (DataHandlerReader)reader.getProperty( DataHandlerReader.PROPERTY); if (dhr != null) { return dhr; } } catch (IllegalArgumentException ex) { // Just continue } Boolean isDataHandlerAware; try { isDataHandlerAware = (Boolean)reader.getProperty(IS_DATA_HANDLERS_AWARE); } catch (IllegalArgumentException ex) { return null; } if (isDataHandlerAware != null && isDataHandlerAware.booleanValue()) { return new DataHandlerReader() { public boolean isBinary() { return ((Boolean)reader.getProperty(IS_BINARY)).booleanValue(); } public boolean isOptimized() { // This is compatible with the old StAXBuilder implementation return true; } public boolean isDeferred() { return false; } public String getContentID() { return null; } public DataHandler getDataHandler() { return (DataHandler)reader.getProperty(DATA_HANDLER); } public DataHandlerProvider getDataHandlerProvider() { throw new UnsupportedOperationException(); } }; } else { return null; } } /** * Helper method to implement {@link XMLStreamReader#getProperty(String)}. This method * processed the properties defined by {@link DataHandlerReader#PROPERTY} and the legacy * extension mechanism (as described above). It can therefore be used to make a * {@link XMLStreamReader} implementation compatible with code that expects it to implement this * legacy extension. * * @param extension * the reference to the {@link DataHandlerReader} extension for the * {@link XMLStreamReader} implementation * @param propertyName * the name of the property, as passed to the * {@link XMLStreamReader#getProperty(String)} method * @return the property value as specified by the {@link DataHandlerReader} or legacy extension; * null if the property is not specified by any of these two extensions */ public static Object processGetProperty(DataHandlerReader extension, String propertyName) { if (extension == null || propertyName == null) { throw new IllegalArgumentException(); } else if (propertyName.equals(DataHandlerReader.PROPERTY)) { return extension; } else if (propertyName.equals(IS_DATA_HANDLERS_AWARE)) { return Boolean.TRUE; } else if (propertyName.equals(IS_BINARY)) { return Boolean.valueOf(extension.isBinary()); } else if (propertyName.equals(DATA_HANDLER)) { try { return extension.getDataHandler(); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } else { return null; } } /** * Get a {@link DataHandler} for the binary data encoded in an element. The method supports * base64 encoded character data as well as optimized binary data through the * {@link DataHandlerReader} extension. *

        * Precondition: the reader is on a {@link XMLStreamConstants#START_ELEMENT} *

        * Postcondition: the reader is on the corresponding * {@link XMLStreamConstants#END_ELEMENT} * * @param reader the stream to read the data from * @return the binary data from the element */ public static DataHandler getDataHandlerFromElement(XMLStreamReader reader) throws XMLStreamException { int event = reader.next(); if (event == XMLStreamConstants.END_ELEMENT) { // This means that the element is actually empty -> return empty DataHandler return new DataHandler(new EmptyDataSource("application/octet-stream")); } else if (event != XMLStreamConstants.CHARACTERS) { throw new XMLStreamException("Expected a CHARACTER event"); } DataHandlerReader dhr = getDataHandlerReader(reader); if (dhr != null && dhr.isBinary()) { DataHandler dh = dhr.getDataHandler(); reader.next(); return dh; } else { WritableBlob blob = new MemoryBlob(); Writer out = new Base64DecodingOutputStreamWriter(blob.getOutputStream()); try { writeTextTo(reader, out); // Take into account that in non coalescing mode, there may be additional // CHARACTERS events loop: while (true) { switch (reader.next()) { case XMLStreamConstants.CHARACTERS: writeTextTo(reader, out); break; case XMLStreamConstants.END_ELEMENT: break loop; default: throw new XMLStreamException("Expected a CHARACTER event"); } } out.close(); } catch (IOException ex) { throw new XMLStreamException("Error during base64 decoding", ex); } return new DataHandler(new BlobDataSource(blob, "application/octet-string")); } } /** * Get the character data for the current event from the given reader and * write it to the given writer. The method will try to figure out the most * efficient way to copy the data without unnecessary buffering or * conversions between strings and character arrays. * * @param reader * the reader to get the character data from * @param writer * the writer to write the character data to * @throws XMLStreamException * if the underlying XML source is not well-formed * @throws IOException * if an I/O error occurs when writing the character data * @throws IllegalStateException * if this state is not a valid text state. * @see CharacterDataReader */ public static void writeTextTo(XMLStreamReader reader, Writer writer) throws XMLStreamException, IOException { CharacterDataReader cdataReader; try { cdataReader = (CharacterDataReader)reader.getProperty(CharacterDataReader.PROPERTY); } catch (IllegalArgumentException ex) { cdataReader = null; } if (cdataReader != null) { cdataReader.writeTextTo(writer); } else { writer.write(reader.getText()); } } /** * Get the text content of the current element as a {@link Reader} object. * * @param reader * The XML stream reader to read the element text from. The reader must be positioned * on a {@link XMLStreamConstants#START_ELEMENT} event. * @param allowNonTextChildren * If set to true, non text child nodes are allowed and skipped. If set * to false only text nodes are allowed and the presence of any other * type of child node will trigger an exception. * @return The reader from which the element text can be read. After the reader has reported the * end of the stream, the XML stream reader will be positioned on the * {@link XMLStreamConstants#END_ELEMENT} event corresponding to the initial * {@link XMLStreamConstants#START_ELEMENT} event. Calling {@link Reader#close()} on the * returned reader has no effect. Any parser exception will be reported by the reader * using {@link XMLStreamIOException}. * @throws IllegalStateException * if the XML stream reader is not positioned on a * {@link XMLStreamConstants#START_ELEMENT} event */ public static Reader getElementTextAsStream(XMLStreamReader reader, boolean allowNonTextChildren) { if (reader.getEventType() != XMLStreamReader.START_ELEMENT) { throw new IllegalStateException("Reader must be on a START_ELEMENT event"); } return new TextFromElementReader(reader, allowNonTextChildren); } /** * Searches the wrapper and delegate classes to find the original {@link XMLStreamReader}. * This method should only be used when a consumer of Axiom really needs to * access the original stream reader. * @param parser XMLStreamReader used by Axiom * @return original parser */ public static XMLStreamReader getOriginalXMLStreamReader(XMLStreamReader parser) { if (log.isDebugEnabled()) { String clsName = (parser != null) ? parser.getClass().toString() : "null"; log.debug("Entry getOriginalXMLStreamReader: " + clsName); } while (parser instanceof DelegatingXMLStreamReader) { parser = ((DelegatingXMLStreamReader) parser).getParent(); if (log.isDebugEnabled()) { String clsName = (parser != null) ? parser.getClass().toString() : "null"; log.debug(" parent: " + clsName); } } if (log.isDebugEnabled()) { String clsName = (parser != null) ? parser.getClass().toString() : "null"; log.debug("Exit getOriginalXMLStreamReader: " + clsName); } return parser; } } ./src/org/apache/axiom/util/stax/XMLEventUtils.java0000664000175000017500000000546511767656530021415 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import javax.xml.stream.XMLStreamConstants; /** * Contains utility methods related to StAX events. */ public final class XMLEventUtils { private XMLEventUtils() {} /** * Get the string representation of a given StAX event type. The returned * value is the name of the constant in {@link XMLStreamConstants} * corresponding to the event type. * * @param event * the event type as returned by * {@link javax.xml.stream.events.XMLEvent#getEventType()}, * {@link javax.xml.stream.XMLStreamReader#getEventType()} or * {@link javax.xml.stream.XMLStreamReader#next()} * @return a string representation of the event type */ public static String getEventTypeString(int event) { String state = null; switch(event) { case XMLStreamConstants.START_ELEMENT: state = "START_ELEMENT"; break; case XMLStreamConstants.START_DOCUMENT: state = "START_DOCUMENT"; break; case XMLStreamConstants.CHARACTERS: state = "CHARACTERS"; break; case XMLStreamConstants.CDATA: state = "CDATA"; break; case XMLStreamConstants.END_ELEMENT: state = "END_ELEMENT"; break; case XMLStreamConstants.END_DOCUMENT: state = "END_DOCUMENT"; break; case XMLStreamConstants.SPACE: state = "SPACE"; break; case XMLStreamConstants.COMMENT: state = "COMMENT"; break; case XMLStreamConstants.DTD: state = "DTD"; break; case XMLStreamConstants.PROCESSING_INSTRUCTION: state = "PROCESSING_INSTRUCTION"; break; case XMLStreamConstants.ENTITY_REFERENCE: state = "ENTITY_REFERENCE"; break; default : state = "UNKNOWN_STATE: " + event; } return state; } } ./src/org/apache/axiom/util/stax/XMLStreamWriterUtils.java0000664000175000017500000001733011767656530022756 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.io.IOException; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter; import org.apache.axiom.util.base64.Base64EncodingWriterOutputStream; /** * Contains utility methods to work with {@link XMLStreamWriter} objects. */ public class XMLStreamWriterUtils { /** * Write base64 encoded data to a stream writer. This will result in one or more * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} events to be written * to the stream (or zero events if the data handler produces an empty byte sequence), * i.e. the data is streamed from the data handler directly to the stream writer. * Since no in-memory base64 representation of the entire binary data is built, this * method is suitable for very large amounts of data. *

        * Note that this method will always serialize the data as base64 encoded character data. * Serialization code should prefer using * {@link #writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)} or * {@link #writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)} to * enable optimization (if supported by the {@link XMLStreamWriter}). * * @param writer the stream writer to write the data to * @param dh the data handler containing the data to encode * @throws IOException if an error occurs when reading the data from the data handler * @throws XMLStreamException if an error occurs when writing the base64 encoded data to * the stream */ public static void writeBase64(XMLStreamWriter writer, DataHandler dh) throws IOException, XMLStreamException { Base64EncodingWriterOutputStream out = new Base64EncodingWriterOutputStream( new XMLStreamWriterWriter(writer)); try { dh.writeTo(out); out.close(); } catch (XMLStreamIOException ex) { throw ex.getXMLStreamException(); } } private static DataHandlerWriter internalGetDataHandlerWriter(XMLStreamWriter writer) { try { return (DataHandlerWriter)writer.getProperty(DataHandlerWriter.PROPERTY); } catch (IllegalArgumentException ex) { return null; } } /** * Get the {@link DataHandlerWriter} extension for a given {@link XMLStreamWriter}. If the * writer expose the extension, a reference to the extension interface implementation is * returned. If the writer doesn't expose the extension, this method returns an instance of the * extension interface that emulates the extension (by writing the binary data as base64 * character data to the stream). * * @param writer * the stream for which the method should return the {@link DataHandlerWriter} * extension * @return a reference to the extension interface exposed by the writer or an implementation the * emulates the extension; the return value is never null */ public static DataHandlerWriter getDataHandlerWriter(final XMLStreamWriter writer) { DataHandlerWriter dataHandlerWriter = internalGetDataHandlerWriter(writer); if (dataHandlerWriter == null) { return new DataHandlerWriter() { public void writeDataHandler(DataHandler dataHandler, String contentID, boolean optimize) throws IOException, XMLStreamException { writeBase64(writer, dataHandler); } public void writeDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, XMLStreamException { writeBase64(writer, dataHandlerProvider.getDataHandler()); } }; } else { return dataHandlerWriter; } } /** * Write binary content to the stream. Depending on the supplied {@link XMLStreamWriter}, * the content will be written as base64 encoded character data or using an optimization * scheme such as XOP/MTOM. The method attempts to submit the binary content using the * {@link DataHandlerWriter} extension. If the writer doesn't expose this extension, * the method will fall back to {@link #writeBase64(XMLStreamWriter, DataHandler)}. *

        * Please refer to the documentation of {@link DataHandlerWriter} for a more * detailed description of the semantics of the different arguments. * * @param writer * the stream writer to write the data to * @param dataHandler * the binary content to write * @param contentID * an existing content ID for the binary data * @param optimize * indicates whether the content is eligible for optimization * @throws IOException * if an error occurs while reading from the data handler * @throws XMLStreamException * if an error occurs while writing to the underlying stream */ public static void writeDataHandler(XMLStreamWriter writer, DataHandler dataHandler, String contentID, boolean optimize) throws IOException, XMLStreamException { DataHandlerWriter dataHandlerWriter = internalGetDataHandlerWriter(writer); if (dataHandlerWriter != null) { dataHandlerWriter.writeDataHandler(dataHandler, contentID, optimize); } else { writeBase64(writer, dataHandler); } } /** * Write binary content to the stream. This method is similar to * {@link #writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)}, * but supports deferred loading of the data handler. * * @param writer * the stream writer to write the data to * @param dataHandlerProvider * the binary content to write * @param contentID * an existing content ID for the binary data * @param optimize * indicates whether the content is eligible for optimization * @throws IOException * if an error occurs while reading from the data handler * @throws XMLStreamException * if an error occurs while writing to the underlying stream */ public static void writeDataHandler(XMLStreamWriter writer, DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, XMLStreamException { DataHandlerWriter dataHandlerWriter = internalGetDataHandlerWriter(writer); if (dataHandlerWriter != null) { dataHandlerWriter.writeDataHandler(dataHandlerProvider, contentID, optimize); } else { writeBase64(writer, dataHandlerProvider.getDataHandler()); } } } ./src/org/apache/axiom/util/stax/XMLFragmentStreamReader.java0000775000175000017500000003522511767656530023355 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import java.util.NoSuchElementException; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * Wrapping XML stream reader that reads a single element from the underlying stream. * It will generate START_DOCUMENT and END_DOCUMENT events as required to make * the sequence of events appear as a complete document. *

        * Assume for example that the parent reader is parsing the following document: *

        <a><b>text</b></a>
        * If the current event is <b> when the wrapper is created, it will produce * the following sequence of events: *

        *

          *
        • A synthetic START_DOCUMENT event.
        • *
        • START_ELEMENT, CHARACTERS and END_ELEMENT events for <b>text</b>. * For these events, the wrapper directly delegates to the parent reader.
        • *
        • A synthetic END_DOCUMENT event.
        • *
        * After all events have been consumed from the wrapper, the current event on the parent reader * will be the event following the last END_ELEMENT of the fragment. In the example above this * will be </a>. *

        * The wrapper will release the reference to the parent reader when {@link #close()} is called. * For obvious reasons, the wrapper will never call {@link XMLStreamReader#close()} on the parent * reader. */ public class XMLFragmentStreamReader implements XMLStreamReader { // The current event is a synthetic START_DOCUMENT event private static final int STATE_START_DOCUMENT = 0; // The current event is from the fragment and there will be more events from the fragment private static final int STATE_IN_FRAGMENT = 1; // The current event is the final END_ELEMENT event from the fragment private static final int STATE_FRAGMENT_END = 2; // The current event is a synthetic END_DOCUMENT event private static final int STATE_END_DOCUMENT = 3; private XMLStreamReader parent; private int state; private int depth; /** * Constructor. * * @param parent the parent reader to read the fragment from * @throws IllegalStateException if the current event on the parent is not a START_ELEMENT */ public XMLFragmentStreamReader(XMLStreamReader parent) { this.parent = parent; if (parent.getEventType() != START_ELEMENT) { throw new IllegalStateException("Expected START_ELEMENT as current event"); } } public int getEventType() { switch (state) { case STATE_START_DOCUMENT: return START_DOCUMENT; case STATE_IN_FRAGMENT: return parent.getEventType(); case STATE_FRAGMENT_END: return END_ELEMENT; case STATE_END_DOCUMENT: return END_DOCUMENT; default: // We will never get here; just make the compiler happy. throw new IllegalStateException(); } } public int next() throws XMLStreamException { switch (state) { case STATE_START_DOCUMENT: state = STATE_IN_FRAGMENT; return START_ELEMENT; case STATE_IN_FRAGMENT: int type = parent.next(); switch (type) { case START_ELEMENT: depth++; break; case END_ELEMENT: if (depth == 0) { state = STATE_FRAGMENT_END; } else { depth--; } } return type; case STATE_FRAGMENT_END: // Consume the event from the parent to put the parser in a well-defined state parent.next(); state = STATE_END_DOCUMENT; return END_DOCUMENT; default: throw new NoSuchElementException("End of document reached"); } } public int nextTag() throws XMLStreamException { switch (state) { case STATE_START_DOCUMENT: state = STATE_IN_FRAGMENT; return START_ELEMENT; case STATE_END_DOCUMENT: case STATE_FRAGMENT_END: throw new NoSuchElementException(); default: int result = parent.nextTag(); switch (result) { case START_ELEMENT: depth++; break; case END_ELEMENT: if (depth == 0) { state = STATE_FRAGMENT_END; } else { depth--; } } return result; } } public void close() throws XMLStreamException { parent = null; } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public String getCharacterEncodingScheme() { if (state == STATE_START_DOCUMENT) { return null; } else { throw new IllegalStateException(); } } public String getEncoding() { if (state == STATE_START_DOCUMENT) { return null; } else { throw new IllegalStateException(); } } public String getVersion() { return "1.0"; } public boolean isStandalone() { return true; } public boolean standaloneSet() { return false; } public Location getLocation() { return parent.getLocation(); } public int getAttributeCount() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeCount(); } } public String getAttributeLocalName(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeLocalName(index); } } public QName getAttributeName(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeName(index); } } public String getAttributeNamespace(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeNamespace(index); } } public String getAttributePrefix(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributePrefix(index); } } public String getAttributeType(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeType(index); } } public String getAttributeValue(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeValue(index); } } public boolean isAttributeSpecified(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.isAttributeSpecified(index); } } public String getAttributeValue(String namespaceURI, String localName) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getAttributeValue(namespaceURI, localName); } } public String getElementText() throws XMLStreamException { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getElementText(); } } public String getLocalName() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getLocalName(); } } public QName getName() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getName(); } } public String getPrefix() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getPrefix(); } } public String getNamespaceURI() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getNamespaceURI(); } } public int getNamespaceCount() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getNamespaceCount(); } } public String getNamespacePrefix(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getNamespacePrefix(index); } } public String getNamespaceURI(int index) { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getNamespaceURI(index); } } public String getNamespaceURI(String prefix) { // It is not clear whether this method is allowed in all states. // The XMLStreamReader Javadoc suggest it is, but Woodstox doesn't // allow it on states other than START_ELEMENT and END_ELEMENT. // We emulate behavior of Woodstox. if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getNamespaceURI(prefix); } } public NamespaceContext getNamespaceContext() { return parent.getNamespaceContext(); } public String getPIData() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getPIData(); } } public String getPITarget() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getPITarget(); } } public String getText() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getText(); } } public char[] getTextCharacters() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getTextCharacters(); } } public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return getTextCharacters(sourceStart, target, targetStart, length); } } public int getTextLength() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getTextLength(); } } public int getTextStart() { if (state == STATE_START_DOCUMENT || state == STATE_END_DOCUMENT) { throw new IllegalStateException(); } else { return parent.getTextStart(); } } public boolean hasName() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.hasName(); } public boolean hasNext() throws XMLStreamException { return state != STATE_END_DOCUMENT; } public boolean hasText() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.hasText(); } public boolean isCharacters() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.isCharacters(); } public boolean isStartElement() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.isStartElement(); } public boolean isEndElement() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.isEndElement(); } public boolean isWhiteSpace() { return state != STATE_START_DOCUMENT && state != STATE_END_DOCUMENT && parent.isWhiteSpace(); } public void require(int type, String namespaceURI, String localName) throws XMLStreamException { switch (state) { case STATE_START_DOCUMENT: if (type != START_DOCUMENT) { throw new XMLStreamException("Expected START_DOCUMENT"); } break; case STATE_END_DOCUMENT: if (type != END_DOCUMENT) { throw new XMLStreamException("Expected END_DOCUMENT"); } break; default: parent.require(type, namespaceURI, localName); } } } ./src/org/apache/axiom/util/stax/xop/0000775000175000017500000000000011767656530016663 5ustar brianbrian./src/org/apache/axiom/util/stax/xop/XOPEncodingStreamWriter.java0000664000175000017500000002051011767656530024212 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter; import org.apache.axiom.util.stax.XMLStreamWriterUtils; /** * {@link XMLStreamWriter} wrapper that encodes XOP. It implements the extension * defined by {@link DataHandlerWriter}. The {@link DataHandler} * objects for the parts referenced by xop:Include element information items produced by * an instance of this class can be retrieved using the {@link #getDataHandler(String)} method. */ public class XOPEncodingStreamWriter extends XOPEncodingStreamWrapper implements XMLStreamWriter, DataHandlerWriter { private final XMLStreamWriter parent; /** * Constructor. * * @param parent * the XML stream to write the encoded infoset to * @param contentIDGenerator * used to generate content IDs for the binary content encoded as * xop:Include element information items * @param optimizationPolicy * the policy to apply to decide which binary content to optimize */ public XOPEncodingStreamWriter(XMLStreamWriter parent, ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy) { super(contentIDGenerator, optimizationPolicy); this.parent = parent; } public Object getProperty(String name) throws IllegalArgumentException { if (DataHandlerWriter.PROPERTY.equals(name)) { return this; } else { return parent.getProperty(name); } } private void writeXOPInclude(String contentID) throws XMLStreamException { String writerPrefix = parent.getPrefix(XOPConstants.NAMESPACE_URI); if (writerPrefix != null) { parent.writeStartElement(XOPConstants.NAMESPACE_URI, "Include"); } else { parent.writeStartElement(XOPConstants.DEFAULT_PREFIX, XOPConstants.INCLUDE, XOPConstants.NAMESPACE_URI); parent.setPrefix(XOPConstants.DEFAULT_PREFIX, XOPConstants.NAMESPACE_URI); parent.writeNamespace(XOPConstants.DEFAULT_PREFIX, XOPConstants.NAMESPACE_URI); } parent.writeAttribute(XOPConstants.HREF, XOPUtils.getURLForContentID(contentID)); parent.writeEndElement(); } public void writeDataHandler(DataHandler dataHandler, String contentID, boolean optimize) throws IOException, XMLStreamException { contentID = processDataHandler(dataHandler, contentID, optimize); if (contentID != null) { writeXOPInclude(contentID); } else { XMLStreamWriterUtils.writeBase64(parent, dataHandler); } } public void writeDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, XMLStreamException { contentID = processDataHandler(dataHandlerProvider, contentID, optimize); if (contentID != null) { writeXOPInclude(contentID); } else { XMLStreamWriterUtils.writeBase64(parent, dataHandlerProvider.getDataHandler()); } } public void close() throws XMLStreamException { parent.close(); } public void flush() throws XMLStreamException { parent.flush(); } public NamespaceContext getNamespaceContext() { return parent.getNamespaceContext(); } public String getPrefix(String uri) throws XMLStreamException { return parent.getPrefix(uri); } public void setDefaultNamespace(String uri) throws XMLStreamException { parent.setDefaultNamespace(uri); } public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { parent.setNamespaceContext(context); } public void setPrefix(String prefix, String uri) throws XMLStreamException { parent.setPrefix(prefix, uri); } public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { parent.writeAttribute(prefix, namespaceURI, localName, value); } public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { parent.writeAttribute(namespaceURI, localName, value); } public void writeAttribute(String localName, String value) throws XMLStreamException { parent.writeAttribute(localName, value); } public void writeCData(String data) throws XMLStreamException { parent.writeCData(data); } public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { parent.writeCharacters(text, start, len); } public void writeCharacters(String text) throws XMLStreamException { parent.writeCharacters(text); } public void writeComment(String data) throws XMLStreamException { parent.writeComment(data); } public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { parent.writeDefaultNamespace(namespaceURI); } public void writeDTD(String dtd) throws XMLStreamException { parent.writeDTD(dtd); } public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeEmptyElement(prefix, localName, namespaceURI); } public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { parent.writeEmptyElement(namespaceURI, localName); } public void writeEmptyElement(String localName) throws XMLStreamException { parent.writeEmptyElement(localName); } public void writeEndDocument() throws XMLStreamException { parent.writeEndDocument(); } public void writeEndElement() throws XMLStreamException { parent.writeEndElement(); } public void writeEntityRef(String name) throws XMLStreamException { parent.writeEntityRef(name); } public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { parent.writeNamespace(prefix, namespaceURI); } public void writeProcessingInstruction(String target, String data) throws XMLStreamException { parent.writeProcessingInstruction(target, data); } public void writeProcessingInstruction(String target) throws XMLStreamException { parent.writeProcessingInstruction(target); } public void writeStartDocument() throws XMLStreamException { parent.writeStartDocument(); } public void writeStartDocument(String encoding, String version) throws XMLStreamException { parent.writeStartDocument(encoding, version); } public void writeStartDocument(String version) throws XMLStreamException { parent.writeStartDocument(version); } public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeStartElement(prefix, localName, namespaceURI); } public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { parent.writeStartElement(namespaceURI, localName); } public void writeStartElement(String localName) throws XMLStreamException { parent.writeStartElement(localName); } } ./src/org/apache/axiom/util/stax/xop/XOPEncodingStreamWrapper.java0000664000175000017500000001037111767656530024362 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; /** * Base class for {@link XOPEncodingStreamReader} and {@link XOPEncodingStreamWriter}. */ public abstract class XOPEncodingStreamWrapper implements MimePartProvider { private final Map dataHandlerObjects = new LinkedHashMap(); private final ContentIDGenerator contentIDGenerator; private final OptimizationPolicy optimizationPolicy; public XOPEncodingStreamWrapper(ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy) { this.contentIDGenerator = contentIDGenerator; this.optimizationPolicy = optimizationPolicy; } private String addDataHandler(Object dataHandlerObject, String existingContentID) { String contentID = contentIDGenerator.generateContentID(existingContentID); dataHandlerObjects.put(contentID, dataHandlerObject); return contentID; } protected String processDataHandler(DataHandler dataHandler, String existingContentID, boolean optimize) throws IOException { if (optimizationPolicy.isOptimized(dataHandler, optimize)) { return addDataHandler(dataHandler, existingContentID); } else { return null; } } protected String processDataHandler(DataHandlerProvider dataHandlerProvider, String existingContentID, boolean optimize) throws IOException { if (optimizationPolicy.isOptimized(dataHandlerProvider, optimize)) { return addDataHandler(dataHandlerProvider, existingContentID); } else { return null; } } /** * Get the set of content IDs referenced in xop:Include element information items * produced by this wrapper. * * @return The set of content IDs in their order of appearance in the infoset. If no * xop:Include element information items have been produced yet, an empty * set will be returned. */ public Set/**/ getContentIDs() { return Collections.unmodifiableSet(dataHandlerObjects.keySet()); } public boolean isLoaded(String contentID) { Object dataHandlerObject = dataHandlerObjects.get(contentID); if (dataHandlerObject == null) { throw new IllegalArgumentException("No DataHandler object found for content ID '" + contentID + "'"); } else if (dataHandlerObject instanceof DataHandler) { return true; } else { return ((DataHandlerProvider)dataHandlerObject).isLoaded(); } } public DataHandler getDataHandler(String contentID) throws IOException { Object dataHandlerObject = dataHandlerObjects.get(contentID); if (dataHandlerObject == null) { throw new IllegalArgumentException("No DataHandler object found for content ID '" + contentID + "'"); } else if (dataHandlerObject instanceof DataHandler) { return (DataHandler)dataHandlerObject; } else { return ((DataHandlerProvider)dataHandlerObject).getDataHandler(); } } } ./src/org/apache/axiom/util/stax/xop/XOPDecodingStreamReader.java0000664000175000017500000004102711767656530024134 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.util.base64.Base64Utils; import org.apache.axiom.util.stax.XMLEventUtils; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * {@link XMLStreamReader} wrapper that decodes XOP. It uses the extension defined by * {@link DataHandlerReader} to expose the {@link DataHandler} objects referenced by * xop:Include elements encountered in the underlying stream. If the consumer uses * {@link #getText()}, {@link #getTextCharacters()}, * {@link #getTextCharacters(int, char[], int, int)} or {@link #getElementText()} when an * xop:Include element is present in the underlying stream, then the decoder will produce * a base64 representation of the data. *

        * Note that this class only implements infoset transformation, but doesn't handle MIME processing. * A {@link MimePartProvider} implementation must be provided to the constructor of this class. This * object will be used to load MIME parts referenced by xop:Include elements encountered * in the underlying stream. *

        * This class supports deferred loading of MIME parts: If the consumer uses * {@link DataHandlerReader#getDataHandlerProvider()}, then the {@link MimePartProvider} will only * be invoked when {@link DataHandlerProvider#getDataHandler()} is called. */ public class XOPDecodingStreamReader extends XMLStreamReaderWrapper implements DataHandlerReader { private static final String SOLE_CHILD_MSG = "Expected xop:Include as the sole child of an element information item (see section " + "3.2 of http://www.w3.org/TR/xop10/)"; private static class DataHandlerProviderImpl implements DataHandlerProvider { private final MimePartProvider mimePartProvider; private final String contentID; public DataHandlerProviderImpl(MimePartProvider mimePartProvider, String contentID) { this.mimePartProvider = mimePartProvider; this.contentID = contentID; } public String getContentID() { return contentID; } public boolean isLoaded() { return mimePartProvider.isLoaded(contentID); } public DataHandler getDataHandler() throws IOException { return mimePartProvider.getDataHandler(contentID); } } private static final Log log = LogFactory.getLog(XOPDecodingStreamReader.class); private final MimePartProvider mimePartProvider; private DataHandlerProviderImpl dh; private String base64; /** * Constructor. * * @param parent * the XML stream to decode * @param mimePartProvider * An implementation of the {@link MimePartProvider} interface that will be used to * load the {@link DataHandler} objects for MIME parts referenced by * xop:Include element information items encountered in the underlying * stream. */ public XOPDecodingStreamReader(XMLStreamReader parent, MimePartProvider mimePartProvider) { super(parent); this.mimePartProvider = mimePartProvider; } private void resetDataHandler() { dh = null; base64 = null; } /** * Process an xop:Include event and return the content ID. *

        * Precondition: The parent reader is on the START_ELEMENT event for the xop:Include * element. Note that the method doesn't check this condition. *

        * Postcondition: The parent reader is on the event following the END_ELEMENT event for the * xop:Include element, i.e. the parent reader is on the END_ELEMENT event of the * element enclosing the xop:Include element. * * @return the content ID the xop:Include refers to * * @throws XMLStreamException */ private String processXopInclude() throws XMLStreamException { if (super.getAttributeCount() != 1 || !super.getAttributeLocalName(0).equals(XOPConstants.HREF)) { throw new XMLStreamException("Expected xop:Include element information item with " + "a (single) href attribute"); } String href = super.getAttributeValue(0); if(log.isDebugEnabled()){ log.debug("processXopInclude - found href : " + href); } if (!href.startsWith("cid:")) { throw new XMLStreamException("Expected href attribute containing a URL in the " + "cid scheme"); } String contentID; try { // URIs should always be decoded using UTF-8. On the other hand, since non ASCII // characters are not allowed in content IDs, we can simply decode using ASCII // (which is a subset of UTF-8) contentID = URLDecoder.decode(href.substring(4), "ascii"); if(log.isDebugEnabled()){ log.debug("processXopInclude - decoded contentID : " + contentID); } } catch (UnsupportedEncodingException ex) { // We should never get here throw new XMLStreamException(ex); } if (super.next() != END_ELEMENT) { throw new XMLStreamException( "Expected xop:Include element information item to be empty"); } // Also consume the END_ELEMENT event of the xop:Include element. There are // two reasons for this: // - It allows us to validate that the message conforms to the XOP specs. // - It makes it easier to implement the getNamespaceContext method. if (super.next() != END_ELEMENT) { throw new XMLStreamException(SOLE_CHILD_MSG); } if (log.isDebugEnabled()) { log.debug("Encountered xop:Include for content ID '" + contentID + "'"); } return contentID; } public int next() throws XMLStreamException { boolean wasStartElement; int event; if (dh != null) { resetDataHandler(); // We already advanced to the next event after the xop:Include (see below), so there // is no call to parent.next() here event = END_ELEMENT; wasStartElement = false; } else { wasStartElement = super.getEventType() == START_ELEMENT; event = super.next(); } if (event == START_ELEMENT && super.getLocalName().equals(XOPConstants.INCLUDE) && super.getNamespaceURI().equals(XOPConstants.NAMESPACE_URI)) { if (!wasStartElement) { throw new XMLStreamException(SOLE_CHILD_MSG); } dh = new DataHandlerProviderImpl(mimePartProvider, processXopInclude()); return CHARACTERS; } else { return event; } } public int getEventType() { return dh == null ? super.getEventType() : CHARACTERS; } public int nextTag() throws XMLStreamException { if (dh != null) { resetDataHandler(); // We already advanced to the next event after the xop:Include (see the implementation // of the next() method) and we now that it is an END_ELEMENT event. return END_ELEMENT; } else { return super.nextTag(); } } public Object getProperty(String name) throws IllegalArgumentException { if (DataHandlerReader.PROPERTY.equals(name)) { return this; } else { return super.getProperty(name); } } public String getElementText() throws XMLStreamException { if (super.getEventType() != START_ELEMENT) { throw new XMLStreamException("The current event is not a START_ELEMENT event"); } int event = super.next(); // Note that an xop:Include must be the first child of the element if (event == START_ELEMENT && super.getLocalName().equals(XOPConstants.INCLUDE) && super.getNamespaceURI().equals(XOPConstants.NAMESPACE_URI)) { String contentID = processXopInclude(); try { return toBase64(mimePartProvider.getDataHandler(contentID)); } catch (IOException ex) { throw new XMLStreamException("Failed to load MIME part '" + contentID + "'", ex); } } else { String text = null; StringBuffer buffer = null; while (event != END_ELEMENT) { switch (event) { case CHARACTERS: case CDATA: case SPACE: case ENTITY_REFERENCE: if (text == null && buffer == null) { text = super.getText(); } else { String thisText = super.getText(); if (buffer == null) { buffer = new StringBuffer(text.length() + thisText.length()); buffer.append(text); } buffer.append(thisText); } break; case PROCESSING_INSTRUCTION: case COMMENT: // Skip this event break; default: throw new XMLStreamException("Unexpected event " + XMLEventUtils.getEventTypeString(event) + " while reading element text"); } event = super.next(); } if (buffer != null) { return buffer.toString(); } else if (text != null) { return text; } else { return ""; } } } public String getPrefix() { if (dh != null) { throw new IllegalStateException(); } else { return super.getPrefix(); } } public String getNamespaceURI() { if (dh != null) { throw new IllegalStateException(); } else { return super.getNamespaceURI(); } } public String getLocalName() { if (dh != null) { throw new IllegalStateException(); } else { return super.getLocalName(); } } public QName getName() { if (dh != null) { throw new IllegalStateException(); } else { return super.getName(); } } public Location getLocation() { return super.getLocation(); } public String getNamespaceURI(String prefix) { String uri = super.getNamespaceURI(prefix); if ("xop".equals(prefix) && uri != null) { System.out.println(prefix + " -> " + uri); } return uri; } public int getNamespaceCount() { if (dh != null) { throw new IllegalStateException(); } else { return super.getNamespaceCount(); } } public String getNamespacePrefix(int index) { if (dh != null) { throw new IllegalStateException(); } else { return super.getNamespacePrefix(index); } } public String getNamespaceURI(int index) { if (dh != null) { throw new IllegalStateException(); } else { return super.getNamespaceURI(index); } } private static String toBase64(DataHandler dh) throws XMLStreamException { try { return Base64Utils.encode(dh); } catch (IOException ex) { throw new XMLStreamException("Exception when encoding data handler as base64", ex); } } private String toBase64() throws XMLStreamException { if (base64 == null) { try { base64 = toBase64(dh.getDataHandler()); } catch (IOException ex) { throw new XMLStreamException("Failed to load MIME part '" + dh.getContentID() + "'", ex); } } return base64; } public String getText() { if (dh != null) { try { return toBase64(); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } else { return super.getText(); } } public char[] getTextCharacters() { if (dh != null) { try { return toBase64().toCharArray(); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } else { return super.getTextCharacters(); } } public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { if (dh != null) { String text = toBase64(); int copied = Math.min(length, text.length()-sourceStart); text.getChars(sourceStart, sourceStart + copied, target, targetStart); return copied; } else { return super.getTextCharacters(sourceStart, target, targetStart, length); } } public int getTextLength() { if (dh != null) { try { return toBase64().length(); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } else { return super.getTextLength(); } } public int getTextStart() { if (dh != null) { return 0; } else { return super.getTextStart(); } } public boolean hasText() { return dh != null || super.hasText(); } public boolean isCharacters() { return dh != null || super.isCharacters(); } public boolean isStartElement() { return dh == null && super.isStartElement(); } public boolean isEndElement() { return dh == null && super.isEndElement(); } public boolean hasName() { return dh == null && super.hasName(); } public boolean isWhiteSpace() { return dh == null && super.isWhiteSpace(); } public void require(int type, String namespaceURI, String localName) throws XMLStreamException { if (dh != null) { if (type != CHARACTERS) { throw new XMLStreamException("Expected CHARACTERS event"); } } else { super.require(type, namespaceURI, localName); } } public boolean isBinary() { return dh != null; } public boolean isOptimized() { // xop:Include implies optimized return true; } public boolean isDeferred() { return true; } public String getContentID() { return dh.getContentID(); } public DataHandler getDataHandler() throws XMLStreamException{ try { return dh.getDataHandler(); } catch (IOException ex) { throw new XMLStreamException("Failed to load MIME part '" + dh.getContentID() + "'"); } } public DataHandlerProvider getDataHandlerProvider() { return dh; } XOPEncodedStream getXOPEncodedStream() { return new XOPEncodedStream(getParent(), mimePartProvider); } } ./src/org/apache/axiom/util/stax/xop/XOPConstants.java0000664000175000017500000000242111767656530022070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import javax.xml.namespace.QName; /** * Interface defining constants used by {@link XOPDecodingStreamReader} and * {@link XOPEncodingStreamReader}. *

        * For internal use only. */ interface XOPConstants { String INCLUDE = "Include"; String NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include"; String DEFAULT_PREFIX = "xop"; QName INCLUDE_QNAME = new QName(NAMESPACE_URI, INCLUDE, DEFAULT_PREFIX); String HREF = "href"; } ./src/org/apache/axiom/util/stax/xop/XOPEncodedStream.java0000664000175000017500000000405111767656530022632 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import javax.xml.stream.XMLStreamReader; /** * Represents an XOP encoded stream. Since an XOP message is a MIME package with * an main part in XML and a set of additional (binary) parts referenced from * the main part, this class encapsulates an {@link XMLStreamReader} * representing the main part and a {@link MimePartProvider} giving access to * the attachments. Instances of this class can be obtained from * {@link XOPUtils#getXOPEncodedStream(XMLStreamReader)}. */ public class XOPEncodedStream { private final XMLStreamReader reader; private final MimePartProvider mimePartProvider; XOPEncodedStream(XMLStreamReader reader, MimePartProvider mimePartProvider) { this.reader = reader; this.mimePartProvider = mimePartProvider; } /** * Get the stream reader for the main part of the XOP message. * * @return the stream reader for the main part */ public XMLStreamReader getReader() { return reader; } /** * Get the provider object for the additional MIME parts referenced by the * main part. * * @return the MIME part provider */ public MimePartProvider getMimePartProvider() { return mimePartProvider; } } ./src/org/apache/axiom/util/stax/xop/MimePartProvider.java0000664000175000017500000000465011767656530022764 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import javax.activation.DataHandler; /** * Interface used by {@link XOPDecodingStreamReader} to load MIME parts referenced by * xop:Include elements. */ public interface MimePartProvider { /** * Check whether the MIME part identified by a given content ID has already been loaded. A * return value of true means that a call to {@link #getDataHandler(String)} (for * the same content ID) will not block or will retrieve the {@link DataHandler} without * overhead. * * @return true if the MIME part has already been loaded; false * otherwise * @throws IllegalArgumentException * Thrown if the MIME part specified by the content ID doesn't exist. Note that the * implementation may be unable to determine this without loading all the MIME * parts. In this case, it should return false. */ boolean isLoaded(String contentID); /** * Get the {@link DataHandler} for the MIME part identified by a given content ID. * * @param contentID * a content ID referenced in an xop:Include element * @return the {@link DataHandler} for the MIME part identified by the content ID; may not be * null * @throws IllegalArgumentException * if the MIME part was not found * @throws IOException * if an error occurred while loading the part */ DataHandler getDataHandler(String contentID) throws IOException; } ./src/org/apache/axiom/util/stax/xop/ContentIDGenerator.java0000664000175000017500000000412211767656530023223 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import org.apache.axiom.util.UIDGenerator; /** * Content ID generator interface. Implementations of this interface are used by * {@link XOPEncodingStreamReader} to generate content IDs for use in xop:Include * elements. */ public interface ContentIDGenerator { /** * Default content ID generator that preserves any existing content ID. */ ContentIDGenerator DEFAULT = new ContentIDGenerator() { public String generateContentID(String existingContentID) { if (existingContentID == null) { return UIDGenerator.generateContentId(); } else { return existingContentID; } } }; /** * Generate a content ID. * * @param existingContentID * An existing content ID for the {@link javax.activation.DataHandler} being * processed, as returned by * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader#getContentID()}, * or null if no existing content ID is known. The implementation is * free to use this information or not. * @return the content ID; may not be null */ String generateContentID(String existingContentID); } ./src/org/apache/axiom/util/stax/xop/OptimizationPolicy.java0000664000175000017500000000766311767656530023410 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import javax.activation.DataHandler; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; /** * Encapsulates an algorithm that decides whether base64 encoded binary data should be optimized * using XOP. The implementation takes the decision based on the submitted binary content and the * "eligible for optimization" flag. Depending on the context of use, this flag is provided by the * return value of {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader#isOptimized()} or * the optimize argument of * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerWriter#writeDataHandler(DataHandler, String, boolean)} * or * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerWriter#writeDataHandler(DataHandlerProvider, String, boolean)}. */ public interface OptimizationPolicy { /** * Policy implementation that optimizes all binary content marked as eligible for optimization. */ OptimizationPolicy DEFAULT = new OptimizationPolicy() { public boolean isOptimized(DataHandler dataHandler, boolean optimize) { return optimize; } public boolean isOptimized(DataHandlerProvider dataHandlerProvider, boolean optimize) { return optimize; } }; /** * Policy implementation that optimizes all binary content, regardless of whether is has been * marked as eligible for optimization. */ OptimizationPolicy ALL = new OptimizationPolicy() { public boolean isOptimized(DataHandler dataHandler, boolean optimize) { return true; } public boolean isOptimized(DataHandlerProvider dataHandlerProvider, boolean optimize) { return true; } }; /** * Determine whether the binary content supplied by a given {@link DataHandler} should be * optimized. * * @param dataHandler * the binary content * @param optimize * indicates whether the binary content was initially marked as eligible for * optimization (see above) * @return true if the binary content should be optimized using XOP, i.e. encoded * using xop:Include * @throws IOException * if an error occurs while reading the data handler */ boolean isOptimized(DataHandler dataHandler, boolean optimize) throws IOException; /** * Determine whether the binary content supplied by a given {@link DataHandlerProvider} should * be optimized. * * @param dataHandlerProvider * the binary content * @param optimize * indicates whether the binary content was initially marked as eligible for * optimization (see above) * @return true if the binary content should be optimized using XOP, i.e. encoded * using xop:Include * @throws IOException * if an error occurs while reading the data handler */ boolean isOptimized(DataHandlerProvider dataHandlerProvider, boolean optimize) throws IOException; } ./src/org/apache/axiom/util/stax/xop/XOPUtils.java0000664000175000017500000001403311767656530021216 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.util.stax.XMLStreamReaderUtils; /** * Contains utility methods related to XOP. */ public class XOPUtils { private static final MimePartProvider nullMimePartProvider = new MimePartProvider() { public boolean isLoaded(String contentID) { throw new IllegalArgumentException("There are no MIME parts!"); } public DataHandler getDataHandler(String contentID) throws IOException { throw new IllegalArgumentException("There are no MIME parts!"); } }; private XOPUtils() {} /** * Extract the content ID from a URL following the cid scheme defined by RFC2392. * * @param url the URL * @return the corresponding content ID * @throws IllegalArgumentException if the URL doesn't use the cid scheme */ public static String getContentIDFromURL(String url) { if (url.startsWith("cid:")) { try { // URIs should always be decoded using UTF-8 (see WSCOMMONS-429). On the // other hand, since non ASCII characters are not allowed in content IDs, // we can simply decode using ASCII (which is a subset of UTF-8) return URLDecoder.decode(url.substring(4), "ascii"); } catch (UnsupportedEncodingException ex) { // We should never get here throw new Error(ex); } } else { throw new IllegalArgumentException("The URL doesn't use the cid scheme"); } } /** * Build a cid URL from the given content ID as described in RFC2392. *

        * Note that this implementation only encodes the percent character (replacing it by "%25"). The * reason is given by the following quotes from RFC3986: *

        * If a reserved character is * found in a URI component and no delimiting role is known for that character, then it must be * interpreted as representing the data octet corresponding to that character's encoding in * US-ASCII. [...] *

        * Under normal circumstances, the only time when octets within a URI are percent-encoded is * during the process of producing the URI from its component parts. This is when an * implementation determines which of the reserved characters are to be used as subcomponent * delimiters and which can be safely used as data. [...] *

        * Because the percent ("%") character serves as the indicator for percent-encoded octets, it * must be percent-encoded as "%25" for that octet to be used as data within a URI. *

        *

        * Since RFC2392 doesn't define any subcomponents for the cid scheme and since RFC2045 specifies * that only US-ASCII characters are allowed in content IDs, the percent character (which is * specifically allowed by RFC2045) is the only character that needs URL encoding. *

        * Another reason to strictly limit the set of characters to be encoded is that some * applications fail to decode cid URLs correctly if they contain percent encoded octets. * * @param contentID the content ID (without enclosing angle brackets) * @return the corresponding URL in the cid scheme */ public static String getURLForContentID(String contentID) { return "cid:" + contentID.replaceAll("%", "%25"); } /** * Get an XOP encoded stream for a given stream reader. Depending on its * type and characteristics, this method may wrap or unwrap the stream * reader: *

          *
        1. If the original reader is an {@link XOPEncodingStreamReader} it will * be preserved, since it is already XOP encoded. *
        2. If the original reader is an {@link XOPDecodingStreamReader}, it will * be unwrapped to give access to the underlying XOP encoded reader. *
        3. If the original reader is a plain XML stream reader implementing the * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} * extension, it will be wrapped in an {@link XOPEncodingStreamReader} so * that optimized binary data can be transferred using XOP. *
        4. In all other cases, the original reader is simply preserved. *
        * * @param reader * the original reader * @return the XOP encoded stream */ public static XOPEncodedStream getXOPEncodedStream(XMLStreamReader reader) { if (reader instanceof XOPEncodingStreamReader) { return new XOPEncodedStream(reader, (MimePartProvider)reader); } else if (reader instanceof XOPDecodingStreamReader) { return ((XOPDecodingStreamReader)reader).getXOPEncodedStream(); } else if (XMLStreamReaderUtils.getDataHandlerReader(reader) != null) { XOPEncodingStreamReader wrapper = new XOPEncodingStreamReader(reader, ContentIDGenerator.DEFAULT, OptimizationPolicy.ALL); return new XOPEncodedStream(wrapper, wrapper); } else { return new XOPEncodedStream(reader, nullMimePartProvider); } } } ./src/org/apache/axiom/util/stax/xop/package.html0000664000175000017500000000160711767656530021150 0ustar brianbrian Contains classes to encode and decode XOP infosets. ./src/org/apache/axiom/util/stax/xop/XOPEncodingStreamReader.java0000664000175000017500000004532511767656530024153 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.xop; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; /** * {@link XMLStreamReader} wrapper that encodes XOP. It assumes that the underlying reader * implements the extension defined by {@link DataHandlerReader} so that it can identify the * information items to optimize (by looking for * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} events for which * {@link DataHandlerReader#isBinary()} returns true). The {@link DataHandler} * objects for the parts referenced by xop:Include element information items produced by * an instance of this class can be retrieved using the {@link #getDataHandler(String)} method. *

        * Note that the primary purpose of this class is not to serialize an XML infoset to an XOP package * (this is better done using {@link XOPEncodingStreamWriter}), but rather to optimize interaction * (by exchanging {@link DataHandler} objects instead of base64 encoded representations) with * databinding frameworks that understand XOP, but that are not aware of the * {@link DataHandlerReader} extension. *

        * This class defers loading of {@link DataHandler} objects until {@link #getDataHandler(String)} is * called, except if this is not supported by the underlying stream. */ public class XOPEncodingStreamReader extends XOPEncodingStreamWrapper implements XMLStreamReader { /** * Wrapper that adds the XOP namespace to another namespace context. */ private static class NamespaceContextWrapper implements NamespaceContext { private static final List xopPrefixList = Arrays.asList(new String[] { XOPConstants.DEFAULT_PREFIX }); private final NamespaceContext parent; public NamespaceContextWrapper(NamespaceContext parent) { this.parent = parent; } public String getNamespaceURI(String prefix) { return XOPConstants.DEFAULT_PREFIX.equals(prefix) ? XOPConstants.NAMESPACE_URI : parent.getNamespaceURI(prefix); } public String getPrefix(String namespaceURI) { return XOPConstants.NAMESPACE_URI.equals(namespaceURI) ? XOPConstants.DEFAULT_PREFIX : parent.getPrefix(namespaceURI); } public Iterator getPrefixes(String namespaceURI) { Iterator prefixes = parent.getPrefixes(namespaceURI); if (XOPConstants.NAMESPACE_URI.equals(namespaceURI)) { if (!prefixes.hasNext()) { return xopPrefixList.iterator(); } else { // This case is very unusual List prefixList = new ArrayList(); do { prefixList.add(prefixes.next()); } while (prefixes.hasNext()); prefixList.add(XOPConstants.DEFAULT_PREFIX); return prefixList.iterator(); } } else { return prefixes; } } } private static final int STATE_PASS_THROUGH = 0; private static final int STATE_XOP_INCLUDE_START_ELEMENT = 1; private static final int STATE_XOP_INCLUDE_END_ELEMENT = 2; private final XMLStreamReader parent; private final DataHandlerReader dataHandlerReader; private int state = STATE_PASS_THROUGH; private String currentContentID; /** * Constructor. * * @param parent * The XML stream to encode. The reader must implement the extension defined by * {@link DataHandlerReader}. * @param contentIDGenerator * used to generate content IDs for the binary content exposed as * xop:Include element information items * @param optimizationPolicy * the policy to apply to decide which binary content to optimize * * @throws IllegalArgumentException * if the provided {@link XMLStreamReader} doesn't implement the extension defined * by {@link DataHandlerReader} */ public XOPEncodingStreamReader(XMLStreamReader parent, ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy) { super(contentIDGenerator, optimizationPolicy); this.parent = parent; DataHandlerReader dataHandlerReader; try { dataHandlerReader = (DataHandlerReader)parent.getProperty(DataHandlerReader.PROPERTY); } catch (IllegalArgumentException ex) { dataHandlerReader = null; } if (dataHandlerReader == null) { throw new IllegalArgumentException("The supplied XMLStreamReader doesn't implement the DataHandlerReader extension"); } this.dataHandlerReader = dataHandlerReader; } public int next() throws XMLStreamException { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: state = STATE_XOP_INCLUDE_END_ELEMENT; return END_ELEMENT; case STATE_XOP_INCLUDE_END_ELEMENT: state = STATE_PASS_THROUGH; currentContentID = null; // Fall through default: int event = parent.next(); if (event == CHARACTERS && dataHandlerReader.isBinary()) { String contentID; try { if (dataHandlerReader.isDeferred()) { contentID = processDataHandler( dataHandlerReader.getDataHandlerProvider(), dataHandlerReader.getContentID(), dataHandlerReader.isOptimized()); } else { contentID = processDataHandler( dataHandlerReader.getDataHandler(), dataHandlerReader.getContentID(), dataHandlerReader.isOptimized()); } } catch (IOException ex) { throw new XMLStreamException("Error while processing data handler", ex); } if (contentID != null) { currentContentID = contentID; state = STATE_XOP_INCLUDE_START_ELEMENT; return START_ELEMENT; } else { return CHARACTERS; } } else { return event; } } } public boolean hasNext() throws XMLStreamException { return state == STATE_PASS_THROUGH ? parent.hasNext() : true; } public int nextTag() throws XMLStreamException { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: state = STATE_XOP_INCLUDE_END_ELEMENT; return END_ELEMENT; case STATE_XOP_INCLUDE_END_ELEMENT: currentContentID = null; // Fall through default: return parent.nextTag(); } } public void require(int type, String namespaceURI, String localName) throws XMLStreamException { if (state == STATE_PASS_THROUGH) { parent.require(type, namespaceURI, localName); } else { if (state == STATE_XOP_INCLUDE_START_ELEMENT && type != START_ELEMENT || state == STATE_XOP_INCLUDE_END_ELEMENT && type != END_ELEMENT || namespaceURI != null && !namespaceURI.equals(XOPConstants.NAMESPACE_URI) || localName != null && !localName.equals(XOPConstants.INCLUDE)) { throw new XMLStreamException(); } } } public Location getLocation() { return parent.getLocation(); } public void close() throws XMLStreamException { parent.close(); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } public String getEncoding() { return parent.getEncoding(); } public String getCharacterEncodingScheme() { return parent.getCharacterEncodingScheme(); } public String getVersion() { return parent.getVersion(); } public boolean isStandalone() { return parent.isStandalone(); } public boolean standaloneSet() { return parent.standaloneSet(); } public String getPIData() { return parent.getPIData(); } public String getPITarget() { return parent.getPITarget(); } public int getAttributeCount() { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: return 1; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeCount(); } } public String getAttributeLocalName(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return XOPConstants.HREF; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeLocalName(index); } } public QName getAttributeName(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return new QName(XOPConstants.HREF); case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeName(index); } } public String getAttributeNamespace(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return null; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeNamespace(index); } } public String getAttributePrefix(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return null; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributePrefix(index); } } public String getAttributeType(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return "CDATA"; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeType(index); } } public String getAttributeValue(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } // We don't use full URL encoding here, because this might cause // interoperability issues. The specs (RFC 2111 and 2392) are not very clear // on which characters should be URL encoded, but one can consider that '%' // is the only really unsafe character. return "cid:" + currentContentID.replaceAll("%", "%25"); case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeValue(index); } } public boolean isAttributeSpecified(int index) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if (index != 0) { throw new IllegalArgumentException(); } return true; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.isAttributeSpecified(index); } } public String getAttributeValue(String namespaceURI, String localName) { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: if ((namespaceURI == null || namespaceURI.length() == 0) && localName.equals(XOPConstants.HREF)) { return "cid:" + currentContentID; } else { return null; } case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getAttributeValue(namespaceURI, localName); } } public String getElementText() throws XMLStreamException { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: state = STATE_XOP_INCLUDE_END_ELEMENT; return ""; case STATE_XOP_INCLUDE_END_ELEMENT: throw new IllegalStateException(); default: return parent.getElementText(); } } public int getEventType() { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: return START_ELEMENT; case STATE_XOP_INCLUDE_END_ELEMENT: return END_ELEMENT; default: return parent.getEventType(); } } public String getNamespaceURI() { return state == STATE_PASS_THROUGH ? parent.getNamespaceURI() : XOPConstants.NAMESPACE_URI; } public String getLocalName() { return state == STATE_PASS_THROUGH ? parent.getLocalName() : XOPConstants.INCLUDE; } public String getPrefix() { return state == STATE_PASS_THROUGH ? parent.getPrefix() : XOPConstants.DEFAULT_PREFIX; } public QName getName() { return state == STATE_PASS_THROUGH ? parent.getName() : XOPConstants.INCLUDE_QNAME; } public NamespaceContext getNamespaceContext() { NamespaceContext ctx = parent.getNamespaceContext(); if (state != STATE_PASS_THROUGH) { ctx = new NamespaceContextWrapper(ctx); } return ctx; } public String getNamespaceURI(String prefix) { if (state != STATE_PASS_THROUGH && XOPConstants.DEFAULT_PREFIX.equals(prefix)) { return XOPConstants.NAMESPACE_URI; } else { return parent.getNamespaceURI(prefix); } } public int getNamespaceCount() { return state == STATE_PASS_THROUGH ? parent.getNamespaceCount() : 1; } public String getNamespacePrefix(int index) { if (state == STATE_PASS_THROUGH) { return parent.getNamespacePrefix(index); } else if (index != 0) { throw new IllegalArgumentException(); } else { return XOPConstants.DEFAULT_PREFIX; } } public String getNamespaceURI(int index) { if (state == STATE_PASS_THROUGH) { return parent.getNamespaceURI(index); } else if (index != 0) { throw new IllegalArgumentException(); } else { return XOPConstants.NAMESPACE_URI; } } public String getText() { if (state == STATE_PASS_THROUGH) { return parent.getText(); } else { throw new IllegalStateException(); } } public int getTextStart() { if (state == STATE_PASS_THROUGH) { return parent.getTextStart(); } else { throw new IllegalStateException(); } } public int getTextLength() { if (state == STATE_PASS_THROUGH) { return parent.getTextLength(); } else { throw new IllegalStateException(); } } public char[] getTextCharacters() { if (state == STATE_PASS_THROUGH) { return parent.getTextCharacters(); } else { throw new IllegalStateException(); } } public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { if (state == STATE_PASS_THROUGH) { return parent.getTextCharacters(sourceStart, target, targetStart, length); } else { throw new IllegalStateException(); } } public boolean hasName() { return state == STATE_PASS_THROUGH ? parent.hasName() : true; } public boolean hasText() { return state == STATE_PASS_THROUGH ? parent.hasText() : false; } public boolean isCharacters() { return state == STATE_PASS_THROUGH ? parent.isCharacters() : false; } public boolean isWhiteSpace() { return state == STATE_PASS_THROUGH ? parent.isWhiteSpace() : false; } public boolean isStartElement() { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: return true; case STATE_XOP_INCLUDE_END_ELEMENT: return false; default: return parent.isStartElement(); } } public boolean isEndElement() { switch (state) { case STATE_XOP_INCLUDE_START_ELEMENT: return false; case STATE_XOP_INCLUDE_END_ELEMENT: return true; default: return parent.isEndElement(); } } } ./src/org/apache/axiom/util/stax/AbstractXMLStreamReader.java0000664000175000017500000001163511767656530023351 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * Partial implementation of the {@link XMLStreamReader} interface. * This class implements methods that can be easily expressed in terms of other * (abstract) methods or for which it makes sense to provide a default * implementation. */ public abstract class AbstractXMLStreamReader implements XMLStreamReader { /** * @return Returns boolean. * @see javax.xml.stream.XMLStreamReader#hasText() */ public boolean hasText() { int event = getEventType(); return ((event == CHARACTERS) || (event == DTD) || (event == CDATA) || (event == ENTITY_REFERENCE) || (event == COMMENT) || (event == SPACE)); } /** * Returns the next tag. * * @return Returns int. * @throws org.apache.axiom.om.impl.exception.OMStreamingException * * @throws XMLStreamException */ public int nextTag() throws XMLStreamException { int eventType = next(); while ((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException("expected start or end tag", getLocation()); } return eventType; } public boolean isStartElement() { return getEventType() == START_ELEMENT; } public boolean isEndElement() { return getEventType() == END_ELEMENT; } public boolean isCharacters() { return getEventType() == CHARACTERS; } public boolean hasName() { int event = getEventType(); return event == START_ELEMENT || event == END_ELEMENT; } public void require(int type, String uri, String localName) throws XMLStreamException { int actualType = getEventType(); if (type != actualType) { throw new XMLStreamException("Required type " + XMLEventUtils.getEventTypeString(type) + ", actual type " + XMLEventUtils.getEventTypeString(actualType)); } if (localName != null) { if (actualType != START_ELEMENT && actualType != END_ELEMENT && actualType != ENTITY_REFERENCE) { throw new XMLStreamException("Required a non-null local name, but current token " + "not a START_ELEMENT, END_ELEMENT or ENTITY_REFERENCE (was " + XMLEventUtils.getEventTypeString(actualType) + ")"); } String actualLocalName = getLocalName(); if (actualLocalName != localName && !actualLocalName.equals(localName)) { throw new XMLStreamException("Required local name '" + localName + "'; current local name '" + actualLocalName + "'."); } } if (uri != null) { if (actualType != START_ELEMENT && actualType != END_ELEMENT) { throw new XMLStreamException("Required non-null namespace URI, but current token " + "not a START_ELEMENT or END_ELEMENT (was " + XMLEventUtils.getEventTypeString(actualType) + ")"); } String actualUri = getNamespaceURI(); if (uri.length() == 0) { if (actualUri != null && actualUri.length() > 0) { throw new XMLStreamException("Required empty namespace, instead have '" + actualUri + "'."); } } else { if (!uri.equals(actualUri)) { throw new XMLStreamException("Required namespace '" + uri + "'; have '" + actualUri +"'."); } } } } } ./src/org/apache/axiom/util/stax/package.html0000664000175000017500000000162111767656530020336 0ustar brianbrian Contains StAX utility classes not depending on the Axiom API. ./src/org/apache/axiom/util/stax/dialect/0000775000175000017500000000000011767656530017462 5ustar brianbrian./src/org/apache/axiom/util/stax/dialect/WoodstoxDialect.java0000664000175000017500000000457511767656530023454 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; class WoodstoxDialect extends AbstractStAXDialect { public static final WoodstoxDialect INSTANCE = new WoodstoxDialect(); public String getName() { return "Woodstox"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { // For Woodstox, this is sufficient factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { return StAXDialectUtils.disallowDoctypeDecl(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { // Woodstox' factories are designed to be thread safe return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { // Woodstox' factories are designed to be thread safe return factory; } public XMLStreamReader normalize(XMLStreamReader reader) { return new WoodstoxStreamReaderWrapper(reader); } public XMLStreamWriter normalize(XMLStreamWriter writer) { return new WoodstoxStreamWriterWrapper(writer); } public XMLInputFactory normalize(XMLInputFactory factory) { return new NormalizingXMLInputFactoryWrapper(factory, this); } public XMLOutputFactory normalize(XMLOutputFactory factory) { return new WoodstoxOutputFactoryWrapper(factory, this); } } ./src/org/apache/axiom/util/stax/dialect/NamespaceContextCorrectingXMLStreamWriterWrapper.java0000664000175000017500000001537011767656530032107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.util.stax.AbstractXMLStreamWriter; /** * {@link XMLStreamWriter} wrapper that handles namespace bindings on behalf of the underlying * writer. This wrapper can be used to correct two issues found in some stream writer * implementations: *

          *
        1. The writer doesn't correctly scope the namespace bindings. According to the StAX * specifications, the scope of a namespace binding defined using * {@link XMLStreamWriter#setPrefix(String, String)} or * {@link XMLStreamWriter#setDefaultNamespace(String)} is limited to * "the current START_ELEMENT / END_ELEMENT pair". Some implementations * such as early versions of XL XP-J don't satisfy this requirement. *
        2. The writer doesn't handle masked prefixes correctly. To ensure consistent behavior * in the presence of masked prefixes, the {@link XMLStreamWriter#getPrefix(String)} method * (and the corresponding methods in the namespace context returned by * {@link XMLStreamWriter#getNamespaceContext()}) must not return a prefix that * is bound to a different namespace URI in a nested scope. Some implementations such as * the StAX reference implementation fail to meet this requirement. *
        *

        * Invocations of the following methods will be completely processed by the wrapper, and will never * reach the underlying writer: *

          *
        • {@link XMLStreamWriter#getNamespaceContext()} *
        • {@link XMLStreamWriter#setNamespaceContext(NamespaceContext)} *
        • {@link XMLStreamWriter#getPrefix(String)} *
        • {@link XMLStreamWriter#setDefaultNamespace(String)} *
        • {@link XMLStreamWriter#setPrefix(String, String)} *
        *

        * The following methods rely on information from the namespace context to choose a the namespace * prefix; the wrapper redirects invocations of these methods to the corresponding variants taking * an explicit prefix parameter: *

          *
        • {@link XMLStreamWriter#writeStartElement(String, String)} *
        • {@link XMLStreamWriter#writeAttribute(String, String, String)} *
        • {@link XMLStreamWriter#writeEmptyElement(String, String)} *
        *

        * This implies that if the wrapper is used, these methods will never be called on the underlying * writer. */ class NamespaceContextCorrectingXMLStreamWriterWrapper extends AbstractXMLStreamWriter { private final XMLStreamWriter parent; public NamespaceContextCorrectingXMLStreamWriterWrapper(XMLStreamWriter parent) { this.parent = parent; } protected void doWriteAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { parent.writeAttribute(prefix, namespaceURI, localName, value); } protected void doWriteAttribute(String localName, String value) throws XMLStreamException { parent.writeAttribute(localName, value); } protected void doWriteCData(String data) throws XMLStreamException { parent.writeCData(data); } protected void doWriteCharacters(char[] text, int start, int len) throws XMLStreamException { parent.writeCharacters(text, start, len); } protected void doWriteCharacters(String text) throws XMLStreamException { parent.writeCharacters(text); } protected void doWriteComment(String data) throws XMLStreamException { parent.writeComment(data); } protected void doWriteDefaultNamespace(String namespaceURI) throws XMLStreamException { parent.writeDefaultNamespace(namespaceURI); } protected void doWriteDTD(String dtd) throws XMLStreamException { parent.writeDTD(dtd); } protected void doWriteEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeEmptyElement(prefix, localName, namespaceURI); } protected void doWriteEmptyElement(String localName) throws XMLStreamException { parent.writeEmptyElement(localName); } protected void doWriteEndDocument() throws XMLStreamException { parent.writeEndDocument(); } protected void doWriteEndElement() throws XMLStreamException { parent.writeEndElement(); } protected void doWriteEntityRef(String name) throws XMLStreamException { parent.writeEntityRef(name); } protected void doWriteNamespace(String prefix, String namespaceURI) throws XMLStreamException { parent.writeNamespace(prefix, namespaceURI); } protected void doWriteProcessingInstruction(String target, String data) throws XMLStreamException { parent.writeProcessingInstruction(target, data); } protected void doWriteProcessingInstruction(String target) throws XMLStreamException { parent.writeProcessingInstruction(target); } protected void doWriteStartDocument() throws XMLStreamException { parent.writeStartDocument(); } protected void doWriteStartDocument(String encoding, String version) throws XMLStreamException { parent.writeStartDocument(encoding, version); } protected void doWriteStartDocument(String version) throws XMLStreamException { parent.writeStartDocument(version); } protected void doWriteStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { parent.writeStartElement(prefix, localName, namespaceURI); } protected void doWriteStartElement(String localName) throws XMLStreamException { parent.writeStartElement(localName); } public void close() throws XMLStreamException { parent.close(); } public void flush() throws XMLStreamException { parent.flush(); } public Object getProperty(String name) throws IllegalArgumentException { return parent.getProperty(name); } } ./src/org/apache/axiom/util/stax/dialect/StAXDialectDetector.java0000664000175000017500000003012011767656530024120 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.jar.Attributes; import java.util.jar.Manifest; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Detects StAX dialects and normalizes factories for a given StAX implementation. *

        * Note that this class internally maintains a cache of detected dialects. The overhead caused by * invocations of methods in this class is thus small. */ public class StAXDialectDetector { private static final Log log = LogFactory.getLog(StAXDialectDetector.class); private static final Attributes.Name IMPLEMENTATION_TITLE = new Attributes.Name("Implementation-Title"); private static final Attributes.Name IMPLEMENTATION_VENDOR = new Attributes.Name("Implementation-Vendor"); private static final Attributes.Name IMPLEMENTATION_VERSION = new Attributes.Name("Implementation-Version"); private static final Attributes.Name BUNDLE_SYMBOLIC_NAME = new Attributes.Name("Bundle-SymbolicName"); private static final Attributes.Name BUNDLE_VENDOR = new Attributes.Name("Bundle-Vendor"); private static final Attributes.Name BUNDLE_VERSION = new Attributes.Name("Bundle-Version"); /** * Map that stores detected dialects by location. The location is the URL corresponding to the * root folder of the classpath entry from which the StAX implementation is loaded. Note that * in the case of a JAR file, this is not the URL pointing to the JAR, but a jar: * URL that points to the root folder of the archive. */ private static final Map/**/ dialectByUrl = Collections.synchronizedMap(new HashMap()); private StAXDialectDetector() {} /** * Get the URL corresponding to the root folder of the classpath entry from which a given * resource is loaded. This URL can be used to load other resources from the same classpath * entry (JAR file or directory). * * @return the root URL or null if the resource can't be found or if it is not * possible to determine the root URL */ private static URL getRootUrlForResource(ClassLoader classLoader, String resource) { if (classLoader == null) { // A null class loader means the bootstrap class loader. In this case we use the // system class loader. This is safe since we can assume that the system class // loader uses parent first as delegation policy. classLoader = ClassLoader.getSystemClassLoader(); } URL url = classLoader.getResource(resource); if (url == null) { return null; } String file = url.getFile(); if (file.endsWith(resource)) { try { return new URL(url.getProtocol(), url.getHost(), url.getPort(), file.substring(0, file.length()-resource.length())); } catch (MalformedURLException ex) { return null; } } else { return null; } } private static URL getRootUrlForClass(Class cls) { return getRootUrlForResource(cls.getClassLoader(), cls.getName().replace('.', '/') + ".class"); } /** * Detect the dialect of a given {@link XMLInputFactory} and normalize it. * * @param factory the factory to normalize * @return the normalized factory * * @see StAXDialect#normalize(XMLInputFactory) */ public static XMLInputFactory normalize(XMLInputFactory factory) { return getDialect(factory.getClass()).normalize(factory); } /** * Detect the dialect of a given {@link XMLOutputFactory} and normalize it. * * @param factory the factory to normalize * @return the normalized factory * * @see StAXDialect#normalize(XMLOutputFactory) */ public static XMLOutputFactory normalize(XMLOutputFactory factory) { return getDialect(factory.getClass()).normalize(factory); } /** * Detect the dialect of a given StAX implementation. * * @param implementationClass * any class that is part of the StAX implementation; typically this should be a * {@link XMLInputFactory}, {@link XMLOutputFactory}, * {@link javax.xml.stream.XMLStreamReader} or * {@link javax.xml.stream.XMLStreamWriter} implementation * @return the detected dialect */ public static StAXDialect getDialect(Class implementationClass) { URL rootUrl = getRootUrlForClass(implementationClass); if (rootUrl == null) { log.warn("Unable to determine location of StAX implementation containing class " + implementationClass.getName() + "; using default dialect"); return UnknownStAXDialect.INSTANCE; } return getDialect(implementationClass.getClassLoader(), rootUrl); } private static StAXDialect getDialect(ClassLoader classLoader, URL rootUrl) { StAXDialect dialect = (StAXDialect)dialectByUrl.get(rootUrl); if (dialect != null) { return dialect; } else { dialect = detectDialect(classLoader, rootUrl); dialectByUrl.put(rootUrl, dialect); return dialect; } } private static StAXDialect detectDialect(ClassLoader classLoader, URL rootUrl) { StAXDialect dialect = detectDialectFromJarManifest(rootUrl); if (dialect == null) { // Note: We look for well defined classes instead of just checking the package name // of the class passed to getDialect(Class) because in some parsers, the implementations // of the StAX interfaces (factories, readers and writers) are not in the same package. dialect = detectDialectFromClasses(classLoader, rootUrl); } if (dialect == null) { log.warn("Unable to determine dialect of the StAX implementation at " + rootUrl); return UnknownStAXDialect.INSTANCE; } else { if (log.isDebugEnabled()) { log.debug("Detected StAX dialect: " + dialect.getName()); } return dialect; } } private static StAXDialect detectDialectFromJarManifest(URL rootUrl) { Manifest manifest; try { URL metaInfUrl = new URL(rootUrl, "META-INF/MANIFEST.MF"); InputStream is = metaInfUrl.openStream(); try { manifest = new Manifest(is); } finally { is.close(); } } catch (IOException ex) { log.warn("Unable to load manifest for StAX implementation at " + rootUrl); return UnknownStAXDialect.INSTANCE; } Attributes attrs = manifest.getMainAttributes(); String title = attrs.getValue(IMPLEMENTATION_TITLE); String symbolicName = attrs.getValue(BUNDLE_SYMBOLIC_NAME); if (symbolicName != null) { int i = symbolicName.indexOf(';'); if (i != -1) { symbolicName = symbolicName.substring(0, i); } } String vendor = attrs.getValue(IMPLEMENTATION_VENDOR); if (vendor == null) { vendor = attrs.getValue(BUNDLE_VENDOR); } String version = attrs.getValue(IMPLEMENTATION_VERSION); if (version == null) { version = attrs.getValue(BUNDLE_VERSION); } if (log.isDebugEnabled()) { log.debug("StAX implementation at " + rootUrl + " is:\n" + " Title: " + title + "\n" + " Symbolic name: " + symbolicName + "\n" + " Vendor: " + vendor + "\n" + " Version: " + version); } // For the moment, the dialect detection is quite simple, but in the future we will probably // have to differentiate by version number if (vendor != null && vendor.toLowerCase().indexOf("woodstox") != -1) { return WoodstoxDialect.INSTANCE; } else if (title != null && title.indexOf("SJSXP") != -1) { return new SJSXPDialect(false); } else if ("com.bea.core.weblogic.stax".equals(symbolicName)) { // Weblogic's StAX implementation doesn't support CDATA section reporting and there are // a couple of additional test cases (with respect to BEA's reference implementation) // that fail. log.warn("Weblogic's StAX implementation is unsupported and some Axiom features will not work " + "as expected! Please use Woodstox instead."); // This is the best match we can return in this case. return BEADialect.INSTANCE; } else if ("BEA".equals(vendor)) { return BEADialect.INSTANCE; } else if ("com.ibm.ws.prereq.banshee".equals(symbolicName)) { return XLXP2Dialect.INSTANCE; } else { return null; } } private static Class loadClass(ClassLoader classLoader, URL rootUrl, String name) { try { if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } Class cls = classLoader.loadClass(name); // Cross check if the class was loaded from the same location (JAR) return rootUrl.equals(getRootUrlForClass(cls)) ? cls : null; } catch (ClassNotFoundException ex) { return null; } } private static StAXDialect detectDialectFromClasses(ClassLoader classLoader, URL rootUrl) { Class cls; // Try Sun's implementation found in JREs cls = loadClass(classLoader, rootUrl, "com.sun.xml.internal.stream.XMLOutputFactoryImpl"); if (cls != null) { // Check if the implementation has the bug fixed here: // https://sjsxp.dev.java.net/source/browse/sjsxp/zephyr/src/com/sun/xml/stream/ZephyrWriterFactory.java?rev=1.8&r1=1.4&r2=1.5 boolean isUnsafeStreamResult; try { cls.getDeclaredField("fStreamResult"); isUnsafeStreamResult = true; } catch (NoSuchFieldException ex) { isUnsafeStreamResult = false; } return new SJSXPDialect(isUnsafeStreamResult); } // Try IBM's XL XP-J cls = loadClass(classLoader, rootUrl, "com.ibm.xml.xlxp.api.stax.StAXImplConstants"); if (cls != null) { boolean isSetPrefixBroken; try { cls.getField("IS_SETPREFIX_BEFORE_STARTELEMENT"); isSetPrefixBroken = false; } catch (NoSuchFieldException ex) { isSetPrefixBroken = true; } return new XLXP1Dialect(isSetPrefixBroken); } cls = loadClass(classLoader, rootUrl, "com.ibm.xml.xlxp2.api.stax.StAXImplConstants"); if (cls != null) { return new XLXP2Dialect(); } return null; } } ./src/org/apache/axiom/util/stax/dialect/BEAStreamReaderWrapper.java0000664000175000017500000001244511767656530024562 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; class BEAStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { /** * The character set encoding as inferred from the start bytes of the stream. */ private final String encodingFromStartBytes; private int depth; public BEAStreamReaderWrapper(XMLStreamReader parent, String encodingFromStartBytes) { super(parent); this.encodingFromStartBytes = encodingFromStartBytes; } public String getCharacterEncodingScheme() { if (getEventType() == START_DOCUMENT) { return super.getCharacterEncodingScheme(); } else { throw new IllegalStateException(); } } public String getVersion() { if (getEventType() == START_DOCUMENT) { return super.getVersion(); } else { throw new IllegalStateException(); } } public boolean isStandalone() { if (getEventType() == START_DOCUMENT) { return super.isStandalone(); } else { throw new IllegalStateException(); } } public boolean standaloneSet() { if (getEventType() == START_DOCUMENT) { return super.standaloneSet(); } else { throw new IllegalStateException(); } } public int next() throws XMLStreamException { if (!hasNext()) { // The reference implementation throws an XMLStreamException in this case. // This can't be considered as compliant with the specifications. throw new IllegalStateException("Already reached end of document"); } else { int event = super.next(); switch (event) { case START_ELEMENT: depth++; break; case END_ELEMENT: depth--; } return event; } } public String getEncoding() { if (getEventType() == START_DOCUMENT) { String encoding = super.getEncoding(); if (encoding != null) { return encoding; } else { if (encodingFromStartBytes == null) { // This means that the reader was created from a character stream // ==> always return null return null; } else { // If an XML encoding declaration was present, return the specified // encoding, otherwise fall back to the encoding we detected in // the factory wrapper encoding = getCharacterEncodingScheme(); return encoding == null ? encodingFromStartBytes : encoding; } } } else { throw new IllegalStateException(); } } public String getText() { // The reference implementation fails to normalize line endings in the prolog/epilog; we work // around this at least for getText since this bug causes a test failure in the Axiom unit // tests on Windows. if (depth == 0) { String text = super.getText(); StringBuffer buffer = null; int len = text.length(); for (int i=0; inull. In particular, the expected result for an unbound prefix is * {@link XMLConstants#NULL_NS_URI}. However, many implementations incorrectly return * null in that case. */ class NamespaceURICorrectingNamespaceContextWrapper implements NamespaceContext { private final NamespaceContext parent; public NamespaceURICorrectingNamespaceContextWrapper(NamespaceContext parent) { this.parent = parent; } public String getNamespaceURI(String prefix) { String namespaceURI = parent.getNamespaceURI(prefix); return namespaceURI == null ? XMLConstants.NULL_NS_URI : namespaceURI; } public String getPrefix(String namespaceURI) { return parent.getPrefix(namespaceURI); } public Iterator getPrefixes(String namespaceURI) { return parent.getPrefixes(namespaceURI); } } ./src/org/apache/axiom/util/stax/dialect/EncodingDetectionHelper.java0000664000175000017500000000633711767656530025063 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import javax.xml.stream.XMLStreamException; /** * Implements the character encoding autodetection algorithm described in Appendix F.1 of the * XML 1.0 specifications (Fifth Edition). */ class EncodingDetectionHelper { private final InputStream stream; private final boolean useMark; public EncodingDetectionHelper(InputStream stream) { useMark = stream.markSupported(); if (useMark) { this.stream = stream; } else { this.stream = new PushbackInputStream(stream, 4); } } public InputStream getInputStream() { return stream; } public String detectEncoding() throws XMLStreamException { byte[] startBytes = new byte[4]; try { if (useMark) { stream.mark(4); } int read = 0; do { int c = stream.read(startBytes, read, 4-read); if (c == -1) { throw new XMLStreamException("Unexpected end of stream"); } read += c; } while (read < 4); if (useMark) { stream.reset(); } else { ((PushbackInputStream)stream).unread(startBytes); } } catch (IOException ex) { throw new XMLStreamException("Unable to read start bytes", ex); } int marker = ((startBytes[0] & 0xFF) << 24) + ((startBytes[1] & 0xFF) << 16) + ((startBytes[2] & 0xFF) << 8) + (startBytes[3] & 0xFF); switch (marker) { case 0x0000FEFF: case 0xFFFE0000: case 0x0000FFFE: case 0xFEFF0000: case 0x0000003C: case 0x3C000000: case 0x00003C00: case 0x003C0000: return "UCS-4"; case 0x003C003F: return "UTF-16BE"; case 0x3C003F00: return "UTF-16LE"; case 0x3C3F786D: return "UTF-8"; default: if ((marker & 0xFFFF0000) == 0xFEFF0000) { return "UTF-16BE"; } else if ((marker & 0xFFFF0000) == 0xFFFE0000) { return "UTF-16LE"; } else { return "UTF-8"; } } } } ./src/org/apache/axiom/util/stax/dialect/UnknownStAXDialect.java0000664000175000017500000000405111767656530024012 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; class UnknownStAXDialect implements StAXDialect { public static final UnknownStAXDialect INSTANCE = new UnknownStAXDialect(); public String getName() { return "Unknown"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { // This is in principle only the prerequisite; let's hope that it is sufficient factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { return StAXDialectUtils.disallowDoctypeDecl(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { // Cross fingers and assume that the factory is already thread safe return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { // Cross fingers and assume that the factory is already thread safe return factory; } public XMLInputFactory normalize(XMLInputFactory factory) { return factory; } public XMLOutputFactory normalize(XMLOutputFactory factory) { return factory; } } ./src/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java0000664000175000017500000001165111767656530025100 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; class SJSXPStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { public SJSXPStreamReaderWrapper(XMLStreamReader parent) { super(parent); } public String getCharacterEncodingScheme() { if (getEventType() == START_DOCUMENT) { return super.getCharacterEncodingScheme(); } else { throw new IllegalStateException(); } } public String getEncoding() { if (getEventType() == START_DOCUMENT) { return super.getEncoding(); } else { throw new IllegalStateException(); } } public String getVersion() { if (getEventType() == START_DOCUMENT) { return super.getVersion(); } else { throw new IllegalStateException(); } } public boolean isStandalone() { if (getEventType() == START_DOCUMENT) { return super.isStandalone(); } else { throw new IllegalStateException(); } } public boolean standaloneSet() { if (getEventType() == START_DOCUMENT) { return super.standaloneSet(); } else { throw new IllegalStateException(); } } public String getLocalName() { // Fix for https://sjsxp.dev.java.net/issues/show_bug.cgi?id=21 int event = super.getEventType(); if (event == START_ELEMENT || event == END_ELEMENT || event == ENTITY_REFERENCE) { return super.getLocalName(); } else { throw new IllegalStateException(); } } public String getPrefix() { // Fix for: // - https://sjsxp.dev.java.net/issues/show_bug.cgi?id=24 // - https://sjsxp.dev.java.net/issues/show_bug.cgi?id=54 int event = super.getEventType(); if (event == START_ELEMENT || event == END_ELEMENT) { String result = super.getPrefix(); return result == null || result.length() == 0 ? null : result; } else { throw new IllegalStateException(); } } public String getNamespaceURI() { // Fix for https://sjsxp.dev.java.net/issues/show_bug.cgi?id=27 int event = getEventType(); if (event == START_ELEMENT || event == END_ELEMENT) { return super.getNamespaceURI(); } else { throw new IllegalStateException(); } } public QName getName() { // Fix for https://sjsxp.dev.java.net/issues/show_bug.cgi?id=44 try { return super.getName(); } catch (IllegalArgumentException ex) { throw new IllegalStateException(); } } public boolean hasName() { // Fix for https://sjsxp.dev.java.net/issues/show_bug.cgi?id=22 int event = super.getEventType(); return event == START_ELEMENT || event == END_ELEMENT; } public boolean hasText() { return super.hasText() || super.getEventType() == SPACE; } public boolean isWhiteSpace() { return super.isWhiteSpace() || super.getEventType() == SPACE; } public int next() throws XMLStreamException { // Fix for https://sjsxp.dev.java.net/issues/show_bug.cgi?id=17 // Note that the StAX specs has contradicting information about the type // of exception to throw (IllegalStateException or NoSuchElementException) // if the end of the document has been reached. We use IllegalStateException // because Woodstox does. if (hasNext()) { return super.next(); } else { throw new IllegalStateException(); } } public NamespaceContext getNamespaceContext() { return new SJSXPNamespaceContextWrapper(super.getNamespaceContext()); } public XMLStreamReader getParent() { return super.getParent(); } } ./src/org/apache/axiom/util/stax/dialect/XLXPStreamWriterWrapper.java0000664000175000017500000000262111767656530025033 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper; class XLXPStreamWriterWrapper extends XMLStreamWriterWrapper { public XLXPStreamWriterWrapper(XMLStreamWriter parent) { super(parent); } public void writeStartDocument(String encoding, String version) throws XMLStreamException { if (encoding == null) { throw new IllegalArgumentException(); } else { super.writeStartDocument(encoding, version); } } } ./src/org/apache/axiom/util/stax/dialect/StAXDialect.java0000664000175000017500000003461311767656530022441 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamConstants; /** * Encapsulates the specific characteristics of a particular StAX implementation. * In particular, an implementation of this interface is able to wrap (if necessary) the * readers and writers produced by the StAX implementation to make them conform to the * StAX specifications. This is called normalization. *

        * In addition to bugs in particular StAX implementations and clear violations of the StAX * specifications, the following ambiguities and gray areas in the specifications are also addressed * by the dialect implementations: *

          *
        • The specifications don't tell whether it is allowed to use a null value * for the charset encoding parameter in the following methods: *
            *
          • {@link XMLOutputFactory#createXMLEventWriter(java.io.OutputStream, String)}
          • *
          • {@link XMLOutputFactory#createXMLStreamWriter(java.io.OutputStream, String)}
          • *
          • {@link javax.xml.stream.XMLStreamWriter#writeStartDocument(String, String)}
          • *
          * Some implementations accept null values, while others throw an exception. * To make sure that code written to run with a normalized {@link XMLOutputFactory} remains * portable, the dialect implementation normalizes the behavior of these methods so that they * consistently throw an exception when called with a null encoding. Note that * the type of exception to be thrown remains unspecified.
        • *
        • The StAX specifications require that {@link javax.xml.stream.XMLStreamReader#getEncoding()} * returns the "input encoding if known or null if unknown". This requirement * is not precise enough to guarantee consistent behavior across different implementations. * In order to provide the consumer of the stream reader with complete and unambiguous information about * the encoding of the underlying stream, the dialect implementations normalize the * behavior of the {@link javax.xml.stream.XMLStreamReader#getEncoding()} method such that * it returns a non null value if and only if the reader was created from a byte stream, in * which case the return value is the effective charset encoding used by the parser to * decode the byte stream. According to the XML specifications, this value is determined * by one of the following means: *
            *
          • The encoding was provided when the stream reader was created, i.e. as a parameter * to the {@link javax.xml.stream.XMLInputFactory#createXMLStreamReader(java.io.InputStream, String)} * method. This is referred to as "external encoding information" by the XML * specifications.
          • *
          • The encoding was specified by the XML encoding declaration.
          • *
          • The encoding was detected using the first four bytes of the stream, as described * in appendix of the XML specifications.
          • *
          *
        • *
        • According to the table shown in the documentation of the * {@link javax.xml.stream.XMLStreamReader} class, calls to * {@link javax.xml.stream.XMLStreamReader#getEncoding()}, * {@link javax.xml.stream.XMLStreamReader#getVersion()}, * {@link javax.xml.stream.XMLStreamReader#isStandalone()}, * {@link javax.xml.stream.XMLStreamReader#standaloneSet()} and * {@link javax.xml.stream.XMLStreamReader#getCharacterEncodingScheme()} are only allowed * in the {@link javax.xml.stream.XMLStreamConstants#START_DOCUMENT} state. On the other * hand, this requirement is not mentioned in the documentation of the individual methods * and the majority of StAX implementations support calls to these methods in any state. * However, to improve portability, the dialect implementations normalize these methods to * throw an {@link IllegalStateException} if they are called in a state other than * {@link javax.xml.stream.XMLStreamConstants#START_DOCUMENT}.
        • *
        • The documentation of {@link javax.xml.stream.XMLStreamReader#isCharacters()} specifies * that this method "returns true if the cursor points to a character data event". * On the other hand, the documentation of {@link javax.xml.stream.XMLStreamReader} * states that "parsing events are defined as the XML Declaration, a DTD, start tag, * character data, white space, end tag, comment, or processing instruction" and thus * makes a clear distinction between character data events and white space events. * This means that {@link javax.xml.stream.XMLStreamReader#isCharacters()} should return * true if and only if the current event is * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS}. This is the case for most parsers, * but some return true for {@link javax.xml.stream.XMLStreamConstants#SPACE} * events as well. Where necessary, the dialect implementations correct this behavior. *
        • *
        *

        * Note that there are several ambiguities in the StAX specification which are not addressed by * the different dialect implementations: *

          *
        • It is not clear whether {@link javax.xml.stream.XMLStreamReader#getAttributePrefix(int)} * should return null or an empty string if the attribute doesn't have a * prefix. Consistency with {@link javax.xml.stream.XMLStreamReader#getPrefix()} would * imply that it should return null, but some implementations return an empty * string.
        • *
        • There is a contradicting in the documentation of the * {@link javax.xml.stream.XMLStreamReader#next()} about the exception that is thrown when * this method is called after {@link javax.xml.stream.XMLStreamReader#hasNext()} returns * false. It can either be {@link IllegalStateException} or * {@link java.util.NoSuchElementException}. *

          * Note that some implementations (including the reference implementation) throw an * {@link javax.xml.stream.XMLStreamException} in this case. This is considered as a * violation of the specifications because this exception should only be used * "if there is an error processing the underlying XML source", which is not the case.

        • *
        • An XML document may contain a namespace declaration such as xmlns="". In this * case, it is not clear if {@link javax.xml.stream.XMLStreamReader#getNamespaceURI(int)} * should return null or an empty string.
        • *
        • The documentation of {@link javax.xml.stream.XMLStreamWriter#setPrefix(String, String)} * and {@link javax.xml.stream.XMLStreamWriter#setDefaultNamespace(String)} requires that * the namespace "is bound in the scope of the current START_ELEMENT / END_ELEMENT pair". * The meaning of this requirement is clear in the context of an element written using * the writeStartElement and writeEndElement methods. On the * other hand, the requirement is ambiguous in the context of an element written using * writeEmptyElement and there are two competing interpretations: *
            *
          1. Since the element is empty, it doesn't define a nested scope and the namespace * should be bound in the scope of the enclosing element.
          2. *
          3. An invocation of one of the writeEmptyElement methods actually * doesn't write a complete element because it can be followed by invocations * of writeAttribute, writeNamespace or * writeDefaultNamespace. The element is only completed by a * call to a write method other than the aforementioned methods. * An element written using writeEmptyElement therefore also * defines a scope and the namespace should be bound in that scope.
          4. *
          * While the second interpretation seems to be more consistent, it would introduce another * ambiguity for the following sequence of calls: writeEmptyElement, * writeAttribute, setPrefix, writeCharacters. * In this case, it is not clear if the scope of the empty element should end at the call to * writeAttribute or writeCharacters. *

          * Because of these ambiguities, the dialect implementations don't attempt to normalize the * behavior of {@link javax.xml.stream.XMLStreamWriter#setPrefix(String, String)} * and {@link javax.xml.stream.XMLStreamWriter#setDefaultNamespace(String)} in this particular * context, and their usage in conjunction with writeEmptyElement should be * avoided. *

        • *
        */ public interface StAXDialect { /** * Get the name of this dialect. * * @return the name of the dialect */ String getName(); /** * Configure the given factory to enable reporting of CDATA sections by stream readers created * from it. The example in the documentation of the * {@link javax.xml.stream.XMLStreamReader#next()} method suggests that even if the parser is non * coalescing, CDATA sections should be reported as CHARACTERS events. Some implementations * strictly follow the example, while for others it is sufficient to make the parser non * coalescing. * * @param factory * the factory to configure; this may be an already normalized factory or a "raw" * factory object * @return the factory with CDATA reporting enabled; this may be the original factory instance * or a wrapper * @throws UnsupportedOperationException * if reporting of CDATA sections is not supported */ XMLInputFactory enableCDataReporting(XMLInputFactory factory); /** * Configure the given factory to disallow DOCTYPE declarations. The effect of this is similar * to the http://apache.org/xml/features/disallow-doctype-decl feature in Xerces. The * factory instance returned by this method MUST satisfy the following requirements: *
          *
        • The factory or the reader implementation MUST throw an exception when requested to parse * a document containing a DOCTYPE declaration. If the exception is not thrown by the factory, * it MUST be thrown by the reader before the first {@link XMLStreamConstants#START_ELEMENT} * event. *
        • The parser MUST NOT attempt to load the external DTD subset or any other external * entity. *
        • The parser MUST protect itself against denial of service attacks based on deeply nested * entity definitions present in the internal DTD subset. Ideally, the parser SHOULD NOT process * the internal subset at all and throw an exception immediately when encountering the DOCTYPE * declaration. *
        * This method is typically useful in the context of SOAP processing since a SOAP message must * not contain a Document Type Declaration. * * @param factory * the factory to configure; this may be an already normalized factory or a "raw" * factory object * @return the factory that disallows DOCTYPE declarations; this may be the original factory * instance or a wrapper */ XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory); /** * Make an {@link XMLInputFactory} object thread safe. The implementation may do this either by * configuring the factory or by creating a thread safe wrapper. The returned factory must be * thread safe for all method calls that don't change the (visible) state of the factory. This * means that thread safety is not required for * {@link XMLInputFactory#setEventAllocator(javax.xml.stream.util.XMLEventAllocator)}, * {@link XMLInputFactory#setProperty(String, Object)}, * {@link XMLInputFactory#setXMLReporter(javax.xml.stream.XMLReporter)} and * {@link XMLInputFactory#setXMLResolver(javax.xml.stream.XMLResolver)}. * * @param factory * the factory to make thread safe * @return the thread safe factory */ XMLInputFactory makeThreadSafe(XMLInputFactory factory); /** * Make an {@link XMLOutputFactory} object thread safe. The implementation may do this either by * configuring the factory or by creating a thread safe wrapper. The returned factory must be * thread safe for all method calls that don't change the (visible) state, i.e. the properties, * of the factory. * * @param factory * the factory to make thread safe * @return the thread safe factory */ XMLOutputFactory makeThreadSafe(XMLOutputFactory factory); /** * Normalize an {@link XMLInputFactory}. This will make sure that the readers created from the * factory conform to the StAX specifications. * * @param factory * the factory to normalize * @return the normalized factory */ XMLInputFactory normalize(XMLInputFactory factory); /** * Normalize an {@link XMLOutputFactory}. This will make sure that the writers created from the * factory conform to the StAX specifications. * * @param factory * the factory to normalize * @return the normalized factory */ XMLOutputFactory normalize(XMLOutputFactory factory); } ./src/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java0000664000175000017500000000256211767656530027115 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory; class NormalizingXMLInputFactoryWrapper extends WrappingXMLInputFactory { private final AbstractStAXDialect dialect; public NormalizingXMLInputFactoryWrapper(XMLInputFactory parent, AbstractStAXDialect dialect) { super(parent); this.dialect = dialect; } protected XMLStreamReader wrap(XMLStreamReader reader) { return dialect.normalize(reader); } } ./src/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java0000664000175000017500000000764611767656530026030 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; class WoodstoxStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { public WoodstoxStreamReaderWrapper(XMLStreamReader reader) { super(reader); } public String getCharacterEncodingScheme() { if (getEventType() == START_DOCUMENT) { return super.getCharacterEncodingScheme(); } else { throw new IllegalStateException(); } } public String getEncoding() { if (getEventType() == START_DOCUMENT) { return super.getEncoding(); } else { throw new IllegalStateException(); } } public String getVersion() { if (getEventType() == START_DOCUMENT) { return super.getVersion(); } else { throw new IllegalStateException(); } } public boolean isStandalone() { if (getEventType() == START_DOCUMENT) { return super.isStandalone(); } else { throw new IllegalStateException(); } } public boolean standaloneSet() { if (getEventType() == START_DOCUMENT) { return super.standaloneSet(); } else { throw new IllegalStateException(); } } public boolean isCharacters() { // TODO: in the dialect detection we should take into account the Woodstox version, // so that we can avoid creating the wrapper for Woodstox versions where this // issue has been fixed // This addresses WSTX-201: return getEventType() == CHARACTERS; } public String getPrefix() { // Woodstox 4.0 may return "" instead of null String prefix = super.getPrefix(); return prefix == null || prefix.length() == 0 ? null : prefix; } public String getNamespaceURI() { // Woodstox 4.0 may return "" instead of null String uri = super.getNamespaceURI(); return uri == null || uri.length() == 0 ? null : uri; } public String getNamespaceURI(String prefix) { // Woodstox 4.0 may return "" instead of null String uri = super.getNamespaceURI(prefix); return uri == null || uri.length() == 0 ? null : uri; } public String getNamespacePrefix(int index) { // Woodstox 4.0 may return "" instead of null String prefix = super.getNamespacePrefix(index); return prefix == null || prefix.length() == 0 ? null : prefix; } public String getAttributeNamespace(int index) { // Woodstox 4.0 may return "" instead of null String uri = super.getAttributeNamespace(index); return uri == null || uri.length() == 0 ? null : uri; } public NamespaceContext getNamespaceContext() { return new NamespaceURICorrectingNamespaceContextWrapper(super.getNamespaceContext()); } public XMLStreamReader getParent() { return super.getParent(); } } ./src/org/apache/axiom/util/stax/dialect/DisallowDoctypeDeclStreamReaderWrapper.java0000664000175000017500000000306011767656530030062 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; class DisallowDoctypeDeclStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { public DisallowDoctypeDeclStreamReaderWrapper(XMLStreamReader parent) { super(parent); } public int next() throws XMLStreamException { int event = super.next(); if (event == DTD) { throw new XMLStreamException("DOCTYPE is not allowed"); } return event; } public XMLStreamReader getParent() { return super.getParent(); } } ./src/org/apache/axiom/util/stax/dialect/SynchronizedOutputFactoryWrapper.java0000664000175000017500000000540411767656530027121 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.OutputStream; import java.io.Writer; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.Result; import org.apache.axiom.util.stax.wrapper.XMLOutputFactoryWrapper; class SynchronizedOutputFactoryWrapper extends XMLOutputFactoryWrapper { public SynchronizedOutputFactoryWrapper(XMLOutputFactory parent) { super(parent); } public synchronized XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding) throws XMLStreamException { return super.createXMLEventWriter(stream, encoding); } public synchronized XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException { return super.createXMLEventWriter(stream); } public synchronized XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException { return super.createXMLEventWriter(result); } public synchronized XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException { return super.createXMLEventWriter(stream); } public synchronized XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding) throws XMLStreamException { return super.createXMLStreamWriter(stream, encoding); } public synchronized XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException { return super.createXMLStreamWriter(stream); } public synchronized XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { return super.createXMLStreamWriter(result); } public synchronized XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException { return super.createXMLStreamWriter(stream); } } ./src/org/apache/axiom/util/stax/dialect/SJSXPNamespaceContextWrapper.java0000664000175000017500000000412711767656530025763 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; class SJSXPNamespaceContextWrapper implements NamespaceContext { private final NamespaceContext parent; public SJSXPNamespaceContextWrapper(NamespaceContext parent) { this.parent = parent; } public String getNamespaceURI(String prefix) { String namespaceURI = parent.getNamespaceURI(prefix); return namespaceURI == null ? XMLConstants.NULL_NS_URI : namespaceURI; } public String getPrefix(String namespaceURI) { return parent.getPrefix(namespaceURI); } public Iterator getPrefixes(String namespaceURI) { // SJSXP doesn't correctly handle masked namespace declarations List prefixes = new ArrayList(5); for (Iterator it = parent.getPrefixes(namespaceURI); it.hasNext(); ) { String prefix = (String)it.next(); String actualNamespaceURI = parent.getNamespaceURI(prefix); if (namespaceURI == actualNamespaceURI || namespaceURI != null && namespaceURI.equals(actualNamespaceURI)) { prefixes.add(prefix); } } return prefixes.iterator(); } } ./src/org/apache/axiom/util/stax/dialect/XLXP1Dialect.java0000664000175000017500000000541511767656530022474 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; class XLXP1Dialect extends AbstractStAXDialect { private final boolean isSetPrefixBroken; public XLXP1Dialect(boolean isSetPrefixBroken) { this.isSetPrefixBroken = isSetPrefixBroken; } public String getName() { return isSetPrefixBroken ? "XL XP-J (StAX non-compliant versions)" : "XL XP-J (StAX compliant versions)"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { return StAXDialectUtils.disallowDoctypeDecl(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { // XLXP's factories are thread safe return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { // XLXP's factories are thread safe return factory; } public XMLStreamReader normalize(XMLStreamReader reader) { return new XLXP1StreamReaderWrapper(reader); } public XMLStreamWriter normalize(XMLStreamWriter writer) { XMLStreamWriter wrapper = new XLXPStreamWriterWrapper(writer); // Early versions of XLXP the scope of the prefix bindings defined by setPrefix // is incorrect if (isSetPrefixBroken) { wrapper = new NamespaceContextCorrectingXMLStreamWriterWrapper(wrapper); } return wrapper; } public XMLInputFactory normalize(XMLInputFactory factory) { return new XLXPInputFactoryWrapper(factory, this); } public XMLOutputFactory normalize(XMLOutputFactory factory) { return new NormalizingXMLOutputFactoryWrapper(factory, this); } } ./src/org/apache/axiom/util/stax/dialect/XLXPStreamReaderWrapper.java0000664000175000017500000000265511767656530024770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; class XLXPStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { public XLXPStreamReaderWrapper(XMLStreamReader parent) { super(parent); } public boolean isCharacters() { // XLXP returns true for SPACE events as well; this is not correct return getEventType() == CHARACTERS; } public XMLStreamReader getParent() { return super.getParent(); } } ./src/org/apache/axiom/util/stax/dialect/BEAInputFactoryWrapper.java0000664000175000017500000000665011767656530024634 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.InputStream; import java.io.Reader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper; class BEAInputFactoryWrapper extends XMLInputFactoryWrapper { public BEAInputFactoryWrapper(XMLInputFactory parent) { super(parent); } public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException { return createXMLStreamReader(null, stream); } public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException { // The getEncoding() method of the stream reader produced by the reference implementation // doesn't return complete information about the effective encoding. To work around this, // we need to implement the detection algorithm described in Appendix F.1 of the // XML 1.0 specifications (Fifth Edition). Note that the encoding determined here may be // overridden by the XML encoding declaration, if present in the XML document. This // information is already available from the stream reader, so that we don't need to // reimplement this part. // TODO: this needs some more unit testing! EncodingDetectionHelper helper = new EncodingDetectionHelper(stream); stream = helper.getInputStream(); String encoding = helper.detectEncoding(); XMLStreamReader reader; if (systemId == null) { reader = super.createXMLStreamReader(stream); } else { reader = super.createXMLStreamReader(systemId, stream); } return new BEAStreamReaderWrapper(reader, encoding); } public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException { return new BEAStreamReaderWrapper(super.createXMLStreamReader(stream, encoding), null); } public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return new BEAStreamReaderWrapper(super.createXMLStreamReader(reader), null); } public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException { return new BEAStreamReaderWrapper(super.createXMLStreamReader(source), null); } public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException { return new BEAStreamReaderWrapper(super.createXMLStreamReader(systemId, reader), null); } } ./src/org/apache/axiom/util/stax/dialect/SecureXMLResolver.java0000664000175000017500000000361311767656530023661 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLResolver; import javax.xml.stream.XMLStreamException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This XMLResolver is used whenever a secure XMLStreamReader * is needed. Basically it throws an exception if an attempt * is made to read an entity. */ final class SecureXMLResolver implements XMLResolver { private static Log log = LogFactory.getLog(SecureXMLResolver.class); public Object resolveEntity(String arg0, String arg1, String arg2, String arg3) throws XMLStreamException { // Do not expose the name of the entity that was attempted to be // read as this will reveal secure information to the client. if (log.isDebugEnabled()) { log.debug("resolveEntity is disabled because this is a secure XMLStreamReader(" + arg0 + ") (" + arg1 + ") (" + arg2 + ") (" + arg3 + ")"); } throw new XMLStreamException("Reading external entities is disabled"); } } ./src/org/apache/axiom/util/stax/dialect/BEADialect.java0000664000175000017500000000523611767656530022210 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; class BEADialect extends AbstractStAXDialect { public static final StAXDialect INSTANCE = new BEADialect(); public String getName() { return "BEA"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); factory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { return StAXDialectUtils.disallowDoctypeDecl(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { // Factories are already thread safe return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { // Factories are already thread safe return factory; } public XMLStreamReader normalize(XMLStreamReader reader) { return new BEAStreamReaderWrapper(reader, null); } public XMLStreamWriter normalize(XMLStreamWriter writer) { // The stream writer implementation of the reference implementation doesn't handle masked // namespace bindings correctly. We wrap the writer in a // NamespaceContextCorrectingXMLStreamWriterWrapper to work around this problem. return new NamespaceContextCorrectingXMLStreamWriterWrapper(writer); } public XMLInputFactory normalize(XMLInputFactory factory) { return new BEAInputFactoryWrapper(factory); } public XMLOutputFactory normalize(XMLOutputFactory factory) { return new NormalizingXMLOutputFactoryWrapper(factory, this); } } ./src/org/apache/axiom/util/stax/dialect/SJSXPDialect.java0000664000175000017500000000724711767656530022534 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLResolver; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; class SJSXPDialect extends AbstractStAXDialect { private final boolean isUnsafeStreamResult; public SJSXPDialect(boolean isUnsafeStreamResult) { this.isUnsafeStreamResult = isUnsafeStreamResult; } public String getName() { return isUnsafeStreamResult ? "SJSXP (with thread safety issue)" : "SJSXP"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); factory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { // SJSXP is particular because when SUPPORT_DTD is set to false, no DTD event is reported. // This means that we would not be able to throw an exception. The trick is to enable // DTD support and trigger an exception if the parser attempts to load the external subset // or returns a DTD event. factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.TRUE); factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); factory.setXMLResolver(new XMLResolver() { public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException { throw new XMLStreamException("DOCTYPE is not allowed"); } }); return new DisallowDoctypeDeclInputFactoryWrapper(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { factory.setProperty("reuse-instance", Boolean.FALSE); return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { factory.setProperty("reuse-instance", Boolean.FALSE); if (isUnsafeStreamResult) { factory = new SynchronizedOutputFactoryWrapper(factory); } return factory; } public XMLStreamReader normalize(XMLStreamReader reader) { return new SJSXPStreamReaderWrapper(reader); } public XMLStreamWriter normalize(XMLStreamWriter writer) { return new SJSXPStreamWriterWrapper(writer); } public XMLInputFactory normalize(XMLInputFactory factory) { return new NormalizingXMLInputFactoryWrapper(factory, this); } public XMLOutputFactory normalize(XMLOutputFactory factory) { return new SJSXPOutputFactoryWrapper(factory, this); } } ./src/org/apache/axiom/util/stax/dialect/package.html0000664000175000017500000000163011767656530021743 0ustar brianbrian Contains classes to handle differences between StAX implementations. ./src/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java0000664000175000017500000000257411767656530027321 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.util.stax.wrapper.WrappingXMLOutputFactory; class NormalizingXMLOutputFactoryWrapper extends WrappingXMLOutputFactory { private final AbstractStAXDialect dialect; public NormalizingXMLOutputFactoryWrapper(XMLOutputFactory parent, AbstractStAXDialect dialect) { super(parent); this.dialect = dialect; } protected XMLStreamWriter wrap(XMLStreamWriter writer) { return dialect.normalize(writer); } } ./src/org/apache/axiom/util/stax/dialect/WoodstoxStreamWriterWrapper.java0000664000175000017500000000263111767656530026067 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper; class WoodstoxStreamWriterWrapper extends XMLStreamWriterWrapper { public WoodstoxStreamWriterWrapper(XMLStreamWriter parent) { super(parent); } public void writeStartDocument(String encoding, String version) throws XMLStreamException { if (encoding == null) { throw new IllegalArgumentException(); } else { super.writeStartDocument(encoding, version); } } } ./src/org/apache/axiom/util/stax/dialect/WoodstoxOutputFactoryWrapper.java0000664000175000017500000000352511767656530026272 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.OutputStream; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; class WoodstoxOutputFactoryWrapper extends NormalizingXMLOutputFactoryWrapper { public WoodstoxOutputFactoryWrapper(XMLOutputFactory parent, AbstractStAXDialect dialect) { super(parent, dialect); } public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding) throws XMLStreamException { if (encoding == null) { throw new IllegalArgumentException(); } else { return super.createXMLEventWriter(stream, encoding); } } public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding) throws XMLStreamException { if (encoding == null) { throw new IllegalArgumentException(); } else { return super.createXMLStreamWriter(stream, encoding); } } } ./src/org/apache/axiom/util/stax/dialect/AbstractStAXDialect.java0000664000175000017500000000215711767656530024123 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; abstract class AbstractStAXDialect implements StAXDialect { public abstract XMLStreamReader normalize(XMLStreamReader reader); public abstract XMLStreamWriter normalize(XMLStreamWriter writer); } ./src/org/apache/axiom/util/stax/dialect/NamespaceContextCorrectingXMLStreamReaderWrapper.java0000664000175000017500000000643611767656530032040 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.DelegatingXMLStreamReader; import org.apache.axiom.util.namespace.ScopedNamespaceContext; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; /** * {@link XMLStreamReader} wrapper that tracks the namespace bindings on behalf of the underlying * reader. This class may be used to wrap {@link XMLStreamReader} instances known to have issues in * their namespace context implementation. It tracks the namespace bindings using the * {@link XMLStreamReader#getNamespacePrefix(int)} and {@link XMLStreamReader#getNamespaceURI(int)} * methods and exposes this information by overriding the * {@link XMLStreamReader#getNamespaceContext()} and {@link XMLStreamReader#getNamespaceURI(String)} * methods. Invocations of these two methods will therefore never reach the underlying reader. */ class NamespaceContextCorrectingXMLStreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader { private final ScopedNamespaceContext namespaceContext = new ScopedNamespaceContext(); /** * Constructor. * * @param parent the parent reader */ public NamespaceContextCorrectingXMLStreamReaderWrapper(XMLStreamReader parent) { super(parent); } private void startElement() { namespaceContext.startScope(); for (int i=0, c=getNamespaceCount(); ixml and xmlns prefixes. This wrapper may * be used to fix the behavior of broken {@link NamespaceContext} * implementations. */ class ImplicitNamespaceContextWrapper extends AbstractNamespaceContext { private final NamespaceContext parent; public ImplicitNamespaceContextWrapper(NamespaceContext parent) { this.parent = parent; } protected String doGetNamespaceURI(String prefix) { return parent.getNamespaceURI(prefix); } protected String doGetPrefix(String namespaceURI) { return parent.getPrefix(namespaceURI); } protected Iterator doGetPrefixes(String namespaceURI) { return parent.getPrefixes(namespaceURI); } } ./src/org/apache/axiom/util/stax/dialect/XLXP2Dialect.java0000664000175000017500000000513211767656530022471 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; class XLXP2Dialect extends AbstractStAXDialect { public static final StAXDialect INSTANCE = new XLXP2Dialect(); public String getName() { return "XLXP2"; } public XMLInputFactory enableCDataReporting(XMLInputFactory factory) { factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); return factory; } public XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { // Set an XMLResolver that fails if an attempt is made to resolve a reference // This is an additional safeguard. factory.setXMLResolver(new SecureXMLResolver()); return StAXDialectUtils.disallowDoctypeDecl(factory); } public XMLInputFactory makeThreadSafe(XMLInputFactory factory) { // XLXP's factories are thread safe return factory; } public XMLOutputFactory makeThreadSafe(XMLOutputFactory factory) { // XLXP's factories are thread safe return factory; } public XMLStreamReader normalize(XMLStreamReader reader) { // XLXP2's getNamespaceContext implementation is broken return new NamespaceContextCorrectingXMLStreamReaderWrapper( new XLXPStreamReaderWrapper(reader)); } public XMLStreamWriter normalize(XMLStreamWriter writer) { return new XLXPStreamWriterWrapper(writer); } public XMLInputFactory normalize(XMLInputFactory factory) { return new XLXPInputFactoryWrapper(factory, this); } public XMLOutputFactory normalize(XMLOutputFactory factory) { return new NormalizingXMLOutputFactoryWrapper(factory, this); } } ./src/org/apache/axiom/util/stax/dialect/StAXDialectUtils.java0000664000175000017500000000353411767656530023460 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import javax.xml.stream.XMLInputFactory; class StAXDialectUtils { /** * Default implementation for the {@link StAXDialect#disallowDoctypeDecl(XMLInputFactory)} * method. This method assumes that if {@link XMLInputFactory#SUPPORT_DTD} is set to false, the * underlying parser *
          *
        1. still reports DTD events and *
        2. doesn't attempt to load the external DTD subset (if present). *
        * These assumptions may be false for some StAX implementations. * * @param factory * the factory to configure * @return the configured factory */ public static XMLInputFactory disallowDoctypeDecl(XMLInputFactory factory) { factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); return new DisallowDoctypeDeclInputFactoryWrapper(factory); } } ./src/org/apache/axiom/util/stax/dialect/XLXPInputFactoryWrapper.java0000664000175000017500000000521611767656530025035 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.dialect; import java.io.InputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; class XLXPInputFactoryWrapper extends NormalizingXMLInputFactoryWrapper { public XLXPInputFactoryWrapper(XMLInputFactory parent, AbstractStAXDialect dialect) { super(parent, dialect); } public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException { return createXMLStreamReader(null, stream); } public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException { // Both versions of XLXP have issues with documents using UTF-16 without byte // order markers, although this type of document is explicitly supported by the XML // specification: // * XLXP parses the document, XMLStreamReader#getEncoding incorrectly reports // UTF-8 as the detected encoding. // * XLXP2 simply fails on UTF-16 documents without BOM. EncodingDetectionHelper helper = new EncodingDetectionHelper(stream); stream = helper.getInputStream(); String encoding = helper.detectEncoding(); if (encoding.startsWith("UTF-16")) { if (systemId == null) { return super.createXMLStreamReader(stream, encoding); } else { // Here we have an issue because it is not possible to specify the // systemId and the encoding at the same time... return super.createXMLStreamReader(systemId, stream); } } else { if (systemId == null) { return super.createXMLStreamReader(stream); } else { return super.createXMLStreamReader(systemId, stream); } } } } ./src/org/apache/axiom/util/stax/debug/0000775000175000017500000000000011767656530017143 5ustar brianbrian./src/org/apache/axiom/util/stax/debug/XMLStreamReaderValidator.java0000664000175000017500000001640611767656530024622 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.debug; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.util.Stack; // TODO: this needs reformatting; the (generated) Javadoc is unreadable! /** * There are several places in the code where events are passed from * a source to a consumer using XMLStreamReader events. * * XMLStreamReader (impl)--> consumer of XMLStreamReader events * * This simple class can be interjected as a filter and used to do some simple validation. * Validating the events coming from source (impl) can help find and correct errors * when they occur. Otherwise the errors may be caught much further downstream and hard to fix. * * XMLStreamReader (impl)--> XMLStreamReaderValiator-> consumer of XMLStreamReader events * * * In the initial version, the XMStreamValidator ensures that the start element events match the * end element events. */ public class XMLStreamReaderValidator extends XMLStreamReaderWrapper { private static Log log = LogFactory.getLog(XMLStreamReaderValidator.class); private static boolean IS_DEBUG_ENABLED = log.isDebugEnabled(); private static boolean IS_ADV_DEBUG_ENABLED = false; // Turn this on to trace every event private boolean throwExceptions = false; // Indicates whether OMException should be thrown if errors are disovered private Stack stack = new Stack(); // Stack keeps track of the nested element QName /** * @param delegate XMLStreamReader to validate * @param throwExceptions (true if exceptions should be thrown when errors are encountered) */ public XMLStreamReaderValidator(XMLStreamReader delegate, boolean throwExceptions) { super(delegate); this.throwExceptions = throwExceptions; } public int next() throws XMLStreamException { int event = super.next(); trackEvent(event); return event; } public String getElementText() throws XMLStreamException { String text = super.getElementText(); trackEvent(END_ELEMENT); return text; } public int nextTag() throws XMLStreamException { int event = super.nextTag(); trackEvent(event); return event; } private void trackEvent(int event) throws XMLStreamException { logParserState(); // Make sure that the start element and end element events match. // Mismatched events are a key indication that the delegate stream reader is // broken or corrupted. switch (event) { case XMLStreamConstants.START_ELEMENT: stack.push(super.getName()); break; case XMLStreamConstants.END_ELEMENT: QName delegateQName = super.getName(); if (stack.isEmpty()) { reportMismatchedEndElement(null, delegateQName); } else { QName expectedQName = (QName) stack.pop(); if (!expectedQName.equals(delegateQName)) { reportMismatchedEndElement(expectedQName, delegateQName); } } break; default : } } /** * Report a mismatched end element. * @param expectedQName * @param delegateQName * @throws XMLStreamException */ private void reportMismatchedEndElement(QName expectedQName, QName delegateQName) throws XMLStreamException { String text = null; if (expectedQName == null) { text = "An END_ELEMENT event for " + delegateQName + " was encountered, but the START_ELEMENT stack is empty."; } else { text = "An END_ELEMENT event for " + delegateQName + " was encountered, but this doesn't match the corresponding START_ELEMENT " + expectedQName + " event."; } if (IS_DEBUG_ENABLED) { log.debug(text); } if (throwExceptions) { throw new XMLStreamException(text); } } /** * Dump the current event of the delegate. */ protected void logParserState() { if (IS_ADV_DEBUG_ENABLED) { int currentEvent = super.getEventType(); switch (currentEvent) { case XMLStreamConstants.START_ELEMENT: log.trace("START_ELEMENT: "); log.trace(" QName: " + super.getName()); break; case XMLStreamConstants.START_DOCUMENT: log.trace("START_DOCUMENT: "); break; case XMLStreamConstants.CHARACTERS: log.trace("CHARACTERS: "); log.trace( "[" + super.getText() + "]"); break; case XMLStreamConstants.CDATA: log.trace("CDATA: "); log.trace( "[" + super.getText() + "]"); break; case XMLStreamConstants.END_ELEMENT: log.trace("END_ELEMENT: "); log.trace(" QName: " + super.getName()); break; case XMLStreamConstants.END_DOCUMENT: log.trace("END_DOCUMENT: "); break; case XMLStreamConstants.SPACE: log.trace("SPACE: "); log.trace( "[" + super.getText() + "]"); break; case XMLStreamConstants.COMMENT: log.trace("COMMENT: "); log.trace( "[" + super.getText() + "]"); break; case XMLStreamConstants.DTD: log.trace("DTD: "); log.trace( "[" + super.getText() + "]"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: log.trace("PROCESSING_INSTRUCTION: "); log.trace(" [" + super.getPITarget() + "][" + super.getPIData() + "]"); break; case XMLStreamConstants.ENTITY_REFERENCE: log.trace("ENTITY_REFERENCE: "); log.trace(" " + super.getLocalName() + "[" + super.getText() + "]"); break; default : log.trace("UNKNOWN_STATE: " + currentEvent); } } } } ./src/org/apache/axiom/util/stax/debug/UnclosedReaderDetector.java0000664000175000017500000000543311767656530024404 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.stax.debug; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory; import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * {@link XMLInputFactory} wrapper that enabled detection of unclosed stream readers. An unclosed * reader will be detected when the {@link XMLStreamReader} instance is finalized by the virtual * machine. When this happens, a warning message will be logged. The log message contains the stack * trace of the instruction that created the reader. *

        * Note that for this to work, the detector must compute the stack trace every time a reader is * created. Since this may have a significant performance impact, the wrapper should only used * during testing and debugging. */ public class UnclosedReaderDetector extends WrappingXMLInputFactory { static final Log log = LogFactory.getLog(UnclosedReaderDetector.class); private static class StreamReaderWrapper extends XMLStreamReaderWrapper { private final Throwable stackTrace; private boolean isClosed; public StreamReaderWrapper(XMLStreamReader parent) { super(parent); stackTrace = new Throwable(); } public void close() throws XMLStreamException { super.close(); isClosed = true; } protected void finalize() throws Throwable { if (!isClosed) { log.warn("Detected unclosed XMLStreamReader.", stackTrace); } } } /** * Constructor. * * @param parent the parent factory */ public UnclosedReaderDetector(XMLInputFactory parent) { super(parent); } protected XMLStreamReader wrap(XMLStreamReader reader) { return new StreamReaderWrapper(reader); } } ./src/org/apache/axiom/util/stax/debug/package.html0000664000175000017500000000162311767656530021426 0ustar brianbrian Contains classes that can be used to debug StAX related issues. ./src/org/apache/axiom/util/blob/0000775000175000017500000000000011767656530016014 5ustar brianbrian./src/org/apache/axiom/util/blob/OverflowBlob.java0000664000175000017500000003657711767656530021303 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.io.ReadFromSupport; import org.apache.axiom.ext.io.StreamCopyException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Blob implementation that stores data in a temporary file if the size exceeds a configurable * threshold. The data is first stored into a fixed size buffer. Once this buffer overflows, it is * transferred to a temporary file. The buffer is divided into a given number of fixed size chunks * that are allocated on demand. Since a temporary file may be created it is mandatory to call * {@link #release()} to discard the blob. */ public class OverflowBlob implements WritableBlob { private static final Log log = LogFactory.getLog(OverflowBlob.class); static final int STATE_NEW = 0; static final int STATE_UNCOMMITTED = 1; static final int STATE_COMMITTED = 2; class OutputStreamImpl extends BlobOutputStream { private FileOutputStream fileOutputStream; public WritableBlob getBlob() { return OverflowBlob.this; } public void write(byte[] b, int off, int len) throws IOException { if (fileOutputStream != null) { fileOutputStream.write(b, off, len); } else if (len > (chunks.length-chunkIndex)*chunkSize - chunkOffset) { // The buffer will overflow. Switch to a temporary file. fileOutputStream = switchToTempFile(); // Write the new data to the temporary file. fileOutputStream.write(b, off, len); } else { // The data will fit into the buffer. while (len > 0) { byte[] chunk = getCurrentChunk(); // Determine number of bytes that can be copied to the current chunk. int c = Math.min(len, chunkSize-chunkOffset); // Copy data to the chunk. System.arraycopy(b, off, chunk, chunkOffset, c); // Update variables. len -= c; off += c; chunkOffset += c; if (chunkOffset == chunkSize) { chunkIndex++; chunkOffset = 0; } } } } public void write(byte[] b) throws IOException { write(b, 0, b.length); } public void write(int b) throws IOException { write(new byte[] { (byte)b }, 0, 1); } public void flush() throws IOException { if (fileOutputStream != null) { fileOutputStream.flush(); } } public void close() throws IOException { if (fileOutputStream != null) { fileOutputStream.close(); } state = STATE_COMMITTED; } } class InputStreamImpl extends InputStream { private int currentChunkIndex; private int currentChunkOffset; private int markChunkIndex; private int markChunkOffset; public int available() throws IOException { return (chunkIndex-currentChunkIndex)*chunkSize + chunkOffset - currentChunkOffset; } public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0 && !(currentChunkIndex == chunkIndex && currentChunkOffset == chunkOffset)) { int c; if (currentChunkIndex == chunkIndex) { // The current chunk is the last one => take into account the offset c = Math.min(len, chunkOffset-currentChunkOffset); } else { c = Math.min(len, chunkSize-currentChunkOffset); } // Copy the data. System.arraycopy(chunks[currentChunkIndex], currentChunkOffset, b, off, c); // Update variables len -= c; off += c; currentChunkOffset += c; read += c; if (currentChunkOffset == chunkSize) { currentChunkIndex++; currentChunkOffset = 0; } } if (read == 0) { // We didn't read anything (and the len argument was not 0) => we reached the end of the buffer. return -1; } else { return read; } } public int read(byte[] b) throws IOException { return read(b, 0, b.length); } public int read() throws IOException { byte[] b = new byte[1]; return read(b) == -1 ? -1 : b[0] & 0xFF; } public boolean markSupported() { return true; } public void mark(int readlimit) { markChunkIndex = currentChunkIndex; markChunkOffset = currentChunkOffset; } public void reset() throws IOException { currentChunkIndex = markChunkIndex; currentChunkOffset = markChunkOffset; } public long skip(long n) throws IOException { int available = available(); int c = n < available ? (int)n : available; int newOffset = currentChunkOffset + c; int chunkDelta = newOffset/chunkSize; currentChunkIndex += chunkDelta; currentChunkOffset = newOffset - (chunkDelta*chunkSize); return c; } public void close() throws IOException { } } /** * Size of the chunks that will be allocated in the buffer. */ final int chunkSize; /** * The prefix to be used in generating the name of the temporary file. */ final String tempPrefix; /** * The suffix to be used in generating the name of the temporary file. */ final String tempSuffix; /** * Array of byte[] representing the chunks of the buffer. * A chunk is only allocated when the first byte is written to it. * This attribute is set to null when the buffer overflows and * is written out to a temporary file. */ byte[][] chunks; /** * Index of the chunk the next byte will be written to. */ int chunkIndex; /** * Offset into the chunk where the next byte will be written. */ int chunkOffset; /** * The handle of the temporary file. This is only set when the memory buffer * overflows and is written out to a temporary file. */ File temporaryFile; /** * The state of the blob. */ int state = STATE_NEW; public OverflowBlob(int numberOfChunks, int chunkSize, String tempPrefix, String tempSuffix) { this.chunkSize = chunkSize; this.tempPrefix = tempPrefix; this.tempSuffix = tempSuffix; chunks = new byte[numberOfChunks][]; } public boolean isSupportingReadUncommitted() { // This is actually a limitation of the implementation, not an intrinsic limitation return false; } /** * Get the current chunk to write to, allocating it if necessary. * * @return the current chunk to write to (never null) */ byte[] getCurrentChunk() { if (chunkOffset == 0) { // We will write the first byte to the current chunk. Allocate it. byte[] chunk = new byte[chunkSize]; chunks[chunkIndex] = chunk; return chunk; } else { // The chunk has already been allocated. return chunks[chunkIndex]; } } /** * Create a temporary file and write the existing in memory data to it. * * @return an open FileOutputStream to the temporary file * @throws IOException */ FileOutputStream switchToTempFile() throws IOException { temporaryFile = File.createTempFile(tempPrefix, tempSuffix); if (log.isDebugEnabled()) { log.debug("Using temporary file " + temporaryFile); } temporaryFile.deleteOnExit(); FileOutputStream fileOutputStream = new FileOutputStream(temporaryFile); // Write the buffer to the temporary file. for (int i=0; i 0) { fileOutputStream.write(chunks[chunkIndex], 0, chunkOffset); } // Release references to the buffer so that it can be garbage collected. chunks = null; return fileOutputStream; } public BlobOutputStream getOutputStream() { if (state != STATE_NEW) { throw new IllegalStateException(); } else { state = STATE_UNCOMMITTED; return new OutputStreamImpl(); } } public long readFrom(InputStream in, long length, boolean commit) throws StreamCopyException { // TODO: this will not work if the blob is in state UNCOMMITTED and we have already switched to a temporary file long read = 0; long toRead = length == -1 ? Long.MAX_VALUE : length; while (true) { int c; try { int len = chunkSize-chunkOffset; if (len > toRead) { len = (int)toRead; } c = in.read(getCurrentChunk(), chunkOffset, len); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } if (c == -1) { break; } read += c; toRead -= c; chunkOffset += c; if (chunkOffset == chunkSize) { chunkIndex++; chunkOffset = 0; if (chunkIndex == chunks.length) { FileOutputStream fileOutputStream; try { fileOutputStream = switchToTempFile(); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } byte[] buf = new byte[4096]; while (true) { int c2; try { c2 = in.read(buf, 0, (int)Math.min(toRead, 4096)); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } if (c2 == -1) { break; } try { fileOutputStream.write(buf, 0, c2); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } read += c2; toRead -= c2; } try { fileOutputStream.close(); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } break; } } } state = commit ? STATE_COMMITTED : STATE_UNCOMMITTED; return read; } public long readFrom(InputStream in, long length) throws StreamCopyException { return readFrom(in, length, state == STATE_NEW); } public InputStream getInputStream() throws IOException { if (state != STATE_COMMITTED) { throw new IllegalStateException(); } else if (temporaryFile != null) { return new FileInputStream(temporaryFile); } else { return new InputStreamImpl(); } } public void writeTo(OutputStream out) throws StreamCopyException { if (temporaryFile != null) { FileInputStream in; try { in = new FileInputStream(temporaryFile); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } try { if (out instanceof ReadFromSupport) { ((ReadFromSupport)out).readFrom(in, -1); } else { byte[] buf = new byte[4096]; while (true) { int c; try { c = in.read(buf); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } if (c == -1) { break; } try { out.write(buf, 0, c); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } } } } finally { try { in.close(); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } } } else { try { for (int i=0; i 0) { out.write(chunks[chunkIndex], 0, chunkOffset); } } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } } } public long getLength() { if (temporaryFile != null) { return temporaryFile.length(); } else { return chunkIndex*chunkSize + chunkOffset; } } public void release() { if (temporaryFile != null) { if (log.isDebugEnabled()) { log.debug("Deleting temporary file " + temporaryFile); } temporaryFile.delete(); } } protected void finalize() throws Throwable { if (temporaryFile != null) { log.warn("Cleaning up unreleased temporary file " + temporaryFile); temporaryFile.delete(); } } } ./src/org/apache/axiom/util/blob/MemoryBlob.java0000664000175000017500000001702111767656530020727 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import org.apache.axiom.ext.io.StreamCopyException; /** * Blob implementation that stores data in memory. */ public class MemoryBlob implements WritableBlob { // TODO: this should be configurable final static int BUFFER_SIZE = 4096; class OutputStreamImpl extends BlobOutputStream { public WritableBlob getBlob() { return MemoryBlob.this; } public void write(byte[] b, int off, int len) throws IOException { int total = 0; while (total < len) { int copy = Math.min(len-total, BUFFER_SIZE-index); System.arraycopy(b, off, currBuffer, index, copy); total += copy; index += copy; off += copy; if (index >= BUFFER_SIZE) { addBuffer(); } } } public void write(byte[] b) throws IOException { this.write(b, 0, b.length); } byte[] writeByte = new byte[1]; public void write(int b) throws IOException { writeByte[0] = (byte) b; this.write(writeByte, 0, 1); } public void close() throws IOException { outputStream = null; committed = true; } } class InputStreamImpl extends InputStream { private int i; private int currIndex; private int totalIndex; private int mark; private byte[] currBuffer; private byte[] read_byte = new byte[1]; public InputStreamImpl() { } public int read() throws IOException { int read = read(read_byte); if (read < 0) { return -1; } else { return read_byte[0] & 0xFF; } } public int available() throws IOException { return (int)getLength() - totalIndex; } public synchronized void mark(int readlimit) { mark = totalIndex; } public boolean markSupported() { return true; } public int read(byte[] b, int off, int len) throws IOException { int size = (int)getLength(); int total = 0; if (totalIndex >= size) { return -1; } while (total < len && totalIndex < size) { if (currBuffer == null) { currBuffer = (byte[]) data.get(i); } int copy = Math.min(len - total, BUFFER_SIZE - currIndex); copy = Math.min(copy, size - totalIndex); System.arraycopy(currBuffer, currIndex, b, off, copy); total += copy; currIndex += copy; totalIndex += copy; off += copy; if (currIndex >= BUFFER_SIZE) { if (i+1 < data.size()) { i++; currIndex = 0; } else { currIndex = BUFFER_SIZE; } currBuffer = null; } } return total; } public int read(byte[] b) throws IOException { return this.read(b, 0, b.length); } public synchronized void reset() throws IOException { i = mark / BUFFER_SIZE; currIndex = mark - (i * BUFFER_SIZE); currBuffer = (byte[]) data.get(i); totalIndex = mark; } } List data; // null here indicates the blob is in state NEW int index; byte[] currBuffer; OutputStreamImpl outputStream; boolean committed; private void init() { data = new ArrayList(); addBuffer(); } void addBuffer() { currBuffer = new byte[BUFFER_SIZE]; data.add(currBuffer); index = 0; } public boolean isSupportingReadUncommitted() { return true; } public long getLength() { if (data == null) { return 0; } else { return (BUFFER_SIZE * (data.size()-1)) + index; } } public BlobOutputStream getOutputStream() { if (data != null) { throw new IllegalStateException(); } else { init(); return outputStream = new OutputStreamImpl(); } } public long readFrom(InputStream in, long length, boolean commit) throws StreamCopyException { if (data == null) { init(); } if (length == -1) { length = Long.MAX_VALUE; } long bytesReceived = 0; // Now directly write to the buffers boolean done = false; while (!done) { // Don't get more than will fit in the current buffer int len = (int) Math.min(BUFFER_SIZE - index, length-bytesReceived); // Now get the bytes int bytesRead; try { bytesRead = in.read(currBuffer, index, len); } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.READ, ex); } if (bytesRead >= 0) { bytesReceived += bytesRead; index += bytesRead; if (index >= BUFFER_SIZE) { addBuffer(); } if (bytesReceived >= length) { done = true; } } else { done = true; } } committed = commit; return bytesReceived; } public long readFrom(InputStream in, long length) throws StreamCopyException { return readFrom(in, length, data == null); } public InputStream getInputStream() throws IOException { return new InputStreamImpl(); } public void writeTo(OutputStream os) throws StreamCopyException { int size = (int)getLength(); if (data != null) { try { int numBuffers = data.size(); for (int j = 0; j < numBuffers-1; j ++) { os.write( (byte[]) data.get(j), 0, BUFFER_SIZE); } if (numBuffers > 0) { int writeLimit = size - ((numBuffers-1) * BUFFER_SIZE); os.write( (byte[]) data.get(numBuffers-1), 0, writeLimit); } } catch (IOException ex) { throw new StreamCopyException(StreamCopyException.WRITE, ex); } } } public void release() { // no-op } } ./src/org/apache/axiom/util/blob/BlobOutputStream.java0000664000175000017500000000301211767656530022126 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.io.ReadFromSupport; import org.apache.axiom.ext.io.StreamCopyException; /** * Output stream that is used to write to a blob. Instances of this class are returned by the * {@link WritableBlob#getOutputStream()} method. */ public abstract class BlobOutputStream extends OutputStream implements ReadFromSupport { /** * Get the blob to which this output stream belongs. * * @return the blob */ public abstract WritableBlob getBlob(); public long readFrom(InputStream inputStream, long length) throws StreamCopyException { return getBlob().readFrom(inputStream, length); } } ./src/org/apache/axiom/util/blob/package.html0000664000175000017500000000227311767656530020301 0ustar brianbrian Contains utility classes to work with binary data. They are typically used to store data temporarily and often provide a better alternative than using {@link java.io.ByteArrayOutputStream} and {@link java.io.ByteArrayInputStream}.

        Note that the API in this package is new in 1.2.9 and may undergo some changes in subsequent releases. Please use with care! ./src/org/apache/axiom/util/blob/Blob.java0000664000175000017500000000422611767656530017541 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.io.StreamCopyException; /** * Stores binary data. *

        * Not that blobs are not thread safe. While they support requesting multiple concurrent input * streams, these streams must be used in the same thread, unless appropriate synchronization or * locking is done. */ public interface Blob { /** * Get an input stream to read the data in the blob. * * @return the input stream to read the data from * @throws IOException */ InputStream getInputStream() throws IOException; /** * Write the data to a given output stream. * * @param out * The output stream to write the data to. This method will not close the stream. * @throws StreamCopyException * Thrown if there is an I/O when reading the data from the blob or when writing it * to the stream. {@link StreamCopyException#getOperation()} can be used to * determine whether the failed operation was a read or a write. */ void writeTo(OutputStream out) throws StreamCopyException; /** * Get the length of the data in the blob, i.e. the number of bytes. * * @return the length of the data in the blob */ long getLength(); }./src/org/apache/axiom/util/blob/WritableBlob.java0000664000175000017500000001723311767656530021235 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.io.StreamCopyException; /** * A writable blob. *

        * The behavior of the methods defined by this interface is described in terms of three logical * states the blob can be in: *

        *
        NEW *
        The blob has just been created and no data has been written to it yet. *
        UNCOMMITTED *
        Data is being written to the blob. *
        COMMITTED *
        All data has been written to the blob and the blob will no longer accept any new data. *
        * Whether or not reading data from the blob if is in state NEW or UNCOMMITTED depends on the * return value of {@link #isSupportingReadUncommitted()}. *

        * Blobs are not thread safe. */ public interface WritableBlob extends Blob { /** * Determine whether the blob supports reading in state NEW or UNCOMMITTED. If this method * returns false and the blob is in state NEW or UNCOMMITTED, any call to a method * defined by the {@link Blob} superinterface will result in an {@link IllegalStateException}. * If this method returns true, then any data written to the blob will be * immediately available for reading. This is also true for an input stream obtained from * {@link Blob#getInputStream()} before the data is written. This implies that it is possible * for the input stream to first report the end of the stream and later allow reading additional * data. Therefore, a pair of streams obtained from {@link #getOutputStream()} and * {@link Blob#getInputStream()} behaves differently than a {@link java.io.PipedOutputStream} * and {@link java.io.PipedInputStream} pair, because in this situation * {@link java.io.PipedInputStream} would block. * * @return true if the blob allows reading the data in state NEW or UNCOMMITTED; * false if the blob allows read operations only in state COMMITTED */ boolean isSupportingReadUncommitted(); /** * Create an output stream to write data to the blob. *

        * Precondition: The blob is in state NEW. *

        * Postcondition: The blob is in state UNCOMMITTED. *

        * Note that the pre- and postconditions imply that this method may be called at most once for * a given blob instance. *

        * Calls to methods of the returned output stream will modify the state of the blob * according to the following rules: *

          *
        • A call to {@link OutputStream#close()} will change the state to COMMITTED. *
        • Calls to other methods will not modify the state of the blob. They will result in * an {@link IOException} if the state is COMMITTED, i.e. if the stream has already been * closed. *
        * * @return an output stream that can be used to write data to the blob * * @throws IllegalStateException if the blob is not in state NEW */ BlobOutputStream getOutputStream(); /** * Read data from the given input stream and write it to the blob. *

        * A call to this method has the same effect as requesting an output stream using * {@link #getOutputStream()} and copying the data from the input stream to that * output stream, but the implementation will achieve this result in a more efficient way. *

        * Precondition: The blob is in state NEW or UNCOMMITTED. *

        * Postcondition: The blob is in state UNCOMMITTED if commit is * false. It is in state COMMITTED if commit is true. *

        * The precondition implies that this method may be used after a call to * {@link #getOutputStream()}. In that case it is illegal to set commit to * true (because this would invalidate the state of the output stream). *

        * The method transfers data from the input stream to the blob until one of the following * conditions is met: *

          *
        • The end of the input stream is reached. *
        • The value of the length argument is different from -1 * and the number of bytes transferred is equal to length. *
        * * @param in An input stream to read data from. This method will not * close the stream. * @param length the number of bytes to transfer, or -1 if the method should * transfer data until the end of the input stream is reached * @param commit indicates whether the blob should be in state COMMITTED after the operation * @return the number of bytes transferred * @throws StreamCopyException * @throws IllegalStateException if the blob is in state COMMITTED or if * {@link #getOutputStream()} has been called before and commit is * true */ long readFrom(InputStream in, long length, boolean commit) throws StreamCopyException; /** * Read data from the given input stream and write it to the blob. *

        * This method is similar to {@link #readFrom(InputStream, long, boolean)}, except that the state * of the blob after the invocation (i.e. the commit argument) is determined * automatically: *

        * * * * * * * * * *
        Precondition (state)Postcondition (state)
        NEWCOMMITTED
        UNCOMMITTEDUNCOMMITTED
        COMMITTEDillegal
        *

        * There are thus two usage patterns for this method: *

          *
        1. The method is used to fill the blob with the data from an input stream, but no other * data is written to the blob. *
        2. The method is used in parallel with the output stream returned by * {@link #getOutputStream()}: some data is written using the output stream and some * data is written using this method (for efficiency reasons). *
        * * @param in An input stream to read data from. This method will not * close the stream. * @param length the number of bytes to transfer, or -1 if the method should * transfer data until the end of the input stream is reached * @return the number of bytes transferred * @throws StreamCopyException * @throws IllegalStateException if the blob is in state COMMITTED */ long readFrom(InputStream in, long length) throws StreamCopyException; /** * Release all resources held by this blob. */ void release(); } ./src/org/apache/axiom/util/blob/BlobDataSource.java0000664000175000017500000000327711767656530021521 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.blob; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.axiom.ext.activation.SizeAwareDataSource; /** * Data source backed by a {@link Blob}. */ public class BlobDataSource implements SizeAwareDataSource { private final Blob blob; private final String contentType; public BlobDataSource(Blob blob, String contentType) { this.blob = blob; this.contentType = contentType; } public InputStream getInputStream() throws IOException { return blob.getInputStream(); } public String getContentType() { return contentType; } public String getName() { return null; } public OutputStream getOutputStream() throws IOException { throw new UnsupportedOperationException(); } public long getSize() { return blob.getLength(); } } ./src/org/apache/axiom/util/package.html0000664000175000017500000000207511767656530017363 0ustar brianbrian Contains utility classes not depending on the Axiom API. This package and all its subpackages are meant to contain utility classes that have no dependencies on the rest of the Axiom API, except for org.apache.axiom.ext. ./src/org/apache/axiom/util/namespace/0000775000175000017500000000000011767656530017032 5ustar brianbrian./src/org/apache/axiom/util/namespace/AbstractNamespaceContext.java0000664000175000017500000001033711767656530024626 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.namespace; import java.util.Collections; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; /** * Partial {@link NamespaceContext} implementation that takes care of the * implicit namespace bindings (for the xml and xmlns * prefixes) defined in the {@link NamespaceContext} Javadoc. */ public abstract class AbstractNamespaceContext implements NamespaceContext { public final String getNamespaceURI(String prefix) { if (prefix == null) { throw new IllegalArgumentException("prefix can't be null"); } else if (prefix.equals(XMLConstants.XML_NS_PREFIX)) { return XMLConstants.XML_NS_URI; } else if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) { return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; } else { return doGetNamespaceURI(prefix); } } /** * Get namespace URI bound to a prefix in the current scope. The contract of * this method is the same as * {@link NamespaceContext#getNamespaceURI(String)}, except that the * implementation is not required to handle the implicit namespace bindings. * * @param prefix * prefix to look up * @return namespace URI bound to prefix in the current scope */ protected abstract String doGetNamespaceURI(String prefix); public final String getPrefix(String namespaceURI) { if (namespaceURI == null) { throw new IllegalArgumentException("namespaceURI can't be null"); } else if (namespaceURI.equals(XMLConstants.XML_NS_URI)) { return XMLConstants.XML_NS_PREFIX; } else if (namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { return XMLConstants.XMLNS_ATTRIBUTE; } else { return doGetPrefix(namespaceURI); } } /** * Get prefix bound to namespace URI in the current scope. The contract of * this method is the same as {@link NamespaceContext#getPrefix(String)}, * except that the implementation is not required to handle the implicit * namespace bindings. * * @param namespaceURI * URI of namespace to lookup * @return prefix bound to namespace URI in current context */ protected abstract String doGetPrefix(String namespaceURI); public final Iterator getPrefixes(String namespaceURI) { if (namespaceURI == null) { throw new IllegalArgumentException("namespaceURI can't be null"); } else if (namespaceURI.equals(XMLConstants.XML_NS_URI)) { return Collections.singleton(XMLConstants.XML_NS_PREFIX).iterator(); } else if (namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { return Collections.singleton(XMLConstants.XMLNS_ATTRIBUTE).iterator(); } else { return doGetPrefixes(namespaceURI); } } /** * Get all prefixes bound to a namespace URI in the current scope. The * contract of this method is the same as * {@link NamespaceContext#getPrefixes(String)}, except that the * implementation is not required to handle the implicit namespace bindings. * * @param namespaceURI * URI of namespace to lookup * @return iterator for all prefixes bound to the namespace URI in the * current scope */ protected abstract Iterator doGetPrefixes(String namespaceURI); } ./src/org/apache/axiom/util/namespace/MapBasedNamespaceContext.java0000664000175000017500000000523511767656530024540 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.namespace; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.xml.XMLConstants; /** * Namespace context implementation that stores namespace bindings in a {@link Map}. */ public class MapBasedNamespaceContext extends AbstractNamespaceContext { protected Map namespaces; public MapBasedNamespaceContext(Map map) { namespaces = map; } protected String doGetNamespaceURI(String prefix) { String namespaceURI = (String)namespaces.get(prefix); return namespaceURI == null ? XMLConstants.NULL_NS_URI : namespaceURI; } protected String doGetPrefix(String nsURI) { Iterator iter = namespaces.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getValue(); if (uri.equals(nsURI)) { return (String) entry.getKey(); } } if (nsURI.length() == 0) { return ""; } return null; } protected Iterator doGetPrefixes(String nsURI) { Set prefixes = null; Iterator iter = namespaces.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getValue(); if (uri.equals(nsURI)) { if (prefixes == null) { prefixes = new HashSet(); } prefixes.add(entry.getKey()); } } if (prefixes != null) { return Collections.unmodifiableSet(prefixes).iterator(); } else if (nsURI.length() == 0) { return Collections.singleton("").iterator(); } else { return Collections.EMPTY_LIST.iterator(); } } }./src/org/apache/axiom/util/namespace/package.html0000664000175000017500000000171511767656530021317 0ustar brianbrian Contains utility classes to work with {@link javax.xml.namespace.NamespaceContext} and {@link javax.xml.namespace.QName}. ./src/org/apache/axiom/util/namespace/ScopedNamespaceContext.java0000664000175000017500000001470111767656530024277 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.util.namespace; import java.util.Iterator; import java.util.NoSuchElementException; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; /** * {@link NamespaceContext} implementation that supports nested scopes. A scope is typically * associated with a start tag / end tag pair. The implementation takes care of correctly * handling masked namespace bindings. Masking occurs when the same prefix is bound to a different * namespace URI in a nested scope. */ public class ScopedNamespaceContext extends AbstractNamespaceContext { /** * Array containing the prefixes for the namespace bindings. */ String[] prefixArray = new String[16]; /** * Array containing the URIs for the namespace bindings. */ String[] uriArray = new String[16]; /** * The number of currently defined namespace bindings. */ int bindings; /** * Tracks the scopes defined for this namespace context. Each entry in the array identifies * the first namespace binding defined in the corresponding scope and points to an entry * in {@link #prefixArray}/{@link #uriArray}. */ private int[] scopeIndexes = new int[16]; /** * The number of currently defined scopes. This is the same as the depth of the current scope, * where the depth of the root scope is 0. */ private int scopes; /** * Define a prefix binding in the current scope. It will be visible in the current scope as * well as each nested scope, unless the prefix is bound to a different namespace URI in that * scope. * * @param prefix the prefix to bind or the empty string to set the default namespace; may not * be null * @param namespaceURI the corresponding namespace URI; may not be null */ public void setPrefix(String prefix, String namespaceURI) { if (prefix == null || namespaceURI == null) { throw new IllegalArgumentException("prefix and namespaceURI may not be null"); } if (bindings == prefixArray.length) { int len = prefixArray.length; int newLen = len*2; String[] newPrefixArray = new String[newLen]; System.arraycopy(prefixArray, 0, newPrefixArray, 0, len); String[] newUriArray = new String[newLen]; System.arraycopy(uriArray, 0, newUriArray, 0, len); prefixArray = newPrefixArray; uriArray = newUriArray; } prefixArray[bindings] = prefix; uriArray[bindings] = namespaceURI; bindings++; } /** * Start a new scope. Since scopes are nested, this will not end the current scope. */ public void startScope() { if (scopes == scopeIndexes.length) { int[] newScopeIndexes = new int[scopeIndexes.length*2]; System.arraycopy(scopeIndexes, 0, newScopeIndexes, 0, scopeIndexes.length); scopeIndexes = newScopeIndexes; } scopeIndexes[scopes++] = bindings; } /** * End the current scope and restore the scope in which the current scope was nested. * This will remove all prefix bindings declared since the corresponding invocation * of the {@link #startScope()} method. */ public void endScope() { bindings = scopeIndexes[--scopes]; } protected String doGetNamespaceURI(String prefix) { for (int i=bindings-1; i>=0; i--) { if (prefix.equals(prefixArray[i])) { return uriArray[i]; } } // The Javadoc of NamespaceContext#getNamespaceURI specifies that XMLConstants.NULL_NS_URI // is returned both for unbound prefixes and the null namespace return XMLConstants.NULL_NS_URI; } protected String doGetPrefix(String namespaceURI) { outer: for (int i=bindings-1; i>=0; i--) { if (namespaceURI.equals(uriArray[i])) { String prefix = prefixArray[i]; // Now check that the prefix is not masked for (int j=i+1; j= 0) { if (namespaceURI.equals(uriArray[binding])) { String prefix = prefixArray[binding]; // Now check that the prefix is not masked for (int j=binding+1; jSOAPHeaderBlock
        object initialized with the specified name and * adds it to this SOAPHeader object. * * @param localName * @param ns * @return the new SOAPHeaderBlock object that was inserted into this * SOAPHeader object * @throws org.apache.axiom.om.OMException * if a SOAP error occurs */ SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException; /** * Get the appropriate set of headers for a RolePlayer. * * The RolePlayer indicates whether it is the ultimate destination (in which case * headers with no role or the explicit UltimateDestination role will be included), * and any non-standard roles it supports. Headers targeted to "next" will always * be included, and those targeted to "none" (for SOAP 1.2) will never be included. * * @return an Iterator over all the HeaderBlocks this RolePlayer should process. */ Iterator getHeadersToProcess(RolePlayer rolePlayer); /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified role. An role is a global * attribute that indicates the intermediate parties to whom the message should be sent. An role * receives the message and then sends it to the next role. The default role is the ultimate * intended recipient for the message, so if no role attribute is included in a * SOAPHeader object, the message is sent to its ultimate destination. * * @param role a String giving the URI of the role for which to search * @return Returns an Iterator object over all the SOAPHeaderBlock * objects that contain the specified role * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String) */ Iterator examineHeaderBlocks(String role); /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified role and detaches them from this * SOAPHeader object. *

        * This method allows an role to process only the parts of the SOAPHeader object * that apply to it and to remove them before passing the message on to the next role. * * @param role a String giving the URI of the role for which to search * @return Returns an Iterator object over all the SOAPHeaderBlock * objects that contain the specified role * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String) */ Iterator extractHeaderBlocks(String role); /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object that have the specified role and that have a MustUnderstand * attribute whose value is equivalent to true. * * @param role a String giving the URI of the role for which to search * @return Returns an Iterator object over all the SOAPHeaderBlock * objects that contain the specified role and are marked as MustUnderstand. */ Iterator examineMustUnderstandHeaderBlocks(String role); /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object. * * @return an Iterator object over all the SOAPHeaderBlock objects * contained by this SOAPHeader. If there are no header blocks then an * empty iterator is returned. */ Iterator examineAllHeaderBlocks(); /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object and detaches them from this SOAPHeader object. * * @return Returns an Iterator object over all the SOAPHeaderBlock * objects contained by this SOAPHeader */ Iterator extractAllHeaderBlocks(); /** * Return all the Headers that has the Namespace URI to given NS URI. * * @param nsURI * @return Returns ArrayList. */ ArrayList getHeaderBlocksWithNSURI(String nsURI); /** * Get the appropriate set of headers for a RolePlayer in a particular namespace *

        * The RolePlayer indicates whether it is the ultimate destination (in which case headers with * no role or the explicit UltimateDestination role will be included), and any non-standard * roles it supports. Headers targeted to "next" will always be included, and those targeted to * "none" (for SOAP 1.2) will never be included. *

        * This version of the API allows us to iterate only once over the headers searching for * a particular namespace for headers targeted at "us". * * @param rolePlayer a RolePlayer containing our role configuration * @param namespace if specified, we'll only return headers from this namespace * @return an Iterator over all the HeaderBlocks this RolePlayer should process. */ Iterator getHeadersToProcess(RolePlayer rolePlayer, String namespace); } ./src/org/apache/axiom/soap/SOAPFaultSubCode.java0000664000175000017500000000160511767656530020733 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; public interface SOAPFaultSubCode extends SOAPFaultClassifier { } ./src/org/apache/axiom/soap/impl/0000775000175000017500000000000011767656530016024 5ustar brianbrian./src/org/apache/axiom/soap/impl/llom/0000775000175000017500000000000011767656530016767 5ustar brianbrian./src/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java0000664000175000017500000004035511767656530022336 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.RolePlayer; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * A local interface we can use to make "header checker" objects which can be used by * HeaderIterators to filter results. This really SHOULD be done with anonymous classes: *

        * public void getHeadersByRole(final String role) { * return new HeaderIterator() { * public boolean checkHeader(SOAPHeaderBlock header) { * ... * if (role.equals(headerRole)) return true; * return false; * } * } * } *

        * ...but there appears to be some kind of weird problem with the JVM not correctly scoping the * passed "role" value in a situation like the above. As such, we have to make Checker objects * instead (sigh). */ interface Checker { boolean checkHeader(SOAPHeaderBlock header); } /** * A Checker to make sure headers match a given role. If the role we're looking for is null, then * everything matches. */ class RoleChecker implements Checker { String role; public RoleChecker(String role) { this.role = role; } public boolean checkHeader(SOAPHeaderBlock header) { if (role == null) { return true; } String thisRole = header.getRole(); return (role.equals(thisRole)); } } /** * This Checker uses a RolePlayer to return the appropriate headers for that RolePlayer to process. * Ignore "none", always "next", etc. */ class RolePlayerChecker implements Checker { RolePlayer rolePlayer; /** Optional namespace - if non-null we'll only return headers that match */ String namespace; /** * Constructor. * * @param rolePlayer the RolePlayer to check against. This can be null, in which * case we assume we're the ultimate destination. */ public RolePlayerChecker(RolePlayer rolePlayer) { this.rolePlayer = rolePlayer; } public RolePlayerChecker(RolePlayer rolePlayer, String namespace) { this.rolePlayer = rolePlayer; this.namespace = namespace; } public boolean checkHeader(SOAPHeaderBlock header) { // If we're filtering on namespace, check that first since the compare is simpler. if (namespace != null) { OMNamespace headerNamespace = header.getNamespace(); if (headerNamespace == null || !namespace.equals(headerNamespace.getNamespaceURI())) { return false; } } String role = header.getRole(); SOAPVersion version = header.getVersion(); // 1. If role is ultimatedest, go by what the rolePlayer says if (role == null || role.equals("") || (version instanceof SOAP12Version && role.equals(SOAP12Constants.SOAP_ROLE_ULTIMATE_RECEIVER))) { return (rolePlayer == null || rolePlayer.isUltimateDestination()); } // 2. If role is next, always return true if (role.equals(version.getNextRoleURI())) return true; // 3. If role is none, always return false if (version instanceof SOAP12Version && role.equals(SOAP12Constants.SOAP_ROLE_NONE)) { return false; } // 4. Return t/f depending on match List roles = (rolePlayer == null) ? null : rolePlayer.getRoles(); if (roles != null) { for (Iterator i = roles.iterator(); i.hasNext();) { String thisRole = (String) i.next(); if (thisRole.equals(role)) return true; } } return false; } } /** A Checker to see that we both match a given role AND are mustUnderstand=true */ class MURoleChecker extends RoleChecker { public MURoleChecker(String role) { super(role); } public boolean checkHeader(SOAPHeaderBlock header) { if (header.getMustUnderstand()) return super.checkHeader(header); return false; } } /** A class representing the SOAP Header, primarily allowing access to the contained HeaderBlocks. */ public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader { static Log log = LogFactory.getLog(SOAPHeaderImpl.class); /** An Iterator which walks the header list as needed, potentially filtering as we traverse. */ class HeaderIterator implements Iterator { SOAPHeaderBlock current; boolean advance = false; Checker checker; public HeaderIterator() { this(null); } public HeaderIterator(Checker checker) { this.checker = checker; current = (SOAPHeaderBlock) getFirstElement(); if (current != null) { if (!checkHeader(current)) { advance = true; hasNext(); } } } public void remove() { } public boolean checkHeader(SOAPHeaderBlock header) { if (checker == null) return true; return checker.checkHeader(header); } public boolean hasNext() { if (!advance) { return current != null; } advance = false; OMNode sibling = current.getNextOMSibling(); while (sibling != null) { if (sibling instanceof SOAPHeaderBlock) { SOAPHeaderBlock possible = (SOAPHeaderBlock) sibling; if (checkHeader(possible)) { current = (SOAPHeaderBlock) sibling; return true; } } sibling = sibling.getNextOMSibling(); } current = null; return false; } public Object next() { SOAPHeaderBlock ret = current; if (ret != null) { advance = true; hasNext(); } return ret; } } protected SOAPHeaderImpl(OMNamespace ns, SOAPFactory factory) { super(SOAPConstants.HEADER_LOCAL_NAME, ns, factory); } public SOAPHeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, SOAPConstants.HEADER_LOCAL_NAME, true, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory); } /** * Creates a new SOAPHeaderBlock object initialized with the specified name and * adds it to this SOAPHeader object. * * @param localName * @param ns * @return the new SOAPHeaderBlock object that was inserted into this * SOAPHeader object * @throws org.apache.axiom.om.OMException * if a SOAP error occurs * @throws OMException */ public abstract SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException; /** * Get the appropriate set of headers for a RolePlayer. *

        * The RolePlayer indicates whether it is the ultimate destination (in which case headers with * no role or the explicit UltimateDestination role will be included), and any non-standard * roles it supports. Headers targeted to "next" will always be included, and those targeted to * "none" (for SOAP 1.2) will never be included. * * @return an Iterator over all the HeaderBlocks this RolePlayer should process. */ public Iterator getHeadersToProcess(RolePlayer rolePlayer) { return new HeaderIterator(new RolePlayerChecker(rolePlayer)); } /** * Get the appropriate set of headers for a RolePlayer. *

        * The RolePlayer indicates whether it is the ultimate destination (in which case headers with * no role or the explicit UltimateDestination role will be included), and any non-standard * roles it supports. Headers targeted to "next" will always be included, and those targeted to * "none" (for SOAP 1.2) will never be included. * * @param rolePlayer a RolePlayer containing our role configuration * @param namespace if specified, we'll only return headers from this namespace * @return an Iterator over all the HeaderBlocks this RolePlayer should process. */ public Iterator getHeadersToProcess(RolePlayer rolePlayer, String namespace) { return new HeaderIterator(new RolePlayerChecker(rolePlayer, namespace)); } /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified actor. An actor is a global * attribute that indicates the intermediate parties to whom the message should be sent. An * actor receives the message and then sends it to the next actor. The default actor is the * ultimate intended recipient for the message, so if no actor attribute is included in a * SOAPHeader object, the message is sent to its ultimate destination. * * @param role a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified actor * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String) */ public Iterator examineHeaderBlocks(final String role) { return new HeaderIterator(new RoleChecker(role)); } /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified role and detaches them from this * SOAPHeader object.

        This method allows an role to process only the parts of * the SOAPHeader object that apply to it and to remove them before passing the * message on to the next role. * * @param role a String giving the URI of the role for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified role * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String) */ public abstract Iterator extractHeaderBlocks(String role); /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object that have the specified actor and that have a MustUnderstand * attribute whose value is equivalent to true. * * @param actor a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified actor and are marked as MustUnderstand */ public Iterator examineMustUnderstandHeaderBlocks(final String actor) { return new HeaderIterator(new MURoleChecker(actor)); } /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object. Not that this will return elements containing the QName * (http://schemas.xmlsoap.org/soap/envelope/, Header) * * @return an Iterator object over all the SOAPHeaderBlock objects * contained by this SOAPHeader */ public Iterator examineAllHeaderBlocks() { class DefaultChecker implements Checker { public boolean checkHeader(SOAPHeaderBlock header) { return true; } } return new HeaderIterator(new DefaultChecker()); } /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object and detaches them from this SOAPHeader object. * * @return an Iterator object over all the SOAPHeaderBlock objects * contained by this SOAPHeader */ public Iterator extractAllHeaderBlocks() { throw new UnsupportedOperationException(); // TODO implement this } public ArrayList getHeaderBlocksWithNSURI(String nsURI) { ArrayList headers = null; OMNode node; OMElement header = this.getFirstElement(); if (header != null) { headers = new ArrayList(); } node = header; while (node != null) { if (node.getType() == OMNode.ELEMENT_NODE) { header = (OMElement) node; OMNamespace namespace = header.getNamespace(); if (nsURI == null) { if (namespace == null) { headers.add(header); } } else { if (namespace != null) { if (nsURI.equals(namespace.getNamespaceURI())) { headers.add(header); } } } } node = node.getNextOMSibling(); } return headers; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAPEnvelopeImpl)) { throw new SOAPProcessingException( "Expecting an implementation of SOAP Envelope as the parent. But received some other implementation"); } } public void addChild(OMNode child) { // Make sure a proper element is added. The children of a SOAPHeader should be // SOAPHeaderBlock objects. // Due to legacy usages (AXIS2 has a lot of tests that violate this constraint) // I am only going to log an exception when debug is enabled. if (log.isDebugEnabled()) { if (child instanceof OMElement && !(child instanceof SOAPHeaderBlock)) { Exception e = new SOAPProcessingException( "An attempt was made to add a normal OMElement as a child of a SOAPHeader." + " This is not supported. The child should be a SOAPHeaderBlock."); log.debug(exceptionToString(e)); } } super.addChild(child); } public static String exceptionToString(Throwable e) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); return text; } } ./src/org/apache/axiom/soap/impl/llom/soap11/0000775000175000017500000000000011767656530020073 5ustar brianbrian./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java0000664000175000017500000000611011767656530024626 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultReasonImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultReasonImpl extends SOAPFaultReasonImpl { /** Eran Chinthaka (chinthaka@apache.org) */ public SOAP11FaultReasonImpl(SOAPFactory factory) { super(null, factory); } public SOAP11FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP11FaultReasonImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); } public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException { throw new UnsupportedOperationException("addSOAPText() not allowed for SOAP 1.1!"); } public SOAPFaultText getFirstSOAPText() { throw new UnsupportedOperationException("getFirstSOAPText() not allowed for SOAP 1.1!"); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultImpl, got " + parent.getClass()); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); // Special syntax OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } public String getLocalName() { return SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME; } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java0000664000175000017500000000474311767656530024312 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultRoleImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultRoleImpl extends SOAPFaultRoleImpl { public SOAP11FaultRoleImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); } public SOAP11FaultRoleImpl(SOAPFactory factory) { super(null, factory); } public SOAP11FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultImpl, got " + parent.getClass()); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11Factory.java0000664000175000017500000003050111767656530023171 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory; import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP11Version; import org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl; import org.apache.axiom.soap.impl.llom.SOAPMessageImpl; /** */ public class SOAP11Factory extends OMLinkedListImplFactory implements SOAPFactory { public SOAP11Factory(OMLinkedListMetaFactory metaFactory) { super(metaFactory); } public SOAP11Factory() { } public OMNamespace getNamespace() { return new OMNamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); } public String getSoapVersionURI() { return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } public SOAPVersion getSOAPVersion() { return SOAP11Version.getSingleton(); } public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new OMNamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); } public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) { return new SOAPEnvelopeImpl(ns, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP11HeaderImpl(envelope, this); } public SOAPHeader createSOAPHeader() throws SOAPProcessingException { return new SOAP11HeaderImpl(this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP11HeaderImpl(envelope, builder, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, parent, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, OMDataSource ds) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, this, ds); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, parent, builder, this); } public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException { return new SOAP11FaultImpl(parent, e, this); } public SOAPFault createSOAPFault() throws SOAPProcessingException { return new SOAP11FaultImpl(this); } public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException { return new SOAP11FaultImpl(parent, this); } public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) { return new SOAP11FaultImpl(parent, builder, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP11BodyImpl(envelope, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP11BodyImpl(envelope, builder, this); } public SOAPBody createSOAPBody() throws SOAPProcessingException { return new SOAP11BodyImpl(this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultCodeImpl(parent, this); } public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException { return new SOAP11FaultCodeImpl(this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultCodeImpl(parent, builder, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP11FaultValueImpl(parent, this); } public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException { return new SOAP11FaultValueImpl(this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultValueImpl(parent, builder, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP11FaultValueImpl(parent, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultValueImpl(parent, builder, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP11FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException { return new SOAP11FaultSubCodeImpl(this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultSubCodeImpl(parent, builder, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP11FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultSubCodeImpl(parent, builder, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultReasonImpl(parent, this); } public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException { return new SOAP11FaultReasonImpl(this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultReasonImpl(parent, builder, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException { return new SOAP11FaultTextImpl(parent, this); } public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException { return new SOAP11FaultTextImpl(this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) { return new SOAP11FaultTextImpl(parent, builder, this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultRoleImpl(parent, this); } public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException { return new SOAP11FaultRoleImpl(this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultRoleImpl(parent, builder, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultDetailImpl(parent, this); } public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException { return new SOAP11FaultDetailImpl(this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultDetailImpl(parent, builder, this); } public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new OMNamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; } public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException { SOAPEnvelope defaultEnvelope = getDefaultEnvelope(); SOAPFault fault = createSOAPFault(defaultEnvelope.getBody()); SOAPFaultCode faultCode = createSOAPFaultCode(fault); SOAPFaultReason reason = createSOAPFaultReason(fault); //createSOAPFaultText(reason); createSOAPFaultDetail(fault); return defaultEnvelope; } public SOAPMessage createSOAPMessage() { return new SOAPMessageImpl(this); } public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) { return new SOAPMessageImpl(builder, this); } public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) { return new SOAPMessageImpl(envelope, parserWrapper, this); } public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) { return new SOAPEnvelopeImpl(builder, this); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11BodyImpl.java0000664000175000017500000000400311767656530023277 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPBodyImpl; public class SOAP11BodyImpl extends SOAPBodyImpl { /** @param envelope */ public SOAP11BodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } public SOAP11BodyImpl(SOAPFactory factory) throws SOAPProcessingException { super(SOAPConstants.BODY_LOCAL_NAME, factory.getNamespace(), factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPFault addFault(Exception e) throws OMException { return ((SOAP11Factory) this.factory).createSOAPFault(this, e); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java0000664000175000017500000000713611767656530024734 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultSubCodeImpl; public class SOAP11FaultSubCodeImpl extends SOAPFaultSubCodeImpl { public SOAP11FaultSubCodeImpl(SOAPFactory factory) { super(null, factory); } //changed public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } //changed public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP11FaultSubCodeImpl or SOAP11FaultCodeImpl, got " + parent.getClass()); } } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP11FaultSubCodeImpl or SOAP11FaultCodeImpl, got " + subCode.getClass()); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { if (!(soapFaultSubCodeValue instanceof SOAP11FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultValueImpl, got " + soapFaultSubCodeValue.getClass()); } super.setValue(soapFaultSubCodeValue); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultTextImpl.java0000664000175000017500000000400311767656530024322 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultTextImpl; public class SOAP11FaultTextImpl extends SOAPFaultTextImpl { public SOAP11FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP11FaultTextImpl(SOAPFactory factory) throws SOAPProcessingException { super((OMNamespace) null, factory); } public SOAP11FaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultReasonImpl, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java0000664000175000017500000000733011767656530024256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultCodeImpl extends SOAPFaultCodeImpl { public SOAP11FaultCodeImpl(SOAPFactory factory) { super(SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, null, factory); } public SOAP11FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, builder, factory); } public SOAP11FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, false, factory); } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP11FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultSubCodeImpl, got " + subCode.getClass()); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue value) throws SOAPProcessingException { if (!(value instanceof SOAP11FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultValueImpl, got " + value.getClass()); } super.setValue(value); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultImpl, got " + parent.getClass()); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } public String getLocalName() { return SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME; } public SOAPFaultValue getValue() { return null; // throw new UnsupportedOperationException("getValue() not supported for SOAP 1.1 faults"); } public SOAPFaultSubCode getSubCode() { return null; // throw new UnsupportedOperationException("getSubCode() not supported for SOAP 1.1 faults"); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java0000664000175000017500000001467211767656530024562 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP11Version; import org.apache.axiom.soap.impl.llom.SOAPHeaderBlockImpl; public class SOAP11HeaderBlockImpl extends SOAPHeaderBlockImpl { public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory, OMDataSource ds) { super(localName, ns, factory, ds); } /** * @param localName * @param ns */ public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super(localName, ns, parent, factory); checkParent(parent); } /** * Constructor SOAPHeaderBlockImpl * * @param localName * @param ns * @param parent * @param builder */ public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, ns, parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11HeaderImpl)) { throw new SOAPProcessingException( "Expecting SOAP11HeaderImpl, got " + parent.getClass()); } } public void setRole(String roleURI) { setAttribute(SOAP11Constants.ATTR_ACTOR, roleURI, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public String getRole() { // Get the property or attribute String val; if (this.hasOMDataSourceProperty(ROLE_PROPERTY)) { val = this.getOMDataSourceProperty(ROLE_PROPERTY); } else { val = getAttribute(SOAP11Constants.ATTR_ACTOR, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } return val; } public void setMustUnderstand(boolean mustUnderstand) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? "1" : "0", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else { throw new SOAPProcessingException( "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" "); } } /** * Returns whether the mustUnderstand attribute for this SOAPHeaderBlock object is * turned on. * * @return true if the mustUnderstand attribute of this * SOAPHeaderBlock object is turned on; false otherwise */ public boolean getMustUnderstand() throws SOAPProcessingException { // First, try getting the information from the property // Fallback to getting the information from the attribute String mustUnderstand; if (this.hasOMDataSourceProperty(MUST_UNDERSTAND_PROPERTY)) { mustUnderstand = this.getOMDataSourceProperty(MUST_UNDERSTAND_PROPERTY); } else { mustUnderstand = getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } // Parse the value if (mustUnderstand != null) { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { return true; } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand)) { return false; } else { throw new SOAPProcessingException( "Invalid value found in mustUnderstand value of " + this.getLocalName() + " header block"); } } return false; } public void setRelay(boolean relay) { throw new UnsupportedOperationException("Not supported for SOAP 1.1"); } public boolean getRelay() { throw new UnsupportedOperationException("Not supported for SOAP 1.1"); } public SOAPVersion getVersion() { return SOAP11Version.getSingleton(); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultValueImpl.java0000664000175000017500000000425211767656530024460 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultValueImpl; public class SOAP11FaultValueImpl extends SOAPFaultValueImpl { public SOAP11FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, parent, factory); } public SOAP11FaultValueImpl(SOAPFactory factory) throws SOAPProcessingException { super((OMNamespace) null, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, factory); } public SOAP11FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP11FaultSubCodeImpl or SOAP11FaultCodeImpl, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.java0000664000175000017500000001155511767656530023467 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultImpl extends SOAPFaultImpl { /** Eran Chinthaka (chinthaka@apache.org) */ public SOAP11FaultImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } public SOAP11FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, e, factory); } public SOAP11FaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** * This is a convenience method for the SOAP Fault Impl. * * @param parent */ public SOAP11FaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException { return new SOAP11FaultDetailImpl(fault, (SOAPFactory) this.factory); } public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultCodeImpl, got " + soapFaultCode.getClass()); } super.setCode(soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { if (!(reason instanceof SOAP11FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultReasonImpl, got " + reason.getClass()); } super.setReason(reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { if (!(role instanceof SOAP11FaultRoleImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultRoleImpl, got " + role.getClass()); } super.setRole(role); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11BodyImpl)) { throw new SOAPProcessingException( "Expecting SOAP11BodyImpl, got " + parent.getClass()); } } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { if (!(detail instanceof SOAP11FaultDetailImpl)) { throw new SOAPProcessingException( "Expecting SOAP11FaultDetailImpl, got " + detail.getClass()); } super.setDetail(detail); } protected void serializeFaultNode(XMLStreamWriter writer) throws XMLStreamException { } public SOAPFaultCode getCode() { return (SOAPFaultCode) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_CODE); } public SOAPFaultReason getReason() { return (SOAPFaultReason) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_REASON); } public SOAPFaultNode getNode() { return null; } public SOAPFaultRole getRole() { return (SOAPFaultRole) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_ROLE); } public SOAPFaultDetail getDetail() { return (SOAPFaultDetail) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL); } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java0000664000175000017500000000417611767656530024613 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultDetailImpl; public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl { public SOAP11FaultDetailImpl(SOAPFactory factory) { super(null, factory); this.localName = SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } public SOAP11FaultDetailImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); this.localName = SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); this.localName = SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException("Expecting SOAP11FaultImpl, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java0000664000175000017500000000677111767656530023610 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap11; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPHeaderImpl; import javax.xml.namespace.QName; import java.util.Iterator; public class SOAP11HeaderImpl extends SOAPHeaderImpl { public SOAP11HeaderImpl(SOAPFactory factory) throws SOAPProcessingException { super(factory.getNamespace(), factory); } /** @param envelope */ public SOAP11HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException { if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) { throw new OMException( "All the SOAP Header blocks should be namespace qualified"); } OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix()); if (namespace != null) { ns = namespace; } SOAPHeaderBlock soapHeaderBlock = null; try { soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this, (SOAPFactory) this.factory); } catch (SOAPProcessingException e) { throw new OMException(e); } ((OMNodeEx) soapHeaderBlock).setComplete(true); return soapHeaderBlock; } public Iterator extractHeaderBlocks(String role) { return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(), new QName( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.ATTR_ACTOR), role, true); } } ./src/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java0000664000175000017500000003520511767656530022721 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.llom.OMNodeImpl; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** Class SOAPEnvelopeImpl */ public class SOAPEnvelopeImpl extends SOAPElement implements SOAPEnvelope, OMConstants { private static Log log = LogFactory.getLog(SOAPEnvelopeImpl.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); /** * Constructor * @param builder the OMXMLParserWrapper building this envelope * @param factory the SOAPFactory building this envelope */ public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) { super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory); } /** * Constructor * @param ns OMNamespace for this envelope * @param factory SOAPFactory associated with this envelope */ public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) { super(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory); } public SOAPVersion getVersion() { return ((SOAPFactory)factory).getSOAPVersion(); } /** * Returns the SOAPHeader object for this SOAPEnvelope object.

        * This SOAPHeader will just be a container for all the headers in the OMMessage *

        * * @return the SOAPHeader object or null if there is none * @throws OMException if there is a problem obtaining the SOAPHeader object */ public SOAPHeader getHeader() throws OMException { // The soap header is the first element in the envelope. OMElement e = getFirstElement(); if (e instanceof SOAPHeader) { return (SOAPHeader)e; } return null; } /** * Check that a node is allowed as a child of a SOAP envelope. * * @param child */ private void checkChild(OMNode child) { if ((child instanceof OMElement) && !(child instanceof SOAPHeader || child instanceof SOAPBody)) { throw new SOAPProcessingException( "SOAP Envelope can not have children other than SOAP Header and Body", SOAP12Constants.FAULT_CODE_SENDER); } } /** * Add a SOAPHeader or SOAPBody object * @param child an OMNode to add - must be either a SOAPHeader or a SOAPBody */ public void addChild(OMNode child) { // SOAP 1.1 allows for arbitrary elements after SOAPBody so do NOT check for // node types when appending to SOAP 1.1 envelope. if (getVersion() instanceof SOAP12Version) { checkChild(child); } if (child instanceof SOAPHeader) { // The SOAPHeader is added before the SOAPBody // We must be sensitive to the state of the parser. It is possible that the // has not been processed yet. if (this.done) { // Parsing is complete, therefore it is safe to // call getBody. SOAPBody body = getBody(); if (body != null) { body.insertSiblingBefore(child); return; } } else { // Flow to here indicates that we are still expanding the // envelope. The body or body contents may not be // parsed yet. We can't use getBody() yet...it will // cause a failure. So instead, carefully find the // body and insert the header. If the body is not found, // this indicates that it has not been parsed yet...and // the code will fall through to the super.addChild. OMNode node = this.lastChild; while (node != null) { if (node instanceof SOAPBody) { node.insertSiblingBefore(child); return; } node = node.getPreviousOMSibling(); } } } super.addChild(child); } /** * Returns the SOAPBody object associated with this SOAPEnvelope * object.

        This SOAPBody will just be a container for all the BodyElements in the * OMMessage

        * * @return the SOAPBody object for this SOAPEnvelope object or * null if there is none * @throws OMException if there is a problem obtaining the SOAPBody object */ public SOAPBody getBody() throws OMException { //check for the first element OMElement element = getFirstElement(); if (element != null) { if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) { return (SOAPBody) element; } else { // if not second element SHOULD be the body OMNode node = element.getNextOMSibling(); while (node != null && node.getType() != OMNode.ELEMENT_NODE) { node = node.getNextOMSibling(); } if (node == null) { // The envelope only contains a header return null; } else if (SOAPConstants.BODY_LOCAL_NAME.equals(((OMElement)node).getLocalName())) { return (SOAPBody)node; } else { throw new OMException("SOAPEnvelope must contain a body element " + "which is either first or second child element of the SOAPEnvelope."); } } } return null; } /** * Method detach * * @throws OMException */ public OMNode detach() throws OMException { // throw new OMException("Root Element can not be detached"); // I'm confused why this threw an exception as above. One should be able to create // a SOAP envelope and be able to detach from the its parent document. // The example is if I want to send a SOAPEnvelope inside another SOAP message, then this will // not allow to do that. // Must be an idea of a DOM guy ;) return this; } protected void checkParent(OMElement parent) throws SOAPProcessingException { // here do nothing as SOAPEnvelope doesn't have a parent !!! } public void internalSerialize(XMLStreamWriter writer2, boolean cache) throws XMLStreamException { MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2; if (!writer.isIgnoreXMLDeclaration()) { String charSetEncoding = writer.getCharSetEncoding(); String xmlVersion = writer.getXmlVersion(); writer.getXmlStreamWriter().writeStartDocument( charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING : charSetEncoding, xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion); } if (cache) { //in this case we don't care whether the elements are built or not //we just call the serializeAndConsume methods OMSerializerUtil.serializeStartpart(this, writer); //serialize children OMElement header = getHeader(); if ((header != null) && (header.getFirstOMChild() != null)) { ((SOAPHeaderImpl) header).internalSerialize(writer, true); } SOAPBody body = getBody(); //REVIEW: getBody has statements to return null..Can it be null in any case? if (body != null) { ((SOAPBodyImpl) body).internalSerialize(writer, true); } OMSerializerUtil.serializeEndpart(writer); } else { //Now the caching is supposed to be off. However caching been switched off //has nothing to do if the element is already built! if (this.done || (this.builder == null)) { OMSerializerUtil.serializeStartpart(this, writer); OMElement header = getHeader(); if ((header != null) && (header.getFirstOMChild() != null)) { serializeInternally((OMNodeImpl) header, writer); } SOAPBody body = getBody(); if (body != null) { serializeInternally((OMNodeImpl) body, writer); } OMSerializerUtil.serializeEndpart(writer); } else { OMSerializerUtil.serializeByPullStream(this, writer, cache); } // let's try to close the builder/parser here since we are now done with the // non-caching code block serializing the top-level SOAPEnvelope element // TODO: should use 'instance of OMXMLParserWrapper' instead? StAXBuilder is more generic if ((builder != null) && (builder instanceof StAXBuilder)) { try { if (isDebugEnabled) { log.debug("closing builder: " + builder); } StAXBuilder staxBuilder = (StAXBuilder) builder; staxBuilder.close(); } catch (Exception e) { if (isDebugEnabled) { log.error("Could not close builder or parser due to: ", e); } } } else { if (isDebugEnabled) { log.debug("Could not close builder or parser due to:"); if (builder == null) { log.debug("builder is null"); } if ((builder != null) && !(builder instanceof StAXBuilder)) { log.debug("builder is not instance of " + StAXBuilder.class.getName()); } } } } } private void serializeInternally(OMNodeImpl child, MTOMXMLStreamWriter writer) throws XMLStreamException { if ((!(child instanceof OMElement)) || child.isComplete() || child.builder == null) { child.internalSerialize(writer, false); } else { OMElement element = (OMElement) child; element.getBuilder().setCache(false); OMSerializerUtil.serializeByPullStream(element, writer, false); } child.getNextOMSibling(); } public boolean hasFault() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(payloadQName.getLocalPart())) { String ns = payloadQName.getNamespaceURI(); return (ns != null && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns))); } } // Fallback: Get the body and get the fault information from the body SOAPBody body = this.getBody(); return (body == null) ? false : body.hasFault(); } public String getSOAPBodyFirstElementLocalName() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { return payloadQName.getLocalPart(); } SOAPBody body = this.getBody(); return (body == null) ? null : body.getFirstElementLocalName(); } public OMNamespace getSOAPBodyFirstElementNS() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { return this.factory.createOMNamespace(payloadQName.getNamespaceURI(), payloadQName.getPrefix()); } SOAPBody body = this.getBody(); return (body == null) ? null : body.getFirstElementNS(); } /** * Use a parser property to fetch the first element in the body. * Returns null if this optimized property is not set or not available. * @return The qname of the first element in the body or null */ private QName getPayloadQName_Optimized() { // The parser may expose a SOAPBODY_FIRST_CHILD_ELEMENT_QNAME property // Use that QName to determine if there is a fault OMXMLParserWrapper builder = this.getBuilder(); if (builder instanceof StAXSOAPModelBuilder) { try { QName payloadQName = (QName) ((StAXSOAPModelBuilder) builder). getReaderProperty(SOAPConstants.SOAPBODY_FIRST_CHILD_ELEMENT_QNAME); return payloadQName; } catch (Throwable e) { // The parser may not support this property. // In such cases, processing continues below in the fallback approach } } return null; } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultNodeImpl.java0000664000175000017500000000364511767656530023030 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultNodeImpl extends SOAPElement implements SOAPFaultNode { protected SOAPFaultNodeImpl(OMNamespace ns, SOAPFactory factory) { super(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, ns, factory); } public SOAPFaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true, factory); } public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder, factory); } public void setNodeValue(String uri) { this.setText(uri); } public String getNodeValue() { return this.getText(); } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java0000664000175000017500000001512311767656530022214 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.llom.OMElementImpl; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; /** Class SOAPFaultImpl */ public abstract class SOAPFaultImpl extends SOAPElement implements SOAPFault, OMConstants { protected Exception e; protected SOAPFaultImpl(OMNamespace ns, SOAPFactory factory) { super(SOAPConstants.SOAPFAULT_LOCAL_NAME, ns, factory); } /** * Constructor SOAPFaultImpl * * @param parent * @param e */ public SOAPFaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory); setException(e); } public void setException(Exception e) { this.e = e; putExceptionToSOAPFault(e); } public SOAPFaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory); } /** * Constructor SOAPFaultImpl * * @param parent * @param builder */ public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder, factory); } protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException; // --------------- Getters and Settors --------------------------- // public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { setNewElement(getCode(), soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { setNewElement(getReason(), reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { setNewElement(getNode(), node); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { setNewElement(getRole(), role); } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { setNewElement(getDetail(), detail); } /** If exception detailElement is not there we will return null */ public Exception getException() throws OMException { SOAPFaultDetail detail = getDetail(); if (detail == null) { return null; } OMElement exceptionElement = getDetail().getFirstChildWithName( new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY)); if (exceptionElement != null && exceptionElement.getText() != null) { return new Exception(exceptionElement.getText()); } return null; } protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); sw.flush(); SOAPFaultDetail detail = getDetail(); if (detail == null) { detail = getNewSOAPFaultDetail(this); setDetail(detail); } OMElement faultDetailEnty = new OMElementImpl( SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, null, detail, factory); faultDetailEnty.setText(sw.getBuffer().toString()); } protected void setNewElement(OMElement myElement, OMElement newElement) { if (myElement != null) { myElement.discard(); } if (newElement != null && newElement.getParent() != null) { newElement.discard(); } this.addChild(newElement); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); // this is a special case. This fault element may contain its children in any order. But spec mandates a specific order // the overriding of the method will facilitate that. Not sure this is the best method to do this :( build(); OMSerializerUtil.serializeStartpart(this, writer); SOAPFaultCode faultCode = getCode(); if (faultCode != null) { ((OMNodeEx) faultCode).internalSerialize(writer, true); } SOAPFaultReason faultReason = getReason(); if (faultReason != null) { ((OMNodeEx) faultReason).internalSerialize(writer, true); } serializeFaultNode(writer); SOAPFaultRole faultRole = getRole(); if (faultRole != null && faultRole.getText() != null && !"".equals(faultRole.getText())) { ((OMNodeEx) faultRole).internalSerialize(writer, true); } SOAPFaultDetail faultDetail = getDetail(); if (faultDetail != null) { ((OMNodeEx) faultDetail).internalSerialize(writer, true); } OMSerializerUtil.serializeEndpart(writer); } protected abstract void serializeFaultNode(XMLStreamWriter writer) throws XMLStreamException; } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultRoleImpl.java0000664000175000017500000000414411767656530023037 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultRoleImpl extends SOAPElement implements org.apache.axiom.soap.SOAPFaultRole { protected SOAPFaultRoleImpl(OMNamespace ns, SOAPFactory factory) { super(factory.getSOAPVersion().getFaultRoleQName().getLocalPart(), ns, factory); } public SOAPFaultRoleImpl(SOAPFault parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultRoleQName().getLocalPart(), extractNamespaceFromParent, factory); } public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultRoleQName().getLocalPart(), builder, factory); } public void setRoleValue(String uri) { this.setText(uri); } public String getRoleValue() { return this.getText(); } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultTextImpl.java0000664000175000017500000000724511767656530023067 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.llom.OMAttributeImpl; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; public abstract class SOAPFaultTextImpl extends SOAPElement implements SOAPFaultText { protected OMAttribute langAttr; protected OMNamespace langNamespace = null; protected SOAPFaultTextImpl(OMNamespace ns, SOAPFactory factory) { super(SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, ns, factory); this.langNamespace = factory.createOMNamespace( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX); } protected SOAPFaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory); this.langNamespace = factory.createOMNamespace( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX); } protected SOAPFaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder, factory); this.langNamespace = factory.createOMNamespace( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX); } public void setLang(String lang) { //langAttr = new OMAttributeImpl(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace(), lang); langAttr = new OMAttributeImpl( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, langNamespace, lang, this.factory); this.addAttribute(langAttr); } public String getLang() { if (langAttr == null) { //langAttr = this.getFirstAttribute(new QName(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace().getName())); langAttr = this.getAttribute( new QName(langNamespace.getNamespaceURI(), SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX)); } return langAttr == null ? null : langAttr.getAttributeValue(); } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultCodeImpl.java0000664000175000017500000000602111767656530023004 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultCodeImpl extends SOAPElement implements SOAPFaultCode { protected SOAPFaultCodeImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } protected SOAPFaultCodeImpl(OMNamespace ns, SOAPFactory factory) { this(factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), ns, factory); } public SOAPFaultCodeImpl(SOAPFault parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, localName, builder, factory); } public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { this(parent, factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), builder, factory); } public SOAPFaultCodeImpl(SOAPFault parent, String localName, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, localName, extractNamespaceFromParent, factory); } public SOAPFaultCodeImpl(SOAPFault parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { this(parent, factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), extractNamespaceFromParent, factory); } public void setValue(SOAPFaultValue value) throws SOAPProcessingException { ElementHelper.setNewElement(this, value, value); } public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException { ElementHelper.setNewElement(this, getSubCode(), value); } } ./src/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java0000664000175000017500000000522511767656530022527 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.llom.OMDocumentImpl; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAPMessageImpl extends OMDocumentImpl implements SOAPMessage { public SOAPMessageImpl(SOAPFactory factory) { super(factory); } public SOAPMessageImpl(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper, SOAPFactory factory) { super(envelope, parserWrapper, factory); } public SOAPMessageImpl(OMXMLParserWrapper parserWrapper, SOAPFactory factory) { super(parserWrapper, factory); } public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException { return (SOAPEnvelope) getOMDocumentElement(); } public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException { super.addChild(envelope); this.documentElement = envelope; } public void setOMDocumentElement(OMElement rootElement) { throw new UnsupportedOperationException( "This is not allowed. Use set SOAPEnvelope instead"); } public void setFirstChild(OMNode firstChild) { throw new UnsupportedOperationException( "This is not allowed. Use set SOAPEnvelope instead"); } protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException { ((OMNodeEx) this.documentElement).internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java0000664000175000017500000001214311767656530023303 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.llom.OMAttributeImpl; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; /** Class SOAPHeaderBlockImpl */ public abstract class SOAPHeaderBlockImpl extends OMSourcedElementImpl implements SOAPHeaderBlock { private boolean processed = false; public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory, OMDataSource ds) { super(localName, ns, factory, ds); } /** * @param localName * @param ns * @param parent */ public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super(localName, ns, parent, factory); this.setNamespace(ns); } /** * Constructor SOAPHeaderBlockImpl. * * @param localName * @param ns * @param parent * @param builder */ public SOAPHeaderBlockImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, ns, parent, builder, factory); this.setNamespace(ns); } /** * @param attributeName * @param attrValue * @param soapEnvelopeNamespaceURI */ protected void setAttribute(String attributeName, String attrValue, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attributeName)); if (omAttribute != null) { omAttribute.setAttributeValue(attrValue); } else { OMAttribute attribute = new OMAttributeImpl(attributeName, new OMNamespaceImpl( soapEnvelopeNamespaceURI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), attrValue, this.factory); this.addAttribute(attribute); } } /** * Method getAttribute. * * @param attrName * @param soapEnvelopeNamespaceURI * @return Returns String. */ protected String getAttribute(String attrName, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attrName)); return (omAttribute != null) ? omAttribute.getAttributeValue() : null; } public boolean isProcessed() { return processed; } public void setProcessed() { processed = true; } /** * @param key * @return requested OMDataSourceExt property or null */ protected String getOMDataSourceProperty(String key) { if (this.hasOMDataSourceProperty(key)) { return (String) ((OMDataSourceExt) getDataSource()).getProperty(key); } return null; } /** * @param key * @return requested OMDataSourceExt property or null */ protected boolean hasOMDataSourceProperty(String key) { if (!this.isExpanded()) { OMDataSource ds = this.getDataSource(); if (ds instanceof OMDataSourceExt) { return ((OMDataSourceExt)ds).hasProperty(key); } } return false; } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultDetailImpl.java0000664000175000017500000000505411767656530023341 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Iterator; public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail { protected SOAPFaultDetailImpl(OMNamespace ns, SOAPFactory factory) { super(factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), ns, factory); } protected SOAPFaultDetailImpl(SOAPFault parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), extractNamespaceFromParent, factory); } protected SOAPFaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), builder, factory); } public void addDetailEntry(OMElement detailElement) { this.addChild(detailElement); } public Iterator getAllDetailEntries() { return this.getChildren(); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); super.internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/llom/SOAPElement.java0000664000175000017500000000707111767656530021713 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.llom.OMElementImpl; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamWriter; public abstract class SOAPElement extends OMElementImpl { /** * @param parent * @param localName * @param extractNamespaceFromParent */ protected SOAPElement(OMElement parent, String localName, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(localName, null, parent, factory); if (parent == null) { throw new SOAPProcessingException( " Can not create " + localName + " element without a parent !!"); } checkParent(parent); if (extractNamespaceFromParent) { this.ns = parent.getNamespace(); } } protected SOAPElement(OMElement parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, null, parent, builder, factory); } /** * @param localName * @param ns */ protected SOAPElement(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } /** This has to be implemented by all the derived classes to check for the correct parent. */ protected abstract void checkParent(OMElement parent) throws SOAPProcessingException; public void setParent(OMContainer element) { super.setParent(element); if (element instanceof OMElement) { checkParent((OMElement) element); } } /** * Utility method to register a content handler for * push type builders. * @param writer * @return PULL_TYPE_BUILDER or PUSH_TYPE_BUILDER */ protected short registerContentHandler(XMLStreamWriter writer) { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } return builderType; } } ./src/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java0000664000175000017500000001774211767656530022047 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import javax.xml.stream.XMLStreamConstants; /** Class SOAPBodyImpl */ public abstract class SOAPBodyImpl extends SOAPElement implements SOAPBody, OMConstants { /** Field hasSOAPFault */ private boolean hasSOAPFault = false; private boolean enableLookAhead = true; private boolean lookAheadAttempted = false; private boolean lookAheadSuccessful = false; private String lookAheadLocalName = null; private OMNamespace lookAheadNS = null; protected SOAPBodyImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } /** @param envelope */ public SOAPBodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, SOAPConstants.BODY_LOCAL_NAME, true, factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder, factory); } /** * Creates a new SOAPFault object and adds it to this SOAPBody * object. * * @param e * @return the new SOAPFault object * @throws org.apache.axiom.om.OMException * if there is a SOAP error * @throws OMException */ public abstract SOAPFault addFault(Exception e) throws OMException; /** * Indicates whether a SOAPFault object exists in this SOAPBody * object. * * @return true if a SOAPFault object exists in this * SOAPBody object; false otherwise */ public boolean hasFault() { if (hasSOAPFault) { return true; } else { // Set hasSOAPFault if it matches the name matches a SOAP Fault String name = this.getFirstElementLocalName(); if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(name)) { OMNamespace ns = this.getFirstElementNS(); if (ns != null && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()))) { hasSOAPFault = true; } } return hasSOAPFault; } } /** * Returns the SOAPFault object in this SOAPBody object. * * @return the SOAPFault object in this SOAPBody object */ public SOAPFault getFault() { OMElement element = getFirstElement(); if (hasSOAPFault) { return (SOAPFault) element; } else if (element != null && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals( element.getLocalName()) && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals( element.getNamespace().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals( element.getNamespace().getNamespaceURI()))) { //added this line hasSOAPFault = true; return (SOAPFault) element; } else { return null; } } /** * @param soapFault * @throws org.apache.axiom.om.OMException * * @throws OMException */ public void addFault(SOAPFault soapFault) throws OMException { if (hasSOAPFault) { throw new OMException( "SOAP Body already has a SOAP Fault and there can not be more than one SOAP fault"); } addChild(soapFault); hasSOAPFault = true; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAPEnvelopeImpl)) { throw new SOAPProcessingException( "Expecting an implementation of SOAP Envelope as the parent. But received some other implementation"); } } public OMNode detach() throws OMException { throw new SOAPProcessingException( "Can not detach SOAP Body, SOAP Envelope must have a Body !!"); } /* * Overridden so that we can detect when a child element is built */ public void buildNext() { if (builder != null) { int token = builder.next(); if (token == XMLStreamConstants.START_ELEMENT) { enableLookAhead = false; } } } private boolean hasLookahead() { if (!enableLookAhead) { return false; } if (lookAheadAttempted) { return lookAheadSuccessful; } lookAheadAttempted = true; StAXSOAPModelBuilder soapBuilder = (StAXSOAPModelBuilder) this.builder; if (soapBuilder != null && soapBuilder.isCache() && !soapBuilder.isCompleted() && !soapBuilder.isClosed()) { lookAheadSuccessful = soapBuilder.lookahead(); if (lookAheadSuccessful) { this.lookAheadLocalName = soapBuilder.getName(); String ns = soapBuilder.getNamespace(); ns = (ns == null) ? "" : ns; this.lookAheadNS = factory.createOMNamespace(ns, soapBuilder.getPrefix()); } } return lookAheadSuccessful; } public OMNamespace getFirstElementNS() { if (hasLookahead()) { return this.lookAheadNS; } else { OMElement element = this.getFirstElement(); if (element == null) { return null; } else { return element.getNamespace(); } } } public String getFirstElementLocalName() { if (hasLookahead()) { return this.lookAheadLocalName; } else { OMElement element = this.getFirstElement(); if (element == null) { return null; } else { return element.getLocalName(); } } } public void addChild(OMNode child) { this.enableLookAhead = false; super.addChild(child); } } ./src/org/apache/axiom/soap/impl/llom/SOAPTextImpl.java0000664000175000017500000000345311767656530022070 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; public class SOAPTextImpl extends SOAPElement { protected SOAPTextImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory); } protected SOAPTextImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder, factory); } public void setLang(String lang) { // TODO : Chinthaka fix me } public String getLang() { // TODO Chinthaka fix me return null; } protected void checkParent(OMElement parent) throws SOAPProcessingException { // do nothing } } ./src/org/apache/axiom/soap/impl/llom/soap12/0000775000175000017500000000000011767656530020074 5ustar brianbrian./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java0000664000175000017500000000424511767656530024311 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultRoleImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl { public SOAP12FaultRoleImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public SOAP12FaultRoleImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultImpl, got " + parent.getClass()); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); super.internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12BodyImpl.java0000664000175000017500000000401111767656530023300 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPBodyImpl; public class SOAP12BodyImpl extends SOAPBodyImpl { public SOAP12BodyImpl(SOAPFactory factory) { super(SOAPConstants.BODY_LOCAL_NAME, factory.getNamespace(), factory); } /** @param envelope */ public SOAP12BodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPFault addFault(Exception e) throws OMException { return new SOAP12FaultImpl(this, e, (SOAPFactory) this.factory); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12Factory.java0000664000175000017500000003036411767656530023202 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory; import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl; import org.apache.axiom.soap.impl.llom.SOAPMessageImpl; /** */ public class SOAP12Factory extends OMLinkedListImplFactory implements SOAPFactory { public SOAP12Factory(OMLinkedListMetaFactory metaFactory) { super(metaFactory); } public SOAP12Factory() { } public String getSoapVersionURI() { return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; } public SOAPVersion getSOAPVersion() { return SOAP12Version.getSingleton(); } public OMNamespace getNamespace() { return new OMNamespaceImpl(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); } public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new OMNamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); } public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) { return new SOAPEnvelopeImpl(ns, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP12HeaderImpl(envelope, this); } public SOAPHeader createSOAPHeader() throws SOAPProcessingException { return new SOAP12HeaderImpl(this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP12HeaderImpl(envelope, builder, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, parent, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, parent, builder, this); } public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException { return new SOAP12FaultImpl(parent, e, this); } public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException { return new SOAP12FaultImpl(parent, this); } public SOAPFault createSOAPFault() throws SOAPProcessingException { return new SOAP12FaultImpl(this); } public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) { return new SOAP12FaultImpl(parent, builder, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP12BodyImpl(envelope, this); } public SOAPBody createSOAPBody() throws SOAPProcessingException { return new SOAP12BodyImpl(this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP12BodyImpl(envelope, builder, this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultCodeImpl(parent, this); } public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException { return new SOAP12FaultCodeImpl(this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultCodeImpl(parent, builder, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP12FaultValueImpl(parent, this); } public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException { return new SOAP12FaultValueImpl(this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultValueImpl(parent, builder, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, OMDataSource ds) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, this, ds); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP12FaultValueImpl(parent, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultValueImpl(parent, builder, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP12FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException { return new SOAP12FaultSubCodeImpl(this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultSubCodeImpl(parent, builder, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP12FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultSubCodeImpl(parent, builder, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultReasonImpl(parent, this); } public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException { return new SOAP12FaultReasonImpl(this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultReasonImpl(parent, builder, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException { return new SOAP12FaultTextImpl(parent, this); } public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException { return new SOAP12FaultTextImpl(this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) { return new SOAP12FaultTextImpl(parent, builder, this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultNodeImpl(parent, this); } public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException { return new SOAP12FaultNodeImpl(this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultNodeImpl(parent, builder, this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultRoleImpl(parent, this); } public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException { return new SOAP12FaultRoleImpl(this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultRoleImpl(parent, builder, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultDetailImpl(parent, this); } public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException { return new SOAP12FaultDetailImpl(this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultDetailImpl(parent, builder, this); } public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new OMNamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; } public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException { SOAPEnvelope defaultEnvelope = getDefaultEnvelope(); SOAPFault fault = createSOAPFault(defaultEnvelope.getBody()); SOAPFaultCode faultCode = createSOAPFaultCode(fault); createSOAPFaultValue(faultCode); SOAPFaultReason reason = createSOAPFaultReason(fault); createSOAPFaultText(reason); createSOAPFaultDetail(fault); return defaultEnvelope; } public SOAPMessage createSOAPMessage() { return new SOAPMessageImpl(this); } public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) { return new SOAPMessageImpl(builder, this); } public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) { return new SOAPMessageImpl(envelope, parserWrapper, this); } public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) { return new SOAPEnvelopeImpl(builder, this); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java0000664000175000017500000000423211767656530024606 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.llom.SOAPFaultDetailImpl; public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl { public SOAP12FaultDetailImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); this.localName = SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } public SOAP12FaultDetailImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); this.localName = SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); this.localName = SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultImpl as parent, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultTextImpl.java0000664000175000017500000000373511767656530024337 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultTextImpl; public class SOAP12FaultTextImpl extends SOAPFaultTextImpl { public SOAP12FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultTextImpl(SOAPFactory factory) throws SOAPProcessingException { super(factory.getNamespace(), factory); } public SOAP12FaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultReasonImpl as parent, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java0000664000175000017500000000420011767656530024264 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultNodeImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl { public SOAP12FaultNodeImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } public SOAP12FaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultImpl, got " + parent.getClass()); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { this.registerContentHandler(writer); super.internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultValueImpl.java0000664000175000017500000000401211767656530024454 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultValueImpl; public class SOAP12FaultValueImpl extends SOAPFaultValueImpl { public SOAP12FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultValueImpl(SOAPFactory factory) throws SOAPProcessingException { super(factory.getNamespace(), factory); } public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP12FaultSubCodeImpl) || (parent instanceof SOAP12FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP12FaultSubCodeImpl or SOAP12FaultCodeImpl as parent, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultImpl.java0000664000175000017500000001242211767656530023463 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.llom.SOAPFaultImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP12FaultImpl extends SOAPFaultImpl { /** Eran Chinthaka (chinthaka@apache.org) */ public SOAP12FaultImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } public SOAP12FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, e, factory); } public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** * This is a convenience method for the SOAP Fault Impl. * * @param parent */ public SOAP12FaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) { return new SOAP12FaultDetailImpl(fault, (SOAPFactory) this.factory); } public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultCodeImpl, got " + soapFaultCode.getClass()); } super.setCode(soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { if (!(reason instanceof SOAP12FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultReasonImpl, got " + reason.getClass()); } super.setReason(reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { if (!(node instanceof SOAP12FaultNodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultNodeImpl, got " + node.getClass()); } super.setNode(node); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { if (!(role instanceof SOAP12FaultRoleImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultRoleImpl, got " + role.getClass()); } super.setRole(role); } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { if (!(detail instanceof SOAP12FaultDetailImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultDetailImpl, got " + detail.getClass()); } super.setDetail(detail); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12BodyImpl)) { throw new SOAPProcessingException( "Expecting SOAP12BodyImpl, got " + parent.getClass()); } } protected void serializeFaultNode( XMLStreamWriter writer) throws XMLStreamException { SOAPFaultNode faultNode = getNode(); if (faultNode != null && faultNode.getText() != null && !"".equals(faultNode.getText())) { ((SOAP12FaultNodeImpl) faultNode).internalSerialize(writer, true); } } public SOAPFaultNode getNode() { return (SOAPFaultNode) getFirstChildWithName(SOAP12Constants.QNAME_FAULT_NODE); } public SOAPFaultCode getCode() { return (SOAPFaultCode) getFirstChildWithName(SOAP12Constants.QNAME_FAULT_CODE); } public SOAPFaultReason getReason() { return (SOAPFaultReason) getFirstChildWithName(SOAP12Constants.QNAME_FAULT_REASON); } public SOAPFaultRole getRole() { return (SOAPFaultRole) getFirstChildWithName(SOAP12Constants.QNAME_FAULT_ROLE); } public SOAPFaultDetail getDetail() { return (SOAPFaultDetail)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_DETAIL); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java0000664000175000017500000000552011767656530024634 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.llom.SOAPFaultReasonImpl; public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl { public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } public SOAP12FaultReasonImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } public SOAP12FaultReasonImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException { if (!(soapFaultText instanceof SOAP12FaultTextImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultTextImpl, got " + soapFaultText.getClass()); } addChild(soapFaultText); } public SOAPFaultText getFirstSOAPText() { return (SOAPFaultText)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_TEXT); } /** * getText() is overridden here in order to provide a uniform way for SOAP 1.1 * and SOAP 1.2 to get the "default" reason string. * * @return the default (local language, or first) reason string */ public String getText() { // TODO: Make this look for the correct lang for our locale first return getFirstSOAPText().getText(); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultImpl, got " + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java0000664000175000017500000001505311767656530024556 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.llom.SOAPHeaderBlockImpl; public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl implements SOAP12Constants { public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory, OMDataSource ds) { super(localName, ns, factory, ds); } /** * Eran Chinthaka (chinthaka@apache.org) */ /** * @param localName * @param ns */ public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super(localName, ns, parent, factory); checkParent(parent); } /** * Constructor SOAPHeaderBlockImpl * * @param localName * @param ns * @param parent * @param builder */ public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, ns, parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12HeaderImpl)) { throw new SOAPProcessingException( "Expecting SOAP12HeaderImpl as parent, got " + parent.getClass()); } } public void setRole(String roleURI) { setAttribute(SOAP_ROLE, roleURI, SOAP_ENVELOPE_NAMESPACE_URI); } public String getRole() { // Get the property or attribute String val; if (this.hasOMDataSourceProperty(ROLE_PROPERTY)) { val = this.getOMDataSourceProperty(ROLE_PROPERTY); } else { val = getAttributeValue(QNAME_ROLE); } return val; } public void setMustUnderstand(boolean mustUnderstand) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE : SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE, SOAP_ENVELOPE_NAMESPACE_URI); } public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand, SOAP_ENVELOPE_NAMESPACE_URI); } else { throw new SOAPProcessingException( "mustUndertand should be one of \"true\", " + "\"false\", \"0\" or \"1\" "); } } public boolean getMustUnderstand() throws SOAPProcessingException { // First, try getting the information from the property // Fallback to getting the information from the attribute String mustUnderstand; if (this.hasOMDataSourceProperty(MUST_UNDERSTAND_PROPERTY)) { mustUnderstand = this.getOMDataSourceProperty(MUST_UNDERSTAND_PROPERTY); } else { mustUnderstand = getAttribute(ATTR_MUSTUNDERSTAND, SOAP_ENVELOPE_NAMESPACE_URI); } // Now parse the value if (mustUnderstand != null) { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { return true; } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand)) { return false; } else { throw new SOAPProcessingException( "Invalid value found in mustUnderstand value of " + this.getLocalName() + " header block"); } } return false; } public void setRelay(boolean relay) { setAttribute(SOAP_RELAY, relay ? "true" : "false", SOAP_ENVELOPE_NAMESPACE_URI); } public boolean getRelay() { boolean ret = false; // Get the property or attribute String val; if (this.hasOMDataSourceProperty(RELAY_PROPERTY)) { val = this.getOMDataSourceProperty(RELAY_PROPERTY); } else { val = getAttributeValue(QNAME_RELAY); } if (val != null) { ret = "true".equalsIgnoreCase(val); } return ret; } /** * What SOAP version is this HeaderBlock? * * @return a SOAPVersion, one of the two singletons. */ public SOAPVersion getVersion() { return SOAP12Version.getSingleton(); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java0000664000175000017500000000642011767656530024257 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl; import javax.xml.namespace.QName; public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl { /** Eran Chinthaka (chinthaka@apache.org) */ public SOAP12FaultCodeImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP12FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP12FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultSubCodeImpl, got " + subCode.getClass()); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue value) throws SOAPProcessingException { if (!(value instanceof SOAP12FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultValueImpl, got " + value.getClass()); } super.setValue(value); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultImpl as parent, got " + parent.getClass()); } } // Overridden so that we can have a single interface to reliably get the faultcode's value public QName getTextAsQName() { return getValue().getTextAsQName(); } public SOAPFaultValue getValue() { return (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE); } public SOAPFaultSubCode getSubCode() { return (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java0000664000175000017500000000711511767656530024733 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPFaultSubCodeImpl; public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl { //changed public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } public SOAP12FaultSubCodeImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } //changed public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP12FaultSubCodeImpl) || (parent instanceof SOAP12FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP FaultSubCode " + "or SOAP FaultCodeValue as the parent. But received some " + "other implementation"); } } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP12FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultSubCodeImpl, got " + subCode.getClass()); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP12FaultValueImpl, got " + soapFaultSubCodeValue.getClass()); } super.setValue(soapFaultSubCodeValue); } } ./src/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java0000664000175000017500000000676111767656530023611 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom.soap12; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.llom.SOAPHeaderImpl; import javax.xml.namespace.QName; import java.util.Iterator; public class SOAP12HeaderImpl extends SOAPHeaderImpl { /** Eran Chinthaka (chinthaka@apache.org) */ public SOAP12HeaderImpl(SOAPFactory factory) { super(factory.getNamespace(), factory); } /** @param envelope */ public SOAP12HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException { if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) { throw new OMException( "All the SOAP Header blocks should be namespace qualified"); } OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix()); if (namespace != null) { ns = namespace; } SOAPHeaderBlock soapHeaderBlock = null; try { soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this, (SOAPFactory) this.factory); } catch (SOAPProcessingException e) { throw new OMException(e); } ((OMNodeEx) soapHeaderBlock).setComplete(true); return soapHeaderBlock; } public Iterator extractHeaderBlocks(String role) { return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(), new QName( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_ROLE), role, true); } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultSubCodeImpl.java0000664000175000017500000000542411767656530023464 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode { protected SOAPFaultValue value; protected SOAPFaultSubCode subCode; protected SOAPFaultSubCodeImpl(OMNamespace ns, SOAPFactory factory) { super(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, ns, factory); } protected SOAPFaultSubCodeImpl(OMElement parent, String localName, SOAPFactory factory) throws SOAPProcessingException { super(parent, localName, true, factory); } protected SOAPFaultSubCodeImpl(OMElement parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, localName, builder, factory); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { ElementHelper.setNewElement(this, value, soapFaultSubCodeValue); } public SOAPFaultValue getValue() { if (value == null) { value = (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE); } return value; } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { ElementHelper.setNewElement(this, this.subCode, subCode); } public SOAPFaultSubCode getSubCode() { if (subCode == null) { subCode = (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE); } return subCode; } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultValueImpl.java0000664000175000017500000000457711767656530023224 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultValueImpl extends SOAPElement implements SOAPFaultValue { protected SOAPFaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, true, factory); } protected SOAPFaultValueImpl(OMNamespace ns, SOAPFactory factory) { super(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, ns, factory); } protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder, factory); } protected SOAPFaultValueImpl(String localName, OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, localName, true, factory); } protected SOAPFaultValueImpl(OMNamespace ns, String localName, SOAPFactory factory) { super(localName, ns, factory); } protected SOAPFaultValueImpl(OMElement parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, localName, builder, factory); } } ./src/org/apache/axiom/soap/impl/llom/SOAPFaultReasonImpl.java0000664000175000017500000000627111767656530023370 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.llom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public abstract class SOAPFaultReasonImpl extends SOAPElement implements SOAPFaultReason { protected SOAPFaultReasonImpl(OMNamespace ns, SOAPFactory factory) { super(factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), ns, factory); } /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), builder, factory); } /** @param parent */ public SOAPFaultReasonImpl(OMElement parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), extractNamespaceFromParent, factory); } public List getAllSoapTexts() { List faultTexts = new ArrayList(1); Iterator childrenIter = this.getChildren(); while (childrenIter.hasNext()) { OMNode node = (OMNode) childrenIter.next(); if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultTextImpl)) { faultTexts.add(((SOAPFaultTextImpl) node)); } } return faultTexts; } public SOAPFaultText getSOAPFaultText(String language) { Iterator childrenIter = this.getChildren(); while (childrenIter.hasNext()) { OMNode node = (OMNode) childrenIter.next(); if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultTextImpl) && (language == null || language.equals(((SOAPFaultTextImpl) node).getLang()))) { return (SOAPFaultText) node; } } return null; } } ./src/org/apache/axiom/soap/impl/dom/0000775000175000017500000000000011767656530016603 5ustar brianbrian./src/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java0000664000175000017500000002564011767656530022152 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.RolePlayer; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader { /** @param envelope */ public SOAPHeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, SOAPConstants.HEADER_LOCAL_NAME, true, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory); } /** * Creates a new SOAPHeaderBlock object initialized with the specified name and * adds it to this SOAPHeader object. * * @param localName * @param ns * @return the new SOAPHeaderBlock object that was inserted into this * SOAPHeader object * @throws org.apache.axiom.om.OMException * if a SOAP error occurs */ public abstract SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException; /** * Get the appropriate set of headers for a RolePlayer. *

        * The RolePlayer indicates whether it is the ultimate destination (in which case headers with * no role or the explicit UltimateDestination role will be included), and any non-standard * roles it supports. Headers targeted to "next" will always be included, and those targeted to * "none" (for SOAP 1.2) will never be included. * * @return an Iterator over all the HeaderBlocks this RolePlayer should process. */ public Iterator getHeadersToProcess(RolePlayer rolePlayer) { return null; // TODO: Implement this! } public Iterator getHeadersToProcess(RolePlayer rolePlayer, String namespace) { return null; // TODO: Implement this! } /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified actor. An actor is a global * attribute that indicates the intermediate parties to whom the message should be sent. An * actor receives the message and then sends it to the next actor. The default actor is the * ultimate intended recipient for the message, so if no actor attribute is included in a * SOAPHeader object, the message is sent to its ultimate destination. * * @param paramRole a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified actor * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String) */ public Iterator examineHeaderBlocks(String paramRole) { /* Iterator headerBlocksIter = this.getChildren(); ArrayList headersWithGivenActor = new ArrayList(); if (paramRole == null || "".equals(paramRole)) { return returnAllSOAPHeaders(this.getChildren()); } while (headerBlocksIter.hasNext()) { Object o = headerBlocksIter.next(); if (o instanceof SOAPHeaderBlock) { SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o; String role = soapHeaderBlock.getRole(); if ((role != null) && role.equalsIgnoreCase(paramRole)) { headersWithGivenActor.add(soapHeaderBlock); } } } return headersWithGivenActor.iterator();*/ if (paramRole == null || paramRole.trim().length() == 0) { return examineAllHeaderBlocks(); } Collection elements = new ArrayList(); for (Iterator iter = examineAllHeaderBlocks(); iter.hasNext();) { SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iter.next(); /* if (headerBlock.getRole() == null || headerBlock.getRole().trim().length() == 0 || headerBlock.getRole().equals(paramRole)) { elements.add(headerBlock); } */ if (headerBlock.getRole() != null && headerBlock.getRole().trim().length() > 0 && headerBlock.getRole().equals(paramRole)) { elements.add(headerBlock); } } return elements.iterator(); } // private Iterator returnAllSOAPHeaders(Iterator children) { // ArrayList headers = new ArrayList(); // while (children.hasNext()) { // Object o = children.next(); // if (o instanceof SOAPHeaderBlock) { // headers.add(o); // } // } // // return headers.iterator(); // // } /** * Returns a list of all the SOAPHeaderBlock objects in this * SOAPHeader object that have the the specified role and detaches them from this * SOAPHeader object.

        This method allows an role to process only the parts of * the SOAPHeader object that apply to it and to remove them before passing the * message on to the next role. * * @param role a String giving the URI of the role for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified role * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String) */ public abstract Iterator extractHeaderBlocks(String role); /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object that have the specified actor and that have a MustUnderstand * attribute whose value is equivalent to true. * * @param actor a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderBlock objects * that contain the specified actor and are marked as MustUnderstand */ public Iterator examineMustUnderstandHeaderBlocks(String actor) { Iterator headerBlocksIter = this.getChildren(); ArrayList mustUnderstandHeadersWithGivenActor = new ArrayList(); while (headerBlocksIter.hasNext()) { Object o = headerBlocksIter.next(); if (o instanceof SOAPHeaderBlock) { SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o; String role = soapHeaderBlock.getRole(); boolean mustUnderstand = soapHeaderBlock.getMustUnderstand(); if ((role != null) && role.equals(actor) && mustUnderstand) { mustUnderstandHeadersWithGivenActor.add(soapHeaderBlock); } } } return mustUnderstandHeadersWithGivenActor.iterator(); } /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object. Not that this will return elements containing the QName * (http://schemas.xmlsoap.org/soap/envelope/, Header) * * @return an Iterator object over all the SOAPHeaderBlock objects * contained by this SOAPHeader */ public Iterator examineAllHeaderBlocks() { return this.getChildrenWithName(null); } /** * Returns an Iterator over all the SOAPHeaderBlock objects in this * SOAPHeader object and detaches them from this SOAPHeader object. * * @return an Iterator object over all the SOAPHeaderBlock objects * contained by this SOAPHeader */ public Iterator extractAllHeaderBlocks() { Collection result = new ArrayList(); for (Iterator iter = getChildrenWithName(null); iter.hasNext();) { ElementImpl headerBlock = (ElementImpl) iter.next(); iter.remove(); result.add(headerBlock); } return result.iterator(); } public ArrayList getHeaderBlocksWithNSURI(String nsURI) { ArrayList headers = null; OMNode node; OMElement header = this.getFirstElement(); if (header != null) { headers = new ArrayList(); } node = header; while (node != null) { if (node.getType() == OMNode.ELEMENT_NODE) { header = (OMElement) node; OMNamespace namespace = header.getNamespace(); if (nsURI == null) { if (namespace == null) { headers.add(header); } } else { if (namespace != null) { if (nsURI.equals(namespace.getNamespaceURI())) { headers.add(header); } } } } node = node.getNextOMSibling(); } return headers; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAPEnvelopeImpl)) { throw new SOAPProcessingException( "Expecting an implementation of SOAP Envelope as the " + "parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap11/0000775000175000017500000000000011767656530017707 5ustar brianbrian./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java0000664000175000017500000000673311767656530024455 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultReasonImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultReasonImpl extends SOAPFaultReasonImpl { public SOAP11FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP11FaultReasonImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); } public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException { throw new UnsupportedOperationException("addSOAPText() not allowed for SOAP 1.1!"); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } public String getLocalName() { return SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME; } public SOAPFaultText getFirstSOAPText() { throw new UnsupportedOperationException("getFirstSOAPText() not supported for SOAP 1.1!"); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.java0000664000175000017500000000577411767656530024133 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultRoleImpl extends SOAPFaultRoleImpl { public SOAP11FaultRoleImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, false, factory); } public SOAP11FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java0000664000175000017500000002327211767656530023014 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.NamespaceImpl; import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP11Version; import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl; import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory; /** */ public class SOAP11Factory extends DOMSOAPFactory { public SOAP11Factory(OMDOMMetaFactory metaFactory) { super(metaFactory); } public SOAP11Factory() { } public SOAP11Factory(DocumentImpl doc) { super(doc); } public String getSoapVersionURI() { return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI; } public SOAPVersion getSOAPVersion() { return SOAP11Version.getSingleton(); } public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); } public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) { return new SOAPEnvelopeImpl(ns, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP11HeaderImpl(envelope, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP11HeaderImpl(envelope, builder, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, parent, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException { return new SOAP11HeaderBlockImpl(localName, ns, parent, builder, this); } public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException { return new SOAP11FaultImpl(parent, e, this); } public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException { return new SOAP11FaultImpl(parent, this); } public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) { return new SOAP11FaultImpl(parent, builder, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP11BodyImpl(envelope, (SOAPFactory) envelope .getOMFactory()); } public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP11BodyImpl(envelope, builder, (SOAPFactory) envelope .getOMFactory()); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultCodeImpl(parent, this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultCodeImpl(parent, builder, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP11FaultValueImpl(parent, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultValueImpl(parent, builder, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP11FaultValueImpl(parent, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultValueImpl(parent, builder, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP11FaultSubCodeImpl(parent, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultSubCodeImpl(parent, builder, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP11FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP11FaultSubCodeImpl(parent, builder, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultReasonImpl(parent, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultReasonImpl(parent, builder, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException { return new SOAP11FaultTextImpl(parent, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) { return new SOAP11FaultTextImpl(parent, builder, this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultRoleImpl(parent, this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultRoleImpl(parent, builder, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException { return new SOAP11FaultDetailImpl(parent, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP11FaultDetailImpl(parent, builder, this); } public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new NamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; } public OMNamespace getNamespace() { return new NamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); } public SOAPFault createSOAPFault() throws SOAPProcessingException { return new SOAP11FaultImpl(this.getDefaultEnvelope().getBody(), this); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.java0000664000175000017500000000355511767656530023126 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPBodyImpl; public class SOAP11BodyImpl extends SOAPBodyImpl { /** @param envelope */ public SOAP11BodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPFault addFault(Exception e) throws OMException { SOAPFault soapFault = new SOAP11FaultImpl(this, e, (SOAPFactory) this.factory); this.hasSOAPFault = true; return soapFault; } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java0000664000175000017500000000722511767656530024547 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultSubCodeImpl; public class SOAP11FaultSubCodeImpl extends SOAPFaultSubCodeImpl { //changed public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } //changed public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl)) { throw new SOAPProcessingException("Expecting SOAP 1.1 " + "implementation of SOAP FaultSubCode or SOAP FaultCode as" + " the parent. But received some other implementation"); } } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!((parentNode instanceof SOAP11FaultSubCodeImpl) || (parentNode instanceof SOAP11FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Sub " + "Code. But received some other implementation"); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { if (!(soapFaultSubCodeValue instanceof SOAP11FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Value. " + "But received some other implementation"); } super.setValue(soapFaultSubCodeValue); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.java0000664000175000017500000000357011767656530024146 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultTextImpl; public class SOAP11FaultTextImpl extends SOAPFaultTextImpl { public SOAP11FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP11FaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP FaultReason " + "as the parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java0000664000175000017500000001002711767656530024067 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultCodeImpl extends SOAPFaultCodeImpl { /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAP11FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP11FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP11FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Sub " + "Code. But received some other implementation"); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue value) throws SOAPProcessingException { if (!(value instanceof SOAP11FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Value. " + "But received some other implementation"); } super.setValue(value); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } public void internalSerialize( XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } OMSerializerUtil.serializeStartpart(this, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, writer); writer.writeCharacters(this.getText()); writer.writeEndElement(); } public String getLocalName() { return SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME; } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.java0000664000175000017500000001341411767656530024367 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP11Version; import org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl; public class SOAP11HeaderBlockImpl extends SOAPHeaderBlockImpl { /** * @param localName * @param ns */ public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super(localName, ns, parent, factory); checkParent(parent); } public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } /** * Constructor SOAPHeaderBlockImpl * * @param localName * @param ns * @param parent * @param builder */ public SOAP11HeaderBlockImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, ns, parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11HeaderImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Body as the parent. But received some other implementation"); } } public void setRole(String roleURI) { setAttribute(SOAP11Constants.ATTR_ACTOR, roleURI, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public String getRole() { return getAttribute(SOAP11Constants.ATTR_ACTOR, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } //TODO : implement public void setRelay(boolean relay) { throw new UnsupportedOperationException("Not supported for SOAP 1.1"); } //TODO : implement public boolean getRelay() { throw new UnsupportedOperationException("Not supported for SOAP 1.1"); } public void setMustUnderstand(boolean mustUnderstand) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? "1" : "0", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else { throw new SOAPProcessingException( "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" "); } } /** * Returns whether the mustUnderstand attribute for this SOAPHeaderBlock object is * turned on. * * @return true if the mustUnderstand attribute of this * SOAPHeaderBlock object is turned on; false otherwise */ public boolean getMustUnderstand() throws SOAPProcessingException { String mustUnderstand; if ((mustUnderstand = getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) != null) { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { return true; } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand)) { return false; } else { throw new SOAPProcessingException( "Invalid value found in mustUnderstand value of " + this.getLocalName() + " header block"); } } return false; } /** * What SOAP version is this HeaderBlock? * * @return a SOAPVersion, one of the two singletons. */ public SOAPVersion getVersion() { return SOAP11Version.getSingleton(); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.java0000664000175000017500000000375111767656530024277 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultValueImpl; public class SOAP11FaultValueImpl extends SOAPFaultValueImpl { public SOAP11FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP11FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP FaultSubCode " + "or SOAP FaultCode as the parent. But received some other" + " implementation." + parent.getClass()); } } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java0000664000175000017500000001217511767656530023302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP11FaultImpl extends SOAPFaultImpl { public SOAP11FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, e, factory); } public SOAP11FaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** * This is a convenience method for the SOAP Fault Impl. * * @param parent */ public SOAP11FaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException { return new SOAP11FaultDetailImpl(fault, (SOAPFactory) this.factory); } public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Code. " + "But received some other implementation"); } super.setCode(soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { if (!(reason instanceof SOAP11FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Reason. " + "But received some other implementation"); } super.setReason(reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node"); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { if (!(role instanceof SOAP11FaultRoleImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Role. " + "But received some other implementation"); } super.setRole(role); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11BodyImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Body as the " + "parent. But received some other implementation"); } } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { if (!(detail instanceof SOAP11FaultDetailImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault Detail. " + "But received some other implementation"); } super.setDetail(detail); } protected void serializeFaultNode( XMLStreamWriter writer) throws XMLStreamException { } public SOAPFaultRole getRole() { return (SOAP11FaultRoleImpl)getFirstChildWithName(SOAP11Constants.QNAME_FAULT_ROLE); } public SOAPFaultCode getCode() { return (SOAPFaultCode)getFirstChildWithName(SOAP11Constants.QNAME_FAULT_CODE); } public SOAPFaultReason getReason() { return (SOAPFaultReason)getFirstChildWithName(SOAP11Constants.QNAME_FAULT_REASON); } public SOAPFaultDetail getDetail() { return (SOAPFaultDetail)getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL); } public SOAPFaultNode getNode() { throw new UnsupportedOperationException("SOAP 1.1 has no Fault Node"); } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java0000664000175000017500000000370511767656530024424 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl; public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl { public SOAP11FaultDetailImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, false, factory); } public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } public SOAP11FaultDetailImpl(SOAPFactory factory) { super(factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP11FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.1 implementation of SOAP Fault as " + "the parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java0000664000175000017500000000654311767656530023421 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap11; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPHeaderImpl; import javax.xml.namespace.QName; import java.util.Iterator; public class SOAP11HeaderImpl extends SOAPHeaderImpl { /** @param envelope */ public SOAP11HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException { if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) { throw new OMException( "All the SOAP Header blocks should be namespace qualified"); } OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix()); if (namespace != null) { ns = namespace; } SOAPHeaderBlock soapHeaderBlock = null; try { soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this, (SOAPFactory) this.factory); } catch (SOAPProcessingException e) { throw new OMException(e); } ((OMNodeEx) soapHeaderBlock).setComplete(true); return soapHeaderBlock; } public Iterator extractHeaderBlocks(String role) { return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(), new QName( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.ATTR_ACTOR), role, true); } } ./src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java0000664000175000017500000003401011767656530022526 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.NodeImpl; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP11Version; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAPEnvelopeImpl extends SOAPElement implements SOAPEnvelope, OMConstants { private static final QName HEADER_QNAME = new QName(SOAPConstants.HEADER_LOCAL_NAME); /** @param builder */ public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) { super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory); } public SOAPEnvelopeImpl(DocumentImpl doc, OMXMLParserWrapper builder, SOAPFactory factory) { super( doc, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, null, builder, factory); } /** @param ns */ public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) { super(((DOMSOAPFactory) factory).getDocument(), SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory); this.getOwnerDocument().appendChild(this); } public SOAPVersion getVersion() { return ((SOAPFactory)factory).getSOAPVersion(); } /** * Returns the SOAPHeader object for this SOAPEnvelope object. *

        * This SOAPHeader will just be a container for all the headers in the OMMessage *

        * * @return the SOAPHeader object or null if there is none * @throws org.apache.axiom.om.OMException * if there is a problem obtaining the SOAPHeader object * @throws OMException */ public SOAPHeader getHeader() throws OMException { // Header must be the first child OMElement header = getFirstElement(); if (header == null || !(header instanceof SOAPHeader)) { return null; } return (SOAPHeader) header; } /** * Check that a node is allowed as a child of a SOAP envelope. * * @param child */ private void checkChild(OMNode child) { if ((child instanceof OMElement) && !(child instanceof SOAPHeader || child instanceof SOAPBody)) { throw new SOAPProcessingException( "SOAP Envelope can not have children other than SOAP Header and Body", SOAP12Constants.FAULT_CODE_SENDER); } } public void addChild(OMNode child) { // SOAP 1.1 allows for arbitrary elements after SOAPBody so do NOT check for // node types when appending to SOAP 1.1 envelope. if (getVersion() instanceof SOAP12Version) { checkChild(child); } if (child instanceof SOAPHeader) { // The SOAPHeader is added before the SOAPBody // We must be sensitive to the state of the parser. It is possible that the // has not been processed yet. if (this.done) { // Parsing is complete, therefore it is safe to // call getBody. SOAPBody body = getBody(); if (body != null) { body.insertSiblingBefore(child); return; } } else { // Flow to here indicates that we are still expanding the // envelope. The body or body contents may not be // parsed yet. We can't use getBody() yet...it will // cause a failure. So instead, carefully find the // body and insert the header. If the body is not found, // this indicates that it has not been parsed yet...and // the code will fall through to the super.addChild. OMNode node = this.lastChild; while (node != null) { if (node instanceof SOAPBody) { node.insertSiblingBefore(child); return; } node = node.getPreviousOMSibling(); } } } super.addChild(child); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { // Check that the child to be added is valid in the context of a SOAP envelope. // Note that this also covers the appendChild case, since that method // calls insertBefore with refChild == null. // SOAP 1.1 allows for arbitrary elements after SOAPBody so do NOT check for // allowed node types when appending to SOAP 1.1 envelope. if (!(getVersion() instanceof SOAP11Version && refChild == null)) { checkChild((OMNode)newChild); } return super.insertBefore(newChild, refChild); } /** * Returns the SOAPBody object associated with this SOAPEnvelope * object. *

        * This SOAPBody will just be a container for all the BodyElements in the OMMessage *

        * * @return the SOAPBody object for this SOAPEnvelope object or * null if there is none * @throws org.apache.axiom.om.OMException * if there is a problem obtaining the SOAPBody object * @throws OMException */ public SOAPBody getBody() throws OMException { // check for the first element OMElement element = getFirstElement(); if (element != null) { if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) { return (SOAPBody) element; } else { // if not second element SHOULD be the body OMNode node = element.getNextOMSibling(); while (node != null && node.getType() != OMNode.ELEMENT_NODE) { node = node.getNextOMSibling(); } if (node == null) { // The envelope only contains a header return null; } else if (SOAPConstants.BODY_LOCAL_NAME.equals(((OMElement)node).getLocalName())) { return (SOAPBody)node; } else { throw new OMException("SOAPEnvelope must contain a body element " + "which is either first or second child element of the SOAPEnvelope."); } } } return null; } /** * Method detach * * @throws OMException */ public OMNode detach() throws OMException { throw new OMException("Root Element can not be detached"); } protected void checkParent(OMElement parent) throws SOAPProcessingException { // here do nothing as SOAPEnvelope doesn't have a parent !!! } public void internalSerialize(XMLStreamWriter writer2, boolean cache) throws XMLStreamException { MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2; if (!writer.isIgnoreXMLDeclaration()) { String charSetEncoding = writer.getCharSetEncoding(); String xmlVersion = writer.getXmlVersion(); writer.getXmlStreamWriter().writeStartDocument( charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING : charSetEncoding, xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion); } if (cache) { //in this case we don't care whether the elements are built or not //we just call the serializeAndConsume methods OMSerializerUtil.serializeStartpart(this, writer); //serialize children SOAPHeader header = getHeader(); if ((header != null) && (header.getFirstOMChild() != null)) { ((SOAPHeaderImpl) header).internalSerialize(writer, true); } SOAPBody body = getBody(); //REVIEW: getBody has statements to return null..Can it be null in any case? if (body != null) { ((org.apache.axiom.soap.impl.dom.SOAPBodyImpl) body).internalSerialize(writer, true); } OMSerializerUtil.serializeEndpart(writer); } else { //Now the caching is supposed to be off. However caching been switched off //has nothing to do if the element is already built! if (this.done || (this.builder == null)) { OMSerializerUtil.serializeStartpart(this, writer); OMElement header = getHeader(); if ((header != null) && (header.getFirstOMChild() != null)) { serializeInternally((NodeImpl) header, writer); } SOAPBody body = getBody(); if (body != null) { serializeInternally((NodeImpl) body, writer); } OMSerializerUtil.serializeEndpart(writer); } else { OMSerializerUtil.serializeByPullStream(this, writer, cache); } } } private void serializeInternally(NodeImpl child, MTOMXMLStreamWriter writer) throws XMLStreamException { if ((!(child instanceof OMElement)) || child.isComplete() || child.builder == null) { child.internalSerialize(writer, false); } else { OMElement element = (OMElement) child; element.getBuilder().setCache(false); OMSerializerUtil.serializeByPullStream(element, writer, false); } // child = (NodeImpl) child.getNextOMSibling(); } public OMNode getNextOMSibling() throws OMException { if (this.ownerNode != null && !this.ownerNode.isComplete()) { this.ownerNode.setComplete(true); } return null; } public boolean hasFault() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(payloadQName.getLocalPart())) { String ns = payloadQName.getNamespaceURI(); return (ns != null && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns))); } } // Fallback: Get the body and get the fault information from the body SOAPBody body = this.getBody(); return (body == null) ? false : body.hasFault(); } public String getSOAPBodyFirstElementLocalName() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { return payloadQName.getLocalPart(); } SOAPBody body = this.getBody(); return (body == null) ? null : body.getFirstElementLocalName(); } public OMNamespace getSOAPBodyFirstElementNS() { QName payloadQName = this.getPayloadQName_Optimized(); if (payloadQName != null) { return this.factory.createOMNamespace(payloadQName.getNamespaceURI(), payloadQName.getPrefix()); } SOAPBody body = this.getBody(); return (body == null) ? null : body.getFirstElementNS(); } /** * Use a parser property to fetch the first element in the body. * Returns null if this optimized property is not set or not available. * @return The qname of the first element in the body or null */ private QName getPayloadQName_Optimized() { // The parser may expose a SOAPBODY_FIRST_CHILD_ELEMENT_QNAME property // Use that QName to determine if there is a fault OMXMLParserWrapper builder = this.getBuilder(); if (builder instanceof StAXSOAPModelBuilder) { try { QName payloadQName = (QName) ((StAXSOAPModelBuilder) builder). getReaderProperty(SOAPConstants.SOAPBODY_FIRST_CHILD_ELEMENT_QNAME); return payloadQName; } catch (Throwable e) { // The parser may not support this property. // In such cases, processing continues below in the fallback approach } } return null; } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java0000664000175000017500000000704411767656530022641 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public abstract class SOAPFaultNodeImpl extends SOAPElement implements SOAPFaultNode { public SOAPFaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true, factory); } public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder, factory); } public void setNodeValue(String uri) { this.setText(uri); } public String getNodeValue() { return this.getText(); } public void internalSerialize( XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter( writer)); } if (!cache) { //No caching if (this.firstChild != null) { OMSerializerUtil.serializeStartpart(this, writer); firstChild.internalSerialize(writer, false); OMSerializerUtil.serializeEndpart(writer); } else if (!this.done) { if (builderType == PULL_TYPE_BUILDER) { OMSerializerUtil.serializeByPullStream(this, writer); } else { OMSerializerUtil.serializeStartpart(this, writer); builder.setCache(cache); builder.next(); OMSerializerUtil.serializeEndpart(writer); } } else { OMSerializerUtil.serializeNormal(this, writer, cache); } // do not serialise the siblings } else { //Cached OMSerializerUtil.serializeNormal(this, writer, cache); // do not serialise the siblings } } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java0000664000175000017500000001566511767656530022043 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.om.impl.dom.ParentNode; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; public abstract class SOAPFaultImpl extends SOAPElement implements SOAPFault, OMConstants { protected Exception e; /** * Constructor SOAPFaultImpl * * @param parent * @param e */ public SOAPFaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory); setException(e); } public void setException(Exception e) { this.e = e; putExceptionToSOAPFault(e); } public SOAPFaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory); } /** * Constructor SOAPFaultImpl * * @param parent * @param builder */ public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder, factory); } protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException; // --------------- Getters and Settors --------------------------- // public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { setNewElement(getCode(), soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { setNewElement(getReason(), reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { setNewElement(getNode(), node); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { setNewElement(getRole(), role); } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { setNewElement(getDetail(), detail); } /** If exception detailElement is not there we will return null */ public Exception getException() throws OMException { SOAPFaultDetail detail = getDetail(); if (detail == null) { return null; } OMElement exceptionElement = getDetail().getFirstChildWithName( new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY)); if (exceptionElement != null && exceptionElement.getText() != null) { return new Exception(exceptionElement.getText()); } return null; } protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); sw.flush(); SOAPFaultDetail detail = getDetail(); if (detail == null) { detail = getNewSOAPFaultDetail(this); setDetail(detail); } OMElement faultDetailEnty = new ElementImpl((ParentNode)detail, SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, null, this.factory); faultDetailEnty.setText(sw.getBuffer().toString()); } protected void setNewElement(OMElement myElement, OMElement newElement) { if (myElement != null) { myElement.discard(); } if (newElement != null && newElement.getParent() != null) { newElement.discard(); } this.addChild(newElement); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder .registerExternalContentHandler(new StreamWriterToContentHandlerConverter( writer)); } // this is a special case. This fault element may contain its children // in any order. But spec mandates a specific order // the overriding of the method will facilitate that. Not sure this is // the best method to do this :( build(); OMSerializerUtil.serializeStartpart(this, writer); SOAPFaultCode faultCode = getCode(); if (faultCode != null) { (faultCode).serialize(writer); } SOAPFaultReason faultReason = getReason(); if (faultReason != null) { (faultReason).serialize(writer); } serializeFaultNode(writer); SOAPFaultRole faultRole = getRole(); if (faultRole != null) { (faultRole).serialize(writer); } SOAPFaultDetail faultDetail = getDetail(); if (faultDetail != null) { (faultDetail).serialize(writer); } OMSerializerUtil.serializeEndpart(writer); } protected abstract void serializeFaultNode( XMLStreamWriter writer) throws XMLStreamException; } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java0000664000175000017500000000733711767656530022662 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public abstract class SOAPFaultRoleImpl extends SOAPElement implements SOAPFaultRole { public SOAPFaultRoleImpl(SOAPFault parent, String localName, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, localName, extractNamespaceFromParent, factory); } public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultRoleQName().getLocalPart(), builder, factory); } public void setRoleValue(String uri) { if (firstChild != null) { firstChild.detach(); } this.setText(uri); } public String getRoleValue() { return this.getText(); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } if (!cache) { //No caching if (this.firstChild != null) { OMSerializerUtil.serializeStartpart(this, writer); firstChild.internalSerialize(writer, false); OMSerializerUtil.serializeEndpart(writer); } else if (!this.done) { if (builderType == PULL_TYPE_BUILDER) { OMSerializerUtil.serializeByPullStream(this, writer); } else { OMSerializerUtil.serializeStartpart(this, writer); builder.setCache(cache); builder.next(); OMSerializerUtil.serializeEndpart(writer); } } else { OMSerializerUtil.serializeNormal(this, writer, cache); } // do not serialise the siblings } else { //Cached OMSerializerUtil.serializeNormal(this, writer, cache); // do not serialise the siblings } } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java0000664000175000017500000000602511767656530022676 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.AttrImpl; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; public abstract class SOAPFaultTextImpl extends SOAPElement implements SOAPFaultText { protected OMAttribute langAttr; protected final OMNamespace langNamespace; protected SOAPFaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory); this.langNamespace = factory.createOMNamespace( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX); } protected SOAPFaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder, factory); this.langNamespace = factory.createOMNamespace( SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX); } public void setLang(String lang) { langAttr = new AttrImpl(this.ownerNode, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, langNamespace, lang, this.factory); this.addAttribute(langAttr); } public String getLang() { if (langAttr == null) { langAttr = this.getAttribute( new QName(langNamespace.getNamespaceURI(), SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX)); } return langAttr == null ? null : langAttr.getAttributeValue(); } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java0000664000175000017500000000517511767656530022631 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultCodeImpl extends SOAPElement implements SOAPFaultCode { /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), builder, factory); } /** @param parent */ public SOAPFaultCodeImpl(SOAPFault parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), extractNamespaceFromParent, factory); } /** Eran Chinthaka (chinthaka@apache.org) */ public void setValue(SOAPFaultValue value) throws SOAPProcessingException { ElementHelper.setNewElement(this, value, value); } public SOAPFaultValue getValue() { return (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE); } public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException { ElementHelper.setNewElement(this, getSubCode(), value); } public SOAPFaultSubCode getSubCode() { return (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE); } } ./src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java0000664000175000017500000000443011767656530022340 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAPMessageImpl extends DocumentImpl implements SOAPMessage { public SOAPMessageImpl(SOAPFactory factory) { super(factory); } public SOAPMessageImpl(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper, SOAPFactory factory) { this(parserWrapper, factory); this.setSOAPEnvelope(envelope); } public SOAPMessageImpl(OMXMLParserWrapper parserWrapper, SOAPFactory factory) { super(factory); this.builder = parserWrapper; } public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException { return (SOAPEnvelope) getOMDocumentElement(); } public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException { this.addChild(envelope); } protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException { ((OMNodeEx) this.ownerNode.getDocumentElement()).internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java0000664000175000017500000001102011767656530023110 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.AttrImpl; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.om.impl.dom.NamespaceImpl; import org.apache.axiom.om.impl.dom.ParentNode; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.namespace.QName; public abstract class SOAPHeaderBlockImpl extends ElementImpl implements SOAPHeaderBlock { private boolean processed = false; /** * @param localName * @param ns * @param parent */ public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super((ParentNode) parent, localName, (NamespaceImpl) ns, factory); this.setNamespace(ns); } public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) throws SOAPProcessingException { super(((OMDOMFactory) factory).getDocument(), localName, (NamespaceImpl) ns, factory); this.setNamespace(ns); } /** * Constructor SOAPHeaderBlockImpl. * * @param localName * @param ns * @param parent * @param builder */ public SOAPHeaderBlockImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super((ParentNode) parent, localName, (NamespaceImpl) ns, builder, factory); this.setNamespace(ns); } /** * @param attributeName * @param attrValue * @param soapEnvelopeNamespaceURI */ protected void setAttribute(String attributeName, String attrValue, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attributeName)); if (omAttribute != null) { omAttribute.setAttributeValue(attrValue); } else { OMAttribute attribute = new AttrImpl(this.ownerNode, attributeName, new NamespaceImpl(soapEnvelopeNamespaceURI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), attrValue, this.factory); this.addAttribute(attribute); } } /** * Method getAttribute. * * @param attrName * @return Returns String. */ protected String getAttribute(String attrName, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attrName)); return (omAttribute != null) ? omAttribute.getAttributeValue() : null; } public boolean isProcessed() { return processed; } public void setProcessed() { processed = true; } public OMDataSource getDataSource() { throw new UnsupportedOperationException(); } public boolean isExpanded() { throw new UnsupportedOperationException(); } public OMDataSource setDataSource(OMDataSource dataSource) { throw new UnsupportedOperationException(); } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java0000664000175000017500000000557511767656530023165 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Iterator; public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail { protected SOAPFaultDetailImpl(SOAPFault parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), extractNamespaceFromParent, factory); } protected SOAPFaultDetailImpl(SOAPFactory factory) { super(factory); } protected SOAPFaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), builder, factory); } public void addDetailEntry(OMElement detailElement) { this.addChild(detailElement); } public Iterator getAllDetailEntries() { return this.getChildren(); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // select the builder short builderType = PULL_TYPE_BUILDER; // default is pull type if (builder != null) { builderType = this.builder.getBuilderType(); } if ((builderType == PUSH_TYPE_BUILDER) && (builder.getRegisteredContentHandler() == null)) { builder.registerExternalContentHandler( new StreamWriterToContentHandlerConverter(writer)); } super.internalSerialize(writer, cache); } } ./src/org/apache/axiom/soap/impl/dom/SOAPElement.java0000664000175000017500000000566211767656530021533 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.om.impl.dom.NamespaceImpl; import org.apache.axiom.om.impl.dom.ParentNode; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPElement extends ElementImpl { public SOAPElement(SOAPFactory factory) { super(factory); } /** @param parent */ protected SOAPElement(OMElement parent, String localName, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super((ParentNode) parent, localName, null, factory); if (parent == null) { throw new SOAPProcessingException( " Can not create " + localName + " element without a parent !!"); } checkParent(parent); if (extractNamespaceFromParent) { this.namespace = parent.getNamespace(); } this.localName = localName; } protected SOAPElement(OMElement parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super((ParentNode) parent, localName, null, builder, factory); } protected SOAPElement(DocumentImpl doc, String localName, OMNamespace ns, SOAPFactory factory) { super(doc, localName, (NamespaceImpl) ns, factory); } protected SOAPElement(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, SOAPFactory factory) { super(ownerDocument, tagName, ns, builder, factory); } /** This has to be implemented by all the derived classes to check for the correct parent. */ protected abstract void checkParent(OMElement parent) throws SOAPProcessingException; } ./src/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java0000664000175000017500000001336611767656530021661 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPBodyImpl extends SOAPElement implements SOAPBody, OMConstants { /** Field hasSOAPFault */ protected boolean hasSOAPFault = false; /** @param envelope */ public SOAPBodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, SOAPConstants.BODY_LOCAL_NAME, true, factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder, factory); } /** * Creates a new SOAPFault object and adds it to this SOAPBody object. * * @param e * @return the new SOAPFault object * @throws org.apache.axiom.om.OMException * if there is a SOAP error * @throws OMException */ public abstract SOAPFault addFault(Exception e) throws OMException; /** * Indicates whether a SOAPFault object exists in this SOAPBody object. * * @return true if a SOAPFault object exists in this * SOAPBody object; false otherwise */ public boolean hasFault() { if (hasSOAPFault) { return true; } else { OMElement element = getFirstElement(); if (element != null && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element .getLocalName()) && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(element.getNamespace().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(element.getNamespace().getNamespaceURI()))) { //added this line hasSOAPFault = true; return true; } else { return false; } } } /** * Returns the SOAPFault object in this SOAPBody object. * * @return the SOAPFault object in this SOAPBody object */ public SOAPFault getFault() { OMElement element = getFirstElement(); if (hasSOAPFault) { return (SOAPFault) element; } else if (element != null && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element .getLocalName()) && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(element .getNamespace().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(element.getNamespace().getNamespaceURI()))) { //added this line hasSOAPFault = true; return (SOAPFault) element; } else { return null; } } /** * @param soapFault * @throws org.apache.axiom.om.OMException * * @throws OMException */ public void addFault(SOAPFault soapFault) throws OMException { if (hasSOAPFault) { throw new OMException( "SOAP Body already has a SOAP Fault and there can not be " + "more than one SOAP fault"); } addChild(soapFault); hasSOAPFault = true; } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAPEnvelopeImpl)) { throw new SOAPProcessingException( "Expecting an implementation of SOAP Envelope as the " + "parent. But received some other implementation"); } } /*public OMNode detach() throws OMException { throw new SOAPProcessingException( "Can not detach SOAP Body, SOAP Envelope must have a Body !!"); }*/ public OMNamespace getFirstElementNS() { OMElement element = this.getFirstElement(); if (element == null) { return null; } else { return element.getNamespace(); } } public String getFirstElementLocalName() { OMElement element = this.getFirstElement(); if (element == null) { return null; } else { return element.getLocalName(); } } } ./src/org/apache/axiom/soap/impl/dom/SOAPTextImpl.java0000664000175000017500000000343411767656530021703 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; public class SOAPTextImpl extends SOAPElement { protected SOAPTextImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory); } protected SOAPTextImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder, factory); } public void setLang(String lang) { // TODO : Chinthaka fix me } public String getLang() { // TODO Chinthaka fix me return null; } protected void checkParent(OMElement parent) throws SOAPProcessingException { // do nothing } } ./src/org/apache/axiom/soap/impl/dom/soap12/0000775000175000017500000000000011767656530017710 5ustar brianbrian./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java0000664000175000017500000000367311767656530024131 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl; public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl { public SOAP12FaultRoleImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, true, factory); } public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.java0000664000175000017500000000363711767656530023131 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPBodyImpl; public class SOAP12BodyImpl extends SOAPBodyImpl { /** @param envelope */ public SOAP12BodyImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPBodyImpl * * @param envelope * @param builder */ public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPFault addFault(Exception e) throws OMException { SOAPFault soapFault = new SOAP12FaultImpl(this, e, (SOAPFactory) this.factory); this.hasSOAPFault = true; return soapFault; } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java0000664000175000017500000002242111767656530023011 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.NamespaceImpl; import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl; import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory; /** */ public class SOAP12Factory extends DOMSOAPFactory { public SOAP12Factory(OMDOMMetaFactory metaFactory) { super(metaFactory); } public SOAP12Factory() { } public SOAP12Factory(DocumentImpl doc) { super(doc); } public String getSoapVersionURI() { return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI; } public SOAPVersion getSOAPVersion() { return SOAP12Version.getSingleton(); } public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); } public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) { return new SOAPEnvelopeImpl(ns, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP12HeaderImpl(envelope, this); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP12HeaderImpl(envelope, builder, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, parent, this); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException { return new SOAP12HeaderBlockImpl(localName, ns, parent, builder, this); } public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException { return new SOAP12FaultImpl(parent, e, this); } public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException { return new SOAP12FaultImpl(parent, this); } public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) { return new SOAP12FaultImpl(parent, builder, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException { return new SOAP12BodyImpl(envelope, this); } public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) { return new SOAP12BodyImpl(envelope, builder, this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultCodeImpl(parent, this); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultCodeImpl(parent, builder, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP12FaultValueImpl(parent, this); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultValueImpl(parent, builder, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP12FaultValueImpl(parent, this); } //added public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultValueImpl(parent, builder, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException { return new SOAP12FaultSubCodeImpl(parent, this); } //changed public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultSubCodeImpl(parent, builder, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException { return new SOAP12FaultSubCodeImpl(parent, this); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { return new SOAP12FaultSubCodeImpl(parent, builder, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultReasonImpl(parent, this); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultReasonImpl(parent, builder, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException { return new SOAP12FaultTextImpl(parent, this); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) { return new SOAP12FaultTextImpl(parent, builder, this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultNodeImpl(parent, this); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultNodeImpl(parent, builder, this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultRoleImpl(parent, this); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultRoleImpl(parent, builder, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException { return new SOAP12FaultDetailImpl(parent, this); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) { return new SOAP12FaultDetailImpl(parent, builder, this); } public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new NamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; } public SOAPFault createSOAPFault() throws SOAPProcessingException { return new SOAP12FaultImpl(this.getDefaultEnvelope().getBody(), this); } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java0000664000175000017500000000355511767656530024431 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl; public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl { public SOAP12FaultDetailImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java0000664000175000017500000000362711767656530024153 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultTextImpl; public class SOAP12FaultTextImpl extends SOAPFaultTextImpl { public SOAP12FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP FaultReason " + "as the parent. But received some other implementation"); } } }./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java0000664000175000017500000000353211767656530024107 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl; public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl { public SOAP12FaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java0000664000175000017500000000352511767656530024300 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultValueImpl; public class SOAP12FaultValueImpl extends SOAPFaultValueImpl { public SOAP12FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP12FaultSubCodeImpl) || (parent instanceof SOAP12FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java0000664000175000017500000001243011767656530023276 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.dom.SOAPFaultImpl; import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class SOAP12FaultImpl extends SOAPFaultImpl { public SOAP12FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException { super(parent, e, factory); } public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** * This is a convenience method for the SOAP Fault Impl. * * @param parent */ public SOAP12FaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory); } protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) { return new SOAP12FaultDetailImpl(fault, (SOAPFactory) this.factory); } public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException { if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Code. " + "But received some other implementation"); } super.setCode(soapFaultCode); } public void setReason(SOAPFaultReason reason) throws SOAPProcessingException { if (!(reason instanceof SOAP12FaultReasonImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Reason. But received some other implementation"); } super.setReason(reason); } public void setNode(SOAPFaultNode node) throws SOAPProcessingException { if (!(node instanceof SOAP12FaultNodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Node. But received some other implementation"); } super.setNode(node); } public void setRole(SOAPFaultRole role) throws SOAPProcessingException { if (!(role instanceof SOAP12FaultRoleImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Role. But received some other implementation"); } super.setRole(role); } public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException { if (!(detail instanceof SOAP12FaultDetailImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Detail. But received some other implementation"); } super.setDetail(detail); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12BodyImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation"); } } protected void serializeFaultNode(XMLStreamWriter writer) throws XMLStreamException { SOAPFaultNode faultNode = getNode(); if (faultNode != null) { (faultNode).serialize(writer); } } public SOAPFaultReason getReason() { return (SOAPFaultReason)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_REASON); } public SOAPFaultDetail getDetail() { return (SOAPFaultDetail)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_DETAIL); } public SOAPFaultCode getCode() { return (SOAPFaultCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_CODE); } public SOAPFaultNode getNode() { return (SOAPFaultNode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_NODE); } public SOAPFaultRole getRole() { return (SOAPFaultRoleImpl)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_ROLE); } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java0000664000175000017500000000502211767656530024445 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.impl.dom.SOAPFaultReasonImpl; public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl { public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP12FaultReasonImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException { if (!(soapFaultText instanceof SOAP12FaultTextImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Text. " + "But received some other implementation"); } super.addSOAPText(soapFaultText); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault as the " + "parent. But received some other implementation"); } } public SOAPFaultText getFirstSOAPText() { return (SOAPFaultText)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_TEXT); } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java0000664000175000017500000001332211767656530024367 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.SOAP12Version; import org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl; public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl { /** * @param localName * @param ns */ public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, SOAPFactory factory) throws SOAPProcessingException { super(localName, ns, parent, factory); checkParent(parent); } public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) { super(localName, ns, factory); } /** * Constructor SOAPHeaderBlockImpl * * @param localName * @param ns * @param parent * @param builder */ public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(localName, ns, parent, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12HeaderImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation"); } } public void setRole(String roleURI) { setAttribute(SOAP12Constants.SOAP_ROLE, roleURI, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public String getRole() { return getAttribute(SOAP12Constants.SOAP_ROLE, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public void setMustUnderstand(boolean mustUnderstand) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE : SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } else { throw new SOAPProcessingException( "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" "); } } public boolean getMustUnderstand() throws SOAPProcessingException { String mustUnderstand; if ((mustUnderstand = getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) != null) { if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) { return true; } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand)) { return false; } else { throw new SOAPProcessingException( "Invalid value found in mustUnderstand value of " + this.getLocalName() + " header block"); } } return false; } public void setRelay(boolean relay) { setAttribute(SOAP12Constants.SOAP_RELAY, String.valueOf(relay), SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } public boolean getRelay() { return Boolean.valueOf(getAttribute(SOAP12Constants.SOAP_RELAY, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) .booleanValue(); } /** * What SOAP version is this HeaderBlock? * * @return a SOAPVersion, one of the two singletons. */ public SOAPVersion getVersion() { return SOAP12Version.getSingleton(); } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java0000664000175000017500000000601311767656530024071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl; import javax.xml.namespace.QName; public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl { /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, builder, factory); } /** @param parent */ public SOAP12FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, true, factory); } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP12FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault " + "Sub Code. But received some other implementation"); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue value) throws SOAPProcessingException { if (!(value instanceof SOAP12FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Value. " + "But received some other implementation"); } super.setValue(value); } public QName getTextAsQName() { SOAPFaultValue value = getValue(); return value == null ? null : value.getTextAsQName(); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!(parent instanceof SOAP12FaultImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault as " + "the parent. But received some other implementation"); } } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java0000664000175000017500000000715611767656530024554 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPFaultSubCodeImpl; public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl { //changed public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } //changed public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory); } public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder, factory); } protected void checkParent(OMElement parent) throws SOAPProcessingException { if (!((parent instanceof SOAP12FaultSubCodeImpl) || (parent instanceof SOAP12FaultCodeImpl))) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP FaultSubCode " + "or SOAP FaultCodeValue as the parent. But received some " + "other implementation"); } } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { if (!(subCode instanceof SOAP12FaultSubCodeImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault " + "Sub Code. But received some other implementation"); } super.setSubCode(subCode); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) { throw new SOAPProcessingException( "Expecting SOAP 1.2 implementation of SOAP Fault Value. " + "But received some other implementation"); } super.setValue(soapFaultSubCodeValue); } } ./src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java0000664000175000017500000000652211767656530023420 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.soap12; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.impl.dom.SOAPHeaderImpl; import javax.xml.namespace.QName; import java.util.Iterator; public class SOAP12HeaderImpl extends SOAPHeaderImpl { /** @param envelope */ public SOAP12HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory) throws SOAPProcessingException { super(envelope, factory); } /** * Constructor SOAPHeaderImpl * * @param envelope * @param builder */ public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, SOAPFactory factory) { super(envelope, builder, factory); } public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException { if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) { throw new OMException( "All the SOAP Header blocks should be namespace qualified"); } OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix()); if (namespace != null) { ns = namespace; } SOAPHeaderBlock soapHeaderBlock = null; try { soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this, (SOAPFactory) this.factory); } catch (SOAPProcessingException e) { throw new OMException(e); } ((OMNodeEx) soapHeaderBlock).setComplete(true); return soapHeaderBlock; } public Iterator extractHeaderBlocks(String role) { return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(), new QName( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_ROLE), role, true); } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java0000664000175000017500000000506711767656530023303 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode { protected SOAPFaultValue value; protected SOAPFaultSubCode subCode; protected SOAPFaultSubCodeImpl(OMElement parent, String localName, SOAPFactory factory) throws SOAPProcessingException { super(parent, localName, true, factory); } protected SOAPFaultSubCodeImpl(OMElement parent, String localName, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, localName, builder, factory); } public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException { ElementHelper.setNewElement(this, value, soapFaultSubCodeValue); } public SOAPFaultValue getValue() { if (value == null) { value = (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE); } return value; } public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException { ElementHelper.setNewElement(this, this.subCode, subCode); } public SOAPFaultSubCode getSubCode() { if (subCode == null) { subCode = (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE); } return subCode; } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java0000664000175000017500000000320711767656530023025 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPProcessingException; public abstract class SOAPFaultValueImpl extends SOAPElement implements SOAPFaultValue { protected SOAPFaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException { super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, true, factory); } protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder, factory); } } ./src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java0000664000175000017500000000564611767656530023211 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPProcessingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public abstract class SOAPFaultReasonImpl extends SOAPElement implements SOAPFaultReason { protected SOAPFaultText text; /** * Constructor OMElementImpl * * @param parent * @param builder */ public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) { super(parent, factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), builder, factory); } /** @param parent */ public SOAPFaultReasonImpl(OMElement parent, boolean extractNamespaceFromParent, SOAPFactory factory) throws SOAPProcessingException { super(parent, factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), extractNamespaceFromParent, factory); } /** Eran Chinthaka (chinthaka@apache.org) */ public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException { ElementHelper.setNewElement(this, text, soapFaultText); } public List getAllSoapTexts() { //TODO Ruchith check List faultTexts = new ArrayList(); Iterator childrenIter = this.getChildren(); while (childrenIter.hasNext()) { OMNode node = (OMNode) childrenIter.next(); if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultTextImpl)) { faultTexts.add(((SOAPFaultTextImpl) node)); } } return faultTexts; } public SOAPFaultText getSOAPFaultText(String language) { //TODO Ruchith throw new UnsupportedOperationException(); } } ./src/org/apache/axiom/soap/impl/dom/factory/0000775000175000017500000000000011767656530020252 5ustar brianbrian./src/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java0000664000175000017500000002601311767656530023551 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.dom.factory; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl; import org.apache.axiom.soap.impl.dom.SOAPMessageImpl; import org.apache.axiom.soap.impl.dom.soap11.SOAP11FaultDetailImpl; import org.apache.axiom.soap.impl.dom.soap12.SOAP12FaultImpl; public class DOMSOAPFactory extends OMDOMFactory implements SOAPFactory { public DOMSOAPFactory(OMDOMMetaFactory metaFactory) { super(metaFactory); } public DOMSOAPFactory() { } public DOMSOAPFactory(DocumentImpl doc) { super(doc); } public String getSoapVersionURI() { throw new UnsupportedOperationException(); } public SOAPVersion getSOAPVersion() { throw new UnsupportedOperationException(); } public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) { SOAPMessageImpl messageImpl = new SOAPMessageImpl(builder, this); this.document = messageImpl; return messageImpl; } public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) { SOAPMessageImpl messageImpl = new SOAPMessageImpl(envelope, parserWrapper, this); this.document = messageImpl; return messageImpl; } public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) { return new SOAPEnvelopeImpl((DocumentImpl) this.createOMDocument(), builder, this); } public SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) { throw new UnsupportedOperationException(); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException { return new SOAP12FaultImpl(parent, this); } public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) { throw new UnsupportedOperationException(); } public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { throw new UnsupportedOperationException(); } public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException { SOAPEnvelope defaultEnvelope = getDefaultEnvelope(); SOAPFault fault = createSOAPFault(defaultEnvelope.getBody()); SOAPFaultCode faultCode = createSOAPFaultCode(fault); createSOAPFaultValue(faultCode); SOAPFaultReason reason = createSOAPFaultReason(fault); createSOAPFaultText(reason); createSOAPFaultNode(fault); createSOAPFaultRole(fault); createSOAPFaultDetail(fault); return defaultEnvelope; } public SOAPMessage createSOAPMessage() { return new SOAPMessageImpl(this); } public SOAPHeader createSOAPHeader() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFault createSOAPFault() throws SOAPProcessingException { return null; } public SOAPBody createSOAPBody() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException { return new SOAP11FaultDetailImpl(this); } public OMNamespace getNamespace() { throw new UnsupportedOperationException(); } public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, OMDataSource ds) throws SOAPProcessingException { throw new UnsupportedOperationException("TODO"); } } ./src/org/apache/axiom/soap/impl/builder/0000775000175000017500000000000011767656530017452 5ustar brianbrian./src/org/apache/axiom/soap/impl/builder/SOAP12BuilderHelper.java0000664000175000017500000003422211767656530023674 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.builder; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.exception.OMBuilderException; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamReader; import java.util.Vector; public class SOAP12BuilderHelper extends SOAPBuilderHelper { private SOAPFactory factory; private boolean codePresent = false; private boolean reasonPresent = false; private boolean nodePresent = false; private boolean rolePresent = false; private boolean detailPresent = false; private boolean subcodeValuePresent = false; private boolean subSubcodePresent = false; private boolean valuePresent = false; private boolean subcodePresent = false; private boolean codeprocessing = false; private boolean subCodeProcessing = false; private boolean reasonProcessing = false; private Vector detailElementNames; public SOAP12BuilderHelper(StAXSOAPModelBuilder builder) { super(builder); factory = builder.getSoapFactory(); } public OMElement handleEvent(XMLStreamReader parser, OMElement parent, int elementLevel) throws SOAPProcessingException { this.parser = parser; OMElement element = null; if (elementLevel == 4) { if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) { if (codePresent) { throw new OMBuilderException( "Multiple Code element encountered"); } else { element = factory.createSOAPFaultCode((SOAPFault) parent, builder); codePresent = true; codeprocessing = true; } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) { if (!codeprocessing && !subCodeProcessing) { if (codePresent) { if (reasonPresent) { throw new OMBuilderException( "Multiple Reason Element encountered"); } else { element = factory.createSOAPFaultReason( (SOAPFault) parent, builder); reasonPresent = true; reasonProcessing = true; } } else { throw new OMBuilderException( "Wrong element order encountred at " + parser.getLocalName()); } } else { if (codeprocessing) { throw new OMBuilderException( "Code doesn't have a value"); } else { throw new OMBuilderException( "A subcode doesn't have a Value"); } } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) { if (!reasonProcessing) { if (reasonPresent && !rolePresent && !detailPresent) { if (nodePresent) { throw new OMBuilderException( "Multiple Node element encountered"); } else { element = factory.createSOAPFaultNode( (SOAPFault) parent, builder); nodePresent = true; } } else { throw new OMBuilderException( "wrong element order encountered at " + parser.getLocalName()); } } else { throw new OMBuilderException( "Reason element Should have a text"); } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME)) { if (!reasonProcessing) { if (reasonPresent && !detailPresent) { if (rolePresent) { throw new OMBuilderException( "Multiple Role element encountered"); } else { element = factory.createSOAPFaultRole( (SOAPFault) parent, builder); rolePresent = true; } } else { throw new OMBuilderException( "Wrong element order encountered at " + parser.getLocalName()); } } else { throw new OMBuilderException( "Reason element should have a text"); } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) { if (!reasonProcessing) { if (reasonPresent) { if (detailPresent) { throw new OMBuilderException( "Multiple detail element encountered"); } else { element = factory.createSOAPFaultDetail( (SOAPFault) parent, builder); detailPresent = true; } } else { throw new OMBuilderException( "wrong element order encountered at " + parser.getLocalName()); } } else { throw new OMBuilderException( "Reason element should have a text"); } } else { throw new OMBuilderException( parser.getLocalName() + " unsupported element in SOAPFault element"); } } else if (elementLevel == 5) { if (parent.getLocalName().equals( SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) { if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) { if (!valuePresent) { element = factory.createSOAPFaultValue( (SOAPFaultCode) parent, builder); valuePresent = true; codeprocessing = false; } else { throw new OMBuilderException( "Multiple value Encountered in code element"); } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) { if (!subcodePresent) { if (valuePresent) { element = factory.createSOAPFaultSubCode( (SOAPFaultCode) parent, builder); subcodePresent = true; subCodeProcessing = true; } else { throw new OMBuilderException( "Value should present before the subcode"); } } else { throw new OMBuilderException( "multiple subcode Encountered in code element"); } } else { throw new OMBuilderException( parser.getLocalName() + " is not supported inside the code element"); } } else if (parent.getLocalName().equals( SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) { if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) { element = factory.createSOAPFaultText( (SOAPFaultReason) parent, builder); ((OMNodeEx) element).setComplete(false); reasonProcessing = false; } else { throw new OMBuilderException( parser.getLocalName() + " is not supported inside the reason"); } } else if (parent.getLocalName().equals( SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) { element = this.factory.createOMElement( parser.getLocalName(), null, parent, builder); builder.setProcessingDetailElements(true); detailElementNames = new Vector(); detailElementNames.add(parser.getLocalName()); } else { throw new OMBuilderException( parent.getLocalName() + " should not have child element"); } } else if (elementLevel > 5) { if (parent.getLocalName().equals( SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) { if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) { if (subcodeValuePresent) { throw new OMBuilderException( "multiple subCode value encountered"); } else { element = factory.createSOAPFaultValue( (SOAPFaultSubCode) parent, builder); subcodeValuePresent = true; subSubcodePresent = false; subCodeProcessing = false; } } else if (parser.getLocalName().equals( SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) { if (subcodeValuePresent) { if (!subSubcodePresent) { element = factory.createSOAPFaultSubCode( (SOAPFaultSubCode) parent, builder); subcodeValuePresent = false; subSubcodePresent = true; subCodeProcessing = true; } else { throw new OMBuilderException( "multiple subcode encountered"); } } else { throw new OMBuilderException( "Value should present before the subcode"); } } else { throw new OMBuilderException( parser.getLocalName() + " is not supported inside the subCode element"); } } else if (builder.isProcessingDetailElements()) { int detailElementLevel = 0; boolean localNameExist = false; for (int i = 0; i < detailElementNames.size(); i++) { if (parent.getLocalName().equals( detailElementNames.get(i))) { localNameExist = true; detailElementLevel = i + 1; } } if (localNameExist) { detailElementNames.setSize(detailElementLevel); element = this.factory.createOMElement( parser.getLocalName(), null, parent, builder); detailElementNames.add(parser.getLocalName()); } } else { throw new OMBuilderException( parent.getLocalName() + " should not have child at element level " + elementLevel); } } processNamespaceData(element, false); processAttributes(element); return element; } }./src/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java0000664000175000017500000001445411767656530023700 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.builder; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.exception.OMBuilderException; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPProcessingException; import org.w3c.dom.Element; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class SOAP11BuilderHelper extends SOAPBuilderHelper implements SOAP11Constants { private SOAPFactory factory; private boolean faultcodePresent = false; private boolean faultstringPresent = false; public SOAP11BuilderHelper(StAXSOAPModelBuilder builder) { super(builder); factory = builder.getSoapFactory(); } public OMElement handleEvent(XMLStreamReader parser, OMElement parent, int elementLevel) throws SOAPProcessingException { this.parser = parser; OMElement element = null; String localName = parser.getLocalName(); if (elementLevel == 4) { if (SOAP_FAULT_CODE_LOCAL_NAME.equals(localName)) { SOAPFaultCode code = factory.createSOAPFaultCode( (SOAPFault) parent, builder); processNamespaceData(code, false); processAttributes(code); processText(parser, code); ((OMNodeEx) code).setComplete(true); element = code; ((StAXSOAPModelBuilder) builder).adjustElementLevel(-1); faultcodePresent = true; } else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) { SOAPFaultReason reason = factory.createSOAPFaultReason( (SOAPFault) parent, builder); processNamespaceData(reason, false); processAttributes(reason); processText(parser, reason); ((OMNodeEx) reason).setComplete(true); element = reason; ((StAXSOAPModelBuilder) builder).adjustElementLevel(-1); faultstringPresent = true; } else if (SOAP_FAULT_ACTOR_LOCAL_NAME.equals(localName)) { element = factory.createSOAPFaultRole((SOAPFault) parent, builder); processNamespaceData(element, false); processAttributes(element); } else if (SOAP_FAULT_DETAIL_LOCAL_NAME.equals(localName)) { element = factory.createSOAPFaultDetail((SOAPFault) parent, builder); processNamespaceData(element, false); processAttributes(element); } else { element = factory.createOMElement( localName, null, parent, builder); processNamespaceData(element, false); processAttributes(element); } } else if (elementLevel == 5) { String parentTagName = ""; if (parent instanceof Element) { parentTagName = ((Element) parent).getTagName(); } else { parentTagName = parent.getLocalName(); } if (parentTagName.equals(SOAP_FAULT_CODE_LOCAL_NAME)) { throw new OMBuilderException( "faultcode element should not have children"); } else if (parentTagName.equals( SOAP_FAULT_STRING_LOCAL_NAME)) { throw new OMBuilderException( "faultstring element should not have children"); } else if (parentTagName.equals( SOAP_FAULT_ACTOR_LOCAL_NAME)) { throw new OMBuilderException( "faultactor element should not have children"); } else { element = this.factory.createOMElement( localName, null, parent, builder); processNamespaceData(element, false); processAttributes(element); } } else if (elementLevel > 5) { element = this.factory.createOMElement(localName, null, parent, builder); processNamespaceData(element, false); processAttributes(element); } return element; } private void processText(XMLStreamReader parser, OMElement value) { try { int token = parser.next(); while (token != XMLStreamReader.END_ELEMENT) { if (token == XMLStreamReader.CHARACTERS) { factory.createOMText(value, parser.getText()); } else if (token == XMLStreamReader.CDATA) { factory.createOMText(value, parser.getText()); } else { throw new SOAPProcessingException( "Only Characters are allowed here"); } token = parser.next(); } } catch (XMLStreamException e) { throw new SOAPProcessingException(e); } } }./src/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java0000664000175000017500000000636011767656530024611 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMException; import org.apache.axiom.om.impl.builder.OMAttachmentAccessorMimePartProvider; import org.apache.axiom.om.impl.builder.XOPBuilder; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.util.stax.xop.XOPDecodingStreamReader; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamReader; public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements XOPBuilder { /** Attachments handles deferred parsing of incoming MIME Messages. */ Attachments attachments; int partIndex = 0; public MTOMStAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, Attachments attachments, String soapVersion) { super(new XOPDecodingStreamReader(parser, new OMAttachmentAccessorMimePartProvider( attachments)), factory, soapVersion); this.attachments = attachments; } /** * @param reader * @param attachments */ public MTOMStAXSOAPModelBuilder(XMLStreamReader reader, Attachments attachments, String soapVersion) { super(new XOPDecodingStreamReader(reader, new OMAttachmentAccessorMimePartProvider( attachments)), soapVersion); this.attachments = attachments; } public MTOMStAXSOAPModelBuilder(XMLStreamReader reader, Attachments attachments) { super(new XOPDecodingStreamReader(reader, new OMAttachmentAccessorMimePartProvider( attachments))); this.attachments = attachments; } /* (non-Javadoc) * @see org.apache.axiom.soap.impl.builder.XOPBuilder#getDataHandler(java.lang.String) */ public DataHandler getDataHandler(String blobContentID) throws OMException { DataHandler dataHandler = attachments.getDataHandler(blobContentID); /* The getDataHandler javadoc indicates that null indicate that the datahandler * was not found * if (dataHandler == null) { throw new OMException( "Referenced Attachment not found in the MIME Message. ContentID:" + blobContentID); } */ return dataHandler; } public Attachments getAttachments() { return attachments; } } ./src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java0000664000175000017500000005166311767656530024122 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.builder; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMMetaFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.CustomBuilder; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPMessage; import org.apache.axiom.soap.SOAPModelBuilder; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamReader; /** * StAX based builder that produces a SOAP infoset model. * It builds SOAP specific objects such as {@link SOAPEnvelope}, {@link SOAPHeader}, * {@link org.apache.axiom.soap.SOAPHeaderBlock} and {@link SOAPBody}. *

        * This builder offers two different ways to handle SOAP versions: *

          *
        • Either the SOAP version is specified when the builder is constructed. If the specified * version doesn't match the envelope namespace of the actual message, an exception is * triggered. This approach should be used when the SOAP version is known from information * other than the content of the message. For example, in the HTTP case it is possible * to identify the SOAP version based on the Content-Type header.
        • *
        • If no SOAP version is specified, the builder will automatically detect it from the * envelope namespace. It will then build the object model using the * {@link SOAPFactory} implementation corresponding to that SOAP version.
        • *
        * In both cases, the {@link SOAPFactory} is retrieved either from the {@link OMMetaFactory} * specified when the builder is constructed, or if none is specified, from the default * meta factory returned by {@link OMAbstractFactory#getMetaFactory()}. */ public class StAXSOAPModelBuilder extends StAXOMBuilder implements SOAPModelBuilder { SOAPMessage soapMessage; /** Field envelope */ private SOAPEnvelope envelope; private OMNamespace envelopeNamespace; private String namespaceURI; /** * The meta factory used to get the SOAPFactory implementation when SOAP version detection * is enabled. This is only used if soapFactory is null. */ private OMMetaFactory metaFactory; private SOAPFactory soapFactory; /** Field headerPresent */ private boolean headerPresent = false; /** Field bodyPresent */ private boolean bodyPresent = false; /** Field log */ private static final Log log = LogFactory.getLog(StAXSOAPModelBuilder.class); private boolean processingFault = false; //added /* This is used to indicate whether detail element is processing in soap 1.2 builderhelper */ private boolean processingDetailElements = false; private SOAPBuilderHelper builderHelper; private String parserVersion = null; private static final boolean isDebugEnabled = log.isDebugEnabled(); /** * Constructor. * * @param parser the parser to read the SOAP message from * @param soapVersion the namespace URI corresponding to the expected SOAP version * of the message */ public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) { this(OMAbstractFactory.getMetaFactory(), parser, soapVersion); } /** * Constructor. * * @param metaFactory the meta factory used to get the appropriate {@link SOAPFactory} * implementation * @param parser the parser to read the SOAP message from * @param soapVersion the namespace URI corresponding to the expected SOAP version * of the message */ public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader parser, String soapVersion) { super(metaFactory.getOMFactory(), parser); this.metaFactory = metaFactory; parserVersion = parser.getVersion(); identifySOAPVersion(soapVersion); } /** * Constructor. * * @param parser the parser to read the SOAP message from */ public StAXSOAPModelBuilder(XMLStreamReader parser) { this(OMAbstractFactory.getMetaFactory(), parser); } /** * Constructor. * * @param metaFactory the meta factory used to get the appropriate {@link SOAPFactory} * implementation * @param parser the parser to read the SOAP message from */ public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader parser) { super(metaFactory.getOMFactory(), parser); this.metaFactory = metaFactory; parserVersion = parser.getVersion(); SOAPEnvelope soapEnvelope = getSOAPEnvelope(); envelopeNamespace = soapEnvelope.getNamespace(); } /** * Constructor. * * @param parser the parser to read the SOAP message from * @param factory the SOAP factory to use * @param soapVersion the namespace URI corresponding to the expected SOAP version * of the message */ public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion) { super(factory, parser); soapFactory = factory; parserVersion = parser.getVersion(); identifySOAPVersion(soapVersion); } /** @param soapVersionURIFromTransport */ protected void identifySOAPVersion(String soapVersionURIFromTransport) { SOAPEnvelope soapEnvelope = getSOAPEnvelope(); if (soapEnvelope == null) { throw new SOAPProcessingException("SOAP Message does not contain an Envelope", SOAPConstants.FAULT_CODE_VERSION_MISMATCH); } envelopeNamespace = soapEnvelope.getNamespace(); if (soapVersionURIFromTransport != null) { String namespaceName = envelopeNamespace.getNamespaceURI(); if (!(soapVersionURIFromTransport.equals(namespaceName))) { throw new SOAPProcessingException( "Transport level information does not match with SOAP" + " Message namespace URI", envelopeNamespace.getPrefix() + ":" + SOAPConstants.FAULT_CODE_VERSION_MISMATCH); } } } public SOAPEnvelope getSOAPEnvelope() throws OMException { while ((envelope == null) && !done) { next(); } return envelope; } protected OMNode createNextOMElement() { OMNode newElement = null; if (elementLevel == 3 && customBuilderForPayload != null) { OMNode parent = lastNode; if (parent != null && parent.isComplete()) { parent = (OMNode) lastNode.getParent(); } if (parent instanceof SOAPBody) { newElement = createWithCustomBuilder(customBuilderForPayload, soapFactory); } } if (newElement == null && customBuilders != null && elementLevel <= maxDepthForCustomBuilders) { String namespace = parser.getNamespaceURI(); String localPart = parser.getLocalName(); CustomBuilder customBuilder = getCustomBuilder(namespace, localPart); if (customBuilder != null) { newElement = createWithCustomBuilder(customBuilder, soapFactory); } } if (newElement == null) { newElement = createOMElement(); } else { elementLevel--; // Decrease level since custom builder read the end element event } return newElement; } /** * Method createOMElement. * * @return Returns OMNode. * @throws OMException */ protected OMNode createOMElement() throws OMException { OMElement node; String elementName = parser.getLocalName(); if (lastNode == null) { node = constructNode(null, elementName, true); setSOAPEnvelope(node); } else if (lastNode.isComplete()) { OMContainer parent = lastNode.getParent(); if (parent == document) { // If we get here, this means that we found the SOAP envelope, but that it was // preceded by a comment node. Since constructNode will create a new document // based on the SOAP version of the envelope, we simply discard the last node // and do as if we just encountered the first node in the document. lastNode = null; node = constructNode(null, elementName, true); setSOAPEnvelope(node); } else { node = constructNode((OMElement)parent, elementName, false); ((OMNodeEx) lastNode).setNextOMSibling(node); ((OMNodeEx) node).setPreviousOMSibling(lastNode); } } else { OMContainerEx e = (OMContainerEx) lastNode; node = constructNode((OMElement) lastNode, elementName, false); e.setFirstChild(node); } if (isDebugEnabled) { log.debug("Build the OMElement " + node.getLocalName() + " by the StaxSOAPModelBuilder"); } return node; } protected void setSOAPEnvelope(OMElement node) { soapMessage.setSOAPEnvelope((SOAPEnvelope) node); soapMessage.setXMLVersion(parserVersion); soapMessage.setCharsetEncoding(charEncoding); } /** * Method constructNode * * @param parent * @param elementName * @param isEnvelope */ protected OMElement constructNode(OMElement parent, String elementName, boolean isEnvelope) { OMElement element; if (parent == null) { // Now I've found a SOAP Envelope, now create SOAPDocument and SOAPEnvelope here. if (!elementName.equals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME)) { throw new SOAPProcessingException("First Element must contain the local name, " + SOAPConstants.SOAPENVELOPE_LOCAL_NAME + " , but found " + elementName, SOAPConstants.FAULT_CODE_SENDER); } // determine SOAP version and from that determine a proper factory here. if (soapFactory == null) { namespaceURI = this.parser.getNamespaceURI(); if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) { soapFactory = metaFactory.getSOAP12Factory(); if (isDebugEnabled) { log.debug("Starting to process SOAP 1.2 message"); } } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) { soapFactory = metaFactory.getSOAP11Factory(); if (isDebugEnabled) { log.debug("Starting to process SOAP 1.1 message"); } } else { throw new SOAPProcessingException( "Only SOAP 1.1 or SOAP 1.2 messages are supported in the" + " system", SOAPConstants.FAULT_CODE_VERSION_MISMATCH); } } else { namespaceURI = soapFactory.getSoapVersionURI(); } // create a SOAPMessage to hold the SOAP envelope and assign the SOAP envelope in that. soapMessage = soapFactory.createSOAPMessage(this); // TODO: this needs to be reviewed; why do we create an OMDocument in StAXOMBuilder and // then replace it here OMDocument orgDocument = this.document; soapMessage.setXMLEncoding(orgDocument.getXMLEncoding()); this.document = soapMessage; if (charEncoding != null) { document.setCharsetEncoding(charEncoding); } envelope = soapFactory.createSOAPEnvelope(this); element = envelope; processNamespaceData(element, true); // fill in the attributes processAttributes(element); } else if (elementLevel == 2) { // Must be in the right namespace regardless String elementNS = parser.getNamespaceURI(); if (!(namespaceURI.equals(elementNS))) { if (!bodyPresent || !SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) { throw new SOAPProcessingException("Disallowed element found inside Envelope : {" + elementNS + "}" + elementName); } } // this is either a header or a body if (elementName.equals(SOAPConstants.HEADER_LOCAL_NAME)) { if (headerPresent) { throw new SOAPProcessingException("Multiple headers encountered!", getSenderFaultCode()); } if (bodyPresent) { throw new SOAPProcessingException("Header Body wrong order!", getSenderFaultCode()); } headerPresent = true; element = soapFactory.createSOAPHeader((SOAPEnvelope) parent, this); processNamespaceData(element, true); processAttributes(element); } else if (elementName.equals(SOAPConstants.BODY_LOCAL_NAME)) { if (bodyPresent) { throw new SOAPProcessingException("Multiple body elements encountered", getSenderFaultCode()); } bodyPresent = true; element = soapFactory.createSOAPBody((SOAPEnvelope) parent, this); processNamespaceData(element, true); processAttributes(element); } else { throw new SOAPProcessingException(elementName + " is not supported here. Envelope can not have elements other than Header and Body.", getSenderFaultCode()); } } else if ((elementLevel == 3) && parent.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME)) { // this is a headerblock try { element = soapFactory.createSOAPHeaderBlock(elementName, null, (SOAPHeader) parent, this); } catch (SOAPProcessingException e) { throw new SOAPProcessingException("Can not create SOAPHeader block", getReceiverFaultCode(), e); } processNamespaceData(element, false); processAttributes(element); } else if ((elementLevel == 3) && parent.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME) && elementName.equals(SOAPConstants.BODY_FAULT_LOCAL_NAME)) { // this is a headerblock element = soapFactory.createSOAPFault((SOAPBody) parent, this); processNamespaceData(element, false); processAttributes(element); processingFault = true; if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(envelopeNamespace.getNamespaceURI())) { builderHelper = new SOAP12BuilderHelper(this); } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(envelopeNamespace.getNamespaceURI())) { builderHelper = new SOAP11BuilderHelper(this); } } else if (elementLevel > 3 && processingFault) { element = builderHelper.handleEvent(parser, parent, elementLevel); } else { // this is neither of above. Just create an element element = soapFactory.createOMElement(elementName, null, parent, this); processNamespaceData(element, false); processAttributes(element); } return element; } private String getSenderFaultCode() { return envelope.getVersion().getSenderFaultCode().getLocalPart(); } private String getReceiverFaultCode() { return envelope.getVersion().getReceiverFaultCode().getLocalPart(); } public void endElement() { if (lastNode.isComplete()) { OMElement parent = (OMElement) lastNode.getParent(); ((OMNodeEx) parent).setComplete(true); lastNode = parent; } else { OMNode e = lastNode; ((OMNodeEx) e).setComplete(true); } } /** Method createDTD. Overriding the default behaviour as a SOAPMessage should not have a DTD. */ protected OMNode createDTD() throws OMException { throw new OMException("SOAP message MUST NOT contain a Document Type Declaration(DTD)"); } /** Method createPI. Overriding the default behaviour as a SOAP Message should not have a PI. */ protected OMNode createPI() throws OMException { throw new OMException("SOAP message MUST NOT contain Processing Instructions(PI)"); } /** * Method getDocumentElement. * * @return Returns OMElement. */ public OMElement getDocumentElement() { return envelope != null ? envelope : getSOAPEnvelope(); } /** * Method processNamespaceData. * * @param node * @param isSOAPElement */ protected void processNamespaceData(OMElement node, boolean isSOAPElement) { super.processNamespaceData(node); if (isSOAPElement) { OMNamespace omNS = node.getNamespace(); if (omNS != null) { String uri = omNS.getNamespaceURI(); if (uri.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) || uri.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { // okay } else { throw new SOAPProcessingException("invalid SOAP namespace URI. " + "Only " + SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI + " and " + SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI + " are supported.", SOAP12Constants.FAULT_CODE_SENDER); } } } } /*these three methods to set and check detail element processing or mandatory fault element are present */ public OMNamespace getEnvelopeNamespace() { return envelopeNamespace; } public boolean isProcessingDetailElements() { return processingDetailElements; } public void setProcessingDetailElements(boolean value) { processingDetailElements = value; } public SOAPMessage getSoapMessage() { return soapMessage; } public OMDocument getDocument() { return this.soapMessage; } /** @return Returns the soapFactory. */ protected SOAPFactory getSoapFactory() { return soapFactory; } /** * Increase or decrease the element level by the desired amount. * This is needed by the SOAP11BuilderHelper to account for the different * depths for the SOAP fault sytax. * @param value */ void adjustElementLevel(int value) { elementLevel = elementLevel + value; } } ./src/org/apache/axiom/soap/impl/builder/SOAPBuilderHelper.java0000664000175000017500000001033111767656530023524 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap.impl.builder; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.impl.exception.OMBuilderException; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPProcessingException; import javax.xml.stream.XMLStreamReader; public abstract class SOAPBuilderHelper { protected StAXSOAPModelBuilder builder; protected XMLStreamReader parser; protected SOAPBuilderHelper(StAXSOAPModelBuilder builder) { this.builder = builder; } public abstract OMElement handleEvent(XMLStreamReader parser, OMElement element, int elementLevel) throws SOAPProcessingException; protected void processNamespaceData(OMElement node, boolean checkSOAPNamespace) { int namespaceCount = parser.getNamespaceCount(); for (int i = 0; i < namespaceCount; i++) { String namespaceURI = parser.getNamespaceURI(i); if (namespaceURI != null) { node.declareNamespace(parser.getNamespaceURI(i), parser.getNamespacePrefix(i)); } } // set the own namespace String namespaceURI = parser.getNamespaceURI(); String prefix = parser.getPrefix(); OMNamespace namespace = null; if (namespaceURI != null && namespaceURI.length() > 0) { if (prefix == null) { // this means, this elements has a default namespace or it has inherited a default namespace from its parent namespace = node.findNamespace(namespaceURI, ""); if (namespace == null) { namespace = node.declareNamespace(namespaceURI, ""); } } else { namespace = node.findNamespace(namespaceURI, prefix); } node.setNamespace(namespace); } // TODO we got to have this to make sure OM reject mesagess that are not name space qualified // But got to comment this to interop with Axis.1.x // if (namespace == null) { // throw new OMException("All elements must be namespace qualified!"); // } if (checkSOAPNamespace) { if (node.getNamespace() != null && !node.getNamespace().getNamespaceURI().equals( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) && !node.getNamespace().getNamespaceURI().equals( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { throw new OMBuilderException("invalid SOAP namespace URI"); } } } protected void processAttributes(OMElement node) { int attribCount = parser.getAttributeCount(); for (int i = 0; i < attribCount; i++) { OMNamespace ns = null; String uri = parser.getAttributeNamespace(i); if (uri != null && uri.hashCode() != 0) { ns = node.findNamespace(uri, parser.getAttributePrefix(i)); } // todo if the attributes are supposed to namespace qualified all the time // todo then this should throw an exception here node.addAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i), ns); } } } ./src/org/apache/axiom/soap/SOAPFaultNode.java0000664000175000017500000000273611767656530020302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; public interface SOAPFaultNode extends OMElement { /** * Eran Chinthaka (chinthaka@apache.org) */ /** * each SOAP node is identified by a URI. The value of the Node element information item is the * URI that identifies the SOAP node that generated the fault. SOAP nodes that do not act as the * ultimate SOAP receiver MUST include this element information item. An ultimate SOAP receiver * MAY include this element information item to indicate explicitly that it generated the * fault. * * @param uri */ void setNodeValue(String uri); String getNodeValue(); } ./src/org/apache/axiom/soap/SOAPMessage.java0000664000175000017500000000206511767656530020000 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMDocument; public interface SOAPMessage extends OMDocument { SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException; void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException; } ./src/org/apache/axiom/soap/SOAPFaultClassifier.java0000664000175000017500000000321311767656530021470 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; /** * Common superinterface for {@link SOAPFaultCode} and {@link SOAPFaultSubCode}. * This interface enables manipulation of SOAP fault codes and SOAP fault sub * codes using common code. */ public interface SOAPFaultClassifier extends OMElement { /** * Fault SubCode contain only one mandatory Value child. This value child contains a QName * * @param value */ void setValue(SOAPFaultValue value) throws SOAPProcessingException; /** @return Returns SOAPFaultValue. */ SOAPFaultValue getValue(); /** * Fault SubCode can contain an optional SubCode * * @param subCode */ void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException; /** @return Returns SOAPFaultSubCode. */ SOAPFaultSubCode getSubCode(); } ./src/org/apache/axiom/soap/SOAPFault.java0000664000175000017500000000667511767656530017502 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; /** * An element in the SOAPBody object that contains error and/or status information. * This information may relate to errors in the OMMessage object or to problems that * are not related to the content in the message itself. Problems not related to the message itself * are generally errors in processing, such as the inability to communicate with an upstream * server. *

        * The SOAPFault interface provides methods for retrieving the information contained in * a SOAPFault object and for setting the fault code, the fault actor, and a string * describing the fault. B fault code is one of the codes defined in the SOAP 1.1 specification that * describe the fault. An actor is an intermediate recipient to whom a message was routed. The * message path may include one or more actors, or, if no actors are specified, the message goes * only to the default actor, which is the final intended recipient. */ public interface SOAPFault extends OMElement { /** * SOAPFaultCode is a mandatory item in a Fault, in SOAP 1.2 specification * * @param soapFaultCode */ void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException; SOAPFaultCode getCode(); /** * SOAPFaultReason is a mandatory item in a Fault, in SOAP 1.2 specification * * @param reason */ void setReason(SOAPFaultReason reason) throws SOAPProcessingException; SOAPFaultReason getReason(); /** * SOAPFaultNode is an optional item in a Fault, in SOAP 1.2 specification * * @param node */ void setNode(SOAPFaultNode node) throws SOAPProcessingException; SOAPFaultNode getNode(); /** * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification * * @param role */ void setRole(SOAPFaultRole role) throws SOAPProcessingException; SOAPFaultRole getRole(); /** * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification * * @param detail */ void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException; SOAPFaultDetail getDetail(); /** * Returns Exception if there is one in the SOAP fault. *

        * If the exception is like; stack trace goes here * * * @return Returns Exception. * @throws org.apache.axiom.om.OMException * */ Exception getException() throws OMException; void setException(Exception e) throws OMException; } ./src/org/apache/axiom/soap/SOAP11Version.java0000664000175000017500000000404611767656530020204 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import javax.xml.namespace.QName; /** * Version-specific stuff for SOAP 1.1 */ public class SOAP11Version implements SOAPVersion, SOAP11Constants { private static final SOAP11Version singleton = new SOAP11Version(); public static SOAP11Version getSingleton() { return singleton; } private SOAP11Version() { } public String getEnvelopeURI() { return SOAP_ENVELOPE_NAMESPACE_URI; } public String getEncodingURI() { return SOAP_ENCODING_NAMESPACE_URI; } public QName getRoleAttributeQName() { return QNAME_ACTOR; } public String getNextRoleURI() { return SOAP_ACTOR_NEXT; } public QName getMustUnderstandFaultCode() { return QNAME_MU_FAULTCODE; } public QName getSenderFaultCode() { return QNAME_SENDER_FAULTCODE; } public QName getReceiverFaultCode() { return QNAME_RECEIVER_FAULTCODE; } public QName getFaultReasonQName() { return QNAME_FAULT_REASON; } public QName getFaultCodeQName() { return QNAME_FAULT_CODE; } public QName getFaultDetailQName() { return QNAME_FAULT_DETAIL; } public QName getFaultRoleQName() { return QNAME_FAULT_ROLE; } } ./src/org/apache/axiom/soap/SOAP12Constants.java0000664000175000017500000001232111767656530020527 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import javax.xml.namespace.QName; public interface SOAP12Constants extends SOAPConstants { /** Eran Chinthaka (chinthaka@apache.org) */ public String SOAP_ENVELOPE_NAMESPACE_URI = "http://www.w3.org/2003/05/soap-envelope"; public String SOAP_ENCODING_NAMESPACE_URI = "http://www.w3.org/2003/05/soap-encoding"; public static final String SOAP_ROLE = "role"; public static final String SOAP_RELAY = "relay"; // SOAP Fault Code public static final String SOAP_FAULT_CODE_LOCAL_NAME = "Code"; public static final String SOAP_FAULT_SUB_CODE_LOCAL_NAME = "Subcode"; public static final String SOAP_FAULT_VALUE_LOCAL_NAME = "Value"; // SOAP Fault Codes public static final String SOAP_FAULT_VALUE_VERSION_MISMATCH = "VersionMismatch"; public static final String SOAP_FAULT_VALUE_MUST_UNDERSTAND = "MustUnderstand"; public static final String SOAP_FAULT_VALUE_DATA_ENCODING_UKNOWN = "DataEncodingUnknown"; public static final String SOAP_FAULT_VALUE_SENDER = "Sender"; public static final String SOAP_FAULT_VALUE_RECEIVER = "Receiver"; // SOAP Fault Reason public static final String SOAP_FAULT_REASON_LOCAL_NAME = "Reason"; public static final String SOAP_FAULT_TEXT_LOCAL_NAME = "Text"; public static final String SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME = "lang"; public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_URI = "http://www.w3.org/XML/1998/namespace"; public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX = "xml"; // SOAP Fault Node public static final String SOAP_FAULT_NODE_LOCAL_NAME = "Node"; // SOAP Fault Detail public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "Detail"; // SOAP Fault Role public static final String SOAP_FAULT_ROLE_LOCAL_NAME = "Role"; //SOAP 1.2 Content Type public static final String SOAP_12_CONTENT_TYPE = "application/soap+xml"; // -------- SOAP Fault Codes ------------------------------ public static final String FAULT_CODE_SENDER = "Sender"; public static final String FAULT_CODE_RECEIVER = "Receiver"; public static final String SOAP_ROLE_NEXT = "http://www.w3.org/2003/05/soap-envelope/role/next"; public static final String SOAP_ROLE_NONE = "http://www.w3.org/2003/05/soap-envelope/role/none"; public static final String SOAP_ROLE_ULTIMATE_RECEIVER = "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"; // QNames static final QName QNAME_ROLE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_ROLE); static final QName QNAME_RELAY = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_RELAY); static final QName QNAME_MU_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_MUST_UNDERSTAND); static final QName QNAME_SENDER_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_SENDER); static final QName QNAME_RECEIVER_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_RECEIVER); static final QName QNAME_FAULT_REASON = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_REASON_LOCAL_NAME); static final QName QNAME_FAULT_CODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_CODE_LOCAL_NAME); static final QName QNAME_FAULT_NODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_NODE_LOCAL_NAME); static final QName QNAME_FAULT_DETAIL = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_DETAIL_LOCAL_NAME); static final QName QNAME_FAULT_ROLE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_ROLE_LOCAL_NAME); static final QName QNAME_FAULT_VALUE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_VALUE_LOCAL_NAME); static final QName QNAME_FAULT_SUBCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_SUB_CODE_LOCAL_NAME); static final QName QNAME_FAULT_TEXT = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_FAULT_TEXT_LOCAL_NAME); } ./src/org/apache/axiom/soap/SOAPFactory.java0000664000175000017500000002616211767656530020027 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; public interface SOAPFactory extends OMFactory { String getSoapVersionURI(); SOAPVersion getSOAPVersion(); /** Eran Chinthaka (chinthaka@apache.org) */ SOAPMessage createSOAPMessage(); SOAPMessage createSOAPMessage(OMXMLParserWrapper builder); SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper); /** * Create a SOAP envelope. The returned element will have the namespace URI specified by the * SOAP version that this factory represents. It will have the prefix given by * {@link SOAPConstants#SOAP_DEFAULT_NAMESPACE_PREFIX}. It will also have a corresponding * namespace declaration. * * @return the SOAP envelope */ // TODO: when does this thing throw a SOAPProcessingException?? SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException; SOAPEnvelope createSOAPEnvelope(OMNamespace ns); SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder); /** * @param envelope * @return Returns SOAPHeader. */ SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException; SOAPHeader createSOAPHeader() throws SOAPProcessingException; /** * @param envelope * @param builder * @return Returns SOAPHeader. */ SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder); /** * @param localName * @param ns * @return Returns SOAPHeaderBlock. */ SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException; SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException; /** * Create SOAPHeaderBlock that has an OMDataSource * @param localName * @param ns * @param ds * @return SOAPHeaderBlock * @throws SOAPProcessingException */ SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, OMDataSource ds) throws SOAPProcessingException; /** * @param localName * @param ns * @param parent * @param builder * @return Returns SOAPHeaderBlock. */ SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException; /** * @param parent * @param e * @return Returns SOAPFault. */ SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException; SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException; SOAPFault createSOAPFault() throws SOAPProcessingException; /** * @param parent * @param builder * @return Returns SOAPFault. */ SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder); /** * @param envelope * @return Returns SOAPBody. */ SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException; SOAPBody createSOAPBody() throws SOAPProcessingException; /** * @param envelope * @param builder * @return Returns SOAPBody. */ SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder); /* ======================== = SOAPFaultCode = ======================== */ /** * Code eii under SOAPFault (parent) * * @param parent * @return Returns SOAPFaultCode. */ SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException; SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException; /** * Code eii under SOAPFault (parent) * * @param parent * @param builder * @return Returns SOAPFaultCode. */ SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultCodeValue = ======================== */ /** * Value eii under Code (parent) * * @param parent * @return Returns SOAPFaultValue. */ SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException; SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException; /** * Value eii under Code (parent) * * @param parent * @param builder * @return Returns SOAPFaultValue. */ SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultSubCode = ======================== */ /** * SubCode eii under Value (parent) * * @param parent * @return Returns SOAPFaultValue. */ //added SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException; //added SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder); //changed SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException; SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException; /** * SubCode eii under Value (parent) * * @param parent * @param builder * @return Returns SOAPFaultSubCode. */ //changed SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder); /** * SubCode eii under SubCode (parent) * * @param parent * @return Returns SOAPFaultSubCode. */ SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException; /** * SubCode eii under SubCode (parent) * * @param parent * @param builder * @return Returns SOAPFaultSubCode. */ SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultReason = ======================== */ /** * Reason eii under SOAPFault (parent) * * @param parent * @return Returns SOAPFaultReason. */ SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException; SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException; /** * Reason eii under SOAPFault (parent) * * @param parent * @param builder * @return Returns SOAPFaultReason. */ SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultReasonText = ======================== */ /** * SubCode eii under SubCode (parent) * * @param parent * @return Returns SOAPFaultText. */ SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException; SOAPFaultText createSOAPFaultText() throws SOAPProcessingException; /** * SubCode eii under SubCode (parent) * * @param parent * @param builder * @return Returns SOAPFaultText. */ SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultNode = ======================== */ /** * Node eii under SOAPFault (parent) * * @param parent * @return Returns SOAPFaultNode. */ SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException; SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException; /** * Node eii under SOAPFault (parent) * * @param parent * @param builder * @return Returns SOAPFaultNode. */ SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultRole = ======================== */ /** * Role eii under SOAPFault (parent) * * @param parent * @return Returns SOAPFaultRole. */ SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException; SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException; /** * Role eii under SOAPFault (parent) * * @param parent * @param builder * @return Returns SOAPFaultRole. */ SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder); /*======================== = SOAPFaultDetail = ======================== */ /** * Detail eii under SOAPFault (parent) * * @param parent * @return Returns SOAPFaultDetail. */ SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException; SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException; /** * Role eii under SOAPFault (parent) * * @param parent * @param builder * @return Returns SOAPFaultDetail. */ SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder); /** * Method getDefaultEnvelope. This returns a SOAP envelope consisting with an empty Header and a * Body. This is just a util method which can be used everywhere. * * @return Returns SOAPEnvelope. */ SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException; SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException; OMNamespace getNamespace(); } ./src/org/apache/axiom/soap/SOAP12Version.java0000664000175000017500000000404411767656530020203 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import javax.xml.namespace.QName; /** * Version-specific stuff for SOAP 1.2 */ public class SOAP12Version implements SOAPVersion, SOAP12Constants { private static final SOAP12Version singleton = new SOAP12Version(); public static SOAP12Version getSingleton() { return singleton; } private SOAP12Version() { } public String getEnvelopeURI() { return SOAP_ENVELOPE_NAMESPACE_URI; } public String getEncodingURI() { return SOAP_ENCODING_NAMESPACE_URI; } public QName getRoleAttributeQName() { return QNAME_ROLE; } public String getNextRoleURI() { return SOAP_ROLE_NEXT; } public QName getMustUnderstandFaultCode() { return QNAME_MU_FAULTCODE; } public QName getSenderFaultCode() { return QNAME_SENDER_FAULTCODE; } public QName getReceiverFaultCode() { return QNAME_RECEIVER_FAULTCODE; } public QName getFaultReasonQName() { return QNAME_FAULT_REASON; } public QName getFaultCodeQName() { return QNAME_FAULT_CODE; } public QName getFaultDetailQName() { return QNAME_FAULT_DETAIL; } public QName getFaultRoleQName() { return QNAME_FAULT_ROLE; } } ./src/org/apache/axiom/soap/SOAPBody.java0000664000175000017500000000662411767656530017316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; /** * An object that represents the contents of the SOAP body element in a SOAP message. B SOAP body * element consists of XML data that affects the way the application-specific content is processed. *

        * B SOAPBody object contains OMBodyBlock objects, which have the content * for the SOAP body. B SOAPFault object, which carries status and/or error * information, is an example of a OMBodyBlock object. */ public interface SOAPBody extends OMElement { /** * Creates a new SOAPFault object and adds it to this SOAPBody * object. * * @param e * @return the new SOAPFault object * @throws org.apache.axiom.om.OMException * if there is a SOAP error * @throws org.apache.axiom.om.OMException * */ SOAPFault addFault(Exception e) throws OMException; /** * Indicates whether a SOAPFault object exists in this SOAPBody * object. * * @return true if a SOAPFault object exists in this * SOAPBody object; false otherwise */ boolean hasFault(); /** * Returns the SOAPFault object in this SOAPBody object. * * @return the SOAPFault object in this SOAPBody object */ SOAPFault getFault(); /** * @param soapFault * @throws OMException */ void addFault(SOAPFault soapFault) throws OMException; /** * Retrieves the OMNamespace of the first element in the body. * The implementation might build the OMElement or it may * obtain this information from the builder/parser without building * the OMElement. Use this method in the situations where you need * to know the OMNamespace, but don't necessarily need the OMElement. * @return OMNamespace of first element in the body or null */ public OMNamespace getFirstElementNS(); /** * Retrieves the local name of the first element in the body. * The implementation might build the OMElement or it may * obtain this information from the builder/parser without building * the OMElement. Use this method in the situations where you need * to know the name, but don't necessarily need the OMElement. * @return local name of first element in the body or null */ public String getFirstElementLocalName(); } ./src/org/apache/axiom/soap/SOAPHeaderBlock.java0000664000175000017500000001135511767656530020561 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMSourcedElement; /** *

        An object representing the contents in the SOAP header part of the SOAP envelope. The * immediate children of a SOAPHeader object can be represented only as * SOAPHeaderBlock objects.

        B SOAPHeaderBlock object can have other * OMElement objects as its children.

        */ public interface SOAPHeaderBlock extends OMSourcedElement { /** * A SOAPHeaderBlock may be represented as an unexpanded OMSourcedElement. * In such cases, the underlying OMDataSource may have a property that contains * the value of the ROLE/ACTOR, RELAY or MUST_UNDERSTAND setting. */ public String ROLE_PROPERTY = "org.apache.axiom.soap.SOAPHeader.ROLE"; public String RELAY_PROPERTY = "org.apache.axiom.soap.SOAPHeader.RELAY"; public String MUST_UNDERSTAND_PROPERTY = "org.apache.axiom.soap.SOAPHeader.MUST_UNDERSTAND"; /** * Sets the actor associated with this SOAPHeaderBlock object to the specified * actor. * * @param roleURI a String giving the URI of the actor to set * @throws IllegalArgumentException * if there is a problem in setting the actor. * @see #getRole() getRole() */ void setRole(String roleURI); /** * Returns the uri of the actor associated with this SOAPHeaderBlock object. * * @return a String giving the URI of the actor * @see #setRole(String) setRole(java.lang.String) */ String getRole(); /** * Sets the mustUnderstand attribute for this SOAPHeaderBlock object to be on or * off.

        If the mustUnderstand attribute is on, the actor who receives the * SOAPHeaderBlock must process it correctly. This ensures, for example, that if * the SOAPHeaderBlock object modifies the message, that the message is being * modified correctly.

        * * @param mustUnderstand true to set the mustUnderstand attribute on; * false to turn if off * @throws IllegalArgumentException * if there is a problem in setting the actor. * @see #getMustUnderstand() getMustUnderstand() */ void setMustUnderstand(boolean mustUnderstand); void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException; /** * Returns whether the mustUnderstand attribute for this SOAPHeaderBlock object is * turned on. * * @return true if the mustUnderstand attribute of this * SOAPHeaderBlock object is turned on; false otherwise */ boolean getMustUnderstand() throws SOAPProcessingException; boolean isProcessed(); /** * We need to know whether all the mustUnderstand headers have been processed by the node. This * will done by a specific validation handler at the end of the execution chain. For this all * the handlers who process a particular header block must explicitly say that he processesd the * header by calling setProcessed() */ void setProcessed(); /** * Sets the relay attribute for this SOAPHeaderBlock to be either true or false. The SOAP relay * attribute is set to true to indicate that the SOAP header block must be relayed by any node * that is targeted by the header block but not actually process it. * * @param relay a boolean giving the value to be set */ void setRelay(boolean relay); /** * Returns the relay status associated with this SOAPHeaderBlock object. * * @return a boolean giving the relay status */ boolean getRelay(); /** * What SOAP version is this HeaderBlock? * * @return a SOAPVersion, one of the two singletons. */ SOAPVersion getVersion(); } ./src/org/apache/axiom/soap/SOAPEnvelope.java0000664000175000017500000000637311767656530020177 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; /** Interface SOAPEnvelope */ public interface SOAPEnvelope extends OMElement { /** * Returns the SOAPHeader object for this SOAPEnvelope object.

        * This SOAPHeader will just be a container for all the headers in the OMMessage *

        * * @return the SOAPHeader object or null if there is none * @throws org.apache.axiom.om.OMException * if there is a problem obtaining the SOAPHeader object */ SOAPHeader getHeader() throws OMException; /** * Returns the SOAPBody object associated with this SOAPEnvelope * object.

        This SOAPBody will just be a container for all the BodyElements in the * OMMessage

        * * @return the SOAPBody object for this SOAPEnvelope object or * null if there is none * @throws OMException if there is a problem obtaining the SOAPBody object */ SOAPBody getBody() throws OMException; SOAPVersion getVersion(); /** * Returns true if there is a SOAPFault in the body. * The implementation may choose to get this information by building the OM * tree or use parser provided information. * @return true if SOAPFault in the body */ boolean hasFault(); /** * Retrieves the OMNamespace of the first element in the body. * The implementation might build the OMElement or it may * obtain this information from the builder/parser without building * the OMElement. Use this method in the situations where you need * to know the OMNamespace, but don't necessarily need the OMElement. * @return OMNamespace of first element in the body or null */ public OMNamespace getSOAPBodyFirstElementNS(); /** * Retrieves the local name of the first element in the body. * The implementation might build the OMElement or it may * obtain this information from the builder/parser without building * the OMElement. Use this method in the situations where you need * to know the name, but don't necessarily need the OMElement. * @return local name of first element in the body or null */ public String getSOAPBodyFirstElementLocalName(); } ./src/org/apache/axiom/soap/SOAPModelBuilder.java0000664000175000017500000000223311767656530020760 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMXMLParserWrapper; /** * SOAP specific extension to {@link OMXMLParserWrapper}. */ public interface SOAPModelBuilder extends OMXMLParserWrapper { /** * Get the SOAP envelope for the document processed by this builder. * * @return the SOAP envelope */ SOAPEnvelope getSOAPEnvelope(); } ./src/org/apache/axiom/soap/SOAPFaultCode.java0000664000175000017500000000160211767656530020256 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; public interface SOAPFaultCode extends SOAPFaultClassifier { } ./src/org/apache/axiom/soap/SOAPConstants.java0000664000175000017500000000544711767656530020377 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; public interface SOAPConstants { /** * Eran Chinthaka (chinthaka@apache.org) */ /** Field SOAP_DEFAULT_NAMESPACE_PREFIX */ static final String SOAP_DEFAULT_NAMESPACE_PREFIX = "soapenv"; /** Field SOAPENVELOPE_LOCAL_NAME */ static final String SOAPENVELOPE_LOCAL_NAME = "Envelope"; /** Field HEADER_LOCAL_NAME */ static final String HEADER_LOCAL_NAME = "Header"; /** Field BODY_LOCAL_NAME */ static final String BODY_LOCAL_NAME = "Body"; /** Field BODY_NAMESPACE_PREFIX */ static final String BODY_NAMESPACE_PREFIX = SOAP_DEFAULT_NAMESPACE_PREFIX; /** Field BODY_FAULT_LOCAL_NAME */ static final String BODY_FAULT_LOCAL_NAME = "Fault"; /** Field ATTR_MUSTUNDERSTAND */ static final String ATTR_MUSTUNDERSTAND = "mustUnderstand"; static final String ATTR_MUSTUNDERSTAND_TRUE = "true"; static final String ATTR_MUSTUNDERSTAND_FALSE = "false"; static final String ATTR_MUSTUNDERSTAND_0 = "0"; static final String ATTR_MUSTUNDERSTAND_1 = "1"; /** Field SOAPFAULT_LOCAL_NAME */ static final String SOAPFAULT_LOCAL_NAME = "Fault"; /** Field SOAPFAULT_DETAIL_LOCAL_NAME */ static final String SOAPFAULT_DETAIL_LOCAL_NAME = "detail"; static final String SOAP_FAULT_DETAIL_EXCEPTION_ENTRY = "Exception"; // -------- SOAP Fault Codes ------------------------------ static final String FAULT_CODE_VERSION_MISMATCH = "VersionMismatch"; static final String FAULT_CODE_MUST_UNDERSTAND = "MustUnderstand"; static final String FAULT_CODE_DATA_ENCODING_UNKNOWN = "DataEncodingUnknown"; // Followings are different in SOAP 1.1 and 1.2 specifications static final String FAULT_CODE_SENDER = ""; static final String FAULT_CODE_RECEIVER = ""; // Special Property available on some parsers to get the // Qname of the first child element in the soap body. static final String SOAPBODY_FIRST_CHILD_ELEMENT_QNAME = "org.apache.axiom.SOAPBodyFirstChildElementQName"; } ./src/org/apache/axiom/soap/SOAPProcessingException.java0000664000175000017500000000453411767656530022412 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMException; public class SOAPProcessingException extends OMException { private static final long serialVersionUID = -5432612295193716211L; private String soapFaultCode; /** Eran Chinthaka (chinthaka@apache.org) */ public SOAPProcessingException(String message) { super(message); } public SOAPProcessingException(Throwable cause) { super(cause); } /** * @param messageText - this will appear as the Text in the Reason information item of SOAP * Fault * @param faultCode - this will appear as the Value in the Code information item of SOAP * Fault * @param cause - this will appear under the Detail information item of SOAP Fault */ public SOAPProcessingException(String messageText, String faultCode, Throwable cause) { super(messageText, cause); this.soapFaultCode = faultCode; } /** * @param messageText - this will appear as the Text in the Reason information item of SOAP * Fault * @param faultCode - this will appear as the Value in the Code information item of SOAP * Fault */ public SOAPProcessingException(String messageText, String faultCode) { super(messageText); this.soapFaultCode = faultCode; } public String getFaultCode() { return soapFaultCode; } public void setFaultCode(String soapFaultCode) { this.soapFaultCode = soapFaultCode; } } ./src/org/apache/axiom/soap/SOAPVersion.java0000664000175000017500000000476211767656530020047 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import javax.xml.namespace.QName; /** * A generic way to get at SOAP-version-specific values. As long as we can get * one of these from a SOAP element, we can get at the right */ public interface SOAPVersion { /** * Obtain the envelope namespace for this version of SOAP */ String getEnvelopeURI(); /** * Obtain the encoding namespace for this version of SOAP */ String getEncodingURI(); /** * Obtain the QName for the role attribute (actor/role) */ QName getRoleAttributeQName(); /** * Obtain the "next" role/actor URI */ String getNextRoleURI(); /** * Obtain the QName for the MustUnderstand fault code */ QName getMustUnderstandFaultCode(); /** * Obtain the QName for the Sender fault code * @return Sender fault code as a QName */ QName getSenderFaultCode(); /** * Obtain the QName for the Receiver fault code. * * @return Receiver fault code as a QName */ QName getReceiverFaultCode(); /** * Obtain the QName for the fault reason element. * * @return the QName for the fault reason element */ QName getFaultReasonQName(); /** * Obtain the QName for the fault code element. * * @return the QName for the fault code element */ QName getFaultCodeQName(); /** * Obtain the QName for the fault detail element. * * @return the QName for the fault detail element */ QName getFaultDetailQName(); /** * Obtain the QName for the fault role/actor element. * * @return the QName for the fault role/actor element */ QName getFaultRoleQName(); } ./src/org/apache/axiom/soap/SOAPFaultDetail.java0000664000175000017500000000277111767656530020616 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; import java.util.Iterator; /** * The Detail element information item is intended for carrying application specific error * information related to the SOAP Body . *

        * The Detail element information item has: A [local name] of Detail . A [namespace name] of * http://www.w3.org/2003/05/soap-envelope . Zero or more attribute information items in its * [attributes] property. Zero or more child element information items in its [children] property. */ public interface SOAPFaultDetail extends OMElement { /** Eran Chinthaka (chinthaka@apache.org) */ void addDetailEntry(OMElement detailElement); Iterator getAllDetailEntries(); } ./src/org/apache/axiom/soap/SOAPFaultValue.java0000664000175000017500000000173511767656530020467 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; public interface SOAPFaultValue extends OMElement { /** * Eran Chinthaka (chinthaka@apache.org) */ } ./src/org/apache/axiom/soap/RolePlayer.java0000664000175000017500000000322711767656530020010 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import java.util.List; /** * This interface represents the thing which provides us with the SOAP roles in a given * context. Used to search through SOAP header blocks. */ public interface RolePlayer { /** * Get a list of the roles supported. NOTE: the "next" role is automatically supported, * and the "none" role (for SOAP 1.2) is automatically disallowed. The roles returned * should only be the non-standard ones, since the ultimate destination role is also * handled by the isUltimateDestination method below. * * @return a List containing URI Strings, one per custom role supported, or null */ List getRoles(); /** * Are we the ultimate destination? * * @return true if this is the ultimate destination, false if an intermediary. */ boolean isUltimateDestination(); } ./src/org/apache/axiom/soap/SOAPFaultText.java0000664000175000017500000000251211767656530020331 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; public interface SOAPFaultText extends OMElement { /** * Eran Chinthaka (chinthaka@apache.org) */ /** * lang is a mandatory attribute within the SOAPFaultText which must have * SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI as the namespace URI and * SOAP12constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX or a capitalization thereof as the * prefix * * @param lang */ void setLang(String lang); String getLang(); } ./src/org/apache/axiom/soap/SOAPFaultRole.java0000664000175000017500000000273611767656530020316 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import org.apache.axiom.om.OMElement; /** * The Role element information item identifies the role the node was operating in at the point the * fault occurred. *

        * The Role element information item has: A [local name] of Role . A [namespace name] of * http://www.w3.org/2003/05/soap-envelope . */ public interface SOAPFaultRole extends OMElement { /** * Eran Chinthaka (chinthaka@apache.org) */ /** * The value of the Role element information item MUST be one of the roles assumed by the node * during processing of the message * * @param uri */ void setRoleValue(String uri); String getRoleValue(); } ./src/org/apache/axiom/soap/SOAP11Constants.java0000664000175000017500000000564311767656530020537 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.soap; import javax.xml.namespace.QName; public interface SOAP11Constants extends SOAPConstants { /** Eran Chinthaka (chinthaka@apache.org) */ static final String SOAP_ENVELOPE_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/envelope/"; static final String SOAP_ENCODING_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/encoding/"; /** Field ATTR_ACTOR */ static final String ATTR_ACTOR = "actor"; /** Field SOAP_FAULT_CODE_LOCAL_NAME */ static final String SOAP_FAULT_CODE_LOCAL_NAME = "faultcode"; /** Field SOAP_FAULT_STRING_LOCAL_NAME */ static final String SOAP_FAULT_STRING_LOCAL_NAME = "faultstring"; /** Field SOAP_FAULT_ACTOR_LOCAL_NAME */ static final String SOAP_FAULT_ACTOR_LOCAL_NAME = "faultactor"; static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "detail"; //SOAP 1.2 Content Type static final String SOAP_11_CONTENT_TYPE = "text/xml"; // -------- SOAP Fault Codes ------------------------------ static final String FAULT_CODE_SENDER = "Client"; static final String FAULT_CODE_RECEIVER = "Server"; static final String SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next"; // QNames static final QName QNAME_ACTOR = new QName(SOAP_ENVELOPE_NAMESPACE_URI, ATTR_ACTOR); static final QName QNAME_MU_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_MUST_UNDERSTAND); static final QName QNAME_SENDER_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_SENDER); static final QName QNAME_RECEIVER_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, FAULT_CODE_RECEIVER); static final QName QNAME_FAULT_REASON = new QName(SOAP_FAULT_STRING_LOCAL_NAME); static final QName QNAME_FAULT_CODE = new QName(SOAP_FAULT_CODE_LOCAL_NAME); static final QName QNAME_FAULT_DETAIL = new QName(SOAP_FAULT_DETAIL_LOCAL_NAME); static final QName QNAME_FAULT_ROLE = new QName(SOAP_FAULT_ACTOR_LOCAL_NAME); } ./src/org/apache/axiom/osgi/0000775000175000017500000000000011767656530015062 5ustar brianbrian./src/org/apache/axiom/osgi/FactoryInjectionComponent.java0000664000175000017500000000535411767656530023071 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.osgi; import java.util.ArrayList; import java.util.List; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMMetaFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Internal component required for OSGi support. This component is * responsible for injecting the {@link OMMetaFactory} instance loaded * from the implementation bundle into {@link OMAbstractFactory} (using * {@link OMAbstractFactory#setMetaFactory(OMMetaFactory)}). This class * is for internal use only and MUST NOT be used for other purposes. * * @scr.component name="factoryinjection.component" immediate="true" * @scr.reference name="metafactory" interface="org.apache.axiom.om.OMMetaFactory" cardinality="0..n" policy="dynamic" bind="setMetaFactory" unbind="unsetMetaFactory" */ public class FactoryInjectionComponent { private static final Log log = LogFactory .getLog(FactoryInjectionComponent.class); public FactoryInjectionComponent() { if (log.isDebugEnabled()) { log.debug("FactoryInjectionComponent created"); } } private static List metaFactories = null; protected void setMetaFactory(OMMetaFactory metafactory) { synchronized (FactoryInjectionComponent.class) { if (metaFactories == null) { metaFactories = new ArrayList(); } // Special case llom - it's the default if (metafactory.getClass().toString().indexOf("llom") != -1) { metaFactories.add(0, metafactory); } else { metaFactories.add(metafactory); } OMAbstractFactory.setMetaFactory((OMMetaFactory) metaFactories.get(0)); } } protected void unsetMetaFactory(OMMetaFactory metafactory) { synchronized (FactoryInjectionComponent.class) { if (metaFactories != null) { metaFactories.remove(metafactory); } if (metaFactories.size() == 0) { metaFactories = null; } else { OMAbstractFactory.setMetaFactory((OMMetaFactory) metaFactories.get(0)); } } } } ./src/org/apache/axiom/ext/0000775000175000017500000000000011767656530014721 5ustar brianbrian./src/org/apache/axiom/ext/activation/0000775000175000017500000000000011767656530017062 5ustar brianbrian./src/org/apache/axiom/ext/activation/SizeAwareDataSource.java0000664000175000017500000000546611767656530023605 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.activation; import javax.activation.DataSource; /** * Optional extension interface that can be implemented by data sources that support a * getSize method. * Code working with data sources can use this this information to optimize certain operations. * Note however that instead of checking of this interface directly, this kind of code * should use {@link org.apache.axiom.util.activation.DataSourceUtils#getSize(DataSource)} * because this method is able to determine the size of other types of data sources as well. *

        * Code using this interface should be aware that some implementations may be unable to guarantee * 100% accuracy when determining the size of the data source. Situations where this can occur * include: *

          *
        • The data source uses a network protocol that allows to get the size of the data * but that doesn't guarantee accurateness.
        • *
        • Reading the data involves a decoding operation and the length of the resulting stream * can't be determined precisely without performing the decoding operation. In this * case the implementation of this interface may return a value based on an estimation.
        • *
        * When reading the actual data, the code should always read until the end of the stream is * reached (as indicated by the return value of the read methods of the * {@link java.io.InputStream} class). It must be prepared to reach the end of the stream after * a number of bytes that is lower or higher than the value returned by {@link #getSize()}. */ public interface SizeAwareDataSource extends DataSource { /** * Get the size of the data source. * Implementations must return the number of bytes that can be read from * the input stream returned by {@link #getInputStream()} before reaching * the end of the stream. If the implementation is unable to determine the * size, it must return -1. * * @return the size of the data source or -1 if the size is not known */ long getSize(); } ./src/org/apache/axiom/ext/activation/package.html0000664000175000017500000000163311767656530021346 0ustar brianbrian Defines Axiom specific extensions to the Java Activation Framework API. ./src/org/apache/axiom/ext/stax/0000775000175000017500000000000011767656530015700 5ustar brianbrian./src/org/apache/axiom/ext/stax/datahandler/0000775000175000017500000000000011767656530020147 5ustar brianbrian./src/org/apache/axiom/ext/stax/datahandler/DataHandlerReader.java0000664000175000017500000001676211767656530024320 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.stax.datahandler; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; /** * Extension interface for {@link javax.xml.stream.XMLStreamReader} implementations that expose * base64 encoded binary content as {@link DataHandler} objects. *

        * All the requirements specified in {@link org.apache.axiom.ext.stax} apply to * this extension interface. In particular, * a consumer MUST use {@link javax.xml.stream.XMLStreamReader#getProperty(String)} with the property * name defined by {@link #PROPERTY} to get a reference to this extension interface. *

        * If the {@link javax.xml.stream.XMLStreamReader} wishes to expose base64 encoded content using * this extension interface, it MUST do so using a single * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} event. To maintain compatibility with * consumers that are unaware of the extension, the implementation SHOULD make sure that * {@link javax.xml.stream.XMLStreamReader#getText()}, * {@link javax.xml.stream.XMLStreamReader#getTextStart()}, * {@link javax.xml.stream.XMLStreamReader#getTextLength()}, * {@link javax.xml.stream.XMLStreamReader#getTextCharacters()}, * {@link javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int, int)} and * {@link javax.xml.stream.XMLStreamReader#getElementText()} behave as expected for this type of * event, i.e. return the base64 representation of the binary content. *

        * The extension described by this interface will typically be implemented by XMLStreamReader * instances provided by databinding frameworks or XMLStreamReader proxies that enrich a stream of * StAX events with binary data existing outside of the XML document (e.g. an XOP/MTOM decoder). */ public interface DataHandlerReader { /** * The name of the property used to look up this extension interface from a * {@link javax.xml.stream.XMLStreamReader} implementation. */ String PROPERTY = DataHandlerReader.class.getName(); /** * Check whether the current event is a {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} * event representing base64 encoded binary content and for which a * {@link javax.activation.DataHandler} is available. * * @return true if the current event is a * {@link javax.xml.stream.XMLStreamConstants#CHARACTERS} event representing base64 * encoded binary content and for which a {@link javax.activation.DataHandler} is * available; false for all other types of events. */ boolean isBinary(); /** * Check if the binary content is eligible for optimization (e.g. using XOP) or if it should * be serialized as base64. * Calling this method is only meaningful if {@link #isBinary()} returns true for * the current event. The behavior of this method is undefined if this is not the case. * * @return true if the binary content is eligible for optimization; * false otherwise */ boolean isOptimized(); /** * Check whether the {@link javax.xml.stream.XMLStreamReader} supports deferred loading of the * binary content for the current event. If this method returns true then a * consumer MAY call {@link #getDataHandlerProvider()} and retrieve the * {@link javax.activation.DataHandler} later using {@link DataHandlerProvider#getDataHandler()}. * Calling this method is only meaningful if {@link #isBinary()} returns true for * the current event. The behavior of this method is undefined if this is not the case. * * @return true if deferred loading is supported; false otherwise */ boolean isDeferred(); /** * Get the content ID of the binary content for the current event, if available. The result of * this method is defined if and only if {@link #isBinary()} returns true for the * current event. *

        * The implementation SHOULD only return a non null value if the content ID has been used * previously in an interaction with another component or system. The implementation SHOULD NOT * generate a new content ID solely for the purpose of this method. *

        * If available, the returned value MUST be a raw content ID. In particular: *

          *
        • If the content ID has been extracted from an href attribute, it MUST NOT * contain the cid: prefix.
        • *
        • If it has been extracted from a Content-ID MIME header, it MUST NOT be * enclosed in angles (<>).
        • *
        *

        * A consumer MAY use the return value of this method in contexts where it is desirable to * preserve the original content ID used by another system or component to identify the binary * content. However, the consumer MUST NOT make any assumption about the uniqueness or validity * of the content ID (with respect to relevant standards such as RFC822) and SHOULD make * provision to sanitize the value if necessary. * * @return any content ID used previously to identify the binary content, or null * if no content ID is known */ String getContentID(); /** * Get the {@link DataHandler} with the binary content for the current event. The behavior of * this method is only defined for events for which {@link #isBinary()} returns * true. For events of this type the method MUST return a valid * {@link DataHandler}, regardless of the return value of {@link #isDeferred()}. If * {@link #isDeferred()} returns true, then the consumer may use this method to * force the implementation to load the binary content immediately. * * @return the binary content for the current event * * @throws XMLStreamException if an error occurs while loading the {@link DataHandler} */ DataHandler getDataHandler() throws XMLStreamException; /** * Get a {@link DataHandlerProvider} instance for deferred loading of the binary content for the * current event. The behavior of this method is defined if and only if {@link #isDeferred()} * returns true for the current event. The returned reference MUST remain valid * after the current event has been consumed. It is up to the implementation to specify the * exact lifecycle of the returned instance, in particular until when the binary content can be * retrieved. * * @return the {@link DataHandlerProvider} instance the consumer can use to load the binary * content at a later time */ DataHandlerProvider getDataHandlerProvider(); } ./src/org/apache/axiom/ext/stax/datahandler/DataHandlerWriter.java0000664000175000017500000001370611767656530024365 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.stax.datahandler; import java.io.IOException; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; /** * Extension interface for {@link javax.xml.stream.XMLStreamWriter} implementations that can * receive base64 encoded binary content as {@link DataHandler} objects. A stream writer * implementing this extension may write the binary data as base64 encoded character data * or using some optimization such as XOP/MTOM. *

        * All the requirements specified in {@link org.apache.axiom.ext.stax} apply to * this extension interface. In particular, * a consumer MUST use {@link javax.xml.stream.XMLStreamWriter#getProperty(String)} with the property * name defined by {@link #PROPERTY} to get a reference to this extension interface. *

        * The interface defines two methods to write binary content, one that takes a {@link DataHandler} * argument and one with a {@link DataHandlerProvider} argument. The first should be used when * the content is immediately available, while the second supports deferred loading of the data * handler. The meaning of the contentID and optimize arguments is * the same for both methods: *

        *
        contentID *
        * A content ID of the binary content, if available. The semantics of this argument are * similar to those defined for the return value of the * {@link DataHandlerReader#getContentID()} method: *
          *
        • This argument should only be set if a content ID has been used * previously in an interaction with another component or system. * The caller SHOULD NOT generate a new content ID solely for the * purpose of invoking the extension. *
        • The argument must be a raw content ID. *
        • The implementation MUST NOT make any assumption about the uniqueness or validity * of the content ID. It MAY ignore the supplied value. *
        *
        optimize *
        * Specifies if binary content is eligible for optimization (e.g. using XOP) or if it should * be serialized as base64. This is only an indication and the implementation MAY choose * to override this value or ignore it entirely. *
        * Instead of interacting directly with this extension interface, the consumer may use the * {@link org.apache.axiom.util.stax.XMLStreamWriterUtils#writeDataHandler(javax.xml.stream.XMLStreamWriter, DataHandler, String, boolean)} or * {@link org.apache.axiom.util.stax.XMLStreamWriterUtils#writeDataHandler(javax.xml.stream.XMLStreamWriter, DataHandlerProvider, String, boolean)} * utility methods. These methods make the processing of binary data entirely transparent for * the caller. */ public interface DataHandlerWriter { /** * The name of the property used to look up this extension interface from a * {@link javax.xml.stream.XMLStreamWriter} implementation. */ String PROPERTY = DataHandlerWriter.class.getName(); /** * Write binary content to the stream. The implementation may choose to write the data as base64 * encoded character data or using an optimization protocol such as XOP/MTOM. * * @param dataHandler * the binary content to write * @param contentID * an existing content ID for the binary data (see above) * @param optimize * indicates whether the content is eligible for optimization (see above) * @throws IOException * if an error occurs while reading from the data handler * @throws XMLStreamException * if an error occurs while writing to the underlying stream */ void writeDataHandler(DataHandler dataHandler, String contentID, boolean optimize) throws IOException, XMLStreamException; /** * Write binary content to the stream. This method allows the implementation to defer loading of * the content. More precisely, if the implementation decides to use an optimization scheme such * as XOP, then the content will not be written immediately to the underlying stream, but only * after the XML infoset is complete. If the caller uses this method, the implementation can * defer the actual loading of the binary content. * * @param dataHandlerProvider * the binary content to write * @param contentID * an existing content ID for the binary data (see above) * @param optimize * indicates whether the content is eligible for optimization (see above) * @throws IOException * If an error occurs while reading from the data handler. Since the implementation * is free to override the supplied optimize argument, it may attempt * to load the binary data immediately. Because this operation may fail, the method * must declare this exception. * @throws XMLStreamException * if an error occurs while writing to the underlying stream */ void writeDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, XMLStreamException; } ./src/org/apache/axiom/ext/stax/datahandler/DataHandlerProvider.java0000664000175000017500000000425211767656530024677 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.stax.datahandler; import java.io.IOException; import javax.activation.DataHandler; /** * Interface used for deferred loading of binary content. * * @see DataHandlerReader#isDeferred() * @see DataHandlerReader#getDataHandlerProvider() */ public interface DataHandlerProvider { /** * Check whether the {@link DataHandler} has already been loaded. A return value of * true means that a call to {@link #getDataHandler()} will not block or will * retrieve the {@link DataHandler} without overhead. Note the return value of this method for a * given instance of this class may change over time due to events other than a call to * {@link #getDataHandler()} on the same instance. E.g. a call to {@link #getDataHandler()} on * one instance may change the return value of the method on another instance (because the * {@link DataHandler} objects can only be loaded in a certain sequence). * * @return true if the {@link DataHandler} has already been loaded; * false otherwise */ boolean isLoaded(); /** * Get the {@link DataHandler} object for the binary content. * * @return the binary content * * @throws IOException if an error occurs while loading the {@link DataHandler} */ DataHandler getDataHandler() throws IOException; } ./src/org/apache/axiom/ext/stax/datahandler/package.html0000664000175000017500000000171111767656530022430 0ustar brianbrian Defines an Axiom specific extension to the StAX API to work with DataHandler objects. @see org.apache.axiom.ext.stax ./src/org/apache/axiom/ext/stax/DelegatingXMLStreamReader.java0000664000175000017500000000354211767656530023472 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.stax; import javax.xml.stream.XMLStreamReader; /** * Interface implemented by {@link XMLStreamReader} classes that delegate to another stream reader * and that can be safely unwrapped. *

        * This interface gives access to the parent reader, i.e. it allows to unwrap a stream reader * wrapper. It should be noted that in general, unwrapping a wrapper and accessing the parent object * is not a safe operation because it may invalidate the state of the wrapper (which may still be * used later). Therefore this interface must only be implemented by {@link XMLStreamReader} classes * for which unwrapping is a safe operation. In particular, this interface should not be implemented * by wrappers that alter the sequence of events produced by the stream reader. *

        * This interface is used by * {@link org.apache.axiom.util.stax.XMLStreamReaderUtils#getOriginalXMLStreamReader(XMLStreamReader)} * to get access to the original parser. */ public interface DelegatingXMLStreamReader extends XMLStreamReader { XMLStreamReader getParent(); } ./src/org/apache/axiom/ext/stax/CharacterDataReader.java0000664000175000017500000000633411767656530022362 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.stax; import java.io.IOException; import java.io.Writer; import javax.xml.stream.XMLStreamException; /** * Optional interface implemented by {@link javax.xml.stream.XMLStreamReader} * implementations that support writing character data directly to a * {@link Writer}. *

        * All the requirements outlined in {@link org.apache.axiom.ext.stax} apply to * this extension interface. In particular, to get a reference to the extension, * the consumer MUST call {@link javax.xml.stream.XMLStreamReader#getProperty(String)} * with {@link #PROPERTY} as the property name. */ public interface CharacterDataReader { /** * The name of the property used to look up this extension interface from a * {@link javax.xml.stream.XMLStreamReader} implementation. */ String PROPERTY = CharacterDataReader.class.getName(); /** * Output the character data for the current event to the given writer. In * general, the implementation behaves such that * reader.writeTextTo(writer) has the same effect as * writer.write(reader.getText()). However, the implementation * MAY choose to split the character data differently. E.g. it MAY write the * character data in multiple chunks or it MAY choose to process more * character data in a single event than would be returned by * {@link javax.xml.stream.XMLStreamReader#getText()}. Therefore, using this * method together with {@link javax.xml.stream.XMLStreamReader#getText()}, * {@link javax.xml.stream.XMLStreamReader#getTextCharacters()}, * {@link javax.xml.stream.XMLStreamReader#getTextStart()}, * {@link javax.xml.stream.XMLStreamReader#getTextLength()} or * {@link javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int, int)} * is not supported and may lead to undefined results. *

        * The implementation SHOULD avoid any unnecessary conversions between * strings and character arrays. * * @param writer * the writer to write the character data to * @throws XMLStreamException * if the underlying XML source is not well-formed * @throws IOException * if an I/O error occurs when writing the character data * @throws IllegalStateException * if this state is not a valid text state. */ void writeTextTo(Writer writer) throws XMLStreamException, IOException; } ./src/org/apache/axiom/ext/stax/package.html0000664000175000017500000000465111767656530020167 0ustar brianbrian Defines Axiom specific extensions to the StAX API.

        This package and its subpackages defines several extensions to the StAX API, more precisely for the {@link javax.xml.stream.XMLStreamReader} and {@link javax.xml.stream.XMLStreamWriter} classes. The reader or writer wishing to support the extension MAY implement the corresponding interface directly, but a consumer MUST use the property mechanism to get a reference to this extension interface, i.e. it MUST call {@link javax.xml.stream.XMLStreamReader#getProperty(String)} or {@link javax.xml.stream.XMLStreamWriter#getProperty(String)}. Each of the extension interfaces in this package defines a constant for the property name to use.

        The rationale for this requirement is that a property based approach continues to work even if the stream implementing the extension is accessed indirectly through a proxy implementing the {@link javax.xml.stream.XMLStreamReader} or {@link javax.xml.stream.XMLStreamWriter} interface but unaware of the extensions defined in this package. Note that this assumes that the proxy correctly delegates calls to the getProperty methods.

        The property returning the extension interface MUST be available regardless of the current state of the stream. In addition it is assumed to be immutable, i.e. its value MUST NOT not change during the lifetime of the {@link javax.xml.stream.XMLStreamReader} or {@link javax.xml.stream.XMLStreamWriter} implementation. For a consumer it is therefore sufficient to look up the extension once and to continue using the obtained reference during the entire lifetime of the stream. ./src/org/apache/axiom/ext/io/0000775000175000017500000000000011767656530015330 5ustar brianbrian./src/org/apache/axiom/ext/io/ReadFromSupport.java0000664000175000017500000000407711767656530021277 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.io; import java.io.InputStream; /** * Optional interface implemented by {@link java.io.OutputStream} implementations that support * transferring data from an {@link InputStream}. This interface may be used to avoid allocating * a temporary buffer when there is a need to copy data from an input stream to an output stream. */ public interface ReadFromSupport { /** * Read data from the given input stream and write it to this output stream. * The method transfers data until one of the following conditions is met: *

          *
        • The end of the input stream is reached. *
        • The value of the length argument is different from -1 * and the number of bytes transferred is equal to length. *
        * * @param inputStream * An input stream to read data from. This method will not close the stream. * @param length * the number of bytes to transfer, or -1 if the method should * transfer data until the end of the input stream is reached * @throws StreamCopyException * @return the number of bytes transferred */ long readFrom(InputStream inputStream, long length) throws StreamCopyException; } ./src/org/apache/axiom/ext/io/StreamCopyException.java0000664000175000017500000000464211767656530022146 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.ext.io; import java.io.IOException; /** * Signals that an I/O exception occurred while copying data from an input stream (or other data * source) to an output stream (or other data sink). The exception wraps the original * {@link IOException} together with information about the type of operation (read or write) that * failed. */ public class StreamCopyException extends IOException { private static final long serialVersionUID = -6489101119109339448L; /** * Indicates that the wrapped exception was triggered while reading from the input stream * (or data source). */ public static final int READ = 1; /** * Indicates that the wrapped exception was triggered while writing to the output stream * (or data sink). */ public static final int WRITE = 2; private final int operation; /** * Constructor. * * @param operation * indicates the type of operation that caused the exception; must be {@link #READ} * or {@link #WRITE} * @param cause * the wrapped exception */ public StreamCopyException(int operation, IOException cause) { this.operation = operation; initCause(cause); } /** * Get information about the type of operation that fails. * * @return one of {@link #READ} or {@link #WRITE} */ public int getOperation() { return operation; } public String getMessage() { return operation == READ ? "Error reading from source" : "Error writing to destination"; } } ./src/org/apache/axiom/ext/io/package.html0000664000175000017500000000163011767656530017611 0ustar brianbrian Defines Axiom specific extensions to the classes in {@link java.io}. ./src/org/apache/axiom/mime/0000775000175000017500000000000011767656530015050 5ustar brianbrian./src/org/apache/axiom/mime/MultipartWriterFactory.java0000664000175000017500000000277011767656530022427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime; import java.io.OutputStream; /** * Factory for {@link MultipartWriter} instances. */ public interface MultipartWriterFactory { /** * Create a new {@link MultipartWriter} instance that writes a MIME multipart package to a given * output stream. * * @param out * The output stream to write the MIME package to. * @param boundary * The MIME boundary to use. The value should not include the leading dashes, i.e. it * is the same value as used in the boundary content type parameter. * @return the writer instance */ MultipartWriter createMultipartWriter(OutputStream out, String boundary); } ./src/org/apache/axiom/mime/impl/0000775000175000017500000000000011767656530016011 5ustar brianbrian./src/org/apache/axiom/mime/impl/javamail/0000775000175000017500000000000011767656530017575 5ustar brianbrian./src/org/apache/axiom/mime/impl/javamail/MultipartWriterImpl.java0000664000175000017500000001065011767656530024442 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime.impl.javamail; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import javax.activation.DataHandler; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import org.apache.axiom.mime.MultipartWriter; import org.apache.axiom.util.blob.BlobDataSource; import org.apache.axiom.util.blob.MemoryBlob; import org.apache.axiom.util.blob.WritableBlob; class MultipartWriterImpl implements MultipartWriter { private static final byte[] DASH_DASH = { '-', '-' }; private static final byte[] CR_LF = { 13, 10 }; class PartOutputStream extends OutputStream { private final String contentType; private final String contentTransferEncoding; private final String contentID; private final WritableBlob blob; private final OutputStream parent; public PartOutputStream(String contentType, String contentTransferEncoding, String contentID) { this.contentType = contentType; this.contentTransferEncoding = contentTransferEncoding; this.contentID = contentID; blob = new MemoryBlob(); parent = blob.getOutputStream(); } public void write(int b) throws IOException { parent.write(b); } public void write(byte[] b, int off, int len) throws IOException { parent.write(b, off, len); } public void write(byte[] b) throws IOException { parent.write(b); } public void close() throws IOException { parent.close(); writePart(new DataHandler(new BlobDataSource(blob, contentType)), contentTransferEncoding, contentID); } } private final OutputStream out; private final byte[] boundary; public MultipartWriterImpl(OutputStream out, String boundary) { this.out = out; try { this.boundary = boundary.getBytes("ascii"); } catch (UnsupportedEncodingException ex) { // If we ever get here, then there is something really wrong with the JRE... throw new RuntimeException(ex); } } public OutputStream writePart(String contentType, String contentTransferEncoding, String contentID) throws IOException { return new PartOutputStream(contentType, contentTransferEncoding, contentID); } public void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID) throws IOException { MimeBodyPart mimeBodyPart = new MimeBodyPart(); try { mimeBodyPart.setDataHandler(dataHandler); mimeBodyPart.addHeader("Content-ID", "<" + contentID + ">"); mimeBodyPart.addHeader("Content-Type", dataHandler.getContentType()); mimeBodyPart.addHeader("Content-Transfer-Encoding", contentTransferEncoding); } catch (MessagingException ex) { IOException ex2 = new IOException("Unable to create MimeBodyPart"); ex2.initCause(ex); throw ex2; } out.write(DASH_DASH); out.write(boundary); out.write(CR_LF); try { mimeBodyPart.writeTo(out); } catch (MessagingException ex) { IOException ex2 = new IOException("Unable to write the MimeBodyPart object"); ex2.initCause(ex); throw ex2; } out.write(CR_LF); } public void complete() throws IOException { out.write(DASH_DASH); out.write(boundary); out.write(DASH_DASH); out.write(CR_LF); } } ./src/org/apache/axiom/mime/impl/javamail/JavaMailMultipartWriterFactory.java0000664000175000017500000000255311767656530026560 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime.impl.javamail; import java.io.OutputStream; import org.apache.axiom.mime.MultipartWriter; import org.apache.axiom.mime.MultipartWriterFactory; /** * Factory for the JavaMail based {@link MultipartWriter} implementation. */ public class JavaMailMultipartWriterFactory implements MultipartWriterFactory { public static final MultipartWriterFactory INSTANCE = new JavaMailMultipartWriterFactory(); public MultipartWriter createMultipartWriter(OutputStream out, String boundary) { return new MultipartWriterImpl(out, boundary); } } ./src/org/apache/axiom/mime/impl/javamail/package.html0000664000175000017500000000162111767656530022056 0ustar brianbrian MIME message processing API implementation based on JavaMail. ./src/org/apache/axiom/mime/impl/axiom/0000775000175000017500000000000011767656530017126 5ustar brianbrian./src/org/apache/axiom/mime/impl/axiom/MultipartWriterImpl.java0000664000175000017500000001036611767656530023777 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime.impl.axiom; import java.io.IOException; import java.io.OutputStream; import javax.activation.DataHandler; import org.apache.axiom.mime.MultipartWriter; import org.apache.axiom.util.base64.Base64EncodingOutputStream; class MultipartWriterImpl implements MultipartWriter { class PartOutputStream extends OutputStream { private final OutputStream parent; public PartOutputStream(OutputStream parent) { this.parent = parent; } public void write(int b) throws IOException { parent.write(b); } public void write(byte[] b, int off, int len) throws IOException { parent.write(b, off, len); } public void write(byte[] b) throws IOException { parent.write(b); } public void close() throws IOException { if (parent instanceof Base64EncodingOutputStream) { ((Base64EncodingOutputStream)parent).complete(); } writeAscii("\r\n"); } } private final OutputStream out; private final String boundary; private final byte[] buffer = new byte[256]; public MultipartWriterImpl(OutputStream out, String boundary) { this.out = out; this.boundary = boundary; } void writeAscii(String s) throws IOException { int count = 0; for (int i=0, len=s.length(); i= 128) { throw new IOException("Illegal character '" + c + "'"); } buffer[count++] = (byte)c; if (count == buffer.length) { out.write(buffer); count = 0; } } if (count > 0) { out.write(buffer, 0, count); } } public OutputStream writePart(String contentType, String contentTransferEncoding, String contentID) throws IOException { OutputStream transferEncoder; if (contentTransferEncoding.equals("8bit") || contentTransferEncoding.equals("binary")) { transferEncoder = out; } else { // We support no content transfer encodings other than 8bit, binary and base64. transferEncoder = new Base64EncodingOutputStream(out); contentTransferEncoding = "base64"; } writeAscii("--"); writeAscii(boundary); // TODO: specify if contentType == null is legal and check what to do if (contentType != null) { writeAscii("\r\nContent-Type: "); writeAscii(contentType); } writeAscii("\r\nContent-Transfer-Encoding: "); writeAscii(contentTransferEncoding); // TODO: specify that the content ID may be null if (contentID != null) { writeAscii("\r\nContent-ID: <"); writeAscii(contentID); out.write('>'); } writeAscii("\r\n\r\n"); return new PartOutputStream(transferEncoder); } public void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID) throws IOException { OutputStream partOutputStream = writePart(dataHandler.getContentType(), contentTransferEncoding, contentID); dataHandler.writeTo(partOutputStream); partOutputStream.close(); } public void complete() throws IOException { writeAscii("--"); writeAscii(boundary); writeAscii("--\r\n"); } } ./src/org/apache/axiom/mime/impl/axiom/AxiomMultipartWriterFactory.java0000664000175000017500000000253211767656530025477 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime.impl.axiom; import java.io.OutputStream; import org.apache.axiom.mime.MultipartWriter; import org.apache.axiom.mime.MultipartWriterFactory; /** * Factory for Axiom's own {@link MultipartWriter} implementation. */ public class AxiomMultipartWriterFactory implements MultipartWriterFactory { public static final MultipartWriterFactory INSTANCE = new AxiomMultipartWriterFactory(); public MultipartWriter createMultipartWriter(OutputStream out, String boundary) { return new MultipartWriterImpl(out, boundary); } } ./src/org/apache/axiom/mime/impl/axiom/package.html0000664000175000017500000000160711767656530021413 0ustar brianbrian Default MIME message processing API implementation. ./src/org/apache/axiom/mime/MultipartWriter.java0000664000175000017500000001075711767656530021103 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.mime; import java.io.IOException; import java.io.OutputStream; import javax.activation.DataHandler; /** * Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments. * Objects implementing this interface are created using a {@link MultipartWriterFactory}. MIME * parts are written using {@link #writePart(String, String, String)} or * {@link #writePart(DataHandler, String, String)}. Calls to both methods can be mixed, i.e. it * is not required to use the same method for all MIME parts. Instead, the caller should choose * the most convenient method for each part (depending on the form in which the content is * available). After all parts have been written, {@link #complete()} must be called to write the * final MIME boundary. *

        * The following semantics are defined for the contentTransferEncoding and * contentID arguments of the two write methods: *

          *
        • It is the responsibility of the implementation to apply the content transfer encoding * as specified by the contentTransferEncoding argument. The caller only * provides the unencoded data. The implementation should support at least binary * and base64. If it doesn't support the specified encoding, it may use an * alternative one. In any case, the implementation must make sure that the MIME part * has a Content-Transfer-Encoding header appropriate for the applied * encoding.
        • *
        • The content ID passed as argument is always the raw ID (without the angle brackets). * It is the responsibility of the implementation to properly format the value * of the Content-ID header.
        • *
        */ public interface MultipartWriter { /** * Start writing a MIME part. The methods returns an {@link OutputStream} that the caller can * use to write the content of the MIME part. After writing the content, * {@link OutputStream#close()} must be called to complete the writing of the MIME part. * * @param contentType * the value of the Content-Type header of the MIME part * @param contentTransferEncoding * the content transfer encoding to be used (see above); must not be * null * @param contentID * the content ID of the MIME part (see above) * @return an output stream to write the content of the MIME part * @throws IOException * if an I/O error occurs when writing to the underlying stream */ OutputStream writePart(String contentType, String contentTransferEncoding, String contentID) throws IOException; /** * Write a MIME part. The content is provided by a {@link DataHandler} object, which also * specifies the content type of the part. * * @param dataHandler * the content of the MIME part to write * @param contentTransferEncoding * the content transfer encoding to be used (see above); must not be * null * @param contentID * the content ID of the MIME part (see above) * @throws IOException * if an I/O error occurs when writing the part to the underlying stream */ void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID) throws IOException; /** * Complete writing of the MIME multipart package. This method does not close the * underlying stream. * * @throws IOException * if an I/O error occurs when writing to the underlying stream */ void complete() throws IOException; } ./src/org/apache/axiom/mime/package.html0000664000175000017500000000176711767656530017344 0ustar brianbrian Contains interfaces for MIME message processing.

        The APIs in this package have been designed as low level provider interfaces independent of Axiom's core APIs. ./src/org/apache/axiom/om/0000775000175000017500000000000011767656530014534 5ustar brianbrian./src/org/apache/axiom/om/OMNamespace.java0000664000175000017500000000332611767656530017533 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** * Interface OMNamespace. *

        * Implementations of this interface must be immutable or behave as if they were immutable, * i.e. {@link #getPrefix()} and {@link #getNamespaceURI()} must always return the same * values when invoked on the same instance. */ public interface OMNamespace { /** * Method equals. * * @param uri * @param prefix * @return Returns boolean. */ boolean equals(String uri, String prefix); /** * Method getPrefix. * * @return Returns String. */ String getPrefix(); /** * Method getName. * * @return Returns String. * @deprecated This method is deprecated. Please use getNamespaceURI() method instead. */ String getName(); /** * Provides the namespace URI of this namespace. * * @return - the namespace URI of the namespace. */ String getNamespaceURI(); } ./src/org/apache/axiom/om/OMAttribute.java0000664000175000017500000000340311767656530017576 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.namespace.QName; /** Interface OMAttribute */ public interface OMAttribute { /** @return Returns localName. */ String getLocalName(); /** @param localName */ void setLocalName(String localName); /** @return Returns String. */ String getAttributeValue(); /** @param value */ void setAttributeValue(String value); /** @return Returns String. */ String getAttributeType(); /** @param value */ void setAttributeType(String value); /** @param omNamespace */ void setOMNamespace(OMNamespace omNamespace); /** @return Returns OMNamespace. */ OMNamespace getNamespace(); /** @return Returns javax.xml.namespace.QName */ QName getQName(); /** Returns the OMFactory that created this object */ OMFactory getOMFactory(); /** * Returns the owner element of this attribute * @return OMElement - The owner element */ OMElement getOwner(); } ./src/org/apache/axiom/om/impl/0000775000175000017500000000000011767656530015475 5ustar brianbrian./src/org/apache/axiom/om/impl/MIMEOutputUtils.java0000664000175000017500000004077411767656530021345 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import javax.activation.DataHandler; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.attachments.ConfigurableDataHandler; import org.apache.axiom.attachments.ByteArrayDataSource; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMText; import org.apache.axiom.om.util.CommonUtils; import org.apache.axiom.util.activation.DataHandlerWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * @deprecated The features of this class are now implemented by {@link OMMultipartWriter}, which * has as cleaner API and supports streaming of individual MIME parts, in particular the * SOAP part. */ public class MIMEOutputUtils { private static Log log = LogFactory.getLog(MIMEOutputUtils.class); private static boolean isDebugEnabled = log.isDebugEnabled(); private static byte[] CRLF = { 13, 10 }; /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void complete(OutputStream outStream, byte[] xmlData, LinkedList binaryNodeList, String boundary, String contentId, String charSetEncoding, String SOAPContentType) { complete(outStream, xmlData, binaryNodeList, boundary, contentId, charSetEncoding, SOAPContentType, null); } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void complete(OutputStream outStream, byte[] xmlData, LinkedList binaryNodeList, String boundary, String contentId, String charSetEncoding, String SOAPContentType, OMOutputFormat omOutputFormat) { try { if (isDebugEnabled) { log.debug("Start: write the SOAPPart and the attachments"); } // Write out the mime boundary startWritingMime(outStream, boundary); javax.activation.DataHandler dh = new javax.activation.DataHandler(new ByteArrayDataSource(xmlData, "text/xml; charset=" + charSetEncoding)); MimeBodyPart rootMimeBodyPart = new MimeBodyPart(); rootMimeBodyPart.setDataHandler(dh); rootMimeBodyPart.addHeader("Content-Type", "application/xop+xml; charset=" + charSetEncoding + "; type=\"" + SOAPContentType + "\""); rootMimeBodyPart.addHeader("Content-Transfer-Encoding", "binary"); rootMimeBodyPart.addHeader("Content-ID", "<" + contentId + ">"); // Write out the SOAPPart writeBodyPart(outStream, rootMimeBodyPart, boundary); // Now write out the Attachment parts (which are represented by the // text nodes int the binary node list) Iterator binaryNodeIterator = binaryNodeList.iterator(); while (binaryNodeIterator.hasNext()) { OMText binaryNode = (OMText) binaryNodeIterator.next(); writeBodyPart(outStream, createMimeBodyPart(binaryNode .getContentID(), (DataHandler) binaryNode .getDataHandler(), omOutputFormat), boundary); } finishWritingMime(outStream); outStream.flush(); if (isDebugEnabled) { log.debug("End: write the SOAPPart and the attachments"); } } catch (IOException e) { throw new OMException("Error while writing to the OutputStream.", e); } catch (MessagingException e) { throw new OMException("Problem writing Mime Parts.", e); } } /** * @deprecated This method is only useful in conjunction with * {@link #writeBodyPart(OutputStream, MimeBodyPart, String)}, which is deprecated. */ public static MimeBodyPart createMimeBodyPart(String contentID, DataHandler dataHandler) throws MessagingException { return createMimeBodyPart(contentID, dataHandler, null); } /** * @deprecated This method is only useful in conjunction with * {@link #writeBodyPart(OutputStream, MimeBodyPart, String)}, which is deprecated. */ public static MimeBodyPart createMimeBodyPart(String contentID, DataHandler dataHandler, OMOutputFormat omOutputFormat) throws MessagingException { String contentType = dataHandler.getContentType(); // Get the content-transfer-encoding String contentTransferEncoding = "binary"; if (dataHandler instanceof ConfigurableDataHandler) { ConfigurableDataHandler configurableDataHandler = (ConfigurableDataHandler) dataHandler; contentTransferEncoding = configurableDataHandler.getTransferEncoding(); } if (isDebugEnabled) { log.debug("Create MimeBodyPart"); log.debug(" Content-ID = " + contentID); log.debug(" Content-Type = " + contentType); log.debug(" Content-Transfer-Encoding = " + contentTransferEncoding); } boolean useCTEBase64 = omOutputFormat != null && Boolean.TRUE.equals( omOutputFormat.getProperty( OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS)); if (useCTEBase64) { if (!CommonUtils.isTextualPart(contentType) && "binary".equals(contentTransferEncoding)) { if (isDebugEnabled) { log.debug(" changing Content-Transfer-Encoding from " + contentTransferEncoding + " to base-64"); } contentTransferEncoding = "base64"; } } // Now create the mimeBodyPart for the datahandler and add the appropriate content headers MimeBodyPart mimeBodyPart = new MimeBodyPart(); mimeBodyPart.setDataHandler(dataHandler); mimeBodyPart.addHeader("Content-ID", "<" + contentID + ">"); mimeBodyPart.addHeader("Content-Type", contentType); mimeBodyPart.addHeader("Content-Transfer-Encoding", contentTransferEncoding); return mimeBodyPart; } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void writeMimeBoundary(OutputStream outStream, String boundary) throws IOException { // REVIEW: This conversion is hard-coded to UTF-8. // The complete solution is to respect the charset setting of the message. // However this may cause problems in BoundaryDelimittedStream and other // lower level classes. outStream.write(new byte[] { 45, 45 }); outStream.write(boundary.getBytes("UTF-8")); } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void startWritingMime(OutputStream outStream, String boundary) throws IOException { writeMimeBoundary(outStream, boundary); //outStream.write(CRLF); } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void writeBodyPart(OutputStream outStream, MimeBodyPart part, String boundary) throws IOException, MessagingException { if (isDebugEnabled) { log.debug("Start writeMimeBodyPart for " + part.getContentID()); } outStream.write(CRLF); part.writeTo(outStream); outStream.write(CRLF); writeMimeBoundary(outStream, boundary); outStream.flush(); if (isDebugEnabled) { log.debug("End writeMimeBodyPart"); } } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void finishWritingMime(OutputStream outStream) throws IOException { if (isDebugEnabled) { log.debug("Write --, which indicates the end of the last boundary"); } outStream.write(new byte[] { 45, 45 }); } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void writeSOAPWithAttachmentsMessage(StringWriter writer, OutputStream outputStream, Attachments attachments, OMOutputFormat format) { try { OMMultipartWriter mpw = new OMMultipartWriter(outputStream, format); Writer rootPartWriter = new OutputStreamWriter(mpw.writeRootPart(), format.getCharSetEncoding()); rootPartWriter.write(writer.toString()); rootPartWriter.close(); // Get the collection of ids associated with the attachments Collection ids; if (respectSWAAttachmentOrder(format)) { // ContentIDList is the order of the incoming/added attachments ids = Arrays.asList(attachments.getAllContentIDs()); } else { // ContentIDSet is an undefined order (the implementation currently // orders the attachments using the natural order of the content ids) ids = attachments.getContentIDSet(); } for (Iterator it = ids.iterator(); it.hasNext(); ) { String id = (String)it.next(); mpw.writePart(attachments.getDataHandler(id), id); } mpw.complete(); } catch (IOException ex) { throw new OMException("Error writing SwA message", ex); } } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void writeDataHandlerWithAttachmentsMessage(DataHandler rootDataHandler, String contentType, OutputStream outputStream, Map attachments, OMOutputFormat format) { writeDataHandlerWithAttachmentsMessage(rootDataHandler, contentType, outputStream, attachments, format, null); } /** * @deprecated Use {@link OMMultipartWriter} instead. */ public static void writeDataHandlerWithAttachmentsMessage(DataHandler rootDataHandler, final String contentType, OutputStream outputStream, Map attachments, OMOutputFormat format, Collection ids) { try { if (!rootDataHandler.getContentType().equals(contentType)) { rootDataHandler = new DataHandlerWrapper(rootDataHandler) { public String getContentType() { return contentType; } }; } OMMultipartWriter mpw = new OMMultipartWriter(outputStream, format); mpw.writePart(rootDataHandler, format.getRootContentId()); Iterator idIterator = null; if (ids == null) { // If ids are not provided, use the attachment map // to get the keys idIterator = attachments.keySet().iterator(); } else { // if ids are provided (normal case), iterate // over the ids so that the attachments are // written in the same order as the id keys. idIterator = ids.iterator(); } while (idIterator.hasNext()) { String key = (String) idIterator.next(); mpw.writePart((DataHandler) attachments.get(key), key); } mpw.complete(); outputStream.flush(); } catch (IOException e) { throw new OMException("Error while writing to the OutputStream.", e); } } /** * @deprecated Axiom only supports standard SwA messages. However, {@link OMMultipartWriter} * provides a flexible way to build MIME packages for non standard formats such as * MM7. */ public static void writeMM7Message(StringWriter writer, OutputStream outputStream, Attachments attachments, OMOutputFormat format, String innerPartCID, String innerBoundary) { try { OMMultipartWriter mpw = new OMMultipartWriter(outputStream, format); Writer rootPartWriter = new OutputStreamWriter(mpw.writeRootPart(), format.getCharSetEncoding()); rootPartWriter.write(writer.toString()); rootPartWriter.close(); if (attachments.getContentIDSet().size() != 0) { OMOutputFormat innerFormat = new OMOutputFormat(format); innerFormat.setMimeBoundary(innerBoundary); OutputStream innerOutputStream = mpw.writePart("multipart/related; boundary=\"" + innerBoundary + "\"", innerPartCID); OMMultipartWriter innerMpw = new OMMultipartWriter(innerOutputStream, innerFormat); Collection ids; if (respectSWAAttachmentOrder(format)) { // ContentIDList is the order of the incoming/added attachments ids = Arrays.asList(attachments.getAllContentIDs()); } else { // ContentIDSet is an undefined order (the implementation currently // orders the attachments using the natural order of the content ids) ids = attachments.getContentIDSet(); } for (Iterator it = ids.iterator(); it.hasNext(); ) { String id = (String)it.next(); innerMpw.writePart(attachments.getDataHandler(id), id); } innerMpw.complete(); innerOutputStream.close(); } mpw.complete(); } catch (IOException e) { throw new OMException("Error while writing to the OutputStream.", e); } } /** * @param format * @return true if the incoming attachment order should be respected */ private static boolean respectSWAAttachmentOrder(OMOutputFormat format) { Boolean value = (Boolean) format.getProperty(OMOutputFormat.RESPECT_SWA_ATTACHMENT_ORDER); if (value == null) { value = OMOutputFormat.RESPECT_SWA_ATTACHMENT_ORDER_DEFAULT; } return value.booleanValue(); } } ./src/org/apache/axiom/om/impl/OMNodeEx.java0000664000175000017500000000650611767656530017765 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMSerializable; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * Interface OMNodeEx *

        * Internal Implementation detail. Adding special interface to stop folks from accidently using * OMNode. Please use at your own risk. May corrupt the data integrity. */ public interface OMNodeEx extends OMNode { public void setNextOMSibling(OMNode node); public void setPreviousOMSibling(OMNode previousSibling); public void setParent(OMContainer element); public void setComplete(boolean state); public void setType(int nodeType) throws OMException; /** * Serializes the node. Note that this is an internal method that MUST NOT be used outside of * Axiom. Please use {@link OMSerializable#serialize(XMLStreamWriter, boolean)} instead. * * @param writer * @param cache indicates if caching should be enabled * @throws javax.xml.stream.XMLStreamException * */ public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException; /** * @deprecated This method will be removed in a future version of Axiom. It is only here to * maintain backward compatibility with projects using this method despite the fact * that it is marked as internal. */ public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException; /** * @deprecated This method will be removed in a future version of Axiom. It is only here to * maintain backward compatibility with projects using this method despite the fact * that it is marked as internal. */ public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException; /** * Get the next sibling if it is available. The sibling is available if it is complete or * if the builder has started building the node. In the latter case, * {@link OMNode#isComplete()} may return false when called on the sibling. * In contrast to {@link OMNode#getNextOMSibling()}, this method will never modify * the state of the underlying parser. * * @return the next sibling or null if the node has no next sibling or * the builder has not yet started to build the next sibling */ public OMNode getNextOMSiblingIfAvailable(); } ./src/org/apache/axiom/om/impl/OMDocumentImplUtil.java0000664000175000017500000000542111767656530022034 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.impl.util.OMSerializerUtil; /** * Utility class with default implementations for some of the methods defined by the * {@link OMDocument} interface. */ public class OMDocumentImplUtil { private OMDocumentImplUtil() {} public static void internalSerialize(OMDocument document, XMLStreamWriter writer2, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException { MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2; if (includeXMLDeclaration) { //Check whether the OMOutput char encoding and OMDocument char //encoding matches, if not use char encoding of OMOutput String encoding = writer.getCharSetEncoding(); if (encoding == null || "".equals(encoding)) { encoding = document.getCharsetEncoding(); } String version = document.getXMLVersion(); if (version == null) { version = "1.0"; } if (encoding == null) { writer.getXmlStreamWriter().writeStartDocument(version); } else { writer.getXmlStreamWriter().writeStartDocument(encoding, version); } } if (cache || document.isComplete() || document.getBuilder() == null) { OMSerializerUtil.serializeChildren(document, writer, cache); } else { StreamingOMSerializer streamingOMSerializer = new StreamingOMSerializer(); XMLStreamReader reader = document.getXMLStreamReaderWithoutCaching(); while (reader.getEventType() != XMLStreamReader.END_DOCUMENT) { streamingOMSerializer.serialize(reader, writer); } } } } ./src/org/apache/axiom/om/impl/llom/0000775000175000017500000000000011767656530016440 5ustar brianbrian./src/org/apache/axiom/om/impl/llom/OMSerializableImpl.java0000664000175000017500000001623311767656530022774 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import java.io.OutputStream; import java.io.Writer; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMSerializable; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class OMSerializableImpl implements OMSerializable { private static final Log log = LogFactory.getLog(OMSerializableImpl.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); /** Field parserWrapper */ public OMXMLParserWrapper builder; /** Field done */ protected boolean done = false; protected final OMFactory factory; public OMSerializableImpl(OMFactory factory) { this.factory = factory; } public OMFactory getOMFactory() { return factory; } public boolean isComplete() { return done; } /** * Parses this node and builds the object structure in memory. However a node, created * programmatically, will have done set to true by default and this will cause populateyourself * not to work properly! * * @throws OMException */ public void build() throws OMException { if (builder != null && builder.isCompleted()) { if (DEBUG_ENABLED) { log.debug("Builder is already complete."); } } while (!done) { builder.next(); if (builder.isCompleted() && !done) { if (DEBUG_ENABLED) { log.debug("Builder is complete. Setting OMObject to complete."); } setComplete(true); } } } public void close(boolean build) { if (build) { this.build(); } this.done = true; // If this is a StAXBuilder, close it. if (builder instanceof StAXBuilder && !((StAXBuilder) builder).isClosed()) { ((StAXBuilder) builder).releaseParserOnClose(true); ((StAXBuilder) builder).close(); } } public abstract void setComplete(boolean state); /** * Serializes the node. * * @param writer * @throws XMLStreamException */ public abstract void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException; public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { serialize(xmlWriter, true); } public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException { serialize(xmlWriter, false); } public void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException { // If the input xmlWriter is not an MTOMXMLStreamWriter, then wrapper it MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter ? (MTOMXMLStreamWriter) xmlWriter : new MTOMXMLStreamWriter(xmlWriter); internalSerialize(writer, cache); writer.flush(); } public void serialize(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serialize(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serializeAndConsume(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serializeAndConsume(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); try { internalSerialize(writer, true); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2)); writer.setOutputFormat(format); try { internalSerialize(writer, true); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); try { internalSerialize(writer, false); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2)); writer.setOutputFormat(format); try { internalSerialize(writer, false); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } } ./src/org/apache/axiom/om/impl/llom/OMTextImpl.java0000664000175000017500000003377211767656530021321 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.builder.XOPBuilder; import org.apache.axiom.util.UIDGenerator; import org.apache.axiom.util.base64.Base64Utils; import org.apache.axiom.util.stax.XMLStreamWriterUtils; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.io.InputStream; public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants { /** Field nameSpace used when serializing Binary stuff as MTOM optimized. */ public static final OMNamespace XOP_NS = new OMNamespaceImpl( "http://www.w3.org/2004/08/xop/include", "xop"); protected String value = null; protected char[] charArray; private boolean calcNS; // Set to true after textNS is calculated protected OMNamespace textNS; protected String mimeType; protected boolean optimize = false; protected boolean isBinary = false; /** Field contentID for the mime part used when serializing Binary stuff as MTOM optimized. */ private String contentID = null; /** * Field dataHandler contains the DataHandler Declaring as Object to remove the dependency on * Javax.activation.DataHandler */ private Object dataHandlerObject = null; private static final String EMTPY_STRING = ""; /** * Constructor OMTextImpl. * * @param s */ public OMTextImpl(String s, OMFactory factory) { this(s, TEXT_NODE, factory); } /** * @param s * @param nodeType - OMText can handle CHARACTERS, SPACES, CDATA and ENTITY REFERENCES. * Constants for this can be found in OMNode. */ public OMTextImpl(String s, int nodeType, OMFactory factory) { this(null, s, nodeType, factory); } /** * Constructor OMTextImpl. * * @param parent * @param text */ public OMTextImpl(OMContainer parent, String text, OMFactory factory) { this(parent, text, TEXT_NODE, factory); } /** * Construct OMTextImpl that is a copy of the source OMTextImpl * @param parent * @param source OMTextImpl * @param factory */ public OMTextImpl(OMContainer parent, OMTextImpl source, OMFactory factory) { super(parent, factory, true); // Copy the value of the text this.value = source.value; this.nodeType = source.nodeType; // Clone the charArray (if it exists) if (source.charArray != null) { this.charArray = new char[source.charArray.length]; System.arraycopy(source.charArray, 0, this.charArray, 0, source.charArray.length); } // Turn off calcNS...the namespace will need to be recalculated // in the new tree's context. this.calcNS = false; this.textNS = null; // Copy the optimized related settings. this.optimize = source.optimize; this.mimeType = source.mimeType; this.isBinary = source.isBinary; // TODO // Do we need a deep copy of the data-handler this.contentID = source.contentID; this.dataHandlerObject = source.dataHandlerObject; } public OMTextImpl(OMContainer parent, String text, int nodeType, OMFactory factory) { super(parent, factory, true); this.value = text == null ? EMTPY_STRING : text; this.nodeType = nodeType; } public OMTextImpl(OMContainer parent, char[] charArray, int nodeType, OMFactory factory) { super(parent, factory, true); this.charArray = charArray; this.nodeType = nodeType; } public OMTextImpl(OMContainer parent, QName text, OMFactory factory) { this(parent, text, TEXT_NODE, factory); } public OMTextImpl(OMContainer parent, QName text, int nodeType, OMFactory factory) { super(parent, factory, true); if (text == null) throw new IllegalArgumentException("QName text arg cannot be null!"); this.calcNS = true; this.textNS = ((OMElementImpl) parent).handleNamespace(text.getNamespaceURI(), text.getPrefix()); this.value = textNS.getPrefix() + ":" + text.getLocalPart(); this.nodeType = nodeType; } /** * @param s - base64 encoded String representation of Binary * @param mimeType of the Binary */ public OMTextImpl(String s, String mimeType, boolean optimize, OMFactory factory) { this(null, s, mimeType, optimize, factory); } /** * @param parent * @param s - base64 encoded String representation of Binary * @param mimeType of the Binary */ public OMTextImpl(OMContainer parent, String s, String mimeType, boolean optimize, OMFactory factory) { this(parent, s, factory); this.mimeType = mimeType; this.optimize = optimize; this.isBinary = true; done = true; this.nodeType = TEXT_NODE; } /** @param dataHandler To send binary optimised content Created programatically. */ public OMTextImpl(Object dataHandler, OMFactory factory) { this(dataHandler, true, factory); } /** * @param dataHandler * @param optimize To send binary content. Created progrmatically. */ public OMTextImpl(Object dataHandler, boolean optimize, OMFactory factory) { super(factory); this.dataHandlerObject = dataHandler; this.isBinary = true; this.optimize = optimize; done = true; this.nodeType = TEXT_NODE; } /** * Constructor. * * @param dataHandlerProvider * @param optimize * @param factory */ public OMTextImpl(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize, OMFactory factory) { super(factory); this.contentID = contentID; dataHandlerObject = dataHandlerProvider; isBinary = true; this.optimize = optimize; done = true; nodeType = TEXT_NODE; } /** * @param contentID * @param parent * @param builder Used when the builder is encountered with a XOP:Include tag Stores a * reference to the builder and the content-id. Supports deferred parsing of * MIME messages. */ public OMTextImpl(String contentID, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory) { super(parent, factory, false); this.contentID = contentID; this.optimize = true; this.isBinary = true; this.builder = builder; this.nodeType = TEXT_NODE; } /** * Writes the relevant output. * * @param writer * @throws XMLStreamException */ private void writeOutput(XMLStreamWriter writer) throws XMLStreamException { int type = getType(); if (type == TEXT_NODE || type == SPACE_NODE) { writer.writeCharacters(this.getText()); } else if (type == CDATA_SECTION_NODE) { writer.writeCData(this.getText()); } else if (type == ENTITY_REFERENCE_NODE) { writer.writeEntityRef(this.getText()); } } /** Returns the value. */ public String getText() throws OMException { if (charArray != null || this.value != null) { return getTextFromProperPlace(); } else { try { return Base64Utils.encode((DataHandler)getDataHandler()); } catch (Exception e) { throw new OMException(e); } } } public char[] getTextCharacters() { return charArray != null ? charArray : value.toCharArray(); } public boolean isCharacters() { return charArray != null; } /** * This OMText contains two data source:value and charArray. This method will return text from * correct place. */ private String getTextFromProperPlace() { return charArray != null ? new String(charArray) : value; } /** Returns the value. */ public QName getTextAsQName() throws OMException { return ((OMElement)parent).resolveQName(getTextFromProperPlace()); } /* (non-Javadoc) * @see org.apache.axiom.om.OMText#getNamespace() */ public OMNamespace getNamespace() { // If the namespace has already been determined, return it // Otherwise calculate the namespace if the text contains a colon and is not detached. if (calcNS) { return textNS; } else { calcNS = true; if (getParent() != null) { String text = getTextFromProperPlace(); if (text != null) { int colon = text.indexOf(':'); if (colon > 0) { textNS = ((OMElementImpl) getParent()). findNamespaceURI(text.substring(0, colon)); if (textNS != null) { charArray = null; value = text.substring(colon + 1); } } } } } return textNS; } public boolean isOptimized() { return optimize; } public void setOptimize(boolean value) { this.optimize = value; if (value) { isBinary = true; } } /** * Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of * Base64 user has to explicitly specify that the content is binary, before calling * getDataHandler(), getInputStream().... */ public void setBinary(boolean value) { isBinary = value; } public boolean isBinary() { return isBinary; } /** * Gets the datahandler. * * @return Returns javax.activation.DataHandler */ public Object getDataHandler() { if ((value != null || charArray != null) && isBinary) { String text = getTextFromProperPlace(); return org.apache.axiom.attachments.utils.DataHandlerUtils .getDataHandlerFromText(text, mimeType); } else { if (dataHandlerObject == null) { if (contentID == null) { throw new RuntimeException("ContentID is null"); } dataHandlerObject = ((XOPBuilder) builder) .getDataHandler(contentID); } else if (dataHandlerObject instanceof DataHandlerProvider) { try { dataHandlerObject = ((DataHandlerProvider)dataHandlerObject).getDataHandler(); } catch (IOException ex) { throw new OMException(ex); } } return dataHandlerObject; } } public java.io.InputStream getInputStream() throws OMException { if (isBinary) { if (dataHandlerObject == null) { getDataHandler(); } InputStream inStream; javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject; try { inStream = dataHandler.getDataSource().getInputStream(); } catch (IOException e) { throw new OMException( "Cannot get InputStream from DataHandler.", e); } return inStream; } else { throw new OMException("Unsupported Operation"); } } public String getContentID() { if (contentID == null) { contentID = UIDGenerator.generateContentId(); } return this.contentID; } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (!this.isBinary) { writeOutput(writer); } else { try { XMLStreamWriterUtils.writeDataHandler(writer, (DataHandler)getDataHandler(), contentID, optimize); } catch (IOException ex) { throw new OMException("Error reading data handler", ex); } } } /** * A slightly different implementation of the discard method. * * @throws OMException */ public void discard() throws OMException { if (done) { this.detach(); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#buildAll() */ public void buildWithAttachments() { if (!this.done) { this.build(); } if (isOptimized()) { this.getDataHandler(); } } public void setContentID(String cid) { this.contentID = cid; } } ./src/org/apache/axiom/om/impl/llom/util/0000775000175000017500000000000011767656530017415 5ustar brianbrian./src/org/apache/axiom/om/impl/llom/util/AXIOMUtil.java0000664000175000017500000000174511767656530022002 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.util; /** * @deprecated Use {@link org.apache.axiom.om.util.AXIOMUtil} instead. */ public class AXIOMUtil extends org.apache.axiom.om.util.AXIOMUtil { } ./src/org/apache/axiom/om/impl/llom/util/NamespaceContextImpl.java0000664000175000017500000000217211767656530024345 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.util; import java.util.Map; import org.apache.axiom.util.namespace.MapBasedNamespaceContext; /** * @deprecated Use {@link MapBasedNamespaceContext} instead. */ public class NamespaceContextImpl extends MapBasedNamespaceContext { public NamespaceContextImpl(Map map) { super(map); } } ./src/org/apache/axiom/om/impl/llom/util/XMLComparator.java0000664000175000017500000002055011767656530022752 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.exception.XMLComparisonException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Iterator; import java.util.Vector; /** @deprecated This class is outdated. Please use XmlUnit to compate two xml files. */ public class XMLComparator { /** Eran Chinthaka (chinthaka@apache.org) */ private static Log log = LogFactory.getLog(XMLComparator.class); private Vector ignorableNamespaceList = new Vector(); public void addIgnorableNamespace(String nsURI) { ignorableNamespaceList.add(nsURI); } public void clearIgnorableNamespaces() { ignorableNamespaceList.clear(); } public boolean compare(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException { //ignore if the elements belong to any of the ignorable namespaces list if (isIgnorable(elementOne) || isIgnorable(elementTwo)) { return true; } if (elementOne == null && elementTwo == null) { log.info("Both Elements are null."); return true; } if (elementOne == null && elementTwo != null) { throw new XMLComparisonException( "Element One is null and Element Two is not null"); } if (elementOne != null && elementTwo == null) { throw new XMLComparisonException( "Element Two is null and Element One is not null"); } log.info( "Now Checking " + elementOne.getLocalName() + " and " + elementTwo.getLocalName() + "============================="); log.info("Comparing Element Names ......."); compare("Elements names are not equal. ", elementOne.getLocalName(), elementTwo.getLocalName()); log.info("Comparing Namespaces ........."); compare("Element namespaces are not equal", elementOne.getNamespace(), elementTwo.getNamespace()); log.info("Comparing attributes ....."); compareAllAttributes(elementOne, elementTwo); log.info("Comparing texts ....."); /* * Trimming the value of the XMLElement is not correct * since this compare method cannot be used to compare * element contents with trailing and leading whitespaces * BUT for the practicalltiy of tests and to get the current * tests working we have to trim() the contents */ compare("Elements texts are not equal ", elementOne.getText().trim(), elementTwo.getText().trim()); log.info("Comparing Children ......"); compareAllChildren(elementOne, elementTwo); return true; } private void compareAllAttributes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException { compareAttibutes(elementOne, elementTwo); compareAttibutes(elementTwo, elementOne); } private void compareAllChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException { compareChildren(elementOne, elementTwo); compareChildren(elementTwo, elementOne); } private boolean isIgnorable(OMElement elt) { if (elt != null) { OMNamespace namespace = elt.getNamespace(); if (namespace != null) { return ignorableNamespaceList.contains(namespace.getNamespaceURI()); } else { return false; } } else { return false; } } private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException { //ignore if the elements belong to any of the ignorable namespaces list if (isIgnorable(elementOne) || isIgnorable(elementTwo)) { return; } Iterator elementOneChildren = elementOne.getChildren(); while (elementOneChildren.hasNext()) { OMNode omNode = (OMNode) elementOneChildren.next(); if (omNode instanceof OMElement) { OMElement elementOneChild = (OMElement) omNode; OMElement elementTwoChild = null; //Do the comparison only if the element is not ignorable if (!isIgnorable(elementOneChild)) { elementTwoChild = elementTwo.getFirstChildWithName( elementOneChild.getQName()); //Do the comparison only if the element is not ignorable if (!isIgnorable(elementTwoChild)) { if (elementTwoChild == null) { throw new XMLComparisonException( " There is no " + elementOneChild.getLocalName() + " element under " + elementTwo.getLocalName()); } } } compare(elementOneChild, elementTwoChild); } } } private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException { int elementOneAtribCount = 0; int elementTwoAtribCount = 0; Iterator attributes = elementOne.getAllAttributes(); while (attributes.hasNext()) { OMAttribute omAttribute = (OMAttribute) attributes.next(); OMAttribute attr = elementTwo.getAttribute( omAttribute.getQName()); if (attr == null) { throw new XMLComparisonException( "Attributes are not the same in two elements. Attribute " + omAttribute.getLocalName() + " != "); } elementOneAtribCount++; } Iterator elementTwoIter = elementTwo.getAllAttributes(); while (elementTwoIter.hasNext()) { elementTwoIter.next(); elementTwoAtribCount++; } if (elementOneAtribCount != elementTwoAtribCount) { throw new XMLComparisonException( "Attributes are not the same in two elements."); } } private void compare(String failureNotice, String one, String two) throws XMLComparisonException { if (!one.equals(two)) { throw new XMLComparisonException( failureNotice + one + " != " + two); } } private void compare(String failureNotice, OMNamespace one, OMNamespace two) throws XMLComparisonException { if (one == null && two == null) { return; } else if (one != null && two == null) { throw new XMLComparisonException( "First Namespace is NOT null. But the second is null"); } else if (one == null && two != null) { throw new XMLComparisonException( "First Namespace is null. But the second is NOT null"); } if (!one.getNamespaceURI().equals(two.getNamespaceURI())) { throw new XMLComparisonException( failureNotice + one + " != " + two); } // Do we need to compare prefixes as well } } ./src/org/apache/axiom/om/impl/llom/OMCommentImpl.java0000664000175000017500000000455411767656530021773 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class OMCommentImpl extends OMNodeImpl implements OMComment { protected String value; /** * Constructor OMCommentImpl. * * @param parentNode * @param contentText */ public OMCommentImpl(OMContainer parentNode, String contentText, OMFactory factory) { super(parentNode, factory, true); this.value = contentText; nodeType = OMNode.COMMENT_NODE; } /** * Constructor OMCommentImpl. * * @param parentNode */ public OMCommentImpl(OMContainer parentNode, OMFactory factory) { this(parentNode, null, factory); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { writer.writeComment(this.value); } /** * Gets the value of this comment. * * @return Returns String. */ public String getValue() { return value; } /** * Sets the value of this comment. * * @param text */ public void setValue(String text) { this.value = text; } /** * Discards this node. * * @throws OMException */ public void discard() throws OMException { if (done) { this.detach(); } } } ./src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java0000664000175000017500000000364411767656530021726 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMXMLParserWrapper; /** * Empty subclass of {@link org.apache.axiom.om.impl.OMStAXWrapper} to keep compatibility * with existing code. */ public class OMStAXWrapper extends org.apache.axiom.om.impl.OMStAXWrapper { /** * When constructing the OMStaxWrapper, the creator must produce the builder (an instance of the * OMXMLparserWrapper of the input) and the Element Node to start parsing. The wrapper will * parse(proceed) until the end of the given element. Hence care should be taken to pass the * root element if the entire document is needed. * * @param builder * @param startNode */ public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode) { super(builder, startNode); } /** * Constructor OMStAXWrapper. * * @param builder * @param startNode * @param cache */ public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache) { super(builder, startNode, cache); } } ./src/org/apache/axiom/om/impl/llom/OMNamespaceImpl.java0000664000175000017500000000210111767656530022247 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; /** @deprecated Use {@link org.apache.axiom.om.impl.OMNamespaceImpl} */ public class OMNamespaceImpl extends org.apache.axiom.om.impl.OMNamespaceImpl { public OMNamespaceImpl(String pUri, String prefix) { super(pUri, prefix); } } ./src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java0000664000175000017500000000574511767656530024752 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class OMProcessingInstructionImpl extends OMNodeImpl implements OMProcessingInstruction { protected String target; protected String value; /** * Constructor OMProcessingInstructionImpl. * * @param parentNode * @param target * @param value */ public OMProcessingInstructionImpl(OMContainer parentNode, String target, String value, OMFactory factory) { super(parentNode, factory, true); this.target = target; this.value = value; nodeType = OMNode.PI_NODE; } /** * Constructor OMProcessingInstructionImpl. * * @param parentNode */ public OMProcessingInstructionImpl(OMContainer parentNode, OMFactory factory) { this(parentNode, null, null, factory); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { writer.writeProcessingInstruction(this.target + " ", this.value); } /** * Gets the value of this Processing Instruction. * * @return string */ public String getValue() { return value; } /** * Sets the target of this Processing Instruction. * * @param target */ public void setTarget(String target) { this.target = target; } /** * Gets the target of this Processing Instruction. * * @return Returns String. */ public String getTarget() { return target; } /** * Sets the value of this Processing Instruction. * * @param text */ public void setValue(String text) { this.value = text; } /** * Discards this node. * * @throws OMException */ public void discard() throws OMException { if (done) { this.detach(); } } } ./src/org/apache/axiom/om/impl/llom/OMElementImpl.java0000664000175000017500000011145211767656530021756 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.OMXMLStreamReader; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder; import org.apache.axiom.om.impl.builder.XOPBuilder; import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory; import org.apache.axiom.om.impl.traverse.OMChildElementIterator; import org.apache.axiom.om.impl.traverse.OMChildrenIterator; import org.apache.axiom.om.impl.traverse.OMChildrenLegacyQNameIterator; import org.apache.axiom.om.impl.traverse.OMChildrenLocalNameIterator; import org.apache.axiom.om.impl.traverse.OMChildrenNamespaceIterator; import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator; import org.apache.axiom.om.impl.util.EmptyIterator; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.StringWriter; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; /** Class OMElementImpl */ public class OMElementImpl extends OMNodeImpl implements OMElement, OMConstants, OMContainerEx { private static final Log log = LogFactory.getLog(OMElementImpl.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); public static final OMNamespace DEFAULT_DEFAULT_NS_OBJECT = new OMNamespaceImpl("", ""); /** Field ns */ protected OMNamespace ns; /** Field localName */ protected String localName; protected QName qName; /** Field firstChild */ protected OMNode firstChild; /** Field namespaces */ protected HashMap namespaces = null; /** Field attributes */ protected HashMap attributes = null; /** Field noPrefixNamespaceCounter */ protected int noPrefixNamespaceCounter = 0; protected OMNode lastChild; private int lineNumber; private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator(); /** * Constructor OMElementImpl. A null namespace indicates that the default namespace in scope is * used */ public OMElementImpl(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory) { super(parent, factory, false); this.localName = localName; if (ns != null) { setNamespace(ns); } this.builder = builder; firstChild = null; } /** Constructor OMElementImpl. */ public OMElementImpl(String localName, OMNamespace ns, OMFactory factory) { this(localName, ns, null, factory); } /** * This is the basic constructor for OMElement. All the other constructors depends on this. * * @param localName - this MUST always be not null * @param ns - can be null * @param parent - this should be an OMContainer * @param factory - factory that created this OMElement *

        * A null namespace indicates that the default namespace in scope is used */ public OMElementImpl(String localName, OMNamespace ns, OMContainer parent, OMFactory factory) { super(parent, factory, true); if (localName == null || localName.trim().length() == 0) { throw new OMException("localname can not be null or empty"); } this.localName = localName; if (ns != null) { setNamespace(ns); } } /** * It is assumed that the QName passed contains, at least, the localName for this element. * * @param qname - this should be valid qname according to javax.xml.namespace.QName * @throws OMException */ public OMElementImpl(QName qname, OMContainer parent, OMFactory factory) throws OMException { this(qname.getLocalPart(), null, parent, factory); this.ns = handleNamespace(qname); } /** Method handleNamespace. */ OMNamespace handleNamespace(QName qname) { OMNamespace ns = null; // first try to find a namespace from the scope String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null && namespaceURI.length() > 0) { String prefix = qname.getPrefix(); ns = findNamespace(qname.getNamespaceURI(), prefix); /** * What is left now is * 1. nsURI = null & parent != null, but ns = null * 2. nsURI != null, (parent doesn't have an ns with given URI), but ns = null */ if (ns == null) { if ("".equals(prefix)) { prefix = OMSerializerUtil.getNextNSPrefix(); } ns = declareNamespace(namespaceURI, prefix); } if (ns != null) { this.ns = ns; } } return ns; } /** * Method handleNamespace. * * @return Returns namespace. */ private OMNamespace handleNamespace(OMNamespace ns) { OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix()); if (namespace == null) { namespace = declareNamespace(ns); } return namespace; } OMNamespace handleNamespace(String namespaceURI, String prefix) { OMNamespace namespace = findNamespace(namespaceURI, prefix); if (namespace == null) { namespace = declareNamespace(namespaceURI, prefix); } return namespace; } /** * Adds child to the element. One can decide whether to append the child or to add to the front * of the children list. */ public void addChild(OMNode child) { if (child.getOMFactory() instanceof OMLinkedListImplFactory) { addChild((OMNodeImpl) child); } else { addChild(importNode(child)); } } /** * Searches for children with a given QName and returns an iterator to traverse through the * OMNodes. This QName can contain any combination of prefix, localname and URI. * * @throws OMException */ public Iterator getChildrenWithName(QName elementQName) { OMNode firstChild = getFirstOMChild(); Iterator it = new OMChildrenQNameIterator(firstChild, elementQName); // The getChidrenWithName method used to tolerate an empty namespace // and interpret that as getting any element that matched the local // name. There are custmers of axiom that have hard-coded dependencies // on this semantic. // The following code falls back to this legacy behavior only if // (a) elementQName has no namespace, (b) the new iterator finds no elements // and (c) there are children. if (elementQName.getNamespaceURI().length() == 0 && firstChild != null && !it.hasNext()) { if (log.isTraceEnabled()) { log.trace("There are no child elements that match the unqualifed name: " + elementQName); log.trace("Now looking for child elements that have the same local name."); } it = new OMChildrenLegacyQNameIterator(getFirstOMChild(), elementQName); } return it; } public Iterator getChildrenWithLocalName(String localName) { return new OMChildrenLocalNameIterator(getFirstOMChild(), localName); } public Iterator getChildrenWithNamespaceURI(String uri) { return new OMChildrenNamespaceIterator(getFirstOMChild(), uri); } /** * Method getFirstChildWithName. * * @throws OMException */ public OMElement getFirstChildWithName(QName elementQName) throws OMException { OMChildrenQNameIterator omChildrenQNameIterator = new OMChildrenQNameIterator(getFirstOMChild(), elementQName); OMNode omNode = null; if (omChildrenQNameIterator.hasNext()) { omNode = (OMNode) omChildrenQNameIterator.next(); } return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ? (OMElement) omNode : null; } /** Method addChild. */ private void addChild(OMNodeImpl child) { if (child.parent == this && child == lastChild) { // The child is already the last node. // We don't need to detach and re-add it. } else { // Normal Case // The order of these statements is VERY important // Since setting the parent has a detach method inside // it strips down all the rerefences to siblings. // setting the siblings should take place AFTER setting the parent child.setParent(this); if (firstChild == null) { firstChild = child; child.previousSibling = null; } else { child.previousSibling = (OMNodeImpl) lastChild; ((OMNodeImpl) lastChild).nextSibling = child; } child.nextSibling = null; lastChild = child; } // For a normal OMNode, the incomplete status is // propogated up the tree. // However, a OMSourcedElement is self-contained // (it has an independent parser source). // So only propogate the incomplete setting if this // is a normal OMNode if (!child.isComplete() && !(child instanceof OMSourcedElement)) { this.setComplete(false); } } /** * Gets the next sibling. This can be an OMAttribute or OMText or OMELement for others. * * @throws OMException */ public OMNode getNextOMSibling() throws OMException { while (!done && builder != null ) { if (builder.isCompleted()) { if (DEBUG_ENABLED) { log.debug("Builder is complete. Setting OMElement to complete."); } setComplete(true); } else { int token = builder.next(); if (token == XMLStreamConstants.END_DOCUMENT) { throw new OMException( "Parser has already reached end of the document. No siblings found"); } } } return super.getNextOMSibling(); } /** * Returns a collection of this element. Children can be of types OMElement, OMText. * * @return Returns children. */ public Iterator getChildren() { return new OMChildrenIterator(getFirstOMChild()); } /** * Returns a filtered list of children - just the elements. * * @return Returns an iterator of the child elements. */ public Iterator getChildElements() { return new OMChildElementIterator(getFirstElement()); } /** * Creates a namespace in the current element scope. * * @return Returns namespace. */ public OMNamespace declareNamespace(String uri, String prefix) { if ("".equals(prefix)) prefix = OMSerializerUtil.getNextNSPrefix(); OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix); return declareNamespace(ns); } /** * We use "" to store the default namespace of this element. As one can see user can not give "" * as the prefix, when he declare a usual namespace. * * @param uri */ public OMNamespace declareDefaultNamespace(String uri) { OMNamespaceImpl namespace = new OMNamespaceImpl(uri == null ? "" : uri, ""); if (namespaces == null) { this.namespaces = new HashMap(5); } namespaces.put("", namespace); if (ns == null || "".equals(ns.getPrefix())) { ns = namespace; this.qName = null; } return namespace; } public OMNamespace getDefaultNamespace() { OMNamespace defaultNS; if (namespaces != null && (defaultNS = (OMNamespace) namespaces.get("")) != null) { return defaultNS; } if (parent instanceof OMElementImpl) { return ((OMElementImpl) parent).getDefaultNamespace(); } return null; } /** @return Returns namespace. */ public OMNamespace declareNamespace(OMNamespace namespace) { if (namespaces == null) { this.namespaces = new HashMap(5); } String prefix = namespace.getPrefix(); if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); namespace = new OMNamespaceImpl(namespace.getNamespaceURI(), prefix); } namespaces.put(prefix, namespace); return namespace; } /** * Finds a namespace with the given uri and prefix, in the scope of the document. Starts to find * from the current element and goes up in the hiararchy until one is found. If none is found, * returns null. */ public OMNamespace findNamespace(String uri, String prefix) { // check in the current element OMNamespace namespace = findDeclaredNamespace(uri, prefix); if (namespace != null) { return namespace; } // go up to check with ancestors if (parent != null) { //For the OMDocumentImpl there won't be any explicit namespace //declarations, so going up the parent chain till the document //element should be enough. if (parent instanceof OMElement) { namespace = ((OMElementImpl) parent).findNamespace(uri, prefix); } } return namespace; } public OMNamespace findNamespaceURI(String prefix) { OMNamespace ns = this.namespaces == null ? null : (OMNamespace) this.namespaces.get(prefix); if (ns == null && this.parent instanceof OMElement) { // try with the parent ns = ((OMElement) this.parent).findNamespaceURI(prefix); } return ns; } // Constant static final OMNamespaceImpl xmlns = new OMNamespaceImpl(OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX); /** * Checks for the namespace only in the current Element. This is also used to retrieve * the prefix of a known namespace URI. */ private OMNamespace findDeclaredNamespace(String uri, String prefix) { if (uri == null) { return namespaces == null ? null : (OMNamespace)namespaces.get(prefix); } //If the prefix is available and uri is available and its the xml namespace if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI)) { return xmlns; } if (namespaces == null) { return null; } if (prefix == null || "".equals(prefix)) { OMNamespace defaultNamespace = this.getDefaultNamespace(); if (defaultNamespace != null && uri.equals(defaultNamespace.getNamespaceURI())) { return defaultNamespace; } Iterator namespaceListIterator = namespaces.values().iterator(); String nsUri; while (namespaceListIterator.hasNext()) { OMNamespace omNamespace = (OMNamespace) namespaceListIterator.next(); nsUri = omNamespace.getNamespaceURI(); if (nsUri != null && nsUri.equals(uri)) { return omNamespace; } } } else { OMNamespace namespace = (OMNamespace) namespaces.get(prefix); if (namespace != null && uri.equals(namespace.getNamespaceURI())) { return namespace; } } return null; } /** * Method getAllDeclaredNamespaces. * * @return Returns Iterator. */ public Iterator getAllDeclaredNamespaces() { if (namespaces == null) { return EMPTY_ITERATOR; } return namespaces.values().iterator(); } /** * Returns a List of OMAttributes. * * @return Returns iterator. */ public Iterator getAllAttributes() { if (attributes == null) { return EMPTY_ITERATOR; } return attributes.values().iterator(); } /** * Returns a named attribute if present. * * @param qname the qualified name to search for * @return Returns an OMAttribute with the given name if found, or null */ public OMAttribute getAttribute(QName qname) { return attributes == null ? null : (OMAttribute) attributes.get(qname); } /** * Returns a named attribute's value, if present. * * @param qname the qualified name to search for * @return Returns a String containing the attribute value, or null. */ public String getAttributeValue(QName qname) { OMAttribute attr = getAttribute(qname); return (attr == null) ? null : attr.getAttributeValue(); } /** * Inserts an attribute to this element. Implementor can decide as to insert this in the front * or at the end of set of attributes. * *

        The owner of the attribute is set to be the particular OMElement. * If the attribute already has an owner then the attribute is cloned (i.e. its name, * value and namespace are copied to a new attribute) and the new attribute is added * to the element. It's owner is then set to be the particular OMElement. * * @return The attribute that was added to the element. Note: The added attribute * may not be the same instance that was given to add. This can happen if the given * attribute already has an owner. In such case the returned attribute and the given * attribute are equal but not the same instance. * * @see OMAttributeImpl#equals(Object) */ public OMAttribute addAttribute(OMAttribute attr){ // If the attribute already has an owner element then clone the attribute (except if it is owned // by the this element) OMElement owner = attr.getOwner(); if (owner != null) { if (owner == this) { return attr; } attr = new OMAttributeImpl( attr.getLocalName(), attr.getNamespace(), attr.getAttributeValue(), attr.getOMFactory()); } if (attributes == null) { this.attributes = new LinkedHashMap(5); } OMNamespace namespace = attr.getNamespace(); if (namespace != null) { String uri = namespace.getNamespaceURI(); if (uri.length() > 0) { String prefix = namespace.getPrefix(); OMNamespace ns2 = findNamespaceURI(prefix); if (ns2 == null || !uri.equals(ns2.getNamespaceURI())) { declareNamespace(uri, prefix); } } } // Set the owner element of the attribute ((OMAttributeImpl)attr).owner = this; OMAttributeImpl oldAttr = (OMAttributeImpl)attributes.put(attr.getQName(), attr); // Did we replace an existing attribute? if (oldAttr != null) { oldAttr.owner = null; } return attr; } /** Method removeAttribute. */ public void removeAttribute(OMAttribute attr) { if (attributes != null) { // Remove the owner from this attribute ((OMAttributeImpl)attr).owner = null; attributes.remove(attr.getQName()); } } public OMAttribute addAttribute(String attributeName, String value, OMNamespace ns) { OMNamespace namespace = null; if (ns != null) { String namespaceURI = ns.getNamespaceURI(); String prefix = ns.getPrefix(); namespace = findNamespace(namespaceURI, prefix); if (namespace == null) { namespace = new OMNamespaceImpl(namespaceURI, prefix); } } return addAttribute(new OMAttributeImpl(attributeName, namespace, value, this.factory)); } /** Method setBuilder. */ public void setBuilder(OMXMLParserWrapper wrapper) { this.builder = wrapper; } /** * Method getBuilder. * * @return Returns OMXMLParserWrapper. */ public OMXMLParserWrapper getBuilder() { return builder; } /** Forces the parser to proceed, if parser has not yet finished with the XML input. */ public void buildNext() { if (builder != null) { if (!builder.isCompleted()) { builder.next(); } else { this.setComplete(true); if (DEBUG_ENABLED) { log.debug("Builder is complete. Setting OMElement to complete."); } } } } /** * Method getFirstOMChild. * * @return Returns child. */ public OMNode getFirstOMChild() { while ((firstChild == null) && !done) { buildNext(); } return firstChild; } public OMNode getFirstOMChildIfAvailable() { return firstChild; } /** Method setFirstChild. */ public void setFirstChild(OMNode firstChild) { if (firstChild != null) { ((OMNodeEx) firstChild).setParent(this); } this.firstChild = firstChild; } public void setLastChild(OMNode omNode) { this.lastChild = omNode; } /** * Removes this information item and its children, from the model completely. * * @throws OMException */ public OMNode detach() throws OMException { if (!done) { build(); } super.detach(); return this; } /** Gets the type of node, as this is the super class of all the nodes. */ public int getType() { return OMNode.ELEMENT_NODE; } public void build() throws OMException { /** * builder is null. Meaning this is a programatical created element but it has children which are not completed * Build them all. */ if (builder == null && !done) { for (Iterator childrenIterator = this.getChildren(); childrenIterator.hasNext();) { OMNode omNode = (OMNode) childrenIterator.next(); omNode.build(); } } else { super.build(); } } public XMLStreamReader getXMLStreamReader() { return getXMLStreamReader(true); } public XMLStreamReader getXMLStreamReaderWithoutCaching() { return getXMLStreamReader(false); } public XMLStreamReader getXMLStreamReader(boolean cache) { return OMContainerHelper.getXMLStreamReader(this, cache); } /** * Sets the text of the given element. caution - This method will wipe out all the text elements * (and hence any mixed content) before setting the text. */ public void setText(String text) { OMNode child = this.getFirstOMChild(); while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { child.detach(); } child = child.getNextOMSibling(); } OMAbstractFactory.getOMFactory().createOMText(this, text); } /** * Sets the text, as a QName, of the given element. caution - This method will wipe out all the * text elements (and hence any mixed content) before setting the text. */ public void setText(QName text) { OMNode child = this.getFirstOMChild(); while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { child.detach(); } child = child.getNextOMSibling(); } OMAbstractFactory.getOMFactory().createOMText(this, text); } /** * Selects all the text children and concatenates them to a single string. * * @return Returns String. */ public String getText() { String childText = null; StringBuffer buffer = null; OMNode child = this.getFirstOMChild(); while (child != null) { final int type = child.getType(); if (type == OMNode.TEXT_NODE || type == OMNode.CDATA_SECTION_NODE) { OMText textNode = (OMText) child; String textValue = textNode.getText(); if (textValue != null && textValue.length() != 0) { if (childText == null) { // This is the first non empty text node. Just save the string. childText = textValue; } else { // We've already seen a non empty text node before. Concatenate using // a StringBuffer. if (buffer == null) { // This is the first text node we need to append. Initialize the // StringBuffer. buffer = new StringBuffer(childText); } buffer.append(textValue); } } } child = child.getNextOMSibling(); } if (childText == null) { // We didn't see any text nodes. Return an empty string. return ""; } else if (buffer != null) { return buffer.toString(); } else { return childText; } } public QName getTextAsQName() { String childText = getTrimmedText(); if (childText != null) { return resolveQName(childText); } return null; } /** * Returns the concatination string of TRIMMED values of all OMText child nodes of this * element. This is included purely to improve usability. */ public String getTrimmedText() { String childText = null; StringBuffer buffer = null; OMNode child = this.getFirstOMChild(); while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { OMText textNode = (OMText) child; String textValue = textNode.getText(); if (textValue != null && textValue.length() != 0) { if (childText == null) { // This is the first non empty text node. Just save the string. childText = textValue.trim(); } else { // We've already seen a non empty text node before. Concatenate using // a StringBuffer. if (buffer == null) { // This is the first text node we need to append. Initialize the // StringBuffer. buffer = new StringBuffer(childText); } buffer.append(textValue.trim()); } } } child = child.getNextOMSibling(); } if (childText == null) { // We didn't see any text nodes. Return an empty string. return ""; } else if (buffer != null) { return buffer.toString(); } else { return childText; } } /////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (cache || this.done || (this.builder == null)) { OMSerializerUtil.serializeStartpart(this, writer); OMSerializerUtil.serializeChildren(this, writer, cache); OMSerializerUtil.serializeEndpart(writer); } else { OMSerializerUtil.serializeByPullStream(this, writer, cache); } } //////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// /** * Gets first element. * * @return Returns element. */ public OMElement getFirstElement() { OMNode node = getFirstOMChild(); while (node != null) { if (node.getType() == OMNode.ELEMENT_NODE) { return (OMElement) node; } else { node = node.getNextOMSibling(); } } return null; } /** * Method getLocalName. * * @return Returns local name. */ public String getLocalName() { return localName; } /** Method setLocalName. */ public void setLocalName(String localName) { this.localName = localName; this.qName = null; } public OMNamespace getNamespace() { // return ns != null ? ns : DEFAULT_DEFAULT_NS_OBJECT; if (ns == null) { // User wants to keep this element in the default default namespace. Let's try to see the default namespace // is overriden by some one up in the tree OMNamespace parentDefaultNS = this.findNamespaceURI(""); if (parentDefaultNS != null && !"".equals(parentDefaultNS.getNamespaceURI())) { // if it was overriden, then we must explicitly declare default default namespace as the namespace // of this element ns = DEFAULT_DEFAULT_NS_OBJECT; this.qName = null; } } return ns; } public String getNamespaceURI() { OMNamespace ns = getNamespace(); if (ns == null) { return null; } else { String namespaceURI = ns.getNamespaceURI(); return namespaceURI.length() == 0 ? null : namespaceURI; } } /** Method setNamespace. */ public void setNamespace(OMNamespace namespace) { OMNamespace nsObject = null; if (namespace != null) { nsObject = handleNamespace(namespace); } this.ns = nsObject; this.qName = null; } public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) { this.ns = namespace; this.qName = null; } /** * Method getQName. * * @return Returns QName. */ public QName getQName() { if (qName != null) { return qName; } if (ns != null) { if (ns.getPrefix() != null) { qName = new QName(ns.getNamespaceURI(), localName, ns.getPrefix()); } else { qName = new QName(ns.getNamespaceURI(), localName); } } else { qName = new QName(localName); } return qName; } public String toStringWithConsume() throws XMLStreamException { StringWriter writer = new StringWriter(); XMLStreamWriter writer2 = StAXUtils.createXMLStreamWriter(writer); try { this.serializeAndConsume(writer2); writer2.flush(); } finally { writer2.close(); } return writer.toString(); } public String toString() { StringWriter writer = new StringWriter(); try { XMLStreamWriter writer2 = StAXUtils.createXMLStreamWriter(writer); try { this.serialize(writer2); writer2.flush(); } finally { writer2.close(); } } catch (XMLStreamException e) { throw new RuntimeException("Can not serialize OM Element " + this.getLocalName(), e); } return writer.toString(); } /** * Method discard. * * @throws OMException */ public void discard() throws OMException { if (done || builder == null) { this.detach(); } else { builder.discard(this); } } public QName resolveQName(String qname) { int idx = qname.indexOf(':'); if (idx == -1) { OMNamespace ns = getDefaultNamespace(); return ns == null ? new QName(qname) : new QName(ns.getNamespaceURI(), qname, ""); } else { String prefix = qname.substring(0, idx); OMNamespace ns = findNamespace(null, prefix); return ns == null ? null : new QName(ns.getNamespaceURI(), qname.substring(idx+1), prefix); } } public OMElement cloneOMElement() { if (log.isDebugEnabled()) { log.debug("cloneOMElement start"); log.debug(" element string =" + getLocalName()); log.debug(" isComplete = " + isComplete()); log.debug(" builder = " + builder); } // Make sure the source (this node) is completed if (!isComplete()) { this.build(); } // Now get a parser for the full tree XMLStreamReader xmlStreamReader = this.getXMLStreamReader(true); if (log.isDebugEnabled()) { log.debug(" reader = " + xmlStreamReader); } // Get a new builder. Use an xop aware builder if the original // builder is xop aware StAXOMBuilder newBuilder = null; if (builder instanceof XOPBuilder) { Attachments attachments = ((XOPBuilder)builder).getAttachments(); attachments.getAllContentIDs(); if (xmlStreamReader instanceof OMXMLStreamReader) { if (log.isDebugEnabled()) { log.debug(" read optimized xop:include"); } ((OMXMLStreamReader)xmlStreamReader).setInlineMTOM(false); } newBuilder = new XOPAwareStAXOMBuilder(xmlStreamReader, attachments); } else { newBuilder = new StAXOMBuilder(xmlStreamReader); } if (log.isDebugEnabled()) { log.debug(" newBuilder = " + newBuilder); } // Build the (target) clonedElement from the parser OMElement clonedElement = newBuilder.getDocumentElement(); clonedElement.build(); return clonedElement; } public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } public int getLineNumber() { return lineNumber; } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#buildAll() */ public void buildWithAttachments() { if (!done) { this.build(); } Iterator iterator = getChildren(); while (iterator.hasNext()) { OMNode node = (OMNode) iterator.next(); node.buildWithAttachments(); } } /** This method will be called when one of the children becomes complete. */ protected void notifyChildComplete() { if (!this.done && builder == null) { Iterator iterator = getChildren(); while (iterator.hasNext()) { OMNode node = (OMNode) iterator.next(); if (!node.isComplete()) { return; } } this.setComplete(true); } } } ./src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java0000664000175000017500000000454411767656530021737 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class OMDocTypeImpl extends OMNodeImpl implements OMDocType { protected String value; /** * Constructor OMDocTypeImpl. * * @param parentNode * @param contentText */ public OMDocTypeImpl(OMContainer parentNode, String contentText, OMFactory factory) { super(parentNode, factory, true); this.value = contentText; nodeType = OMNode.DTD_NODE; } /** * Constructor OMDocTypeImpl. * * @param parentNode */ public OMDocTypeImpl(OMContainer parentNode, OMFactory factory) { this(parentNode, null, factory); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { writer.writeDTD(this.value); } /** * Gets the value of this DocType. * * @return Returns String. */ public String getValue() { return value; } /** * Sets the value of this DocType. * * @param text */ public void setValue(String text) { this.value = text; } /** * Discards this node. * * @throws OMException */ public void discard() throws OMException { if (done) { this.detach(); } } } ./src/org/apache/axiom/om/impl/llom/OMNodeImpl.java0000664000175000017500000002762411767656530021261 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory; /** Class OMNodeImpl */ public abstract class OMNodeImpl extends OMSerializableImpl implements OMNode, OMNodeEx { /** Field parent */ protected OMContainerEx parent; /** Field nextSibling */ protected OMNodeImpl nextSibling; /** Field previousSibling */ protected OMNodeImpl previousSibling; /** Field nodeType */ protected int nodeType; /** * Constructor OMNodeImpl * * @param factory The OMFactory that created this */ public OMNodeImpl(OMFactory factory) { super(factory); } /** * For a node to exist there must be a parent. * * @param parent Parent OMContainer of this node * @param factory The OMFactory that created this */ public OMNodeImpl(OMContainer parent, OMFactory factory, boolean done) { super(factory); this.done = done; if ((parent != null)) { this.parent = (OMContainerEx) parent; parent.addChild(this); } } /** * Returns the immediate parent of the node. Parent is always an Element. * * @return Returns OMContainer. * @throws OMException */ public OMContainer getParent() { return parent; } /** * Method setParent. * * @param element */ public void setParent(OMContainer element) { if ((this.parent) == element) { return; } //If we are asked to assign a new parent in place //of an existing one. We should detach this node //from the previous parent. if (element != null) { if (this.parent != null) { this.detach(); } this.parent = (OMContainerEx) element; } else { this.parent = null; } } /** * Returns the next sibling. This can be an OMAttribute or OMText or OMElement for others. * * @return Returns OMNode. * @throws org.apache.axiom.om.OMException * */ public OMNode getNextOMSibling() throws OMException { if ((nextSibling == null) && (parent != null) && !parent.isComplete()) { parent.buildNext(); } return nextSibling; } public OMNode getNextOMSiblingIfAvailable() { return nextSibling; } /** * Method setNextOMSibling. * * @param node */ public void setNextOMSibling(OMNode node) { if (node == null || node.getOMFactory() instanceof OMLinkedListImplFactory) { this.nextSibling = (OMNodeImpl) node; } else { this.nextSibling = (OMNodeImpl) importNode(node); } this.nextSibling = (OMNodeImpl) node; } /** * Method setComplete. * * @param state */ public void setComplete(boolean state) { this.done = state; if (parent != null) { if (!done) { parent.setComplete(false); } else if (parent instanceof OMElementImpl) { ((OMElementImpl) parent).notifyChildComplete(); } } } /** * Removes this information item and its children, from the model completely. * * @throws OMException */ public OMNode detach() throws OMException { if (parent == null) { throw new OMException( "Nodes that don't have a parent can not be detached"); } OMNodeImpl nextSibling = (OMNodeImpl) getNextOMSibling(); if (previousSibling == null) { parent.setFirstChild(nextSibling); } else { ((OMNodeEx) getPreviousOMSibling()).setNextOMSibling(nextSibling); } if (nextSibling != null) { nextSibling.setPreviousOMSibling(getPreviousOMSibling()); } if ((parent instanceof OMElementImpl) && ((OMElementImpl) parent).lastChild == this) { ((OMElementImpl) parent).lastChild = getPreviousOMSibling(); } this.previousSibling = null; this.nextSibling = null; this.parent = null; return this; } /** * Inserts a sibling just after the current information item. * * @param sibling * @throws OMException */ public void insertSiblingAfter(OMNode sibling) throws OMException { if (parent == null) { throw new OMException("Parent can not be null"); } else if (this == sibling) { throw new OMException("Inserting self as the sibling is not allowed"); } ((OMNodeEx) sibling).setParent(parent); if (sibling instanceof OMNodeImpl) { OMNodeImpl siblingImpl = (OMNodeImpl) sibling; if (nextSibling == null) { getNextOMSibling(); } siblingImpl.setPreviousOMSibling(this); if (nextSibling == null) { parent.setLastChild(sibling); } else { nextSibling.setPreviousOMSibling(sibling); } ((OMNodeEx) sibling).setNextOMSibling(nextSibling); nextSibling = siblingImpl; } } /** * Inserts a sibling just before the current information item. * * @param sibling * @throws OMException */ public void insertSiblingBefore(OMNode sibling) throws OMException { if (parent == null) { throw new OMException("Parent can not be null"); } else if (this == sibling) { throw new OMException("Inserting self as the sibling is not allowed"); } if (sibling instanceof OMNodeImpl) { OMNodeImpl siblingImpl = (OMNodeImpl) sibling; if (previousSibling == null) { parent.setFirstChild(siblingImpl); siblingImpl.nextSibling = this; siblingImpl.previousSibling = null; } else { siblingImpl.setParent(parent); siblingImpl.nextSibling = this; previousSibling.setNextOMSibling(siblingImpl); siblingImpl.setPreviousOMSibling(previousSibling); } previousSibling = siblingImpl; } } /** * Gets the type of node, as this is the super class of all the nodes. * * @return Returns the type of node as indicated by {@link #setType} * @see #setType */ public int getType() { return nodeType; } /** * Method setType. * * @param nodeType * @throws OMException */ public void setType(int nodeType) throws OMException { this.nodeType = nodeType; } /** * Gets the previous sibling. * * @return boolean */ public OMNode getPreviousOMSibling() { return previousSibling; } /** * Method setPreviousOMSibling. * * @param previousSibling */ public void setPreviousOMSibling(OMNode previousSibling) { if (previousSibling == null || previousSibling.getOMFactory() instanceof OMLinkedListImplFactory) { this.previousSibling = (OMNodeImpl) previousSibling; } else { this.previousSibling = (OMNodeImpl) importNode(previousSibling); } } /** * Parses this node and builds the object structure in memory. AXIOM supports two levels of * deffered building. First is deffered building of AXIOM using StAX. Second level is the * deffered building of attachments. AXIOM reads in the attachements from the stream only when * user asks by calling getDataHandler(). build() method builds the OM without the attachments. * buildAll() builds the OM together with attachement data. This becomes handy when user wants * to free the input stream. */ public void buildWithAttachments() { if (!this.done) { this.build(); } } /** * This method is intended only to be used by Axiom intenals when merging Objects from different * Axiom implementations to the LLOM implementation. * * @param child */ protected OMNode importNode(OMNode child) { int type = child.getType(); switch (type) { case (OMNode.ELEMENT_NODE): { OMElement childElement = (OMElement) child; OMElement newElement = (new StAXOMBuilder(this.factory, childElement .getXMLStreamReader())).getDocumentElement(); newElement.buildWithAttachments(); return newElement; } case (OMNode.TEXT_NODE): { OMText importedText = (OMText) child; OMText newText; if (importedText.isBinary()) { boolean isOptimize = importedText.isOptimized(); newText = this.factory.createOMText(importedText .getDataHandler(), isOptimize); } else if (importedText.isCharacters()) { newText = this.factory.createOMText(null, importedText .getTextCharacters(), importedText.getType()); } else { newText = this.factory.createOMText(null, importedText .getText()/*, importedText.getOMNodeType()*/); } return newText; } case (OMNode.PI_NODE): { OMProcessingInstruction importedPI = (OMProcessingInstruction) child; return factory.createOMProcessingInstruction(null, importedPI.getTarget(), importedPI.getValue()); } case (OMNode.COMMENT_NODE): { OMComment importedComment = (OMComment) child; return factory.createOMComment(null, importedComment.getValue()); } case (OMNode.DTD_NODE) : { OMDocType importedDocType = (OMDocType) child; return factory.createOMDocType(null, importedDocType.getValue()); } default: { throw new UnsupportedOperationException( "Not Implemented Yet for the given node type"); } } } public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, true); } public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, false); } } ./src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java0000664000175000017500000002302211767656530022136 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMDocumentImplUtil; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.traverse.OMChildrenIterator; import org.apache.axiom.om.impl.traverse.OMChildrenLocalNameIterator; import org.apache.axiom.om.impl.traverse.OMChildrenNamespaceIterator; import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.util.Iterator; /** Class OMDocumentImpl */ public class OMDocumentImpl extends OMSerializableImpl implements OMDocument, OMContainerEx { /** Field documentElement */ protected OMElement documentElement; /** Field firstChild */ protected OMNode firstChild; /** Field lastChild */ protected OMNode lastChild; /** Field charSetEncoding Default : UTF-8 */ protected String charSetEncoding = "UTF-8"; /** Field xmlVersion */ protected String xmlVersion = "1.0"; protected String xmlEncoding; protected String isStandalone; /** * Create a OMDocument given the OMFactory * * @param factory The OMFactory that created this instace */ public OMDocumentImpl(OMFactory factory) { super(factory); this.done = true; } /** * Create the OMDocument with the factory * * @param parserWrapper * @param factory */ public OMDocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) { super(factory); this.builder = parserWrapper; } /** * Create the OMDoucment with the factory and set the given OMElement * as the document element * * @param documentElement * @param parserWrapper * @param factory */ public OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper, OMFactory factory) { super(factory); this.documentElement = documentElement; this.builder = parserWrapper; } public OMXMLParserWrapper getBuilder() { return builder; } /** * Method getDocumentElement. * * @return Returns OMElement. */ public OMElement getOMDocumentElement() { while (documentElement == null && builder != null) { builder.next(); } return documentElement; } /** * Method setDocumentElement. * * @param documentElement */ public void setOMDocumentElement(OMElement documentElement) { this.documentElement = documentElement; } /** * Method setComplete. * * @param state */ public void setComplete(boolean state) { this.done = state; } /** Forces the parser to proceed, if parser has not yet finished with the XML input. */ public void buildNext() { if (builder != null && !builder.isCompleted()) { builder.next(); } } /** * Adds child to the element. One can decide whether to append the child or to add to the front * of the children list. * * @param child */ public void addChild(OMNode child) { if (child instanceof OMElement) { if (this.documentElement == null) { addChild((OMNodeImpl) child); this.documentElement = (OMElement) child; } else { throw new OMException("Document element already exists"); } } else { addChild((OMNodeImpl) child); } } /** * Method addChild. * * @param child */ private void addChild(OMNodeImpl child) { if (firstChild == null) { firstChild = child; child.setPreviousOMSibling(null); } else { child.setPreviousOMSibling(lastChild); ((OMNodeEx) lastChild).setNextOMSibling(child); } child.setNextOMSibling(null); child.setParent(this); lastChild = child; } /** * Returns a collection of this element. Children can be of types OMElement, OMText. * * @return Returns iterator. */ public Iterator getChildren() { return new OMChildrenIterator(getFirstOMChild()); } /** * Searches for children with a given QName and returns an iterator to traverse through the * OMNodes. The QName can contain any combination of prefix, localname and URI. * * @param elementQName * @return Returns Iterator. * @throws org.apache.axiom.om.OMException * */ public Iterator getChildrenWithName(QName elementQName) { return new OMChildrenQNameIterator(getFirstOMChild(), elementQName); } public Iterator getChildrenWithLocalName(String localName) { return new OMChildrenLocalNameIterator(getFirstOMChild(), localName); } public Iterator getChildrenWithNamespaceURI(String uri) { return new OMChildrenNamespaceIterator(getFirstOMChild(), uri); } /** * Method getFirstOMChild. * * @return Returns first om child. */ public OMNode getFirstOMChild() { while ((firstChild == null) && !done) { buildNext(); } return firstChild; } public OMNode getFirstOMChildIfAvailable() { return firstChild; } /** * Method getFirstChildWithName. * * @param elementQName * @return Returns OMElement. * @throws OMException */ public OMElement getFirstChildWithName(QName elementQName) throws OMException { OMChildrenQNameIterator omChildrenQNameIterator = new OMChildrenQNameIterator(getFirstOMChild(), elementQName); OMNode omNode = null; if (omChildrenQNameIterator.hasNext()) { omNode = (OMNode) omChildrenQNameIterator.next(); } return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ? (OMElement) omNode : null; } /** * Method setFirstChild. * * @param firstChild */ public void setFirstChild(OMNode firstChild) { this.firstChild = firstChild; } /** * Forcefully set the last child * @param omNode */ public void setLastChild(OMNode omNode) { this.lastChild = omNode; } public String getCharsetEncoding() { return charSetEncoding; } public void setCharsetEncoding(String charEncoding) { this.charSetEncoding = charEncoding; } public String isStandalone() { return isStandalone; } public void setStandalone(String isStandalone) { this.isStandalone = isStandalone; } public String getXMLVersion() { return xmlVersion; } public void setXMLVersion(String xmlVersion) { this.xmlVersion = xmlVersion; } public String getXMLEncoding() { return xmlEncoding; } public void setXMLEncoding(String encoding) { this.xmlEncoding = encoding; } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { internalSerialize(writer, cache, !((MTOMXMLStreamWriter) writer).isIgnoreXMLDeclaration()); } protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException { OMDocumentImplUtil.internalSerialize(this, writer, cache, includeXMLDeclaration); } /** Serializes the document with the XML declaration. */ public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, false); } /** Serializes the document with cache. */ public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, true); } public XMLStreamReader getXMLStreamReader() { return getXMLStreamReader(true); } public XMLStreamReader getXMLStreamReaderWithoutCaching() { return getXMLStreamReader(false); } public XMLStreamReader getXMLStreamReader(boolean cache) { return OMContainerHelper.getXMLStreamReader(this, cache); } } ./src/org/apache/axiom/om/impl/llom/OMContainerHelper.java0000664000175000017500000000616311767656530022627 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.OMXMLStreamReader; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.OMXMLStreamReaderValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; class OMContainerHelper { private static final Log log = LogFactory.getLog(OMContainerHelper.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); private OMContainerHelper() {} public static XMLStreamReader getXMLStreamReader(OMContainer container, boolean cache) { OMXMLParserWrapper builder = ((OMSerializableImpl)container).builder; if (builder != null && builder instanceof StAXOMBuilder) { if (!container.isComplete()) { if (((StAXOMBuilder) builder).isLookahead()) { container.buildNext(); } } } // The om tree was built by hand and is already complete OMXMLStreamReader reader = null; boolean done = ((OMSerializableImpl)container).done; if ((builder == null) && done) { reader = new OMStAXWrapper(null, container, false); } else { if ((builder == null) && !cache) { throw new UnsupportedOperationException( "This element was not created in a manner to be switched"); } if (builder != null && builder.isCompleted() && !cache && !done) { throw new UnsupportedOperationException( "The parser is already consumed!"); } reader = new OMStAXWrapper(builder, container, cache); } // If debug is enabled, wrap the OMXMLStreamReader in a validator. // The validator will check for mismatched events to help determine if the OMStAXWrapper // is functioning correctly. All problems are reported as debug.log messages if (DEBUG_ENABLED) { reader = new OMXMLStreamReaderValidator(reader, // delegate to actual reader false); // log problems (true will cause exceptions to be thrown) } return reader; } } ./src/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java0000664000175000017500000011127111767656530023302 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.io.OutputStream; import java.io.StringWriter; import java.io.Writer; import java.util.Iterator; /** *

        Element backed by an arbitrary data source. When necessary, this element will be expanded by * creating a parser from the data source.

        *

        *

        Whenever methods are added to the base {@link OMElementImpl} * class the corresponding methods must be added to this class (there's a unit test to verify that * this has been done, just to make sure nothing gets accidentally broken). If the method only * requires the element name and/or namespace information, the base class method can be called * directly. Otherwise, the element must be expanded into a full OM tree (by calling the {@link * #forceExpand()} method) before the base class method is called. This will typically involve a * heavy overhead penalty, so should be avoided if possible.

        */ public class OMSourcedElementImpl extends OMElementImpl implements OMSourcedElement { /** Data source for element data. */ private OMDataSource dataSource; /** Namespace for element, needed in order to bypass base class handling. */ private OMNamespace definedNamespace = null; /** Flag for parser provided to base element class. */ private boolean isExpanded = false; private static Log log = LogFactory.getLog(OMSourcedElementImpl.class); private static final boolean isDebugEnabled = log.isDebugEnabled(); private static Log forceExpandLog = LogFactory.getLog(OMSourcedElementImpl.class.toString()+".forceExpand"); private XMLStreamReader readerFromDS = null; // Reader from DataSource /** * Constructor. * * @param localName * @param ns * @param factory * @param source */ public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory, OMDataSource source) { super(localName, null, factory); dataSource = source; isExpanded = (dataSource == null); if (!isExpanded) { if (!isLossyPrefix(dataSource)) { // Believe the prefix and create a normal OMNamespace definedNamespace = ns; } else { // Create a deferred namespace that forces an expand to get the prefix definedNamespace = new DeferredNamespace(ns.getNamespaceURI()); } } else { definedNamespace = ns; } } /** * Constructor that takes a QName instead of the local name and the namespace seperately * * @param qName * @param factory * @param source */ public OMSourcedElementImpl(QName qName, OMFactory factory, OMDataSource source) { //create a namespace super(qName.getLocalPart(), null, factory); dataSource = source; isExpanded = (dataSource == null); if (!isExpanded) { if (!isLossyPrefix(dataSource)) { // Believe the prefix and create a normal OMNamespace definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix()); } else { // Create a deferred namespace that forces an expand to get the prefix definedNamespace = new DeferredNamespace(qName.getNamespaceURI()); } } else { definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix()); } } public OMSourcedElementImpl(String localName, OMNamespace ns, OMContainer parent, OMFactory factory) { super(localName, null, parent, factory); dataSource = null; definedNamespace = ns; isExpanded = true; if (ns != null) { this.setNamespace(ns); } } public OMSourcedElementImpl(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory) { super(localName, null, parent, builder, factory); dataSource = null; definedNamespace = ns; isExpanded = true; if (ns != null) { this.setNamespace(ns); } } public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory) { super(localName, null, factory); dataSource = null; definedNamespace = ns; isExpanded = true; if (ns != null) { this.setNamespace(ns); } } /** * The namespace uri is immutable, but the OMDataSource may change * the value of the prefix. This method queries the OMDataSource to * see if the prefix is known. * @param source * @return true or false */ private boolean isLossyPrefix(OMDataSource source) { Object lossyPrefix = null; if (source instanceof OMDataSourceExt) { lossyPrefix = ((OMDataSourceExt) source).getProperty(OMDataSourceExt.LOSSY_PREFIX); } return lossyPrefix == Boolean.TRUE; } private void setDeferredNamespace(OMDataSource source, String uri, String prefix) { Object lossyPrefix = null; if (source instanceof OMDataSourceExt) { lossyPrefix = ((OMDataSourceExt) source).getProperty(OMDataSourceExt.LOSSY_PREFIX); } if (lossyPrefix != Boolean.TRUE) { // Believe the prefix and create a normal OMNamespace definedNamespace = new OMNamespaceImpl(uri, prefix); } else { // Create a deferred namespace that forces an expand to get the prefix definedNamespace = new DeferredNamespace(uri); } } /** * Generate element name for output. * * @return name */ private String getPrintableName() { String uri = null; if (getNamespace() != null) { uri = getNamespace().getNamespaceURI(); } if (uri == null || uri.length() == 0) { return getLocalName(); } else { return "{" + uri + '}' + getLocalName(); } } /** * Get parser from data source. Note that getDataReader may consume the underlying data source. * * @return parser */ private XMLStreamReader getDirectReader() { try { // If expansion has occurred, then the reader from the datasource is consumed or stale. // In such cases use the stream reader from the OMElementImpl if (isExpanded()) { return super.getXMLStreamReader(); } else { return dataSource.getReader(); } } catch (XMLStreamException e) { log.error("Could not get parser from data source for element " + getPrintableName(), e); throw new RuntimeException("Error obtaining parser from data source:" + e.getMessage()); } } /** * Set parser for OM, if not previously set. Since the builder is what actually constructs the * tree on demand, this first creates a builder */ private void forceExpand() { if (!isExpanded) { if (isDebugEnabled) { log.debug("forceExpand: expanding element " + getPrintableName()); if(forceExpandLog.isDebugEnabled()){ // When using an OMSourcedElement, it can be particularly difficult to // determine why an expand occurs... a stack trace should help debugging this Exception e = new Exception("Debug Stack Trace"); forceExpandLog.debug("forceExpand stack", e); } } // Get the XMLStreamReader readerFromDS = getDirectReader(); // Advance past the START_DOCUMENT to the start tag. // Remember the character encoding. String characterEncoding = readerFromDS.getCharacterEncodingScheme(); if (characterEncoding != null) { characterEncoding = readerFromDS.getEncoding(); } try { if (readerFromDS.getEventType() != XMLStreamConstants.START_ELEMENT) { while (readerFromDS.next() != XMLStreamConstants.START_ELEMENT) ; } } catch (XMLStreamException e) { log.error("forceExpand: error parsing data soruce document for element " + getLocalName(), e); throw new RuntimeException("Error parsing data source document:" + e.getMessage()); } // Make sure element local name and namespace matches what was expected if (!readerFromDS.getLocalName().equals(getLocalName())) { log.error("forceExpand: expected element name " + getLocalName() + ", found " + readerFromDS.getLocalName()); throw new RuntimeException("Element name from data source is " + readerFromDS.getLocalName() + ", not the expected " + getLocalName()); } String readerURI = readerFromDS.getNamespaceURI(); readerURI = (readerURI == null) ? "" : readerURI; String uri = (getNamespace() == null) ? "" : ((getNamespace().getNamespaceURI() == null) ? "" : getNamespace().getNamespaceURI()); if (!readerURI.equals(uri)) { log.error("forceExpand: expected element namespace " + getLocalName() + ", found " + uri); throw new RuntimeException("Element namespace from data source is " + readerURI + ", not the expected " + uri); } // Get the current prefix and the reader's prefix String readerPrefix = readerFromDS.getPrefix(); readerPrefix = (readerPrefix == null) ? "" : readerPrefix; String prefix = null; OMNamespace ns = getNamespace(); if (ns == null || ns instanceof DeferredNamespace) { // prefix is not available until after expansion } else { prefix = ns.getPrefix(); } // Set the builder for this element isExpanded = true; super.setBuilder(new StAXOMBuilder(getOMFactory(), readerFromDS, this, characterEncoding)); setComplete(false); // Update the prefix if necessary. This must be done after // isParserSet to avoid a recursive call if (!readerPrefix.equals(prefix) || getNamespace() == null || ns instanceof DeferredNamespace) { if (log.isDebugEnabled()) { log.debug( "forceExpand: changing prefix from " + prefix + " to " + readerPrefix); } setNamespace(new OMNamespaceImpl(readerURI, readerPrefix)); } } } /** * Check if element has been expanded into tree. * * @return true if expanded, false if not */ public boolean isExpanded() { return isExpanded; } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getChildElements() */ public Iterator getChildElements() { forceExpand(); return super.getChildElements(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#declareNamespace(java.lang.String, java.lang.String) */ public OMNamespace declareNamespace(String uri, String prefix) { forceExpand(); return super.declareNamespace(uri, prefix); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#declareDefaultNamespace(java.lang.String) */ public OMNamespace declareDefaultNamespace(String uri) { forceExpand(); return super.declareDefaultNamespace(uri); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getDefaultNamespace() */ public OMNamespace getDefaultNamespace() { forceExpand(); return super.getDefaultNamespace(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#declareNamespace(org.apache.axiom.om.OMNamespace) */ public OMNamespace declareNamespace(OMNamespace namespace) { forceExpand(); return super.declareNamespace(namespace); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#findNamespace(java.lang.String, java.lang.String) */ public OMNamespace findNamespace(String uri, String prefix) { forceExpand(); return super.findNamespace(uri, prefix); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#findNamespaceURI(java.lang.String) */ public OMNamespace findNamespaceURI(String prefix) { forceExpand(); return super.findNamespaceURI(prefix); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getAllDeclaredNamespaces() */ public Iterator getAllDeclaredNamespaces() throws OMException { forceExpand(); return super.getAllDeclaredNamespaces(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getAllAttributes() */ public Iterator getAllAttributes() { forceExpand(); return super.getAllAttributes(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getAttribute(javax.xml.namespace.QName) */ public OMAttribute getAttribute(QName qname) { forceExpand(); return super.getAttribute(qname); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getAttributeValue(javax.xml.namespace.QName) */ public String getAttributeValue(QName qname) { forceExpand(); return super.getAttributeValue(qname); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#addAttribute(org.apache.axiom.om.OMAttribute) */ public OMAttribute addAttribute(OMAttribute attr) { forceExpand(); return super.addAttribute(attr); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#addAttribute(java.lang.String, * java.lang.String, org.apache.axiom.om.OMNamespace) */ public OMAttribute addAttribute(String attributeName, String value, OMNamespace namespace) { forceExpand(); return super.addAttribute(attributeName, value, namespace); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#removeAttribute(org.apache.axiom.om.OMAttribute) */ public void removeAttribute(OMAttribute attr) { forceExpand(); super.removeAttribute(attr); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setBuilder(org.apache.axiom.om.OMXMLParserWrapper) */ public void setBuilder(OMXMLParserWrapper wrapper) { throw new UnsupportedOperationException( "Builder cannot be set for element backed by data source"); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getBuilder() */ public OMXMLParserWrapper getBuilder() { forceExpand(); return super.getBuilder(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setFirstChild(org.apache.axiom.om.OMNode) */ public void setFirstChild(OMNode node) { forceExpand(); super.setFirstChild(node); } public void setLastChild(OMNode omNode) { forceExpand(); super.setLastChild(omNode); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getFirstElement() */ public OMElement getFirstElement() { forceExpand(); return super.getFirstElement(); } public XMLStreamReader getXMLStreamReader(boolean cache) { if (isDebugEnabled) { log.debug("getting XMLStreamReader for " + getPrintableName() + " with cache=" + cache); } if (isExpanded) { return super.getXMLStreamReader(cache); } else { if (cache && isDestructiveRead()) { forceExpand(); return super.getXMLStreamReader(); } return getDirectReader(); } } public XMLStreamReader getXMLStreamReader() { return getXMLStreamReader(true); } public XMLStreamReader getXMLStreamReaderWithoutCaching() { return getXMLStreamReader(false); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setText(java.lang.String) */ public void setText(String text) { forceExpand(); super.setText(text); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setText(javax.xml.namespace.QName) */ public void setText(QName text) { forceExpand(); super.setText(text); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getText() */ public String getText() { forceExpand(); return super.getText(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getTextAsQName() */ public QName getTextAsQName() { forceExpand(); return super.getTextAsQName(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getLocalName() */ public String getLocalName() { // no need to set the parser, just call base method directly return super.getLocalName(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setLocalName(java.lang.String) */ public void setLocalName(String localName) { // no need to expand the tree, just call base method directly super.setLocalName(localName); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getNamespace() */ public OMNamespace getNamespace() throws OMException { if (isExpanded()) { return super.getNamespace(); } return definedNamespace; } public String getNamespaceURI() { return super.getNamespaceURI(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setNamespace(org.apache.axiom.om.OMNamespace) */ public void setNamespace(OMNamespace namespace) { forceExpand(); super.setNamespace(namespace); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement# * setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace) */ public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) { forceExpand(); super.setNamespaceWithNoFindInCurrentScope(namespace); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getQName() */ public QName getQName() { if (isExpanded()) { return super.getQName(); } else if (getNamespace() != null) { // always ignore prefix on name from sourced element return new QName(getNamespace().getNamespaceURI(), getLocalName()); } else { return new QName(getLocalName()); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#toStringWithConsume() */ public String toStringWithConsume() throws XMLStreamException { if (isExpanded()) { return super.toStringWithConsume(); } else { StringWriter writer = new StringWriter(); XMLStreamWriter writer2 = StAXUtils.createXMLStreamWriter(writer); dataSource.serialize(writer2); // dataSource.serialize consumes the data writer2.flush(); return writer.toString(); } } private boolean isDestructiveWrite() { if (dataSource instanceof OMDataSourceExt) { return ((OMDataSourceExt) dataSource).isDestructiveWrite(); } else { return true; } } private boolean isDestructiveRead() { if (dataSource instanceof OMDataSourceExt) { return ((OMDataSourceExt) dataSource).isDestructiveRead(); } else { return false; } } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#resolveQName(java.lang.String) */ public QName resolveQName(String qname) { forceExpand(); return super.resolveQName(qname); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#cloneOMElement() */ public OMElement cloneOMElement() { forceExpand(); return super.cloneOMElement(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#setLineNumber(int) */ public void setLineNumber(int lineNumber) { // no need to expand the tree, just call base method directly super.setLineNumber(lineNumber); } /* (non-Javadoc) * @see org.apache.axiom.om.OMElement#getLineNumber() */ public int getLineNumber() { // no need to expand the tree, just call base method directly return super.getLineNumber(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#discard() */ public void discard() throws OMException { // discard without expanding the tree setComplete(true); super.detach(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#getType() */ public int getType() { // no need to expand the tree, just call base method directly return super.getType(); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (isExpanded()) { super.internalSerialize(writer, cache); } else if (cache) { if (isDestructiveWrite()) { forceExpand(); super.internalSerialize(writer, true); } else { dataSource.serialize(writer); } } else { dataSource.serialize(writer); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serialize(javax.xml.stream.XMLStreamWriter) */ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { // The contract is to serialize with caching internalSerialize(xmlWriter, true); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serialize(java.io.OutputStream) */ public void serialize(OutputStream output) throws XMLStreamException { OMOutputFormat format = new OMOutputFormat(); serialize(output, format); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serialize(java.io.Writer) */ public void serialize(Writer writer) throws XMLStreamException { OMOutputFormat format = new OMOutputFormat(); serialize(writer, format); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode# * serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat) */ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { if (isExpanded) { super.serialize(output, format); } else if (isDestructiveWrite()) { forceExpand(); super.serialize(output, format); } else { dataSource.serialize(output, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode# * serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat) */ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { if (isExpanded) { super.serialize(writer, format); } else if (isDestructiveWrite()) { forceExpand(); super.serialize(writer, format); } else { dataSource.serialize(writer, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serializeAndConsume(javax.xml.stream.XMLStreamWriter) */ public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter) throws XMLStreamException { internalSerialize(xmlWriter, false); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.OutputStream) */ public void serializeAndConsume(OutputStream output) throws XMLStreamException { if (isDebugEnabled) { log.debug("serialize " + getPrintableName() + " to output stream"); } OMOutputFormat format = new OMOutputFormat(); if (isExpanded()) { super.serializeAndConsume(output, format); } else { dataSource.serialize(output, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.Writer) */ public void serializeAndConsume(Writer writer) throws XMLStreamException { if (isDebugEnabled) { log.debug("serialize " + getPrintableName() + " to writer"); } if (isExpanded()) { super.serializeAndConsume(writer); } else { OMOutputFormat format = new OMOutputFormat(); dataSource.serialize(writer, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode# * serializeAndConsume(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat) */ public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException { if (isDebugEnabled) { log.debug("serialize formatted " + getPrintableName() + " to output stream"); } if (isExpanded()) { super.serializeAndConsume(output, format); } else { dataSource.serialize(output, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode# * serializeAndConsume(java.io.Writer, org.apache.axiom.om.OMOutputFormat) */ public void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException { if (isDebugEnabled) { log.debug("serialize formatted " + getPrintableName() + " to writer"); } if (isExpanded()) { super.serializeAndConsume(writer, format); } else { dataSource.serialize(writer, format); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#addChild(org.apache.axiom.om.OMNode) */ public void addChild(OMNode omNode) { forceExpand(); super.addChild(omNode); } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#getChildrenWithName(javax.xml.namespace.QName) */ public Iterator getChildrenWithName(QName elementQName) { forceExpand(); return super.getChildrenWithName(elementQName); } public Iterator getChildrenWithLocalName(String localName) { forceExpand(); return super.getChildrenWithLocalName(localName); } public Iterator getChildrenWithNamespaceURI(String uri) { forceExpand(); return super.getChildrenWithNamespaceURI(uri); } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#getFirstChildWithName(javax.xml.namespace.QName) */ public OMElement getFirstChildWithName(QName elementQName) throws OMException { forceExpand(); return super.getFirstChildWithName(elementQName); } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#getChildren() */ public Iterator getChildren() { forceExpand(); return super.getChildren(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#getFirstOMChild() */ public OMNode getFirstOMChild() { forceExpand(); return super.getFirstOMChild(); } public OMNode getFirstOMChildIfAvailable() { return super.getFirstOMChildIfAvailable(); } /* (non-Javadoc) * @see org.apache.axiom.om.OMContainer#buildNext() */ public void buildNext() { forceExpand(); super.buildNext(); } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#detach() */ public OMNode detach() throws OMException { // detach without expanding the tree boolean complete = isComplete(); setComplete(true); OMNode result = super.detach(); setComplete(complete); return result; } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#getNextOMSibling() */ public OMNode getNextOMSibling() throws OMException { // no need to expand the tree, just call base method directly return super.getNextOMSibling(); } public OMNode getNextOMSiblingIfAvailable() { return super.getNextOMSiblingIfAvailable(); } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#getTrimmedText() */ public String getTrimmedText() { forceExpand(); return super.getTrimmedText(); } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#handleNamespace(javax.xml.namespace.QName) */ OMNamespace handleNamespace(QName qname) { forceExpand(); return super.handleNamespace(qname); } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#isComplete() */ public boolean isComplete() { if (isExpanded) { return super.isComplete(); } else { return true; } } /* (non-Javadoc) * @see org.apache.axiom.om.impl.llom.OMElementImpl#toString() */ public String toString() { if (isExpanded) { return super.toString(); } else if (isDestructiveWrite()) { forceExpand(); return super.toString(); } else { try { StringWriter writer = new StringWriter(); OMOutputFormat format = new OMOutputFormat(); dataSource.serialize(writer, format); String text = writer.toString(); writer.close(); return text; } catch (XMLStreamException e) { throw new RuntimeException("Cannot serialize OM Element " + this.getLocalName(), e); } catch (IOException e) { throw new RuntimeException("Cannot serialize OM Element " + this.getLocalName(), e); } } } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#buildAll() */ public void buildWithAttachments() { // If not done, force the parser to build the elements if (!done) { this.build(); } // If the OMSourcedElement is in in expanded form, then // walk the descendents to make sure they are built. // If the OMSourcedElement is backed by a OMDataSource, // we don't want to walk the children (because this will result // in an unnecessary translation from OMDataSource to a full OM tree). if (isExpanded()) { Iterator iterator = getChildren(); while (iterator.hasNext()) { OMNode node = (OMNode) iterator.next(); node.buildWithAttachments(); } } } public void build() throws OMException { super.build(); } protected void notifyChildComplete() { super.notifyChildComplete(); } OMNamespace handleNamespace(String namespaceURI, String prefix) { return super.handleNamespace(namespaceURI, prefix); } /** * Provide access to the data source encapsulated in OMSourcedElement. * This is usesful when we want to access the raw data in the data source. * * @return the internal datasource */ public OMDataSource getDataSource() { return dataSource; } /** * setOMDataSource */ public OMDataSource setDataSource(OMDataSource dataSource) { if (!isExpanded()) { OMDataSource oldDS = this.dataSource; this.dataSource = dataSource; return oldDS; // Caller is responsible for closing the data source } else { // TODO // Remove the entire subtree and replace with // new datasource. There maybe a more performant way to do this. OMDataSource oldDS = this.dataSource; Iterator it = getChildren(); while(it.hasNext()) { it.next(); it.remove(); } this.dataSource = dataSource; setComplete(false); isExpanded = false; super.setBuilder(null); if (isLossyPrefix(dataSource)) { // Create a deferred namespace that forces an expand to get the prefix definedNamespace = new DeferredNamespace(definedNamespace.getNamespaceURI()); } return oldDS; } } /** * setComplete override The OMSourcedElement has its own isolated builder/reader during the * expansion process. Thus calls to setCompete should stop here and not propogate up to the * parent (which may have a different builder or no builder). */ public void setComplete(boolean value) { done = value; if (done == true) { if (readerFromDS != null) { try { readerFromDS.close(); } catch (XMLStreamException e) { } readerFromDS = null; } if (dataSource != null) { if (dataSource instanceof OMDataSourceExt) { ((OMDataSourceExt)dataSource).close(); } dataSource = null; } } if (done == true && readerFromDS != null) { try { readerFromDS.close(); } catch (XMLStreamException e) { } readerFromDS = null; } } class DeferredNamespace implements OMNamespace { final String uri; DeferredNamespace(String ns) { this.uri = ns; } public boolean equals(String uri, String prefix) { String thisPrefix = getPrefix(); return (this.uri.equals(uri) && (thisPrefix == null ? prefix == null : thisPrefix.equals(prefix))); } public String getName() { return uri; } public String getNamespaceURI() { return uri; } public String getPrefix() { if (!isExpanded()) { forceExpand(); } return getNamespace().getPrefix(); } public int hashCode() { String thisPrefix = getPrefix(); return uri.hashCode() ^ (thisPrefix != null ? thisPrefix.hashCode() : 0); } public boolean equals(Object obj) { if (!(obj instanceof OMNamespace)) { return false; } OMNamespace other = (OMNamespace)obj; String otherPrefix = other.getPrefix(); String thisPrefix = getPrefix(); return (uri.equals(other.getNamespaceURI()) && (thisPrefix == null ? otherPrefix == null : thisPrefix.equals(otherPrefix))); } } } ./src/org/apache/axiom/om/impl/llom/factory/0000775000175000017500000000000011767656530020107 5ustar brianbrian./src/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java0000664000175000017500000002426611767656530025434 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.factory; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMMetaFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.llom.OMAttributeImpl; import org.apache.axiom.om.impl.llom.OMCommentImpl; import org.apache.axiom.om.impl.llom.OMDocTypeImpl; import org.apache.axiom.om.impl.llom.OMDocumentImpl; import org.apache.axiom.om.impl.llom.OMElementImpl; import org.apache.axiom.om.impl.llom.OMProcessingInstructionImpl; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; import org.apache.axiom.om.impl.llom.OMTextImpl; import javax.xml.namespace.QName; /** Class OMLinkedListImplFactory */ public class OMLinkedListImplFactory implements OMFactory { private final OMLinkedListMetaFactory metaFactory; public OMLinkedListImplFactory(OMLinkedListMetaFactory metaFactory) { this.metaFactory = metaFactory; } public OMLinkedListImplFactory() { this(new OMLinkedListMetaFactory()); } public OMMetaFactory getMetaFactory() { return metaFactory; } /** * Method createOMElement. * * @param localName * @param ns * @return Returns OMElement. */ public OMElement createOMElement(String localName, OMNamespace ns) { return new OMElementImpl(localName, ns, this); } public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) { return new OMElementImpl(localName, ns, parent, this); } /** * Method createOMElement. * * @param localName * @param ns * @param parent * @param builder * @return Returns OMElement. */ public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder) { return new OMElementImpl(localName, ns, parent, builder, this); } public OMElement createOMElement(String localName, String namespaceURI, String prefix) { if (namespaceURI == null) { throw new IllegalArgumentException("namespaceURI must not be null"); } else if (namespaceURI.length() == 0) { return createOMElement(localName, null); } else { return createOMElement(localName, createOMNamespace(namespaceURI, prefix)); } } /** * Create an OMElement with the given QName under the given parent. * * If the QName contains a prefix, we will ensure that an OMNamespace is created * mapping the given namespace to the given prefix. If no prefix is passed, we'll * use whatever's already mapped in the parent, or create a generated one. * * @param qname the QName of the element to create * @param parent the OMContainer in which to place the new element * @return Returns the new OMElement * @throws OMException if there's a namespace mapping problem */ public OMElement createOMElement(QName qname, OMContainer parent) throws OMException { return new OMElementImpl(qname, parent, this); } /** * Create an OMElement with the given QName *

        * If the QName contains a prefix, we will ensure that an OMNamespace is created mapping the * given namespace to the given prefix. If no prefix is passed, we'll use whatever's already * mapped in the parent, or create a generated one. * * @param qname * @return the new OMElement. */ public OMElement createOMElement(QName qname) throws OMException { return new OMElementImpl(qname, null, this); } /** * Construct element with arbitrary data source. * * @param source * @param localName * @param ns */ public OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns) { return new OMSourcedElementImpl(localName, ns, this, source); } /** * Construct element with arbitrary data source. * * @param source the data source * @param qname the name of the element produced by the data source */ public OMSourcedElement createOMElement(OMDataSource source, QName qname) { return new OMSourcedElementImpl(qname, this, source); } /** * Method createOMNamespace. * * @param uri * @param prefix * @return Returns OMNamespace. */ public OMNamespace createOMNamespace(String uri, String prefix) { return new OMNamespaceImpl(uri, prefix); } /** * Method createOMText. * * @param parent * @param text * @return Returns OMText. */ public OMText createOMText(OMContainer parent, String text) { return new OMTextImpl(parent, text, this); } public OMText createOMText(OMContainer parent, QName text) { return new OMTextImpl(parent, text, this); } public OMText createOMText(OMContainer parent, String text, int type) { return new OMTextImpl(parent, text, type, this); } public OMText createOMText(OMContainer parent, char[] charArary, int type) { return new OMTextImpl(parent, charArary, type, this); } public OMText createOMText(OMContainer parent, QName text, int type) { return new OMTextImpl(parent, text, type, this); } /** * Method createOMText. * * @param s * @return Returns OMText. */ public OMText createOMText(String s) { return new OMTextImpl(s, this); } public OMText createOMText(String s, int type) { return new OMTextImpl(s, type, this); } /** * Creates text. * * @param s * @param mimeType * @param optimize * @return Returns OMText. */ public OMText createOMText(String s, String mimeType, boolean optimize) { return new OMTextImpl(s, mimeType, optimize, this); } /** * Creates text. * * @param dataHandler * @param optimize * @return Returns OMText. */ public OMText createOMText(Object dataHandler, boolean optimize) { return new OMTextImpl(dataHandler, optimize, this); } public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize) { return new OMTextImpl(contentID, dataHandlerProvider, optimize, this); } public OMText createOMText(String contentID, OMContainer parent, OMXMLParserWrapper builder) { return new OMTextImpl(contentID, parent, builder, this); } public OMText createOMText(OMContainer parent, OMText source) { return new OMTextImpl(parent, (OMTextImpl) source, this); } /** * Creates text. * * @param parent * @param s * @param mimeType * @param optimize * @return Returns OMText. */ public OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize) { return new OMTextImpl(parent, s, mimeType, optimize, this); } /** * Creates attribute. * * @param localName * @param ns * @param value * @return Returns OMAttribute. */ public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value) { return new OMAttributeImpl(localName, ns, value, this); } /** * Creates DocType/DTD. * * @param parent * @param content * @return Returns doctype. */ public OMDocType createOMDocType(OMContainer parent, String content) { return new OMDocTypeImpl(parent, content, this); } /** * Creates a PI. * * @param parent * @param piTarget * @param piData * @return Returns OMProcessingInstruction. */ public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) { return new OMProcessingInstructionImpl(parent, piTarget, piData, this); } /** * Creates a comment. * * @param parent * @param content * @return Returns OMComment. */ public OMComment createOMComment(OMContainer parent, String content) { return new OMCommentImpl(parent, content, this); } /* (non-Javadoc) * @see org.apache.axiom.om.OMFactory#createOMDocument() */ public OMDocument createOMDocument() { return new OMDocumentImpl(this); } /* (non-Javadoc) * @see org.apache.axiom.om.OMFactory#createOMDocument(org.apache.axiom.om.OMXMLParserWrapper) */ public OMDocument createOMDocument(OMXMLParserWrapper builder) { return new OMDocumentImpl(builder, this); } } ./src/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java0000664000175000017500000000407511767656530025415 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.factory; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.AbstractOMMetaFactory; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory; import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory; /** * Meta factory for the linked list OM implementation. *

        * Since all OM factories for LLOM are stateless, {@link #getOMFactory()}, * {@link #getSOAP11Factory()} and {@link #getSOAP12Factory()} will return the * same instance on every invocation. * * @scr.component name="metafactory.llom.component" immediate="true" * @scr.service interface="org.apache.axiom.om.OMMetaFactory" * @scr.property name="implementationName" type="String" value="llom" */ public class OMLinkedListMetaFactory extends AbstractOMMetaFactory { private final OMFactory omFactory = new OMLinkedListImplFactory(this); private final SOAPFactory soap11Factory = new SOAP11Factory(this); private final SOAPFactory soap12Factory = new SOAP12Factory(this); public OMFactory getOMFactory() { return omFactory; } public SOAPFactory getSOAP11Factory() { return soap11Factory; } public SOAPFactory getSOAP12Factory() { return soap12Factory; } } ./src/org/apache/axiom/om/impl/llom/factory/OMXMLBuilderFactory.java0000664000175000017500000000470511767656530024513 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom.factory; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import javax.xml.stream.XMLStreamReader; /** * Class OMXMLBuilderFactory * * @deprecated This class is deprecated because it is located in the wrong package and JAR * (it is implementation independent but belongs to LLOM). Please use * {@link org.apache.axiom.om.OMXMLBuilderFactory} instead. */ public class OMXMLBuilderFactory { /** Field PARSER_XPP */ public static final String PARSER_XPP = "XPP"; /** Field PARSER_STAX */ public static final String PARSER_STAX = "StAX"; /** Field MODEL_SOAP_SPECIFIC */ public static final String MODEL_SOAP_SPECIFIC = "SOAP_SPECIFIC"; /** Field MODEL_OM */ public static final String MODEL_OM = "OM_ONLY"; /** * Method createStAXSOAPModelBuilder. * * @param soapFactory * @param parser * @return Returns StAXSOAPModelBuilder. */ public static StAXSOAPModelBuilder createStAXSOAPModelBuilder( SOAPFactory soapFactory, XMLStreamReader parser) { return new StAXSOAPModelBuilder(parser, soapFactory, null); } /** * Method createStAXOMBuilder. * * @param ombuilderFactory * @param parser * @return Returns StAXOMBuilder. */ public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) { return new StAXOMBuilder(ombuilderFactory, parser); } } ./src/org/apache/axiom/om/impl/llom/OMAttributeImpl.java0000664000175000017500000001450611767656530022332 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMElement; import javax.xml.namespace.QName; /** Class OMAttributeImpl */ public class OMAttributeImpl implements OMAttribute { /** Field localName */ private String localName; /** Field value */ private String value; /** Field type */ private String type; /** Field namespace */ private OMNamespace namespace; private QName qName; /** OMFactory that created this OMAttribute */ private OMFactory factory; // Keep track of the owner of the attribute protected OMElement owner; /** * Constructor OMAttributeImpl. * * @param localName * @param ns * @param value */ public OMAttributeImpl(String localName, OMNamespace ns, String value, OMFactory factory) { if (localName == null || localName.trim().length() == 0) throw new IllegalArgumentException("Local name may not be null or empty"); this.localName = localName; this.value = value; this.namespace = ns; this.type = OMConstants.XMLATTRTYPE_CDATA; this.factory = factory; } /** @return Returns QName. */ public QName getQName() { if (qName != null) { return qName; } if (namespace != null) { // Guard against QName implementation sillyness. if (namespace.getPrefix() == null) { this.qName = new QName(namespace.getNamespaceURI(), localName); } else { this.qName = new QName(namespace.getNamespaceURI(), localName, namespace.getPrefix()); } } else { this.qName = new QName(localName); } return this.qName; } // -------- Getters and Setters /** * Method getLocalName. * * @return Returns local name. */ public String getLocalName() { return localName; } /** * Method setLocalName. * * @param localName */ public void setLocalName(String localName) { if (localName == null || localName.trim().length() == 0) throw new IllegalArgumentException("Local name may not be null or empty"); this.localName = localName; this.qName = null; } /** * Method getAttributeValue. * * @return Returns value. */ public String getAttributeValue() { return value; } /** * Method setAttributeValue. * * @param value */ public void setAttributeValue(String value) { this.value = value; } /** * Method getAttributeType. * * @return Returns type. */ public String getAttributeType() { return type; } /** * Method setAttributeType. * * @param type */ public void setAttributeType(String type) { this.type = type; } /** * Method setOMNamespace. * * @param omNamespace */ public void setOMNamespace(OMNamespace omNamespace) { this.namespace = omNamespace; this.qName = null; } /** * Method getNamespace. * * @return Returns namespace. */ public OMNamespace getNamespace() { return namespace; } public OMFactory getOMFactory() { return this.factory; } /** * Returns the owner element of this attribute * @return OMElement - the owner element */ public OMElement getOwner() { return owner; } /** * Checks for the equality of two OMAttribute instances. Thus the object to compare * this with may be an instance of OMAttributeImpl (an instance of this class) or * an instance of AttrImpl. The method returns false for any object of type other * than OMAttribute. * *

        We check for the equality of namespaces first (note that if the namespace of this instance is null * then for the obj to be equal its namespace must also be null). This condition solely * doesn't determine the equality. So we check for the equality of names and values (note that the value * can also be null in which case the same argument holds as that for the namespace) of the two instances. * If all three conditions are met then we say the two instances are equal. * * Note: We ignore the owner when checking for the equality. This is simply because the owner is * introduced just to keep things simple for the programmer and not as part of an attribute itself. * * @param obj The object to compare with this instance. * @return True if obj is equal to this or else false. */ public boolean equals(Object obj) { if (! (obj instanceof OMAttribute)) return false; OMAttribute other = (OMAttribute)obj; //first check namespace then localName then value to improve performance return (namespace == null ? other.getNamespace() == null : namespace.equals(other.getNamespace()) && localName.equals(other.getLocalName()) && (value == null ? other.getAttributeValue() == null : value.equals(other.getAttributeValue()))); } public int hashCode() { return localName.hashCode() ^ (value != null ? value.hashCode() : 0) ^ (namespace != null ? namespace.hashCode() : 0); } } ./src/org/apache/axiom/om/impl/llom/OMNavigator.java0000664000175000017500000000240111767656530021466 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.llom; import org.apache.axiom.om.OMNode; /** * Empty subclass of {@link org.apache.axiom.om.impl.OMNavigator} to keep compatibility * with existing code. */ public class OMNavigator extends org.apache.axiom.om.impl.OMNavigator { /** Constructor OMNavigator. */ public OMNavigator() { } /** * Constructor OMNavigator. * * @param node */ public OMNavigator(OMNode node) { super(node); } } ./src/org/apache/axiom/om/impl/OptimizationPolicyImpl.java0000664000175000017500000000651711767656530023041 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import javax.activation.DataHandler; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.util.stax.xop.OptimizationPolicy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * {@link OptimizationPolicy} implementation that takes a decision based on the * settings in {@link OMOutputFormat}. *

        * For internal use only. */ class OptimizationPolicyImpl implements OptimizationPolicy { private static Log log = LogFactory.getLog(OptimizationPolicyImpl.class); private static boolean isDebugEnabled = log.isDebugEnabled(); private final OMOutputFormat format; public OptimizationPolicyImpl(OMOutputFormat format) { this.format = format; } private final static int UNSUPPORTED = -1; private final static int EXCEED_LIMIT = 1; public boolean isOptimized(DataHandler dataHandler, boolean optimize) { if (!optimize) { return false; } // TODO: this needs review and cleanup // ** START ** code from MTOMXMLStreamWriter#isOptimizedThreshold if(isDebugEnabled){ log.debug("Start MTOMXMLStreamWriter.isOptimizedThreshold()"); } int optimized = UNSUPPORTED; if(dataHandler!=null){ if(isDebugEnabled){ log.debug("DataHandler fetched, starting optimized Threshold processing"); } optimized= BufferUtils.doesDataHandlerExceedLimit(dataHandler, format.getOptimizedThreshold()); } if(optimized == UNSUPPORTED || optimized == EXCEED_LIMIT){ if(log.isDebugEnabled()){ log.debug("node should be added to binart NodeList for optimization"); } return true; } return false; // ** END ** code from MTOMXMLStreamWriter#isOptimizedThreshold } public boolean isOptimized(DataHandlerProvider dataHandlerProvider, boolean optimize) throws IOException { if (!optimize) { return false; } else { // TODO: this is suboptimal because it forces loading of the data handler; // note that it is strictly the same logic as was applied in the old // MTOMXMLStreamWriter#isOptimizedThreshold method return isOptimized(dataHandlerProvider.getDataHandler(), optimize); } } } ./src/org/apache/axiom/om/impl/jaxp/0000775000175000017500000000000011767656530016437 5ustar brianbrian./src/org/apache/axiom/om/impl/jaxp/OMResult.java0000664000175000017500000000355411767656530021023 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.jaxp; import javax.xml.transform.sax.SAXResult; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.builder.SAXOMBuilder; /** * Implementation of {@link javax.xml.transform.Result} for AXIOM. * The implementation is based on {@link SAXResult} and transforms the stream * of SAX events to an AXIOM tree using {@link SAXOMBuilder}. *

        * Note that building {@link org.apache.axiom.om.OMDocType} nodes from DTD information is * not supported. */ public class OMResult extends SAXResult { private final SAXOMBuilder builder; public OMResult(OMFactory omFactory) { builder = new SAXOMBuilder(omFactory); setHandler(builder); } public OMResult() { this(OMAbstractFactory.getOMFactory()); } public OMDocument getDocument() { return builder.getDocument(); } public OMElement getRootElement() { return builder.getRootElement(); } } ./src/org/apache/axiom/om/impl/jaxp/OMSource.java0000664000175000017500000000273511767656530021005 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.jaxp; import javax.xml.transform.sax.SAXSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.serialize.OMXMLReader; import org.xml.sax.InputSource; /** * Implementation of {@link javax.xml.transform.Source} for AXIOM. * The implementation is based on {@link SAXSource} and directly transforms an AXIOM * tree into a stream of SAX events using {@link OMXMLReader}. *

        * Note that {@link org.apache.axiom.om.OMDocType} nodes are not supported and will be * silently skipped. */ public class OMSource extends SAXSource { public OMSource(OMElement element) { super(new OMXMLReader(element), new InputSource()); } } ./src/org/apache/axiom/om/impl/util/0000775000175000017500000000000011767656530016452 5ustar brianbrian./src/org/apache/axiom/om/impl/util/OMSerializerUtil.java0000664000175000017500000007521511767656530022532 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.CommonUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.ArrayList; import java.util.Iterator; public class OMSerializerUtil { private static Log log = LogFactory.getLog(OMSerializerUtil.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); private static boolean ADV_DEBUG_ENABLED = true; static long nsCounter = 0; private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance"; private static final String XSI_LOCAL_NAME = "type"; /** * Method serializeEndpart. * * @param writer * @throws javax.xml.stream.XMLStreamException * */ public static void serializeEndpart(XMLStreamWriter writer) throws XMLStreamException { writer.writeEndElement(); } /** * Method serializeAttribute. * * @param attr * @param writer * @throws XMLStreamException * @deprecated use serializeStartpart instead */ public static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer) throws XMLStreamException { // first check whether the attribute is associated with a namespace OMNamespace ns = attr.getNamespace(); String prefix = null; String namespaceName = null; if (ns != null) { // add the prefix if it's availble prefix = ns.getPrefix(); namespaceName = ns.getNamespaceURI(); if (prefix != null) { writer.writeAttribute(prefix, namespaceName, attr.getLocalName(), attr.getAttributeValue()); } else { writer.writeAttribute(namespaceName, attr.getLocalName(), attr.getAttributeValue()); } } else { String localName = attr.getLocalName(); String attributeValue = attr.getAttributeValue(); writer.writeAttribute(localName, attributeValue); } } /** * Method serializeNamespace. * * @param namespace * @param writer * @throws XMLStreamException * @deprecated Use serializeStartpart instead */ public static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer) throws XMLStreamException { if (namespace == null) { return; } String uri = namespace.getNamespaceURI(); String prefix = namespace.getPrefix(); if (uri != null && !"".equals(uri)) { String prefixFromWriter = writer.getPrefix(uri); // Handling Default Namespaces First // Case 1 : // here we are trying define a default namespace. But has this been defined in the current context. // yes, there can be a default namespace, but it may have a different URI. If its a different URI // then explicitly define the default namespace here. // Case 2 : // The passed in namespace is a default ns, but there is a non-default ns declared // in the current scope. if (("".equals(prefix) && "".equals(prefixFromWriter) && !uri.equals(writer.getNamespaceContext().getNamespaceURI(""))) || (prefix != null && "".equals(prefix) && (prefixFromWriter == null || !prefix.equals(prefixFromWriter)))) { // this has not been declared earlier writer.writeDefaultNamespace(uri); writer.setDefaultNamespace(uri); } else { prefix = prefix == null ? getNextNSPrefix(writer) : prefix; if (prefix != null && !prefix.equals(prefixFromWriter) && !checkForPrefixInTheCurrentContext(writer, uri, prefix)) { writer.writeNamespace(prefix, uri); writer.setPrefix(prefix, uri); } } } else { // now the nsURI passed is "" or null. Meaning we gonna work with defaultNS. // check whether there is a defaultNS already declared. If yes, is it the same as this ? String currentDefaultNSURI = writer.getNamespaceContext().getNamespaceURI(""); if ((currentDefaultNSURI != null && !currentDefaultNSURI.equals(uri)) || uri != null && !uri.equals(currentDefaultNSURI)) { // this has not been declared earlier writer.writeDefaultNamespace(uri); writer.setDefaultNamespace(uri); } } } /** * @deprecated This method was used to work around a StAX conformance issue in early versions * of the XL XP-J parser. This is now handled by * {@link org.apache.axiom.util.stax.dialect.StAXDialect}, and this method always returns * false. */ public static boolean isSetPrefixBeforeStartElement(XMLStreamWriter writer) { return false; } /** * Method serializeStartpart. Serialize the start tag of an element. * * @param element * @param writer * @throws XMLStreamException */ public static void serializeStartpart(OMElement element, XMLStreamWriter writer) throws XMLStreamException { serializeStartpart(element, element.getLocalName(), writer); } /** * Method serializeStartpart. Serialize the start tag of an element. * * @param element * @param localName (in some cases, the caller wants to force a different localName) * @param writer * @throws XMLStreamException */ public static void serializeStartpart(OMElement element, String localName, XMLStreamWriter writer) throws XMLStreamException { // Note: To serialize the start tag, we must follow the order dictated by the JSR-173 (StAX) specification. // Please keep this code in sync with the code in StreamingOMSerializer.serializeElement // The algorithm is: // ... generate writeStartElement // // ... generate setPrefix/setDefaultNamespace for each namespace declaration if the prefix is unassociated. // ... generate setPrefix/setDefaultNamespace if the prefix of the element is unassociated // ... generate setPrefix/setDefaultNamespace for each unassociated prefix of the attributes. // // ... generate writeNamespace/writerDefaultNamespace for the new namespace declarations determine during the "set" processing // ... generate writeAttribute for each attribute ArrayList writePrefixList = null; ArrayList writeNSList = null; // Get the namespace and prefix of the element OMNamespace eOMNamespace = element.getNamespace(); String ePrefix = null; String eNamespace = null; if (eOMNamespace != null) { ePrefix = eOMNamespace.getPrefix(); eNamespace = eOMNamespace.getNamespaceURI(); } ePrefix = (ePrefix != null && ePrefix.length() == 0) ? null : ePrefix; eNamespace = (eNamespace != null && eNamespace.length() == 0) ? null : eNamespace; if (eNamespace != null) { if (ePrefix == null) { if (!isAssociated("", eNamespace, writer)) { if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (! writePrefixList.contains("")) { writePrefixList.add(""); writeNSList.add(eNamespace); } } writer.writeStartElement("", localName, eNamespace); } else { /* * If XMLStreamWriter.writeStartElement(prefix,localName,namespaceURI) associates * the prefix with the namespace .. */ if (!isAssociated(ePrefix, eNamespace, writer)) { if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (! writePrefixList.contains(ePrefix)) { writePrefixList.add(ePrefix); writeNSList.add(eNamespace); } } writer.writeStartElement(ePrefix, localName, eNamespace); } } else { writer.writeStartElement(localName); } // Generate setPrefix for the namespace declarations Iterator it = element.getAllDeclaredNamespaces(); while (it != null && it.hasNext()) { OMNamespace omNamespace = (OMNamespace) it.next(); String prefix = null; String namespace = null; if (omNamespace != null) { prefix = omNamespace.getPrefix(); namespace = omNamespace.getNamespaceURI(); } prefix = (prefix != null && prefix.length() == 0) ? null : prefix; namespace = (namespace != null && namespace.length() == 0) ? null : namespace; String newPrefix = generateSetPrefix(prefix, namespace, writer, false); // If this is a new association, remember it so that it can written out later if (newPrefix != null) { if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (!writePrefixList.contains(newPrefix)) { writePrefixList.add(newPrefix); writeNSList.add(namespace); } } } // Generate setPrefix for the element // Get the prefix and namespace of the element. "" and null are identical. String newPrefix = generateSetPrefix(ePrefix, eNamespace, writer, false); // If this is a new association, remember it so that it can written out later if (newPrefix != null) { if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (!writePrefixList.contains(newPrefix)) { writePrefixList.add(newPrefix); writeNSList.add(eNamespace); } } // Now Generate setPrefix for each attribute Iterator attrs = element.getAllAttributes(); while (attrs != null && attrs.hasNext()) { OMAttribute attr = (OMAttribute) attrs.next(); OMNamespace omNamespace = attr.getNamespace(); String prefix = null; String namespace = null; if (omNamespace != null) { prefix = omNamespace.getPrefix(); namespace = omNamespace.getNamespaceURI(); } prefix = (prefix != null && prefix.length() == 0) ? null : prefix; namespace = (namespace != null && namespace.length() == 0) ? null : namespace; // Default prefix referencing is not allowed on an attribute if (prefix == null && namespace != null) { String writerPrefix = writer.getPrefix(namespace); writerPrefix = (writerPrefix != null && writerPrefix.length() == 0) ? null : writerPrefix; prefix = (writerPrefix != null) ? writerPrefix : getNextNSPrefix(); } newPrefix = generateSetPrefix(prefix, namespace, writer, true); // If the prefix is not associated with a namespace yet, remember it so that we can // write out a namespace declaration if (newPrefix != null) { if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (!writePrefixList.contains(newPrefix)) { writePrefixList.add(newPrefix); writeNSList.add(namespace); } } } // Now Generate setPrefix for each prefix referenced in an xsi:type // For example xsi:type="p:dataType" // The following code will make sure that setPrefix is called for "p". attrs = element.getAllAttributes(); while (attrs != null && attrs.hasNext()) { OMAttribute attr = (OMAttribute) attrs.next(); OMNamespace omNamespace = attr.getNamespace(); String prefix = null; String namespace = null; if (omNamespace != null) { prefix = omNamespace.getPrefix(); namespace = omNamespace.getNamespaceURI(); } prefix = (prefix != null && prefix.length() == 0) ? null : prefix; namespace = (namespace != null && namespace.length() == 0) ? null : namespace; String local = attr.getLocalName(); if (XSI_URI.equals(namespace) && XSI_LOCAL_NAME.equals(local)) { String value = attr.getAttributeValue(); if (DEBUG_ENABLED) { log.debug("The value of xsi:type is " + value); } if (value != null) { value = value.trim(); if (value.indexOf(":") > 0) { String refPrefix = value.substring(0, value.indexOf(":")); OMNamespace omNS = element.findNamespaceURI(refPrefix); String refNamespace = (omNS == null) ? null : omNS.getNamespaceURI(); if (refNamespace != null && refNamespace.length() > 0) { newPrefix = generateSetPrefix(refPrefix, refNamespace, writer, true); // If the prefix is not associated with a namespace yet, remember it so that we can // write out a namespace declaration if (newPrefix != null) { if (DEBUG_ENABLED) { log.debug("An xmlns:" + newPrefix +"=\"" + refNamespace +"\" will be written"); } if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (!writePrefixList.contains(newPrefix)) { writePrefixList.add(newPrefix); writeNSList.add(refNamespace); } } } } } } } // Now write out the list of namespace declarations in this list that we constructed // while doing the "set" processing. if (writePrefixList != null) { for (int i = 0; i < writePrefixList.size(); i++) { String prefix = (String) writePrefixList.get(i); String namespace = (String) writeNSList.get(i); if (prefix != null) { if (namespace == null) { writer.writeNamespace(prefix, ""); } else { writer.writeNamespace(prefix, namespace); } } else { writer.writeDefaultNamespace(namespace); } } } // Now write the attributes attrs = element.getAllAttributes(); while (attrs != null && attrs.hasNext()) { OMAttribute attr = (OMAttribute) attrs.next(); OMNamespace omNamespace = attr.getNamespace(); String prefix = null; String namespace = null; if (omNamespace != null) { prefix = omNamespace.getPrefix(); namespace = omNamespace.getNamespaceURI(); } prefix = (prefix != null && prefix.length() == 0) ? null : prefix; namespace = (namespace != null && namespace.length() == 0) ? null : namespace; if (prefix == null && namespace != null) { // Default namespaces are not allowed on an attribute reference. // Earlier in this code, a unique prefix was added for this case...now obtain and use it prefix = writer.getPrefix(namespace); //XMLStreamWriter doesn't allow for getPrefix to know whether you're asking for the prefix //for an attribute or an element. So if the namespace matches the default namespace getPrefix will return //the empty string, as if it were an element, in all cases (even for attributes, and even if //there was a prefix specifically set up for this), which is not the desired behavior. //Since the interface is base java, we can't fix it where we need to (by adding an attr boolean to //XMLStreamWriter.getPrefix), so we hack it in here... if (prefix == null || "".equals(prefix)) { for (int i = 0; i < writePrefixList.size(); i++) { if (namespace.equals((String) writeNSList.get(i))) { prefix = (String) writePrefixList.get(i); } } } } else if (namespace != null) { // Use the writer's prefix if it is different, but if the writers // prefix is empty then do not replace because attributes do not // default to the default namespace like elements do. String writerPrefix = writer.getPrefix(namespace); if (!prefix.equals(writerPrefix) && writerPrefix != null && !"".equals(writerPrefix)) { prefix = writerPrefix; } } if (namespace != null) { if(prefix == null && OMConstants.XMLNS_URI.equals(namespace)){ prefix = OMConstants.XMLNS_PREFIX; } // Qualified attribute writer.writeAttribute(prefix, namespace, attr.getLocalName(), attr.getAttributeValue()); } else { // Unqualified attribute writer.writeAttribute(attr.getLocalName(), attr.getAttributeValue()); } } } private static boolean checkForPrefixInTheCurrentContext(XMLStreamWriter writer, String nameSpaceName, String prefix) throws XMLStreamException { Iterator prefixesIter = writer.getNamespaceContext().getPrefixes(nameSpaceName); while (prefixesIter.hasNext()) { String prefix_w = (String) prefixesIter.next(); if (prefix_w.equals(prefix)) { // if found do not declare the ns return true; } } return false; } /** * serializeNamespaces * * @param element * @param writer * @throws XMLStreamException * @deprecated Use serializeStartpart instead */ public static void serializeNamespaces (OMElement element, XMLStreamWriter writer) throws XMLStreamException { Iterator namespaces = element.getAllDeclaredNamespaces(); if (namespaces != null) { while (namespaces.hasNext()) { serializeNamespace((OMNamespace) namespaces.next(), writer); } } } /** * Serialize attributes * * @param element * @param writer * @throws XMLStreamException * @deprecated Consider using serializeStartpart instead */ public static void serializeAttributes (OMElement element, XMLStreamWriter writer) throws XMLStreamException { Iterator attributes = element.getAllAttributes(); if (attributes != null && attributes.hasNext()) { while (attributes.hasNext()) { serializeAttribute((OMAttribute) attributes.next(), writer); } } } /** * Method serializeNormal. * * @param writer * @param cache * @throws XMLStreamException */ public static void serializeNormal (OMElement element, XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (cache) { element.build(); } serializeStartpart(element, writer); OMNode firstChild = element.getFirstOMChild(); if (firstChild != null) { if (cache) { (firstChild).serialize(writer); } else { (firstChild).serializeAndConsume(writer); } } serializeEndpart(writer); } public static void serializeByPullStream (OMElement element, XMLStreamWriter writer) throws XMLStreamException { serializeByPullStream(element, writer, false); } public static void serializeByPullStream (OMElement element, XMLStreamWriter writer, boolean cache) throws XMLStreamException { new StreamingOMSerializer().serialize(element.getXMLStreamReader(cache), writer); } public static void serializeChildren(OMContainer container, XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (cache) { Iterator children = container.getChildren(); while (children.hasNext()) { ((OMNodeEx) children.next()).internalSerialize(writer, true); } } else { OMNodeEx child = (OMNodeEx)container.getFirstOMChild(); while (child != null) { if ((!(child instanceof OMElement)) || child.isComplete() || ((OMElement)child).getBuilder() == null) { child.internalSerialize(writer, false); } else { OMElement element = (OMElement) child; element.getBuilder().setCache(false); serializeByPullStream(element, writer, cache); } child = (OMNodeEx)child.getNextOMSiblingIfAvailable(); } } } /** * Get the next prefix name * @return next prefix name */ public static String getNextNSPrefix() { String prefix = "axis2ns" + ++nsCounter % Long.MAX_VALUE; /** * Calling getNextNSPrefix is "a last gasp" approach * for obtaining a prefix. In almost all cases, the * OM element should be provided a prefix by the source parser * or programatically by the user. We only get to this * spot if one was not supplied. * * The debug information is two-fold. * (1) It helps users determine at what point in the code this default * prefix is getting built. This will help them identify * where to change their code if they don't want a default * prefix. * * (2) It identifies this place in the code as suspect. * Do we really want to keep generating new prefixes (?). * This could result in lots of symbol table entries for the * subsequent parser that reads this data. This could hamper * extremely long run usages. * This could be a point where we want a plugin so that users can * decide their own strategy. Examples from other products * include generating a prefix number from the namespace * string. * */ if (DEBUG_ENABLED) { log.debug("Obtained next prefix:" + prefix); if (ADV_DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(CommonUtils.callStackToString()); } } return prefix; } public static String getNextNSPrefix(XMLStreamWriter writer) { String prefix = getNextNSPrefix(); while (writer.getNamespaceContext().getNamespaceURI(prefix) != null) { prefix = getNextNSPrefix(); } return prefix; } /** * Generate setPrefix/setDefaultNamespace if the prefix is not associated * * @param prefix * @param namespace * @param writer * @param attr * @return prefix name if a setPrefix/setDefaultNamespace is performed */ public static String generateSetPrefix(String prefix, String namespace, XMLStreamWriter writer, boolean attr) throws XMLStreamException { prefix = (prefix == null) ? "" : prefix; // If the prefix and namespace are already associated, no generation is needed if (isAssociated(prefix, namespace, writer)) { return null; } // Attributes without a prefix always are associated with the unqualified namespace // according to the schema specification. No generation is needed. if (prefix.length() == 0 && namespace == null && attr) { return null; } // Generate setPrefix/setDefaultNamespace if the prefix is not associated. String newPrefix = null; if (namespace != null) { // Qualified Namespace if (prefix.length() == 0) { writer.setDefaultNamespace(namespace); newPrefix = ""; } else { writer.setPrefix(prefix, namespace); newPrefix = prefix; } } else { // Unqualified Namespace // Disable the default namespace writer.setDefaultNamespace(""); newPrefix = ""; } return newPrefix; } /** * @param prefix * @param namespace * @param writer * @return true if the prefix is associated with the namespace in the current context */ public static boolean isAssociated(String prefix, String namespace, XMLStreamWriter writer) throws XMLStreamException { // The "xml" prefix is always (implicitly) associated. Returning true here makes sure that // we never write a declaration for the xml namespace. See WSCOMMONS-281 for a discussion // of this issue. if ("xml".equals(prefix)) { return true; } // NOTE: Calling getNamespaceContext() on many XMLStreamWriter implementations is expensive. // Please use other writer methods first. // For consistency, convert null arguments. // This helps get around the parser implementation differences. // In addition, the getPrefix/getNamespace methods cannot be called with null parameters. prefix = (prefix == null) ? "" : prefix; namespace = (namespace == null) ? "" : namespace; if (namespace.length() > 0) { // QUALIFIED NAMESPACE // Get the namespace associated with the prefix String writerPrefix = writer.getPrefix(namespace); if (prefix.equals(writerPrefix)) { return true; } // It is possible that the namespace is associated with multiple prefixes, // So try getting the namespace as a second step. if (writerPrefix != null) { NamespaceContext nsContext = writer.getNamespaceContext(); if(nsContext != null) { String writerNS = nsContext.getNamespaceURI(prefix); return namespace.equals(writerNS); } } return false; } else { // UNQUALIFIED NAMESPACE // Cannot associate a prefix with an unqualifed name. // However sometimes axiom creates a fake prefix name if xmns="" is not in effect. // So return true if (prefix.length() > 0) { return true; } // Get the namespace associated with the prefix. // It is illegal to call getPrefix with null, but the specification is not // clear on what happens if called with "". So the following code is // protected try { String writerPrefix = writer.getPrefix(""); if (writerPrefix != null && writerPrefix.length() == 0) { return true; } } catch (Throwable t) { if (DEBUG_ENABLED) { log.debug("Caught exception from getPrefix(\"\"). Processing continues: " + t); } } // Fallback to using the namespace context NamespaceContext nsContext = writer.getNamespaceContext(); if (nsContext != null) { String writerNS = nsContext.getNamespaceURI(""); if (writerNS != null && writerNS.length() > 0) { return false; } } return true; } } } ./src/org/apache/axiom/om/impl/util/EmptyIterator.java0000664000175000017500000000224311767656530022126 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.util; import java.util.Iterator; import java.util.NoSuchElementException; public class EmptyIterator implements Iterator { public void remove() { throw new UnsupportedOperationException(); } public boolean hasNext() { return false; } public Object next() { throw new NoSuchElementException(); } } ./src/org/apache/axiom/om/impl/OMStAXWrapper.java0000664000175000017500000001467111767656530020765 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.util.StreamReaderDelegate; import org.apache.axiom.om.OMAttachmentAccessor; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.OMXMLStreamReader; import org.apache.axiom.util.stax.xop.ContentIDGenerator; import org.apache.axiom.util.stax.xop.OptimizationPolicy; import org.apache.axiom.util.stax.xop.XOPEncodingStreamReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * {@link XMLStreamReader} implementation that generates events from a given Axiom tree. * This class does intentionally does not implement XMLStreamReaderContainer because * it does not wrap a parser (it wraps an OM graph). */ public class OMStAXWrapper extends StreamReaderDelegate implements OMXMLStreamReader { private static final Log log = LogFactory.getLog(OMStAXWrapper.class); private final SwitchingWrapper switchingWrapper; private XOPEncodingStreamReader xopEncoder; /** * When constructing the OMStaxWrapper, the creator must produce the builder (an instance of the * OMXMLparserWrapper of the input) and the Element Node to start parsing. The wrapper will * parse(proceed) until the end of the given element. Hence care should be taken to pass the * root element if the entire document is needed. * * @param builder * @param startNode */ public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode) { this(builder, startNode, false); } /** * Constructor OMStAXWrapper. * * @param builder * @param startNode * @param cache */ public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache) { switchingWrapper = new SwitchingWrapper(builder, startNode, cache); setParent(switchingWrapper); } public boolean isInlineMTOM() { return xopEncoder == null; } public void setInlineMTOM(boolean value) { // For inlineMTOM=false, we insert an XOPEncodingStreamReader proxy between // us and SwitchingWrapper. // For inlineMTOM=true, we remove it and delegate directly to SwitchingWrapper. if (value) { if (xopEncoder != null) { xopEncoder = null; setParent(switchingWrapper); } } else { if (xopEncoder == null) { // Since the intention is to support an efficient way to pass binary content to a // consumer that is not aware of our data handler extension (see WSCOMMONS-344), we // use OptimizationPolicy.ALL, i.e. we ignore OMText#isOptimized(). xopEncoder = new XOPEncodingStreamReader(switchingWrapper, ContentIDGenerator.DEFAULT, OptimizationPolicy.ALL); setParent(xopEncoder); } } } public DataHandler getDataHandler(String contentID) { if (contentID.startsWith("cid:")) { log.warn("Invalid usage of OMStAXWrapper#getDataHandler(String): the argument must " + "be a content ID, not an href; see OMAttachmentAccessor."); contentID = contentID.substring(4); } // Temporary workaround for WSCOMMONS-485: OMXMLParserWrapper builder = switchingWrapper.getBuilder(); if (builder != null && builder instanceof OMAttachmentAccessor) { DataHandler dh = ((OMAttachmentAccessor)builder).getDataHandler(contentID); if (dh != null) { return dh; } } if (xopEncoder == null) { throw new IllegalStateException("The wrapper is in inlineMTOM=true mode"); } if (xopEncoder.getContentIDs().contains(contentID)) { try { return xopEncoder.getDataHandler(contentID); } catch (IOException ex) { throw new OMException(ex); } } else { return null; } } // TODO: need to check which of these delegate methods are really necessary; // some of them should also be defined properly by an interface public OMXMLParserWrapper getBuilder() { return switchingWrapper.getBuilder(); } public boolean isAllowSwitching() { return switchingWrapper.isAllowSwitching(); } public boolean isClosed() { return switchingWrapper.isClosed(); } public void releaseParserOnClose(boolean value) { switchingWrapper.releaseParserOnClose(value); } public void setAllowSwitching(boolean b) { switchingWrapper.setAllowSwitching(b); } public void setParser(XMLStreamReader parser) { switchingWrapper.setParser(parser); } public void setNamespaceURIInterning(boolean b) { switchingWrapper.setNamespaceURIInterning(b); } /** * @return OMDataSource if available */ public OMDataSource getDataSource() { return switchingWrapper.getDataSource(); } /** * If enabled, treat OMSourcedElements that have * a OMDataSource as leaf nodes. The caller * should use the getDataSource method to obtain * the OMDataSource for these events. * @param value boolean */ public void enableDataSourceEvents(boolean value) { switchingWrapper.enableDataSourceEvents(value); } } ./src/org/apache/axiom/om/impl/OMNamespaceImpl.java0000664000175000017500000000471111767656530021315 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import org.apache.axiom.om.OMNamespace; /** Class OMNamespaceImpl */ public class OMNamespaceImpl implements OMNamespace { /** Field prefix */ private final String prefix; /** Field uri */ private final String uri; /** * @param uri * @param prefix */ public OMNamespaceImpl(String uri, String prefix) { if (uri == null) { throw new IllegalArgumentException("Namespace URI may not be null"); } this.uri = uri; this.prefix = prefix; } /** * Method equals. * * @param uri * @param prefix * @return Returns boolean. */ public boolean equals(String uri, String prefix) { return (this.uri.equals(uri) && (this.prefix == null ? prefix == null : this.prefix.equals(prefix))); } public boolean equals(Object obj) { if (!(obj instanceof OMNamespace)) return false; OMNamespace other = (OMNamespace)obj; String otherPrefix = other.getPrefix(); return (uri.equals(other.getNamespaceURI()) && (prefix == null ? otherPrefix == null : prefix.equals(otherPrefix))); } /** * Method getPrefix. * * @return Returns String. */ public String getPrefix() { return prefix; } /** * Method getName. * * @return Returns String. */ public String getName() { return uri; } public String getNamespaceURI() { return uri; } public int hashCode() { return uri.hashCode() ^ (prefix != null ? prefix.hashCode() : 0); } } ./src/org/apache/axiom/om/impl/exception/0000775000175000017500000000000011767656530017473 5ustar brianbrian./src/org/apache/axiom/om/impl/exception/OMBuilderException.java0000664000175000017500000000237011767656530024041 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.exception; import org.apache.axiom.om.OMException; /** Class OMBuilderException */ public class OMBuilderException extends OMException { private static final long serialVersionUID = -7447667411291193889L; /** * Constructor OMBuilderException * * @param s */ public OMBuilderException(String s) { super(s); } public OMBuilderException(Throwable cause) { super(cause); } } ./src/org/apache/axiom/om/impl/exception/XMLComparisonException.java0000664000175000017500000000242411767656530024712 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.exception; public class XMLComparisonException extends Exception { /** Eran Chinthaka (chinthaka@apache.org) */ private static final long serialVersionUID = -7918497983548520994L; public XMLComparisonException(String message) { super(message); } public XMLComparisonException(Throwable cause) { super(cause); } public XMLComparisonException(String message, Throwable cause) { super(message, cause); } } ./src/org/apache/axiom/om/impl/exception/OMStreamingException.java0000664000175000017500000000321711767656530024405 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.exception; import org.apache.axiom.om.OMException; /** Class OMStreamingException */ public class OMStreamingException extends OMException { private static final long serialVersionUID = 8108888406034145092L; /** Constructor OMStreamingException */ public OMStreamingException() { } /** * Constructor OMStreamingException * * @param message */ public OMStreamingException(String message) { super(message); } /** * Constructor OMStreamingException * * @param message * @param cause */ public OMStreamingException(String message, Throwable cause) { super(message, cause); } /** * Constructor OMStreamingException * * @param cause */ public OMStreamingException(Throwable cause) { super(cause); } } ./src/org/apache/axiom/om/impl/OMContainerEx.java0000664000175000017500000000414411767656530021016 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMNode; /** * Interface OMContainerEx *

        * Internal Implementation detail. Adding special interface to stop folks from accidently using * OMContainer. Please use at your own risk. May corrupt the data integrity. */ public interface OMContainerEx extends OMContainer { public void setComplete(boolean state); /** * forcefully set the first element in this parent element * @param omNode */ public void setFirstChild(OMNode omNode); /** * forcefully set the last element in this parent element * @param omNode */ public void setLastChild(OMNode omNode); /** * Get the first child if it is available. The child is available if it is complete or * if the builder has started building the node. In the latter case, * {@link OMNode#isComplete()} may return false when called on the child. * In contrast to {@link OMContainer#getFirstOMChild()}, this method will never modify * the state of the underlying parser. * * @return the first child or null if the container has no children or * the builder has not yet started to build the first child */ public OMNode getFirstOMChildIfAvailable(); } ./src/org/apache/axiom/om/impl/AbstractOMMetaFactory.java0000664000175000017500000001033211767656530022475 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMMetaFactory; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.builder.SAXOMXMLParserWrapper; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXParserConfiguration; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAPModelBuilder; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; import org.xml.sax.InputSource; /** * Base class for {@link OMMetaFactory} implementations that make use of the standard builders * ({@link org.apache.axiom.om.impl.builder.StAXOMBuilder} and its subclasses). */ public abstract class AbstractOMMetaFactory implements OMMetaFactory { private XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration, InputSource is) { try { if (is.getByteStream() != null) { String encoding = is.getEncoding(); if (encoding == null) { return StAXUtils.createXMLStreamReader(configuration, is.getByteStream()); } else { return StAXUtils.createXMLStreamReader(configuration, is.getByteStream(), encoding); } } else if (is.getCharacterStream() != null) { return StAXUtils.createXMLStreamReader(configuration, is.getCharacterStream()); } else { throw new IllegalArgumentException(); } } catch (XMLStreamException ex) { throw new OMException(ex); } } public OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, XMLStreamReader parser) { StAXOMBuilder builder = new StAXOMBuilder(omFactory, parser); // StAXOMBuilder defaults to the "legacy" behavior, which is to keep a reference to the // parser after the builder has been closed. Since releasing this reference is a good idea // we default to releaseParserOnClose=true for builders created through the OMMetaFactory // API. builder.releaseParserOnClose(true); return builder; } public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, InputSource is) { return createStAXOMBuilder(omFactory, createXMLStreamReader(configuration, is)); } public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Source source) { if (source instanceof SAXSource) { return new SAXOMXMLParserWrapper(omFactory, (SAXSource)source); } else { try { return new StAXOMBuilder(omFactory, StAXUtils.getXMLInputFactory().createXMLStreamReader(source)); } catch (XMLStreamException ex) { throw new OMException(ex); } } } public SOAPModelBuilder createStAXSOAPModelBuilder(XMLStreamReader parser) { StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(this, parser); builder.releaseParserOnClose(true); return builder; } public SOAPModelBuilder createSOAPModelBuilder(StAXParserConfiguration configuration, InputSource is) { return createStAXSOAPModelBuilder(createXMLStreamReader(configuration, is)); } } ./src/org/apache/axiom/om/impl/OMMultipartWriter.java0000664000175000017500000001367711767656530021770 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import java.io.OutputStream; import javax.activation.DataHandler; import org.apache.axiom.attachments.ConfigurableDataHandler; import org.apache.axiom.mime.MultipartWriter; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.CommonUtils; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; /** * Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments. This class wraps a * {@link MultipartWriter}, providing a higher level API. In particular it will configure content * types and content transfer encodings based on information from an {@link OMOutputFormat} object. */ public class OMMultipartWriter { private final OMOutputFormat format; private final MultipartWriter writer; private final boolean useCTEBase64; private final String rootPartContentType; public OMMultipartWriter(OutputStream out, OMOutputFormat format) { this.format = format; writer = format.getMultipartWriterFactory().createMultipartWriter(out, format.getMimeBoundary()); useCTEBase64 = format != null && Boolean.TRUE.equals( format.getProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS)); String soapContentType; if (format.isSOAP11()) { soapContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE; } else { soapContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE; } if (format.isOptimized()) { rootPartContentType = "application/xop+xml; charset=" + format.getCharSetEncoding() + "; type=\"" + soapContentType + "\""; } else { rootPartContentType = soapContentType + "; charset=" + format.getCharSetEncoding(); } } private String getContentTransferEncoding(String contentType) { if (useCTEBase64 && !CommonUtils.isTextualPart(contentType)) { return "base64"; } else { return "binary"; } } /** * Get the content type of the root part, as determined by the {@link OMOutputFormat} passed * to the constructor of this object. * * @return the content type of the root part */ public String getRootPartContentType() { return rootPartContentType; } /** * Start writing the root part of the MIME package. This method delegates to * {@link MultipartWriter#writePart(String, String, String)}, but computes the content type, * content transfer encoding and content ID from the {@link OMOutputFormat}. * * @return an output stream to write the content of the MIME part * @throws IOException * if an I/O error occurs when writing to the underlying stream */ public OutputStream writeRootPart() throws IOException { return writer.writePart(rootPartContentType, "binary", format.getRootContentId()); } /** * Start writing an attachment part of the MIME package. This method delegates to * {@link MultipartWriter#writePart(String, String, String)}, but computes the content transfer * encoding based on the content type and the {@link OMOutputFormat}. * * @param contentType * the content type of the MIME part to write * @param contentID * the content ID of the MIME part * @return an output stream to write the content of the MIME part * @throws IOException * if an I/O error occurs when writing to the underlying stream */ public OutputStream writePart(String contentType, String contentID) throws IOException { return writer.writePart(contentType, getContentTransferEncoding(contentType), contentID); } /** * Write a MIME part. This method delegates to * {@link MultipartWriter#writePart(DataHandler, String, String)}, but computes the appropriate * content transfer encoding from the {@link OMOutputFormat}. * * @param dataHandler * the content of the MIME part to write * @param contentID * the content ID of the MIME part * @throws IOException * if an I/O error occurs when writing the part to the underlying stream */ public void writePart(DataHandler dataHandler, String contentID) throws IOException { String contentTransferEncoding = null; if (dataHandler instanceof ConfigurableDataHandler) { contentTransferEncoding = ((ConfigurableDataHandler)dataHandler).getTransferEncoding(); } if (contentTransferEncoding == null) { contentTransferEncoding = getContentTransferEncoding(dataHandler.getContentType()); } writer.writePart(dataHandler, contentTransferEncoding, contentID); } /** * Complete writing of the MIME multipart package. This method delegates to * {@link MultipartWriter#complete()}. * * @throws IOException * if an I/O error occurs when writing to the underlying stream */ public void complete() throws IOException { writer.complete(); } } ./src/org/apache/axiom/om/impl/dom/0000775000175000017500000000000011767656530016254 5ustar brianbrian./src/org/apache/axiom/om/impl/dom/AttributeMap.java0000664000175000017500000002163011767656530021522 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import java.util.Vector; public class AttributeMap extends NamedNodeMapImpl { /** @param ownerNode */ protected AttributeMap(ParentNode ownerNode) { super(ownerNode); } public Node removeNamedItem(String name) throws DOMException { // TODO Set used to false return super.removeNamedItem(name); } public Node removeNamedItemNS(String namespaceURI, String name) throws DOMException { // TODO return super.removeNamedItemNS(namespaceURI, name); } /** Almost a copy of the Xerces impl. */ public Node setNamedItem(Node attribute) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null); throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg); } AttrImpl attr = (AttrImpl) attribute; if (attr.isOwned()) { // If the attribute is owned then: if (attr.getOwnerElement() != this.ownerNode) // the owner must be // the owner of this // list throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INUSE_ATTRIBUTE_ERR, null)); else return attr; // No point adding the 'same' attr again to the // same element } attr.parent = this.ownerNode; // Set the owner node attr.isOwned(true); // To indicate that this attr belong to an element attr.setUsed(true); // Setting used to true int i = findNamePoint(attr.getNodeName(), 0); AttrImpl previous = null; if (i >= 0) { // There's an attribute already with this attr's name previous = (AttrImpl) nodes.elementAt(i); nodes.setElementAt(attr, i); previous.parent = null; previous.isOwned(false); // make sure it won't be mistaken with defaults in case it's reused previous.isSpecified(true); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { nodes = new Vector(5, 10); } nodes.insertElementAt(attr, i); } // - Not sure whether we really need this // // notify document // ownerNode.getOwnerDocument().setAttrNode(attr, previous); // If the new attribute is not normalized, // the owning element is inherently not normalized. if (!attr.isNormalized()) { ownerNode.isNormalized(false); } return previous; } /** Almost a copy of the Xerces impl. */ public Node setNamedItemNS(Node attribute) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null); throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg); } AttrImpl attr = (AttrImpl) attribute; if (attr.isOwned()) { // If the attribute is owned then: //the owner must be the owner of this list if (attr.getOwnerElement() != this.ownerNode) throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INUSE_ATTRIBUTE_ERR, null)); else return attr; // No point adding the 'same' attr again to the // same element } //Set the owner node attr.ownerNode = (DocumentImpl) this.ownerNode.getOwnerDocument(); attr.parent = this.ownerNode; attr.isOwned(true); // To indicate that this attr belong to an element int i = findNamePoint(attr.getNamespaceURI(), attr.getLocalName()); AttrImpl previous = null; if (i >= 0) { previous = (AttrImpl) nodes.elementAt(i); nodes.setElementAt(attr, i); previous.ownerNode = (DocumentImpl) this.ownerNode .getOwnerDocument(); previous.parent = null; previous.isOwned(false); // make sure it won't be mistaken with defaults in case it's reused previous.isSpecified(true); } else { // If we can't find by namespaceURI, localName, then we find by // nodeName so we know where to insert. i = findNamePoint(attr.getNodeName(), 0); if (i >= 0) { previous = (AttrImpl) nodes.elementAt(i); nodes.insertElementAt(attr, i); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { nodes = new Vector(5, 10); } nodes.insertElementAt(attr, i); } } // If the new attribute is not normalized, // the owning element is inherently not normalized. if (!attr.isNormalized()) { ownerNode.isNormalized(false); } return previous; } /** * BORROWED from Xerces impl. Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all * the nodes contained in the map. */ public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) { AttributeMap newmap = new AttributeMap((ParentNode) ownerNode); newmap.hasDefaults(hasDefaults()); newmap.cloneContent(this); return newmap; } // cloneMap():AttributeMap /** BORROWED from Xerces impl. */ protected void cloneContent(NamedNodeMapImpl srcmap) { Vector srcnodes = srcmap.nodes; if (srcnodes != null) { int size = srcnodes.size(); if (size != 0) { if (nodes == null) { nodes = new Vector(size); } nodes.setSize(size); for (int i = 0; i < size; ++i) { NodeImpl n = (NodeImpl) srcnodes.elementAt(i); NodeImpl clone = (NodeImpl) n.cloneNode(true); clone.isSpecified(n.isSpecified()); nodes.setElementAt(clone, i); clone.ownerNode = this.ownerNode.ownerNode; clone.isOwned(true); } } } } // cloneContent():AttributeMap } ./src/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java0000664000175000017500000000364111767656530021643 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMStAXWrapper; /** * Empty subclass of {@link OMStAXWrapper} to keep compatibility with existing code. */ public class DOMStAXWrapper extends OMStAXWrapper { /** * When constructing the OMStaxWrapper, the creator must produce the builder (an instance of the * OMXMLparserWrapper of the input) and the Element Node to start parsing. The wrapper will * parse(proceed) until the end of the given element. Hence care should be taken to pass the * root element if the entire document is needed. * * @param builder * @param startNode */ public DOMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode) { super(builder, startNode); } /** * Constructor OMStAXWrapper. * * @param builder * @param startNode * @param cache */ public DOMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache) { super(builder, startNode, cache); } } ./src/org/apache/axiom/om/impl/dom/DOMNavigator.java0000664000175000017500000000237311767656530021416 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.OMNavigator; /** * Empty subclass of {@link OMNavigator} to keep compatibility with existing code. */ public class DOMNavigator extends OMNavigator { /** Constructor OMNavigator. */ public DOMNavigator() { } /** * Constructor OMNavigator. * * @param node */ public DOMNavigator(OMNode node) { super(node); } } ./src/org/apache/axiom/om/impl/dom/ElementImpl.java0000664000175000017500000013546511767656530021350 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.impl.traverse.OMChildElementIterator; import org.apache.axiom.om.impl.traverse.OMDescendantsIterator; import org.apache.axiom.om.impl.traverse.OMQNameFilterIterator; import org.apache.axiom.om.impl.traverse.OMQualifiedNameFilterIterator; import org.apache.axiom.om.impl.util.EmptyIterator; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; /** Implementation of the org.w3c.dom.Element and org.apache.axiom.om.Element interfaces. */ public class ElementImpl extends ParentNode implements Element, OMElement, OMConstants { private int lineNumber; protected OMNamespace namespace; protected String localName; private AttributeMap attributes; private HashMap namespaces; private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator(); private static final OMNamespace XMLNS_NAMESPACE_WITH_PREFIX = new NamespaceImpl(OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX); private static final OMNamespace XMLNS_NAMESPACE_WITHOUT_PREFIX = new NamespaceImpl(OMConstants.XMLNS_NS_URI, null); /** @param ownerDocument ownerDocument * @param tagName tagName * @param factory OMFactory * * */ public ElementImpl(DocumentImpl ownerDocument, String tagName, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.attributes = new AttributeMap(this); this.done = true; } /** * Creates a new element with the namespace. * * @param ownerDocument * @param tagName * @param ns * @param factory */ public ElementImpl(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.namespace = ns; this.declareNamespace(ns); this.attributes = new AttributeMap(this); this.done = true; } public ElementImpl(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.namespace = ns; this.builder = builder; this.declareNamespace(ns); this.attributes = new AttributeMap(this); } public ElementImpl(ParentNode parentNode, String tagName, NamespaceImpl ns, OMFactory factory) { this((DocumentImpl) parentNode.getOwnerDocument(), tagName, ns, factory); parentNode.addChild(this); this.done = true; } public ElementImpl(ParentNode parentNode, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { this(tagName, ns, builder, factory); if (parentNode != null) { this.ownerNode = (DocumentImpl) parentNode.getOwnerDocument(); this.isOwned(true); parentNode.addChild(this); } } public ElementImpl(String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { this(factory); this.localName = tagName; this.namespace = ns; this.builder = builder; if (ns != null) { this.declareNamespace(ns); } this.attributes = new AttributeMap(this); } public ElementImpl(OMFactory factory) { super(factory); this.ownerNode = ((OMDOMFactory) factory).getDocument(); } // / // /org.w3c.dom.Node methods // / /* * (non-Javadoc) * * @see org.w3c.dom.Node#getNodeType() */ public short getNodeType() { return Node.ELEMENT_NODE; } /* * (non-Javadoc) * * @see org.w3c.dom.Node#getNodeName() */ public String getNodeName() { if (this.namespace != null) { if (this.namespace.getPrefix() == null || "".equals(this.namespace.getPrefix())) { return this.localName; } else { return this.namespace.getPrefix() + ":" + this.localName; } } else { return this.localName; } } /** Returns the value of the namespace URI. */ public String getNamespaceURI() { if (this.namespace == null) { return null; } else { // If the element has no namespace, the result should be null, not // an empty string. String uri = this.namespace.getNamespaceURI(); return uri.length() == 0 ? null : uri.intern(); } } // / // /org.apache.axiom.om.OMNode methods // / /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNode#getType() */ public int getType() throws OMException { return OMNode.ELEMENT_NODE; } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNode#setType(int) */ public void setType(int nodeType) throws OMException { // Do nothing ... // This is an Eement Node... } // / // / org.w3c.dom.Element methods // / /* * (non-Javadoc) * * @see org.w3c.dom.Element#getTagName() */ public String getTagName() { return this.getNodeName(); } /** * Removes an attribute by name. * * @param name The name of the attribute to remove * @see org.w3c.dom.Element#removeAttribute(String) */ public void removeAttribute(String name) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (name.startsWith(OMConstants.XMLNS_NS_PREFIX)) { String namespacePrefix = DOMUtil.getLocalName(name); if (this.findNamespaceURI(namespacePrefix) != null) { this.removeNamespace(namespacePrefix); } } if (this.attributes != null) { this.attributes.removeNamedItem(name); } } /* * (non-Javadoc) * * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, * java.lang.String) */ public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) { //look in the ns list if (this.namespaces != null) { this.namespaces.remove(DOMUtil.getLocalName(localName)); } } else if (this.attributes != null) { this.attributes.removeNamedItemNS(namespaceURI, localName); } } /** * Removes the specified attribute node. * * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr) */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (this.attributes == null || this.attributes.getNamedItem(oldAttr.getName()) == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } return (AttrImpl) this.attributes.removeNamedItem(oldAttr .getName()); } /* * (non-Javadoc) * * @see org.w3c.dom.Element#hasAttribute(java.lang.String) */ public boolean hasAttribute(String name) { return this.getAttributeNode(name) != null; } /** * Returns whether the given attribute is available or not. * * @see org.w3c.dom.Element#hasAttributeNS(String, String) */ public boolean hasAttributeNS(String namespaceURI, String localName) { return this.getAttributeNodeNS(namespaceURI, localName) != null; } /** * Looks in the local list of attributes and returns if found. If the local list is null, * returns "". * * @see org.w3c.dom.Element#getAttribute(String) */ public String getAttribute(String name) { if (attributes == null) { return ""; } else { Attr attr = ((Attr) attributes.getNamedItem(name)); return (attr != null) ? attr.getValue() : ""; } } /** * Retrieves an attribute node by name. * * @see org.w3c.dom.Element#getAttributeNode(String) */ public Attr getAttributeNode(String name) { return (this.attributes == null) ? null : (AttrImpl) this.attributes .getNamedItem(name); } /** * Retrieves an attribute value by local name and namespace URI. * * @see org.w3c.dom.Element#getAttributeNS(String, String) */ public String getAttributeNS(String namespaceURI, String localName) { if (this.attributes == null) { return ""; } Attr attributeNodeNS = this.getAttributeNodeNS(namespaceURI, localName); return attributeNodeNS == null ? "" : attributeNodeNS.getValue(); } /** * Retrieves an attribute node by local name and namespace URI. * * @see org.w3c.dom.Element#getAttributeNodeNS(String, String) */ public Attr getAttributeNodeNS(String namespaceURI, String localName) { if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) { OMNamespace ns = this.findNamespaceURI(localName); String nsuri = ns != null ? ns.getNamespaceURI() : ""; AttrImpl namespaceAttr = new AttrImpl(this.ownerNode, localName, nsuri, this.factory); NamespaceImpl xmlNs = new NamespaceImpl(OMConstants.XMLNS_NS_URI); namespaceAttr.setOMNamespace(xmlNs); return namespaceAttr; } return (this.attributes == null) ? null : (Attr) this.attributes .getNamedItemNS(namespaceURI, localName); } /** * Adds a new attribute node. * * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr) */ public Attr setAttributeNode(Attr attr) throws DOMException { AttrImpl attrImpl = (AttrImpl) attr; if (attrImpl.isOwned()) {// check for ownership if (!this.getOwnerDocument().equals(attr.getOwnerDocument())) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } } if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } // check whether the attr is in use if (attrImpl.isUsed()) { String msg = DOMMessageFormatter .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.INUSE_ATTRIBUTE_ERR, null); throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg); } if (attr.getNodeName().startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) { // This is a ns declaration this.declareNamespace(attr.getNodeValue(), DOMUtil .getLocalName(attr.getName())); //Don't add this to attr list, since its a namespace return attr; } else if (attr.getNodeName().equals(OMConstants.XMLNS_NS_PREFIX)) { this.declareDefaultNamespace(attr.getValue()); //Don't add this to attr list, since its a namespace return attr; } if (this.attributes == null) { this.attributes = new AttributeMap(this); } return (Attr) this.attributes.setNamedItem(attr); } /* * (non-Javadoc) * * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String) */ public void setAttribute(String name, String value) throws DOMException { // Check for invalid charaters if (!DOMUtil.isQualifiedName(name)) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR, null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } if (name.startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) { // This is a ns declaration this.declareNamespace(value, DOMUtil.getLocalName(name)); } else if (name.equals(OMConstants.XMLNS_NS_PREFIX)) { this.declareDefaultNamespace(value); } else { this.setAttributeNode(new AttrImpl(this.ownerNode, name, value, this.factory)); } } /* * (non-Javadoc) * * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr) */ public Attr setAttributeNodeNS(Attr attr) throws DOMException { // Check whether the attr is a namespace declaration // if so add a namespace NOT an attribute if (attr.getNamespaceURI() != null && attr.getNamespaceURI().equals(OMConstants.XMLNS_NS_URI)) { this.declareNamespace(attr.getName(), attr.getValue()); return attr; } else { AttrImpl attrImpl = (AttrImpl) attr; if (attrImpl.isOwned()) {// check for ownership if (!this.getOwnerDocument().equals(attr.getOwnerDocument())) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } } if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } // check whether the attr is in use if (attrImpl.isUsed()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INUSE_ATTRIBUTE_ERR, null); throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg); } if (this.attributes == null) { this.attributes = new AttributeMap(this); } // handle the namespaces if (attr.getNamespaceURI() != null && findNamespace(attr.getNamespaceURI(), attr.getPrefix()) == null) { // TODO checkwhether the same ns is declared with a different // prefix and remove it this.declareNamespace(new NamespaceImpl(attr.getNamespaceURI(), attr.getPrefix())); } return (Attr) this.attributes.setNamedItemNS(attr); } } /** * Adds a new attribute. * * @see org.w3c.dom.Element#setAttributeNS(String, String, String) */ public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { if (namespaceURI != null && !"".equals(namespaceURI)) { if (namespaceURI.equals(OMConstants.XMLNS_NS_URI)) { this.declareNamespace(value, DOMUtil .getLocalName(qualifiedName)); } else { AttrImpl attr = new AttrImpl(this.ownerNode, DOMUtil .getLocalName(qualifiedName), value, this.factory); attr.setOMNamespace(new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName))); this.setAttributeNodeNS(attr); } } else { // When the namespace is null, the attr name given better not be // a qualified name // But anyway check and set it this.setAttribute(DOMUtil.getLocalName(qualifiedName), value); } } private OMAttribute addAttribute(String namespaceURI, String qualifiedName, String value) throws DOMException { if (!DOMUtil.isQualifiedName(qualifiedName)) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR , null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (this.attributes == null) { this.attributes = new AttributeMap(this); } if (namespaceURI != null) { if (!DOMUtil.isValidNamespace(namespaceURI, qualifiedName)) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NAMESPACE_ERR, null); throw new DOMException(DOMException.NAMESPACE_ERR, msg); } // Check whether there's an existing Attr with same local name and // namespace URI String localName = DOMUtil.getLocalName(qualifiedName); Attr attributeNode = this.getAttributeNodeNS(namespaceURI, localName); if (attributeNode != null) { AttrImpl tempAttr = ((AttrImpl) attributeNode); tempAttr.setOMNamespace(new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName))); tempAttr.setAttributeValue(value); this.attributes.setNamedItem(tempAttr); return tempAttr; } else { NamespaceImpl ns = new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName)); AttrImpl attr = new AttrImpl((DocumentImpl) this .getOwnerDocument(), localName, ns, value, this.factory); this.attributes.setNamedItem(attr); return attr; } } else { Attr attributeNode = this.getAttributeNode(qualifiedName); if (attributeNode != null) { AttrImpl tempAttr = ((AttrImpl) attributeNode); tempAttr.setAttributeValue(value); this.attributes.setNamedItem(tempAttr); return tempAttr; } else { AttrImpl attr = new AttrImpl((DocumentImpl) this .getOwnerDocument(), qualifiedName, value, this.factory); this.attributes.setNamedItem(attr); return attr; } } } /** Returns whether this element contains any attribute or not. */ public boolean hasAttributes() { // DOM represents namespace declarations as attributes; therefore // we need to check both "attributes" and "namespaces" return attributes != null && attributes.getLength() > 0 || namespaces != null && !namespaces.isEmpty(); } /* * (non-Javadoc) * * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, * java.lang.String) */ public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { final QName qname = new QName(namespaceURI, localName); return new NodeListImpl() { protected Iterator getIterator() { return new OMQNameFilterIterator( new OMDescendantsIterator(getFirstOMChild()), qname); } }; } /* * (non-Javadoc) * * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String) */ public NodeList getElementsByTagName(final String name) { if (name.equals("*")) { return new NodeListImpl() { protected Iterator getIterator() { return new OMDescendantsIterator(getFirstOMChild()); } }; } else { return new NodeListImpl() { protected Iterator getIterator() { return new OMQualifiedNameFilterIterator( new OMDescendantsIterator(getFirstOMChild()), name); } }; } } // / // /OmElement methods // / /** @see org.apache.axiom.om.OMElement#addAttribute (org.apache.axiom.om.OMAttribute) */ public OMAttribute addAttribute(OMAttribute attr) { // If the attribute already has an owner element then clone the attribute (except if it is owned // by the this element) OMElement owner = attr.getOwner(); if (owner != null) { if (owner == this) { return attr; } attr = (OMAttribute)((AttrImpl)attr).cloneNode(false); } OMNamespace namespace = attr.getNamespace(); if (namespace != null) { String uri = namespace.getNamespaceURI(); if (uri.length() > 0) { String prefix = namespace.getPrefix(); OMNamespace ns2 = findNamespaceURI(prefix); if (ns2 == null || !uri.equals(ns2.getNamespaceURI())) { declareNamespace(uri, prefix); } } } if (attr.getNamespace() != null) { // If the attr has a namespace this.setAttributeNodeNS((Attr) attr); } else { this.setAttributeNode((Attr) attr); } return attr; } public OMAttribute addAttribute(String localName, String value, OMNamespace ns) { if (ns != null) { String uri = ns.getNamespaceURI(); if (uri.length() > 0) { String prefix = ns.getPrefix(); OMNamespace ns2 = findNamespaceURI(prefix); if (ns2 == null || !uri.equals(ns2.getNamespaceURI())) { declareNamespace(uri, prefix); } } } return addAttribute(new AttrImpl(ownerNode, localName, ns, value, factory)); } /** * Allows overriding an existing declaration if the same prefix was used. * * @see org.apache.axiom.om.OMElement#declareNamespace (org.apache.axiom.om.OMNamespace) */ public OMNamespace declareNamespace(OMNamespace namespace) { if (namespaces == null) { this.namespaces = new HashMap(5); } if (namespace != null) { String prefix = namespace.getPrefix(); if ("".equals(prefix)) { namespace = declareDefaultNamespace(namespace.getNamespaceURI()); } else if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); namespace = new NamespaceImpl(namespace.getNamespaceURI(), prefix); } if (!namespace.getPrefix().startsWith(OMConstants.XMLNS_NS_PREFIX)) { namespaces.put(namespace.getPrefix(), namespace); } } return namespace; } /** * Allows overriding an existing declaration if the same prefix was used. * * @see org.apache.axiom.om.OMElement#declareNamespace(String, String) */ public OMNamespace declareNamespace(String uri, String prefix) { if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); } NamespaceImpl ns = new NamespaceImpl(uri, prefix); return declareNamespace(ns); } /** * We use "" to store the default namespace of this element. As one can see user can not give "" * as the prefix, when he declare a usual namespace. * * @param uri */ public OMNamespace declareDefaultNamespace(String uri) { NamespaceImpl ns = new NamespaceImpl(uri, ""); if (namespaces == null) { this.namespaces = new HashMap(5); } namespaces.put("", ns); return ns; } public OMNamespace getDefaultNamespace() { if (namespaces != null) { NamespaceImpl defaultNS = (NamespaceImpl) namespaces.get(""); if (defaultNS != null) { return defaultNS; } } if (parentNode instanceof ElementImpl) { ElementImpl element = (ElementImpl) parentNode; element.getDefaultNamespace(); } return null; } /** @see org.apache.axiom.om.OMElement#findNamespace(String, String) */ public OMNamespace findNamespace(String uri, String prefix) { // check in the current element OMNamespace namespace = findDeclaredNamespace(uri, prefix); if (namespace != null) { return namespace; } // go up to check with ancestors if (this.parentNode != null) { // For the OMDocumentImpl there won't be any explicit namespace // declarations, so going up the parent chain till the document // element should be enough. if (parentNode instanceof OMElement) { namespace = ((ElementImpl) parentNode).findNamespace(uri, prefix); } } if (namespace == null && uri != null && prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI)) { declareNamespace(OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX); namespace = findNamespace(uri, prefix); } return namespace; } public OMNamespace findNamespaceURI(String prefix) { OMNamespace ns = this.namespaces == null ? null : (OMNamespace) this.namespaces.get(prefix); if (ns == null && this.parentNode instanceof OMElement) { // try with the parent ns = ((OMElement) this.parentNode).findNamespaceURI(prefix); } return ns; } /** * Checks for the namespace only in the current Element. This can also be used to * retrieve the prefix of a known namespace URI. */ private OMNamespace findDeclaredNamespace(String uri, String prefix) { if (uri == null) { return namespaces == null ? null : (OMNamespace)namespaces.get(prefix); } // If the prefix is available and uri is available and its the xml // namespace if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI)) { return new NamespaceImpl(uri, prefix); } if (namespaces == null) { return null; } if (prefix == null || "".equals(prefix)) { Iterator namespaceListIterator = namespaces.values().iterator(); while (namespaceListIterator.hasNext()) { OMNamespace omNamespace = (OMNamespace) namespaceListIterator.next(); String nsURI = omNamespace.getNamespaceURI(); if (nsURI != null && nsURI.equals(uri)) { return omNamespace; } } } else { OMNamespace namespace = (OMNamespace) namespaces.get(prefix); if (namespace != null && uri.equals(namespace.getNamespaceURI())) { return namespace; } } return null; } /** * Returns a named attribute if present. * * @see org.apache.axiom.om.OMElement#getAttribute (javax.xml.namespace.QName) */ public OMAttribute getAttribute(QName qname) { if (this.attributes == null) { return null; } if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals("")) { return (AttrImpl) this.getAttributeNode(qname.getLocalPart()); } else { return (AttrImpl) this.getAttributeNodeNS(qname.getNamespaceURI(), qname.getLocalPart()); } } /** * Returns a named attribute's value, if present. * * @param qname the qualified name to search for * @return Returns a String containing the attribute value, or null. */ public String getAttributeValue(QName qname) { OMAttribute attr = getAttribute(qname); return (attr == null) ? null : attr.getAttributeValue(); } /** * Returns the first Element node. * * @see org.apache.axiom.om.OMElement#getFirstElement() */ public OMElement getFirstElement() { OMNode node = getFirstOMChild(); while (node != null) { if (node.getType() == Node.ELEMENT_NODE) { return (OMElement) node; } else { node = node.getNextOMSibling(); } } return null; } /** * Returns the namespace of this element. * * @see org.apache.axiom.om.OMElement#getNamespace() */ public OMNamespace getNamespace() { return namespace != null ? namespace : getDefaultNamespace(); } /** * Returns the QName of this element. * * @see org.apache.axiom.om.OMElement#getQName() */ public QName getQName() { QName qName; if (namespace != null) { if (namespace.getPrefix() != null) { qName = new QName(namespace.getNamespaceURI(), this.localName, namespace.getPrefix()); } else { qName = new QName(namespace.getNamespaceURI(), this.localName); } } else { qName = new QName(this.localName); } return qName; } /** * Gets all the text children and concatinates them to a single string. * * @see org.apache.axiom.om.OMElement#getText() */ public String getText() { String childText = ""; OMNode child = this.getFirstOMChild(); OMText textNode; while (child != null) { final int type = child.getType(); if (type == OMNode.TEXT_NODE || type == OMNode.CDATA_SECTION_NODE) { textNode = (OMText) child; if (textNode.getText() != null && !"".equals(textNode.getText())) { childText += textNode.getText(); } } child = child.getNextOMSibling(); } return childText; } public QName getTextAsQName() { String childText = getTrimmedText(); if (childText != null) { return resolveQName(childText); } return null; } public String getTrimmedText() { String childText = null; OMNode child = this.getFirstOMChild(); OMText textNode; while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { textNode = (OMText) child; String textValue = textNode.getText(); if (textValue != null && !"".equals(textValue.trim())) { if (childText == null) childText = ""; childText += textValue.trim(); } } child = child.getNextOMSibling(); } return childText; } /** * Removes an attribute from the element. * * @see org.apache.axiom.om.OMElement#removeAttribute (org.apache.axiom.om.OMAttribute) */ public void removeAttribute(OMAttribute attr) { this.removeAttributeNode((AttrImpl) attr); } /** * Sets the OM builder. * * @see org.apache.axiom.om.OMElement#setBuilder (org.apache.axiom.om.OMXMLParserWrapper) */ public void setBuilder(OMXMLParserWrapper wrapper) { this.builder = wrapper; } /** * Sets the local name. * * @see org.apache.axiom.om.OMElement#setLocalName(String) */ public void setLocalName(String localName) { this.localName = localName; } /** * Sets the namespace. * * @see org.apache.axiom.om.OMElement#setNamespace (org.apache.axiom.om.OMNamespace) */ public void setNamespace(OMNamespace namespace) { this.namespace = namespace; } public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) { this.namespace = namespace; } /** * Creates a text node with the given value and adds it to the element. * * @see org.apache.axiom.om.OMElement#setText(String) */ public void setText(String text) { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } // if we already have other text nodes remove them OMNode child = this.getFirstOMChild(); while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { child.detach(); } child = child.getNextOMSibling(); } TextImpl textNode = (TextImpl) (this.ownerNode) .createTextNode(text); this.addChild(textNode); } public void setText(QName text) { throw new UnsupportedOperationException(); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (cache || this.done || (this.builder == null)) { OMSerializerUtil.serializeStartpart(this, writer); OMSerializerUtil.serializeChildren(this, writer, cache); OMSerializerUtil.serializeEndpart(writer); } else { OMSerializerUtil.serializeByPullStream(this, writer, cache); } } public String toStringWithConsume() throws XMLStreamException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.serializeAndConsume(baos); return new String(baos.toByteArray()); } /** * Overridden toString() for ease of debugging. * * @see Object#toString() */ public String toString() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { // this.build(); this.serialize(baos); } catch (XMLStreamException e) { throw new RuntimeException("Can not serialize OM Element " + this.getLocalName(), e); } return new String(baos.toByteArray()); } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMElement#getChildElements() */ public Iterator getChildElements() { return new OMChildElementIterator(getFirstElement()); } /** @see org.apache.axiom.om.OMElement#getAllDeclaredNamespaces() */ public Iterator getAllDeclaredNamespaces() throws OMException { if (namespaces == null) { return EMPTY_ITERATOR; } return namespaces.values().iterator(); } /** @see org.apache.axiom.om.OMElement#getAllAttributes() */ public Iterator getAllAttributes() { if (attributes == null) { return EMPTY_ITERATOR; } ArrayList list = new ArrayList(); for (int i = 0; i < attributes.getLength(); i++) { OMAttribute item = (OMAttribute) attributes.getItem(i); if (item.getNamespace() == null || !(item.getNamespace() != null && OMConstants.XMLNS_NS_URI .equals(item.getNamespace().getNamespaceURI()))) { list.add(item); } } return list.iterator(); } /** * Returns the local name of this element node * * @see org.w3c.dom.Node#getLocalName() */ public String getLocalName() { return this.localName; } /** * Returns the namespace prefix of this element node * * @see org.w3c.dom.Node#getPrefix() */ public String getPrefix() { return (this.namespace == null) ? null : this.namespace.getPrefix(); } /** @see NodeImpl#setOwnerDocument (org.apache.axiom.om.impl.dom.DocumentImpl) */ protected void setOwnerDocument(DocumentImpl document) { this.ownerNode = document; this.isOwned(true); if (document.firstChild == null) { document.firstChild = this; } } public QName resolveQName(String qname) { int idx = qname.indexOf(':'); if (idx == -1) { OMNamespace ns = getDefaultNamespace(); return ns == null ? new QName(qname) : new QName(ns.getNamespaceURI(), qname, ""); } else { String prefix = qname.substring(0, idx); OMNamespace ns = findNamespace(null, prefix); return ns == null ? null : new QName(ns.getNamespaceURI(), qname.substring(idx+1), prefix); } } /** * Creates a clone which belongs to a new document. * * @see org.apache.axiom.om.OMElement#cloneOMElement() */ public OMElement cloneOMElement() { return (ElementImpl) this.cloneNode(true); } public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } public int getLineNumber() { return lineNumber; } public Node cloneNode(boolean deep) { ElementImpl newnode = (ElementImpl) super.cloneNode(deep); // Replicate NamedNodeMap rather than sharing it. if (attributes != null) { newnode.attributes = (AttributeMap) attributes.cloneMap(newnode); } return newnode; } /** Returns the set of attributes of this node and the namespace declarations available. */ public NamedNodeMap getAttributes() { AttributeMap attributeMap = new AttributeMap(this); // Add the set of existing attrs for (int i = 0; i < this.attributes.getLength(); i++) { attributeMap.addItem((Attr) this.attributes.getItem(i)); } // Add the NS declarations if (this.namespaces != null) { Iterator nsDecls = this.namespaces.keySet().iterator(); while (nsDecls.hasNext()) { String prefix = (String) nsDecls.next(); if (prefix != null){ OMNamespace ns = (OMNamespace)this.namespaces.get(prefix); if ("".equals(prefix)) { AttrImpl attr = new AttrImpl(this.ownerNode, "xmlns", ns.getNamespaceURI(), this.factory); attr.setOMNamespace(XMLNS_NAMESPACE_WITHOUT_PREFIX); attributeMap.addItem(attr); } else { AttrImpl attr = new AttrImpl(this.ownerNode, prefix, ns.getNamespaceURI(), this.factory); attr.setOMNamespace(XMLNS_NAMESPACE_WITH_PREFIX); attributeMap.addItem(attr); } } } } return attributeMap; } /** * Returns the namespace uri, given the prefix. If it is not found at this element, searches the * parent. * * @param prefix * @return Returns namespace. */ public String getNamespaceURI(String prefix) { OMNamespace ns = this.findNamespaceURI(prefix); return (ns != null) ? ns.getNamespaceURI() : null; } /** * Removes a declared namespace given its prefix. * * @param prefix * @return Returns whether the namespace relevant to the given prefix was removed or not */ public boolean removeNamespace(String prefix) { Object ns = this.namespaces.get(prefix); if (ns != null) { this.namespaces.remove(prefix); return true; } else { return false; } } public OMNode getNextOMSibling() throws OMException { while (!done) { int token = builder.next(); if (token == XMLStreamConstants.END_DOCUMENT) { throw new OMException(); } } return super.getNextOMSibling(); } public void discard() throws OMException { if (done) { this.detach(); } else { builder.discard(this); } } /* * DOM-Level 3 methods */ public void setIdAttribute(String name, boolean isId) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } //find the attr AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name); if (tempAttr == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } this.updateIsId(isId, tempAttr); } public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } //find the attr AttrImpl tempAttr = (AttrImpl) this.getAttributeNodeNS(namespaceURI, localName); if (tempAttr == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } this.updateIsId(isId, tempAttr); } public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } //find the attr Iterator attrIter = this.getAllAttributes(); AttrImpl tempAttr = null; while (attrIter.hasNext()) { AttrImpl attr = (AttrImpl) attrIter.next(); if (attr.equals(idAttr)) { tempAttr = attr; break; } } if (tempAttr == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } this.updateIsId(isId, tempAttr); } /** * Updates the id state of the attr and notifies the document * * @param isId * @param tempAttr */ private void updateIsId(boolean isId, AttrImpl tempAttr) { tempAttr.isId = isId; if (isId) { this.ownerNode.addIdAttr(tempAttr); } else { this.ownerNode.removeIdAttr(tempAttr); } } public TypeInfo getSchemaTypeInfo() { // TODO TODO throw new UnsupportedOperationException("TODO"); } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#buildAll() */ public void buildWithAttachments() { if (!done) { this.build(); } Iterator iterator = getChildren(); while (iterator.hasNext()) { OMNode node = (OMNode) iterator.next(); node.buildWithAttachments(); } } } ./src/org/apache/axiom/om/impl/dom/NodeListImpl.java0000664000175000017500000000354711767656530021473 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.Iterator; /** Implementation of org.w3c.dom.NodeList */ public abstract class NodeListImpl implements NodeList { protected abstract Iterator getIterator(); /** * Returns the number of nodes. * * @see org.w3c.dom.NodeList#getLength() */ public int getLength() { Iterator children = getIterator(); int count = 0; while (children.hasNext()) { count++; children.next(); } return count; } /** * Returns the node at the given index. Returns null if the index is invalid. * * @see org.w3c.dom.NodeList#item(int) */ public Node item(int index) { Iterator children = getIterator(); int count = 0; while (children.hasNext()) { if (count == index) { return (Node) children.next(); } else { children.next(); } count++; } return null; } } ./src/org/apache/axiom/om/impl/dom/ChildNode.java0000664000175000017500000001644411767656530020761 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.OMNodeEx; import org.w3c.dom.Node; public abstract class ChildNode extends NodeImpl { protected ChildNode previousSibling; protected ChildNode nextSibling; protected ParentNode parentNode; /** @param ownerDocument */ protected ChildNode(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); } protected ChildNode(OMFactory factory) { super(factory); } public OMNode getNextOMSibling() throws OMException { while (nextSibling == null && this.parentNode != null && !this.parentNode.done) { this.parentNode.buildNext(); } return nextSibling; } public OMNode getNextOMSiblingIfAvailable() { return nextSibling; } public Node getNextSibling() { return (Node) this.getNextOMSibling(); } public OMNode getPreviousOMSibling() { return this.previousSibling; } public Node getPreviousSibling() { return this.previousSibling; } // / // /OMNode methods // / public void setNextOMSibling(OMNode node) { if (node == null) { this.nextSibling = null; return; } if (node instanceof ChildNode) { this.nextSibling = (ChildNode) node; } else { throw new OMException("The node is not a " + ChildNode.class); } } public void setPreviousOMSibling(OMNode node) { if (node == null) { this.previousSibling = null; return; } if (node instanceof ChildNode) { this.previousSibling = (ChildNode) node; } else { throw new OMException("The node is not a " + ChildNode.class); } } public OMContainer getParent() throws OMException { return this.parentNode; } public Node getParentNode() { return this.parentNode; } public void setParent(OMContainer element) { if (element == null || element instanceof ParentNode) { this.parentNode = (ParentNode) element; } else { throw new OMException("The given parent is not of the type " + ParentNode.class); } } public OMNode detach() throws OMException { if (this.parentNode == null) { throw new OMException("Parent level elements cannot be detached"); } else { if (!done) { build(); } getNextOMSibling(); // Make sure that nextSibling is set correctly if (previousSibling == null) { // This is the first child if (nextSibling != null) { this.parentNode.setFirstChild(nextSibling); } else { this.parentNode.firstChild = null; this.parentNode.lastChild = null; } } else { this.previousSibling.setNextOMSibling(nextSibling); if (nextSibling == null) { this.previousSibling.parentNode.done = true; } } if (this.nextSibling != null) { this.nextSibling.setPreviousOMSibling(this.previousSibling); } if (this.parentNode != null && this.parentNode.lastChild == this) { this.parentNode.lastChild = previousSibling; } this.parentNode = null; } return this; } public void discard() throws OMException { throw new UnsupportedOperationException("Cannot discard this node"); } /** Inserts the given sibling next to this item. */ public void insertSiblingAfter(OMNode sibling) throws OMException { if (this.parentNode == null) { throw new OMException("Parent can not be null"); } else if (this == sibling) { throw new OMException("Inserting self as the sibling is not allowed"); } ((OMNodeEx) sibling).setParent(this.parentNode); if (sibling instanceof ChildNode) { ChildNode domSibling = (ChildNode) sibling; domSibling.previousSibling = this; if (this.nextSibling == null) { this.parentNode.setLastChild(sibling); } else { this.nextSibling.previousSibling = domSibling; } domSibling.nextSibling = this.nextSibling; this.nextSibling = domSibling; } else { throw new OMException("The given child is not of type " + ChildNode.class); } } /** Inserts the given sibling before this item. */ public void insertSiblingBefore(OMNode sibling) throws OMException { // ((OMNodeEx)sibling).setParent(this.parentNode); if (this.parentNode == null) { throw new OMException("Parent can not be null"); } else if (this == sibling) { throw new OMException("Inserting self as the sibling is not allowed"); } if (sibling instanceof ChildNode) { // ChildNode domSibling = (ChildNode)sibling; // domSibling.nextSibling = this; // if(this.previousSibling != null) { // this.previousSibling.nextSibling = domSibling; // } // domSibling.previousSibling = this.previousSibling; // this.previousSibling = domSibling; ChildNode siblingImpl = (ChildNode) sibling; siblingImpl.nextSibling = this; if (previousSibling == null) { this.parentNode.setFirstChild(siblingImpl); siblingImpl.previousSibling = null; } else { siblingImpl.setParent(this.parentNode); previousSibling.setNextOMSibling(siblingImpl); siblingImpl.setPreviousOMSibling(previousSibling); } previousSibling = siblingImpl; } else { throw new OMException("The given child is not of type " + ChildNode.class); } } public Node cloneNode(boolean deep) { ChildNode newnode = (ChildNode) super.cloneNode(deep); // Need to break the association w/ original kids newnode.previousSibling = null; newnode.nextSibling = null; newnode.isFirstChild(false); newnode.parentNode = null; return newnode; } } ./src/org/apache/axiom/om/impl/dom/jaxp/0000775000175000017500000000000011767656530017216 5ustar brianbrian./src/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java0000664000175000017500000001311611767656530023772 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.jaxp; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.dom.DOMImplementationImpl; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.util.StAXUtils; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.validation.Schema; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** * @deprecated see {@link DocumentBuilderFactoryImpl} */ public class DocumentBuilderImpl extends DocumentBuilder { /** The DocumentBuilderFactory used to create this document builder */ private DocumentBuilderFactoryImpl factory; protected DocumentBuilderImpl(DocumentBuilderFactoryImpl fac) { super(); this.factory = fac; } /** * Returns whether the parser is configured to understand namespaces or not. The StAX parser * used by this DOM impl is namespace aware therefore this will always return true. * * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware() */ public boolean isNamespaceAware() { return true; } /** * The StAX builder used is the org.apache.axiom.om.impl.llom.StAXOMBuilder is a validating * builder. * * @see javax.xml.parsers.DocumentBuilder#isValidating() */ public boolean isValidating() { return true; } public DOMImplementation getDOMImplementation() { return new DOMImplementationImpl(); } /** * Returns a new document impl. * * @see javax.xml.parsers.DocumentBuilder#newDocument() */ public Document newDocument() { OMDOMFactory factory = new OMDOMFactory(); DocumentImpl documentImpl = new DocumentImpl(factory); documentImpl.setComplete(true); return documentImpl; } public void setEntityResolver(EntityResolver arg0) { // TODO } public void setErrorHandler(ErrorHandler arg0) { // TODO } public Document parse(InputSource inputSource) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); // Not really sure whether this will work :-? XMLStreamReader reader = StAXUtils .createXMLStreamReader(inputSource.getCharacterStream()); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); DocumentImpl doc = (DocumentImpl) builder.getDocument(); ((ElementImpl) doc.getDocumentElement()).build(); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */ public Document parse(InputStream is) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); XMLStreamReader reader = StAXUtils .createXMLStreamReader(is); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.File) */ public Document parse(File file) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); XMLStreamReader reader = StAXUtils .createXMLStreamReader(new FileInputStream(file)); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream, String) */ public Document parse(InputStream is, String systemId) throws SAXException, IOException { // TODO throw new UnsupportedOperationException("TODO"); } /** @see javax.xml.parsers.DocumentBuilder#parse(String) */ public Document parse(String uri) throws SAXException, IOException { // TODO throw new UnsupportedOperationException("TODO"); } /* (non-Javadoc) * @see javax.xml.parsers.DocumentBuilder#getSchema() */ public Schema getSchema() { //HACK : To get opensaml working return this.factory.schema; } } ./src/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java0000664000175000017500000000360111767656530025155 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.jaxp; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; /** * Document builder factory that conforms to JAXP. */ public class DOOMDocumentBuilderFactory extends DocumentBuilderFactory { public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { return new DOOMDocumentBuilder(); } public Object getAttribute(String arg0) throws IllegalArgumentException { // TODO throw new UnsupportedOperationException("TODO"); } public void setAttribute(String arg0, Object arg1) throws IllegalArgumentException { // // TODO // throw new UnsupportedOperationException("TODO"); } public void setFeature(String name, boolean value) throws ParserConfigurationException { // TODO TODO OS } public boolean getFeature(String arg0) throws ParserConfigurationException { // TODO TODO throw new UnsupportedOperationException("TODO"); } } ./src/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java0000664000175000017500000001261511767656530025325 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.jaxp; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.validation.Schema; /** * @deprecated * This class has static methods that allow to switch between DOOM and the default * DOM implementation as returned by JAXP. This was a hack introduced for Rampart. * Recent versions of Rampart no longer rely on this hack. On the other hand * usage of {@link #setDOOMRequired(boolean)} in a concurrent environment can * lead to unexpected behavior and severe bugs, as shown in WSCOMMONS-210 and AXIS2-1570. * Due to the way {@link #newDocumentBuilder()} is implemented, it is not possible * to get rid of the setDOOMRequired hack without the risk of breaking existing code. * Therefore this class has been deprecated in favor of {@link DOOMDocumentBuilderFactory}. */ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { /** * Temporary solution until DOOM's DocumentBuilder module is done. Use ThreadLocal to determine * whether or not DOOM implementation is required. By default (isDOOMRequired() == false), we * will use the one from JDK (Crimson) */ private static DocumentBuilderFactory originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); private static String originalDocumentBuilderFactoryClassName = null; private static ThreadLocal documentBuilderFactoryTracker = new ThreadLocal(); protected Schema schema; public static boolean isDOOMRequired() { Object value = documentBuilderFactoryTracker.get(); return (value != null); } public static void setDOOMRequired(boolean isDOOMRequired) { String systemKey = DocumentBuilderFactory.class.getName(); if (isDOOMRequired) { if (!isDOOMRequired()) { originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); originalDocumentBuilderFactoryClassName = originalDocumentBuilderFactory.getClass().getName(); documentBuilderFactoryTracker.set(Boolean.TRUE); System.setProperty(systemKey, DocumentBuilderFactoryImpl.class.getName()); } } else { String currentFactoryClassName = DocumentBuilderFactory.newInstance().getClass().getName(); if (currentFactoryClassName != null && currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName())) { System.getProperties().remove(systemKey); if (originalDocumentBuilderFactoryClassName != null) { System.setProperty(DocumentBuilderFactory.class.getName(), originalDocumentBuilderFactoryClassName); } } documentBuilderFactoryTracker.set(null); originalDocumentBuilderFactory = null; } } public DocumentBuilderFactoryImpl() { super(); } public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { /** * Determine which DocumentBuilder implementation should be returned */ return isDOOMRequired() ? new DocumentBuilderImpl(this) : originalDocumentBuilderFactory.newDocumentBuilder(); } public Object getAttribute(String arg0) throws IllegalArgumentException { // TODO throw new UnsupportedOperationException("TODO"); } public void setAttribute(String arg0, Object arg1) throws IllegalArgumentException { // // TODO // throw new UnsupportedOperationException("TODO"); } public static DocumentBuilderFactory newInstance() { return new DocumentBuilderFactoryImpl(); } public void setFeature(String name, boolean value) throws ParserConfigurationException { // TODO TODO OS } public boolean getFeature(String arg0) throws ParserConfigurationException { // TODO TODO throw new UnsupportedOperationException("TODO"); } /* (non-Javadoc) * @see javax.xml.parsers.DocumentBuilderFactory#setSchema(javax.xml.validation.Schema) */ public void setSchema(Schema schema) { //HACK: Overriding to get opensaml working !! this.schema = schema; } /* (non-Javadoc) * @see javax.xml.parsers.DocumentBuilderFactory#getSchema() */ public Schema getSchema() { //HACK: Overriding to get opensaml working !! return this.schema; } } ./src/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java0000664000175000017500000001145011767656530023626 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.jaxp; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.dom.DOMImplementationImpl; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.util.StAXUtils; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class DOOMDocumentBuilder extends DocumentBuilder { protected DOOMDocumentBuilder() { } /** * Returns whether the parser is configured to understand namespaces or not. The StAX parser * used by this DOM impl is namespace aware therefore this will always return true. * * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware() */ public boolean isNamespaceAware() { return true; } /** * The StAX builder used is the org.apache.axiom.om.impl.llom.StAXOMBuilder is a validating * builder. * * @see javax.xml.parsers.DocumentBuilder#isValidating() */ public boolean isValidating() { return true; } public DOMImplementation getDOMImplementation() { return new DOMImplementationImpl(); } /** * Returns a new document impl. * * @see javax.xml.parsers.DocumentBuilder#newDocument() */ public Document newDocument() { OMDOMFactory factory = new OMDOMFactory(); DocumentImpl documentImpl = new DocumentImpl(factory); documentImpl.setComplete(true); return documentImpl; } public void setEntityResolver(EntityResolver arg0) { // TODO } public void setErrorHandler(ErrorHandler arg0) { // TODO } public Document parse(InputSource inputSource) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); // Not really sure whether this will work :-? XMLStreamReader reader = StAXUtils .createXMLStreamReader(inputSource.getCharacterStream()); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); DocumentImpl doc = (DocumentImpl) builder.getDocument(); doc.close(true); return doc; } catch (XMLStreamException e) { throw new SAXException(e); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */ public Document parse(InputStream is) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); XMLStreamReader reader = StAXUtils .createXMLStreamReader(is); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); DocumentImpl doc = (DocumentImpl) builder.getDocument(); doc.close(true); return doc; } catch (XMLStreamException e) { throw new SAXException(e); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.File) */ public Document parse(File file) throws SAXException, IOException { FileInputStream in = new FileInputStream(file); try { return parse(in); } finally { in.close(); } } /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream, String) */ public Document parse(InputStream is, String systemId) throws SAXException, IOException { // TODO throw new UnsupportedOperationException("TODO"); } /** @see javax.xml.parsers.DocumentBuilder#parse(String) */ public Document parse(String uri) throws SAXException, IOException { // TODO throw new UnsupportedOperationException("TODO"); } } ./src/org/apache/axiom/om/impl/dom/OMDOMException.java0000664000175000017500000000245611767656530021660 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMException; /** OMDOM specific exception */ public class OMDOMException extends OMException { private static final long serialVersionUID = 8763119035210190906L; public OMDOMException() { super(); } public OMDOMException(String arg0) { super(arg0); } public OMDOMException(Throwable arg0) { super(arg0); } public OMDOMException(String arg0, Throwable arg1) { super(arg0, arg1); } } ./src/org/apache/axiom/om/impl/dom/TextNodeImpl.java0000664000175000017500000003766711767656530021516 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.attachments.utils.DataHandlerUtils; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.builder.XOPBuilder; import org.apache.axiom.util.UIDGenerator; import org.apache.axiom.util.base64.Base64Utils; import org.apache.axiom.util.stax.XMLStreamWriterUtils; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.Text; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.io.InputStream; public abstract class TextNodeImpl extends CharacterImpl implements Text, OMText { private String mimeType; private boolean optimize; private boolean isBinary; private String contentID = null; protected OMNamespace textNS = null; protected char[] charArray; /** * Field dataHandler contains the DataHandler. Declaring as Object to remove the dependency on * Javax.activation.DataHandler */ private Object dataHandlerObject = null; /** * Creates a text node with the given text required by the OMDOMFactory. The owner document * should be set properly when appending this to a DOM tree. * * @param text */ public TextNodeImpl(String text, OMFactory factory) { super(factory); //this.textValue = (text != null) ? new StringBuffer(text) // : new StringBuffer(""); this.textValue = (text != null) ? text : ""; this.done = true; } /** * @param contentID * @param parent * @param builder Used when the builder is encountered with a XOP:Include tag Stores a * reference to the builder and the content-id. Supports deffered parsing of * MIME messages */ public TextNodeImpl(String contentID, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory) { super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory); this.contentID = contentID; this.optimize = true; this.isBinary = true; this.done = true; this.builder = builder; } /** * Construct TextImpl that is a copy of the source OMTextImpl * * @param parent * @param source TextImpl * @param factory */ public TextNodeImpl(OMContainer parent, TextNodeImpl source, OMFactory factory) { super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory); this.done = true; // Copy the value of the text if (source.textValue != null) { this.textValue = source.textValue; } // Clone the charArray (if it exists) if (source.charArray != null) { this.charArray = new char[source.charArray.length]; for (int i = 0; i < source.charArray.length; i++) { this.charArray[i] = source.charArray[i]; } } // Turn off textNS...the namespace will need to be recalculated // in the new tree's context. this.textNS = null; // Copy the optimized related settings. this.optimize = source.optimize; this.mimeType = source.mimeType; this.isBinary = source.isBinary; // TODO // Do we need a deep copy of the data-handler this.contentID = source.contentID; this.dataHandlerObject = source.dataHandlerObject; } public TextNodeImpl(String text, String mimeType, boolean optimize, OMFactory factory) { this(text, mimeType, optimize, true, factory); } public TextNodeImpl(String text, String mimeType, boolean optimize, boolean isBinary, OMFactory factory) { this(text, factory); this.mimeType = mimeType; this.optimize = optimize; this.isBinary = isBinary; } /** * @param dataHandler * @param optimize To send binary content. Created progrmatically. */ public TextNodeImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory) { super(ownerNode, factory); this.dataHandlerObject = dataHandler; this.isBinary = true; this.optimize = optimize; done = true; } /** * Constructor. * * @param contentID * @param dataHandlerProvider * @param optimize * @param factory */ public TextNodeImpl(DocumentImpl ownerNode, String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize, OMFactory factory) { super(ownerNode, factory); this.contentID = contentID; dataHandlerObject = dataHandlerProvider; isBinary = true; this.optimize = optimize; done = true; } /** * @param ownerNode */ public TextNodeImpl(DocumentImpl ownerNode, OMFactory factory) { super(ownerNode, factory); this.done = true; } /** * @param ownerNode * @param value */ public TextNodeImpl(DocumentImpl ownerNode, String value, OMFactory factory) { super(ownerNode, value, factory); this.done = true; } public TextNodeImpl(DocumentImpl ownerNode, char[] value, OMFactory factory) { super(ownerNode, factory); this.charArray = value; this.done = true; } /** * @param ownerNode * @param value */ public TextNodeImpl(DocumentImpl ownerNode, String value, String mimeType, boolean optimize, OMFactory factory) { this(ownerNode, value, factory); this.mimeType = mimeType; this.optimize = optimize; this.isBinary = true; done = true; } public TextNodeImpl(OMContainer parent, QName text, OMFactory factory) { this(parent, text, OMNode.TEXT_NODE, factory); } public TextNodeImpl(OMContainer parent, QName text, int nodeType, OMFactory factory) { this(((ElementImpl) parent).ownerNode, factory); if (text != null) { this.textNS = ((ElementImpl) parent).findNamespace(text.getNamespaceURI(), text.getPrefix()); } else { } this.textValue = (text == null) ? "" : text.getLocalPart(); this.done = true; } /** * Breaks this node into two nodes at the specified offset, keeping both in the tree as * siblings. After being split, this node will contain all the content up to the offset point. A * new node of the same type, which contains all the content at and after the offset point, is * returned. If the original node had a parent node, the new node is inserted as the next * sibling of the original node. When the offset is equal to the length of this node, the new * node has no data. */ public Text splitText(int offset) throws DOMException { if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } if (offset < 0 || offset > this.textValue.length()) { throw new DOMException(DOMException.INDEX_SIZE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR, null)); } String newValue = this.textValue.substring(offset); this.deleteData(offset, this.textValue.length()); TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode( newValue); if (this.parentNode != null) { newText.setParent(this.parentNode); } this.insertSiblingAfter(newText); return newText; } // / // /org.w3c.dom.Node methods // / public String getNodeName() { return "#text"; } public short getNodeType() { return Node.TEXT_NODE; } // / // /OMNode methods // / public boolean isOptimized() { return this.optimize; } public void setOptimize(boolean value) { this.optimize = value; if (value) { isBinary = true; } } public void discard() throws OMException { if (done) { this.detach(); } } /** * Writes the relevant output. * * @param writer * @throws XMLStreamException */ private void writeOutput(XMLStreamWriter writer) throws XMLStreamException { int type = getType(); if (type == OMNode.TEXT_NODE || type == SPACE_NODE) { writer.writeCharacters(this.getText()); } else if (type == OMNode.CDATA_SECTION_NODE) { writer.writeCData(this.getText()); } else if (type == OMNode.ENTITY_REFERENCE_NODE) { writer.writeEntityRef(this.getText()); } } public String getText() { if (this.textNS != null) { return getTextString(); } else if (this.charArray != null || this.textValue != null) { return getTextFromProperPlace(); } else { try { return Base64Utils.encode((DataHandler) getDataHandler()); } catch (Exception e) { throw new OMException(e); } } } public String getData() throws DOMException { return this.getText(); } public char[] getTextCharacters() { return charArray != null ? charArray : this.textValue.toCharArray(); } public boolean isCharacters() { return charArray != null; } private String getTextFromProperPlace() { return charArray != null ? new String(charArray) : textValue; } private String getTextString() { if (textNS != null) { String prefix = textNS.getPrefix(); if (prefix == null || "".equals(prefix)) { return getTextFromProperPlace(); } else { return prefix + ":" + getTextFromProperPlace(); } } return null; } public QName getTextAsQName() { if (textNS != null) { String prefix = textNS.getPrefix(); String name = textNS.getNamespaceURI(); if (prefix == null || "".equals(prefix)) { return new QName(name, getTextFromProperPlace()); } else { return new QName(textNS.getNamespaceURI(), getTextFromProperPlace(), prefix); } } else if (this.textValue != null || charArray != null) { return new QName(getTextFromProperPlace()); } else { try { // TODO: do we really want to build a QName from base64 encoded data?!? return new QName(Base64Utils.encode((DataHandler) getDataHandler())); } catch (Exception e) { throw new OMException(e); } } } public String getNodeValue() throws DOMException { return this.getText(); } public String getContentID() { if (contentID == null) { contentID = UIDGenerator.generateContentId(); } return this.contentID; } public Object getDataHandler() { /* * this should return a DataHandler containing the binary data * reperesented by the Base64 strings stored in OMText */ if ((textValue != null || charArray != null || textNS != null) & isBinary) { String text = textNS == null ? getTextFromProperPlace() : getTextString(); return DataHandlerUtils .getDataHandlerFromText(text, mimeType); } else { if (dataHandlerObject == null) { if (contentID == null) { throw new RuntimeException("ContentID is null"); } dataHandlerObject = ((XOPBuilder) builder) .getDataHandler(contentID); } else if (dataHandlerObject instanceof DataHandlerProvider) { try { dataHandlerObject = ((DataHandlerProvider) dataHandlerObject).getDataHandler(); } catch (IOException ex) { throw new OMException(ex); } } return dataHandlerObject; } } public java.io.InputStream getInputStream() throws OMException { if (isBinary) { if (dataHandlerObject == null) { getDataHandler(); } InputStream inStream; javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject; try { inStream = dataHandler.getDataSource().getInputStream(); } catch (IOException e) { throw new OMException( "Cannot get InputStream from DataHandler.", e); } return inStream; } else { throw new OMException("Unsupported Operation"); } } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { if (!this.isBinary) { writeOutput(writer); } else { try { XMLStreamWriterUtils.writeDataHandler(writer, (DataHandler) getDataHandler(), contentID, optimize); } catch (IOException ex) { throw new OMException("Error reading data handler", ex); } } } /* * DOM-Level 3 methods */ public String getWholeText() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public boolean isElementContentWhitespace() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public Text replaceWholeText(String arg0) throws DOMException { // TODO TODO throw new UnsupportedOperationException("TODO"); } public String toString() { return (this.textValue != null) ? textValue : ""; } /* (non-Javadoc) * @see org.apache.axiom.om.OMNode#buildAll() */ public void buildWithAttachments() { this.build(); if (isOptimized()) { this.getDataHandler(); } } public boolean isBinary() { return isBinary; } /** * Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 * user has to explicitly specify that the content is binary, before calling getDataHandler(), * getInputStream().... */ public void setBinary(boolean value) { this.isBinary = value; } public OMNamespace getNamespace() { return textNS; } public void setContentID(String cid) { this.contentID = cid; } } ./src/org/apache/axiom/om/impl/dom/DOOMAbstractFactory.java0000664000175000017500000000260511767656530022674 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory; import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory; public class DOOMAbstractFactory { public static OMFactory getOMFactory() { return new OMDOMFactory(); } public static SOAPFactory getSOAP11Factory() { return new SOAP11Factory(); } public static SOAPFactory getSOAP12Factory() { return new SOAP12Factory(); } } ./src/org/apache/axiom/om/impl/dom/DOMUtil.java0000664000175000017500000000510311767656530020373 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; /** Utility class for the OM-DOM implementation */ class DOMUtil { public static boolean isQualifiedName(String value) { // TODO check for valid characters // throw new UnsupportedOperationException("TODO"); return true; } /** * @deprecated please use isQualifiedName * @param value * @return */ public static boolean isValidChras(String value) { // TODO check for valid characters // throw new UnsupportedOperationException("TODO"); return true; } public static boolean isValidNamespace(String namespaceURI, String qualifiedname) { // TODO check for valid namespace /** * if the qualifiedName has a prefix and the namespaceURI is null, if * the qualifiedName has a prefix that is "xml" and the namespaceURI is * different from " http://www.w3.org/XML/1998/namespace", or if the * qualifiedName, or its prefix, is "xmlns" and the namespaceURI is * different from " http://www.w3.org/2000/xmlns/". */ // throw new UnsupportedOperationException("TODO"); // temporary fix return true; } /** * Get the local name from a qualified name * * @param qualifiedName */ public static String getLocalName(String qualifiedName) { int idx = qualifiedName.indexOf(':'); return idx == -1 ? qualifiedName : qualifiedName.substring(idx+1); } /** * Get the prefix from a qualified name * * @param qualifiedName */ public static String getPrefix(String qualifiedName) { int idx = qualifiedName.indexOf(':'); return idx == -1 ? null : qualifiedName.substring(0, idx); } } ./src/org/apache/axiom/om/impl/dom/AttrImpl.java0000664000175000017500000004070311767656530020657 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.TypeInfo; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** Implementation of org.w3c.dom.Attr and org.apache.axiom.om.OMAttribute */ public class AttrImpl extends NodeImpl implements OMAttribute, Attr { /** Name of the attribute */ private String attrName; /** Attribute value */ private TextImpl attrValue; /** Attribute type */ private String attrType; /** Attribute namespace */ private NamespaceImpl namespace; /** Flag to indicate whether this attr is used or not */ private boolean used; /** Owner of this attribute */ protected ParentNode parent; /** Flag used to mark an attribute as per the DOM Level 3 specification */ protected boolean isId; protected AttrImpl(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); } public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace ns, String value, OMFactory factory) { super(ownerDocument, factory); this.attrName = localName; this.attrValue = new TextImpl(ownerDocument, value, factory); this.attrType = OMConstants.XMLATTRTYPE_CDATA; this.namespace = (NamespaceImpl) ns; } public AttrImpl(DocumentImpl ownerDocument, String name, String value, OMFactory factory) { super(ownerDocument, factory); this.attrName = name; this.attrValue = new TextImpl(ownerDocument, value, factory); this.attrType = OMConstants.XMLATTRTYPE_CDATA; } public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory) { super(ownerDocument, factory); this.attrName = name; //If this is a default namespace attr if (OMConstants.XMLNS_NS_PREFIX.equals(name)) { this.namespace = new NamespaceImpl( OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX); } this.attrType = OMConstants.XMLATTRTYPE_CDATA; } public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace namespace, OMFactory factory) { super(ownerDocument, factory); this.attrName = localName; this.namespace = (NamespaceImpl) namespace; this.attrType = OMConstants.XMLATTRTYPE_CDATA; } // / // /org.w3c.dom.Node methods // / /** Returns the name of this attribute. */ public String getNodeName() { return (this.namespace != null && !"".equals(this.namespace.getPrefix()) && !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) ? this.namespace.getPrefix() + ":" + this.attrName : this.attrName; } /** * Returns the node type. * * @see org.w3c.dom.Node#getNodeType() */ public short getNodeType() { return Node.ATTRIBUTE_NODE; } /** * Returns the value of this attribute. * * @see org.w3c.dom.Node#getNodeValue() */ public String getNodeValue() throws DOMException { return (this.attrValue == null) ? "" : this.attrValue.getData(); } /** * Returns the value of this attribute. * * @see org.w3c.dom.Attr#getValue() */ public String getValue() { return (this.attrValue == null) ? null : this.attrValue.getText(); } // / // /org.w3c.dom.Attr methods // / public String getName() { if (this.namespace != null) { if ((OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) { return this.attrName; } else if (OMConstants.XMLNS_NS_URI.equals(this.namespace.getNamespaceURI())) { return OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName; } else if (this.namespace.getPrefix().equals("")) { return this.attrName; } else { return this.namespace.getPrefix() + ":" + this.attrName; } } else { return this.attrName; } } /** * Returns the owner element. * * @see org.w3c.dom.Attr#getOwnerElement() */ public Element getOwnerElement() { // Owned is set to an element instance when the attribute is added to an // element return (Element) (isOwned() ? parent : null); } public boolean getSpecified() { // Since we don't support DTD or schema, we always return true return true; } /** * Not supported: Cannot detach attributes. Use the operations available in the owner node. * * @see org.apache.axiom.om.OMNode#detach() */ public OMNode detach() throws OMException { throw new UnsupportedOperationException("Not supported"); } /** * Not supported: Cannot discard attributes. Use the operations available in the owner node. * * @see org.apache.axiom.om.OMNode#discard() */ public void discard() throws OMException { throw new UnsupportedOperationException("Not supported"); } /** * Returns the type of this attribute node. * * @see org.apache.axiom.om.OMNode#getType() */ public int getType() { return -1; } /** * This is not supported since attributes serialization is handled by the serialization of the * owner nodes. */ public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { throw new UnsupportedOperationException("Not supported"); } /** * Returns the namespace of the attribute as an OMNamespace. * * @see org.apache.axiom.om.OMAttribute#getNamespace() */ public OMNamespace getNamespace() { return this.namespace; } /** * Returns a qname representing the attribute. * * @see org.apache.axiom.om.OMAttribute#getQName() */ public QName getQName() { return (namespace == null) ? new QName(this.attrName) : // This next bit is because QName is kind of stupid, and throws an // IllegalArgumentException on null prefix instead of treating it exactly // as if no prefix had been passed. Grr. (namespace.getPrefix() == null ? new QName(namespace.getNamespaceURI(), attrName) : new QName(namespace.getNamespaceURI(), attrName, namespace.getPrefix())); } /** * Returns the attribute value. * * @see org.apache.axiom.om.OMAttribute#getAttributeValue() */ public String getAttributeValue() { return this.attrValue.getText(); } /** * Returns the attribute value. * * @see org.apache.axiom.om.OMAttribute#getAttributeType() */ public String getAttributeType() { return this.attrType; } /** * Sets the name of attribute. * * @see org.apache.axiom.om.OMAttribute#setLocalName(String) */ public void setLocalName(String localName) { this.attrName = localName; } /** * Sets the namespace of this attribute node. * * @see org.apache.axiom.om.OMAttribute#setOMNamespace (org.apache.axiom.om.OMNamespace) */ public void setOMNamespace(OMNamespace omNamespace) { this.namespace = (NamespaceImpl) omNamespace; } /** * Sets the attribute value. * * @see org.apache.axiom.om.OMAttribute#setAttributeValue(String) */ public void setAttributeValue(String value) { if (isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode( value); } /** * Sets the attribute value. * * @see org.apache.axiom.om.OMAttribute#setAttributeType(String) */ public void setAttributeType(String attrType) { this.attrType = attrType; } /** * Sets the parent element to the given OMContainer. * * @see org.apache.axiom.om.impl.OMNodeEx#setParent (org.apache.axiom.om.OMContainer) */ public void setParent(OMContainer element) { this.parent = (ParentNode) element; } /** * Sets the type. NOT IMPLEMENTED: Unnecessary. * * @see org.apache.axiom.om.impl.OMNodeEx#setType(int) */ public void setType(int nodeType) throws OMException { // not necessary ??? } /** @return Returns boolean. */ protected boolean isUsed() { return used; } /** @param used The used to set. */ protected void setUsed(boolean used) { this.used = used; } /** * Sets the value of the attribute. * * @see org.w3c.dom.Attr#setValue(String) */ public void setValue(String value) throws DOMException { this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode( value); } /** * Returns the parent node of this attribute. * * @see org.apache.axiom.om.OMNode#getParent() */ public OMContainer getParent() { return this.parent; } /** * Returns the attribute name. * * @see org.w3c.dom.Node#getLocalName() */ public String getLocalName() { return (this.namespace == null) ? this.attrName : DOMUtil .getLocalName(this.attrName); } /** * Returns the namespace URI of this attr node. * * @see org.w3c.dom.Node#getNamespaceURI() */ public String getNamespaceURI() { return (this.namespace != null) ? namespace.getNamespaceURI() : null; } /** * Returns the namespace prefix of this attr node. * * @see org.w3c.dom.Node#getPrefix() */ public String getPrefix() { // TODO Error checking return (this.namespace == null) ? null : this.namespace.getPrefix(); } public Node cloneNode(boolean deep) { AttrImpl clone = (AttrImpl) super.cloneNode(deep); if (clone.attrValue == null) { // Need to break the association w/ original kids clone.attrValue = new TextImpl(this.attrValue.toString(), factory); if (this.attrValue.nextSibling != null) { throw new UnsupportedOperationException( "Attribute value can contain only a text " + "node with out any siblings"); } } clone.isSpecified(true); clone.setParent(null); clone.setUsed(false); return clone; } /* * DOM-Level 3 methods */ public TypeInfo getSchemaTypeInfo() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public boolean isId() { return isId; } public String toString() { return (this.namespace == null) ? this.attrName : this.namespace .getPrefix() + ":" + this.attrName; } /** * Returns the owner element of this attribute * @return OMElement - if the parent OMContainer is an instanceof OMElement * we return that OMElement else return null. To get the OMContainer itself use * getParent() method. */ public OMElement getOwner() { return (parent instanceof OMElement) ? (OMElement)parent : null; } /** * An instance of AttrImpl can act as an OMAttribute and as well as an * org.w3c.dom.Attr. So we first check if the object to compare with (obj) * is of type OMAttribute (this includes instances of OMAttributeImpl or * AttrImpl (instances of this class)). If so we check for the equality * of namespaces first (note that if the namespace of this instance is null then for the obj * to be equal its namespace must also be null). This condition solely doesn't determine the equality. * So we check for the equality of names and values (note that the value can also be null in which case * the same argument holds as that for the namespace) of the two instances. If all three conditions are * met then we say the two instances are equal. * *

        If obj is of type org.w3c.dom.Attr then we perform the same equality check * as before. Note that, however, the implementation of the test for equality in this case is little different * than before. * *

        If obj is neither of type OMAttribute nor of type org.w3c.dom.Attr * then we return false. * * @param obj The object to compare with this instance * @return True if the two objects are equal or else false. The equality is checked as explained above. */ public boolean equals(Object obj) { if (obj instanceof OMAttribute) { // Checks equality of an OMAttributeImpl or an AttrImpl with this instance OMAttribute other = (OMAttribute) obj; return (namespace == null ? other.getNamespace() == null : namespace.equals(other.getNamespace()) && attrName.equals(other.getLocalName()) && (attrValue == null ? other.getAttributeValue() == null : attrValue.toString().equals(other.getAttributeValue()))); } else if (obj instanceof Attr) {// Checks equality of an org.w3c.dom.Attr with this instance Attr other = (Attr)obj; String otherNs = other.getNamespaceURI(); if (namespace == null) { // I don't have a namespace if (otherNs != null) { return false; // I don't have a namespace and the other has. So return false } else { // Both of us don't have namespaces. So check for name and value equality only return (attrName.equals(other.getLocalName()) && (attrValue == null ? other.getValue() == null : attrValue.toString().equals(other.getValue()))); } } else { // Ok, now I've a namespace String ns = namespace.getNamespaceURI(); String prefix = namespace.getPrefix(); String otherPrefix = other.getPrefix(); // First check for namespaceURI equality. Then check for prefix equality. // Then check for name and value equality return (ns.equals(otherNs) && (prefix == null ? otherPrefix == null : prefix.equals(otherPrefix)) && (attrName.equals(other.getLocalName())) && (attrValue == null ? other.getValue() == null : attrValue.toString().equals(other.getValue()))); } } return false; } public int hashCode() { return attrName.hashCode() ^ (attrValue != null ? attrValue.toString().hashCode() : 0) ^ (namespace != null ? namespace.hashCode() : 0); } } ./src/org/apache/axiom/om/impl/dom/CharacterImpl.java0000664000175000017500000001406211767656530021640 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMFactory; import org.w3c.dom.CharacterData; import org.w3c.dom.DOMException; /** * This implements the OMText operations which are to be inherited by TextImpl, CommentImpl, * CDATASectionImpl. */ public abstract class CharacterImpl extends ChildNode implements CharacterData { protected String textValue; protected CharacterImpl(OMFactory factory) { super(factory); } /** @param ownerNode */ public CharacterImpl(DocumentImpl ownerNode, OMFactory factory) { super(ownerNode, factory); } public CharacterImpl(DocumentImpl ownerNode, String value, OMFactory factory) { super(ownerNode, factory); this.textValue = (value != null) ? value : ""; } /// ///org.w3c.dom.CharacterData mrthods /// public void appendData(String value) throws DOMException { if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } this.textValue += value; } /** * */ public void deleteData(int offset, int count) throws DOMException { this.replaceData(offset, count, null); } /** If the given data is null the content will be deleted. */ public void replaceData(int offset, int count, String data) throws DOMException { if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } int length = this.textValue.length(); if (offset < 0 || offset > length - 1 || count < 0) { throw new DOMException(DOMException.INDEX_SIZE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR, null)); } else { int end = Math.min(count + offset, length); if (data == null) { this.textValue = (new StringBuilder(textValue)).delete(offset, end).toString(); } else { this.textValue = (new StringBuilder(textValue)).replace(offset, end, data).toString(); } } } /** Returns the value of the data. */ public String getData() throws DOMException { return (this.textValue != null) ? this.textValue : ""; } /** Inserts a string at the specified offset. */ public void insertData(int offset, String data) throws DOMException { int length = this.getLength(); if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } if (offset < 0 || offset > length - 1) { throw new DOMException(DOMException.INDEX_SIZE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR, null)); } this.textValue = (new StringBuilder(textValue)).insert(offset, data).toString(); } /** Sets the text value of data. */ public void setData(String data) throws DOMException { if (!this.isReadonly()) { this.textValue = data; } else { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } } /** * Extracts a range of data from the node. * * @return Returns the specified substring. If the sum of offset and count exceeds the length, then * all 16-bit units to the end of the data are returned. */ public String substringData(int offset, int count) throws DOMException { if (offset < 0 || offset > this.getLength() || count < 0) { throw new DOMException(DOMException.INDEX_SIZE_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR, null)); } int end = Math.min(count + offset, textValue.length()); return this.textValue.substring(offset, end); } /** * Returns the length of the string value. */ public int getLength() { return (this.textValue != null) ? this.textValue.length() : 0; } } ./src/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java0000664000175000017500000000477611767656530022377 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.w3c.dom.DocumentType; import org.w3c.dom.NamedNodeMap; public class DocumentTypeImpl extends ChildNode implements DocumentType, OMDocType { private String value; public DocumentTypeImpl(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); done = true; } public String getNodeName() { return getName(); } public short getNodeType() { return DOCUMENT_TYPE_NODE; } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { throw new UnsupportedOperationException(); } public void setType(int nodeType) throws OMException { throw new UnsupportedOperationException(); } public int getType() { return DTD_NODE; } public NamedNodeMap getEntities() { throw new UnsupportedOperationException(); } public String getInternalSubset() { throw new UnsupportedOperationException(); } public String getName() { // TODO Auto-generated method stub return null; } public NamedNodeMap getNotations() { throw new UnsupportedOperationException(); } public String getPublicId() { throw new UnsupportedOperationException(); } public String getSystemId() { throw new UnsupportedOperationException(); } public String getValue() { return value; } public void setValue(String text) { value = text; } } ./src/org/apache/axiom/om/impl/dom/XMLChar.java0000664000175000017500000005472611767656530020373 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; /** * This class defines the basic XML character properties. The data in this class can be used to * verify that a character is a valid XML character or if the character is a space, name start, or * name character. *

        * A series of convenience methods are supplied to ease the burden of the developer. Because * inlining the checks can improve per character performance, the tables of character properties are * public. Using the character as an index into the CHARS array and applying the * appropriate mask flag (e.g. MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments for the isValid * method for details. */ public class XMLChar { // // Constants // /** Character flags. */ private static final byte[] CHARS = new byte[1 << 16]; /** Valid character mask. */ public static final int MASK_VALID = 0x01; /** Space character mask. */ public static final int MASK_SPACE = 0x02; /** Name start character mask. */ public static final int MASK_NAME_START = 0x04; /** Name character mask. */ public static final int MASK_NAME = 0x08; /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; /** * Content character mask. Special characters are those that can be considered the start of * markup, such as '<' and '&'. The various newline characters are considered special as * well. All other valid XML characters can be considered content. *

        * This is an optimization for the inner loop of character scanning. */ public static final int MASK_CONTENT = 0x20; /** NCName start character mask. */ public static final int MASK_NCNAME_START = 0x40; /** NCName character mask. */ public static final int MASK_NCNAME = 0x80; // // Static initialization // static { // // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | // [#xE000-#xFFFD] | [#x10000-#x10FFFF] // int charRange[] = { 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD, }; // // [3] S ::= (#x20 | #x9 | #xD | #xA)+ // int spaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; // // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | // CombiningChar | Extender // int nameChar[] = { 0x002D, 0x002E, // '-' and '.' }; // // [5] Name ::= (Letter | '_' | ':') (NameChar)* // int nameStartChar[] = { 0x003A, 0x005F, // ':' and '_' }; // // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] // int pubidChar[] = { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; int pubidRange[] = { 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A }; // // [84] Letter ::= BaseChar | Ideographic // int letterRange[] = { // BaseChar 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E, 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217, 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1, 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C, 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4, 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5, 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA, 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7, 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6, 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990, 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD, 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10, 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36, 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B, 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3, 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28, 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D, 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95, 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA, 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10, 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61, 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3, 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10, 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E, 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88, 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB, 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47, 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103, 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155, 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF, 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9, 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D, 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC, 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB, 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B, 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C, 0xAC00, 0xD7A3, // Ideographic 0x3021, 0x3029, 0x4E00, 0x9FA5, }; int letterChar[] = { // BaseChar 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, 0x1F5D, 0x1FBE, 0x2126, 0x212E, // Ideographic 0x3007, }; // // [87] CombiningChar ::= ... // int combiningCharRange[] = { 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1, 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652, 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954, 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8, 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48, 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43, 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83, 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03, 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56, 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD, 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48, 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9, 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84, 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7, 0x20D0, 0x20DC, 0x302A, 0x302F, }; int combiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; // // [88] Digit ::= ... // int digitRange[] = { 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F, 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F, 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F, 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, }; // // [89] Extender ::= ... // int extenderRange[] = { 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE, }; int extenderChar[] = { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; // // SpecialChar ::= '<', '&', '\n', '\r', ']' // int specialChar[] = { '<', '&', '\n', '\r', ']', }; // // Initialize // // set valid characters for (int i = 0; i < charRange.length; i += 2) { for (int j = charRange[i]; j <= charRange[i + 1]; j++) { CHARS[j] |= MASK_VALID | MASK_CONTENT; } } // remove special characters for (int i = 0; i < specialChar.length; i++) { CHARS[specialChar[i]] = (byte) (CHARS[specialChar[i]] & ~MASK_CONTENT); } // set space characters for (int i = 0; i < spaceChar.length; i++) { CHARS[spaceChar[i]] |= MASK_SPACE; } // set name start characters for (int i = 0; i < nameStartChar.length; i++) { CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } for (int i = 0; i < letterRange.length; i += 2) { for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) { CHARS[j] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } } for (int i = 0; i < letterChar.length; i++) { CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } // set name characters for (int i = 0; i < nameChar.length; i++) { CHARS[nameChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < digitRange.length; i += 2) { for (int j = digitRange[i]; j <= digitRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharRange.length; i += 2) { for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharChar.length; i++) { CHARS[combiningCharChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < extenderRange.length; i += 2) { for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < extenderChar.length; i++) { CHARS[extenderChar[i]] |= MASK_NAME | MASK_NCNAME; } // remove ':' from allowable MASK_NCNAME_START and MASK_NCNAME chars CHARS[':'] &= ~(MASK_NCNAME_START | MASK_NCNAME); // set Pubid characters for (int i = 0; i < pubidChar.length; i++) { CHARS[pubidChar[i]] |= MASK_PUBID; } for (int i = 0; i < pubidRange.length; i += 2) { for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) { CHARS[j] |= MASK_PUBID; } } } // () // // Public static methods // /** * Returns true if the specified character is a supplemental character. * * @param c The character to check. */ public static boolean isSupplemental(int c) { return (c >= 0x10000 && c <= 0x10FFFF); } /** * Returns true the supplemental character corresponding to the given surrogates. * * @param h The high surrogate. * @param l The low surrogate. */ public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; } /** * Returns the high surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char highSurrogate(int c) { return (char) (((c - 0x00010000) >> 10) + 0xD800); } /** * Returns the low surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char lowSurrogate(int c) { return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); } /** * Returns whether the given character is a high surrogate * * @param c The character to check. */ public static boolean isHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDBFF); } /** * Returns whether the given character is a low surrogate * * @param c The character to check. */ public static boolean isLowSurrogate(int c) { return (0xDC00 <= c && c <= 0xDFFF); } /** * Returns true if the specified character is valid. This method also checks the surrogate * character range from 0x10000 to 0x10FFFF. *

        * If the program chooses to apply the mask directly to the CHARS array, then they * are responsible for checking the surrogate character range. * * @param c The character to check. */ public static boolean isValid(int c) { return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isValid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean /** * Returns true if the specified character can be considered content. * * @param c The character to check. */ public static boolean isContent(int c) { return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isContent(int):boolean /** * Returns true if the specified character can be considered markup. Markup characters include * '<', '&', and '%'. * * @param c The character to check. */ public static boolean isMarkup(int c) { return c == '<' || c == '&' || c == '%'; } // isMarkup(int):boolean /** * Returns true if the specified character is a space character as defined by production [3] in * the XML 1.0 specification. * * @param c The character to check. */ public static boolean isSpace(int c) { return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0; } // isSpace(int):boolean /** * Returns true if the specified character is a space character as amdended in the XML 1.1 * specification. * * @param c The character to check. */ public static boolean isXML11Space(int c) { return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) || c == 0x85 || c == 0x2028; } // isXML11Space(int):boolean /** * Returns true if the specified character is a valid name start character as defined by * production [5] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; } // isNameStart(int):boolean /** * Returns true if the specified character is a valid name character as defined by production * [4] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; } // isName(int):boolean /** * Returns true if the specified character is a valid NCName start character as defined by * production [4] in Namespaces in XML recommendation. * * @param c The character to check. */ public static boolean isNCNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; } // isNCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName character as defined by production * [5] in Namespaces in XML recommendation. * * @param c The character to check. */ public static boolean isNCName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; } // isNCName(int):boolean /** * Returns true if the specified character is a valid Pubid character as defined by production * [13] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isPubid(int c) { return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; } // isPubid(int):boolean /* * [5] Name ::= (Letter | '_' | ':') (NameChar)* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) return false; char ch = name.charAt(0); if (!isNameStart(ch)) return false; for (int i = 1; i < name.length(); i++) { ch = name.charAt(i); if (!isName(ch)) { return false; } } return true; } // isValidName(String):boolean /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) return false; char ch = ncName.charAt(0); if (!isNCNameStart(ch)) return false; for (int i = 1; i < ncName.length(); i++) { ch = ncName.charAt(i); if (!isNCName(ch)) { return false; } } return true; } // isValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) return false; for (int i = 0; i < nmtoken.length(); i++) { char ch = nmtoken.charAt(i); if (! isName(ch)) { return false; } } return true; } // isValidName(String):boolean // encodings /** * Returns true if the encoding name is a valid IANA encoding. This method does not verify that * there is a decoder available for this encoding, only that the characters are valid for an * IANA encoding name. * * @param ianaEncoding The IANA encoding name. */ public static boolean isValidIANAEncoding(String ianaEncoding) { if (ianaEncoding != null) { int length = ianaEncoding.length(); if (length > 0) { char c = ianaEncoding.charAt(0); if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { for (int i = 1; i < length; i++) { c = ianaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } } return false; } // isValidIANAEncoding(String):boolean /** * Returns true if the encoding name is a valid Java encoding. This method does not verify that * there is a decoder available for this encoding, only that the characters are valid for an * Java encoding name. * * @param javaEncoding The Java encoding name. */ public static boolean isValidJavaEncoding(String javaEncoding) { if (javaEncoding != null) { int length = javaEncoding.length(); if (length > 0) { for (int i = 1; i < length; i++) { char c = javaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } return false; } // isValidIANAEncoding(String):boolean } // class XMLChar ./src/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java0000664000175000017500000000500311767656530023201 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class DocumentFragmentImpl extends ParentNode implements DocumentFragment { /** @param ownerDocument */ public DocumentFragmentImpl(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); this.done = true; } /* * (non-Javadoc) * * @see org.w3c.dom.Node#getNodeType() */ public short getNodeType() { return Node.DOCUMENT_FRAGMENT_NODE; } /* * (non-Javadoc) * * @see org.w3c.dom.Node#getNodeName() */ public String getNodeName() { return "#document-fragment"; } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNode#getType() */ public int getType() throws OMException { return -1; } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNode#setType(int) */ public void setType(int nodeType) throws OMException { // DO Nothing :-? } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { // TODO throw new UnsupportedOperationException("TODO"); } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { // TODO throw new UnsupportedOperationException("TODO"); } public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException { // TODO throw new UnsupportedOperationException("TODO"); } } ./src/org/apache/axiom/om/impl/dom/CommentImpl.java0000664000175000017500000000423011767656530021342 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.w3c.dom.Comment; import org.w3c.dom.Node; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class CommentImpl extends CharacterImpl implements Comment, OMComment { public CommentImpl(DocumentImpl ownerNode, OMFactory factory) { super(ownerNode, factory); this.done = true; } public CommentImpl(DocumentImpl ownerNode, String value, OMFactory factory) { super(ownerNode, value, factory); this.done = true; } public String getNodeName() { return "#comment"; } public short getNodeType() { return Node.COMMENT_NODE; } public String getValue() { return this.getData(); } public void setValue(String text) { this.textValue = text; } public int getType() { return OMNode.COMMENT_NODE; } public void setType(int nodeType) throws OMException { throw new UnsupportedOperationException( "You should not set the node type of a comment"); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { writer.writeComment(this.textValue); } } ./src/org/apache/axiom/om/impl/dom/ParentNode.java0000664000175000017500000006507111767656530021167 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.impl.traverse.OMChildrenIterator; import org.apache.axiom.om.impl.traverse.OMChildrenLocalNameIterator; import org.apache.axiom.om.impl.traverse.OMChildrenNamespaceIterator; import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; import java.util.Iterator; public abstract class ParentNode extends ChildNode implements OMContainerEx { protected ChildNode firstChild; protected ChildNode lastChild; /** @param ownerDocument */ protected ParentNode(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); } protected ParentNode(OMFactory factory) { super(factory); } // / // /OMContainer methods // / public OMXMLParserWrapper getBuilder() { return this.builder; } public void addChild(OMNode omNode) { if (omNode.getOMFactory() instanceof OMDOMFactory) { Node domNode = (Node) omNode; if (this.ownerNode != null && !domNode.getOwnerDocument().equals(this.ownerNode)) { this.appendChild(this.ownerNode.importNode(domNode, true)); } else { this.appendChild(domNode); } } else { addChild(importNode(omNode)); } } public void buildNext() { if (!this.done) builder.next(); } public Iterator getChildren() { return new OMChildrenIterator(getFirstOMChild()); } /** * Returns an iterator of child nodes having a given qname. * * @see org.apache.axiom.om.OMContainer#getChildrenWithName (javax.xml.namespace.QName) */ public Iterator getChildrenWithName(QName elementQName) throws OMException { return new OMChildrenQNameIterator(getFirstOMChild(), elementQName); } public Iterator getChildrenWithLocalName(String localName) { return new OMChildrenLocalNameIterator(getFirstOMChild(), localName); } public Iterator getChildrenWithNamespaceURI(String uri) { return new OMChildrenNamespaceIterator(getFirstOMChild(), uri); } /** * Returns the first OMElement child node. * * @see org.apache.axiom.om.OMContainer#getFirstChildWithName (javax.xml.namespace.QName) */ public OMElement getFirstChildWithName(QName elementQName) throws OMException { Iterator children = new OMChildrenQNameIterator(getFirstOMChild(), elementQName); while (children.hasNext()) { OMNode node = (OMNode) children.next(); // Return the first OMElement node that is found if (node instanceof OMElement) { return (OMElement) node; } } return null; } public OMNode getFirstOMChild() { while ((firstChild == null) && !done) { buildNext(); } return firstChild; } public OMNode getFirstOMChildIfAvailable() { return firstChild; } public void setFirstChild(OMNode omNode) { if (firstChild != null) { ((OMNodeEx) omNode).setParent(this); } this.firstChild = (ChildNode) omNode; } /** * Forcefully set the last child * @param omNode */ public void setLastChild(OMNode omNode) { this.lastChild = (ChildNode) omNode; } // / // /DOM Node methods // / public NodeList getChildNodes() { if (!this.done) { this.build(); } return new NodeListImpl() { protected Iterator getIterator() { return getChildren(); } }; } public Node getFirstChild() { return (Node) this.getFirstOMChild(); } public Node getLastChild() { if (!this.done) { this.build(); } return this.lastChild; } public boolean hasChildNodes() { while ((firstChild == null) && !done) { buildNext(); } return this.firstChild != null; } /** * Inserts newChild before the refChild. If the refChild is null then the newChild is made the * last child. */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { ChildNode newDomChild = (ChildNode) newChild; ChildNode refDomChild = (ChildNode) refChild; if (this == newChild || !isAncestor(newChild)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } if (newDomChild.parentNode != null && newDomChild.ownerNode == this.ownerNode) { //If the newChild is already in the tree remove it newDomChild.parentNode.removeChild(newDomChild); } if (!(this instanceof Document) && !(this.ownerNode == newDomChild.getOwnerDocument())) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null)); } if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } if (this instanceof Document) { if (newDomChild instanceof ElementImpl) { if (((DocumentImpl) this).documentElement != null) { // Throw exception since there cannot be two document elements throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } if (newDomChild.parentNode == null) { newDomChild.parentNode = this; } // set the document element ((DocumentImpl) this).documentElement = (ElementImpl) newDomChild; } else if (!(newDomChild instanceof CommentImpl || newDomChild instanceof ProcessingInstructionImpl || newDomChild instanceof DocumentFragmentImpl || newDomChild instanceof DocumentTypeImpl)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } } boolean compositeChild = newDomChild.nextSibling != null; ChildNode endChild = null; if(compositeChild) { ChildNode tempNextChild = newDomChild.nextSibling; while(tempNextChild != null) { tempNextChild.parentNode = this; endChild = tempNextChild; tempNextChild = tempNextChild.nextSibling; } } if (refChild == null) { // Append the child to the end of the list // if there are no children if (this.lastChild == null && firstChild == null) { if(compositeChild) { this.lastChild = endChild; } else { this.lastChild = newDomChild; } this.firstChild = newDomChild; this.firstChild.isFirstChild(true); newDomChild.setParent(this); } else { this.lastChild.nextSibling = newDomChild; newDomChild.previousSibling = this.lastChild; if(compositeChild) { this.lastChild = endChild; } else { this.lastChild = newDomChild; } this.lastChild.nextSibling = null; } if (newDomChild.parentNode == null) { newDomChild.parentNode = this; } return newChild; } else { Iterator children = this.getChildren(); boolean found = false; while (children.hasNext()) { ChildNode tempNode = (ChildNode) children.next(); if (tempNode.equals(refChild)) { // RefChild found if (this.firstChild == tempNode) { // If the refChild is the // first child if (newChild instanceof DocumentFragmentImpl) { // The new child is a DocumentFragment DocumentFragmentImpl docFrag = (DocumentFragmentImpl) newChild; this.firstChild = docFrag.firstChild; docFrag.lastChild.nextSibling = refDomChild; refDomChild.previousSibling = docFrag.lastChild.nextSibling; } else { // Make the newNode the first Child this.firstChild = newDomChild; newDomChild.nextSibling = refDomChild; refDomChild.previousSibling = newDomChild; this.firstChild.isFirstChild(true); refDomChild.isFirstChild(false); newDomChild.previousSibling = null; // Just to be // sure :-) } } else { // If the refChild is not the fist child ChildNode previousNode = refDomChild.previousSibling; if (newChild instanceof DocumentFragmentImpl) { // the newChild is a document fragment DocumentFragmentImpl docFrag = (DocumentFragmentImpl) newChild; previousNode.nextSibling = docFrag.firstChild; docFrag.firstChild.previousSibling = previousNode; docFrag.lastChild.nextSibling = refDomChild; refDomChild.previousSibling = docFrag.lastChild; } else { previousNode.nextSibling = newDomChild; newDomChild.previousSibling = previousNode; newDomChild.nextSibling = refDomChild; refDomChild.previousSibling = newDomChild; } } found = true; break; } } if (!found) { throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null)); } if (newDomChild.parentNode == null) { newDomChild.parentNode = this; } return newChild; } } /** Replaces the oldChild with the newChild. */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { ChildNode newDomChild = (ChildNode) newChild; ChildNode oldDomChild = (ChildNode) oldChild; if (newChild == null) { return this.removeChild(oldChild); } if (this == newChild || !isAncestor(newChild)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } if (newDomChild != null && //This is the case where this is an Element in the document (this.ownerNode != null && !this.ownerNode.equals(newDomChild.ownerNode)) || //This is the case where this is the Document itself (this.ownerNode == null && !this.equals(newDomChild.ownerNode))) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null)); } if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } Iterator children = this.getChildren(); boolean found = false; while (!found && children.hasNext()) { ChildNode tempNode = (ChildNode) children.next(); if (tempNode.equals(oldChild)) { if (newChild instanceof DocumentFragmentImpl) { DocumentFragmentImpl docFrag = (DocumentFragmentImpl) newDomChild; ChildNode child = (ChildNode) docFrag.getFirstChild(); this.replaceChild(child, oldChild); //set the parent of all kids to me while(child != null) { child.parentNode = this; child = child.nextSibling; } this.lastChild = (ChildNode)docFrag.getLastChild(); } else { if (this.firstChild == oldDomChild) { if (this.firstChild.nextSibling != null) { this.firstChild.nextSibling.previousSibling = newDomChild; newDomChild.nextSibling = this.firstChild.nextSibling; } //Cleanup the current first child this.firstChild.parentNode = null; this.firstChild.nextSibling = null; //Set the new first child this.firstChild = newDomChild; } else { newDomChild.nextSibling = oldDomChild.nextSibling; newDomChild.previousSibling = oldDomChild.previousSibling; oldDomChild.previousSibling.nextSibling = newDomChild; // If the old child is not the last if (oldDomChild.nextSibling != null) { oldDomChild.nextSibling.previousSibling = newDomChild; } else { this.lastChild = newDomChild; } } newDomChild.parentNode = this; } found = true; // remove the old child's references to this tree oldDomChild.nextSibling = null; oldDomChild.previousSibling = null; oldDomChild.parentNode = null; } } if (!found) throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null)); return oldChild; } /** Removes the given child from the DOM Tree. */ public Node removeChild(Node oldChild) throws DOMException { // Check if this node is readonly if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } // Check if the Child is there Iterator children = this.getChildren(); boolean childFound = false; while (!childFound && children.hasNext()) { ChildNode tempNode = (ChildNode) children.next(); if (tempNode.equals(oldChild)) { if (this.firstChild == tempNode) { // If this is the first child ChildNode nextSib = tempNode.nextSibling; this.firstChild = nextSib; if (nextSib == null) { this.lastChild = null; } else { nextSib.previousSibling = null; } tempNode.parentNode = null; tempNode.nextSibling = null; } else if (this.lastChild == tempNode) { // not the first child, but the last child ChildNode prevSib = tempNode.previousSibling; this.lastChild = prevSib; prevSib.nextSibling = null; tempNode.parentNode = null; tempNode.previousSibling = null; } else { ChildNode oldDomChild = (ChildNode) oldChild; ChildNode privChild = oldDomChild.previousSibling; privChild.nextSibling = oldDomChild.nextSibling; oldDomChild.nextSibling.previousSibling = privChild; // Remove old child's references to this tree oldDomChild.nextSibling = null; oldDomChild.previousSibling = null; } // Child found childFound = true; } } if (!childFound) throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null)); return oldChild; } private boolean isAncestor(Node newNode) { // TODO isAncestor return true; } public Node cloneNode(boolean deep) { ParentNode newnode = (ParentNode) super.cloneNode(deep); // set owner document newnode.ownerNode = ownerNode; // Need to break the association w/ original kids newnode.firstChild = null; newnode.lastChild = null; // Then, if deep, clone the kids too. if (deep) { for (ChildNode child = firstChild; child != null; child = child.nextSibling) { newnode.appendChild(child.cloneNode(true)); } } return newnode; } /** * This method is intended only to be used by Axiom intenals when merging Objects from different * Axiom implementations to the DOOM implementation. * * @param child */ protected OMNode importNode(OMNode child) { int type = child.getType(); switch (type) { case (OMNode.ELEMENT_NODE): { OMElement childElement = (OMElement) child; OMElement newElement = (new StAXOMBuilder(this.factory, childElement.getXMLStreamReader())) .getDocumentElement(); newElement.build(); return (OMNode) this.ownerNode.importNode((Element) newElement, true); } case (OMNode.TEXT_NODE): { OMText importedText = (OMText) child; OMText newText; if (importedText.isBinary()) { boolean isOptimize = importedText.isOptimized(); newText = this.factory.createOMText(importedText .getDataHandler(), isOptimize); } else if (importedText.isCharacters()) { newText = new TextImpl((DocumentImpl) this.getOwnerDocument(), importedText.getTextCharacters(), this.factory); } else { newText = new TextImpl((DocumentImpl) this.getOwnerDocument(), importedText.getText(), this.factory); } return newText; } case (OMNode.PI_NODE): { OMProcessingInstruction importedPI = (OMProcessingInstruction) child; OMProcessingInstruction newPI = this.factory .createOMProcessingInstruction(this, importedPI.getTarget(), importedPI.getValue()); return newPI; } case (OMNode.COMMENT_NODE): { OMComment importedComment = (OMComment) child; OMComment newComment = this.factory.createOMComment(this, importedComment.getValue()); DocumentImpl doc; if (this instanceof DocumentImpl) { doc = (DocumentImpl) this; } else { doc = (DocumentImpl) getOwnerDocument(); } newComment = new CommentImpl(doc, importedComment.getValue(), this.factory); return newComment; } case (OMNode.DTD_NODE): { OMDocType importedDocType = (OMDocType) child; OMDocType newDocType = this.factory.createOMDocType(this, importedDocType.getValue()); return newDocType; } default: { throw new UnsupportedOperationException( "Not Implemented Yet for the given node type"); } } } public String getTextContent() throws DOMException { Node child = getFirstChild(); if (child != null) { Node next = child.getNextSibling(); if (next == null) { return hasTextContent(child) ? ((NodeImpl)child).getTextContent() : ""; } StringBuffer buf = new StringBuffer(); getTextContent(buf); return buf.toString(); } else { return ""; } } void getTextContent(StringBuffer buf) throws DOMException { Node child = getFirstChild(); while (child != null) { if (hasTextContent(child)) { ((NodeImpl)child).getTextContent(buf); } child = child.getNextSibling(); } } // internal method returning whether to take the given node's text content private static boolean hasTextContent(Node child) { return child.getNodeType() != Node.COMMENT_NODE && child.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE /* && (child.getNodeType() != Node.TEXT_NODE || ((TextImpl) child).isIgnorableWhitespace() == false)*/; } public void setTextContent(String textContent) throws DOMException { // get rid of any existing children // TODO: there is probably a better way to remove all children Node child; while ((child = getFirstChild()) != null) { removeChild(child); } // create a Text node to hold the given content if (textContent != null && textContent.length() != 0) { addChild(factory.createOMText(textContent)); } } public XMLStreamReader getXMLStreamReaderWithoutCaching() { return getXMLStreamReader(false); } public XMLStreamReader getXMLStreamReader() { return getXMLStreamReader(true); } public XMLStreamReader getXMLStreamReader(boolean cache) { if ((builder == null) && !cache) { throw new UnsupportedOperationException( "This element was not created in a manner to be switched"); } if (builder != null && builder.isCompleted() && !cache) { throw new UnsupportedOperationException( "The parser is already consumed!"); } return new DOMStAXWrapper(builder, this, cache); } } ./src/org/apache/axiom/om/impl/dom/NodeImpl.java0000664000175000017500000007142711767656530020641 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.UserDataHandler; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.OutputStream; import java.io.Writer; import java.util.Hashtable; public abstract class NodeImpl implements Node, NodeList, OMNodeEx, Cloneable { /** Holds the user data objects */ private Hashtable userData; // Will be initialized in setUserData() /** Field builder */ public OMXMLParserWrapper builder; /** Field done */ protected boolean done = false; protected DocumentImpl ownerNode; /** Factory that created this node */ protected final OMFactory factory; // data protected short flags; protected final static short OWNED = 0x1 << 1; protected final static short FIRSTCHILD = 0x1 << 2; protected final static short READONLY = 0x1 << 3; protected final static short SPECIFIED = 0x1 << 4; protected final static short NORMALIZED = 0x1 << 5; // // Constructors // protected NodeImpl(DocumentImpl ownerDocument, OMFactory factory) { //this(factory); this.factory = factory; this.ownerNode = ownerDocument; // this.isOwned(true); } protected NodeImpl(OMFactory factory) { this.factory = factory; } public void normalize() { //Parent node should override this } public boolean hasAttributes() { return false; // overridden in ElementImpl } public boolean hasChildNodes() { return false; // Override in ParentNode } public String getLocalName() { return null; // Override in AttrImpl and ElementImpl } public String getNamespaceURI() { return null; // Override in AttrImpl and ElementImpl } public String getNodeValue() throws DOMException { return null; } /* * Overidden in ElementImpl and AttrImpl. */ public String getPrefix() { return null; } public void setNodeValue(String arg0) throws DOMException { // Don't do anything, to be overridden in SOME Child classes } public void setPrefix(String prefix) throws DOMException { throw new DOMException(DOMException.NAMESPACE_ERR, DOMMessageFormatter .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NAMESPACE_ERR, null)); } /** * Finds the document that this Node belongs to (the document in whose context the Node was * created). The Node may or may not */ public Document getOwnerDocument() { return this.ownerNode; } /** * Returns the collection of attributes associated with this node, or null if none. At this * writing, Element is the only type of node which will ever have attributes. * * @see ElementImpl */ public NamedNodeMap getAttributes() { return null; // overridden in ElementImpl } /** * Gets the first child of this Node, or null if none. *

        * By default we do not have any children, ParentNode overrides this. * * @see ParentNode */ public Node getFirstChild() { return null; } /** * Gets the last child of this Node, or null if none. *

        * By default we do not have any children, ParentNode overrides this. * * @see ParentNode */ public Node getLastChild() { return null; } /** Returns the next child of this node's parent, or null if none. */ public Node getNextSibling() { return null; // default behavior, overriden in ChildNode } public Node getParentNode() { return null; // overriden by ChildNode // Document, DocumentFragment, and Attribute will never have parents. } /* * Same as getParentNode but returns internal type NodeImpl. */ NodeImpl parentNode() { return null; } /** Returns the previous child of this node's parent, or null if none. */ public Node getPreviousSibling() { return null; // default behavior, overriden in ChildNode } // public Node cloneNode(boolean deep) { // if(this instanceof OMElement) { // return (Node)((OMElement)this).cloneOMElement(); // } else if(this instanceof OMText ){ // return ((TextImpl)this).cloneText(); // } else { // throw new UnsupportedOperationException("Only elements can be cloned // right now"); // } // } // public Node cloneNode(boolean deep) { NodeImpl newnode; try { newnode = (NodeImpl) clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException("**Internal Error**" + e); } newnode.ownerNode = this.ownerNode; newnode.isOwned(false); newnode.isReadonly(false); return newnode; } /* * (non-Javadoc) * * @see org.w3c.dom.Node#getChildNodes() */ public NodeList getChildNodes() { return this; } public boolean isSupported(String feature, String version) { throw new UnsupportedOperationException(); // TODO } /* * (non-Javadoc) * * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node) */ public Node appendChild(Node newChild) throws DOMException { return insertBefore(newChild, null); } /* * (non-Javadoc) * * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node) */ public Node removeChild(Node oldChild) throws DOMException { throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null)); } /* * (non-Javadoc) * * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { // Overridden in ParentNode throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } /* * (non-Javadoc) * * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } // // NodeList methods // /** * NodeList method: Returns the number of immediate children of this node. *

        * By default we do not have any children, ParentNode overrides this. * * @return Returns int. * @see ParentNode */ public int getLength() { return 0; } /** * NodeList method: Returns the Nth immediate child of this node, or null if the index is out of * bounds. *

        * By default we do not have any children, ParentNode overrides this. * * @param index * @return Returns org.w3c.dom.Node * @see ParentNode */ public Node item(int index) { return null; } /* * Flags setters and getters */ final boolean isOwned() { return (flags & OWNED) != 0; } final void isOwned(boolean value) { flags = (short) (value ? flags | OWNED : flags & ~OWNED); } final boolean isFirstChild() { return (flags & FIRSTCHILD) != 0; } final void isFirstChild(boolean value) { flags = (short) (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD); } final boolean isReadonly() { return (flags & READONLY) != 0; } final void isReadonly(boolean value) { flags = (short) (value ? flags | READONLY : flags & ~READONLY); } final boolean isSpecified() { return (flags & SPECIFIED) != 0; } final void isSpecified(boolean value) { flags = (short) (value ? flags | SPECIFIED : flags & ~SPECIFIED); } final boolean isNormalized() { return (flags & NORMALIZED) != 0; } final void isNormalized(boolean value) { // See if flag should propagate to parent. if (!value && isNormalized() && ownerNode != null) { ownerNode.isNormalized(false); } flags = (short) (value ? flags | NORMALIZED : flags & ~NORMALIZED); } // / // /OM Methods // / /* * (non-Javadoc) * * @see org.apache.axis2.om.OMNode#getParent() */ public OMContainer getParent() throws OMException { return null; // overriden by ChildNode // Document, DocumentFragment, and Attribute will never have parents. } /* * (non-Javadoc) * * @see org.apache.axis2.om.OMNode#isComplete() */ public boolean isComplete() { return this.done; } public void setComplete(boolean state) { this.done = state; } /* * (non-Javadoc) * * @see org.apache.axis2.om.OMNode#insertSiblingAfter * (org.apache.axis2.om.OMNode) */ public void insertSiblingAfter(OMNode sibling) throws OMException { // Overridden in ChildNode throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } /* * (non-Javadoc) * * @see org.apache.axis2.om.OMNode#insertSiblingBefore * (org.apache.axis2.om.OMNode) */ public void insertSiblingBefore(OMNode sibling) throws OMException { // Overridden in ChildNode throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } /** Default behavior returns null, overriden in ChildNode. */ public OMNode getPreviousOMSibling() { return null; } /** Default behavior returns null, overriden in ChildNode. */ public OMNode getNextOMSibling() { return null; } public OMNode getNextOMSiblingIfAvailable() { return null; } public void setPreviousOMSibling(OMNode previousSibling) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } public void setNextOMSibling(OMNode previousSibling) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR, null)); } /** Builds next element. */ public void build() { while (!done) this.builder.next(); } /** * Parses this node and builds the object structure in memory. AXIOM supports two levels of * deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered * building of attachments. AXIOM reads in the attachements from the stream only when user asks by * calling getDataHandler(). build() method builds the OM without the attachments. buildAll() * builds the OM together with attachement data. This becomes handy when user wants to free the * input stream. */ public void buildWithAttachments() { if (!this.done) { this.build(); } } public void close(boolean build) { if (build) { this.build(); } this.done = true; // If this is a StAXBuilder, close it. if (builder instanceof StAXBuilder && !((StAXBuilder) builder).isClosed()) { ((StAXBuilder) builder).releaseParserOnClose(true); ((StAXBuilder) builder).close(); } } /** * Sets the owner document. * * @param document */ protected void setOwnerDocument(DocumentImpl document) { this.ownerNode = document; this.isOwned(true); } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { serialize(xmlWriter, true); } public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException { serialize(xmlWriter, false); } public void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException { MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter ? (MTOMXMLStreamWriter) xmlWriter : new MTOMXMLStreamWriter(xmlWriter); internalSerialize(writer, cache); writer.flush(); } public OMNode detach() { throw new OMException( "Elements that doesn't have a parent can not be detached"); } /* * DOM-Level 3 methods */ public String getBaseURI() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public short compareDocumentPosition(Node other) throws DOMException { // This is not yet implemented. In the meantime, we throw a DOMException // and not an UnsupportedOperationException, since this works better with // some other libraries (such as Saxon 8.9). throw new DOMException(DOMException.NOT_SUPPORTED_ERR, DOMMessageFormatter .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_SUPPORTED_ERR, null)); } public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses } // internal method taking a StringBuffer in parameter void getTextContent(StringBuffer buf) throws DOMException { String content = getNodeValue(); if (content != null) { buf.append(content); } } public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); // overriden in some subclasses } public boolean isSameNode(Node node) { // TODO : check return this == node; } public String lookupPrefix(String arg0) { // TODO TODO throw new UnsupportedOperationException("TODO"); } public boolean isDefaultNamespace(String arg0) { // TODO TODO throw new UnsupportedOperationException("TODO"); } public String lookupNamespaceURI(String arg0) { // TODO TODO throw new UnsupportedOperationException("TODO"); } /** * Tests whether two nodes are equal.
        This method tests for equality of nodes, not sameness * (i.e., whether the two nodes are references to the same object) which can be tested with * Node.isSameNode(). All nodes that are the same will also be equal, though the * reverse may not be true.
        Two nodes are equal if and only if the following conditions are * satisfied:

        • The two nodes are of the same type.
        • The following string * attributes are equal: nodeName, localName, * namespaceURI, prefix, nodeValue . This is: they are * both null, or they have the same length and are character for character * identical.
        • The attributes NamedNodeMaps are equal. This * is: they are both null, or they have the same length and for each node that * exists in one map there is a node that exists in the other map and is equal, although not * necessarily at the same index.
        • The childNodes NodeLists * are equal. This is: they are both null, or they have the same length and contain * equal nodes at the same index. Note that normalization can affect equality; to avoid this, * nodes should be normalized before being compared.

        For two * DocumentType nodes to be equal, the following conditions must also be satisfied: *
        • The following string attributes are equal: publicId, * systemId, internalSubset.
        • The entities * NamedNodeMaps are equal.
        • The notations * NamedNodeMaps are equal.

        On the other hand, the following do not * affect equality: the ownerDocument, baseURI, and * parentNode attributes, the specified attribute for * Attr nodes, the schemaTypeInfo attribute for Attr and * Element nodes, the Text.isElementContentWhitespace attribute for * Text nodes, as well as any user data or event listeners registered on the nodes. *

        Note: As a general rule, anything not mentioned in the description above is not * significant in consideration of equality checking. Note that future versions of this * specification may take into account more attributes and implementations conform to this * specification are expected to be updated accordingly. * * @param node The node to compare equality with. * @return Returns true if the nodes are equal, false otherwise. * @since DOM Level 3 */ //TODO : sumedha, complete public boolean isEqualNode(Node node) { final boolean equal = true; final boolean notEqual = false; if (this.getNodeType() != node.getNodeType()) { return notEqual; } if (checkStringAttributeEquality(node)) { if (checkNamedNodeMapEquality(node)) { } else { return notEqual; } } else { return notEqual; } return equal; } private boolean checkStringAttributeEquality(Node node) { final boolean equal = true; final boolean notEqual = false; // null not-null -> true // not-null null -> true // null null -> false // not-null not-null -> false //NodeName if (node.getNodeName() == null ^ this.getNodeName() == null) { return notEqual; } else { if (node.getNodeName() == null) { //This means both are null.do nothing } else { if (!(node.getNodeName().equals(this.getNodeName()))) { return notEqual; } } } //localName if (node.getLocalName() == null ^ this.getLocalName() == null) { return notEqual; } else { if (node.getLocalName() == null) { //This means both are null.do nothing } else { if (!(node.getLocalName().equals(this.getLocalName()))) { return notEqual; } } } //namespaceURI if (node.getNamespaceURI() == null ^ this.getNamespaceURI() == null) { return notEqual; } else { if (node.getNamespaceURI() == null) { //This means both are null.do nothing } else { if (!(node.getNamespaceURI().equals(this.getNamespaceURI()))) { return notEqual; } } } //prefix if (node.getPrefix() == null ^ this.getPrefix() == null) { return notEqual; } else { if (node.getPrefix() == null) { //This means both are null.do nothing } else { if (!(node.getPrefix().equals(this.getPrefix()))) { return notEqual; } } } //nodeValue if (node.getNodeValue() == null ^ this.getNodeValue() == null) { return notEqual; } else { if (node.getNodeValue() == null) { //This means both are null.do nothing } else { if (!(node.getNodeValue().equals(this.getNodeValue()))) { return notEqual; } } } return equal; } private boolean checkNamedNodeMapEquality(Node node) { final boolean equal = true; final boolean notEqual = false; if (node.getAttributes() == null ^ this.getAttributes() == null) { return notEqual; } NamedNodeMap thisNamedNodeMap = this.getAttributes(); NamedNodeMap nodeNamedNodeMap = node.getAttributes(); // null not-null -> true // not-null null -> true // null null -> false // not-null not-null -> false if (thisNamedNodeMap == null ^ nodeNamedNodeMap == null) { return notEqual; } else { if (thisNamedNodeMap == null) { //This means both are null.do nothing } else { if (thisNamedNodeMap.getLength() != nodeNamedNodeMap.getLength()) { return notEqual; } else { //they have the same length and for each node that exists in one map //there is a node that exists in the other map and is equal, although //not necessarily at the same index. int itemCount = thisNamedNodeMap.getLength(); for (int a = 0; a < itemCount; a++) { NodeImpl thisNode = (NodeImpl) thisNamedNodeMap.item(a); NodeImpl tmpNode = (NodeImpl) nodeNamedNodeMap.getNamedItem(thisNode.getNodeName()); if (tmpNode == null) { //i.e. no corresponding node return notEqual; } else { if (!(thisNode.isEqualNode(tmpNode))) { return notEqual; } } } } } } return equal; } public Object getFeature(String arg0, String arg1) { // TODO TODO throw new UnsupportedOperationException("TODO"); } /* * * userData storage/hashtable will be called only when the user needs to set user data. Previously, it was done as, * for every node a new Hashtable created making the excution very inefficient. According to profiles, no. of method * invocations to setUserData() method is very low, so this implementation is better. * Another option: * TODO do a profile and check the times for hashtable initialization. If it's still higher, we have to go to second option * Create a separate class(UserData) to store key and value pairs. Then put those objects to a array with a reasonable size. * then grow it accordingly. @ Kasun Gajasinghe * @param key userData key * @param value userData value * @param userDataHandler it seems all invocations sends null for this parameter. * Kept it for the moment just for being on the safe side. * @return previous Object if one is set before. */ public Object setUserData(String key, Object value, UserDataHandler userDataHandler) { if (userData == null) { userData = new Hashtable(); } return userData.put(key, value); } public Object getUserData(String key) { if (userData != null) { return userData.get(key); } return null; } public void serialize(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serialize(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serializeAndConsume(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serializeAndConsume(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); try { internalSerialize(writer, true); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils .createXMLStreamWriter(writer2)); writer.setOutputFormat(format); try { internalSerialize(writer, true); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); try { internalSerialize(writer, false); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter writer.flush(); } finally { writer.close(); } } public void serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils .createXMLStreamWriter(writer2)); try { writer.setOutputFormat(format); // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter internalSerialize(writer, false); writer.flush(); } finally { writer.close(); } } /** Returns the OMFactory that created this node */ public OMFactory getOMFactory() { return this.factory; } public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, true); } public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException { internalSerialize(writer, false); } } ./src/org/apache/axiom/om/impl/dom/NamespaceImpl.java0000664000175000017500000000475611767656530021651 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMNamespace; public class NamespaceImpl implements OMNamespace { private final String nsUri; private final String nsPrefix; public NamespaceImpl(String uri) { this(uri, null); } public NamespaceImpl(String uri, String prefix) { if (uri == null) { throw new IllegalArgumentException("Namespace URI may not be null"); } this.nsUri = uri; this.nsPrefix = prefix; } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNamespace#equals(java.lang.String, * java.lang.String) */ public boolean equals(String uri, String prefix) { return (nsUri.equals(uri) && (nsPrefix == null ? prefix == null : nsPrefix.equals(prefix))); } public boolean equals(Object obj) { if (!(obj instanceof OMNamespace)) return false; OMNamespace other = (OMNamespace)obj; String otherPrefix = other.getPrefix(); return (nsUri.equals(other.getNamespaceURI()) && (nsPrefix == null ? otherPrefix == null : nsPrefix.equals(otherPrefix))); } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNamespace#getPrefix() */ public String getPrefix() { return this.nsPrefix; } /* * (non-Javadoc) * * @see org.apache.axiom.om.OMNamespace#getName() */ public String getName() { return this.nsUri; } public String getNamespaceURI() { return this.nsUri; } public int hashCode() { return nsUri.hashCode() ^ (nsPrefix != null ? nsPrefix.hashCode() : 0); } } ./src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java0000664000175000017500000001506011767656530022731 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import java.util.Locale; import java.util.MissingResourceException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; /** Used to format DOM error messages, using the system locale. */ public class DOMMessageFormatter { public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR"; public static final String XML_DOMAIN = "http://www.w3.org/TR/1998/REC-xml-19980210"; public static final String SERIALIZER_DOMAIN = "http://apache.org/xml/serializer"; private static ResourceBundle domResourceBundle = null; private static ResourceBundle xmlResourceBundle = null; private static ResourceBundle serResourceBundle = null; private static Locale locale = null; public static final String LEVEL3_NOT_SUPPORTED = "DOM Level 3 operations are not supported"; public static final String NOT_REQUIRED_FOR_XMLSEC_OR_WSS4J = "This method is not required by Apache XML-Security Impl or WSS4J"; private static final String[] exceptionKeys = { // Note: order is determined by the constants defined in DOMException "INDEX_SIZE_ERR", "DOMSTRING_SIZE_ERR", "HIERARCHY_REQUEST_ERR", "WRONG_DOCUMENT_ERR", "INVALID_CHARACTER_ERR", "NO_DATA_ALLOWED_ERR", "NO_MODIFICATION_ALLOWED_ERR", "NOT_FOUND_ERR", "NOT_SUPPORTED_ERR", "INUSE_ATTRIBUTE_ERR", "INVALID_STATE_ERR", "SYNTAX_ERR", "INVALID_MODIFICATION_ERR", "NAMESPACE_ERR", "INVALID_ACCESS_ERR", "VALIDATION_ERR", "TYPE_MISMATCH_ERR", }; DOMMessageFormatter() { locale = Locale.getDefault(); } /** * Formats a message with the specified arguments using the given locale information. * * @param domain domain from which error string is to come. * @param key The message key. * @param arguments The message replacement text arguments. The order of the arguments must * match that of the placeholders in the actual message. * @return Returns the formatted message. * @throws MissingResourceException Thrown if the message with the specified key cannot be * found. */ public static String formatMessage(String domain, String key, Object[] arguments) throws MissingResourceException { ResourceBundle resourceBundle = getResourceBundle(domain); if (resourceBundle == null) { init(); resourceBundle = getResourceBundle(domain); if (resourceBundle == null) throw new MissingResourceException("Unknown domain" + domain, null, key); } // format message String msg; try { msg = key + ": " + resourceBundle.getString(key); if (arguments != null) { try { msg = java.text.MessageFormat.format(msg, arguments); } catch (Exception e) { msg = resourceBundle.getString("FormatFailed"); msg += " " + resourceBundle.getString(key); } } } // error catch (MissingResourceException e) { msg = resourceBundle.getString("BadMessageKey"); throw new MissingResourceException(key, msg, key); } // no message if (msg == null) { msg = key; if (arguments.length > 0) { StringBuffer str = new StringBuffer(msg); str.append('?'); for (int i = 0; i < arguments.length; i++) { if (i > 0) { str.append('&'); } str.append(String.valueOf(arguments[i])); } } } return msg; } public static String formatMessage(String domain, int exceptionId, Object[] arguments) throws MissingResourceException { return formatMessage(domain, exceptionKeys[exceptionId-1], arguments); } static ResourceBundle getResourceBundle(String domain) { if (domain == DOM_DOMAIN || domain.equals(DOM_DOMAIN)) return domResourceBundle; else if (domain == XML_DOMAIN || domain.equals(XML_DOMAIN)) return xmlResourceBundle; else if (domain == SERIALIZER_DOMAIN || domain.equals(SERIALIZER_DOMAIN)) return serResourceBundle; return null; } /** Initializes Message Formatter. */ public static void init() { if (locale != null) { domResourceBundle = PropertyResourceBundle.getBundle( "org.apache.axiom.om.impl.dom.msg.DOMMessages", locale); serResourceBundle = PropertyResourceBundle.getBundle( "org.apache.axiom.om.impl.dom.msg.XMLSerializerMessages", locale); xmlResourceBundle = PropertyResourceBundle.getBundle( "org.apache.axiom.om.impl.dom.msg.XMLMessages", locale); } else { domResourceBundle = PropertyResourceBundle .getBundle("org.apache.axiom.om.impl.dom.msg.DOMMessages"); serResourceBundle = PropertyResourceBundle .getBundle("org.apache.axiom.om.impl.dom.msg.XMLSerializerMessages"); xmlResourceBundle = PropertyResourceBundle .getBundle("org.apache.axiom.om.impl.dom.msg.XMLMessages"); } } /** * Sets Locale to be used by the formatter. * * @param dlocale */ public static void setLocale(Locale dlocale) { locale = dlocale; } } ./src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java0000664000175000017500000000452511767656530023274 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; public class DOMImplementationImpl implements DOMImplementation { public boolean hasFeature(String feature, String version) { boolean anyVersion = version == null || version.length() == 0; return (feature.equalsIgnoreCase("Core") || feature.equalsIgnoreCase("XML")) && (anyVersion || version.equals("1.0") || version.equals("2.0")); } public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { // TODO Handle docType stuff OMDOMFactory fac = new OMDOMFactory(); DocumentImpl doc = new DocumentImpl(fac); fac.setDocument(doc); new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName), new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName)), fac); return doc; } public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) throws DOMException { // TODO throw new UnsupportedOperationException("TODO"); } /* * DOM-Level 3 methods */ public Object getFeature(String arg0, String arg1) { // TODO TODO throw new UnsupportedOperationException("TODO"); } } ./src/org/apache/axiom/om/impl/dom/DocumentImpl.java0000664000175000017500000004455011767656530021527 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.OMDocumentImplUtil; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.OutputStream; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; public class DocumentImpl extends ParentNode implements Document, OMDocument { private String xmlVersion; private String xmlEncoding; private boolean xmlStandalone = false; private String charEncoding; private Vector idAttrs; protected ElementImpl documentElement; protected Hashtable identifiers; /** @param ownerDocument */ public DocumentImpl(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); ((OMDOMFactory) factory).setDocument(this); this.done = true; } public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) { super(factory); this.builder = parserWrapper; ((OMDOMFactory) factory).setDocument(this); } public DocumentImpl(OMFactory factory) { super(factory); ((OMDOMFactory) factory).setDocument(this); this.done = true; } // / // /OMNode methods // // public void setType(int nodeType) throws OMException { throw new UnsupportedOperationException( "In OM Document object doesn't have a type"); } public int getType() throws OMException { throw new UnsupportedOperationException( "In OM Document object doesn't have a type"); } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { internalSerialize(writer, cache, !((MTOMXMLStreamWriter) writer).isIgnoreXMLDeclaration()); } // / // /Overrides ChildNode specific methods. // / public OMNode getNextOMSibling() throws OMException { return null; } public Node getNextSibling() { return null; } public OMContainer getParent() throws OMException { throw new UnsupportedOperationException("This is the document node"); } public OMNode getPreviousOMSibling() { throw new UnsupportedOperationException("This is the document node"); } public Node getPreviousSibling() { return null; } public void setNextOMSibling(OMNode node) { throw new UnsupportedOperationException("This is the document node"); } public void setParent(OMContainer element) { throw new UnsupportedOperationException("This is the document node"); } public void setPreviousOMSibling(OMNode node) { throw new UnsupportedOperationException("This is the document node"); } // / // /org.w3c.dom.Node methods // / public String getNodeName() { return "#document"; } public short getNodeType() { return Node.DOCUMENT_NODE; } // /org.w3c.dom.Document methods // / public Attr createAttribute(String name) throws DOMException { if (!DOMUtil.isQualifiedName(name)) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR, null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } return new AttrImpl(this, name, this.factory); } public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if (!OMConstants.XMLNS_NS_PREFIX.equals(localName)) { this.checkQName(prefix, localName); } else { return this.createAttribute(localName); } return new AttrImpl(this, localName, new NamespaceImpl( namespaceURI, prefix), this.factory); } public CDATASection createCDATASection(String arg0) throws DOMException { // TODO throw new UnsupportedOperationException("TODO"); } public Comment createComment(String data) { return new CommentImpl(this, data, this.factory); } public DocumentFragment createDocumentFragment() { return new DocumentFragmentImpl(this, this.factory); } public Element createElement(String tagName) throws DOMException { return new ElementImpl(this, tagName, this.factory); } public Element createElementNS(String ns, String qualifiedName) throws DOMException { if (ns == null) ns = ""; String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if(prefix == null) { prefix = ""; } //When the namespace is a default namespace if (prefix != null && !"".equals(prefix)) { this.checkQName(prefix, localName); } NamespaceImpl namespace = new NamespaceImpl(ns, prefix); return new ElementImpl(this, localName, namespace, this.factory); } public EntityReference createEntityReference(String arg0) throws DOMException { // TODO throw new UnsupportedOperationException("TODO"); } public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { return new ProcessingInstructionImpl(this, target, data, factory); } public Text createTextNode(String value) { return new TextImpl(this, value, this.factory); } public DocumentType getDoctype() { Iterator it = getChildren(); while (it.hasNext()) { Object child = it.next(); if (child instanceof DocumentType) { return (DocumentType)child; } else if (child instanceof Element) { // A doctype declaration can only appear before the root element. Stop here. return null; } } return null; } public Element getElementById(String elementId) { //If there are no id attrs if (this.idAttrs == null) { return null; } Enumeration attrEnum = this.idAttrs.elements(); while (attrEnum.hasMoreElements()) { Attr tempAttr = (Attr) attrEnum.nextElement(); if (tempAttr.getValue().equals(elementId)) { return tempAttr.getOwnerElement(); } } //If we reach this point then, there's no such attr return null; } public NodeList getElementsByTagName(String arg0) { // TODO throw new UnsupportedOperationException("TODO"); } public NodeList getElementsByTagNameNS(String arg0, String arg1) { // TODO throw new UnsupportedOperationException("TODO"); } public DOMImplementation getImplementation() { return new DOMImplementationImpl(); } public Node importNode(Node importedNode, boolean deep) throws DOMException { short type = importedNode.getNodeType(); Node newNode = null; switch (type) { case Node.ELEMENT_NODE: { Element newElement; if (importedNode.getLocalName() == null) { newElement = this.createElement(importedNode.getNodeName()); } else { String ns = importedNode.getNamespaceURI(); ns = (ns != null) ? ns.intern() : null; newElement = createElementNS(ns, importedNode.getNodeName()); } // Copy element's attributes, if any. NamedNodeMap sourceAttrs = importedNode.getAttributes(); if (sourceAttrs != null) { int length = sourceAttrs.getLength(); for (int index = 0; index < length; index++) { Attr attr = (Attr) sourceAttrs.item(index); if (attr.getNamespaceURI() != null && !attr.getNamespaceURI().equals( OMConstants.XMLNS_NS_URI)) { Attr newAttr = (Attr) importNode(attr, true); newElement.setAttributeNodeNS(newAttr); } else { // if (attr.getLocalName() == null) { Attr newAttr = (Attr) importNode(attr, true); newElement.setAttributeNode(newAttr); } } } newNode = newElement; break; } case Node.ATTRIBUTE_NODE: { if ("".equals(importedNode.getNamespaceURI()) || importedNode.getNamespaceURI() == null) { newNode = createAttribute(importedNode.getNodeName()); } else { //Check whether it is a default ns decl if (OMConstants.XMLNS_NS_PREFIX.equals(importedNode.getNodeName())) { newNode = createAttribute(importedNode.getNodeName()); } else { String ns = importedNode.getNamespaceURI(); ns = (ns != null) ? ns.intern() : null; newNode = createAttributeNS(ns , importedNode.getNodeName()); } } ((Attr) newNode).setValue(importedNode.getNodeValue()); break; } case Node.TEXT_NODE: { newNode = createTextNode(importedNode.getNodeValue()); break; } case Node.COMMENT_NODE: { newNode = createComment(importedNode.getNodeValue()); break; } case Node.DOCUMENT_FRAGMENT_NODE: { newNode = createDocumentFragment(); // No name, kids carry value break; } case Node.CDATA_SECTION_NODE: case Node.ENTITY_REFERENCE_NODE: case Node.ENTITY_NODE: case Node.PROCESSING_INSTRUCTION_NODE: case Node.DOCUMENT_TYPE_NODE: case Node.NOTATION_NODE: throw new UnsupportedOperationException("TODO : Implement handling of org.w3c.dom.Node type == " + type ); case Node.DOCUMENT_NODE: // Can't import document nodes default: { // Unknown node type String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_SUPPORTED_ERR, null); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } } // If deep, replicate and attach the kids. if (deep && !(importedNode instanceof Attr)) { for (Node srckid = importedNode.getFirstChild(); srckid != null; srckid = srckid.getNextSibling()) { newNode.appendChild(importNode(srckid, true)); } } return newNode; } // / // /OMDocument Methods // / public String getCharsetEncoding() { return this.charEncoding; } public String getXMLVersion() { return this.xmlVersion; } public String isStandalone() { return (this.xmlStandalone) ? "yes" : "no"; } public void setCharsetEncoding(String charsetEncoding) { this.charEncoding = charsetEncoding; } public void setOMDocumentElement(OMElement rootElement) { this.firstChild = (ElementImpl) rootElement; } public void setStandalone(String isStandalone) { this.xmlStandalone = "yes".equalsIgnoreCase(isStandalone); } public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); internalSerialize(writer, false); writer.flush(); } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format); internalSerialize(writer, true); writer.flush(); } public void setXMLVersion(String version) { this.xmlVersion = version; } public String getXMLEncoding() { return xmlEncoding; } public void setXMLEncoding(String encoding) { this.xmlEncoding = encoding; } /** * Returns the document element. * * @see org.apache.axiom.om.OMDocument#getOMDocumentElement() */ public OMElement getOMDocumentElement() { while (this.documentElement == null && !this.done) { this.builder.next(); } return this.documentElement; } /** * Returns the document element. * * @see org.w3c.dom.Document#getDocumentElement() */ public Element getDocumentElement() { return (Element) this.getOMDocumentElement(); } /** * Borrowed from the Xerces impl. Checks if the given qualified name is legal with respect to * the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ protected final void checkQName(String prefix, String local) { // check that both prefix and local part match NCName boolean validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); if (!validNCName) { // REVISIT: add qname parameter to the message String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR, null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } if (prefix == null || prefix.equals("")) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NAMESPACE_ERR, null); throw new DOMException(DOMException.NAMESPACE_ERR, msg); } } protected void addIdAttr(Attr attr) { if (this.idAttrs == null) { this.idAttrs = new Vector(); } this.idAttrs.add(attr); } protected void removeIdAttr(Attr attr) { if (this.idAttrs != null) { this.idAttrs.remove(attr); } } /* * DOM-Level 3 methods */ public String getTextContent() throws DOMException { return null; } public void setTextContent(String textContent) throws DOMException { // no-op } public Node adoptNode(Node node) throws DOMException { //OK... I'm cheating here, a BIG TODO return this.importNode(node, true); } public String getDocumentURI() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public DOMConfiguration getDomConfig() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public String getInputEncoding() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public boolean getStrictErrorChecking() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public String getXmlEncoding() { return this.charEncoding; } public boolean getXmlStandalone() { return this.xmlStandalone; } public String getXmlVersion() { return getXMLVersion(); } public void normalizeDocument() { // TODO TODO throw new UnsupportedOperationException("TODO"); } public Node renameNode(Node arg0, String arg1, String arg2) throws DOMException { // TODO TODO throw new UnsupportedOperationException("TODO"); } public void setDocumentURI(String arg0) { // TODO TODO throw new UnsupportedOperationException("TODO"); } public void setStrictErrorChecking(boolean arg0) { // TODO TODO throw new UnsupportedOperationException("TODO"); } public void setXmlStandalone(boolean standalone) throws DOMException { this.xmlStandalone = standalone; } public void setXmlVersion(String version) throws DOMException { setXMLVersion(version); } protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException { OMDocumentImplUtil.internalSerialize(this, writer, cache, includeXMLDeclaration); } } ./src/org/apache/axiom/om/impl/dom/factory/0000775000175000017500000000000011767656530017723 5ustar brianbrian./src/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java0000664000175000017500000003741111767656530022777 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.factory; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMHierarchyException; import org.apache.axiom.om.OMMetaFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.dom.AttrImpl; import org.apache.axiom.om.impl.dom.CDATASectionImpl; import org.apache.axiom.om.impl.dom.CommentImpl; import org.apache.axiom.om.impl.dom.DocumentFragmentImpl; import org.apache.axiom.om.impl.dom.DocumentImpl; import org.apache.axiom.om.impl.dom.DocumentTypeImpl; import org.apache.axiom.om.impl.dom.ElementImpl; import org.apache.axiom.om.impl.dom.NamespaceImpl; import org.apache.axiom.om.impl.dom.OMDOMException; import org.apache.axiom.om.impl.dom.ParentNode; import org.apache.axiom.om.impl.dom.ProcessingInstructionImpl; import org.apache.axiom.om.impl.dom.TextImpl; import org.apache.axiom.om.impl.dom.TextNodeImpl; import org.w3c.dom.Node; import javax.xml.namespace.QName; /** * OM factory implementation for DOOM. It creates nodes that implement * DOM as defined by the interfaces in {@link org.w3c.dom}. *

        * Since DOM requires every node to have an owner document even if it has not yet * been added to a tree, this factory internally maintains a reference to a * {@link DocumentImpl} instance. The document can be set explicitly using the * {@link #OMDOMFactory(DocumentImpl)} constructor or the {@link #setDocument(DocumentImpl)} * method. If none is set, it will be implicitly created when the first node is created. * All nodes created by this factory will have this {@link DocumentImpl} instance as owner * document. *

        * This has several important consequences: *

          *
        • The same instance of this class should not be used to parse or construct * multiple documents unless {@link #setDocument(DocumentImpl)} is used * to reset the {@link DocumentImpl} instance before processing the next document.
        • *
        • Instances of this class are not thread safe and using a single instance concurrently * will lead to undefined results.
        • *
        */ public class OMDOMFactory implements OMFactory { private final OMDOMMetaFactory metaFactory; protected DocumentImpl document; public OMDOMFactory(OMDOMMetaFactory metaFactory) { this.metaFactory = metaFactory; } public OMDOMFactory() { this(new OMDOMMetaFactory()); } public OMDOMFactory(DocumentImpl doc) { this(new OMDOMMetaFactory()); this.document = doc; } public OMMetaFactory getMetaFactory() { return metaFactory; } public OMDocument createOMDocument() { if (this.document == null) this.document = new DocumentImpl(this); return this.document; } /** * Configure this factory to use the given document. Use with care. * * @param document */ public void setDocument(DocumentImpl document) { this.document = document; } public OMElement createOMElement(String localName, OMNamespace ns) { return new ElementImpl((DocumentImpl) this.createOMDocument(), localName, (NamespaceImpl) ns, this); } public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMDOMException { if (parent == null) { return new ElementImpl((DocumentImpl) this.createOMDocument(), localName, (NamespaceImpl) ns, this); } switch (((ParentNode) parent).getNodeType()) { case Node.ELEMENT_NODE: // We are adding a new child to an elem ElementImpl parentElem = (ElementImpl) parent; ElementImpl elem = new ElementImpl((DocumentImpl) parentElem .getOwnerDocument(), localName, (NamespaceImpl) ns, this); parentElem.appendChild(elem); return elem; case Node.DOCUMENT_NODE: DocumentImpl docImpl = (DocumentImpl) parent; return new ElementImpl(docImpl, localName, (NamespaceImpl) ns, this); case Node.DOCUMENT_FRAGMENT_NODE: DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent; return new ElementImpl((DocumentImpl) docFragImpl .getOwnerDocument(), localName, (NamespaceImpl) ns, this); default: throw new OMDOMException( "The parent container can only be an ELEMENT, DOCUMENT " + "or a DOCUMENT FRAGMENT"); } } /** Creates an OMElement with the builder. */ public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder) { switch (((ParentNode) parent).getNodeType()) { case Node.ELEMENT_NODE: // We are adding a new child to an elem ElementImpl parentElem = (ElementImpl) parent; ElementImpl elem = new ElementImpl((DocumentImpl) parentElem .getOwnerDocument(), localName, (NamespaceImpl) ns, builder, this); parentElem.appendChild(elem); return elem; case Node.DOCUMENT_NODE: DocumentImpl docImpl = (DocumentImpl) parent; ElementImpl elem2 = new ElementImpl(docImpl, localName, (NamespaceImpl) ns, builder, this); docImpl.appendChild(elem2); return elem2; case Node.DOCUMENT_FRAGMENT_NODE: DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent; return new ElementImpl((DocumentImpl) docFragImpl .getOwnerDocument(), localName, (NamespaceImpl) ns, builder, this); default: throw new OMDOMException( "The parent container can only be an ELEMENT, DOCUMENT " + "or a DOCUMENT FRAGMENT"); } } /* (non-Javadoc) * @see org.apache.axiom.om.OMFactory#createOMElement(org.apache.axiom.om.OMDataSource, java.lang.String, org.apache.axiom.om.OMNamespace, org.apache.axiom.om.OMContainer) */ public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns, OMContainer parent) { throw new UnsupportedOperationException("Not supported for DOM"); } /* (non-Javadoc) * @see org.apache.axiom.om.OMFactory#createOMElement(org.apache.axiom.om.OMDataSource, java.lang.String, org.apache.axiom.om.OMNamespace) */ public OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns) { throw new UnsupportedOperationException("Not supported for DOM"); } /** * Unsupported. */ public OMSourcedElement createOMElement(OMDataSource source, QName qname) { throw new UnsupportedOperationException("Not supported for DOM"); } public OMElement createOMElement(String localName, String namespaceURI, String prefix) { if (namespaceURI == null) { throw new IllegalArgumentException("namespaceURI must not be null"); } else if (namespaceURI.length() == 0) { return createOMElement(localName, null); } else { return createOMElement(localName, createOMNamespace(namespaceURI, prefix)); } } /** * Creates a new OMDOM Element node and adds it to the given parent. * * @see #createOMElement(String, OMNamespace, OMContainer) * @see org.apache.axiom.om.OMFactory#createOMElement( javax.xml.namespace.QName, * org.apache.axiom.om.OMContainer) */ public OMElement createOMElement(QName qname, OMContainer parent) throws OMException { NamespaceImpl ns; if (qname.getNamespaceURI().length() == 0) { ns = null; } else if (qname.getPrefix() != null) { ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix()); } else { ns = new NamespaceImpl(qname.getNamespaceURI()); } return createOMElement(qname.getLocalPart(), ns, parent); } /** * Create an OMElement with the given QName *

        * If the QName contains a prefix, we will ensure that an OMNamespace is created mapping the * given namespace to the given prefix. If no prefix is passed, we'll create a generated one. * * @param qname * @return the new OMElement. */ public OMElement createOMElement(QName qname) throws OMException { return createOMElement(qname, null); } /** * Creates a new OMNamespace. * * @see org.apache.axiom.om.OMFactory#createOMNamespace(String, String) */ public OMNamespace createOMNamespace(String uri, String prefix) { return new NamespaceImpl(uri, prefix); } public OMText createOMText(OMContainer parent, String text) { return createOMText(parent, text, OMNode.TEXT_NODE); } public OMText createOMText(OMContainer parent, QName text) { return new TextImpl(parent, text, this); } public OMText createOMText(OMContainer parent, QName text, int type) { return new TextImpl(parent, text, type, this); } public OMText createOMText(OMContainer parent, String text, int type) { if (parent instanceof DocumentImpl) { throw new OMHierarchyException( "DOM doesn't support text nodes as children of a document"); } DocumentImpl ownerDocument = (DocumentImpl)((ElementImpl)parent).getOwnerDocument(); TextNodeImpl txt; if (type == OMNode.CDATA_SECTION_NODE) { txt = new CDATASectionImpl(ownerDocument, text, this); } else { txt = new TextImpl(ownerDocument, text, type, this); } parent.addChild(txt); return txt; } public OMText createOMText(OMContainer parent, OMText source) { return new TextImpl(parent, (TextImpl) source, this); } public OMText createOMText(OMContainer parent, char[] charArary, int type) { ElementImpl parentElem = (ElementImpl) parent; TextImpl txt = new TextImpl((DocumentImpl) parentElem .getOwnerDocument(), charArary, this); parentElem.addChild(txt); return txt; } /** * Creates a OMDOM Text node carrying the given value. * * @see org.apache.axiom.om.OMFactory#createOMText(String) */ public OMText createOMText(String s) { return new TextImpl(this.document, s, this); } /** * Creates a Character node of the given type. * * @see org.apache.axiom.om.OMFactory#createOMText(String, int) */ public OMText createOMText(String text, int type) { switch (type) { case OMNode.TEXT_NODE: return new TextImpl(this.document, text, this); default: throw new OMDOMException("Only Text nodes are supported right now"); } } /** * Creates a new OMDOM Text node with the value of the given text value along with the MTOM * optimization parameters and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(String, String, boolean) */ public OMText createOMText(String text, String mimeType, boolean optimize) { return new TextImpl(this.document, text, mimeType, optimize, this); } /** * Creates a new OMDOM Text node with the given datahandler and the given MTOM optimization * configuration and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean) */ public OMText createOMText(Object dataHandler, boolean optimize) { return new TextImpl(this.document, dataHandler, optimize, this); } public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize) { return new TextImpl(this.document, contentID, dataHandlerProvider, optimize, this); } /** * Creates an OMDOM Text node, adds it to the give parent element and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer, String, * String, boolean) */ public OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize) { TextImpl text = new TextImpl((DocumentImpl) ((ElementImpl) parent) .getOwnerDocument(), s, mimeType, optimize, this); parent.addChild(text); return text; } public OMText createOMText(String contentID, OMContainer parent, OMXMLParserWrapper builder) { TextImpl text = new TextImpl(contentID, parent, builder, this); parent.addChild(text); return text; } public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value) { return new AttrImpl(this.getDocument(), localName, ns, value, this); } public OMDocType createOMDocType(OMContainer parent, String content) { DocumentTypeImpl docType = new DocumentTypeImpl(this.getDocument(), this); docType.setValue(content); parent.addChild(docType); return docType; } public OMProcessingInstruction createOMProcessingInstruction( OMContainer parent, String piTarget, String piData) { ProcessingInstructionImpl pi = new ProcessingInstructionImpl(getDocumentFromParent(parent), piTarget, piData, this); parent.addChild(pi); return pi; } public OMComment createOMComment(OMContainer parent, String content) { CommentImpl comment = new CommentImpl(getDocumentFromParent(parent), content, this); parent.addChild(comment); return comment; } public DocumentImpl getDocument() { return (DocumentImpl) this.createOMDocument(); } public OMDocument createOMDocument(OMXMLParserWrapper builder) { this.document = new DocumentImpl(builder, this); return this.document; } private DocumentImpl getDocumentFromParent(OMContainer parent) { if (parent instanceof DocumentImpl) { return (DocumentImpl) parent; } else { return (DocumentImpl) ((ParentNode) parent).getOwnerDocument(); } } } ./src/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java0000664000175000017500000000361211767656530023602 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom.factory; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.impl.AbstractOMMetaFactory; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory; import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory; /** * Meta factory for the DOOM implementation. *

        * As explained in {@link OMDOMFactory}, OM factories for DOOM are not stateless. * Therefore {@link #getOMFactory()}, {@link #getSOAP11Factory()} and * {@link #getSOAP12Factory()} will return a new instance on every invocation. * * @scr.component name="metafactory.dom.component" immediate="true" * @scr.service interface="org.apache.axiom.om.OMMetaFactory" * @scr.property name="implementationName" type="String" value="doom" */ public class OMDOMMetaFactory extends AbstractOMMetaFactory { public OMFactory getOMFactory() { return new OMDOMFactory(this); } public SOAPFactory getSOAP11Factory() { return new SOAP11Factory(this); } public SOAPFactory getSOAP12Factory() { return new SOAP12Factory(this); } } ./src/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java0000664000175000017500000000607111767656530024323 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; public class ProcessingInstructionImpl extends ChildNode implements ProcessingInstruction, OMProcessingInstruction { private String target; private String value; public ProcessingInstructionImpl(DocumentImpl ownerDocument, String target, String value, OMFactory factory) { super(ownerDocument, factory); this.target = target; this.value = value; done = true; } public int getType() { return OMNode.PI_NODE; } public void setType(int nodeType) throws OMException { if (nodeType != OMNode.PI_NODE) { throw new OMException("Can't change the type of a ProcessingInstruction node"); } } public short getNodeType() { return Node.PROCESSING_INSTRUCTION_NODE; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getValue() { return value; } public void setValue(String text) { this.value = text; } public String getData() { return value; } public void setData(String data) throws DOMException { if (!isReadonly()) { value = data; } else { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null)); } } public String getNodeName() { return target; } public String getNodeValue() throws DOMException { return value; } public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException { writer.writeProcessingInstruction(target + " ", value); } } ./src/org/apache/axiom/om/impl/dom/TextImpl.java0000664000175000017500000000776711767656530020706 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import javax.xml.namespace.QName; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.w3c.dom.Node; public class TextImpl extends TextNodeImpl { private boolean isWhitespace; public TextImpl(DocumentImpl ownerNode, char[] value, OMFactory factory) { super(ownerNode, value, factory); } public TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory) { super(ownerNode, dataHandler, optimize, factory); } public TextImpl(DocumentImpl ownerNode, String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize, OMFactory factory) { super(ownerNode, contentID, dataHandlerProvider, optimize, factory); } public TextImpl(DocumentImpl ownerNode, OMFactory factory) { super(ownerNode, factory); } public TextImpl(DocumentImpl ownerNode, String value, OMFactory factory) { super(ownerNode, value, factory); } public TextImpl(DocumentImpl ownerNode, String value, int nodeType, OMFactory factory) { super(ownerNode, value, factory); isWhitespace = nodeType == SPACE_NODE; } public TextImpl(DocumentImpl ownerNode, String value, String mimeType, boolean optimize, OMFactory factory) { super(ownerNode, value, mimeType, optimize, factory); } public TextImpl(OMContainer parent, QName text, int nodeType, OMFactory factory) { super(parent, text, nodeType, factory); } public TextImpl(OMContainer parent, QName text, OMFactory factory) { super(parent, text, factory); } public TextImpl(OMContainer parent, TextNodeImpl source, OMFactory factory) { super(parent, source, factory); } public TextImpl(String contentID, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory) { super(contentID, parent, builder, factory); } public TextImpl(String text, OMFactory factory) { super(text, factory); } public TextImpl(String text, String mimeType, boolean optimize, boolean isBinary, OMFactory factory) { super(text, mimeType, optimize, isBinary, factory); } public TextImpl(String text, String mimeType, boolean optimize, OMFactory factory) { super(text, mimeType, optimize, factory); } public int getType() throws OMException { return isWhitespace ? OMNode.SPACE_NODE : OMNode.TEXT_NODE; } public void setType(int nodeType) throws OMException { switch (nodeType) { case OMNode.TEXT_NODE: isWhitespace = false; break; case OMNode.SPACE_NODE: isWhitespace = true; break; default: throw new UnsupportedOperationException(); } } public Node cloneNode(boolean deep) { TextImpl textImpl = new TextImpl(this.textValue, this.factory); textImpl.setOwnerDocument(this.ownerNode); return textImpl; } } ./src/org/apache/axiom/om/impl/dom/CDATASectionImpl.java0000664000175000017500000000353611767656530022111 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.w3c.dom.CDATASection; import org.w3c.dom.Node; public class CDATASectionImpl extends TextNodeImpl implements CDATASection { public CDATASectionImpl(String text, OMFactory factory) { super(text, factory); } public CDATASectionImpl(DocumentImpl ownerDocument, String text, OMDOMFactory factory) { super(ownerDocument, text, factory); } public int getType() throws OMException { return OMNode.CDATA_SECTION_NODE; } public void setType(int nodeType) throws OMException { if (nodeType != OMNode.CDATA_SECTION_NODE) { throw new UnsupportedOperationException(); } } public Node cloneNode(boolean deep) { CDATASectionImpl textImpl = new CDATASectionImpl(this.textValue, this.factory); textImpl.setOwnerDocument(this.ownerNode); return textImpl; } } ./src/org/apache/axiom/om/impl/dom/NamedNodeMapImpl.java0000664000175000017500000003614311767656530022240 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.dom; import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import java.util.Vector; /** Most of the implementation is taken from org.apache.xerces.dom.NamedNodeMapImpl */ public class NamedNodeMapImpl implements NamedNodeMap { Vector nodes; ParentNode ownerNode; // // Data // protected short flags; protected final static short READONLY = 0x1 << 0; protected final static short CHANGED = 0x1 << 1; protected final static short HASDEFAULTS = 0x1 << 2; protected NamedNodeMapImpl(ParentNode ownerNode) { this.ownerNode = ownerNode; } /** * */ public Node getNamedItem(String name) { int i = findNamePoint(name, 0); return (i < 0) ? null : (Node) (nodes.elementAt(i)); } /** From org.apache.xerces.dom.NamedNodeMapImpl */ public Node item(int index) { return (nodes != null && index < nodes.size()) ? (Node) (nodes .elementAt(index)) : null; } /** From org.apache.xerces.dom.NamedNodeMapImpl */ public int getLength() { return (nodes != null) ? nodes.size() : 0; } /** * Removes a node specified by name. * * @param name * The name of a node to remove. * @return Returns the node removed from the map if a node with such a name * exists. */ /***/ public Node removeNamedItem(String name) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } int i = findNamePoint(name, 0); if (i < 0) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } NodeImpl n = (NodeImpl) nodes.elementAt(i); nodes.removeElementAt(i); return n; } // removeNamedItem(String):Node /** * Introduced in DOM Level 2. Retrieves a node specified by local name and namespace URI. * * @param namespaceURI The namespace URI of the node to retrieve. When it is null or an empty * string, this method behaves like getNamedItem. * @param localName The local name of the node to retrieve. * @return Returns s Node (of any type) with the specified name, or null if the specified name * did not identify any node in the map. */ public Node getNamedItemNS(String namespaceURI, String localName) { int i = findNamePoint(namespaceURI, localName); return (i < 0) ? null : (Node) (nodes.elementAt(i)); } // getNamedItemNS(String,String):Node /** * Adds a node using its namespaceURI and localName. * * @param arg A node to store in a named node map. The node will later be accessible using the * value of the namespaceURI and localName attribute of the node. If a node with * those namespace URI and local name is already present in the map, it is replaced * by the new one. * @return Returns the replaced Node if the new Node replaces an existing node else returns * null. * @see org.w3c.dom.NamedNodeMap#setNamedItem */ public Node setNamedItemNS(Node arg) throws DOMException { DocumentImpl ownerDocument = (DocumentImpl) ownerNode .getOwnerDocument(); if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (arg.getOwnerDocument() != ownerDocument) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName()); NodeImpl previous = null; if (i >= 0) { previous = (NodeImpl) nodes.elementAt(i); nodes.setElementAt(arg, i); } else { // If we can't find by namespaceURI, localName, then we find by // nodeName so we know where to insert. i = findNamePoint(arg.getNodeName(), 0); if (i >= 0) { previous = (NodeImpl) nodes.elementAt(i); nodes.insertElementAt(arg, i); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { nodes = new Vector(5, 10); } nodes.insertElementAt(arg, i); } } return previous; } // setNamedItemNS(Node):Node /** * Introduced in DOM Level 2. Removes a node specified by local name and namespace URI. * * @param namespaceURI The namespace URI of the node to remove. When it is null or an empty * string, this method behaves like removeNamedItem. * @param name The local name of the node to remove. * @return Returns the node removed from the map if a node with such a local name and namespace * URI exists. * @throws DOMException: Raised if there is no node named name in the map. */ public Node removeNamedItemNS(String namespaceURI, String name) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } int i = findNamePoint(namespaceURI, name); if (i < 0) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } NodeImpl n = (NodeImpl) nodes.elementAt(i); nodes.removeElementAt(i); return n; } // removeNamedItem(String):Node /** * Adds a node using its nodeName attribute. As the nodeName attribute is used to derive the * name which the node must be stored under, multiple nodes of certain types (those that have a * "special" string value) cannot be stored as the names would clash. This is seen as preferable * to allowing nodes to be aliased. * * @param arg A node to store in a named node map. The node will later be accessible using the * value of the namespaceURI and localName attribute of the node. If a node with * those namespace URI and local name is already present in the map, it is replaced * by the new one. * @return Returns the replaced Node if the new Node replaces an existing node, otherwise * returns null. * @throws org.w3c.dom.DOMException The exception description. * @see org.w3c.dom.NamedNodeMap#setNamedItem */ public Node setNamedItem(Node arg) throws DOMException { DocumentImpl ownerDocument = (DocumentImpl) ownerNode .getOwnerDocument(); if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.NO_MODIFICATION_ALLOWED_ERR, null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (arg.getOwnerDocument() != ownerDocument) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, DOMException.WRONG_DOCUMENT_ERR, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); } int i = findNamePoint(arg.getNodeName(), 0); NodeImpl previous = null; if (i >= 0) { previous = (NodeImpl) nodes.elementAt(i); nodes.setElementAt(arg, i); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { nodes = new Vector(5, 10); } nodes.insertElementAt(arg, i); } return previous; } // setNamedItem(Node):Node final boolean isReadOnly() { return (flags & READONLY) != 0; } final void isReadOnly(boolean value) { flags = (short) (value ? flags | READONLY : flags & ~READONLY); } final boolean changed() { return (flags & CHANGED) != 0; } final void changed(boolean value) { flags = (short) (value ? flags | CHANGED : flags & ~CHANGED); } final boolean hasDefaults() { return (flags & HASDEFAULTS) != 0; } final void hasDefaults(boolean value) { flags = (short) (value ? flags | HASDEFAULTS : flags & ~HASDEFAULTS); } /** * From org.apache.xerces.dom.NamedNodeMapImpl *

        * Subroutine: Locates the named item, or the point at which said item should be added. * * @param name Name of a node to look up. * @return If positive or zero, the index of the found item. If negative, index of the * appropriate point at which to insert the item, encoded as -1-index and hence * reconvertable by subtracting it from -1. (Encoding because I don't want to recompare * the strings but don't want to burn bytes on a datatype to hold a flagged value.) */ protected int findNamePoint(String name, int start) { // Binary search int i = 0; if (nodes != null) { int first = start; int last = nodes.size() - 1; while (first <= last) { i = (first + last) / 2; int test = name.compareTo(((Node) (nodes.elementAt(i))) .getNodeName()); if (test == 0) { return i; // Name found } else if (test < 0) { last = i - 1; } else { first = i + 1; } } if (first > i) { i = first; } } return -1 - i; // not-found has to be encoded. } // findNamePoint(String):int /** This findNamePoint is for DOM Level 2 Namespaces. */ protected int findNamePoint(String namespaceURI, String name) { if (nodes == null) return -1; if (name == null) return -1; // This is a linear search through the same nodes Vector. // The Vector is sorted on the DOM Level 1 nodename. // The DOM Level 2 NS keys are namespaceURI and Localname, // so we must linear search thru it. // In addition, to get this to work with nodes without any namespace // (namespaceURI and localNames are both null) we then use the nodeName // as a secondary key. for (int i = 0; i < nodes.size(); i++) { NodeImpl a = (NodeImpl) nodes.elementAt(i); String aNamespaceURI = a.getNamespaceURI(); String aLocalName = a.getLocalName(); if (namespaceURI == null) { if (aNamespaceURI == null && (name.equals(aLocalName) || (aLocalName == null && name.equals(a.getNodeName())))) return i; } else { if (namespaceURI.equals(aNamespaceURI) && name.equals(aLocalName)) return i; } } return -1; } // Compare 2 nodes in the map. If a precedes b, return true, otherwise // return false protected boolean precedes(Node a, Node b) { if (nodes != null) { for (int i = 0; i < nodes.size(); i++) { Node n = (Node) nodes.elementAt(i); if (n == a) return true; if (n == b) return false; } } return false; } /** NON-DOM: Remove attribute at specified index. */ protected void removeItem(int index) { if (nodes != null && index < nodes.size()) { nodes.removeElementAt(index); } } protected Object getItem(int index) { if (nodes != null) { return nodes.elementAt(index); } return null; } protected int addItem(Node arg) { int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName()); if (i >= 0) { nodes.setElementAt(arg, i); } else { // If we can't find by namespaceURI, localName, then we find by // nodeName so we know where to insert. i = findNamePoint(arg.getNodeName(), 0); if (i >= 0) { nodes.insertElementAt(arg, i); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { nodes = new Vector(5, 10); } nodes.insertElementAt(arg, i); } } return i; } /** * NON-DOM: copy content of this map into the specified vector * * @param list Vector to copy information into. * @return Returns a copy of this node named map. */ protected Vector cloneMap(Vector list) { if (list == null) { list = new Vector(5, 10); } list.setSize(0); if (nodes != null) { for (int i = 0; i < nodes.size(); i++) { list.insertElementAt(nodes.elementAt(i), i); } } return list; } protected int getNamedItemIndex(String namespaceURI, String localName) { return findNamePoint(namespaceURI, localName); } /** NON-DOM remove all elements from this map. */ public void removeAll() { if (nodes != null) { nodes.removeAllElements(); } } } ./src/org/apache/axiom/om/impl/MTOMConstants.java0000664000175000017500000000310411767656530021007 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; public interface MTOMConstants { public static final String XOP_INCLUDE = "Include"; public static final String XOP_NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include"; /** If the Message is MTOM optimised then MTOM_TYPE */ String MTOM_TYPE = "application/xop+xml"; /** If the message is Soap with Attachments SWA_TYPE */ String SWA_TYPE = "text/xml"; String SWA_TYPE_12 = "application/soap+xml"; /** * @deprecated */ String ROOT_PART = "SoapPart"; /** * @deprecated This was used in old versions of Axis2 as the key identifying the attachments map * in the message context. You should no longer use this. */ String ATTACHMENTS = "Attachments"; } ./src/org/apache/axiom/om/impl/traverse/0000775000175000017500000000000011767656530017330 5ustar brianbrian./src/org/apache/axiom/om/impl/traverse/OMFilterIterator.java0000664000175000017500000000444511767656530023375 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.axiom.om.OMNode; /** * Abstract iterator that returns matching nodes from another iterator. */ public abstract class OMFilterIterator implements Iterator { private final Iterator parent; private OMNode nextNode; private boolean noMoreNodes; public OMFilterIterator(Iterator parent) { this.parent = parent; } /** * Determine whether the given node matches the filter criteria. * * @param node the node to test * @return true if the node matches, i.e. if it should be returned * by a call to {@link #next()} */ protected abstract boolean matches(OMNode node); public boolean hasNext() { if (noMoreNodes) { return false; } else if (nextNode != null) { return true; } else { while (parent.hasNext()) { OMNode node = (OMNode)parent.next(); if (matches(node)) { nextNode = node; return true; } } noMoreNodes = true; return false; } } public Object next() { if (hasNext()) { OMNode result = nextNode; nextNode = null; return result; } else { throw new NoSuchElementException(); } } public void remove() { parent.remove(); } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenNamespaceIterator.java0000664000175000017500000000277511767656530025521 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMNode; import javax.xml.namespace.QName; /** * Iterate over elements with the same namespace uri * */ public class OMChildrenNamespaceIterator extends OMChildrenQNameIterator { public OMChildrenNamespaceIterator(OMNode currentChild, String uri) { super(currentChild, new QName(uri, "dummyName")); } /** * This version of equals returns true if the local parts match. * * @param searchQName * @param currentQName * @return true if equals */ public boolean isEqual(QName searchQName, QName currentQName) { return searchQName.getNamespaceURI().equals(searchQName.getNamespaceURI()); } } ./src/org/apache/axiom/om/impl/traverse/OMAbstractIterator.java0000664000175000017500000000565611767656530023720 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMNode; /** * Abstract base class for iterators over sets of OM nodes. */ public abstract class OMAbstractIterator implements Iterator { private OMNode currentNode; /** * The parent of the current node. This is used to detect concurrent modifications. */ private OMContainer currentParent; private OMNode nextNode; private boolean noMoreNodes; private boolean nextCalled; public OMAbstractIterator(OMNode firstNode) { if (firstNode == null) { noMoreNodes = true; } else { nextNode = firstNode; } } /** * Get the next node. * * @param currentNode the predecessor of the node to retrieve * @return the next node */ protected abstract OMNode getNextNode(OMNode currentNode); public boolean hasNext() { if (noMoreNodes) { return false; } else if (nextNode != null) { return true; } else { if (currentNode.getParent() != currentParent) { throw new ConcurrentModificationException("The current node has been removed using a method other than Iterator#remove()"); } nextNode = getNextNode(currentNode); noMoreNodes = nextNode == null; return !noMoreNodes; } } public Object next() { if (hasNext()) { currentNode = nextNode; currentParent = currentNode.getParent(); nextNode = null; nextCalled = true; return currentNode; } else { throw new NoSuchElementException(); } } public void remove() { if (!nextCalled) { throw new IllegalStateException("next() has not yet been called"); } // Make sure that we know the next node before removing the current one hasNext(); currentNode.detach(); nextCalled = false; } } ./src/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java0000664000175000017500000000746611767656530024513 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNode; import java.util.Iterator; public class OMChildElementIterator implements Iterator { /** Field currentChild */ protected OMNode currentChild; /** Field lastChild */ protected OMNode lastChild; /** Field nextCalled */ protected boolean nextCalled = false; /** Field removeCalled */ protected boolean removeCalled = false; /** * Constructor OMChildrenIterator. * * @param currentChild */ public OMChildElementIterator(OMElement currentChild) { this.currentChild = currentChild; } /** * Removes the last element returned by the iterator (optional operation) from the underlying * collection. This method can be called only once per call to next. The behavior of * an iterator is unspecified if the underlying collection is modified while the iteration is in * progress in any way other than by calling this method. * * @throws UnsupportedOperationException if the remove operation is not supported by * this Iterator. * @throws IllegalStateException if the next method has not yet been called, or * the remove method has already been called * after the last call to the next method. */ public void remove() { if (!nextCalled) { throw new IllegalStateException( "next method has not yet being called"); } if (removeCalled) { throw new IllegalStateException("remove has already being called"); } removeCalled = true; // since this acts on the last child there is no need to mess with the current child if (lastChild == null) { throw new OMException("cannot remove a child at this stage!"); } lastChild.detach(); } /** * Returns true if the iteration has more elements. (In other words, returns * true if next would return an element rather than throwing an exception.) * * @return Returns true if the iterator has more elements. */ public boolean hasNext() { return (currentChild != null); } /** * Returns the next element in the iteration. * * @return Returns the next element in the iteration. * @throws java.util.NoSuchElementException * iteration has no more elements. */ public Object next() { nextCalled = true; removeCalled = false; if (hasNext()) { lastChild = currentChild; do { currentChild = currentChild.getNextOMSibling(); } while (currentChild != null && currentChild.getType() != OMNode.ELEMENT_NODE); return lastChild; } return null; } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenLegacyQNameIterator.java0000664000175000017500000000432311767656530025742 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMNode; import javax.xml.namespace.QName; /** * Iterate over elements with the QName that uses the * legacy algorithm. This iterator is only retained for migrating * some existing customers that have a dependency on the old algorithm * @deprecated */ public class OMChildrenLegacyQNameIterator extends OMChildrenQNameIterator { public OMChildrenLegacyQNameIterator(OMNode currentChild, QName qName) { super(currentChild, qName); } /** * This version of equals returns true if the local parts match. * * @param searchQName * @param currentQName * @return true if equals */ public boolean isEqual(QName searchQName, QName currentQName) { // if the given localname is null, whatever value this.qname has, its a match. // But can one give a QName without a localName ?? String localPart = searchQName.getLocalPart(); boolean localNameMatch =(localPart == null) || (localPart.equals("")) || ((currentQName != null) && currentQName.getLocalPart().equals(localPart)); String namespaceURI = searchQName.getNamespaceURI(); boolean namespaceURIMatch = (namespaceURI == null) || (namespaceURI.equals(""))|| ((currentQName != null) && currentQName.getNamespaceURI().equals(namespaceURI)); return localNameMatch && namespaceURIMatch; } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenQNameIterator.java0000664000175000017500000000677011767656530024625 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import javax.xml.namespace.QName; /** * Class OMChildrenQNameIterator * * This iterator returns the elements that have a matching QName. * This class can be extended to customize the QName equality. * */ public class OMChildrenQNameIterator extends OMFilterIterator { /** Field givenQName */ private final QName givenQName; /** * Constructor OMChildrenQNameIterator. * * @param currentChild * @param givenQName */ public OMChildrenQNameIterator(OMNode currentChild, QName givenQName) { super(new OMChildrenIterator(currentChild)); this.givenQName = givenQName; } /** * Returns true if the qnames are equal. * The default algorithm is to use the QName equality (which examines the namespace and localPart). * You can extend this class to provide your own equality algorithm. * @param searchQName * @param currentQName * @return true if qnames are equal. */ public boolean isEqual(QName searchQName, QName currentQName) { return searchQName.equals(currentQName); } protected boolean matches(OMNode node) { if (node instanceof OMElement) { QName thisQName = ((OMElement)node).getQName(); // A null givenName is an indicator to return all elements return givenQName == null || isEqual(givenQName, thisQName); } else { return false; } } /** * Prior versions of the OMChildrenQNameIterator used the following * logic to check equality. This algorithm is incorrect; however some customers * have dependency on this behavior. This method is retained (but deprecated) to allow * them an opportunity to use the old algorithm. * * @param searchQName * @param currentQName * @return true using legacy equality match * @deprecated */ public static boolean isEquals_Legacy(QName searchQName, QName currentQName) { // if the given localname is null, whatever value this.qname has, its a match. But can one give a QName without a localName ?? String localPart = searchQName.getLocalPart(); boolean localNameMatch =(localPart == null) || (localPart.equals("")) || ((currentQName != null) && currentQName.getLocalPart().equals(localPart)); String namespaceURI = searchQName.getNamespaceURI(); boolean namespaceURIMatch = (namespaceURI == null) || (namespaceURI.equals(""))|| ((currentQName != null) && currentQName.getNamespaceURI().equals(namespaceURI)); return localNameMatch && namespaceURIMatch; } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIterator.java0000664000175000017500000000544311767656530030065 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import javax.xml.namespace.QName; /** Class OMChildrenWithSpecificAttributeIterator */ public class OMChildrenWithSpecificAttributeIterator extends OMFilterIterator { /** Field attributeName */ private QName attributeName; /** Field attributeValue */ private String attributeValue; /** Field detach */ private boolean detach; private boolean doCaseSensitiveValueChecks = true; /** * Constructor OMChildrenWithSpecificAttributeIterator. * * @param currentChild * @param attributeName * @param attributeValue * @param detach */ public OMChildrenWithSpecificAttributeIterator(OMNode currentChild, QName attributeName, String attributeValue, boolean detach) { super(new OMChildrenIterator(currentChild)); this.attributeName = attributeName; this.attributeValue = attributeValue; this.detach = detach; } public void setCaseInsensitiveValueChecks(boolean val) { doCaseSensitiveValueChecks = val; } protected boolean matches(OMNode node) { if (node instanceof OMElement) { OMAttribute attr = ((OMElement) node).getAttribute( attributeName); return (attr != null) && (doCaseSensitiveValueChecks ? attr.getAttributeValue().equals(attributeValue) : attr.getAttributeValue().equalsIgnoreCase(attributeValue)); } else { return false; } } /** * Method next. * * @return Returns Object. */ public Object next() { Object result = super.next(); if (detach) { remove(); } return result; } } ./src/org/apache/axiom/om/impl/traverse/OMDescendantsIterator.java0000664000175000017500000000351011767656530024373 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMNode; /** * Iterator that iterates over all descendants in document order. */ public class OMDescendantsIterator extends OMAbstractIterator { private int level; public OMDescendantsIterator(OMNode firstNode) { super(firstNode); } protected OMNode getNextNode(OMNode currentNode) { if (currentNode instanceof OMContainer) { OMNode firstChild = ((OMContainer)currentNode).getFirstOMChild(); if (firstChild != null) { level++; return firstChild; } } OMNode node = currentNode; while (true) { OMNode nextSibling = node.getNextOMSibling(); if (nextSibling != null) { return nextSibling; } else if (level == 0) { return null; } else { node = (OMNode)node.getParent(); level--; } } } } ./src/org/apache/axiom/om/impl/traverse/OMQNameFilterIterator.java0000664000175000017500000000275711767656530024323 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import java.util.Iterator; import javax.xml.namespace.QName; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; /** * Iterator that selects elements based on {@link QName} equality, * i.e. namespace URI and local name. * Namespace prefixes are not taken into account by the filter. */ public class OMQNameFilterIterator extends OMFilterIterator { private final QName qname; public OMQNameFilterIterator(Iterator parent, QName qname) { super(parent); this.qname = qname; } protected boolean matches(OMNode node) { return node instanceof OMElement && ((OMElement)node).getQName().equals(qname); } } ./src/org/apache/axiom/om/impl/traverse/OMQualifiedNameFilterIterator.java0000664000175000017500000000434011767656530026014 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import java.util.Iterator; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; /** * Iterator that selects elements based on prefix and local name. * Note that namespace URIs are not taken into account by the filter. */ public class OMQualifiedNameFilterIterator extends OMFilterIterator { private final String prefix; private final String localName; public OMQualifiedNameFilterIterator(Iterator parent, String qualifiedName) { super(parent); int idx = qualifiedName.indexOf(':'); if (idx == -1) { prefix = null; localName = qualifiedName; } else { prefix = qualifiedName.substring(0, idx); localName = qualifiedName.substring(idx+1); } } protected boolean matches(OMNode node) { if (node instanceof OMElement) { OMElement element = (OMElement)node; if (!localName.equals(element.getLocalName())) { return false; } else { OMNamespace ns = ((OMElement)node).getNamespace(); if (prefix == null) { return ns == null || ns.getPrefix().length() == 0; } else { return ns != null && prefix.equals(ns.getPrefix()); } } } else { return false; } } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenIterator.java0000664000175000017500000000236011767656530023672 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMNode; /** Class OMChildrenIterator */ public class OMChildrenIterator extends OMAbstractIterator { /** * Constructor OMChildrenIterator. * * @param currentChild */ public OMChildrenIterator(OMNode currentChild) { super(currentChild); } protected OMNode getNextNode(OMNode currentNode) { return currentNode.getNextOMSibling(); } } ./src/org/apache/axiom/om/impl/traverse/OMChildrenLocalNameIterator.java0000664000175000017500000000276711767656530025461 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.traverse; import org.apache.axiom.om.OMNode; import javax.xml.namespace.QName; /** * Iterate over elements with the same LocalName * */ public class OMChildrenLocalNameIterator extends OMChildrenQNameIterator { public OMChildrenLocalNameIterator(OMNode currentChild, String localName) { super(currentChild, new QName("", localName)); } /** * This version of equals returns true if the local parts match. * * @param searchQName * @param currentQName * @return true if equals */ public boolean isEqual(QName searchQName, QName currentQName) { return searchQName.getLocalPart().equals(currentQName.getLocalPart()); } } ./src/org/apache/axiom/om/impl/EmptyOMLocation.java0000664000175000017500000000176111767656530021370 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import org.apache.axiom.util.stax.DummyLocation; /** * @deprecated use {@link DummyLocation#INSTANCE} instead */ public class EmptyOMLocation extends DummyLocation { } ./src/org/apache/axiom/om/impl/SwitchingWrapper.java0000664000175000017500000014622711767656530021654 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import java.io.Writer; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; import java.util.Stack; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.CharacterDataReader; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDocType; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMSerializable; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMNavigator; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.impl.exception.OMStreamingException; import org.apache.axiom.util.namespace.MapBasedNamespaceContext; import org.apache.axiom.util.stax.AbstractXMLStreamReader; import org.apache.axiom.util.stax.DummyLocation; import org.apache.axiom.util.stax.XMLStreamReaderUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Class used internally by {@link OMStAXWrapper}. */ class SwitchingWrapper extends AbstractXMLStreamReader implements DataHandlerReader, CharacterDataReader, XMLStreamConstants { private static final Log log = LogFactory.getLog(SwitchingWrapper.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); /** Field navigator */ private OMNavigator navigator; /** Field builder */ private OMXMLParserWrapper builder; /** Field parser */ private XMLStreamReader parser; /** * The {@link DataHandlerReader} extension of the underlying parser, or null * if the parser doesn't support this extension. */ private DataHandlerReader dataHandlerReader; private boolean _isClosed = false; // Indicate if parser is closed private boolean _releaseParserOnClose = false; // Defaults to legacy behavior, which is keep the reference /** Field rootNode */ private OMContainer rootNode; /** Field isFirst */ private boolean isFirst = true; // Navigable means the output should be taken from the navigator. // As soon as the navigator returns a null navigable will be reset // to false and the subsequent events will be taken from the builder // or the parser directly. /** Field NAVIGABLE */ private static final short NAVIGABLE = 0; private static final short SWITCH_AT_NEXT = 1; private static final short COMPLETED = 2; private static final short SWITCHED = 3; private static final short DOCUMENT_COMPLETE = 4; /** Field state */ private short state; /** Field currentEvent Default set to START_DOCUMENT */ private int currentEvent = START_DOCUMENT; // SwitchingAllowed is set to false by default. // This means that unless the user explicitly states // that he wants things not to be cached, everything will // be cached. /** Field switchingAllowed */ boolean switchingAllowed = false; // namespaceURI interning // default is false because most XMLStreamReader implementations don't do interning // due to performance impacts boolean namespaceURIInterning = false; /** Field elementStack */ private Stack nodeStack = null; // keeps the next event. The parser actually keeps one step ahead to // detect the end of navigation. (at the end of the stream the navigator // returns a null /** Field nextNode */ private OMSerializable nextNode = null; // holder for the current node. Needs this to generate events from the // current node /** Field currentNode */ private OMSerializable currentNode = null; // needs this to refer to the last known node /** Field lastNode */ private OMSerializable lastNode = null; /** Track depth to ensure we stop generating events when we are done with the root node. */ int depth = 0; // Cache attributes and namespaces. This avoids creating a new Iterator for every call // to getAttributeXXX and getNamespaceXXX. A value of -1 indicates that the // attributes or namespaces for the current element have not been loaded yet. The // two arrays are resized on demand. private int attributeCount = -1; private OMAttribute[] attributes = new OMAttribute[16]; private int namespaceCount = -1; private OMNamespace[] namespaces = new OMNamespace[16]; /** * Method setAllowSwitching. * * @param b */ public void setAllowSwitching(boolean b) { this.switchingAllowed = b; } /** * Method isAllowSwitching. * * @return Returns boolean. */ public boolean isAllowSwitching() { return switchingAllowed; } /** * Set namespace uri interning * @param b */ public void setNamespaceURIInterning(boolean b) { this.namespaceURIInterning = b; } /** * @return if namespace uri interning */ public boolean isNamespaceURIInterning() { return this.namespaceURIInterning; } /** * Constructor. * * @param builder * @param startNode * @param cache */ public SwitchingWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache) { // create a navigator this.navigator = new OMNavigator(startNode); this.builder = builder; this.rootNode = startNode; // initiate the next and current nodes // Note - navigator is written in such a way that it first // returns the starting node at the first call to it // Note - for OMSourcedElements, temporarily set caching // to get the initial navigator nodes boolean resetCache = false; try { if (startNode instanceof OMSourcedElement && !cache && builder != null) { if (!builder.isCache()) { resetCache = true; } builder.setCache(true); // bootstrap the navigator } } catch(Throwable t) {} currentNode = navigator.getNext(); updateNextNode(); if (resetCache) { builder.setCache(cache); } switchingAllowed = !cache; if (startNode instanceof OMDocument) { try { next(); } catch (XMLStreamException ex) { throw new OMException(ex); } } } /** * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getPrefix() */ public String getPrefix() { if (parser != null && currentEvent != END_DOCUMENT) { return parser.getPrefix(); } else { if ((currentEvent == START_ELEMENT) || (currentEvent == END_ELEMENT)) { OMNamespace ns = ((OMElement) lastNode).getNamespace(); if (ns == null) { return null; } else { String prefix = ns.getPrefix(); return prefix == null || prefix.length() == 0 ? null : prefix; } } else { throw new IllegalStateException(); } } } /** * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getNamespaceURI() */ public String getNamespaceURI() { String returnStr; if (parser != null && currentEvent != END_DOCUMENT) { returnStr = parser.getNamespaceURI(); } else { if ((currentEvent == START_ELEMENT) || (currentEvent == END_ELEMENT) || (currentEvent == NAMESPACE)) { OMNamespace ns = ((OMElement) lastNode).getNamespace(); if (ns == null) { returnStr = null; } else { String namespaceURI = ns.getNamespaceURI(); returnStr = namespaceURI.length() == 0 ? null : namespaceURI; } } else { throw new IllegalStateException(); } } // By default most parsers don't intern the namespace. // Unfortunately the property to detect interning on the delegate parsers is hard to detect. // Woodstox has a proprietary property on the XMLInputFactory. // IBM has a proprietary property on the XMLStreamReader. // For now only force the interning if requested. if (this.isNamespaceURIInterning()) { returnStr = (returnStr != null) ? returnStr.intern() : null; } return returnStr; } /** * @return Returns boolean. * @see javax.xml.stream.XMLStreamReader#hasName() */ public boolean hasName() { if (parser != null && currentEvent != END_DOCUMENT) { return parser.hasName(); } else { return ((currentEvent == START_ELEMENT) || (currentEvent == END_ELEMENT)); } } /** * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getLocalName() */ public String getLocalName() { if (parser != null && currentEvent != END_DOCUMENT) { return parser.getLocalName(); } else { if ((currentEvent == START_ELEMENT) || (currentEvent == END_ELEMENT) || (currentEvent == ENTITY_REFERENCE)) { return ((OMElement) lastNode).getLocalName(); } else { throw new IllegalStateException(); } } } /** * @return Returns QName. * @see javax.xml.stream.XMLStreamReader#getName() */ public QName getName() { if (parser != null && currentEvent != END_DOCUMENT) { return parser.getName(); } else { if ((currentEvent == START_ELEMENT) || (currentEvent == END_ELEMENT)) { return getQName((OMElement) lastNode); } else { throw new IllegalStateException(); } } } /** * @return Returns int. * @see javax.xml.stream.XMLStreamReader#getTextLength() */ public int getTextLength() { if (parser != null) { return parser.getTextLength(); } else if (currentEvent == DTD) { // Not sure if that conforms to the StAX spec, but it is what Woodstox does throw new IllegalStateException(); } else { return getTextFromNode().length(); } } /** * @return Returns int. * @see javax.xml.stream.XMLStreamReader#getTextStart() */ public int getTextStart() { if (parser != null) { return parser.getTextStart(); } else { if (currentEvent == DTD) { // Not sure if that conforms to the StAX spec, but it is what Woodstox does throw new IllegalStateException(); } else if (hasText()) { // getTextCharacters always returns a new char array and the start // index is therefore always 0 return 0; } else { throw new IllegalStateException(); } } } /** * @param sourceStart * @param target * @param targetStart * @param length * @return Returns int. * @throws XMLStreamException * @see javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int, int) */ public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { if (parser != null) { try { return parser.getTextCharacters(sourceStart, target, targetStart, length); } catch (XMLStreamException e) { throw new OMStreamingException(e); } } else { if (currentEvent == DTD) { // Not sure if that conforms to the StAX spec, but it is what Woodstox does throw new IllegalStateException(); } else { String text = getTextFromNode(); int copied = Math.min(length, text.length()-sourceStart); text.getChars(sourceStart, sourceStart + copied, target, targetStart); return copied; } } } /** * @return Returns char[]. * @see javax.xml.stream.XMLStreamReader#getTextCharacters() */ public char[] getTextCharacters() { if (parser != null) { return parser.getTextCharacters(); } else if (currentEvent == DTD) { // Not sure if that conforms to the StAX spec, but it is what Woodstox does throw new IllegalStateException(); } else { return getTextFromNode().toCharArray(); } } /** * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getText() */ public String getText() { if (parser != null) { return parser.getText(); } else { return getTextFromNode(); } } private String getTextFromNode() { switch (currentEvent) { case CHARACTERS: case CDATA: case SPACE: return ((OMText)lastNode).getText(); case COMMENT: return ((OMComment)lastNode).getValue(); case DTD: return ((OMDocType)lastNode).getValue(); default: throw new IllegalStateException(); } } public void writeTextTo(Writer writer) throws XMLStreamException, IOException { if (parser != null) { XMLStreamReaderUtils.writeTextTo(parser, writer); } else { switch (currentEvent) { case CHARACTERS: case CDATA: case SPACE: OMText text = (OMText)lastNode; if (text.isCharacters()) { writer.write(text.getTextCharacters()); } else { // TODO: we should cover the binary case in an optimized way writer.write(text.getText()); } break; case COMMENT: writer.write(((OMComment)lastNode).getValue()); break; default: throw new IllegalStateException(); } } } /** * @return Returns int. * @see javax.xml.stream.XMLStreamReader#getEventType() */ // todo this should be improved public int getEventType() { return currentEvent; } private void loadAttributes() { if (attributeCount == -1) { attributeCount = 0; for (Iterator it = ((OMElement)lastNode).getAllAttributes(); it.hasNext(); ) { OMAttribute attr = (OMAttribute)it.next(); if (attributeCount == attributes.length) { OMAttribute[] newAttributes = new OMAttribute[attributes.length*2]; System.arraycopy(attributes, 0, newAttributes, 0, attributes.length); attributes = newAttributes; } attributes[attributeCount] = attr; attributeCount++; } } } private void loadNamespaces() { if (namespaceCount == -1) { namespaceCount = 0; for (Iterator it = ((OMElement)lastNode).getAllDeclaredNamespaces(); it.hasNext(); ) { OMNamespace ns = (OMNamespace)it.next(); // Axiom internally creates an OMNamespace instance for the "xml" prefix, even // if it is not declared explicitly. Filter this instance out. if (!"xml".equals(ns.getPrefix())) { if (namespaceCount == namespaces.length) { OMNamespace[] newNamespaces = new OMNamespace[namespaces.length*2]; System.arraycopy(namespaces, 0, newNamespaces, 0, namespaces.length); namespaces = newNamespaces; } namespaces[namespaceCount] = ns; namespaceCount++; } } } } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getNamespaceURI */ public String getNamespaceURI(int i) { String returnString = null; if (parser != null) { returnString = parser.getNamespaceURI(i); } else { if (isStartElement() || isEndElement() || (currentEvent == NAMESPACE)) { loadNamespaces(); returnString = namespaces[i].getNamespaceURI(); } } /* The following line is necessary to overcome an issue where the empty namespace URI returning null rather than the empty string. Our resolution is to return "" if the return is actually null Note that this is not the case for getNamespaceURI(prefix) method where the contract clearly specifies that the return may be null */ if (returnString == null) returnString = ""; return returnString; } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getNamespacePrefix */ public String getNamespacePrefix(int i) { String returnString = null; if (parser != null) { returnString = parser.getNamespacePrefix(i); } else { if (isStartElement() || isEndElement() || (currentEvent == NAMESPACE)) { loadNamespaces(); String prefix = namespaces[i].getPrefix(); returnString = prefix == null || prefix.length() == 0 ? null : prefix; } } return returnString; } /** * @return Returns int. * @see javax.xml.stream.XMLStreamReader#getNamespaceCount() */ public int getNamespaceCount() { if (parser != null && currentEvent != END_DOCUMENT) { return parser.getNamespaceCount(); } else { if (isStartElement() || isEndElement() || (currentEvent == NAMESPACE)) { loadNamespaces(); return namespaceCount; } else { throw new IllegalStateException(); } } } /** * @param i * @return Returns boolean. * @see javax.xml.stream.XMLStreamReader#isAttributeSpecified */ public boolean isAttributeSpecified(int i) { if (parser != null) { return parser.isAttributeSpecified(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { // The Axiom object model doesn't store this information, // but returning true is a reasonable default. return true; } else { throw new IllegalStateException( "attribute type accessed in illegal event!"); } } } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getAttributeValue */ public String getAttributeValue(int i) { String returnString = null; if (parser != null) { returnString = parser.getAttributeValue(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); returnString = attributes[i].getAttributeValue(); } else { throw new IllegalStateException( "attribute type accessed in illegal event!"); } } return returnString; } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getAttributeType */ public String getAttributeType(int i) { String returnString = null; if (parser != null) { returnString = parser.getAttributeType(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); returnString = attributes[i].getAttributeType(); } else { throw new IllegalStateException( "attribute type accessed in illegal event!"); } } return returnString; } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getAttributePrefix */ public String getAttributePrefix(int i) { String returnString = null; if (parser != null) { returnString = parser.getAttributePrefix(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); OMAttribute attrib = attributes[i]; if (attrib != null) { OMNamespace nameSpace = attrib.getNamespace(); if (nameSpace != null) { returnString = nameSpace.getPrefix(); } } } else { throw new IllegalStateException( "attribute prefix accessed in illegal event!"); } } return returnString; } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getAttributeLocalName */ public String getAttributeLocalName(int i) { String returnString = null; if (parser != null) { returnString = parser.getAttributeLocalName(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); returnString = attributes[i].getLocalName(); } else { throw new IllegalStateException( "attribute localName accessed in illegal event!"); } } return returnString; } /** * @param i * @return Returns String. * @see javax.xml.stream.XMLStreamReader#getAttributeNamespace */ public String getAttributeNamespace(int i) { String returnString = null; if (parser != null) { returnString = parser.getAttributeNamespace(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); OMAttribute attrib = attributes[i]; if (attrib != null) { OMNamespace nameSpace = attrib.getNamespace(); if (nameSpace != null) { returnString = nameSpace.getNamespaceURI(); } } } else { throw new IllegalStateException( "attribute nameSpace accessed in illegal event!"); } } return returnString; } /** * @param i * @return Returns QName. * @see javax.xml.stream.XMLStreamReader#getAttributeName */ public QName getAttributeName(int i) { QName returnQName = null; if (parser != null) { returnQName = parser.getAttributeName(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); returnQName = attributes[i].getQName(); } else { throw new IllegalStateException( "attribute count accessed in illegal event!"); } } return returnQName; } /** * @return Returns int. * @see javax.xml.stream.XMLStreamReader#getAttributeCount */ public int getAttributeCount() { int returnCount = 0; if (parser != null) { returnCount = parser.getAttributeCount(); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { loadAttributes(); returnCount = attributeCount; } else { throw new IllegalStateException( "attribute count accessed in illegal event (" + currentEvent + ")!"); } } return returnCount; } // todo /** * Method getAttributeValue. * * @param s * @param s1 * @return Returns String. */ public String getAttributeValue(String s, String s1) { String returnString = null; if (parser != null) { returnString = parser.getAttributeValue(s, s1); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { QName qname = new QName(s, s1); OMAttribute attrib = ((OMElement) lastNode).getAttribute(qname); if (attrib != null) { returnString = attrib.getAttributeValue(); } } else { throw new IllegalStateException( "attribute type accessed in illegal event!"); } } return returnString; } /** * Method isWhiteSpace. * * @return Returns boolean. */ public boolean isWhiteSpace() { if (parser != null) { return parser.isWhiteSpace(); } else { switch (currentEvent) { case SPACE: return true; case CHARACTERS: // XMLStreamReader Javadoc says that isWhiteSpace "returns true if the cursor // points to a character data event that consists of all whitespace". This // means that this method may return true for a CHARACTER event and we need // to scan the text of the node. String text = getTextFromNode(); for (int i=0; i * Note that this class doesn't support serializing {@link org.apache.axiom.om.OMDocType} * nodes. They will be silently skipped. *

        * This class can also generate SAX events for a subtree. This is the case if the * element passed to the constructor is not the root element of the document. In this * case, care is taken to properly generate startPrefixMapping and * endPrefixMapping events also for namespace mappings declared on the ancestors * of the element. *

        * To understand why this is important, consider the following example: *

        <root xmlns:ns="urn:ns"><element attr="ns:someThing"/><root>
        * In that case, to correctly interpret the attribute value, the SAX content handler must be * aware of the namespace mapping for the ns prefix, even if the serialization starts * only at the child element. */ public class OMXMLReader extends AbstractXMLReader { private final OMElement element; private final AttributesAdapter attributesAdapter = new AttributesAdapter(); public OMXMLReader(OMElement element) { this.element = element; } public void parse(InputSource input) throws IOException, SAXException { parse(); } public void parse(String systemId) throws IOException, SAXException { parse(); } private void parse() throws SAXException { contentHandler.startDocument(); generateParentPrefixMappingEvents(element, true); generateEvents(element); generateParentPrefixMappingEvents(element, false); contentHandler.endDocument(); } private void generatePrefixMappingEvents(OMNamespace ns, boolean start) throws SAXException { String prefix = ns.getPrefix(); if (prefix != null) { if (start) { contentHandler.startPrefixMapping(prefix, ns.getNamespaceURI()); } else { contentHandler.endPrefixMapping(prefix); } } } private void generatePrefixMappingEvents(OMElement omElement, boolean start) throws SAXException { for (Iterator it = omElement.getAllDeclaredNamespaces(); it.hasNext(); ) { generatePrefixMappingEvents((OMNamespace)it.next(), start); } } private void generateParentPrefixMappingEvents(OMElement omElement, boolean start) throws SAXException { if (!(omElement.getParent() instanceof OMElement)) { return; } // Maintain a set of the prefixes we have already seen. This is required to take into // account that a namespace mapping declared on an element can hide another one declared // for the same prefix on an ancestor of the element. Set/**/ seenPrefixes = new HashSet(); for (Iterator it = omElement.getAllDeclaredNamespaces(); it.hasNext(); ) { seenPrefixes.add(((OMNamespace)it.next()).getPrefix()); } OMElement current = omElement; while (true) { OMContainer parent = current.getParent(); if (!(parent instanceof OMElement)) { return; } current = (OMElement)parent; for (Iterator it = current.getAllDeclaredNamespaces(); it.hasNext(); ) { OMNamespace ns = (OMNamespace)it.next(); if (seenPrefixes.add(ns.getPrefix())) { generatePrefixMappingEvents(ns, start); } } } } private void generateEvents(OMElement omElement) throws SAXException { generatePrefixMappingEvents(omElement, true); OMNamespace omNamespace = omElement.getNamespace(); String uri; String prefix; if (omNamespace != null) { uri = omNamespace.getNamespaceURI(); prefix = omNamespace.getPrefix(); } else { uri = ""; prefix = null; } String localName = omElement.getLocalName(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ":" + localName; } // For performance reasons, we always reuse the same instance of AttributesAdapter. // This is explicitely allowed by the specification of the startElement method. attributesAdapter.setAttributes(omElement); contentHandler.startElement(uri, localName, qName, attributesAdapter); for (Iterator it = omElement.getChildren(); it.hasNext(); ) { OMNode node = (OMNode)it.next(); switch (node.getType()) { case OMNode.ELEMENT_NODE: generateEvents((OMElement)node); break; case OMNode.TEXT_NODE: generateEvents((OMText)node, false); break; case OMNode.SPACE_NODE: generateEvents((OMText)node, true); break; case OMNode.CDATA_SECTION_NODE: if (lexicalHandler != null) { lexicalHandler.startCDATA(); } generateEvents((OMText)node, false); if (lexicalHandler != null) { lexicalHandler.endCDATA(); } break; case OMNode.COMMENT_NODE: if (lexicalHandler != null) { char[] ch = ((OMComment)node).getValue().toCharArray(); lexicalHandler.comment(ch, 0, ch.length); } break; case OMNode.PI_NODE: OMProcessingInstruction pi = (OMProcessingInstruction)node; contentHandler.processingInstruction(pi.getTarget(), pi.getValue()); } } contentHandler.endElement(uri, localName, qName); generatePrefixMappingEvents(omElement, false); } private void generateEvents(OMText omText, boolean space) throws SAXException { char[] ch = omText.getTextCharacters(); if (space) { contentHandler.ignorableWhitespace(ch, 0, ch.length); } else { contentHandler.characters(ch, 0, ch.length); } } protected static class AttributesAdapter implements Attributes { private List/**/ attributes = new ArrayList(5); public void setAttributes(OMElement element) { attributes.clear(); for (Iterator it = element.getAllAttributes(); it.hasNext(); ) { attributes.add(it.next()); } } public int getLength() { return attributes.size(); } public int getIndex(String qName) { for (int i=0, len=attributes.size(); i 0) { String refPrefix = value.substring(0, value.indexOf(":")); String refNamespace = reader.getNamespaceURI(refPrefix); if (refNamespace != null && refNamespace.length() > 0) { newPrefix = OMSerializerUtil.generateSetPrefix(refPrefix, refNamespace, writer, true); // If the prefix is not associated with a namespace yet, remember it so that we can // write out a namespace declaration if (newPrefix != null) { if (DEBUG_ENABLED) { log.debug("An xmlns:" + newPrefix +"=\"" + refNamespace +"\" will be written"); } if (writePrefixList == null) { writePrefixList = new ArrayList(); writeNSList = new ArrayList(); } if (!writePrefixList.contains(newPrefix)) { writePrefixList.add(newPrefix); writeNSList.add(refNamespace); } } } } } } } // Now write out the list of namespace declarations in this list that we constructed // while doing the "set" processing. if (writePrefixList != null) { for (int i = 0; i < writePrefixList.size(); i++) { String prefix = (String) writePrefixList.get(i); String namespace = (String) writeNSList.get(i); if (prefix != null) { if (namespace == null) { writer.writeNamespace(prefix, ""); } else { writer.writeNamespace(prefix, namespace); } } else { writer.writeDefaultNamespace(namespace); } } } // Now write the attributes count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { String prefix = reader.getAttributePrefix(i); prefix = (prefix != null && prefix.length() == 0) ? null : prefix; String namespace = reader.getAttributeNamespace(i); namespace = (namespace != null && namespace.length() == 0) ? null : namespace; if (prefix == null && namespace != null) { // Default namespaces are not allowed on an attribute reference. // Earlier in this code, a unique prefix was added for this case...now obtain and use it prefix = writer.getPrefix(namespace); //XMLStreamWriter doesn't allow for getPrefix to know whether you're asking for the prefix //for an attribute or an element. So if the namespace matches the default namespace getPrefix will return //the empty string, as if it were an element, in all cases (even for attributes, and even if //there was a prefix specifically set up for this), which is not the desired behavior. //Since the interface is base java, we can't fix it where we need to (by adding an attr boolean to //XMLStreamWriter.getPrefix), so we hack it in here... if (prefix == null || "".equals(prefix)) { for (int j = 0; j < writePrefixList.size(); j++) { if (namespace.equals((String) writeNSList.get(j))) { prefix = (String) writePrefixList.get(j); } } } } else if (namespace != null && !prefix.equals("xml")) { // Use the writer's prefix if it is different, but if the writers // prefix is empty then do not replace because attributes do not // default to the default namespace like elements do. String writerPrefix = writer.getPrefix(namespace); if (!prefix.equals(writerPrefix) && !"".equals(writerPrefix)) { prefix = writerPrefix; } } if (namespace != null) { // Qualified attribute writer.writeAttribute(prefix, namespace, reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } else { // Unqualified attribute writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } } } /** * Method serializeEndElement. * * @param writer * @throws XMLStreamException */ protected void serializeEndElement(XMLStreamWriter writer) throws XMLStreamException { writer.writeEndElement(); } /** * @param reader * @param writer * @throws XMLStreamException */ protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { writer.writeCharacters(reader.getText()); } /** * Method serializeCData. * * @param reader * @param writer * @throws XMLStreamException */ protected void serializeCData(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { writer.writeCData(reader.getText()); } /** * Method serializeComment. * * @param reader * @param writer * @throws XMLStreamException */ protected void serializeComment(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { writer.writeComment(reader.getText()); } /** * Method serializeProcessingInstruction. * * @param reader * @param writer * @throws XMLStreamException */ protected void serializeProcessingInstruction(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { writer.writeProcessingInstruction(reader.getPITarget(), reader.getPIData()); } /** * @param reader * @param writer * @throws XMLStreamException */ protected void serializeAttributes(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { int count = reader.getAttributeCount(); String prefix = null; String namespaceName = null; String writerPrefix = null; for (int i = 0; i < count; i++) { prefix = reader.getAttributePrefix(i); namespaceName = reader.getAttributeNamespace(i); /* Some parser implementations return null for the unqualified namespace. But getPrefix(null) will throw an exception (according to the XMLStreamWriter javadoc. We guard against this by using "" for the unqualified namespace. */ namespaceName =(namespaceName == null) ? "" : namespaceName; // Using getNamespaceContext should be avoided when not necessary. // Some parser implementations construct a new NamespaceContext each time it is invoked. // writerPrefix = writer.getNamespaceContext().getPrefix(namespaceName); writerPrefix = writer.getPrefix(namespaceName); if (!"".equals(namespaceName)) { //prefix has already being declared but this particular attrib has a //no prefix attached. So use the prefix provided by the writer if (writerPrefix != null && (prefix == null || prefix.equals(""))) { writer.writeAttribute(writerPrefix, namespaceName, reader.getAttributeLocalName(i), reader.getAttributeValue(i)); //writer prefix is available but different from the current //prefix of the attrib. We should be decalring the new prefix //as a namespace declaration } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) { writer.writeNamespace(prefix, namespaceName); writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader.getAttributeValue(i)); //prefix is null (or empty), but the namespace name is valid! it has not //being written previously also. So we need to generate a prefix //here } else { prefix = generateUniquePrefix(writer.getNamespaceContext()); writer.writeNamespace(prefix, namespaceName); writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } } else { //empty namespace is equal to no namespace! writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } } } /** * Generates a unique namespace prefix that is not in the scope of the NamespaceContext * * @param nsCtxt * @return string */ private String generateUniquePrefix(NamespaceContext nsCtxt) { String prefix = NAMESPACE_PREFIX + namespaceSuffix++; //null should be returned if the prefix is not bound! while (nsCtxt.getNamespaceURI(prefix) != null) { prefix = NAMESPACE_PREFIX + namespaceSuffix++; } return prefix; } /** * Method serializeNamespace. * * @param prefix * @param URI * @param writer * @throws XMLStreamException */ private void serializeNamespace(String prefix, String URI, XMLStreamWriter writer) throws XMLStreamException { String prefix1 = writer.getPrefix(URI); if (prefix1 == null) { writer.writeNamespace(prefix, URI); writer.setPrefix(prefix, URI); } } private void serializeDataHandler() throws XMLStreamException { try { if (dataHandlerReader.isDeferred()) { dataHandlerWriter.writeDataHandler(dataHandlerReader.getDataHandlerProvider(), dataHandlerReader.getContentID(), dataHandlerReader.isOptimized()); } else { dataHandlerWriter.writeDataHandler(dataHandlerReader.getDataHandler(), dataHandlerReader.getContentID(), dataHandlerReader.isOptimized()); } } catch (IOException ex) { throw new XMLStreamException("Error while reading data handler", ex); } } } ./src/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java0000664000175000017500000001371411767656530030011 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.serialize; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** Class StreamWriterToContentHandlerConverter */ public class StreamWriterToContentHandlerConverter implements ContentHandler { /** Field log */ private static Log log = LogFactory.getLog(StreamWriterToContentHandlerConverter.class); /** Field writer */ private XMLStreamWriter writer; /** * Constructor StreamWriterToContentHandlerConverter. * * @param writer */ public StreamWriterToContentHandlerConverter(XMLStreamWriter writer) { this.writer = writer; } /** * Method endDocument. * * @throws SAXException */ public void endDocument() throws SAXException { // do nothing } /** * Method startDocument. * * @throws SAXException */ public void startDocument() throws SAXException { // } /** * Method characters. * * @param ch * @param start * @param length * @throws SAXException */ public void characters(char ch[], int start, int length) throws SAXException { try { writer.writeCharacters(ch, start, length); } catch (XMLStreamException e) { throw new SAXException(e); } } /** * Method ignorableWhitespace. * * @param ch * @param start * @param length * @throws SAXException */ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { // throw new UnsupportedOperationException(); } /** * Method endPrefixMapping. * * @param prefix * @throws SAXException */ public void endPrefixMapping(String prefix) throws SAXException { // throw new UnsupportedOperationException(); } /** * Method skippedEntity. * * @param name * @throws SAXException */ public void skippedEntity(String name) throws SAXException { // throw new UnsupportedOperationException(); } /** * Method setDocumentLocator. * * @param locator */ public void setDocumentLocator(Locator locator) { // throw new UnsupportedOperationException(); } /** * Method processingInstruction. * * @param target * @param data * @throws SAXException */ public void processingInstruction(String target, String data) throws SAXException { // throw new UnsupportedOperationException(); } /** * Method startPrefixMapping. * * @param prefix * @param uri * @throws SAXException */ public void startPrefixMapping(String prefix, String uri) throws SAXException { try { writer.writeNamespace(prefix, uri); writer.setPrefix(prefix, uri); } catch (XMLStreamException e) { throw new SAXException(e); } } /** * Method endElement. * * @param namespaceURI * @param localName * @param qName * @throws SAXException */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { try { writer.writeEndElement(); } catch (XMLStreamException e) { throw new SAXException(e); } } /** * Method getPrefix. * * @param qName * @return Returns String. */ private String getPrefix(String qName) { if (qName != null) { return qName.substring(0, qName.indexOf(":")); } return null; } /** * Method startElement. * * @param namespaceURI * @param localName * @param qName * @param atts * @throws SAXException */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { try { log.info("writing element {" + namespaceURI + '}' + localName + " directly to stream "); String prefix = getPrefix(qName); // it is only the prefix we want to learn from the QName! so we can get rid of the // spliting QName if (prefix == null) { writer.writeStartElement(namespaceURI, localName); } else { writer.writeStartElement(prefix, localName, namespaceURI); } if (atts != null) { int attCount = atts.getLength(); for (int i = 0; i < attCount; i++) { writer.writeAttribute(atts.getURI(i), localName, atts.getValue(i)); } } } catch (XMLStreamException e) { throw new SAXException(e); } } } ./src/org/apache/axiom/om/impl/builder/0000775000175000017500000000000011767656530017123 5ustar brianbrian./src/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java0000775000175000017500000000761411767656530023732 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.util.stax.xop.XOPDecodingStreamReader; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; public class XOPAwareStAXOMBuilder extends StAXOMBuilder implements XOPBuilder { /** Attachments handles deferred parsing of incoming MIME Messages. */ Attachments attachments; /** * Constructor StAXOMBuilder. * * @param ombuilderFactory * @param parser */ public XOPAwareStAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser, Attachments attachments) { super(ombuilderFactory, new XOPDecodingStreamReader(parser, new OMAttachmentAccessorMimePartProvider(attachments))); this.attachments = attachments; } /** * Constructor linked to existing element. * * @param factory * @param parser * @param element */ public XOPAwareStAXOMBuilder(OMFactory factory, XMLStreamReader parser, OMElement element, Attachments attachments) { super(factory, new XOPDecodingStreamReader(parser, new OMAttachmentAccessorMimePartProvider(attachments)), element); this.attachments = attachments; } /** * @param filePath - Path to the XML file * @throws XMLStreamException * @throws FileNotFoundException */ public XOPAwareStAXOMBuilder(String filePath, Attachments attachments) throws XMLStreamException, FileNotFoundException { super(new XOPDecodingStreamReader(StAXUtils.createXMLStreamReader(new FileInputStream( filePath)), new OMAttachmentAccessorMimePartProvider(attachments))); this.attachments = attachments; } /** * @param inStream - instream which contains the XML * @throws XMLStreamException */ public XOPAwareStAXOMBuilder(InputStream inStream, Attachments attachments) throws XMLStreamException { super(new XOPDecodingStreamReader(StAXUtils.createXMLStreamReader(inStream), new OMAttachmentAccessorMimePartProvider(attachments))); this.attachments = attachments; } /** * Constructor StAXXOPAwareOMBuilder. * * @param parser */ public XOPAwareStAXOMBuilder(XMLStreamReader parser, Attachments attachments) { super(new XOPDecodingStreamReader(parser, new OMAttachmentAccessorMimePartProvider( attachments))); this.attachments = attachments; } public DataHandler getDataHandler(String blobContentID) throws OMException { return attachments.getDataHandler(blobContentID); } public Attachments getAttachments() { return attachments; } } ./src/org/apache/axiom/om/impl/builder/SAXOMBuilder.java0000664000175000017500000002235711767656530022175 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; import java.util.ArrayList; import java.util.List; import javax.xml.XMLConstants; public class SAXOMBuilder extends DefaultHandler implements LexicalHandler { private OMDocument document; OMElement root = null; OMNode lastNode = null; OMElement nextElem = null; private final OMFactory factory; List prefixMappings = new ArrayList(); int textNodeType = OMNode.TEXT_NODE; public SAXOMBuilder(OMFactory factory) { this.factory = factory; } public SAXOMBuilder() { this(OMAbstractFactory.getOMFactory()); } private OMContainer getContainer() { if (lastNode != null) { return lastNode.isComplete() ? lastNode.getParent() : (OMContainer)lastNode; } else if (document != null) { return document; } else { throw new OMException("Unexpected event. There is no container to add the node to."); } } private void addNode(OMNode node) { if (lastNode != null) { if (lastNode.isComplete()) { ((OMNodeEx) lastNode).setNextOMSibling(node); ((OMNodeEx) node).setPreviousOMSibling(lastNode); } else { ((OMContainerEx) lastNode).setFirstChild(node); } } else if (document != null) { ((OMContainerEx)document).setFirstChild(node); } if (root == null && node instanceof OMElement) { root = (OMElement)node; } lastNode = node; } public void setDocumentLocator(Locator arg0) { } public void startDocument() throws SAXException { document = factory.createOMDocument(null); } public void endDocument() throws SAXException { ((OMContainerEx)document).setComplete(true); } public void startDTD(String name, String publicId, String systemId) throws SAXException { // addNode(factory.createOMDocType(getContainer(), "")); } public void endDTD() throws SAXException { } protected OMElement createNextElement(String localName) throws OMException { OMElement element = factory.createOMElement(localName, null, getContainer(), null); addNode(element); return element; } /* * (non-Javadoc) * * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, * java.lang.String) */ public void startPrefixMapping(String prefix, String uri) throws SAXException { if (nextElem == null) { nextElem = createNextElement(null); } if (prefix.length() == 0) { nextElem.declareDefaultNamespace(uri); } else { nextElem.declareNamespace(uri, prefix); } } public void endPrefixMapping(String arg0) throws SAXException { } /* * (non-Javadoc) * * @see org.xml.sax.ContentHandler#startElement(java.lang.String, * java.lang.String, java.lang.String, org.xml.sax.Attributes) */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (localName == null || localName.trim().equals("")) localName = qName.substring(qName.indexOf(':') + 1); if (nextElem == null) nextElem = createNextElement(localName); else nextElem.setLocalName(localName); nextElem.setNamespace(nextElem.findNamespace(namespaceURI, null)); int j = atts.getLength(); for (int i = 0; i < j; i++) { // Note that some SAX parsers report namespace declarations as attributes in addition // to calling start/endPrefixMapping. // NOTE: This filter was introduced to make SAXOMBuilder work with some versions of // XMLBeans (2.3.0). It is not clear whether this is a bug in XMLBeans or not. // See http://forum.springframework.org/showthread.php?t=43958 for a discussion. // If this test causes problems with other parsers, don't hesitate to remove it. if (!atts.getQName(i).startsWith("xmlns")) { String attrNamespaceURI = atts.getURI(i); OMNamespace ns; if (attrNamespaceURI.length() > 0) { ns = nextElem.findNamespace(atts.getURI(i), null); if (ns == null) { // The "xml" prefix is not necessarily declared explicitly; in this case, // create a new OMNamespace instance. if (attrNamespaceURI.equals(XMLConstants.XML_NS_URI)) { ns = factory.createOMNamespace(XMLConstants.XML_NS_URI, XMLConstants.XML_NS_PREFIX); } else { throw new SAXException("Unbound namespace " + attrNamespaceURI); } } } else { ns = null; } OMAttribute attr = nextElem.addAttribute(atts.getLocalName(i), atts.getValue(i), ns); attr.setAttributeType(atts.getType(i)); } } lastNode = nextElem; nextElem = null; } /* * (non-Javadoc) * * @see org.xml.sax.ContentHandler#endElement(java.lang.String, * java.lang.String, java.lang.String) */ public void endElement(String arg0, String arg1, String arg2) throws SAXException { if (lastNode.isComplete()) { OMContainer parent = lastNode.getParent(); ((OMNodeEx) parent).setComplete(true); lastNode = (OMNode) parent; } else { OMElement e = (OMElement) lastNode; ((OMNodeEx) e).setComplete(true); } } public void startCDATA() throws SAXException { textNodeType = OMNode.CDATA_SECTION_NODE; } public void endCDATA() throws SAXException { textNodeType = OMNode.TEXT_NODE; } public void characterData(char[] ch, int start, int length, int nodeType) throws SAXException { addNode(factory.createOMText(getContainer(), new String(ch, start, length), nodeType)); } public void characters(char[] ch, int start, int length) throws SAXException { characterData(ch, start, length, textNodeType); } public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { characterData(ch, start, length, OMNode.SPACE_NODE); } public void processingInstruction(String target, String data) throws SAXException { addNode(factory.createOMProcessingInstruction(getContainer(), target, data)); } public void comment(char[] ch, int start, int length) throws SAXException { if (lastNode == null) { // Do nothing: the comment appears before the root element. return; } addNode(factory.createOMComment(getContainer(), new String(ch, start, length))); } public void skippedEntity(String arg0) throws SAXException { } public void startEntity(String name) throws SAXException { } public void endEntity(String name) throws SAXException { } public OMDocument getDocument() { if (document != null && document.isComplete()) { return document; } else { throw new OMException("Tree not complete"); } } /** * Get the root element of the Axiom tree built by this content handler. * * @return the root element of the tree * @throws OMException if the tree is not complete */ public OMElement getRootElement() { if (root != null && root.isComplete()) { return root; } else { throw new OMException("Tree not complete"); } } } ./src/org/apache/axiom/om/impl/builder/OMAttachmentAccessorMimePartProvider.java0000664000175000017500000000352011767656530027147 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import java.io.IOException; import javax.activation.DataHandler; import org.apache.axiom.om.OMAttachmentAccessor; import org.apache.axiom.util.stax.xop.MimePartProvider; /** * Adapts an {@link OMAttachmentAccessor} instance to the {@link MimePartProvider} interface. */ public class OMAttachmentAccessorMimePartProvider implements MimePartProvider { private final OMAttachmentAccessor attachments; public OMAttachmentAccessorMimePartProvider(OMAttachmentAccessor attachments) { this.attachments = attachments; } public boolean isLoaded(String contentID) { // TODO: probably we can only determine this for an Attachments object return false; } public DataHandler getDataHandler(String contentID) throws IOException { DataHandler dh = attachments.getDataHandler(contentID); if (dh == null) { throw new IllegalArgumentException("No attachment found for content ID '" + contentID + "'"); } else { return dh; } } } ./src/org/apache/axiom/om/impl/builder/CustomBuilder.java0000664000175000017500000001226711767656530022557 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import javax.xml.stream.XMLStreamReader; /** * A Custom Builder is registered on the StAXBuilder for a particular QName or payload. * When the QName or payload is encountered, the CustomBuilder will build the OMElement * or OMSourcedElement for the StAXBuilder. * * @see org.apache.axiom.om.impl.builder.StAXBuilder#registerCustomBuilder(javax.xml.namespace.QName, int, CustomBuilder) * @see org.apache.axiom.om.impl.builder.StAXBuilder#registerCustomBuilderForPayload(CustomBuilder) */ public interface CustomBuilder { /** * Create an OMElement for this whole subtree. * A null is returned if the default StAXBuilder behavior should be used. * @param namespace * @param localPart * @param parent * @param reader * The stream reader to read the StAX events from. The data read * from this reader always represents plain XML, even if the * original document was XOP encoded. The reader optionally * implements the {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} * extension to give the custom builder access to optimized * binary data. This is appropriate for custom builders that * support {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} * or in cases where there is no other option than to transfer * binary data as base64 encoded character data. *

        * However, if the custom builder interacts with a third party * library that supports XOP, it may want to use that encoding * to optimize the transfer of binary data. To do so, the * custom builder MUST use {@link org.apache.axiom.util.stax.xop.XOPUtils#getXOPEncodedStream(XMLStreamReader)} * to get an XOP encoded stream. This guarantees that the original * reader is wrapped or unwrapped properly and also that * the custom builder correctly gets access to the attachments, * regardless of the type of the original reader. In particular, * the custom builder MUST NOT attempt to retrieve attachments * through the {@link org.apache.axiom.om.OMAttachmentAccessor} * that may be implemented by the builder (because this wouldn't * work if the builder was created from an {@link XMLStreamReader} * implementing the {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} * extension). *

        * The implementation MUST NOT assume that reader is the original * reader returned by the StAX implementation. In general, it * will be a wrapper around the original reader, e.g. one added * by the {@link org.apache.axiom.util.stax.dialect.StAXDialect} * implementation. If the method requires access to the original * parser (e.g. to pass the {@link XMLStreamReader} object to * another library that uses some special optimizations for * particular parser implementations), it SHOULD use * {@link org.apache.axiom.util.stax.XMLStreamReaderUtils#getOriginalXMLStreamReader(XMLStreamReader)} * to unwrap the reader. If the method solely relies on the * conformance of the reader to the StAX specification, it SHOULD * NOT attempt to unwrap it. *

        * If the implementation requires both an * XOP encoded stream and wants to get access to the original reader, it should invoke * {@link org.apache.axiom.util.stax.XMLStreamReaderUtils#getOriginalXMLStreamReader(XMLStreamReader)} * after {@link org.apache.axiom.util.stax.xop.XOPUtils#getXOPEncodedStream(XMLStreamReader)}. * @return null or OMElement */ public OMElement create(String namespace, String localPart, OMContainer parent, XMLStreamReader reader, OMFactory factory) throws OMException; } ./src/org/apache/axiom/om/impl/builder/BuilderAwareReader.java0000664000175000017500000000165111767656530023462 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; public interface BuilderAwareReader { public void setBuilder(StAXBuilder builder); } ./src/org/apache/axiom/om/impl/builder/XOPBuilder.java0000664000175000017500000000226411767656530021747 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.attachments.Attachments; import org.apache.axiom.om.OMAttachmentAccessor; import org.apache.axiom.om.OMException; import javax.activation.DataHandler; public interface XOPBuilder extends OMAttachmentAccessor { DataHandler getDataHandler(String blobContentID) throws OMException; Attachments getAttachments(); }./src/org/apache/axiom/om/impl/builder/StAXOMBuilder.java0000664000175000017500000007040411767656530022355 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMHierarchyException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.util.stax.XMLEventUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.Location; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; /** * StAX based builder that produces a pure XML infoset compliant object model. *

        * This class supports the {@link XMLStreamReader} extension defined by * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} as well as the legacy extension mechanism * defined in the documentation of {@link org.apache.axiom.util.stax.XMLStreamReaderUtils}. *

        Error handling

        * Usually, code that uses StAX directly just stops processing of an XML document * once the first parsing error has been reported. However, since Axiom * uses deferred parsing, and client code accesses the XML infoset using * an object model, things are more complicated. Indeed, if the XML * document is not well formed, the corresponding error might be reported * as a runtime exception by any call to a method of an OM node. *

        * Typically the client code will have some error handling that will intercept * runtime exceptions and take appropriate action. Very often this error handling * code might want to access the object model again, for example to log the request that caused the * failure. This causes no problem except if the runtime exception was caused by a * parsing error, in which case Axiom would again try to pull events from the parser. *

        * This would lead to a situation where Axiom accesses a parser that has reported a parsing * error before. While one would expect that after a first error reported by the parser, all * subsequent invocations of the parser will fail, this is not the case for all parsers * (at least not in all situations). Instead, the parser might be left in an inconsistent * state after the error. E.g. WSCOMMONS-372 describes a case where Woodstox * encounters an error in {@link XMLStreamReader#getText()} but continues to return * (incorrect) events afterwards. The explanation for this behaviour might be that * the situation described here is quite uncommon when StAX is used directly (i.e. not through * Axiom). *

        * To avoid this, the builder remembers exceptions thrown by the parser and rethrows * them during a call to {@link #next()}. */ public class StAXOMBuilder extends StAXBuilder { /** Field document */ private static final Log log = LogFactory.getLog(StAXOMBuilder.class); private boolean doTrace = log.isDebugEnabled(); private static int nsCount = 0; // namespaceURI interning // default is false because most XMLStreamReader implementations don't do interning // due to performance impacts. Thus a customer should not assume that a namespace // on an OMElement is interned. boolean namespaceURIInterning = false; int lookAheadToken = -1; /** * Constructor StAXOMBuilder. * * @param ombuilderFactory * @param parser */ public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) { super(ombuilderFactory, parser); document = createDocument(); } /** * Constructor linked to existing element. * * @param factory * @param parser * @param element * @param characterEncoding of existing element */ public StAXOMBuilder(OMFactory factory, XMLStreamReader parser, OMElement element, String characterEncoding) { // Use this constructor because the parser is passed the START_DOCUMENT state. super(factory, parser, characterEncoding); doTrace = log.isDebugEnabled(); namespaceURIInterning = false; lookAheadToken = -1; document = createDocument(); lastNode = element; document.setOMDocumentElement(element); populateOMElement(element); } /** * Constructor linked to existing element. * * @param factory * @param parser * @param element */ public StAXOMBuilder(OMFactory factory, XMLStreamReader parser, OMElement element) { this(factory, parser, element, null); } /** * @param filePath - Path to the XML file * @throws XMLStreamException * @throws FileNotFoundException */ public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException { this(StAXUtils.createXMLStreamReader(new FileInputStream(filePath))); } /** * Constructor StAXOMBuilder. * * @param parser */ public StAXOMBuilder(XMLStreamReader parser) { super(parser); doTrace = log.isDebugEnabled(); namespaceURIInterning = false; lookAheadToken = -1; omfactory = OMAbstractFactory.getOMFactory(); document = createDocument(); } /** * @param inStream - instream which contains the XML * @throws XMLStreamException */ public StAXOMBuilder(InputStream inStream) throws XMLStreamException { this(StAXUtils.createXMLStreamReader(inStream)); } /** * Init() *must* be called after creating the builder using this constructor. */ public StAXOMBuilder() { super(); doTrace = log.isDebugEnabled(); namespaceURIInterning = false; lookAheadToken = -1; } private OMDocument createDocument() { OMDocument document = omfactory.createOMDocument(this); if (charEncoding != null) { document.setCharsetEncoding(charEncoding); } if (parser.getEventType() == XMLStreamConstants.START_DOCUMENT) { document.setXMLVersion(parser.getVersion()); document.setXMLEncoding(parser.getCharacterEncodingScheme()); document.setStandalone(parser.isStandalone() ? "yes" : "no"); } else { // We allow creating a StAXOMWrapper from a parser in state START_ELEMENT. In that // case, we must not call getVersion or isStandalone since this is forbidden by the // StAX specs. Set some reasonable defaults. document.setXMLVersion("1.0"); document.setStandalone("yes"); } return document; } /** * Method next. * * @return Returns int. * @throws OMException */ public int next() throws OMException { try { // We need a loop here because we may decide to skip an event while (true) { if (done) { throw new OMException(); } int token = parserNext(); if (!cache) { return token; } // The current token should be the same as the // one just obtained. This bit of code is used to // detect invalid parser state. if (doTrace) { int currentParserToken = parser.getEventType(); if (currentParserToken != token) { log.debug("WARNING: The current state of the parser is not equal to the " + "state just received from the parser. The current state in the paser is " + XMLEventUtils.getEventTypeString(currentParserToken) + " the state just received is " + XMLEventUtils.getEventTypeString(token)); /* throw new OMException("The current token " + token + " does not match the current event " + "reported by the parser token. The parser did not update its state correctly. " + "The parser is " + parser); */ } } // Now log the current state of the parser if (doTrace) { logParserState(); } switch (token) { case XMLStreamConstants.START_ELEMENT: elementLevel++; lastNode = createNextOMElement(); break; case XMLStreamConstants.CHARACTERS: lastNode = createOMText(XMLStreamConstants.CHARACTERS); break; case XMLStreamConstants.CDATA: lastNode = createOMText(XMLStreamConstants.CDATA); break; case XMLStreamConstants.END_ELEMENT: endElement(); elementLevel--; break; case XMLStreamConstants.END_DOCUMENT: done = true; ((OMContainerEx) this.document).setComplete(true); break; case XMLStreamConstants.SPACE: try { lastNode = createOMText(XMLStreamConstants.SPACE); if (lastNode == null) { continue; } } catch (OMHierarchyException ex) { // The OM implementation doesn't allow text nodes at the current // position in the tree. Since it is only whitespace, we can safely // skip this event. continue; } break; case XMLStreamConstants.COMMENT: lastNode = createComment(); break; case XMLStreamConstants.DTD: createDTD(); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: lastNode = createPI(); break; case XMLStreamConstants.ENTITY_REFERENCE: lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE); break; default : throw new OMException(); } return token; } } catch (XMLStreamException e) { throw new OMException(e); } } /** * Creates a new OMElement using either a CustomBuilder or * the default Builder mechanism. * @return TODO */ protected OMNode createNextOMElement() { OMNode newElement = null; if (elementLevel == 1 && this.customBuilderForPayload != null) { newElement = createWithCustomBuilder(customBuilderForPayload, omfactory); } else if (customBuilders != null && elementLevel <= this.maxDepthForCustomBuilders) { String namespace = parser.getNamespaceURI(); String localPart = parser.getLocalName(); CustomBuilder customBuilder = getCustomBuilder(namespace, localPart); if (customBuilder != null) { newElement = createWithCustomBuilder(customBuilder, omfactory); } } if (newElement == null) { newElement = createOMElement(); } else { elementLevel--; // Decrease level since custom builder read the end element event } return newElement; } protected OMNode createWithCustomBuilder(CustomBuilder customBuilder, OMFactory factory) { String namespace = parser.getNamespaceURI(); String localPart = parser.getLocalName(); if (log.isDebugEnabled()) { log.debug("Invoking CustomBuilder, " + customBuilder.toString() + ", to the OMNode for {" + namespace + "}" + localPart); } OMContainer parent = null; if (lastNode != null) { if (lastNode.isComplete()) { parent = lastNode.getParent(); } else { parent = (OMContainer)lastNode; } } else { parent = document; } OMNode node = customBuilder.create(namespace, localPart, parent, parser, factory); if (log.isDebugEnabled()) { if (node != null) { log.debug("The CustomBuilder, " + customBuilder.toString() + "successfully constructed the OMNode for {" + namespace + "}" + localPart); } else { log.debug("The CustomBuilder, " + customBuilder.toString() + " did not construct an OMNode for {" + namespace + "}" + localPart + ". The OMNode will be constructed using the installed stax om builder"); } log.debug("The current state of the parser is: "); logParserState(); } return node; } /** * Dump the current event of the parser. */ protected void logParserState() { if (doTrace) { int currentEvent = parser.getEventType(); switch (currentEvent) { case XMLStreamConstants.START_ELEMENT: log.trace("START_ELEMENT: "); log.trace(" QName: " + parser.getName()); break; case XMLStreamConstants.START_DOCUMENT: log.trace("START_DOCUMENT: "); break; case XMLStreamConstants.CHARACTERS: log.trace("CHARACTERS: "); // This can bust up a datahandler //log.trace( "[" + parser.getText() + "]"); break; case XMLStreamConstants.CDATA: log.trace("CDATA: "); // This can but //log.trace( "[" + parser.getText() + "]"); break; case XMLStreamConstants.END_ELEMENT: log.trace("END_ELEMENT: "); log.trace(" QName: " + parser.getName()); break; case XMLStreamConstants.END_DOCUMENT: log.trace("END_DOCUMENT: "); break; case XMLStreamConstants.SPACE: log.trace("SPACE: "); //log.trace( "[" + parser.getText() + "]"); break; case XMLStreamConstants.COMMENT: log.trace("COMMENT: "); //log.trace( "[" + parser.getText() + "]"); break; case XMLStreamConstants.DTD: log.trace("DTD: "); log.trace( "[" + parser.getText() + "]"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: log.trace("PROCESSING_INSTRUCTION: "); log.trace(" [" + parser.getPITarget() + "][" + parser.getPIData() + "]"); break; case XMLStreamConstants.ENTITY_REFERENCE: log.trace("ENTITY_REFERENCE: "); log.trace(" " + parser.getLocalName() + "[" + parser.getText() + "]"); break; default : log.trace("UNKNOWN_STATE: " + currentEvent); } } } /** * Populate element with data from parser START_ELEMENT event. This is used when the source of * data for an element needs to be parsed on demand. The supplied element must already be set to * the proper name and namespace. * * @param node element to be populated */ private void populateOMElement(OMElement node) { // create the namespaces processNamespaceData(node); // fill in the attributes processAttributes(node); Location location = parser.getLocation(); if(location != null) { node.setLineNumber(location.getLineNumber()); } } /** * Method createOMElement. * * @return Returns OMNode. * @throws OMException */ protected OMNode createOMElement() throws OMException { OMElement node; String elementName = parser.getLocalName(); if (lastNode == null) { node = omfactory.createOMElement(elementName, null, document, this); } else if (lastNode.isComplete()) { node = omfactory.createOMElement(elementName, null, lastNode.getParent(), this); ((OMNodeEx) lastNode).setNextOMSibling(node); ((OMNodeEx) node).setPreviousOMSibling(lastNode); } else { OMContainerEx e = (OMContainerEx) lastNode; node = omfactory.createOMElement(elementName, null, (OMElement) lastNode, this); e.setFirstChild(node); } populateOMElement(node); return node; } /** * Method createOMText. * * @return Returns OMNode. * @throws OMException */ protected OMNode createComment() throws OMException { OMNode node; if (lastNode == null) { node = omfactory.createOMComment(document, parser.getText()); } else if (lastNode.isComplete()) { node = omfactory.createOMComment(lastNode.getParent(), parser.getText()); } else { node = omfactory.createOMComment((OMElement) lastNode, parser.getText()); } return node; } /** * Method createDTD. * * @return Returns OMNode. * @throws OMException */ protected OMNode createDTD() throws OMException { if (!parser.hasText()) { return null; } String dtdText = getDTDText(); lastNode = omfactory.createOMDocType(document, dtdText); return lastNode; } /** * The getText() method for a DOCTYPE returns the * subset of the DOCTYPE (not the direct infoset). * This may force the parser to get information from * the network. * @return doctype subset * @throws OMException */ private String getDTDText() throws OMException { String text = null; try { text = parser.getText(); } catch (RuntimeException e) { // Woodstox (and perhaps other parsers) // attempts to load the external subset even if // external enties is false. So ignore this error // if external entity support is explicitly disabled. Boolean b = (Boolean) parser.getProperty( XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES); if (b == null || b == Boolean.TRUE) { throw e; } if (log.isDebugEnabled()) { log.debug("An exception occurred while calling getText() for a DOCTYPE. " + "The exception is ignored because external " + "entites support is disabled. " + "The ignored exception is " + e); } } return text; } /** * Method createPI. * * @return Returns OMNode. * @throws OMException */ protected OMNode createPI() throws OMException { OMNode node; String target = parser.getPITarget(); String data = parser.getPIData(); if (lastNode == null) { node = omfactory.createOMProcessingInstruction(document, target, data); } else if (lastNode.isComplete()) { node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data); } else if (lastNode instanceof OMText) { node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data); } else { node = omfactory.createOMProcessingInstruction((OMContainer) lastNode, target, data); } return node; } protected void endElement() { if (lastNode.isComplete()) { OMNodeEx parent = (OMNodeEx) lastNode.getParent(); parent.setComplete(true); lastNode = parent; } else { OMNodeEx e = (OMNodeEx) lastNode; e.setComplete(true); } //return lastNode; } public OMElement getDocumentElement() { return getDocumentElement(false); } public OMElement getDocumentElement(boolean discardDocument) { OMElement element = document.getOMDocumentElement(); if (discardDocument) { OMNodeEx nodeEx = (OMNodeEx)element; nodeEx.setParent(null); nodeEx.setPreviousOMSibling(null); nodeEx.setNextOMSibling(null); } return element; } /** * Method processNamespaceData. * * @param node */ protected void processNamespaceData(OMElement node) { // set the own namespace String namespaceURI = parser.getNamespaceURI(); String prefix = parser.getPrefix(); int namespaceCount = parser.getNamespaceCount(); for (int i = 0; i < namespaceCount; i++) { String nsprefix = parser.getNamespacePrefix(i); //if the namespace is not defined already when we write the start tag declare it // check whether this is the default namespace and make sure we have not declared that earlier String namespaceURIFromParser = parser.getNamespaceURI(i); if (nsprefix == null || "".equals(nsprefix)) { String nsuri = parser.getNamespaceURI(i); node.declareDefaultNamespace(nsuri == null ? "" : nsuri); } else { // NOTE_A: // By default most parsers don't intern the namespace. // Unfortunately the property to detect interning on the delegate parsers is hard to detect. // Woodstox has a proprietary property on the XMLInputFactory. // IBM has a proprietary property on the XMLStreamReader. // For now only force the interning if requested. if (isNamespaceURIInterning()) { namespaceURIFromParser = namespaceURIFromParser.intern(); } node.declareNamespace(namespaceURIFromParser, nsprefix); } } if (namespaceURI != null && namespaceURI.length() > 0) { OMNamespace namespace = node.findNamespaceURI(prefix == null ? "" : prefix); if (namespace == null || !namespace.getNamespaceURI().equals(namespaceURI)) { // See NOTE_A above if (isNamespaceURIInterning()) { namespaceURI = namespaceURI.intern(); } if (prefix == null || "".equals(prefix)) { namespace = node.declareDefaultNamespace(namespaceURI); } else { namespace = node.declareNamespace(namespaceURI, prefix); } } node.setNamespaceWithNoFindInCurrentScope(namespace); } } /** * @param doDebug * @deprecated */ public void setDoDebug(boolean doDebug) { this.doTrace = doDebug; } protected String createPrefix() { return "ns" + nsCount++; } /** * Set namespace uri interning * @param b */ public void setNamespaceURIInterning(boolean b) { this.namespaceURIInterning = b; } /** * @return if namespace uri interning */ public boolean isNamespaceURIInterning() { return this.namespaceURIInterning; } /** * Pushes the virtual parser ahead one token. * If a look ahead token was calculated it is returned. * @return next token * @throws XMLStreamException */ private int parserNext() throws XMLStreamException { if (lookAheadToken >= 0) { int token = lookAheadToken; lookAheadToken = -1; // Reset return token; } else { if (parserException != null) { log.warn("Attempt to access a parser that has thrown a parse exception before; " + "rethrowing the original exception."); if (parserException instanceof XMLStreamException) { throw (XMLStreamException)parserException; } else { throw (RuntimeException)parserException; } } try { return parser.next(); } catch (XMLStreamException ex) { parserException = ex; throw ex; } } } /** * This method looks ahead to the next start element. * @return true if successful */ public boolean lookahead() { try { while (true) { if (lookAheadToken < 0) { lookAheadToken = parserNext(); } if (lookAheadToken == XMLStreamConstants.START_ELEMENT) { return true; } else if (lookAheadToken == XMLStreamConstants.END_ELEMENT || lookAheadToken == XMLStreamConstants.START_DOCUMENT || lookAheadToken == XMLStreamConstants.END_DOCUMENT) { next(); return false; // leaving scope...start element not found } else { next(); // continue looking past whitespace etc. } } } catch (XMLStreamException e) { throw new OMException(e); } } /** * Check if the node for the current token has already been created or if the parser is ahead * of the builder. * * @return A return value of true indicates that the parser is one token ahead * of the builder, i.e. that the node for the current token has not been created yet. * In this case {@link #getLastNode()} returns the node corresponding to the previous * token. This state can only be reached by a call to {@link #lookahead()}, and the * current token is always a {@link XMLStreamConstants#START_ELEMENT START_ELEMENT}. * The information related to that element can be obtained by calls to * {@link #getName()}, {@link #getNamespace()}, {@link #getPrefix()}, * {@link #getAttributeCount()}, {@link #getAttributeName(int)}, * {@link #getAttributeNamespace(int)}, {@link #getAttributePrefix(int)}, * {@link #getNamespaceCount()}, {@link #getNamespacePrefix(int)} and * {@link #getNamespaceUri(int)}. *

        * A return value of false indicates that the node corresponding to the * current token hold by the parser has already been created, i.e. * {@link #getLastNode()} returns the node corresponding to the current token. */ public boolean isLookahead() { return lookAheadToken >= 0; } } ./src/org/apache/axiom/om/impl/builder/SAXOMXMLParserWrapper.java0000664000175000017500000001031511767656530023754 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import java.io.IOException; import javax.xml.transform.sax.SAXSource; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMXMLParserWrapper; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** * {@link OMXMLParserWrapper} implementation for SAX parsers. By "SAX parser" we mean anything that * is able to write a sequence of events to a SAX {@link ContentHandler}. *

        * Note: This is a very naive implementation. Other implementations of the Axiom API may * provide smarter implementations. For example, in theory it should be possible to defer the * invocation of the parser until the {@link OMElement} object returned by * {@link #getDocumentElement()} is accessed. */ public class SAXOMXMLParserWrapper implements OMXMLParserWrapper { private final OMFactory factory; private final SAXSource source; private OMDocument document; public SAXOMXMLParserWrapper(OMFactory factory, SAXSource source) { this.factory = factory; this.source = source; } public OMDocument getDocument() { if (document == null) { SAXOMBuilder builder = new SAXOMBuilder(factory); XMLReader reader = source.getXMLReader(); reader.setContentHandler(builder); try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", builder); } catch (SAXException ex) { // Ignore } try { reader.parse(source.getInputSource()); } catch (IOException ex) { throw new OMException(ex); } catch (SAXException ex) { throw new OMException(ex); } document = builder.getDocument(); } return document; } public OMElement getDocumentElement() { return getDocument().getOMDocumentElement(); } public OMElement getDocumentElement(boolean discardDocument) { return getDocumentElement(); } public void close() { // TODO throw new UnsupportedOperationException(); } public void discard(OMElement el) throws OMException { // TODO throw new UnsupportedOperationException(); } public short getBuilderType() { // TODO throw new UnsupportedOperationException(); } public String getCharacterEncoding() { // TODO throw new UnsupportedOperationException(); } public Object getParser() { // TODO throw new UnsupportedOperationException(); } public Object getRegisteredContentHandler() { // TODO throw new UnsupportedOperationException(); } public boolean isCache() { // TODO throw new UnsupportedOperationException(); } public boolean isCompleted() { // TODO throw new UnsupportedOperationException(); } public int next() throws OMException { // TODO throw new UnsupportedOperationException(); } public void registerExternalContentHandler(Object obj) { // TODO throw new UnsupportedOperationException(); } public void setCache(boolean b) throws OMException { // TODO throw new UnsupportedOperationException(); } } ./src/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java0000664000175000017500000000300111767656530024273 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.util.stax.XMLStreamReaderUtils; /** * @deprecated Use the corresponding methods in {@link XMLStreamReaderUtils} instead. */ public class DataHandlerReaderUtils { private DataHandlerReaderUtils() {} public static DataHandlerReader getDataHandlerReader(final XMLStreamReader reader) { return XMLStreamReaderUtils.getDataHandlerReader(reader); } public static Object processGetProperty(DataHandlerReader extension, String propertyName) { return XMLStreamReaderUtils.processGetProperty(extension, propertyName); } } ./src/org/apache/axiom/om/impl/builder/StAXBuilder.java0000664000175000017500000005433611767656530022127 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl.builder; import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMConstants; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMContainerEx; import org.apache.axiom.om.impl.OMNodeEx; import org.apache.axiom.om.impl.util.OMSerializerUtil; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.InputStream; import java.util.HashMap; import java.util.Map; /** * OM should be able to be built from any data source. And the model it builds may be a SOAP * specific one or just an XML model. This class will give some common functionality of OM Building * from StAX. */ public abstract class StAXBuilder implements OMXMLParserWrapper { private static Log log = LogFactory.getLog(StAXBuilder.class); /** Field parser */ protected XMLStreamReader parser; /** Field omfactory */ protected OMFactory omfactory; /** Field lastNode */ protected OMNode lastNode; // returns the state of completion /** Field done */ protected boolean done = false; // keeps the state of the cache /** Field cache */ protected boolean cache = true; // keeps the state of the parser access. if the parser is // accessed atleast once,this flag will be set /** Field parserAccessed */ protected boolean parserAccessed = false; protected OMDocument document; protected String charEncoding = null; protected boolean _isClosed = false; // Indicate if parser is closed protected boolean _releaseParserOnClose = false; // Defaults to legacy behavior, which is keep the reference // Fields for Custom Builder implementation protected CustomBuilder customBuilderForPayload = null; protected Map customBuilders = null; protected int maxDepthForCustomBuilders = -1; /** * Reference to the {@link DataHandlerReader} extension of the parser, or null if * the parser doesn't support this extension. */ protected DataHandlerReader dataHandlerReader; /** * Element level is the depth of the element. * The root element (i.e. envelope) is defined as 1. */ protected int elementLevel = 0; /** * Stores exceptions thrown by the parser. Used to avoid accessing the parser * again after is has thrown a parse exception. */ protected Exception parserException; /** * Constructor StAXBuilder. * This constructor is used if the parser is at the beginning (START_DOCUMENT). * * @param ombuilderFactory * @param parser */ protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) { omfactory = ombuilderFactory; // The getEncoding information is only available at the START_DOCUMENT event. charEncoding = parser.getEncoding(); initParser(parser); } /** * Constructor StAXBuilder. * This constructor is used if the parser is not at the START_DOCUMENT. * * @param ombuilderFactory * @param parser * @param characterEncoding */ protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser, String characterEncoding) { omfactory = ombuilderFactory; charEncoding = characterEncoding; initParser(parser); } private void initParser(XMLStreamReader parser) { if (parser instanceof BuilderAwareReader) { ((BuilderAwareReader) parser).setBuilder(this); } dataHandlerReader = DataHandlerReaderUtils.getDataHandlerReader(parser); this.parser = parser; } /** * Constructor StAXBuilder. * * @param parser */ protected StAXBuilder(XMLStreamReader parser) { this(OMAbstractFactory.getOMFactory(), parser); } /** Init() *must* be called after creating the builder using this constructor. */ protected StAXBuilder() { } /** * @deprecated Not used anywhere */ public void init(InputStream inputStream, String charSetEncoding, String url, String contentType) throws OMException { try { this.parser = StAXUtils.createXMLStreamReader(inputStream); } catch (XMLStreamException e1) { throw new OMException(e1); } omfactory = OMAbstractFactory.getOMFactory(); } /** * Method setOMBuilderFactory. * * @param ombuilderFactory */ public void setOMBuilderFactory(OMFactory ombuilderFactory) { this.omfactory = ombuilderFactory; } /** * Method processNamespaceData. * * @param node */ protected abstract void processNamespaceData(OMElement node); // since the behaviors are different when it comes to namespaces // this must be implemented differently /** * Method processAttributes. * * @param node */ protected void processAttributes(OMElement node) { int attribCount = parser.getAttributeCount(); for (int i = 0; i < attribCount; i++) { String uri = parser.getAttributeNamespace(i); String prefix = parser.getAttributePrefix(i); OMNamespace namespace = null; if (uri != null && uri.length() > 0) { // prefix being null means this elements has a default namespace or it has inherited // a default namespace from its parent namespace = node.findNamespace(uri, prefix); if (namespace == null) { if (prefix == null || "".equals(prefix)) { prefix = OMSerializerUtil.getNextNSPrefix(); } namespace = node.declareNamespace(uri, prefix); } } // todo if the attributes are supposed to namespace qualified all the time // todo then this should throw an exception here OMAttribute attr = node.addAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i), namespace); attr.setAttributeType(parser.getAttributeType(i)); } } /** * Method createOMText. * * @return Returns OMNode. * @throws OMException */ protected OMNode createOMText(int textType) throws OMException { OMNode node; if (lastNode == null) { return null; } else if (!lastNode.isComplete()) { node = createOMText((OMElement) lastNode, textType); } else { node = createOMText(lastNode.getParent(), textType); } return node; } /** * This method will check whether the text can be optimizable using IS_BINARY flag. If that is * set then we try to get the data handler. * * @param omContainer * @param textType * @return omNode */ private OMNode createOMText(OMContainer omContainer, int textType) { if (dataHandlerReader != null && dataHandlerReader.isBinary()) { Object dataHandlerObject; if (dataHandlerReader.isDeferred()) { dataHandlerObject = dataHandlerReader.getDataHandlerProvider(); } else { try { dataHandlerObject = dataHandlerReader.getDataHandler(); } catch (XMLStreamException ex) { throw new OMException(ex); } } OMText text = omfactory.createOMText(dataHandlerObject, dataHandlerReader.isOptimized()); String contentID = dataHandlerReader.getContentID(); if (contentID != null) { text.setContentID(contentID); } omContainer.addChild(text); return text; } else { // Some parsers (like Woodstox) parse text nodes lazily and may throw a // RuntimeException in getText() String text; try { text = parser.getText(); } catch (RuntimeException ex) { parserException = ex; throw ex; } return omfactory.createOMText(omContainer, text, textType); } } /** * Method reset. * * @param node * @throws OMException */ public void reset(OMNode node) throws OMException { lastNode = null; } /** * Method discard. * * @param element * @throws OMException */ public void discard(OMElement element) throws OMException { if (element.isComplete() || !cache) { throw new OMException(); } try { // We simply cannot use the parser instance from the builder for this case // it is not safe to assume that the parser inside the builder will be in // sync with the parser of the element in question // Note 1 - however calling getXMLStreamReaderWithoutCaching sets off two flags // the cache flag for this builder and the parserAccessed flag. These flags will be // reset later in this procedure int event =0; XMLStreamReader elementParser = element.getXMLStreamReaderWithoutCaching(); do{ event = elementParser.next(); }while(!(event == XMLStreamConstants.END_ELEMENT && element.getLocalName().equals(elementParser.getLocalName()))); //at this point we are safely at the end_element event of the element we discarded lastNode = element.getPreviousOMSibling(); // resetting the flags - see Note 1 above cache = true; parserAccessed = false; if (lastNode != null) { // if the last node is not an element, we are in trouble because leaf nodes // (such as text) cannot build themselves. worst the lastchild of the // currentparent is still the removed node! we have to correct it OMContainerEx ex = ((OMContainerEx) lastNode.getParent()); ex.setLastChild(lastNode); if (!(lastNode instanceof OMContainerEx)){ ex.buildNext(); }else{ ((OMNodeEx) lastNode).setNextOMSibling(null); } } else { OMElement parent = (OMElement) element.getParent(); if (parent == null) { throw new OMException(); } ((OMContainerEx) parent).setFirstChild(null); lastNode = parent; } } catch (OMException e) { throw e; } catch (Exception e) { throw new OMException(e); } // when an element is discarded the element index that was incremented //at creation needs to be decremented ! elementLevel--; } /** * Method getText. * * @return Returns String. * @throws OMException */ public String getText() throws OMException { return parser.getText(); } /** * Method getNamespace. * * @return Returns String. * @throws OMException */ public String getNamespace() throws OMException { return parser.getNamespaceURI(); } /** * Method getNamespaceCount. * * @return Returns int. * @throws OMException */ public int getNamespaceCount() throws OMException { try { return parser.getNamespaceCount(); } catch (Exception e) { throw new OMException(e); } } /** * Method getNamespacePrefix. * * @param index * @return Returns String. * @throws OMException */ public String getNamespacePrefix(int index) throws OMException { try { return parser.getNamespacePrefix(index); } catch (Exception e) { throw new OMException(e); } } /** * Method getNamespaceUri. * * @param index * @return Returns String. * @throws OMException */ public String getNamespaceUri(int index) throws OMException { try { return parser.getNamespaceURI(index); } catch (Exception e) { throw new OMException(e); } } /** * Method setCache. * * @param b */ public void setCache(boolean b) { if (parserAccessed && b) { throw new UnsupportedOperationException( "parser accessed. cannot set cache"); } cache = b; } /** * @return true if caching */ public boolean isCache() { return cache; } /** * Method getName. * * @return Returns String. * @throws OMException */ public String getName() throws OMException { return parser.getLocalName(); } /** * Method getPrefix. * * @return Returns String. * @throws OMException */ public String getPrefix() throws OMException { return parser.getPrefix(); } /** * Method getAttributeCount. * * @return Returns int. * @throws OMException */ public int getAttributeCount() throws OMException { return parser.getAttributeCount(); } /** * Method getAttributeNamespace. * * @param arg * @return Returns String. * @throws OMException */ public String getAttributeNamespace(int arg) throws OMException { return parser.getAttributeNamespace(arg); } /** * Method getAttributeName. * * @param arg * @return Returns String. * @throws OMException */ public String getAttributeName(int arg) throws OMException { return parser.getAttributeNamespace(arg); } /** * Method getAttributePrefix. * * @param arg * @return Returns String. * @throws OMException */ public String getAttributePrefix(int arg) throws OMException { return parser.getAttributeNamespace(arg); } /** * Get the underlying {@link XMLStreamReader} used by this builder. Note that for this type of * builder, accessing the underlying parser implies that can no longer be used, and any attempt * to call {@link #next()} will result in an exception. * * @return The {@link XMLStreamReader} object used by this builder. Note that the constraints * described in the Javadoc of the reader parameter of the * {@link CustomBuilder#create(String, String, OMContainer, XMLStreamReader, OMFactory)} * method also apply to the stream reader returned by this method, i.e.: *

          *
        • The caller should use * {@link org.apache.axiom.util.stax.xop.XOPUtils#getXOPEncodedStream(XMLStreamReader)} * to get an XOP encoded stream from the return value. *
        • To get access to the bare StAX parser implementation, the caller should use * {@link org.apache.axiom.util.stax.XMLStreamReaderUtils#getOriginalXMLStreamReader(XMLStreamReader)}. *
        * @throws IllegalStateException * if the parser has already been accessed */ public Object getParser() { if (parserAccessed) { throw new IllegalStateException( "Parser already accessed!"); } if (!cache) { parserAccessed = true; return parser; } else { throw new IllegalStateException( "cache must be switched off to access the parser"); } } /** * Method isCompleted. * * @return Returns boolean. */ public boolean isCompleted() { return done; } /** * This method is called with the XMLStreamConstants.START_ELEMENT event. * * @return Returns OMNode. * @throws OMException */ protected abstract OMNode createOMElement() throws OMException; /** * Forwards the parser one step further, if parser is not completed yet. If this is called after * parser is done, then throw an OMException. If the cache is set to false, then returns the * event, *without* building the OM tree. If the cache is set to true, then handles all the * events within this, and builds the object structure appropriately and returns the event. * * @return Returns int. * @throws OMException */ public abstract int next() throws OMException; /** * Register a CustomBuilder associated with the indicated QName. * The CustomBuilder will be used when an element of that qname is encountered. * @param qName * @param maxDepth indicate the maximum depth that this qname will be found. (root = 0) * @param customBuilder * @return replaced CustomBuilder or null */ public CustomBuilder registerCustomBuilder(QName qName, int maxDepth, CustomBuilder customBuilder) { CustomBuilder old = null; if (customBuilders == null) { customBuilders = new HashMap(); } else { old = (CustomBuilder) customBuilders.get(qName); } maxDepthForCustomBuilders = (maxDepthForCustomBuilders > maxDepth) ? maxDepthForCustomBuilders: maxDepth; customBuilders.put(qName, customBuilder); return old; } /** * Register a CustomBuilder for a payload. * The payload is defined as the elements inside a SOAPBody or the * document element of a REST message. * @param customBuilder * @return replaced CustomBuilder or null */ public CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder) { CustomBuilder old = null; this.customBuilderForPayload = customBuilder; return old; } /** * Return CustomBuilder associated with the namespace/localPart * @param namespace * @param localPart * @return CustomBuilder or null */ protected CustomBuilder getCustomBuilder(String namespace, String localPart) { if (customBuilders == null) { return null; } QName qName = new QName(namespace, localPart); return (CustomBuilder) customBuilders.get(qName); } /** @return Returns short. */ public short getBuilderType() { return OMConstants.PULL_TYPE_BUILDER; } /** * Method registerExternalContentHandler. * * @param obj */ public void registerExternalContentHandler(Object obj) { throw new UnsupportedOperationException(); } /** * Method getRegisteredContentHandler. * * @return Returns Object. */ public Object getRegisteredContentHandler() { throw new UnsupportedOperationException(); } public OMDocument getDocument() { return document; } public String getCharsetEncoding() { return document.getCharsetEncoding(); } public OMNode getLastNode() { return this.lastNode; } public void close() { try { if (!isClosed()) { parser.close(); } } catch (Throwable e) { // Can't see a reason why we would want to surface an exception // while closing the parser. if (log.isDebugEnabled()) { log.debug("Exception occurred during parser close. " + "Processing continues. " + e); } } finally { _isClosed = true; done = true; // Release the parser so that it can be GC'd or reused. if (_releaseParserOnClose) { parser = null; } } } /** * Get the value of a feature/property from the underlying XMLStreamReader implementation * without accessing the XMLStreamReader. https://issues.apache.org/jira/browse/WSCOMMONS-155 * * @param name * @return TODO */ public Object getReaderProperty(String name) throws IllegalArgumentException { if (!isClosed()) { return parser.getProperty(name); } return null; } /** * Returns the encoding style of the XML data * @return the character encoding, defaults to "UTF-8" */ public String getCharacterEncoding() { if(this.charEncoding == null){ return "UTF-8"; } return this.charEncoding; } /** * @return if parser is closed */ public boolean isClosed() { return _isClosed; } /** * Indicate if the parser resource should be release when closed. * @param value boolean */ public void releaseParserOnClose(boolean value) { // Release parser if already closed if (isClosed() && value) { parser = null; } _releaseParserOnClose = value; } } ./src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java0000664000175000017500000005031311767656530022050 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import java.util.LinkedList; import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.OMText; import org.apache.axiom.om.util.CommonUtils; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.om.util.XMLStreamWriterFilter; import org.apache.axiom.util.stax.XMLStreamWriterUtils; import org.apache.axiom.util.stax.xop.ContentIDGenerator; import org.apache.axiom.util.stax.xop.OptimizationPolicy; import org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MTOMXMLStreamWriter is an XML + Attachments stream writer. * * For the moment this assumes that transport takes the decision of whether to optimize or not by * looking at whether the MTOM optimize is enabled & also looking at the OM tree whether it has any * optimizable content. */ public class MTOMXMLStreamWriter implements XMLStreamWriter { private static Log log = LogFactory.getLog(MTOMXMLStreamWriter.class); private static boolean isDebugEnabled = log.isDebugEnabled(); private static boolean isTraceEnabled = log.isTraceEnabled(); private XMLStreamWriter xmlWriter; private OutputStream outStream; private LinkedList binaryNodeList = new LinkedList(); private OMMultipartWriter multipartWriter; private OutputStream rootPartOutputStream; private OMOutputFormat format = new OMOutputFormat(); private final OptimizationPolicy optimizationPolicy; // State variables private boolean isEndDocument = false; // has endElement been called private boolean isComplete = false; // have the attachments been written private int depth = 0; // current element depth // Set the filter object if provided private XMLStreamWriterFilter xmlStreamWriterFilter = null; public MTOMXMLStreamWriter(XMLStreamWriter xmlWriter) { this.xmlWriter = xmlWriter; if (isTraceEnabled) { log.trace("Call Stack =" + CommonUtils.callStackToString()); } optimizationPolicy = new OptimizationPolicyImpl(format); } /** * Creates a new MTOMXMLStreamWriter with specified encoding. * * @param outStream * @param format * @throws XMLStreamException * @throws FactoryConfigurationError * @see OMOutputFormat#DEFAULT_CHAR_SET_ENCODING */ public MTOMXMLStreamWriter(OutputStream outStream, OMOutputFormat format) throws XMLStreamException, FactoryConfigurationError { if (isDebugEnabled) { log.debug("Creating MTOMXMLStreamWriter"); log.debug("OutputStream =" + outStream.getClass()); log.debug("OMFormat = " + format.toString()); } if (isTraceEnabled) { log.trace("Call Stack =" + CommonUtils.callStackToString()); } this.format = format; this.outStream = outStream; String encoding = format.getCharSetEncoding(); if (encoding == null) { //Default encoding is UTF-8 format.setCharSetEncoding(encoding = OMOutputFormat.DEFAULT_CHAR_SET_ENCODING); } optimizationPolicy = new OptimizationPolicyImpl(format); if (format.isOptimized()) { multipartWriter = new OMMultipartWriter(outStream, format); try { rootPartOutputStream = multipartWriter.writeRootPart(); } catch (IOException ex) { throw new XMLStreamException(ex); } ContentIDGenerator contentIDGenerator = new ContentIDGenerator() { public String generateContentID(String existingContentID) { return existingContentID != null ? existingContentID : getNextContentId(); } }; xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter( format.getStAXWriterConfiguration(), rootPartOutputStream, encoding), contentIDGenerator, optimizationPolicy); } else { xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(), outStream, format.getCharSetEncoding()); } xmlStreamWriterFilter = format.getXmlStreamWriterFilter(); if (xmlStreamWriterFilter != null) { if (log.isDebugEnabled()) { log.debug("Installing XMLStreamWriterFilter " + xmlStreamWriterFilter); } xmlStreamWriterFilter.setDelegate(xmlWriter); xmlWriter = xmlStreamWriterFilter; } } public void writeStartElement(String string) throws XMLStreamException { xmlWriter.writeStartElement(string); depth++; } public void writeStartElement(String string, String string1) throws XMLStreamException { xmlWriter.writeStartElement(string, string1); depth++; } public void writeStartElement(String string, String string1, String string2) throws XMLStreamException { xmlWriter.writeStartElement(string, string1, string2); depth++; } public void writeEmptyElement(String string, String string1) throws XMLStreamException { xmlWriter.writeEmptyElement(string, string1); } public void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException { xmlWriter.writeEmptyElement(string, string1, string2); } public void writeEmptyElement(String string) throws XMLStreamException { xmlWriter.writeEmptyElement(string); } public void writeEndElement() throws XMLStreamException { xmlWriter.writeEndElement(); depth--; } public void writeEndDocument() throws XMLStreamException { if (isDebugEnabled) { log.debug("writeEndDocument"); } xmlWriter.writeEndDocument(); isEndDocument = true; } public void close() throws XMLStreamException { // TODO: we should probably call flush if the attachments have not been written yet if (isDebugEnabled) { log.debug("close"); } xmlWriter.close(); } /** * Flush is overridden to trigger the attachment serialization */ public void flush() throws XMLStreamException { if (isDebugEnabled) { log.debug("Calling MTOMXMLStreamWriter.flush"); } xmlWriter.flush(); // flush() triggers the optimized attachment writing. // If the optimized attachments are specified, and the xml // document is completed, then write out the attachments. if (format.isOptimized() && !isComplete & (isEndDocument || depth == 0)) { if (isDebugEnabled) { log.debug("The XML writing is completed. Now the attachments are written"); } isComplete = true; try { rootPartOutputStream.close(); // First write the attachments added properly through the DataHandlerWriter extension XOPEncodingStreamWriter encoder = (XOPEncodingStreamWriter)xmlWriter; for (Iterator it = encoder.getContentIDs().iterator(); it.hasNext(); ) { String contentID = (String)it.next(); multipartWriter.writePart(encoder.getDataHandler(contentID), contentID); } // This is for compatibility with writeOptimized for (Iterator it = binaryNodeList.iterator(); it.hasNext();) { OMText text = (OMText) it.next(); multipartWriter.writePart((DataHandler) text.getDataHandler(), text.getContentID()); } multipartWriter.complete(); } catch (IOException e) { throw new OMException(e); } } } public void writeAttribute(String string, String string1) throws XMLStreamException { xmlWriter.writeAttribute(string, string1); } public void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException { xmlWriter.writeAttribute(string, string1, string2, string3); } public void writeAttribute(String string, String string1, String string2) throws XMLStreamException { xmlWriter.writeAttribute(string, string1, string2); } public void writeNamespace(String string, String string1) throws XMLStreamException { xmlWriter.writeNamespace(string, string1); } public void writeDefaultNamespace(String string) throws XMLStreamException { xmlWriter.writeDefaultNamespace(string); } public void writeComment(String string) throws XMLStreamException { xmlWriter.writeComment(string); } public void writeProcessingInstruction(String string) throws XMLStreamException { xmlWriter.writeProcessingInstruction(string); } public void writeProcessingInstruction(String string, String string1) throws XMLStreamException { xmlWriter.writeProcessingInstruction(string, string1); } public void writeCData(String string) throws XMLStreamException { xmlWriter.writeCData(string); } public void writeDTD(String string) throws XMLStreamException { xmlWriter.writeDTD(string); } public void writeEntityRef(String string) throws XMLStreamException { xmlWriter.writeEntityRef(string); } public void writeStartDocument() throws XMLStreamException { xmlWriter.writeStartDocument(); } public void writeStartDocument(String string) throws XMLStreamException { xmlWriter.writeStartDocument(string); } public void writeStartDocument(String string, String string1) throws XMLStreamException { xmlWriter.writeStartDocument(string, string1); } public void writeCharacters(String string) throws XMLStreamException { xmlWriter.writeCharacters(string); } public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException { xmlWriter.writeCharacters(chars, i, i1); } public String getPrefix(String string) throws XMLStreamException { return xmlWriter.getPrefix(string); } public void setPrefix(String string, String string1) throws XMLStreamException { xmlWriter.setPrefix(string, string1); } public void setDefaultNamespace(String string) throws XMLStreamException { xmlWriter.setDefaultNamespace(string); } public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException { xmlWriter.setNamespaceContext(namespaceContext); } public NamespaceContext getNamespaceContext() { return xmlWriter.getNamespaceContext(); } public Object getProperty(String string) throws IllegalArgumentException { return xmlWriter.getProperty(string); } /** * @deprecated * Serialization code should use * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)} * or {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, org.apache.axiom.ext.stax.datahandler.DataHandlerProvider, String, boolean)} * to submit any binary content and let this writer decide whether the content should be * written as base64 encoded character data or using xop:Include. * This makes optimization entirely transparent for the caller and there should be no need * to check if the writer is producing MTOM. */ public boolean isOptimized() { return format.isOptimized(); } public String getContentType() { return format.getContentType(); } /** * @deprecated * Serialization code should use * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)} * or {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, org.apache.axiom.ext.stax.datahandler.DataHandlerProvider, String, boolean)} * to submit any binary content and let this writer decide whether the content should be * written as base64 encoded character data or using xop:Include. */ public void writeOptimized(OMText node) { if(isDebugEnabled){ log.debug("Start MTOMXMLStreamWriter.writeOptimized()"); } binaryNodeList.add(node); if(isDebugEnabled){ log.debug("Exit MTOMXMLStreamWriter.writeOptimized()"); } } /** * @deprecated * Serialization code should use * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)} * or {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, org.apache.axiom.ext.stax.datahandler.DataHandlerProvider, String, boolean)} * to submit any binary content and let this writer decide whether the content should be * written as base64 encoded character data or using xop:Include. * Since the writer applies the settings defined in {@link OMOutputFormat} (including MTOM * thresholds), there is not need for this method anymore. */ public boolean isOptimizedThreshold(OMText node){ // The optimize argument is set to true for compatibility. Indeed, older versions // left it to the caller to check OMText#isOptimized(). try { return optimizationPolicy.isOptimized((DataHandler)node.getDataHandler(), true); } catch (IOException ex) { return true; } } public void setXmlStreamWriter(XMLStreamWriter xmlWriter) { this.xmlWriter = xmlWriter; } public XMLStreamWriter getXmlStreamWriter() { return xmlWriter; } public String getMimeBoundary() { return format.getMimeBoundary(); } public String getRootContentId() { return format.getRootContentId(); } public String getNextContentId() { return format.getNextContentId(); } /** * Returns the character set encoding scheme. If the value of the charSetEncoding is not set * then the default will be returned. * * @return Returns encoding. */ public String getCharSetEncoding() { return format.getCharSetEncoding(); } public void setCharSetEncoding(String charSetEncoding) { format.setCharSetEncoding(charSetEncoding); } public String getXmlVersion() { return format.getXmlVersion(); } public void setXmlVersion(String xmlVersion) { format.setXmlVersion(xmlVersion); } public void setSoap11(boolean b) { format.setSOAP11(b); } public boolean isIgnoreXMLDeclaration() { return format.isIgnoreXMLDeclaration(); } public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) { format.setIgnoreXMLDeclaration(ignoreXMLDeclaration); } public void setDoOptimize(boolean b) { format.setDoOptimize(b); } /** * Get the output format used by this writer. *

        * The caller should use the returned instance in a read-only way, i.e. * he should not modify the settings of the output format. Any attempt * to do so will lead to unpredictable results. * * @return the output format used by this writer */ public OMOutputFormat getOutputFormat() { return format; } public void setOutputFormat(OMOutputFormat format) { this.format = format; } /** * Get the underlying {@link OutputStream} for this writer, if available. This method allows a * node (perhaps an {@link org.apache.axiom.om.OMSourcedElement}) to write its content directly * to the byte stream. *

        * WARNING: This method should be used with extreme care. The caller must be prepared to * handle the following issues: *

          *
        • The caller must use the right charset encoding when writing to the stream. *
        • The caller should avoid writing byte order marks to the stream. *
        • The caller must be aware of the fact that a default namespace might have been set in the * context where the byte stream is requested. If the XML data written to the stream contains * unqualified elements, then the caller must make sure that the default namespace is redeclared * as appropriate. *
        * * @return the underlying byte stream, or null if the stream is not accessible */ public OutputStream getOutputStream() throws XMLStreamException { if (xmlStreamWriterFilter != null) { if (log.isDebugEnabled()) { log.debug("getOutputStream returning null due to presence of XMLStreamWriterFilter " + xmlStreamWriterFilter); } return null; } OutputStream os = null; if (rootPartOutputStream != null) { os = rootPartOutputStream; } else { os = outStream; } if (isDebugEnabled) { if (os == null) { log.debug("Direct access to the output stream is not available."); } else if (rootPartOutputStream != null) { log.debug("Returning access to the buffered xml stream: " + rootPartOutputStream); } else { log.debug("Returning access to the original output stream: " + os); } } if (os != null) { // Flush the state of the writer..Many times the // write defers the writing of tag characters (>) // until the next write. Flush out this character this.writeCharacters(""); this.flush(); } return os; } /** * Writes the relevant output. * * @param writer * @throws XMLStreamException */ private void writeOutput(OMText textNode) throws XMLStreamException { int type = textNode.getType(); if (type == OMNode.TEXT_NODE || type == OMNode.SPACE_NODE) { writeCharacters(textNode.getText()); } else if (type == OMNode.CDATA_SECTION_NODE) { writeCData(textNode.getText()); } else if (type == OMNode.ENTITY_REFERENCE_NODE) { writeEntityRef(textNode.getText()); } } public void setFilter(XMLStreamWriterFilter filter) { if (filter != null) { if (log.isDebugEnabled()) { log.debug("setting filter " + filter.getClass()); } xmlStreamWriterFilter = filter; filter.setDelegate(xmlWriter); xmlWriter = filter; } } public XMLStreamWriterFilter removeFilter() { XMLStreamWriterFilter filter = null; if (xmlStreamWriterFilter != null) { filter = xmlStreamWriterFilter; if (log.isDebugEnabled()) { log.debug("removing filter " + filter.getClass()); } xmlWriter = xmlStreamWriterFilter.getDelegate(); filter.setDelegate(null); xmlStreamWriterFilter = (xmlWriter instanceof XMLStreamWriterFilter) ? (XMLStreamWriterFilter) xmlWriter : null; } return filter; } } ./src/org/apache/axiom/om/impl/OMNavigator.java0000664000175000017500000001643111767656530020533 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.impl; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMSerializable; import org.apache.axiom.om.OMSourcedElement; /** * Refer to the test, org.apache.axiom.om.OMNavigatorTest, to find out how to use features like * isNavigable, isComplete and step. */ public class OMNavigator { /** Field node */ protected OMSerializable node; /** Field visited */ private boolean visited; /** Field next */ private OMSerializable next; // root is the starting element. Once the navigator comes back to the // root, the traversal is terminated /** Field root */ private OMSerializable root; /** Field backtracked */ private boolean backtracked; // flags that tell the status of the navigator /** Field end */ private boolean end = false; /** Field start */ private boolean start = true; // Indicates if an OMSourcedElement with an OMDataSource should // be considered as an interior node or a leaf node. private boolean isDataSourceALeaf = false; /** Constructor OMNavigator. */ public OMNavigator() { } /** * Constructor OMNavigator. * * @param node */ public OMNavigator(OMSerializable node) { init(node); } /** * Method init. * * @param node */ public void init(OMSerializable node) { next = node; root = node; backtracked = false; } /** * Indicate if an OMSourcedElement with a OMDataSource * should be considered as an interior element node or as * a leaf. * @param value boolean */ public void setDataSourceIsLeaf(boolean value) { isDataSourceALeaf = value; } /** * Get the next information item. * * @return the next information item in the sequence of preorder traversal. Note however that a * container (document or element) is treated slightly differently. Once the container * is passed it returns the same item in the next encounter as well. */ public OMSerializable getNext() { if (next == null) { return null; } node = next; visited = backtracked; backtracked = false; updateNextNode(); // set the starting and ending flags if (root.equals(node)) { if (!start) { end = true; } else { start = false; } } return node; } /** * Get the next node. This method only exists for compatibility with existing code. It may throw * a {@link ClassCastException} if an attempt is made to use it on a navigator that was created * from an {@link OMDocument}. * * @return the next node * @see #getNext() */ public OMNode next() { return (OMNode)getNext(); } /** Private method to encapsulate the searching logic. */ private void updateNextNode() { if (!isLeaf(next) && !visited) { OMNode firstChild = _getFirstChild((OMContainer) next); if (firstChild != null) { next = firstChild; } else if (next.isComplete()) { backtracked = true; } else { next = null; } } else { if (next instanceof OMDocument) { next = null; } else { OMNode nextNode = (OMNode)next; OMContainer parent = nextNode.getParent(); OMNode nextSibling = getNextSibling(nextNode); if (nextSibling != null) { next = nextSibling; } else if ((parent != null) && parent.isComplete()) { next = parent; backtracked = true; } else { next = null; } } } } /** * @param n OMNode * @return true if this OMNode should be considered a leaf node */ private boolean isLeaf(OMSerializable n) { if (n instanceof OMContainer) { if (this.isDataSourceALeaf && (n instanceof OMSourcedElement) && n != root) { OMDataSource ds = null; try { ds = ((OMSourcedElement) n).getDataSource(); } catch (UnsupportedOperationException e) { ; // Operation unsupported for some implementations } if (ds != null) { return true; } } return false; } else { return true; } } /** * @param node * @return first child or null */ private OMNode _getFirstChild(OMContainer node) { if (node instanceof OMSourcedElement) { OMNode first = node.getFirstOMChild(); OMNode sibling = first; while (sibling != null) { sibling = sibling.getNextOMSibling(); } return first; } else { return ((OMContainerEx) node).getFirstOMChildIfAvailable(); } } /** * @param node * @return next sibling or null */ private OMNode getNextSibling(OMNode node) { if (node instanceof OMSourcedElement) { return node.getNextOMSibling(); } else { return ((OMNodeEx) node).getNextOMSiblingIfAvailable(); } } /** * Method visited. * * @return Returns boolean. */ public boolean visited() { return visited; } /** * This is a very special method. This allows the navigator to step once it has reached the * existing OM. At this point the isNavigable method will return false but the isComplete method * may return false which means that the navigating the given element is not complete and the * navigator cannot proceed. */ public void step() { if (!end) { next = node; updateNextNode(); } } /** * Returns the navigable status. * * @return Returns boolean. */ public boolean isNavigable() { if (end) { return false; } else { return !(next == null); } } /** * Returns the completed status. * * @return Returns boolean. */ public boolean isCompleted() { return end; } } ./src/org/apache/axiom/om/OMDataSourceExt.java0000664000175000017500000001333511767656530020353 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; /** * Interface to a backing object that can can be read and written as XML. * * To plug an arbitrary object into an OM tree. Follow these steps * 1) Provide a class that implements OMDataSourceExt. * 2) Use OMFactory.createOMElement(OMDataSource, String, OMNamespace) to build an * OMSourcedElement. * 3) Add the OMSourcedElement to the OM tree. * * OMDataSourceExt provides additional methods that are not available on the * original OMDataSource. * * @see OMDataSource * @see OMSourcedElement */ public interface OMDataSourceExt extends OMDataSource { /* Property lossyPrefix * Value null or Boolean.TRUE or Boolean.FALSE * If Boolean.TRUE, this indicates that expansion is needed to * obtain the actual prefix name. */ public static final String LOSSY_PREFIX = "lossyPrefix"; /** * Serializes element data directly to stream. * Assumes that the backing object is destroyed during serialization if isDestructiveWrite * @see OMDataSourceExt * * @param output destination stream for element XML text * @param format Output format information. The implementation must use this information * to choose the correct character set encoding when writing to the * output stream. This parameter must not be null. * @throws XMLStreamException */ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes element data directly to writer. * Assumes that the backing object is destroyed during serialization isDestructiveWrite * @see OMDataSourceExt * * @param writer destination writer for element XML text * @param format output format information (null if none; may * be ignored if not supported by data binding even if supplied) * @throws XMLStreamException */ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * Serializes element data directly to StAX writer. * Assumes that the backing object is destroyed during serialization isDestructiveWrite * @see OMDataSourceExt * * @param xmlWriter destination writer * @throws XMLStreamException */ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException; /** * Get parser for element data. In the general case this may require the * data source to serialize data as XML text and then parse that text. * * @return element parser * @throws XMLStreamException */ public XMLStreamReader getReader() throws XMLStreamException; /** * Returns the backing Object. * @return Object */ public Object getObject(); /** * Returns true if reading the backing object is destructive. * An example of an object with a destructive read is an InputSteam. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when reading the OMDataSourceExt. * @return boolean */ public boolean isDestructiveRead(); /** * Returns true if writing the backing object is destructive. * An example of an object with a destructive write is an InputStream. * The owning OMSourcedElement uses this information to detemine if OM tree * expansion is needed when writing the OMDataSourceExt. * @return boolean */ public boolean isDestructiveWrite(); /** * Returns a InputStream representing the xml data * @param encoding String encoding of InputStream * @return InputStream */ public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException; /** * Returns a byte[] representing the xml data * @param encoding String encoding of InputStream * @return byte[] * @see #getXMLInputStream(String) */ public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException; /** * Close the DataSource and free its resources. */ public void close(); /** * Create a copy of the OMDataSourceExt * @return OMDataSourceExt */ public OMDataSourceExt copy(); /** * Returns true if property is set * @param key * @return TODO */ public boolean hasProperty(String key); /** * Query a property stored on the OMDataSource * @param key * @return value or null */ public Object getProperty(String key); /** * Set a property on the OMDataSource * @param key * @param value * @return old property object or null */ public Object setProperty(String key, Object value); } ./src/org/apache/axiom/om/OMXMLStreamReader.java0000664000175000017500000000425111767656530020574 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamReader; /** * Objects returned by OMElement.getXMLStreamReader may implement this interface */ /** * @author scheu * */ public interface OMXMLStreamReader extends XMLStreamReader, OMAttachmentAccessor { /** * By default, an OMText item that has an MTOM datahandler * will be rendered as a inlined text event. * @return true if inlined as TEXT, false if XOP_INCLUDE is used * * @deprecated This method will be removed in a future release of Axiom. See * {@link #setInlineMTOM(boolean)} for more details. */ public boolean isInlineMTOM(); /** * @param value set to true if inlining of text is desired (default) * throw OMException if not the value is not supported. * * @deprecated To return optimized base64 content as xop:Include elements, wrap the * reader using {@link org.apache.axiom.util.stax.xop.XOPEncodingStreamReader} or * use the more generic {@link org.apache.axiom.util.stax.xop.XOPUtils#getXOPEncodedStream(XMLStreamReader)} * method. * This method introduces unnecessary complexity in the {@link XMLStreamReader} * implementation used by Axiom and will be removed in a future release. */ public void setInlineMTOM(boolean value); } ./src/org/apache/axiom/om/OMMetaFactory.java0000664000175000017500000001363211767656530020056 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import org.apache.axiom.om.util.StAXParserConfiguration; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPModelBuilder; import org.xml.sax.InputSource; /** * Object model meta factory. * This interface encapsulates a particular object model and provides instances * for plain XML, SOAP 1.1 and SOAP 1.2 object model factories for the * given object model implementation. Currently the two OM implementations provided by * Axiom are LLOM (linked list) and DOM. *

        * The factories returned by {@link #getOMFactory()}, {@link #getSOAP11Factory()} and * {@link #getSOAP12Factory()} might be stateless (and thread safe) or not. In the former * case the implementation should return the same instance on every invocation, i.e. * instantiate the factory for each OM type only once. In the latter case, the implementation * must return a new instance on every invocation. In order to work with any OM implementation, * code using an implementation of this class must call the relevant method once and only once * for every document processed. */ public interface OMMetaFactory { /** * Get an OM factory instance for the XML infoset model. * * @return the OM factory instance */ OMFactory getOMFactory(); /** * Get an OM factory instance for the SOAP 1.1 infoset model. * * @return the OM factory instance */ SOAPFactory getSOAP11Factory(); /** * Get an OM factory instance for the SOAP 1.2 infoset model. * * @return the OM factory instance */ SOAPFactory getSOAP12Factory(); /** * Create an object model builder for plain XML that pulls events from a StAX stream reader. * * @param omFactory * The object model factory to use. This factory must be obtained from the same * {@link OMMetaFactory} instance as the one used to invoke this method. In general * the factory will be retrieved from {@link #getOMFactory()}), but in some cases it * may be necessary to pass a {@link SOAPFactory} instance, although this method will * never produce a SOAP infoset. * @param parser * the stream reader to read the XML data from * @return the builder */ OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, XMLStreamReader parser); /** * Create an object model builder for plain XML that reads a document from the provided input * source. * * @param omFactory * The object model factory to use. This factory must be obtained from the same * {@link OMMetaFactory} instance as the one used to invoke this method. In general * the factory will be retrieved from {@link #getOMFactory()}), but in some cases it * may be necessary to pass a {@link SOAPFactory} instance, although this method will * never produce a SOAP infoset. * @param configuration * the parser configuration to use * @param is * the source of the XML document * @return the builder */ OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, InputSource is); /** * Create an object model builder for plain XML that gets its input from a {@link Source}. * * @param omFactory * The object model factory to use. This factory must be obtained from the same * {@link OMMetaFactory} instance as the one used to invoke this method. In general * the factory will be retrieved from {@link #getOMFactory()}), but in some cases it * may be necessary to pass a {@link SOAPFactory} instance, although this method will * never produce a SOAP infoset. * @param source * the source of the XML document * @return the builder */ OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Source source); /** * Create an object model builder for SOAP that pulls events from a StAX stream reader. The * implementation will select the appropriate {@link SOAPFactory} based on the namespace URI of * the SOAP envelope. * * @param parser * the stream reader to read the SOAP message from * @return the builder */ SOAPModelBuilder createStAXSOAPModelBuilder(XMLStreamReader parser); /** * Create an object model builder for SOAP that reads a message from the provided input source. * The implementation will select the appropriate {@link SOAPFactory} based on the namespace URI * of the SOAP envelope. * * @param configuration * the parser configuration to use; for security reasons, this should in general be * {@link StAXParserConfiguration#SOAP} * @param is * the source of the SOAP message * @return the builder */ SOAPModelBuilder createSOAPModelBuilder(StAXParserConfiguration configuration, InputSource is); } ./src/org/apache/axiom/om/OMComment.java0000664000175000017500000000224511767656530017240 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Interface OMComment */ public interface OMComment extends OMNode { /** * Returns the value of this comment as defined by XPath 1.0. * * @return Returns String. */ String getValue(); /** * Sets the content of this comment to the specified string. * * @param text */ void setValue(String text); } ./src/org/apache/axiom/om/OMFactory.java0000664000175000017500000002315611767656530017251 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.namespace.QName; import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; /** Class OMFactory */ public interface OMFactory { /** * Get the {@link OMMetaFactory} from which this factory was obtained. * * @return the meta factory */ OMMetaFactory getMetaFactory(); /** Creates a new OMDocument. */ OMDocument createOMDocument(); OMDocument createOMDocument(OMXMLParserWrapper builder); /** * Create an element with the given name. If a namespace is given, a namespace declaration will * be added automatically to the newly created element. * * @param localName * the local part of the name; must not be null * @param ns * the namespace, or null if the element has no namespace * @return the newly created element */ OMElement createOMElement(String localName, OMNamespace ns); /** * * @param localName * @param ns * @param parent * the parent to which the newly created element will be added; this may be * null, in which case the behavior of the method is the same as * {@link #createOMElement(String, OMNamespace)} * @return the newly created element * @throws OMException */ OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMException; /** * @param localName * @param ns - this can be null * @param parent * @param builder */ OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder); /** * Construct element with arbitrary data source. This is an optional operation which may not be * supported by all factories. * * @param source * @param localName * @param ns */ OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns); /** * Construct element with arbitrary data source. This is an optional operation which may not be * supported by all factories. * * @param source the data source * @param qname the name of the element produced by the data source */ OMSourcedElement createOMElement(OMDataSource source, QName qname); /** * Create an element with the given name. If a namespace is given, a namespace declaration will * be added automatically to the newly created element. * * @param localName * the local part of the name; must not be null * @param namespaceURI * the namespace URI, or the empty string if the element has no namespace; must not * be null * @param prefix * the namespace prefix, or null if a prefix should be generated * @return the newly created OMElement. * @throws IllegalArgumentException * if namespaceURI is null */ OMElement createOMElement(String localName, String namespaceURI, String prefix); /** * Create an OMElement with the given QName under the given parent. * * If the QName contains a prefix, we will ensure that an OMNamespace is created * mapping the given namespace to the given prefix. If no prefix is passed, we'll * use whatever's already mapped in the parent, or create a generated one. * * @param qname the QName of the element to create * @param parent * the parent to which the newly created element will be added; this may be * null, in which case the behavior of the method is the same as * {@link #createOMElement(QName)} * @return Returns the new OMElement * @throws OMException if there's a namespace mapping problem */ OMElement createOMElement(QName qname, OMContainer parent) throws OMException; /** * Create an element with the given {@link QName}. If a namespace URI is given but no prefix, * the method will automatically generate a prefix for the element. If a namespace URI is given, * the method will also add a namespace declaration to the element, binding the auto-generated * prefix or the prefix given in the {@link QName} to the given namespace URI. If neither a * namespace URI nor a prefix is given, no namespace declaration will be added. * * @param qname * the {@link QName} defining the name of the element to be created * @return the new element * @throws OMException * TODO: when??? */ OMElement createOMElement(QName qname) throws OMException; /** * Create an {@link OMNamespace} instance or retrieve an existing one if the factory supports * pooling. * * @param uri * the namespace URI; must not be null * @param prefix * the prefix * @return the {@link OMNamespace} instance * @throws IllegalArgumentException * if uri is null */ OMNamespace createOMNamespace(String uri, String prefix); /** * Creates a new {@link OMText} node with the given value and appends it to the given parent * element. * * @param parent * @param text * @return Returns OMText. */ OMText createOMText(OMContainer parent, String text); /** * Create OMText node that is a copy of the source text node * @param parent * @param source * @return TODO */ public OMText createOMText(OMContainer parent, OMText source); /** * @param parent * @param text - This text itself can contain a namespace inside it. */ OMText createOMText(OMContainer parent, QName text); /** * @param parent * @param text * @param type - this should be either of XMLStreamConstants.CHARACTERS, * XMLStreamConstants.CDATA, XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCE * @return Returns OMText. */ OMText createOMText(OMContainer parent, String text, int type); OMText createOMText(OMContainer parent, char[] charArary, int type); /** * @param parent * @param text - This text itself can contain a namespace inside it. * @param type */ OMText createOMText(OMContainer parent, QName text, int type); /** * @param s * @return Returns OMText. */ OMText createOMText(String s); /** * @param s * @param type - OMText node can handle SPACE, CHARACTERS, CDATA and ENTITY REFERENCES. For * Constants, use either XMLStreamConstants or constants found in OMNode. * @return Returns OMText. */ OMText createOMText(String s, int type); OMText createOMText(String s, String mimeType, boolean optimize); OMText createOMText(Object dataHandler, boolean optimize); OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize); /** * Create a binary {@link OMText} node supporting deferred loading of the content. * * @param contentID * the content ID identifying the binary content; may be null * @param dataHandlerProvider * used to load the {@link javax.activation.DataHandler} when requested from the returned * {@link OMText} node * @param optimize * determines whether the binary content should be optimized * @return TODO */ OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize); OMText createOMText(String contentID, OMContainer parent, OMXMLParserWrapper builder); OMAttribute createOMAttribute(String localName, OMNamespace ns, String value); /** * Creates DocType/DTD. * * @param parent * @param content * @return Returns doctype. */ OMDocType createOMDocType(OMContainer parent, String content); /** * Creates a PI. * * @param parent * @param piTarget * @param piData * @return Returns OMProcessingInstruction. */ OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData); /** * Creates a comment. * * @param parent * @param content * @return Returns OMComment. */ OMComment createOMComment(OMContainer parent, String content); } ./src/org/apache/axiom/om/util/0000775000175000017500000000000011767656530015511 5ustar brianbrian./src/org/apache/axiom/om/util/DetachableInputStream.java0000664000175000017500000001346711767656530022577 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.attachments.utils.BAAInputStream; import org.apache.axiom.attachments.utils.BAAOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; /** * FilterInputStream that delegates to the original * InputStream. When detach() is called, the original * InputStream is consumed, and closed. The unread bytes are * stored in a local stream. * Subsequent requests are serviced by the local stream. * * Rationale: The detached stream can be closed and its * resources freed, but the consumer of the stream can * continue to receive data. * * Cons: If there are a lot of bytes remaining, these are * buffered. Currently they are buffered incore (this * could be improved to buffer in a file). * */ public class DetachableInputStream extends FilterInputStream { private static Log log = LogFactory.getLog(DetachableInputStream.class); private long count = 0; BAAInputStream localStream = null; boolean isClosed = false; public DetachableInputStream(InputStream in) { super(in); count = 0; } /** * @return count of bytes read */ public long length() throws IOException { if (localStream == null) { detach(); } return count; } /** * Consume the input stream and close it. * The bytes in the input stream are buffered. * (Thus the original input stream can release its * resources, but the consumer of the stream can * still receive data). * @throws IOException */ public void detach() throws IOException { if (localStream == null && !isClosed) { BAAOutputStream baaos = new BAAOutputStream(); try { // It is possible that the underlying stream was closed BufferUtils.inputStream2OutputStream(in, baaos); super.close(); } catch (Throwable t) { if (log.isDebugEnabled()) { log.debug("detach caught exception. Processing continues:" + t); log.debug(" " + stackToString(t)); } } finally { in = null; // GC the incoming stream } localStream = new BAAInputStream(baaos.buffers(), baaos.length()); if (log.isDebugEnabled()) { log.debug("The local stream built from the detached " + "stream has a length of:" + baaos.length()); } count = count + baaos.length(); } } public int available() throws IOException { if (localStream != null) { return localStream.available(); } else { return super.available(); } } public void close() throws IOException { isClosed = true; if (localStream != null) { localStream.close(); } else { super.close(); } } public boolean markSupported() { // Mark is not supported because stream can // switch return false; } public synchronized void mark(int readlimit) { throw new UnsupportedOperationException(); } public int read() throws IOException { if (localStream == null) { int rc = super.read(); if (rc != -1) { count++; } return rc; } else { return localStream.read(); } } public int read(byte[] b, int off, int len) throws IOException { if (localStream == null) { int rc = super.read(b, off, len); if (rc > 0) { count += rc; } return rc; } else { return localStream.read(b, off, len); } } public int read(byte[] b) throws IOException { if (localStream == null) { int rc = super.read(b); if (rc > 0) { count += rc; } return rc; } else { return localStream.read(b); } } public synchronized void reset() throws IOException { throw new IOException(); } public long skip(long n) throws IOException { if (localStream == null) { long rc = super.skip(n); if (rc > 0) { count += rc; } return rc; } else { return localStream.skip(n); } } private static String stackToString(Throwable e) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); return text; } } ./src/org/apache/axiom/om/util/UUIDGenerator.java0000664000175000017500000000747411767656530021005 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import java.net.InetAddress; import java.net.UnknownHostException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.Random; import org.apache.axiom.om.OMException; /** * @deprecated Please use one of the specialized methods in the * {@link org.apache.axiom.util.UIDGenerator} class. In contrast to what its name * suggests, the {@link #getUUID()} method doesn't return a UUID. It also doesn't return * a valid URN with uuid NID. See AXIS2-4527 for more information. */ public class UUIDGenerator { /** This class will give UUIDs for axis2. */ private static String baseUUID = null; private static long incrementingValue = 0; private static Random myRand = null; /** * MD5 a random string with localhost/date etc will return 128 bits construct a string of 18 * characters from those bits. * * @return string */ public static synchronized String getUUID() { if (baseUUID == null) { baseUUID = getInitialUUID(); baseUUID = "urn:uuid:" + baseUUID; } if (++incrementingValue >= Long.MAX_VALUE) { incrementingValue = 0; } return baseUUID + (System.currentTimeMillis() + incrementingValue); } protected static String getInitialUUID() { if (myRand == null) { myRand = new Random(); } long rand = myRand.nextLong(); String sid; try { sid = InetAddress.getLocalHost().toString(); } catch (UnknownHostException e) { sid = Thread.currentThread().getName(); } StringBuffer sb = new StringBuffer(); sb.append(sid); sb.append(":"); sb.append(Long.toString(rand)); MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } md5.update(sb.toString().getBytes()); byte[] array = md5.digest(); StringBuffer sb2 = new StringBuffer(); for (int j = 0; j < array.length; ++j) { int b = array[j] & 0xFF; sb2.append(Integer.toHexString(b)); } int begin = myRand.nextInt(); if (begin < 0) begin = begin * -1; begin = begin % 8; return sb2.toString().substring(begin, begin + 18).toUpperCase(); } public static void main(String[] args) { long startTime = new Date().getTime(); for (int i = 0; i < 100000; i++) { UUIDGenerator.getInitialUUID(); } long endTime = new Date().getTime(); System.out.println("getInitialUUID Difference = " + (endTime - startTime)); startTime = new Date().getTime(); for (int i = 0; i < 100000; i++) { UUIDGenerator.getUUID(); } endTime = new Date().getTime(); System.out.println("getUUID Difference = " + (endTime - startTime)); } } ./src/org/apache/axiom/om/util/CopyUtils.java0000664000175000017500000005362611767656530020323 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPFault; import org.apache.axiom.soap.SOAPFaultCode; import org.apache.axiom.soap.SOAPFaultDetail; import org.apache.axiom.soap.SOAPFaultNode; import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPFaultSubCode; import org.apache.axiom.soap.SOAPFaultText; import org.apache.axiom.soap.SOAPFaultValue; import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.util.Iterator; /** * CopyUtils provides static utility methods that are useful for creating a copy of * an OM/SOAPEnvelope tree. * During the expansion, the Source tree retains its shape * (OMSourcedElement nodes are not expanded). * The Target tree has nodes that retain the class identity of the source node. For * example, a SOAPFault in the source tree will have a SOAPFault in the target tree. */ public class CopyUtils { private static Log log = LogFactory.getLog(CopyUtils.class); private static final boolean IS_DEBUG_ENABLED = log.isDebugEnabled(); /** * Private Constructor */ private CopyUtils() { } /** * Creates a copy of the source envelope. * If there are OMSourcedElements in the source tree, * similar MSourcedElements are used in the target tree. * * @param sourceEnv * @return targetEnv */ public static SOAPEnvelope copy(SOAPEnvelope sourceEnv) { // Make sure to build the whole sourceEnv if (log.isDebugEnabled()) { log.debug("start copy SOAPEnvelope"); } SOAPFactory factory = (SOAPFactory) sourceEnv.getOMFactory(); // Create envelope with the same prefix SOAPEnvelope targetEnv = factory.createSOAPEnvelope(sourceEnv.getNamespace()); // Copy the attributes and namespaces from the source // envelope to the target envelope. copyTagData(sourceEnv, targetEnv); Iterator i = sourceEnv.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); if (node instanceof SOAPHeader) { // Copy the SOAPHeader tree SOAPHeader targetHeader = factory.createSOAPHeader(targetEnv); Iterator j = ((SOAPHeader)node).getChildren(); while (j.hasNext()) { OMNode child = (OMNode) j.next(); copy(factory, targetHeader, child); } } else if (node instanceof SOAPBody) { // Copy the SOAPBody tree SOAPBody targetBody = factory.createSOAPBody(targetEnv); Iterator j = ((SOAPBody)node).getChildren(); while (j.hasNext()) { OMNode child = (OMNode) j.next(); copy(factory, targetBody, child); } } else { // Comments, text, etc. copy(factory, targetEnv, node); } } if (log.isDebugEnabled()) { log.debug("end copy SOAPEnvelope"); } return targetEnv; } /** * Simple utility that takes an XMLStreamReader and writes it * to an XMLStreamWriter * @param reader * @param writer * @throws XMLStreamException */ public static void reader2writer(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { StAXOMBuilder builder = new StAXOMBuilder(reader); builder.releaseParserOnClose(true); try { OMDocument omDocument = builder.getDocument(); Iterator it = omDocument.getChildren(); while (it.hasNext()) { OMNode omNode = (OMNode) it.next(); omNode.serializeAndConsume(writer); } } finally { builder.close(); } } /** * Create a copy of the sourceNode and attach it to the targetParent * @param factory OMFactory * @param targetParent * @param sourceNode */ private static void copy(SOAPFactory factory, OMContainer targetParent, OMNode sourceNode) { // Create and attach a node of the same class // TODO It would be nice if you could do this directly from the // OMNode, but OMNode.clone() does not gurantee that an object of the correct // class is created. if (sourceNode instanceof SOAPHeaderBlock) { copySOAPHeaderBlock(factory, targetParent, (SOAPHeaderBlock) sourceNode); } else if (sourceNode instanceof SOAPFault) { copySOAPFault(factory, targetParent, (SOAPFault) sourceNode); } else if (sourceNode instanceof OMSourcedElement) { copyOMSourcedElement(factory, targetParent, (OMSourcedElement) sourceNode); } else if (sourceNode instanceof OMElement) { copyOMElement(factory, targetParent, (OMElement) sourceNode); } else if (sourceNode instanceof OMText) { copyOMText(factory, targetParent, (OMText) sourceNode); } else if (sourceNode instanceof OMComment) { copyOMComment(factory, targetParent, (OMComment) sourceNode); } else { throw new OMException("Internal Failure: Cannot make a copy of " + sourceNode.getClass().getName()); } } /** * Create a copy of the source OMComment * @param factory * @param targetParent * @param sourceComment */ private static void copyOMComment(SOAPFactory factory, OMContainer targetParent, OMComment sourceComment) { // Create and attach the comment factory.createOMComment(targetParent, sourceComment.getValue()); } /** * Create a copy of the OM Text * @param factory * @param targetParent * @param sourceText */ private static void copyOMText(SOAPFactory factory, OMContainer targetParent, OMText sourceText) { if (IS_DEBUG_ENABLED) { log.debug("start copyOMText"); } if (sourceText.isBinary()) { // This forces a load of the datahandler so that it is saved on the copy. Object dh = sourceText.getDataHandler(); if (IS_DEBUG_ENABLED) { String dhclass = (dh == null) ? "null" : dh.getClass().toString(); log.debug("The source text's binary data handler is " + dhclass); } } factory.createOMText(targetParent, sourceText); if (IS_DEBUG_ENABLED) { log.debug("end copyOMText"); } } /** * Create a copy of an ordinary OMElement * @param factory * @param targetParent * @param sourceElement */ private static void copyOMElement(SOAPFactory factory, OMContainer targetParent, OMElement sourceElement) { // Clone and attach the OMElement. // REVIEW This clone will expand the underlying tree. We may want consider traversing // a few levels deeper to see if there are any additional OMSourcedElements. targetParent.addChild(sourceElement.cloneOMElement()); } /** * Create a copy of the OMSourcedElement * @param factory * @param targetParent * @param sourceOMSE */ private static void copyOMSourcedElement(SOAPFactory factory, OMContainer targetParent, OMSourcedElement sourceOMSE) { // If already expanded or this is not an OMDataSourceExt, then // create a copy of the OM Tree OMDataSource ds = sourceOMSE.getDataSource(); if (ds == null || sourceOMSE.isExpanded() || !(ds instanceof OMDataSourceExt)) { copyOMElement(factory, targetParent, sourceOMSE); return; } // If copying is destructive, then copy the OM tree OMDataSourceExt sourceDS = (OMDataSourceExt) ds; if (sourceDS.isDestructiveRead() || sourceDS.isDestructiveWrite()) { copyOMElement(factory, targetParent, sourceOMSE); return; } OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy(); if (targetDS == null) { copyOMElement(factory, targetParent, sourceOMSE); return; } // Otherwise create a target OMSE with the copied DataSource OMSourcedElement targetOMSE = factory.createOMElement(targetDS, sourceOMSE.getLocalName(), sourceOMSE.getNamespace()); targetParent.addChild(targetOMSE); } /** * Create a copy of the SOAPHeaderBlock * @param factory * @param targetParent * @param sourceSHB */ private static void copySOAPHeaderBlock(SOAPFactory factory, OMContainer targetParent, SOAPHeaderBlock sourceSHB) { // If already expanded or this is not an OMDataSourceExt, then // create a copy of the OM Tree OMDataSource ds = sourceSHB.getDataSource(); if (ds == null || sourceSHB.isExpanded() || !(ds instanceof OMDataSourceExt)) { copySOAPHeaderBlock_NoDataSource(factory, targetParent, sourceSHB); return; } // If copying is destructive, then copy the OM tree OMDataSourceExt sourceDS = (OMDataSourceExt) ds; if (sourceDS.isDestructiveRead() || sourceDS.isDestructiveWrite()) { copySOAPHeaderBlock_NoDataSource(factory, targetParent, sourceSHB); return; } // Otherwise create a copy of the OMDataSource OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy(); SOAPHeaderBlock targetSHB = factory.createSOAPHeaderBlock(sourceSHB.getLocalName(), sourceSHB.getNamespace(), targetDS); targetParent.addChild(targetSHB); copySOAPHeaderBlockData(sourceSHB, targetSHB); } /** * Create a copy of the SOAPHeaderBlock * @param factory * @param targetParent * @param sourceSHB */ private static void copySOAPHeaderBlock_NoDataSource(SOAPFactory factory, OMContainer targetParent, SOAPHeaderBlock sourceSHB) { SOAPHeader header = (SOAPHeader) targetParent; String localName = sourceSHB.getLocalName(); OMNamespace ns = sourceSHB.getNamespace(); SOAPHeaderBlock targetSHB = factory.createSOAPHeaderBlock(localName, ns, header); // A SOAPHeaderBlock has tag data, plus extra header processing flags copyTagData(sourceSHB, targetSHB); copySOAPHeaderBlockData(sourceSHB, targetSHB); Iterator i = sourceSHB.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); copy(factory, targetSHB, node); } } /** * Create a copy of a SOAPFault * @param factory * @param targetParent * @param sourceSOAPFault */ private static void copySOAPFault(SOAPFactory factory, OMContainer targetParent, SOAPFault sourceSOAPFault) { Exception e = sourceSOAPFault.getException(); SOAPFault newSOAPFault = (e == null) ? factory.createSOAPFault((SOAPBody) targetParent): factory.createSOAPFault((SOAPBody) targetParent, e); copyTagData(sourceSOAPFault, newSOAPFault); Iterator i = sourceSOAPFault.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); // Copy the tree under the SOAPFault copyFaultData(factory, newSOAPFault, node); } } /** * Copy the source Node, which is a child fo a SOAPFault, * to the target SOAPFault * @param factory * @param targetFault * @param sourceNode */ private static void copyFaultData(SOAPFactory factory, SOAPFault targetFault, OMNode sourceNode) { if (sourceNode instanceof SOAPFaultCode) { copySOAPFaultCode(factory, targetFault, (SOAPFaultCode) sourceNode); } else if (sourceNode instanceof SOAPFaultDetail) { copySOAPFaultDetail(factory, targetFault, (SOAPFaultDetail) sourceNode); } else if (sourceNode instanceof SOAPFaultNode) { copySOAPFaultNode(factory, targetFault, (SOAPFaultNode) sourceNode); } else if (sourceNode instanceof SOAPFaultReason) { copySOAPFaultReason(factory, targetFault, (SOAPFaultReason) sourceNode); } else if (sourceNode instanceof SOAPFaultRole) { copySOAPFaultRole(factory, targetFault, (SOAPFaultRole) sourceNode); } else if (sourceNode instanceof OMText) { copyOMText(factory, targetFault, (OMText) sourceNode); } else if (sourceNode instanceof OMComment) { copyOMComment(factory, targetFault, (OMComment) sourceNode); } else { throw new OMException("Internal Failure: Cannot make a copy of " + sourceNode.getClass().getName() + " object found in a SOAPFault."); } } /** * Create a copy of a SOAPFaultRole * @param factory * @param targetFault * @param sourceRole */ private static void copySOAPFaultRole(SOAPFactory factory, SOAPFault targetFault, SOAPFaultRole sourceRole) { SOAPFaultRole targetRole = factory.createSOAPFaultRole(targetFault); copyTagData(sourceRole, targetRole); targetRole.setRoleValue(sourceRole.getRoleValue()); } /** * Create a copy of a SOAPFaultNode * @param factory * @param targetFault * @param sourceNode */ private static void copySOAPFaultNode(SOAPFactory factory, SOAPFault targetFault, SOAPFaultNode sourceNode) { SOAPFaultNode targetNode = factory.createSOAPFaultNode(targetFault); copyTagData(sourceNode, targetNode); targetNode.setNodeValue(sourceNode.getNodeValue()); } /** * Create a copy of a SOAPFaultDetail * @param factory * @param targetFault * @param sourceDetail */ private static void copySOAPFaultDetail(SOAPFactory factory, SOAPFault targetFault, SOAPFaultDetail sourceDetail) { SOAPFaultDetail targetDetail = factory.createSOAPFaultDetail(targetFault); copyTagData(sourceDetail, targetDetail); // Copy the detail entries Iterator i = sourceDetail.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); copy(factory, targetDetail, node); } } /** * Create a copy of the SOAPFaultReason * @param factory * @param targetFault * @param sourceReason */ private static void copySOAPFaultReason(SOAPFactory factory, SOAPFault targetFault, SOAPFaultReason sourceReason) { SOAPFaultReason targetReason = factory.createSOAPFaultReason(targetFault); copyTagData(sourceReason, targetReason); Iterator i = sourceReason.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); if (node instanceof SOAPFaultText) { SOAPFaultText oldText = (SOAPFaultText) node; SOAPFaultText newText = factory.createSOAPFaultText(targetReason); copyTagData(oldText, newText); // The lang is copied as an attribute } else { // Copy any comments or child nodes copy(factory, targetReason, node); } } } /** * Copy the SOAPFaultCode tree * @param factory * @param targetFault * @param sourceCode */ private static void copySOAPFaultCode(SOAPFactory factory, SOAPFault targetFault, SOAPFaultCode sourceCode) { SOAPFaultCode targetCode = factory.createSOAPFaultCode(targetFault); copyTagData(sourceCode, targetCode); // Create the Value SOAPFaultValue sourceValue = sourceCode.getValue(); SOAPFaultValue targetValue = factory.createSOAPFaultValue(targetCode); copyTagData(sourceValue, targetValue); // There should only be a text node for the value, but in case there is more Iterator i = sourceValue.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); copy(factory, targetValue, node); } // Now get process the SubCode SOAPFaultSubCode sourceSubCode = sourceCode.getSubCode(); if (sourceSubCode != null) { copySOAPFaultSubCode(factory, targetCode, sourceSubCode); } } /** * Copy the SOAPFaultSubCode tree * @param factory * @param targetParent (SOAPFaultCode or SOAPFaultSubCode) * @param sourceSubCode */ private static void copySOAPFaultSubCode(SOAPFactory factory, OMElement targetParent, SOAPFaultSubCode sourceSubCode) { SOAPFaultSubCode targetSubCode; if (targetParent instanceof SOAPFaultSubCode) { targetSubCode = factory.createSOAPFaultSubCode((SOAPFaultSubCode) targetParent); } else { targetSubCode = factory.createSOAPFaultSubCode((SOAPFaultCode) targetParent); } copyTagData(sourceSubCode, targetSubCode); // Process the SOAP FaultValue SOAPFaultValue sourceValue = sourceSubCode.getValue(); SOAPFaultValue targetValue = factory.createSOAPFaultValue(targetSubCode); copyTagData(sourceValue, targetValue); // There should only be a text node for the value, but in case there is more Iterator i = sourceValue.getChildren(); while (i.hasNext()) { OMNode node = (OMNode) i.next(); copy(factory, targetValue, node); } // Now process the SubCode of the SubCode SOAPFaultSubCode sourceSubSubCode = sourceSubCode.getSubCode(); if (sourceSubSubCode != null) { copySOAPFaultSubCode(factory, targetSubCode, sourceSubSubCode); } } /** * Copy the tag data (attributes and namespaces) from the source * element to the target element. * @param sourceElement * @param targetElement */ private static void copyTagData(OMElement sourceElement, OMElement targetElement) { for (Iterator i = sourceElement.getAllDeclaredNamespaces(); i.hasNext();) { OMNamespace ns = (OMNamespace) i.next(); targetElement.declareNamespace(ns); } for (Iterator i = sourceElement.getAllAttributes(); i.hasNext();) { OMAttribute attr = (OMAttribute) i.next(); targetElement.addAttribute(attr); } } /** * Copy Header data (currently only the processed flag) from the * source SOAPHeaderBlock to the target SOAPHeaderBlock * @param sourceSHB * @param targetSHB */ private static void copySOAPHeaderBlockData(SOAPHeaderBlock sourceSHB, SOAPHeaderBlock targetSHB) { // Copy the processed flag. The other SOAPHeaderBlock information //(e.g. role, mustUnderstand) are attributes on the tag and are copied in copyTagData. if (sourceSHB.isProcessed()) { targetSHB.setProcessed(); } } } ./src/org/apache/axiom/om/util/AXIOMUtil.java0000664000175000017500000000421211767656530020066 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMXMLBuilderFactory; import javax.xml.stream.XMLStreamException; import java.io.StringReader; public class AXIOMUtil { /** * Create an OMElement from an XML fragment given as a string. * * @param xmlFragment the well-formed XML fragment * @return The OMElement created out of the string XML fragment. * @throws XMLStreamException */ public static OMElement stringToOM(String xmlFragment) throws XMLStreamException { return stringToOM(OMAbstractFactory.getOMFactory(), xmlFragment); } /** * Create an OMElement from an XML fragment given as a string. * * @param omFactory the factory used to build the object model * @param xmlFragment the well-formed XML fragment * @return The OMElement created out of the string XML fragment. * @throws XMLStreamException */ public static OMElement stringToOM(OMFactory omFactory, String xmlFragment) throws XMLStreamException { if (xmlFragment != null) { return OMXMLBuilderFactory.createOMBuilder(omFactory, new StringReader(xmlFragment)) .getDocumentElement(); } return null; } } ./src/org/apache/axiom/om/util/CommonUtils.java0000664000175000017500000001322311767656530020626 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.commons.logging.Log; /** * Common Utilities */ public class CommonUtils { /** * Private constructor. All methods of this class are static. */ private CommonUtils() {} /** * replace: Like String.replace except that the old and new items are strings. * * @param name string * @param oldT old text to replace * @param newT new text to use * @return replacement string */ public static final String replace(String name, String oldT, String newT) { if (name == null) return ""; // Create a string buffer that is twice initial length. // This is a good starting point. StringBuffer sb = new StringBuffer(name.length() * 2); int len = oldT.length(); try { int start = 0; int i = name.indexOf(oldT, start); while (i >= 0) { sb.append(name.substring(start, i)); sb.append(newT); start = i + len; i = name.indexOf(oldT, start); } if (start < name.length()) sb.append(name.substring(start)); } catch (NullPointerException e) { // No FFDC code needed } return new String(sb); } /** * Get a string containing the stack of the current location * * @return String */ public static String callStackToString() { return stackToString(new RuntimeException()); } /** * Get a string containing the stack of the specified exception * * @param e * @return TODO */ public static String stackToString(Throwable e) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); // Jump past the throwable text = text.substring(text.indexOf("at")); text = replace(text, "at ", "DEBUG_FRAME = "); return text; } /** * Writes the om to a log.debug. * This method assumes optimized mtom attachments * Also calculates the length of the message. * @param om OMElement * @param log Log * @return length of entire message */ public static long logDebug(OMElement om, Log log) { return logDebug(om, log, Integer.MAX_VALUE); } /** * Writes the om to a log.debug. * This method assumes optimized mtom attachments * Also calculates the length of the message. * @param om OMElement * @param log Log * @param limit limit of message to write * @return length of entire message */ public static long logDebug(OMElement om, Log log, int limit) { OMOutputFormat format = new OMOutputFormat(); format.setDoOptimize(true); format.setIgnoreXMLDeclaration(true); return logDebug(om, log, limit, format); } /** * Writes the om to a log.debug. * Also calculates the length of the message. * @param om OMElement * @param log Log * @param limit limit of message to write * @param format OMOutputFormat * @return length of entire message */ public static long logDebug(OMElement om, Log log, int limit, OMOutputFormat format) { LogOutputStream logStream = new LogOutputStream(log, limit); try { om.serialize(logStream, format); logStream.flush(); logStream.close(); } catch (Throwable t) { // Problem occur while logging. Log error and continue log.debug(t); log.error(t); } return logStream.getLength(); } /** * A "textual part" has one or more of the following criteria * 1) a content-type that start with "text" * "application/xml" or "application/soap" * 2) has a charset parameter on the content-type. * * Example: * An part with a content-type of "image/gif" is a non-textual attachment. * An part with a content-type of "application/soap+xml" is an textual attachment * * @param contentType * @return true if text, false otherwise */ public static boolean isTextualPart(String contentType) { String ct = contentType.trim(); // REVIEW: What about content-type with a type of "message" return ct.startsWith("text/") || ct.startsWith("application/soap") || ct.startsWith("application/xml") || ct.indexOf("charset") != -1; } } ./src/org/apache/axiom/om/util/XPathEvaluator.java0000664000175000017500000000261711767656530021271 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.xpath.AXIOMXPath; import org.jaxen.SimpleNamespaceContext; import java.util.List; public class XPathEvaluator { public List evaluateXpath(String xpathExpression, Object element, String nsURI) throws Exception { AXIOMXPath xpath = new AXIOMXPath(xpathExpression); if (nsURI != null) { SimpleNamespaceContext nsContext = new SimpleNamespaceContext(); nsContext.addNamespace(null, nsURI); xpath.setNamespaceContext(nsContext); } return xpath.selectNodes(element); } } ./src/org/apache/axiom/om/util/StAXWriterConfiguration.java0000664000175000017500000000472411767656530023127 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import javax.xml.stream.XMLOutputFactory; import org.apache.axiom.util.stax.dialect.StAXDialect; import org.apache.axiom.util.stax.dialect.StAXDialectDetector; /** * Defines a particular StAX writer configuration. An implementation of this * interface must satisfy the following requirements: *

          *
        1. It MUST be immutable. *
        2. It MUST either be a singleton or properly implement * {@link Object#equals(Object)} and {@link Object#hashCode()}. *
        * These two requirements ensure that instances of this interface may be used as * cache keys. * * @see StAXParserConfiguration */ public interface StAXWriterConfiguration { /** * The default configuration. */ StAXWriterConfiguration DEFAULT = new StAXWriterConfiguration() { public XMLOutputFactory configure(XMLOutputFactory factory, StAXDialect dialect) { return factory; } public String toString() { return "DEFAULT"; } }; /** * Apply the configuration to the given factory. The method MAY optionally * wrap the factory. * * @param factory * the factory to configure * @param dialect * The dialect of the StAX implementation as detected by * {@link StAXDialectDetector}. The implementation may use this * information to configure implementation specific settings. * @return The configured factory. This may be the original factory (if the * implementation only changes the factory properties), or a * wrapper. */ XMLOutputFactory configure(XMLOutputFactory factory, StAXDialect dialect); } ./src/org/apache/axiom/om/util/LogOutputStream.java0000664000175000017500000000642111767656530021475 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.commons.logging.Log; import java.io.IOException; import java.io.OutputStream; /** * LogOutputStream * Writes to log.debug() * Also counts the number of bytes */ public class LogOutputStream extends OutputStream { private byte[] temp = new byte[1]; private boolean isDebugEnabled = false; private long count = 0; private Log log; private int BUFFER_LEN = 4 * 1024; private byte[] buffer = new byte[BUFFER_LEN]; private int bufferIndex = 0; private int limit; public LogOutputStream(Log log, int limit) { isDebugEnabled = log.isDebugEnabled(); this.log = log; this.limit = limit; } public long getLength() { return count; } public void close() throws IOException { if (bufferIndex > 0) { log.debug(new String(buffer, 0, bufferIndex)); bufferIndex = 0; } buffer = null; temp = null; log = null; } public void flush() throws IOException { // noop } public void write(byte[] b, int off, int len) throws IOException { // Adjust total count // Adjust length to write if (count >= limit) { count += len; return; } else if (count + len >= limit) { count += len; len = (int) (len - (limit - count)); // adjust length to write } else { count += len; } if (isDebugEnabled) { if (len + bufferIndex < BUFFER_LEN) { // buffer the text System.arraycopy(b, off, buffer, bufferIndex, len); bufferIndex += len; } else { // write buffered text if (bufferIndex > 0) { log.debug(new String(buffer, 0, bufferIndex)); bufferIndex = 0; } // buffer or write remaining text if (len + bufferIndex < BUFFER_LEN) { System.arraycopy(b, off, buffer, bufferIndex, len); bufferIndex += len; } else { log.debug(new String(b, off, len)); } } } } public void write(byte[] b) throws IOException { this.write(b, 0, b.length); } public void write(int b) throws IOException { temp[0] = (byte) b; this.write(temp, 0, 1); } } ./src/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java0000664000175000017500000001403511767656530023331 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * The base class for classes that are XMLStreamWriterFilters * Each of the XMLStreamWriter events is intercepted and passed to the delegate XMLStreamWriter * * Character data is sent to the xmlData abstract method. Derived classes may * log or change the xml data. * * @see XMLStreamWriterRemoveIllegalChars */ public abstract class XMLStreamWriterFilterBase implements XMLStreamWriterFilter { XMLStreamWriter delegate = null; public XMLStreamWriterFilterBase() { } public void setDelegate(XMLStreamWriter writer) { this.delegate = writer; } public XMLStreamWriter getDelegate() { return delegate; } public void close() throws XMLStreamException { delegate.close(); } public void flush() throws XMLStreamException { delegate.flush(); } public NamespaceContext getNamespaceContext() { return delegate.getNamespaceContext(); } public String getPrefix(String uri) throws XMLStreamException { return delegate.getPrefix(uri); } public Object getProperty(String name) throws IllegalArgumentException { return delegate.getProperty(name); } public void setDefaultNamespace(String uri) throws XMLStreamException { delegate.setDefaultNamespace(uri); } public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { delegate.setNamespaceContext(context); } public void setPrefix(String prefix, String uri) throws XMLStreamException { delegate.setPrefix(prefix, uri); } public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { delegate.writeAttribute(prefix, namespaceURI, localName, xmlData(value)); } public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { delegate.writeAttribute(namespaceURI, localName, xmlData(value)); } public void writeAttribute(String localName, String value) throws XMLStreamException { delegate.writeAttribute(localName, xmlData(value)); } public void writeCData(String data) throws XMLStreamException { delegate.writeCData(xmlData(data)); } public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { // Adapt to writeCharacters that takes a String value String value = new String(text, start, len); writeCharacters(value); } public void writeCharacters(String text) throws XMLStreamException { delegate.writeCharacters(xmlData(text)); } public void writeComment(String data) throws XMLStreamException { delegate.writeComment(data); } public void writeDTD(String dtd) throws XMLStreamException { delegate.writeDTD(dtd); } public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { delegate.writeDefaultNamespace(namespaceURI); } public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { delegate.writeEmptyElement(prefix, localName, namespaceURI); } public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { delegate.writeEmptyElement(namespaceURI, localName); } public void writeEmptyElement(String localName) throws XMLStreamException { delegate.writeEmptyElement(localName); } public void writeEndDocument() throws XMLStreamException { delegate.writeEndDocument(); } public void writeEndElement() throws XMLStreamException { delegate.writeEndElement(); } public void writeEntityRef(String name) throws XMLStreamException { delegate.writeEntityRef(name); } public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { delegate.writeNamespace(prefix, namespaceURI); } public void writeProcessingInstruction(String target, String data) throws XMLStreamException { delegate.writeProcessingInstruction(target, data); } public void writeProcessingInstruction(String target) throws XMLStreamException { delegate.writeProcessingInstruction(target); } public void writeStartDocument() throws XMLStreamException { delegate.writeStartDocument(); } public void writeStartDocument(String encoding, String version) throws XMLStreamException { delegate.writeStartDocument(encoding, version); } public void writeStartDocument(String version) throws XMLStreamException { delegate.writeStartDocument(version); } public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { delegate.writeStartElement(prefix, localName, namespaceURI); } public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { delegate.writeStartElement(namespaceURI, localName); } public void writeStartElement(String localName) throws XMLStreamException { delegate.writeStartElement(localName); } /** * Derived classes extend the method. A derived class may log or modify the xml data * @param value * @return value */ protected abstract String xmlData(String value); } ./src/org/apache/axiom/om/util/OMXMLStreamReaderValidator.java0000664000175000017500000000510011767656530023411 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMXMLStreamReader; import org.apache.axiom.util.stax.debug.XMLStreamReaderValidator; import javax.activation.DataHandler; // TODO: this needs reformatting; the (generated) Javadoc is unreadable! /** * There are several places in the code where events are passed from * a source to a consumer using XMLStreamReader events. * * OMXMLStreamReader (impl)--> consumer of XMLStreamReader events * * This simple class can be interjected as a filter and used to do some simple validation. * Validating the events coming from source (impl) can help find and correct errors * when they occur. Otherwise the errors may be caught much further downstream and hard to fix. * * OMXMLStreamReader (impl)--> OMXMLStreamReaderValiator-> consumer of XMLStreamReader events * * * In the initial version, the XMStreamValidator ensures that the start element events match the * end element events. * * @see org.apache.axiom.om.OMElement#getXMLStreamReader(boolean) */ public class OMXMLStreamReaderValidator extends XMLStreamReaderValidator implements OMXMLStreamReader { /** * @param delegate XMLStreamReader to validate * @param throwExceptions (true if exceptions should be thrown when errors are encountered) */ public OMXMLStreamReaderValidator(OMXMLStreamReader delegate, boolean throwExceptions) { super(delegate, throwExceptions); } public DataHandler getDataHandler(String blobcid) { return ((OMXMLStreamReader)getParent()).getDataHandler(blobcid); } public boolean isInlineMTOM() { return ((OMXMLStreamReader)getParent()).isInlineMTOM(); } public void setInlineMTOM(boolean value) { ((OMXMLStreamReader)getParent()).setInlineMTOM(value); } } ./src/org/apache/axiom/om/util/AttributeHelper.java0000664000175000017500000000373711767656530021471 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; /** Helper class for attributes. */ public class AttributeHelper { /** * In Axiom, a single tree should always contain objects created from the same type of factory * (eg: LinkedListImplFactory, DOMFactory, etc.,). This method will convert omAttribute to the * given omFactory. * * @see ElementHelper#importOMElement(OMElement, OMFactory) to convert instances of OMElement */ public static void importOMAttribute(OMAttribute omAttribute, OMElement omElement) { // first check whether the given OMAttribute has the same OMFactory if (omAttribute.getOMFactory().getClass().isInstance(omElement.getOMFactory())) { omElement.addAttribute(omAttribute); } else { OMNamespace ns = omAttribute.getNamespace(); omElement.addAttribute(omAttribute.getLocalName(), omAttribute.getAttributeValue(), omElement.getOMFactory().createOMNamespace(ns.getNamespaceURI(), ns.getPrefix())); } } } ./src/org/apache/axiom/om/util/StAXUtils.java0000664000175000017500000010276411767656530020226 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.axiom.om.OMConstants; import org.apache.axiom.util.stax.XMLEventUtils; import org.apache.axiom.util.stax.dialect.StAXDialect; import org.apache.axiom.util.stax.dialect.StAXDialectDetector; import org.apache.axiom.util.stax.wrapper.ImmutableXMLInputFactory; import org.apache.axiom.util.stax.wrapper.ImmutableXMLOutputFactory; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.WeakHashMap; /** * Utility class containing StAX related methods. *

        This class defines a set of methods to get {@link XMLStreamReader} and {@link XMLStreamWriter} * instances. This class caches the corresponding factories ({@link XMLInputFactory} * and {@link XMLOutputFactory} objects) by classloader (default) or as singletons. * The behavior can be changed using {@link #setFactoryPerClassLoader(boolean)}.

        *

        Default properties for these factories can be specified using * XMLInputFactory.properties and XMLOutputFactory.properties files. * When a new factory is instantiated, this class will attempt to load the corresponding file using * the context classloader. This class supports properties with boolean, integer and string values. * Both standard StAX properties and implementation specific properties can be specified. This * feature should be used with care since changing some properties to non default values will break * Axiom. Good candidates for XMLInputFactory.properties are:

        *
        *
        javax.xml.stream.isCoalescing
        *
        Requires the processor to coalesce adjacent character data (text nodes and CDATA * sections). This property also controls whether CDATA sections are reported or not.
        *
        com.ctc.wstx.inputBufferLength
        *
        Size of input buffer (in chars), to use for reading XML content from input stream/reader. * This property is Woodstox specific.
        *
        com.ctc.wstx.minTextSegment
        *
        Property to specify shortest non-complete text segment (part of CDATA section or text * content) that the parser is allowed to return, if not required to coalesce text. * This property is Woodstox specific. *
        *

        Good candidates for XMLOutputFactory.properties are:

        *
        *
        com.ctc.wstx.outputEscapeCr
        *
        Property that determines whether Carriage Return (\r) characters are to be escaped when * output or not. If enabled, all instances of of character \r are escaped using a character * entity (where possible, that is, within CHARACTERS events, and attribute values). * Otherwise they are output as is. The main reason to enable this property is to ensure * that carriage returns are preserved as is through parsing, since otherwise they will be * converted to canonical XML linefeeds (\n), when occurring along or as part of \r\n pair. * This property is Woodstox specific.
        *
        */ public class StAXUtils { private static Log log = LogFactory.getLog(StAXUtils.class); private static boolean isDebugEnabled = log.isDebugEnabled(); // If isFactoryPerClassLoader is true (default), then // a separate singleton XMLInputFactory and XMLOutputFactory is maintained // for the each classloader. The different classloaders may be using different // implementations of STAX. // // If isFactoryPerClassLoader is false, then // a single XMLInputFactory and XMLOutputFactory is constructed using // the classloader that loaded StAXUtils. private static boolean isFactoryPerClassLoader = true; // These static singletons are used when the XML*Factory is created with // the StAXUtils classloader. private static final Map/**/ inputFactoryMap = Collections.synchronizedMap(new WeakHashMap()); private static final Map/**/ outputFactoryMap = Collections.synchronizedMap(new WeakHashMap()); // These maps are used for the isFactoryPerClassLoader==true case // The maps are synchronized and weak. private static final Map/*>*/ inputFactoryPerCLMap = Collections.synchronizedMap(new WeakHashMap()); private static final Map/*>*/ outputFactoryPerCLMap = Collections.synchronizedMap(new WeakHashMap()); /** * Get a cached {@link XMLInputFactory} instance using the default * configuration and cache policy (i.e. one instance per class loader). * * @return an {@link XMLInputFactory} instance. */ public static XMLInputFactory getXMLInputFactory() { return getXMLInputFactory(null, isFactoryPerClassLoader); } /** * Get a cached {@link XMLInputFactory} instance using the specified * configuration and the default cache policy. * * @param configuration * the configuration applied to the requested factory * @return an {@link XMLInputFactory} instance. */ public static XMLInputFactory getXMLInputFactory(StAXParserConfiguration configuration) { return getXMLInputFactory(configuration, isFactoryPerClassLoader); } /** * Get a cached {@link XMLInputFactory} instance using the default * configuration and the specified cache policy. * * @param factoryPerClassLoaderPolicy * the cache policy; see * {@link #getXMLInputFactory(StAXParserConfiguration, boolean)} * for more details * @return an {@link XMLInputFactory} instance. */ public static XMLInputFactory getXMLInputFactory(boolean factoryPerClassLoaderPolicy) { return getXMLInputFactory(null, factoryPerClassLoaderPolicy); } /** * Get a cached {@link XMLInputFactory} instance using the specified * configuration and cache policy. * * @param configuration * the configuration applied to the requested factory * @param factoryPerClassLoaderPolicy * If set to true, the factory cached for the * current class loader will be returned. If set to * false, the singleton factory (instantiated using * the class loader that loaded {@link StAXUtils}) will be * returned. * @return an {@link XMLInputFactory} instance. */ public static XMLInputFactory getXMLInputFactory(StAXParserConfiguration configuration, boolean factoryPerClassLoaderPolicy) { if (factoryPerClassLoaderPolicy) { return getXMLInputFactory_perClassLoader(configuration); } else { return getXMLInputFactory_singleton(configuration); } } /** * @deprecated * Returns an XMLInputFactory instance for reuse. * * @param factory An XMLInputFactory instance that is available for reuse */ public static void releaseXMLInputFactory(XMLInputFactory factory) { } public static XMLStreamReader createXMLStreamReader(InputStream in, String encoding) throws XMLStreamException { return createXMLStreamReader(null, in, encoding); } public static XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration, final InputStream in, final String encoding) throws XMLStreamException { final XMLInputFactory inputFactory = getXMLInputFactory(configuration); try { XMLStreamReader reader = (XMLStreamReader) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return inputFactory.createXMLStreamReader(in, encoding); } } ); if (isDebugEnabled) { log.debug("XMLStreamReader is " + reader.getClass().getName()); } return reader; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } public static XMLStreamReader createXMLStreamReader(InputStream in) throws XMLStreamException { return createXMLStreamReader(null, in); } public static XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration, final InputStream in) throws XMLStreamException { final XMLInputFactory inputFactory = getXMLInputFactory(configuration); try { XMLStreamReader reader = (XMLStreamReader) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return inputFactory.createXMLStreamReader(in); } } ); if (isDebugEnabled) { log.debug("XMLStreamReader is " + reader.getClass().getName()); } return reader; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } public static XMLStreamReader createXMLStreamReader(Reader in) throws XMLStreamException { return createXMLStreamReader(null, in); } public static XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration, final Reader in) throws XMLStreamException { final XMLInputFactory inputFactory = getXMLInputFactory(configuration); try { XMLStreamReader reader = (XMLStreamReader) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return inputFactory.createXMLStreamReader(in); } } ); if (isDebugEnabled) { log.debug("XMLStreamReader is " + reader.getClass().getName()); } return reader; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } /** * Get a cached {@link XMLOutputFactory} instance using the default * configuration and cache policy (i.e. one instance per class loader). * * @return an {@link XMLOutputFactory} instance. */ public static XMLOutputFactory getXMLOutputFactory() { return getXMLOutputFactory(null, isFactoryPerClassLoader); } /** * Get a cached {@link XMLOutputFactory} instance using the specified * configuration and the default cache policy. * * @param configuration * the configuration applied to the requested factory * @return an {@link XMLOutputFactory} instance. */ public static XMLOutputFactory getXMLOutputFactory(StAXWriterConfiguration configuration) { return getXMLOutputFactory(configuration, isFactoryPerClassLoader); } /** * Get a cached {@link XMLOutputFactory} instance using the default * configuration and the specified cache policy. * * @param factoryPerClassLoaderPolicy * the cache policy; see * {@link #getXMLOutputFactory(StAXWriterConfiguration, boolean)} * for more details * @return an {@link XMLOutputFactory} instance. */ public static XMLOutputFactory getXMLOutputFactory(boolean factoryPerClassLoaderPolicy) { return getXMLOutputFactory(null, factoryPerClassLoaderPolicy); } /** * Get a cached {@link XMLOutputFactory} instance using the specified * configuration and cache policy. * * @param configuration * the configuration applied to the requested factory * @param factoryPerClassLoaderPolicy * If set to true, the factory cached for the * current class loader will be returned. If set to * false, the singleton factory (instantiated using * the class loader that loaded {@link StAXUtils}) will be * returned. * @return an {@link XMLOutputFactory} instance. */ public static XMLOutputFactory getXMLOutputFactory(StAXWriterConfiguration configuration, boolean factoryPerClassLoaderPolicy) { if (factoryPerClassLoaderPolicy) { return getXMLOutputFactory_perClassLoader(configuration); } else { return getXMLOutputFactory_singleton(configuration); } } /** * Set the policy for how to maintain the XMLInputFactory and XMLOutputFactory * @param value (if false, then one singleton...if true...then singleton per class loader * (default is true) */ public static void setFactoryPerClassLoader(boolean value) { isFactoryPerClassLoader = value; } /** * @deprecated * Returns an XMLOutputFactory instance for reuse. * * @param factory An XMLOutputFactory instance that is available for reuse. */ public static void releaseXMLOutputFactory(XMLOutputFactory factory) { } public static XMLStreamWriter createXMLStreamWriter(OutputStream out) throws XMLStreamException { return createXMLStreamWriter(null, out); } public static XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration, final OutputStream out) throws XMLStreamException { final XMLOutputFactory outputFactory = getXMLOutputFactory(configuration); try { XMLStreamWriter writer = (XMLStreamWriter) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return outputFactory.createXMLStreamWriter(out, OMConstants.DEFAULT_CHAR_SET_ENCODING); } } ); if (isDebugEnabled) { log.debug("XMLStreamWriter is " + writer.getClass().getName()); } return writer; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding) throws XMLStreamException { return createXMLStreamWriter(null, out, encoding); } public static XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration, final OutputStream out, final String encoding) throws XMLStreamException { final XMLOutputFactory outputFactory = getXMLOutputFactory(configuration); try { XMLStreamWriter writer = (XMLStreamWriter) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return outputFactory.createXMLStreamWriter(out, encoding); } } ); if (isDebugEnabled) { log.debug("XMLStreamWriter is " + writer.getClass().getName()); } return writer; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } public static XMLStreamWriter createXMLStreamWriter(final Writer out) throws XMLStreamException { return createXMLStreamWriter(null, out); } public static XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration, final Writer out) throws XMLStreamException { final XMLOutputFactory outputFactory = getXMLOutputFactory(configuration); try { XMLStreamWriter writer = (XMLStreamWriter) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws XMLStreamException { return outputFactory.createXMLStreamWriter(out); } } ); if (isDebugEnabled) { log.debug("XMLStreamWriter is " + writer.getClass().getName()); } return writer; } catch (PrivilegedActionException pae) { throw (XMLStreamException) pae.getException(); } } /** * @deprecated */ public static void reset() { } /** * Load factory properties from a resource. The context class loader is used to locate * the resource. The method converts boolean and integer values to the right Java types. * All other values are returned as strings. * * @param name * @return */ // This has package access since it is used from within anonymous inner classes static Map loadFactoryProperties(String name) { ClassLoader cl = getContextClassLoader(); InputStream in = cl.getResourceAsStream(name); if (in == null) { return null; } else { try { Properties rawProps = new Properties(); Map props = new HashMap(); rawProps.load(in); for (Iterator it = rawProps.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); String strValue = (String)entry.getValue(); Object value; if (strValue.equals("true")) { value = Boolean.TRUE; } else if (strValue.equals("false")) { value = Boolean.FALSE; } else { try { value = Integer.valueOf(strValue); } catch (NumberFormatException ex) { value = strValue; } } props.put(entry.getKey(), value); } if (log.isDebugEnabled()) { log.debug("Loaded factory properties from " + name + ": " + props); } return props; } catch (IOException ex) { log.error("Failed to read " + name, ex); return null; } finally { try { in.close(); } catch (IOException ex) { // Ignore } } } } private static XMLInputFactory newXMLInputFactory(final ClassLoader classLoader, final StAXParserConfiguration configuration) { return (XMLInputFactory)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader savedClassLoader; if (classLoader == null) { savedClassLoader = null; } else { savedClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); } try { XMLInputFactory factory = XMLInputFactory.newInstance(); // Woodstox by default creates coalescing parsers. Even if this violates // the StAX specs, for compatibility with Woodstox, we always enable the // coalescing mode. Note that we need to do that before loading // XMLInputFactory.properties so that this setting can be overridden. factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE); Map props = loadFactoryProperties("XMLInputFactory.properties"); if (props != null) { for (Iterator it = props.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); factory.setProperty((String)entry.getKey(), entry.getValue()); } } StAXDialect dialect = StAXDialectDetector.getDialect(factory.getClass()); if (configuration != null) { factory = configuration.configure(factory, dialect); } return new ImmutableXMLInputFactory(dialect.normalize( dialect.makeThreadSafe(factory))); } finally { if (savedClassLoader != null) { Thread.currentThread().setContextClassLoader(savedClassLoader); } } } }); } /** * @return XMLInputFactory for the current classloader */ private static XMLInputFactory getXMLInputFactory_perClassLoader(StAXParserConfiguration configuration) { ClassLoader cl = getContextClassLoader(); XMLInputFactory factory; if (cl == null) { factory = getXMLInputFactory_singleton(configuration); } else { // Check the cache if (configuration == null) { configuration = StAXParserConfiguration.DEFAULT; } Map map = (Map)inputFactoryPerCLMap.get(configuration); if (map == null) { map = Collections.synchronizedMap(new WeakHashMap()); inputFactoryPerCLMap.put(configuration, map); factory = null; } else { factory = (XMLInputFactory)map.get(cl); } // If not found in the cache map, crate a new factory if (factory == null) { if (log.isDebugEnabled()) { log.debug("About to create XMLInputFactory implementation with " + "classloader=" + cl); log.debug("The classloader for javax.xml.stream.XMLInputFactory is: " + XMLInputFactory.class.getClassLoader()); } try { factory = newXMLInputFactory(null, configuration); } catch (ClassCastException cce) { if (log.isDebugEnabled()) { log.debug("Failed creation of XMLInputFactory implementation with " + "classloader=" + cl); log.debug("Exception is=" + cce); log.debug("Attempting with classloader: " + XMLInputFactory.class.getClassLoader()); } factory = newXMLInputFactory(XMLInputFactory.class.getClassLoader(), configuration); } if (factory != null) { // Cache the new factory map.put(cl, factory); if (log.isDebugEnabled()) { log.debug("Created XMLInputFactory = " + factory.getClass() + " with classloader=" + cl); log.debug("Configuration = " + configuration); log.debug("Size of XMLInputFactory map for this configuration = " + map.size()); log.debug("Configurations for which factories have been cached = " + inputFactoryPerCLMap.keySet()); } } else { factory = getXMLInputFactory_singleton(configuration); } } } return factory; } /** * @return singleton XMLInputFactory loaded with the StAXUtils classloader */ private static XMLInputFactory getXMLInputFactory_singleton(StAXParserConfiguration configuration) { if (configuration == null) { configuration = StAXParserConfiguration.DEFAULT; } XMLInputFactory f = (XMLInputFactory)inputFactoryMap.get(configuration); if (f == null) { f = newXMLInputFactory(StAXUtils.class.getClassLoader(), configuration); inputFactoryMap.put(configuration, f); if (log.isDebugEnabled()) { if (f != null) { log.debug("Created singleton XMLInputFactory " + f.getClass() + " with configuration " + configuration); } } } return f; } private static XMLOutputFactory newXMLOutputFactory(final ClassLoader classLoader, final StAXWriterConfiguration configuration) { return (XMLOutputFactory)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader savedClassLoader; if (classLoader == null) { savedClassLoader = null; } else { savedClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); } try { XMLOutputFactory factory = XMLOutputFactory.newInstance(); factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE); Map props = loadFactoryProperties("XMLOutputFactory.properties"); if (props != null) { for (Iterator it = props.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); factory.setProperty((String)entry.getKey(), entry.getValue()); } } StAXDialect dialect = StAXDialectDetector.getDialect(factory.getClass()); if (configuration != null) { factory = configuration.configure(factory, dialect); } return new ImmutableXMLOutputFactory(dialect.normalize( dialect.makeThreadSafe(factory))); } finally { if (savedClassLoader != null) { Thread.currentThread().setContextClassLoader(savedClassLoader); } } } }); } /** * @return XMLOutputFactory for the current classloader */ private static XMLOutputFactory getXMLOutputFactory_perClassLoader(StAXWriterConfiguration configuration) { ClassLoader cl = getContextClassLoader(); XMLOutputFactory factory; if (cl == null) { factory = getXMLOutputFactory_singleton(configuration); } else { if (configuration == null) { configuration = StAXWriterConfiguration.DEFAULT; } Map map = (Map)outputFactoryPerCLMap.get(configuration); if (map == null) { map = Collections.synchronizedMap(new WeakHashMap()); outputFactoryPerCLMap.put(configuration, map); factory = null; } else { factory = (XMLOutputFactory)map.get(cl); } if (factory == null) { if (log.isDebugEnabled()) { log.debug("About to create XMLOutputFactory implementation with " + "classloader=" + cl); log.debug("The classloader for javax.xml.stream.XMLOutputFactory is: " + XMLOutputFactory.class.getClassLoader()); } try { factory = newXMLOutputFactory(null, configuration); } catch (ClassCastException cce) { if (log.isDebugEnabled()) { log.debug("Failed creation of XMLOutputFactory implementation with " + "classloader=" + cl); log.debug("Exception is=" + cce); log.debug("Attempting with classloader: " + XMLOutputFactory.class.getClassLoader()); } factory = newXMLOutputFactory(XMLOutputFactory.class.getClassLoader(), configuration); } if (factory != null) { map.put(cl, factory); if (log.isDebugEnabled()) { log.debug("Created XMLOutputFactory = " + factory.getClass() + " for classloader=" + cl); log.debug("Configuration = " + configuration); log.debug("Size of XMLOutFactory map for this configuration = " + map.size()); log.debug("Configurations for which factories have been cached = " + outputFactoryPerCLMap.keySet()); } } else { factory = getXMLOutputFactory_singleton(configuration); } } } return factory; } /** * @return XMLOutputFactory singleton loaded with the StAXUtils classloader */ private static XMLOutputFactory getXMLOutputFactory_singleton(StAXWriterConfiguration configuration) { if (configuration == null) { configuration = StAXWriterConfiguration.DEFAULT; } XMLOutputFactory f = (XMLOutputFactory)outputFactoryMap.get(configuration); if (f == null) { f = newXMLOutputFactory(StAXUtils.class.getClassLoader(), configuration); outputFactoryMap.put(configuration, f); if (log.isDebugEnabled()) { if (f != null) { log.debug("Created singleton XMLOutputFactory " + f.getClass() + " with configuration " + configuration); } } } return f; } /** * @return Trhead Context ClassLoader */ private static ClassLoader getContextClassLoader() { ClassLoader cl = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Thread.currentThread().getContextClassLoader(); } } ); return cl; } /** * @deprecated use {@link #createXMLStreamReader(StAXParserConfiguration, InputStream, String)} * with {@link StAXParserConfiguration#STANDALONE} */ public static XMLStreamReader createNetworkDetachedXMLStreamReader(InputStream in, String encoding) throws XMLStreamException { return createXMLStreamReader(StAXParserConfiguration.STANDALONE, in, encoding); } /** * @deprecated use {@link #getXMLInputFactory(StAXParserConfiguration)} with * {@link StAXParserConfiguration#STANDALONE} */ public static XMLInputFactory getNetworkDetachedXMLInputFactory() { return getXMLInputFactory(StAXParserConfiguration.STANDALONE); } /** * @deprecated use {@link #createXMLStreamReader(StAXParserConfiguration, InputStream)} * with {@link StAXParserConfiguration#STANDALONE} */ public static XMLStreamReader createNetworkDetachedXMLStreamReader(InputStream in) throws XMLStreamException { return createXMLStreamReader(StAXParserConfiguration.STANDALONE, in); } /** * @deprecated use {@link #createXMLStreamReader(StAXParserConfiguration, Reader)} * with {@link StAXParserConfiguration#STANDALONE} */ public static XMLStreamReader createNetworkDetachedXMLStreamReader(Reader in) throws XMLStreamException { return createXMLStreamReader(StAXParserConfiguration.STANDALONE, in); } /** * @deprecated Use {@link XMLEventUtils#getEventTypeString(int)} instead */ public static String getEventTypeString(int event) { return XMLEventUtils.getEventTypeString(event); } } ./src/org/apache/axiom/om/util/ElementHelper.java0000664000175000017500000002607111767656530021113 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.ds.ByteArrayDataSource; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeaderBlock; import org.apache.axiom.util.stax.XMLStreamReaderUtils; import org.apache.axiom.util.stax.xop.XOPUtils; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.Writer; import java.util.Iterator; /** * Helper class to provide extra utility stuff against elements. The code is designed to work with * any element implementation. */ public class ElementHelper { private OMElement element; /** * Constructs and binds to an element. * * @param element element to work with */ public ElementHelper(OMElement element) { this.element = element; } /** * @deprecated The algorithm used by this method is incorrect. See AXIOM-356 for more * details. */ public QName resolveQName(String qname, boolean defaultToParentNameSpace) { int colon = qname.indexOf(':'); if (colon < 0) { if (defaultToParentNameSpace) { //get the parent ns and use it for the child OMNamespace namespace = element.getNamespace(); if (namespace != null) { // Guard against QName implementation sillyness. if (namespace.getPrefix() == null) return new QName(namespace.getNamespaceURI(), qname); else return new QName(namespace.getNamespaceURI(), qname, namespace.getPrefix()); } } //else things without no prefix are local. return new QName(qname); } String prefix = qname.substring(0, colon); String local = qname.substring(colon + 1); if (local.length() == 0) { //empy local, exit accordingly return null; } OMNamespace namespace = element.findNamespaceURI(prefix); if (namespace == null) { return null; } return new QName(namespace.getNamespaceURI(), local, prefix); } /** * @deprecated The algorithm used by this method is incorrect. See AXIOM-356 for more * details. */ public QName resolveQName(String qname) { return resolveQName(qname, true); } public static void setNewElement(OMElement parent, OMElement myElement, OMElement newElement) { if (myElement != null) { myElement.discard(); } parent.addChild(newElement); } /** * @deprecated please use OMElement.getFirstChildWithName(qname) instead! */ public static OMElement getChildWithName(OMElement parent, String childName) { Iterator childrenIter = parent.getChildren(); while (childrenIter.hasNext()) { OMNode node = (OMNode) childrenIter.next(); if (node.getType() == OMNode.ELEMENT_NODE && childName.equals(((OMElement) node).getLocalName())) { return (OMElement) node; } } return null; } /** * @deprecated use {@link #getContentID(XMLStreamReader)} instead (see WSCOMMONS-429) */ public static String getContentID(XMLStreamReader parser, String charsetEncoding) { return getContentID(parser); } public static String getContentID(XMLStreamReader parser) { if (parser.getAttributeCount() > 0 && parser.getAttributeLocalName(0).equals("href")) { return getContentIDFromHref(parser.getAttributeValue(0)); } else { throw new OMException( "Href attribute not found in XOP:Include element"); } } /** * Extract the content ID from a href attribute value, i.e. from a URI following the * cid: scheme defined by RFC2392. * * @param href the value of the href attribute * @return the corresponding content ID */ public static String getContentIDFromHref(String href) { return XOPUtils.getContentIDFromURL(href); } /** * Some times two OMElements needs to be added to the same object tree. But in Axiom, a single * tree should always contain object created from the same type of factory (eg: * LinkedListImplFactory, DOMFactory, etc.,). If one OMElement is created from a different * factory than that of the factory which was used to create the object in the existing tree, we * need to convert the new OMElement to match to the factory of existing object tree. This * method will convert omElement to the given omFactory. * * @see AttributeHelper#importOMAttribute(OMAttribute, OMElement) to convert instances of * OMAttribute */ public static OMElement importOMElement(OMElement omElement, OMFactory omFactory) { // first check whether the given OMElement has the same omFactory if (omElement.getOMFactory().getClass().isInstance(omFactory)) { return omElement; } else { OMElement documentElement = new StAXOMBuilder(omFactory, omElement.getXMLStreamReader()) .getDocumentElement(); documentElement.build(); return documentElement; } } /** * This is a method to convert regular OMElements to SOAPHeaderBlocks. * * @param omElement * @param factory * @return TODO * @throws Exception */ public static SOAPHeaderBlock toSOAPHeaderBlock(OMElement omElement, SOAPFactory factory) throws Exception { if (omElement instanceof SOAPHeaderBlock) return (SOAPHeaderBlock) omElement; QName name = omElement.getQName(); String localName = name.getLocalPart(); OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); omElement.serialize(baos); ByteArrayDataSource bads = new ByteArrayDataSource(baos.toByteArray(), "utf-8"); SOAPHeaderBlock block = factory.createSOAPHeaderBlock(localName, namespace, bads); return block; } /** * Returns a stream representing the concatenation of the text nodes that are children of a * given element. * The stream returned by this method produces exactly the same character sequence as the * the stream created by the following expression: *
        new StringReader(element.getText())
        * The difference is that the stream implementation returned by this method is guaranteed * to have constant memory usage and is optimized for performance. * * @param element the element to read the text nodes from * @param cache whether to enable caching when accessing the element * @return a stream representing the concatenation of the text nodes * * @see OMElement#getText() */ public static Reader getTextAsStream(OMElement element, boolean cache) { // If the element is not an OMSourcedElement and has not more than one child, then the most // efficient way to get the Reader is to build a StringReader if (!(element instanceof OMSourcedElement) && (!cache || element.isComplete())) { OMNode child = element.getFirstOMChild(); if (child == null) { return new StringReader(""); } else if (child.getNextOMSibling() == null) { return new StringReader(child instanceof OMText ? ((OMText)child).getText() : ""); } } // In all other cases, extract the data from the XMLStreamReader try { XMLStreamReader reader = element.getXMLStreamReader(cache); if (reader.getEventType() == XMLStreamReader.START_DOCUMENT) { reader.next(); } return XMLStreamReaderUtils.getElementTextAsStream(reader, true); } catch (XMLStreamException ex) { throw new OMException(ex); } } /** * Write the content of the text nodes that are children of a given element to a * {@link Writer}. * If cache is true, this method has the same effect as the following instruction: *
        out.write(element.getText())
        * The difference is that this method is guaranteed to have constant memory usage and is * optimized for performance. * * @param element the element to read the text nodes from * @param out the stream to write the content to * @param cache whether to enable caching when accessing the element * @throws XMLStreamException if an error occurs when reading from the element * @throws IOException if an error occurs when writing to the stream * * @see OMElement#getText() */ public static void writeTextTo(OMElement element, Writer out, boolean cache) throws XMLStreamException, IOException { XMLStreamReader reader = element.getXMLStreamReader(cache); int depth = 0; while (reader.hasNext()) { switch (reader.next()) { case XMLStreamReader.CHARACTERS: case XMLStreamReader.CDATA: if (depth == 1) { out.write(reader.getText()); } break; case XMLStreamReader.START_ELEMENT: depth++; break; case XMLStreamReader.END_ELEMENT: depth--; } } } } ./src/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java0000664000175000017500000001415011767656530025017 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This is an XMLStreamWriterFilter that removes illegal characters. * * Valid and invalid character ranges are defined by: * http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char * * */ public class XMLStreamWriterRemoveIllegalChars extends XMLStreamWriterFilterBase { private static Log log = LogFactory.getLog(XMLStreamWriterRemoveIllegalChars.class); public XMLStreamWriterRemoveIllegalChars() { super(); if (log.isDebugEnabled()) { log.debug("Creating XMLStreamWriterRemoveIllegalChars object " + this); } } // Characters less than 0x20 may be control characters and should be removed // Note the non-initialized bytes in this array are zero private static byte[] REMOVE = new byte[32]; static { REMOVE[0x00] = 1; REMOVE[0x01] = 1; REMOVE[0x02] = 1; REMOVE[0x03] = 1; REMOVE[0x04] = 1; REMOVE[0x05] = 1; REMOVE[0x06] = 1; REMOVE[0x07] = 1; REMOVE[0x08] = 1; // 0x09 is TAB...which is allowed // 0x0A is LINEFEED...which is allowed REMOVE[0x0B] = 1; REMOVE[0x0C] = 1; // 0x0D is CARRIAGE RETURN, which is allowed REMOVE[0x0E] = 1; REMOVE[0x0F] = 1; REMOVE[0x10] = 1; REMOVE[0x11] = 1; REMOVE[0x12] = 1; REMOVE[0x13] = 1; REMOVE[0x14] = 1; REMOVE[0x15] = 1; REMOVE[0x16] = 1; REMOVE[0x17] = 1; REMOVE[0x18] = 1; REMOVE[0x19] = 1; REMOVE[0x1A] = 1; REMOVE[0x1B] = 1; REMOVE[0x1C] = 1; REMOVE[0x1D] = 1; REMOVE[0x1E] = 1; REMOVE[0x1F] = 1; } // These two characters are not allowed private final int FFFE = 0xFFFE; private final char FFFF = 0xFFFF; // Characters in the surrogate range are not allowed // (unless the result is a valid supplemental character) private final char SURROGATE_START = 0xD800; private final char SURROGATE_END = 0xDFFF; /* (non-Javadoc) * @see org.apache.axiom.om.util.XMLStreamWriterFilterBase#xmlData(java.lang.String) */ protected String xmlData(String value) { char[] buffer = null; int len = value.length(); int srcI = 0; int tgtI = 0; int copyLength = 0; int i = 0; // Traverse all of the characters in the input String (value) while (i < len) { // Get the codepoint of the character at the index // Note that the code point may be two characters long (a supplemental character) int cp = value.codePointAt(i); if (cp > FFFF) { // Supplemental Character...Increase index by 2 // Increase the length of good characters to copy by 2 i = i+2; copyLength = copyLength+2; } else { // See if the character is invalid if ((cp < 0x20 && (REMOVE[cp] > 0)) || // Control Character (cp >= SURROGATE_START && cp <= SURROGATE_END ) || // Bad surrogate (cp == FFFF || cp == FFFE)) { // or illegal character // Flow to here indicates that the character is not allowed. // The good characters (up to this point) are copied into the buffer. // Note that the buffer is initialized with the original characters. // Thus the buffer copy is always done on the same buffer (saving // both time and space). // Make the buffer on demand if (buffer == null) { if (log.isDebugEnabled()) { log.debug("One or more illegal characterss found. Codepoint=" + cp); } buffer = value.toCharArray(); } // Copy the good characters into the buffer System.arraycopy(buffer, srcI, buffer, tgtI, copyLength); tgtI = tgtI + copyLength; // Update the target location in the array srcI = i + 1; // Skip over the current character copyLength = 0; // reset new copy length } else { // Valid character, increase copy length copyLength = copyLength+1; } // Single bit16 character, increase index by 1 i = i+1; } } if (buffer == null) { // Normal case, no illegal characters removed..No buffer return value; } else { // Move the final valid characters to the buffer // and return a string representing the value System.arraycopy(buffer, srcI, buffer, tgtI, copyLength); String newValue = new String(buffer, 0, tgtI + copyLength); return newValue; } } } ./src/org/apache/axiom/om/util/Base64.java0000664000175000017500000000164511767656530017406 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.util.base64.Base64Utils; public class Base64 extends Base64Utils { } ./src/org/apache/axiom/om/util/XMLStreamWriterFilter.java0000664000175000017500000000264211767656530022537 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import javax.xml.stream.XMLStreamWriter; /** * An interface used to identify a filter class for an XMLStreamWriter * The filter receives XMLStreamWriter events (and can change or log them). * The filter then sends the events to the delegate XMLStreamWriter * @see XMLStreamWriterFilterBase */ public interface XMLStreamWriterFilter extends XMLStreamWriter { /** * Set a new delegate writer * @param writer */ public void setDelegate(XMLStreamWriter writer); /** * @return XMLStreamWriter delegate */ public XMLStreamWriter getDelegate(); } ./src/org/apache/axiom/om/util/DigestGenerator.java0000664000175000017500000003164711767656530021455 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMText; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.SortedMap; import java.util.TreeMap; /** * Helper class to provide the functionality of the digest value generation. This is an * implementation of the DOMHASH algorithm on OM. */ public class DigestGenerator { /** * This method is an overloaded method for the digest generation for OMDocument * * @param document * @param digestAlgorithm * @return Returns a byte array representing the calculated digest */ public byte[] getDigest(OMDocument document, String digestAlgorithm) throws OMException { byte[] digest = new byte[0]; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeInt(9); Collection childNodes = getValidElements(document); dos.writeInt(childNodes.size()); Iterator itr = childNodes.iterator(); while (itr.hasNext()) { OMNode node = (OMNode) itr.next(); if (node.getType() == OMNode.PI_NODE) dos.write(getDigest((OMProcessingInstruction) node, digestAlgorithm)); else if ( node.getType() == OMNode.ELEMENT_NODE) dos.write(getDigest((OMElement) node, digestAlgorithm)); } dos.close(); md.update(baos.toByteArray()); digest = md.digest(); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } catch (IOException e) { throw new OMException(e); } return digest; } /** * This method is an overloaded method for the digest generation for OMNode * * @param node * @param digestAlgorithm * @return Returns a byte array representing the calculated digest value */ public byte[] getDigest(OMNode node, String digestAlgorithm) { if (node.getType() == OMNode.ELEMENT_NODE) return getDigest((OMElement) node, digestAlgorithm); else if ( node.getType() == OMNode.TEXT_NODE) return getDigest((OMText) node, digestAlgorithm); else if (node.getType() == OMNode.PI_NODE) return getDigest((OMProcessingInstruction) node, digestAlgorithm); else return new byte[0]; } /** * This method is an overloaded method for the digest generation for OMElement * * @param element * @param digestAlgorithm * @return Returns a byte array representing the calculated digest value */ public byte[] getDigest(OMElement element, String digestAlgorithm) throws OMException { byte[] digest = new byte[0]; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeInt(1); dos.write(getExpandedName(element).getBytes("UnicodeBigUnmarked")); dos.write((byte) 0); dos.write((byte) 0); Collection attrs = getAttributesWithoutNS(element); dos.writeInt(attrs.size()); Iterator itr = attrs.iterator(); while (itr.hasNext()) dos.write(getDigest((OMAttribute) itr.next(), digestAlgorithm)); OMNode node = element.getFirstOMChild(); // adjoining Texts are merged, // there is no 0-length Text, and // comment nodes are removed. int length = 0; itr = element.getChildElements(); while (itr.hasNext()) { length++; itr.next(); } dos.writeInt(length); while (node != null) { dos.write(getDigest(node, digestAlgorithm)); node = node.getNextOMSibling(); } dos.close(); md.update(baos.toByteArray()); digest = md.digest(); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } catch (IOException e) { throw new OMException(e); } return digest; } /** * This method is an overloaded method for the digest generation for OMProcessingInstruction * * @param pi * @param digestAlgorithm * @return Returns a byte array representing the calculated digest value */ public byte[] getDigest(OMProcessingInstruction pi, String digestAlgorithm) throws OMException { byte[] digest = new byte[0]; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update((byte) 0); md.update((byte) 0); md.update((byte) 0); md.update((byte) 7); md.update(pi.getTarget().getBytes("UnicodeBigUnmarked")); md.update((byte) 0); md.update((byte) 0); md.update(pi.getValue().getBytes("UnicodeBigUnmarked")); digest = md.digest(); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } catch (UnsupportedEncodingException e) { throw new OMException(e); } return digest; } /** * This method is an overloaded method for the digest generation for OMAttribute * * @param attribute * @param digestAlgorithm * @return Returns a byte array representing the calculated digest value */ public byte[] getDigest(OMAttribute attribute, String digestAlgorithm) throws OMException { byte[] digest = new byte[0]; if (!(attribute.getLocalName().equals("xmlns") || attribute.getLocalName().startsWith("xmlns:"))) try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update((byte) 0); md.update((byte) 0); md.update((byte) 0); md.update((byte) 2); md.update(getExpandedName(attribute).getBytes("UnicodeBigUnmarked")); md.update((byte) 0); md.update((byte) 0); md.update(attribute.getAttributeValue().getBytes("UnicodeBigUnmarked")); digest = md.digest(); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } catch (UnsupportedEncodingException e) { throw new OMException(e); } return digest; } /** * This method is an overloaded method for the digest generation for OMText * * @param text * @param digestAlgorithm * @return Returns a byte array representing the calculated digest value */ public byte[] getDigest(OMText text, String digestAlgorithm) throws OMException { byte[] digest = new byte[0]; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update((byte) 0); md.update((byte) 0); md.update((byte) 0); md.update((byte) 3); md.update(text.getText().getBytes("UnicodeBigUnmarked")); digest = md.digest(); } catch (NoSuchAlgorithmException e) { throw new OMException(e); } catch (UnsupportedEncodingException e) { throw new OMException(e); } return digest; } /** * This method is an overloaded method for getting the expanded name namespaceURI followed by * the local name for OMElement * * @param element * @return Returns the expanded name of OMElement */ public String getExpandedName(OMElement element) { return element.getNamespace().getNamespaceURI() + ":" + element.getLocalName(); } /** * This method is an overloaded method for getting the expanded name namespaceURI followed by * the local name for OMAttribute * * @param attribute * @return Returns the expanded name of the OMAttribute */ public String getExpandedName(OMAttribute attribute) { return attribute.getNamespace().getNamespaceURI() + ":" + attribute.getLocalName(); } /** * Gets the collection of attributes which are none namespace declarations for an OMElement * * @param element * @return Returns the collection of attributes which are none namespace declarations */ public Collection getAttributesWithoutNS(OMElement element) { SortedMap map = new TreeMap(); Iterator itr = element.getAllAttributes(); while (itr.hasNext()) { OMAttribute attribute = (OMAttribute) itr.next(); if (!(attribute.getLocalName().equals("xmlns") || attribute.getLocalName().startsWith("xmlns:"))) map.put(getExpandedName(attribute), attribute); } return map.values(); } /** * Gets the valid element collection of an OMDocument. OMElement and OMProcessingInstruction * only * * @param document * @return Returns a collection of OMProcessingInstructions and OMElements */ public Collection getValidElements(OMDocument document) { ArrayList list = new ArrayList(); Iterator itr = document.getChildren(); while (itr.hasNext()) { OMNode node = (OMNode) itr.next(); if (node.getType() == OMNode.ELEMENT_NODE || node.getType() == OMNode.PI_NODE) list.add(node); } return list; } /** * Gets the String representation of the byte array * * @param array * @return Returns the String of the byte */ public String getStringRepresentation(byte[] array) { String str = ""; for (int i = 0; i < array.length; i++) str += array[i]; return str; } /** * Compares two OMNodes for the XML equality * * @param node * @param comparingNode * @param digestAlgorithm * @return Returns true if the OMNode XML contents are equal */ public boolean compareOMNode(OMNode node, OMNode comparingNode, String digestAlgorithm) { return Arrays.equals(getDigest(node, digestAlgorithm), getDigest(comparingNode, digestAlgorithm)); } /** * Compares two OMDocuments for the XML equality * * @param document * @param comparingDocument * @param digestAlgorithm * @return Returns true if the OMDocument XML content are equal */ public boolean compareOMDocument(OMDocument document, OMDocument comparingDocument, String digestAlgorithm) { return Arrays.equals(getDigest(document, digestAlgorithm), getDigest(comparingDocument, digestAlgorithm)); } /** * Compares two OMAttributes for the XML equality * * @param attribute * @param comparingAttribute * @param digestAlgorithm * @return Returns true if the OMDocument XML content are equal */ public boolean compareOMAttribute(OMAttribute attribute, OMAttribute comparingAttribute, String digestAlgorithm) { return Arrays.equals(getDigest(attribute, digestAlgorithm), getDigest(comparingAttribute, digestAlgorithm)); } /** String representing the MD5 digest algorithm */ public static final String md5DigestAlgorithm = "MD5"; /** String representing the SHA digest algorithm */ public static final String shaDigestAlgorithm = "SHA"; /** String representing the SHA1 digest algorithm */ public static final String sha1DigestAlgorithm = "SHA1"; } ./src/org/apache/axiom/om/util/TextHelper.java0000664000175000017500000001762111767656530020447 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataHandler; import javax.mail.MessagingException; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.attachments.lifecycle.LifecycleManager; import org.apache.axiom.attachments.lifecycle.impl.FileAccessor; import org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.axiom.util.base64.Base64Utils; public class TextHelper { private static int DEFAULT_FILE_THRESHOLD = 100 * 1024; private static String DEFAULT_ATTACHMENT_DIR = "axiomTmp"; private static int DELETE_TIME = 60 * 60; // 1 Hour /** * @param inStream InputStream * @return Base64 encoded string representint the data in inStream * @throws IOException */ public static String toString(InputStream inStream) throws IOException { StringBuffer buffer = new StringBuffer(); toStringBuffer(inStream, buffer); return buffer.toString(); } /** * Append Base64 encoding of the data in the inStream to the specified buffer * @param inStream InputStream * @param buffer Buffer * @throws IOException */ public static void toStringBuffer(InputStream inStream, StringBuffer buffer) throws IOException { int avail = inStream.available(); // The Base64 will increase the size by 1.33 + some additional // space at the data byte[] boundaries. So a factor of 1.35 is used // to ensure capacity. if (avail > 0) { buffer.ensureCapacity((int) (avail* 1.35) + buffer.length()); } // The size of the buffer must be a multiple of 3. Otherwise usage of the // stateless Base64 class would produce filler characters inside the Base64 // encoded text. byte[] data = new byte[1023]; boolean eos = false; do { int len = 0; do { // Always fill the buffer entirely (unless the end of the stream has // been reached); see above. int read = inStream.read(data, len, data.length-len); if (read == -1) { eos = true; break; } len += read; } while (len < data.length); Base64Utils.encode(data, 0, len, buffer); } while (!eos); } /** * Append data in the omText to the specified buffer * @param omText the text node to get the character data from * @param buffer Buffer * @throws IOException */ public static void toStringBuffer(OMText omText, StringBuffer buffer) throws IOException { // If an InputStream is present, stream the BASE64 text to the StreamBuffer if (omText.isOptimized()) { Object dh = omText.getDataHandler(); if (dh instanceof DataHandler) { InputStream is = ((DataHandler) dh).getInputStream(); if (is != null) { toStringBuffer(is, buffer); return; } } } // Otherwise append the text buffer.append(omText.getText()); return; } /** * Create an OMText node from a byte array containing binary data * If the byte array is large and the optimize flag is set, then * the data is stored in a temp file to reduce in-core memory * @param b * @param off * @param length * @param factory * @param isOptimize */ public static OMText toOMText(byte[] b, int off, int length, OMFactory factory, boolean isOptimize) throws IOException, MessagingException { String attachmentDir = getAttachmentDir(factory); return toOMText(b, off, length, factory, isOptimize, attachmentDir); } /** * Create an OMText node from a byte array containing binary data * If the byte array is large and the optimize flag is set, then * the data is stored in a temp file to reduce in-core memory * @param b * @param off * @param length * @param factory * @param isOptimize * @param attachmentDir */ public static OMText toOMText(byte[] b, int off, int length, OMFactory factory, boolean isOptimize, String attachmentDir) throws IOException, MessagingException { OMText omText = null; if (isOptimize) { LifecycleManager lm = getLifecycleManager(factory); int threshold = getThreshold(factory); // TODO Consider lowering the threshold in low memory situations ? //threshold = lm.getRuntimeThreshold(threshold); if (length >= threshold && attachmentDir != null) { // Get the file accessor FileAccessor fileAccessor = lm.create(attachmentDir); OutputStream fos = fileAccessor.getOutputStream(); //Copy the bytes into the file ByteArrayInputStream is = new ByteArrayInputStream(b, off, length); BufferUtils.inputStream2OutputStream(is, fos); fos.close(); // Delete this temp file on exit lm.deleteOnExit(fileAccessor.getFile()); lm.deleteOnTimeInterval(DELETE_TIME, fileAccessor.getFile()); // Create the OMText node from the datahandler DataHandler dh = fileAccessor.getDataHandler(null); omText = factory.createOMText(dh, isOptimize); } } if (omText == null) { omText = factory.createOMText(Base64Utils.encode(b, off, length)); omText.setOptimize(isOptimize); } return omText; } private static LifecycleManager getLifecycleManager(OMFactory factory) { LifecycleManager lm = null; /* TODO Support access to lifecycle manager from the factory if (factory.getProperty(LIFECYCLE_MANAGER)) { ... } */ if (lm == null) { return new LifecycleManagerImpl(); } return lm; } private static int getThreshold(OMFactory factory) { int threshold = DEFAULT_FILE_THRESHOLD; /* TODO Support access to threshold from the factory if (factory.getProperty(FILE_THRESHOLD)) { ... } */ return threshold; } private static String getAttachmentDir(OMFactory factory) { String attachmentDir = DEFAULT_ATTACHMENT_DIR; /* TODO Support access to threshold from the factory if (factory.getProperty(FILE_THRESHOLD)) { ... } */ return attachmentDir; } } ./src/org/apache/axiom/om/util/StAXParserConfiguration.java0000664000175000017500000001426011767656530023103 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.util; import java.io.ByteArrayInputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLResolver; import javax.xml.stream.XMLStreamException; import org.apache.axiom.util.stax.dialect.StAXDialect; import org.apache.axiom.util.stax.dialect.StAXDialectDetector; /** * Defines a particular StAX parser configuration. An implementation of this * interface must satisfy the following requirements: *
          *
        1. It MUST be immutable. *
        2. It MUST either be a singleton or properly implement * {@link Object#equals(Object)} and {@link Object#hashCode()}. *
        * These two requirements ensure that instances of this interface may be used as * cache keys. * * @see StAXWriterConfiguration */ public interface StAXParserConfiguration { /** * The default configuration. */ StAXParserConfiguration DEFAULT = new StAXParserConfiguration() { public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) { return factory; } public String toString() { return "DEFAULT"; } }; /** * Configuration that forces the parser to process the XML document as * standalone. In this configuration, the parser will ignore any references * to external entities, in particular DTDs. This is especially useful to * process documents referencing DTDs with system IDs that are network * locations, because parsing these documents would otherwise fail on nodes * detached from the network. This configuration should be used with care * because the resulting representation of the document may be incomplete. * E.g. default attribute values defined in the DTD will not be reported. */ StAXParserConfiguration STANDALONE = new StAXParserConfiguration() { public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) { factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); // Some StAX parser such as Woodstox still try to load the external DTD subset, // even if IS_SUPPORTING_EXTERNAL_ENTITIES is set to false. To work around this, // we add a custom XMLResolver that returns empty documents. See WSTX-117 for // an interesting discussion about this. factory.setXMLResolver(new XMLResolver() { public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException { return new ByteArrayInputStream(new byte[0]); } }); return factory; } public String toString() { return "STANDALONE"; } }; /** * Configuration that sets up the parser in non coalescing mode. */ StAXParserConfiguration NON_COALESCING = new StAXParserConfiguration() { public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) { factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); return factory; } public String toString() { return "NON_COALESCING"; } }; /** * Configuration that sets up the parser to preserve CDATA sections. This configuration will * also put the parser in non coalescing mode. */ StAXParserConfiguration PRESERVE_CDATA_SECTIONS = new StAXParserConfiguration() { public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) { return dialect.enableCDataReporting(factory); } public String toString() { return "PRESERVE_CDATA_SECTIONS"; } }; /** * Configuration suitable for SOAP messages. This will configure the parser * to throw an exception when it encounters a document type declaration. The * SOAP 1.1 specification indeed prescribes that * "A SOAP message MUST NOT contain a Document Type Declaration." The * difference between the {@link #STANDALONE} configuration and this * configuration is that with {@link #STANDALONE}, the parser silently * ignores references to external entities but doesn't throw any exception. * * @see StAXDialect#disallowDoctypeDecl(XMLInputFactory) */ StAXParserConfiguration SOAP = new StAXParserConfiguration() { public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) { return dialect.disallowDoctypeDecl(factory); } public String toString() { return "SOAP"; } }; /** * Apply the configuration to the given factory. The method MAY optionally * wrap the factory, e.g. to modify the behavior of the * {@link javax.xml.stream.XMLStreamReader} instances created by the * factory. * * @param factory * the factory to configure * @param dialect * The dialect of the StAX implementation as detected by * {@link StAXDialectDetector}. The implementation may use this * information to configure implementation specific settings. * @return The configured factory. This may be the original factory (if the * implementation only changes the factory properties), or a * wrapper. */ XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect); } ./src/org/apache/axiom/om/OMException.java0000664000175000017500000000300211767656530017564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Class OMException */ public class OMException extends RuntimeException { private static final long serialVersionUID = -730218408325095333L; /** Constructor OMException */ public OMException() { } /** * Constructor OMException * * @param message */ public OMException(String message) { super(message); } /** * Constructor OMException * * @param message * @param cause */ public OMException(String message, Throwable cause) { super(message, cause); } /** * Constructor OMException * * @param cause */ public OMException(Throwable cause) { super(cause); } } ./src/org/apache/axiom/om/OMDataSource.java0000664000175000017500000000547311767656530017676 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.OutputStream; import java.io.Writer; /** * Interface to arbitrary source of XML element data. This provides the hook for using a general * data source (such as data binding frameworks) as the backing source of data for an element. */ public interface OMDataSource { /** * Serializes element data directly to stream. * * @param output destination stream for element XML text * @param format Output format information. The implementation must use this information * to choose the correct character set encoding when writing to the * output stream. This parameter must not be null. * @throws XMLStreamException */ void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes element data directly to writer. * * @param writer destination writer for element XML text * @param format output format information (null if none; may be ignored if not * supported by data binding even if supplied) * @throws XMLStreamException */ void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * Serializes element data directly to StAX writer. * * @param xmlWriter destination writer * @throws XMLStreamException */ // TODO: specify whether the implementation MUST, MAY or MUST NOT write START_DOCUMENT and END_DOCUMENT events to the stream void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException; /** * Get parser for element data. In the general case this may require the data source to * serialize data as XML text and then parse that text. * * @return element parser * @throws XMLStreamException */ XMLStreamReader getReader() throws XMLStreamException; } ./src/org/apache/axiom/om/OMAbstractFactory.java0000664000175000017500000002044111767656530020727 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.axiom.soap.SOAPFactory; /** * Provides default instances for object model and meta factories. *

        * The {@link #getMetaFactory()} method returns the default {@link OMMetaFactory} instance. * See the Javadoc of the {@link #getMetaFactory()} method for details about how this * instance is determined. *

        * The {@link #getOMFactory()}, {@link #getSOAP11Factory()} and {@link #getSOAP12Factory()} * methods return default instances for plain XML, SOAP 1.1 and SOAP 1.2 object model factories. * They are convenience methods calling {@link #getMetaFactory()} and then delegating to the * returned {@link OMMetaFactory}. *

        * Note that while {@link #getMetaFactory()} always returns the same instance, the other methods * may return new instances on every invocation, depending on the {@link OMMetaFactory} * implementation. *

        */ public class OMAbstractFactory { public static final String META_FACTORY_NAME_PROPERTY = "org.apache.axiom.om.OMMetaFactory"; private static final String DEFAULT_META_FACTORY_CLASS_NAME = "org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory"; /** * The default {@link OMMetaFactory} instance determined by the system * property {@link #META_FACTORY_NAME_PROPERTY}, or if no such system * property is set, by the value of the * {@link #DEFAULT_META_FACTORY_CLASS_NAME} constant. */ private static OMMetaFactory defaultMetaFactory; /** * The {@link OMMetaFactory} set through * {@link #setMetaFactory(OMMetaFactory)}. If this is null, * then {@link #defaultMetaFactory} will be returned by * {@link #getMetaFactory()}. */ private static OMMetaFactory metaFactory; private OMAbstractFactory() {} /** * Explicitly set a meta factory instance. The new instance will be returned * by all subsequent calls to {@link #getMetaFactory()}. Note that this is * an application wide setting. More precisely, the configured meta factory * will be used by all classes loaded from the class loader where Axiom is * deployed and all its child class loaders. Therefore this method should be * used with care and only be invoked during the initialization of the * application. *

        * When Axiom is deployed as a bundle in an OSGi environment, this method * will be used to inject the meta factory instance from the implementation * bundle. * * @param newMetaFactory * the new meta factory instance, or null to revert * to the default meta factory instance determined by the * org.apache.axiom.om.OMMetaFactory system property */ public static void setMetaFactory(OMMetaFactory newMetaFactory) { metaFactory = newMetaFactory; } /** * Get the default meta factory instance. This method uses the following ordered lookup * procedure to determine the default instance: *

          *
        1. If an instance has been set using {@link #setMetaFactory(OMMetaFactory)}, then that * instance is returned. Note that this will be the case in an OSGi runtime, where * {@link #setMetaFactory(OMMetaFactory)} is invoked by a helper component that is part of * Axiom. *
        2. Use the org.apache.axiom.om.OMMetaFactory system property. This method uses * {@link System#getProperty(String)} to determine the value of the system property. A * {@link SecurityException} thrown by this method is simply ignored and the lookup procedure * continues. *
        3. Use the JDK 1.3 service discovery mechanism to determine the classname of the meta * factory. The method will look for a classname in the file * META-INF/services/org.apache.axiom.om.OMMetaFactory in jars in the class path. *
        4. Return the meta factory for the LLOM implementation is returned. *
        * * @return the default OM factory instance * @throws OMException * if the factory's implementation class can't be found or if the class can't be * instantiated */ public static OMMetaFactory getMetaFactory() { if (metaFactory != null) { return metaFactory; } if (defaultMetaFactory != null) { return defaultMetaFactory; } String metaFactoryClassName = null; // First try system property try { metaFactoryClassName = System.getProperty(META_FACTORY_NAME_PROPERTY); if ("".equals(metaFactoryClassName)) { metaFactoryClassName = null; } } catch (SecurityException e) { // Ignore and continue } // Next use JDK 1.3 service discovery if (metaFactoryClassName == null) { try { InputStream in = OMAbstractFactory.class.getResourceAsStream("/META-INF/services/" + OMMetaFactory.class.getName()); if (in != null) { try { BufferedReader r = new BufferedReader(new InputStreamReader(in)); String line; while ((line = r.readLine()) != null) { line = line.trim(); if (line.length() > 0 && !line.startsWith("#")) { metaFactoryClassName = line; break; } } } finally { in.close(); } } } catch (IOException ex) { // Ignore and continue } } // Default to LLOM if (metaFactoryClassName == null) { metaFactoryClassName = DEFAULT_META_FACTORY_CLASS_NAME; } try { defaultMetaFactory = (OMMetaFactory) Class.forName(metaFactoryClassName).newInstance(); } catch (InstantiationException e) { throw new OMException(e); } catch (IllegalAccessException e) { throw new OMException(e); } catch (ClassNotFoundException e) { throw new OMException(e); } return defaultMetaFactory; } /** * Get the default OM factory instance. * * @return the default OM factory instance * @throws OMException if the factory's implementation class can't be found * or if the class can't be instantiated */ public static OMFactory getOMFactory() { return getMetaFactory().getOMFactory(); } /** * Get the default SOAP 1.1 OM factory instance. * * @return the default SOAP 1.1 OM factory instance * @throws OMException if the factory's implementation class can't be found * or if the class can't be instantiated */ public static SOAPFactory getSOAP11Factory() { return getMetaFactory().getSOAP11Factory(); } /** * Get the default SOAP 1.2 OM factory instance. * * @return the default SOAP 1.2 OM factory instance * @throws OMException if the factory's implementation class can't be found * or if the class can't be instantiated */ public static SOAPFactory getSOAP12Factory() { return getMetaFactory().getSOAP12Factory(); } } ./src/org/apache/axiom/om/ds/0000775000175000017500000000000011767656530015142 5ustar brianbrian./src/org/apache/axiom/om/ds/InputStreamDataSource.java0000664000175000017500000001575111767656530022244 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Iterator; /** * InputStream is an example OMDataSourceExt. * Use it to insert a (InputStream, encoding) into an OM Tree. * This data source is useful for placing an InputStream into an OM * tree, instead of having a deeply nested tree. */ public class InputStreamDataSource extends OMDataSourceExtBase { Data data = null; private static final int BUFFER_LEN = 4096; /** * Constructor * @param is * @param encoding */ public InputStreamDataSource(InputStream is, String encoding) { data = new Data(); data.is = is; data.encoding = encoding; } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } String encoding = format.getCharSetEncoding(); try { if (!data.encoding.equalsIgnoreCase(encoding)) { byte[] bytes = getXMLBytes(encoding); output.write(bytes); } else { // Write the input stream to the output stream inputStream2OutputStream(data.is, output); } } catch (UnsupportedEncodingException e) { throw new XMLStreamException(e); } catch (IOException e) { throw new XMLStreamException(e); } } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } super.serialize(xmlWriter); } public XMLStreamReader getReader() throws XMLStreamException { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return StAXUtils.createXMLStreamReader(data.is,data.encoding); } public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException{ if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return data.is; } public Object getObject() { return data; } public boolean isDestructiveRead() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return true; } public boolean isDestructiveWrite() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } // Writing an input stream is destructive return true; } public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { // Return the byte array directly if it is the same encoding // Otherwise convert the bytes to the proper encoding ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); try { serialize(baos, format); } catch (XMLStreamException e) { throw new OMException(e); } return baos.toByteArray(); } public void close() { if (data.is != null) { try { data.is.close(); } catch (IOException e) { throw new OMException(e); } data.is = null; } } /** * Return a InputStreamDataSource backed by a ByteArrayInputStream */ public OMDataSourceExt copy() { byte[] bytes; try { bytes = getXMLBytes(data.encoding); } catch (UnsupportedEncodingException e) { throw new OMException(e); } InputStream is1 = new ByteArrayInputStream(bytes); InputStream is2 = new ByteArrayInputStream(bytes); data.is = is1; return new InputStreamDataSource(is2, data.encoding); } /** * Private utility to write the InputStream contents to the OutputStream. * @param is * @param os * @throws IOException */ private static void inputStream2OutputStream(InputStream is, OutputStream os) throws IOException { byte[] buffer = new byte[BUFFER_LEN]; int bytesRead = is.read(buffer); while (bytesRead > 0) { os.write(buffer, 0, bytesRead); bytesRead = is.read(buffer); } } /** * Simple utility that takes an XMLStreamReader and writes it * to an XMLStreamWriter * @param reader * @param writer * @throws XMLStreamException */ private static void reader2writer(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { StAXOMBuilder builder = new StAXOMBuilder(reader); builder.releaseParserOnClose(true); try { OMDocument omDocument = builder.getDocument(); Iterator it = omDocument.getChildren(); while (it.hasNext()) { OMNode omNode = (OMNode) it.next(); omNode.serializeAndConsume(writer); } } finally { builder.close(); } } /** * Object containing the InputStream/encoding pair */ public class Data { public String encoding; public InputStream is; } } ./src/org/apache/axiom/om/ds/Behavior.java0000664000175000017500000000426011767656530017546 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; public class Behavior { // An OMDataSource must communicate whether the data source is // can be queried without destruction. OM makes decisions about // caching (etc) based on whether the data source query is // destructive or not destructive. // // The Behavior flag indicates the Behavior of this OMDataSource // DESTRUCTIVE: // Indicates that the backing data can only be read one time. // AFFECT ON OM: // The OM tree will automatically make a OM cache of the // the tree // // NOT_DESTRUCTIVE // Indicates that the data may be queried multiple times. // The InputStream's data is either copied or marks are used to // allow the data to be read again. // AFFECT ON OM: // The OM tree will not automatically make a OM cache of the tree. // // ONE_USE_UNSAFE: // Indicates that the data may be queried only one time. The // second query will cause an immediate failure. This is an unsafe // mode because it violates the OM contract. The implementation of // this mode is done by lying to the OM model. We tell it that the // data is not destructive, and yet we don't make a copy. // public static final int DESTRUCTIVE = 0; public static final int NOT_DESTRUCTIVE = 1; public static final int ONE_USE_UNSAFE = 2; } ./src/org/apache/axiom/om/ds/OMDataSourceExtBase.java0000664000175000017500000001467511767656530021564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.HashMap; import java.util.Iterator; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * OMDataSourceExtBase is a convenient base class that can be extended * by other OMDataSourceExt implementations. */ public abstract class OMDataSourceExtBase implements OMDataSourceExt { private static final Log log = LogFactory.getLog(OMDataSourceExtBase.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); HashMap map = null; // Map of properties public Object getProperty(String key) { if (map == null) { return null; } return map.get(key); } public Object setProperty(String key, Object value) { if (map == null) { map = new HashMap(); } return map.put(key, value); } public boolean hasProperty(String key) { if (map == null) { return false; } return map.containsKey(key); } public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException{ if (DEBUG_ENABLED) { log.debug("getXMLInputStream encoding="+encoding); } return new ByteArrayInputStream(getXMLBytes(encoding)); } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { if (DEBUG_ENABLED) { log.debug("serialize output="+output+" format="+format); } try { // Write bytes to the output stream output.write(getXMLBytes(format.getCharSetEncoding())); } catch (IOException e) { throw new XMLStreamException(e); } } public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { if (DEBUG_ENABLED) { log.debug("serialize writer="+writer+" format="+format); } try { // Convert the bytes into a String and write it to the Writer String text = new String(getXMLBytes(format.getCharSetEncoding())); writer.write(text); } catch (UnsupportedEncodingException e) { throw new XMLStreamException(e); } catch (IOException e) { throw new XMLStreamException(e); } } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { if (DEBUG_ENABLED) { log.debug("serialize xmlWriter="+xmlWriter); } // Some XMLStreamWriters (e.g. MTOMXMLStreamWriter) // provide direct access to the OutputStream. // This allows faster writing. OutputStream os = getOutputStream(xmlWriter); if (os != null) { if (DEBUG_ENABLED) { log.debug("serialize OutputStream optimisation: true"); } String encoding = getCharacterEncoding(xmlWriter); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); serialize(os, format); } else { if (DEBUG_ENABLED) { log.debug("serialize OutputStream optimisation: false"); } // Read the bytes into a reader and // write to the writer. XMLStreamReader xmlReader = getReader(); reader2writer(xmlReader, xmlWriter); } } /** * Simple utility that takes an XMLStreamReader and writes it * to an XMLStreamWriter * @param reader * @param writer * @throws XMLStreamException */ private static void reader2writer(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { StAXOMBuilder builder = new StAXOMBuilder(reader); builder.releaseParserOnClose(true); try { OMDocument omDocument = builder.getDocument(); Iterator it = omDocument.getChildren(); while (it.hasNext()) { // TODO: this is extremely inefficient since next() will actually build the node! OMNode omNode = (OMNode) it.next(); // TODO: quick fix required because OMChildrenIterator#next() no longer builds the node omNode.getNextOMSibling(); omNode.serializeAndConsume(writer); } } finally { builder.close(); } } /** * Some XMLStreamWriters expose an OutputStream that can be * accessed directly. * @return OutputStream or null */ private static OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException { if (writer instanceof MTOMXMLStreamWriter) { return ((MTOMXMLStreamWriter) writer).getOutputStream(); } return null; } /** * Get the character set encoding of the XMLStreamWriter * @return String or null */ private static String getCharacterEncoding(XMLStreamWriter writer) { if (writer instanceof MTOMXMLStreamWriter) { return ((MTOMXMLStreamWriter) writer).getCharSetEncoding(); } return null; } } ./src/org/apache/axiom/om/ds/ParserInputStreamDataSource.java0000664000175000017500000003741711767656530023424 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.attachments.impl.BufferUtils; import org.apache.axiom.attachments.utils.BAAInputStream; import org.apache.axiom.attachments.utils.BAAOutputStream; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.ds.OMDataSourceExtBase; import org.apache.axiom.om.util.CommonUtils; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A DataSource that is backed by an InputStream (read from a parser). * The Data in this Data source owns the payload inputStream. */ public class ParserInputStreamDataSource extends OMDataSourceExtBase { private static final Log log = LogFactory.getLog(ParserInputStreamDataSource.class); // This is the backing storage. // The "data" object contains an InputStream that contains the actual bytes. // Copying/Marking of the InputStream is controlled by the requested Behavior. private Data data = null; // This behavior provides both safety and performance private final static int defaultBehavior = Behavior.NOT_DESTRUCTIVE; /** * This is the constructor that is normally called. * * Note that the ParserInputStreamDataSource takes ownership of the * payload InputStream. It may copy, mark or reset the stream. * Callers should not access the stream after this constructor is called * * @param payload InputStream * @param encoding */ public ParserInputStreamDataSource(InputStream payload, String encoding) { this(payload, encoding, defaultBehavior ); } /** * This constructor is used to test the different Behavior settings. * * Note that the ParserInputStreamDataSource takes ownership of the * payload InputStream. It may copy, mark or reset the stream. * Callers should not access the stream after this constructor is called. * * @param payload * @param encoding * @param behavior */ public ParserInputStreamDataSource(InputStream payload, String encoding, int behavior) { data = new Data(payload, (encoding!=null)?encoding:"UTF-8", behavior); } public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { if(log.isDebugEnabled()){ log.debug("Entry ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat"); } String encoding = (format!=null)?format.getCharSetEncoding():null; try { if (!data.encoding.equalsIgnoreCase(encoding)) { byte[] bytes = getXMLBytes(encoding); output.write(bytes); } else { // Write the input stream to the output stream InputStream is = data.readParserInputStream(); if(is!=null){ BufferUtils.inputStream2OutputStream(is, output); } } if(log.isDebugEnabled()){ log.debug("Exit ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat"); } } catch (UnsupportedEncodingException e) { throw new XMLStreamException(e); } catch (IOException e) { throw new XMLStreamException(e); } } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { if(log.isDebugEnabled()){ log.debug("Entry ParserInputStreamDataSource.serialize(XMLStreamWriter)"); } super.serialize(xmlWriter); if(log.isDebugEnabled()){ log.debug("Exit ParserInputStreamDataSource.serialize(XMLStreamWriter)"); } } public XMLStreamReader getReader() throws XMLStreamException { if(log.isDebugEnabled()){ log.debug("Entry ParserInputStreamDataSource.getReader()"); } InputStream is = data.readParserInputStream(); if(is == null){ //Parser content has already been read. if(log.isDebugEnabled()){ log.warn("Parser content has already been read"); } } XMLStreamReader reader = StAXUtils.createXMLStreamReader(is, data.encoding); if(log.isDebugEnabled()){ log.debug("Exit ParserInputStreamDataSource.getReader()"); } return reader; } /* * Note that the returned InputStream may be different than the one * passed in the constructor. * The caller may not used the mark or reset methods on the InputStream * (non-Javadoc) * @see org.apache.axiom.om.ds.OMDataSourceExtBase#getXMLInputStream(java.lang.String) */ public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException { try{ return data.readParserInputStream(); }catch(XMLStreamException e){ throw new OMException(e); } } public int numReads() { return data.numReads; } public Object getObject() { return data; } public boolean isDestructiveRead() { // If DESTRUCTIVE return true // If NOT_DESTRUCTIVE return false // If ONE_USE_UNSAFE, we lie and tell the engine false // ...but we will intentionally fail on second access. return (data.behavior == Behavior.DESTRUCTIVE); } public boolean isDestructiveWrite() { // If DESTRUCTIVE return true // If NOT_DESTRUCTIVE return false // If ONE_USE_UNSAFE, we lie and tell the engine false // ...but we will intentionally fail on second access. return (data.behavior == Behavior.DESTRUCTIVE); } public byte[] getXMLBytes(String encoding){ if(log.isDebugEnabled()){ log.debug("Entry ParserInputStreamDataSource.getXMLBytes(encoding)"); } try{ InputStream is = data.readParserInputStream(); if(is != null){ ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); try { BufferUtils.inputStream2OutputStream(is, baos); if(log.isDebugEnabled()){ log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)"); } return baos.toByteArray(); } catch (IOException e) { throw new OMException(e); } }else{ //Someone already read the parser, happens in serialize call. I expect user to invoke this //via SerializeAndConsume call if(log.isDebugEnabled()){ log.warn("Parser was already read, recovering by just returning new byte[0]"); log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)"); } return new byte[0]; } }catch(XMLStreamException e){ throw new OMException(e); } } public void close() { if(log.isDebugEnabled()){ log.debug("Entry ParserInputStreamDataSource.close()"); } if (data.payload != null) { try { data.payload.close(); } catch (IOException e) { throw new OMException(e); } data.payload = null; } if(log.isDebugEnabled()){ log.debug("Exit ParserInputStreamDataSource.close()"); } } /** * Return a InputStreamDataSource backed by a ByteArrayInputStream */ public OMDataSourceExt copy() { if(log.isDebugEnabled()){ log.debug("Enter ParserInputStreamDataSource.copy()"); } try { BAAOutputStream baaos = new BAAOutputStream(); BufferUtils.inputStream2OutputStream(data.readParserInputStream(), baaos); BAAInputStream baais = new BAAInputStream(baaos.buffers(), baaos.length()); if (log.isDebugEnabled()) { log.debug("Exit ParserInputStreamDataSource.copy()"); } return new ParserInputStreamDataSource(baais, data.encoding, data.behavior); } catch (Throwable t) { if(log.isDebugEnabled()){ log.debug("Error ParserInputStreamDataSource.copy(): ", t); } throw new OMException(t); } } /** * @author scheu * */ public class Data{ // The InputStream containing the byte data private InputStream payload = null; // The encoding (i.e. UTF-8) private String encoding = null; // The designated Behavior. @see Behavior private int behavior; // Track the number of read accesses. // ONE_USE_UNSAFE will intentionally fail on second read. private int numReads = 0; // Track the first use when ONE_USE_UNSAFE is requested private String firstUseStack = null; /** * Intentionally provide. Only created by ParserInputStreamDataSource * @param payload * @param encoding * @param behavior */ private Data(InputStream payload, String encoding, int behavior) { this.payload = payload; this.encoding = encoding; this.behavior = behavior; setInputStream(payload); } /** * @return InputStream that consumer should use..this may be different * than the InputStream initially handed to the ParsedDataEntitySource * @throws XMLStreamException * @throws OMException if second access and ONE_USE_UNSAFE or other problems occur */ public InputStream readParserInputStream() throws XMLStreamException{ numReads++; // Dump our state if(log.isDebugEnabled()){ log.debug("Entry readParserInputStream()"); log.debug("Data Encoding = "+encoding); log.debug("numReads = "+numReads); log.debug("behavior = "+behavior); // The call stack is helpful to identify non-performant call flows String stack = CommonUtils.stackToString(new OMException()); log.debug("call stack:" + stack); } // TODO NLS if(payload == null){ throw new OMException("ParserInputStreamDataSource's InputStream is null."); } if (behavior == Behavior.NOT_DESTRUCTIVE) { if (numReads > 1) { try { // For NOT_DESTRUCTIVE, the // InputStream (either the original or copied InputStream) // is reset for reuse. if(log.isDebugEnabled()){ log.debug("reset InputStream for reuse"); } payload.reset(); } catch (Throwable t) { throw new OMException(t); } } } else if (behavior == Behavior.ONE_USE_UNSAFE) { // For ONE_USE_UNSAFE, // remember the first call // intentionally fail on the second call if (numReads == 1) { firstUseStack = CommonUtils.stackToString(new OMException()); if(log.isDebugEnabled()){ log.debug("ONE_USE_UNSAFE mode stack:" + firstUseStack); } } else { // TODO NLS OMException ome = new OMException("A second read of ParserInputStreamDataSource is not allowed." + "The first read was done here: " + firstUseStack); if(log.isDebugEnabled()){ log.debug("ONE_USE_UNSAFE second use exception:" + ome); } throw ome; } } if(log.isDebugEnabled()){ log.debug("Exit readParserInputStream()"); } return payload; } public void setInputStream(InputStream inputStream) { if(log.isDebugEnabled()){ String clsName = inputStream == null ? null : inputStream.getClass().getName(); log.debug("Enter setInputStream: The kind of InputStream is:" + clsName); } this.numReads = 0; this.firstUseStack = null; if (inputStream == null) { if(log.isDebugEnabled()){ log.debug("The inputStream is null"); } payload = null; } else if (behavior == Behavior.NOT_DESTRUCTIVE) { if (inputStream.markSupported()) { if(log.isDebugEnabled()){ log.debug("The inputStream supports mark(). Setting mark()"); } // use mark/reset payload = inputStream; payload.mark(Integer.MAX_VALUE); } else { try { if(log.isDebugEnabled()){ log.debug("The inputStream does not supports mark(). Copying Stream"); } // make a non-contiguous resettable input stream BAAOutputStream baaos = new BAAOutputStream(); BufferUtils.inputStream2OutputStream(inputStream, baaos); BAAInputStream baais = new BAAInputStream(baaos.buffers(), baaos.length()); payload = baais; payload.mark(Integer.MAX_VALUE); } catch (Throwable t) { if(log.isDebugEnabled()){ log.debug("Error:", t); } throw new OMException(t); } } } else { payload = inputStream; } if(log.isDebugEnabled()){ log.debug("Exit setInputStream"); } } } } ./src/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java0000664000175000017500000000633611767656530025250 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import java.io.IOException; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.io.Writer; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.util.stax.WrappedTextNodeStreamReader; /** * {@link org.apache.axiom.om.OMDataSource} implementation that represents a text node wrapped * inside an element. The text data is provided by a {@link Reader} object. Since the stream * can only be read once, this data source is destructive. */ public class WrappedTextNodeOMDataSourceFromReader extends OMDataSourceExtBase { private final QName wrapperElementName; private final Reader reader; public WrappedTextNodeOMDataSourceFromReader(QName wrapperElementName, Reader reader) { this.wrapperElementName = wrapperElementName; this.reader = reader; } public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); xmlWriter.setOutputFormat(format); serialize(xmlWriter); xmlWriter.flush(); } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { StreamingOMSerializer serializer = new StreamingOMSerializer(); serializer.serialize(getReader(), xmlWriter); } public XMLStreamReader getReader() throws XMLStreamException { return new WrappedTextNodeStreamReader(wrapperElementName, reader); } public Object getObject() { return null; } public boolean isDestructiveRead() { return true; } public boolean isDestructiveWrite() { return true; } public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { throw new UnsupportedOperationException(); } public void close() { try { reader.close(); } catch (IOException ex) { // Ignore } } public OMDataSourceExt copy() { throw new UnsupportedOperationException(); } } ./src/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java0000664000175000017500000000744111767656530026076 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.nio.charset.Charset; import javax.activation.DataSource; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.util.stax.WrappedTextNodeStreamReader; /** * {@link org.apache.axiom.om.OMDataSource} implementation that represents a text node wrapped * inside an element. The text data is provided by a {@link DataSource} object. */ public class WrappedTextNodeOMDataSourceFromDataSource extends OMDataSourceExtBase { private final QName wrapperElementName; private final DataSource binaryData; private final Charset charset; public WrappedTextNodeOMDataSourceFromDataSource(QName wrapperElementName, DataSource binaryData, Charset charset) { this.wrapperElementName = wrapperElementName; this.binaryData = binaryData; this.charset = charset; } public void serialize(OutputStream out, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter writer = new MTOMXMLStreamWriter(out, format); serialize(writer); writer.flush(); } public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); xmlWriter.setOutputFormat(format); serialize(xmlWriter); xmlWriter.flush(); } public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { StreamingOMSerializer serializer = new StreamingOMSerializer(); serializer.serialize(getReader(), xmlWriter); } public XMLStreamReader getReader() throws XMLStreamException { InputStream is; try { is = binaryData.getInputStream(); } catch (IOException ex) { throw new XMLStreamException(ex); } return new WrappedTextNodeStreamReader(wrapperElementName, new InputStreamReader(is, charset)); } public Object getObject() { return binaryData; } public boolean isDestructiveRead() { return false; } public boolean isDestructiveWrite() { return false; } public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { throw new UnsupportedOperationException(); } public void close() { } public OMDataSourceExt copy() { return new WrappedTextNodeOMDataSourceFromDataSource(wrapperElementName, binaryData, charset); } } ./src/org/apache/axiom/om/ds/package.html0000664000175000017500000000164311767656530017427 0ustar brianbrian Contains ready to use {@link org.apache.axiom.om.OMDataSource} implementations. ./src/org/apache/axiom/om/ds/custombuilder/0000775000175000017500000000000011767656530020023 5ustar brianbrian./src/org/apache/axiom/om/ds/custombuilder/ByteArrayCustomBuilder.java0000664000175000017500000000766411767656530025307 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds.custombuilder; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMException; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.ds.ByteArrayDataSource; import org.apache.axiom.om.impl.builder.CustomBuilder; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayOutputStream; /** * CustomBuilder that creates an OMSourcedElement backed by a ByteArrayDataSource. * If you have a payload or header that will consume a lot of space, it * may be beneficial to plug in this CustomBuilder. * * Use this CustomBuilder as a pattern for other CustomBuilders. */ public class ByteArrayCustomBuilder implements CustomBuilder { private String encoding = null; /** * Constructor * @param encoding */ public ByteArrayCustomBuilder(String encoding) { this.encoding = (encoding == null) ? "utf-8" :encoding; } /* * Create an OMSourcedElement back by a ByteArrayDataSource */ public OMElement create(String namespace, String localPart, OMContainer parent, XMLStreamReader reader, OMFactory factory) throws OMException { try { // Get the prefix of the start tag String prefix = reader.getPrefix(); // Stream the events to a writer starting with the current event StreamingOMSerializer ser = new StreamingOMSerializer(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(baos, encoding); ser.serialize(reader, writer, false); writer.flush(); // Capture the written byte array as a ByteArrayDataSource byte[] bytes = baos.toByteArray(); String text = new String(bytes, "utf-8"); ByteArrayDataSource ds = new ByteArrayDataSource(bytes, encoding); // Create an OMSourcedElement backed by the ByteArrayDataSource OMNamespace ns = factory.createOMNamespace(namespace, prefix); OMElement om = null; if (parent instanceof SOAPHeader && factory instanceof SOAPFactory) { om = ((SOAPFactory)factory).createSOAPHeaderBlock(localPart, ns, ds); } else { om = factory.createOMElement(ds, localPart, ns); } // Add the new OMSourcedElement ot the parent parent.addChild(om); return om; } catch (XMLStreamException e) { throw new OMException(e); } catch (OMException e) { throw e; } catch (Throwable t) { throw new OMException(t); } } } ./src/org/apache/axiom/om/ds/ByteArrayDataSource.java0000664000175000017500000000737411767656530021675 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.StAXUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; /** * ByteArrayDataSource is an example implementation of OMDataSourceExt. * Use it to insert a (byte[], encoding) into an OM Tree. * This data source is useful for placing bytes into an OM * tree, instead of having a deeply nested tree. */ public class ByteArrayDataSource extends OMDataSourceExtBase { private static final Log log = LogFactory.getLog(ByteArrayDataSource.class); private static boolean DEBUG_ENABLED = log.isDebugEnabled(); ByteArray byteArray = null; /** * Constructor * @param bytes * @param encoding */ public ByteArrayDataSource(byte[] bytes, String encoding) { byteArray = new ByteArray(); byteArray.bytes = bytes; byteArray.encoding = encoding; } public XMLStreamReader getReader() throws XMLStreamException { if (DEBUG_ENABLED) { log.debug("getReader"); } return StAXUtils.createXMLStreamReader(new ByteArrayInputStream(byteArray.bytes), byteArray.encoding); } public Object getObject() { return byteArray; } public boolean isDestructiveRead() { // Reading bytes is not destructive return false; } public boolean isDestructiveWrite() { // Writing bytes is not destructive return false; } public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { if (encoding == null) { encoding = OMOutputFormat.DEFAULT_CHAR_SET_ENCODING; } if (DEBUG_ENABLED) { log.debug("getXMLBytes encoding="+encoding); } // Return the byte array directly if it is the same encoding // Otherwise convert the bytes to the proper encoding if (!byteArray.encoding.equalsIgnoreCase(encoding)) { String text = new String(byteArray.bytes, byteArray.encoding); // Convert the internal data structure to the new bytes/encoding byteArray.bytes = text.getBytes(encoding); byteArray.encoding = encoding; } return byteArray.bytes; } public void close() { byteArray = null; } public OMDataSourceExt copy() { // Return shallow copy return new ByteArrayDataSource(byteArray.bytes, byteArray.encoding); } /** * Object containing the byte[]/encoding pair */ public class ByteArray { public byte[] bytes; public String encoding; } } ./src/org/apache/axiom/om/ds/CharArrayDataSource.java0000664000175000017500000000554111767656530021641 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.ds; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; import org.apache.axiom.om.util.StAXUtils; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.CharArrayReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.io.Writer; /** * CharArrayDataSource is an example implementation of OMDataSourceExt. * Use it to insert a char[] into an OM Tree. * This data source is useful for placing characters into an OM * tree, instead of having a deeply nested tree. */ public class CharArrayDataSource extends OMDataSourceExtBase { char[] chars = null; /** * Constructor * @param chars */ public CharArrayDataSource(char[] chars) { this.chars = chars; } public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { try { writer.write(chars); } catch (UnsupportedEncodingException e) { throw new XMLStreamException(e); } catch (IOException e) { throw new XMLStreamException(e); } } public XMLStreamReader getReader() throws XMLStreamException { CharArrayReader reader = new CharArrayReader(chars); return StAXUtils.createXMLStreamReader(reader); } public Object getObject() { return chars; } public boolean isDestructiveRead() { // Reading chars is not destructive return false; } public boolean isDestructiveWrite() { // Writing chars is not destructive return false; } public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { String text = new String(chars); return text.getBytes(encoding); } public void close() { chars = null; } public OMDataSourceExt copy() { // Return shallow copy return new CharArrayDataSource(chars); } } ./src/org/apache/axiom/om/OMElement.java0000664000175000017500000005075311767656530017236 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.io.OutputStream; import java.io.Writer; import java.util.Iterator; /** * A particular kind of node that represents an element infoset information item. *

        * An element has a collection of children, attributes, and namespace declarations. In contrast with * DOM, this interface exposes namespace declarations separately from the attributes. *

        * Namespace declarations are either added explicitly using * {@link #declareNamespace(String, String)}, {@link #declareDefaultNamespace(String)} or * {@link #declareNamespace(OMNamespace)}, or are created implicitly as side effect of other method * calls: *

          *
        • If the element is created with a namespace and no matching namespace declaration is in scope * in the location in the tree where the element is created, then an appropriate namespace * declaration will be automatically added to the newly created element. The exact rules depend on * the method chosen to create the element; see for example {@link OMFactory#createOMElement(QName)}. *
        • If an attribute with a namespace is added, but no matching namespace declaration is in scope * in the element, one is automatically added. See {@link #addAttribute(OMAttribute)} for more * details. *
        * Thus, creating a new element or adding an attribute preserves the consistency of the object model * with respect to namespaces. However, Axiom does not enforce namespace well-formedness for all * possible operations on the object model. E.g. moving an element from one location in the tree to * another one may cause the object model to loose its namespace well-formedness. In that case it is * possible that the object model contains elements or attributes with namespaces for which no * corresponding namespace declarations are in scope. *

        * Fortunately, loosing namespace well-formedness has only very limited impact: *

          *
        • If namespace well-formedness is lost, the string to {@link QName} resolution for attribute * values and element content may be inconsistent, i.e. {@link #resolveQName(String)}, * {@link #getTextAsQName()} and {@link OMText#getTextAsQName()} may return incorrect results. * However, it should be noted that these methods are most relevant for object model instances that * have been loaded from existing documents or messages. These object models are guaranteed to be * well-formed with respect to namespaces (unless they have been modified after loading). *
        • During serialization, Axiom will automatically repair any namespace inconsistencies. It will * add necessary namespace declarations to the output document where they are missing in the object * model and generate modified namespace declarations where the original ones in the object model * are inconsistent. It will also omit redundant namespace declarations. Axiom guarantees that in * the output document, every element and attribute (and {@link OMText} instance with a * {@link QName} value) will have the same namespace URI as in the object model, thus preserving the * intended semantics of the document. On the other hand, the namespace prefixes used in the output * document may differ from the ones in the object model. *
        • More precisely, Axiom will always make sure that any {@link OMElement} or {@link OMAttribute} * node will keep the namespace URI that has been assigned to the node at creation time, unless the * namespace is explicitly changed using {@link #setNamespace(OMNamespace)} or * {@link OMAttribute#setOMNamespace(OMNamespace)}. [TODO: this is currently not entirely true; see * WSCOMMONS-517] *
        */ public interface OMElement extends OMNode, OMContainer { /** * Returns a filtered list of children - just the elements. * * @return Returns an iterator over the child elements. * @see #getChildren() * @see #getChildrenWithName(javax.xml.namespace.QName) */ Iterator getChildElements(); /** * Creates a namespace in the current element scope. * * @param uri The namespace to declare in the current scope. The caller is expected to * ensure that the URI is a valid namespace name. * @param prefix The prefix to associate with the given namespace. The caller is expected to * ensure that this is a valid XML prefix. If "" is given, first this will check * for an existing namespace with the same uri. If not found, a prefix will be * auto-generated. * @return Returns the created namespace information item. * @see #declareNamespace(OMNamespace) * @see #findNamespace(String, String) * @see #getAllDeclaredNamespaces() */ OMNamespace declareNamespace(String uri, String prefix); /** * This will declare a default namespace for this element explicitly * * @param uri */ OMNamespace declareDefaultNamespace(String uri); /** * This will retrieve the default namespace of this element, if available. null returned if none * is found. */ OMNamespace getDefaultNamespace(); /** * Declares a namespace with the element as its scope. * * @param namespace The namespace to declare. * @return Returns the namespace parameter passed. * @see #declareNamespace(String, String) * @see #findNamespace(String, String) * @see #getAllDeclaredNamespaces() */ OMNamespace declareNamespace(OMNamespace namespace); /** * Finds a namespace with the given uri and prefix, in the scope of the hierarchy. *

        *

        Searches from the current element and goes up the hiararchy until a match is found. If no * match is found, returns null.

        *

        *

        Either prefix or uri should be null. Results are undefined if both are * specified.

        * * @param uri The namespace to look for. If this is specified, prefix should be * null. * @param prefix The prefix to look for. If this is specified, uri should be null. * @return Returns the matching namespace declaration, or null if none was found. * @see #declareNamespace(String, String) * @see #declareNamespace(OMNamespace) * @see #getAllDeclaredNamespaces() */ OMNamespace findNamespace(String uri, String prefix); /** * Checks for a namespace in the context of this element with the given prefix and returns the * relevant namespace object, if available. If not available, returns null. * * @param prefix */ OMNamespace findNamespaceURI(String prefix); /** * Returns an iterator for all of the namespaces declared on this element. *

        *

        If you're interested in all namespaces in scope, you need to call this function for all * parent elements as well. Note that the iterator may be invalidated by any call to either * declareNamespace function.

        * * @return Returns an iterator over the {@link OMNamespace} items declared on the current * element. * @see #findNamespace(String, String) * @see #declareNamespace(String, String) * @see #declareNamespace(OMNamespace) */ Iterator getAllDeclaredNamespaces() throws OMException; /** * Returns a list of OMAttributes. *

        *

        Note that the iterator returned by this function will be invalidated by any * addAttribute call.

        * * @return Returns an {@link Iterator} of {@link OMAttribute} items associated with the * element. * @see #getAttribute * @see #addAttribute(OMAttribute) * @see #addAttribute(String, String, OMNamespace) */ Iterator getAllAttributes(); /** * Returns a named attribute if present. * * @param qname the qualified name to search for * @return Returns an OMAttribute with the given name if found, or null */ OMAttribute getAttribute(QName qname); /** * Returns a named attribute's value, if present. * * @param qname * the qualified name to search for * @return The attribute value, or null if no matching attribute is found. */ String getAttributeValue(QName qname); /** * Adds an attribute to this element. *

        * If the attribute already has an owner, the attribute is cloned (i.e. its name, value and * namespace are copied to a new attribute) and the new attribute is added to the element. * Otherwise the existing instance specified by the attr parameter is added to * the element. In both cases the owner of the added attribute is set to be the particular * OMElement. *

        * If there is already an attribute with the same name and namespace URI, it will be replaced * and its owner set to null. *

        * In the particular case where the attribute specified by attr is already owned * by the element, calling this method has no effect. *

        * Attributes are not stored in any particular order. In particular, there is no guarantee * that the added attribute will be returned as the last item by the iterator produced by * a subsequent call to {@link #getAllAttributes()}. *

        * If the attribute being added has a namespace, but no corresponding namespace declaration is * in scope for the element (i.e. declared on the element or one of its ancestors), a new * namespace declaration is added to the element. Note that both the namespace prefix and URI * are taken into account when looking for an existing namespace declaration. * * @param attr The attribute to add. * @return The attribute that was added to the element. As described above this may or may * not be the same as attr, depending on whether the attribute specified * by this parameter already has an owner or not. */ OMAttribute addAttribute(OMAttribute attr); /** * Adds an attribute to this element. *

        * If the element already has an attribute with the same local name and namespace URI, then this * existing attribute will be removed from the element, i.e. this method will always create a * new {@link OMAttribute} instance and never update an existing one. * * @param localName * The local name for the attribute. * @param value * The string value of the attribute. This function does not check to make sure that * the given attribute value can be serialized directly as an XML value. The caller * may, for example, pass a string with the character 0x01. * @param ns * The namespace has to be one of the in scope namespace. i.e. the passed namespace * must be declared in the parent element of this attribute or ancestors of the * parent element of the attribute. * @return Returns the added attribute. */ OMAttribute addAttribute(String localName, String value, OMNamespace ns); /** * Method removeAttribute * * @param attr */ void removeAttribute(OMAttribute attr); /** * Method setBuilder. * * @param wrapper */ void setBuilder(OMXMLParserWrapper wrapper); /** * Sets the first child. * * @param node * @deprecated This method should not be called, un-intentionally. When some one randomly set * the first child, all the links handling will not happen inside this method. So we * have moved this method to the less visible interface, OMContainerEx. */ void setFirstChild(OMNode node); /** * Returns the first child element of the element. * * @return Returns the first child element of the element, or null if none was found. */ OMElement getFirstElement(); /** @param text */ void setText(String text); /** * Set the content of this element to the given QName. If no matching namespace declaration for * the QName is in scope, then this method will add one. * * @param qname * the QName value */ void setText(QName qname); /** * Returns the non-empty text children as a string. *

        * This method iterates over all the text children of the element and concatenates * them to a single string. Only direct children will be considered, i.e. the text * is not extracted recursively. For example the return value for * <element>A<child>B</child>C</element> will be AC. *

        * All whitespace will be preserved. * * @return A string representing the concatenation of the child text nodes. * If there are no child text nodes, an empty string is returned. */ String getText(); /** OMText can contain its information as a QName as well. This will return the text as a QName */ QName getTextAsQName(); /** * Returns the local name of the element. * * @return Returns the local name of the element. */ String getLocalName(); /** * Method setLocalName * * @param localName */ void setLocalName(String localName); /** * Get the namespace this element is part of. * * @return the namespace of this element, or null if the element has no namespace */ OMNamespace getNamespace(); /** * Get the namespace URI of the element. Note that the contract of this method is identical to * DOM's {@link org.w3c.dom.Node#getNamespaceURI()} (when called on an * {@link org.w3c.dom.Element}). * * @return the namespace URI of the element or null if the element has no namespace */ String getNamespaceURI(); /** * Sets the Namespace. This will first search for a namespace in the current scope with the * given namespace. If no namespace is found with the given details, then it will declare a new * one. Then that namespace will be assigned to this element. * * @param namespace */ void setNamespace(OMNamespace namespace); /** * This will not search the namespace in the scope nor will declare in the current element, as * in setNamespace(OMNamespace). This will just assign the given namespace to the element. * * @param namespace */ void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace); /** * Gets the QName of this node. * * @return Returns the {@link QName} for the element. */ QName getQName(); /** * This is a convenience method only. This will basically serialize the given OMElement to a * String but will build the OMTree in the memory */ String toString(); /** * This is a convenience method only. This basically serializes the given OMElement to a String * but will NOT build the OMTree in the memory. So you are at your own risk of losing * information. */ String toStringWithConsume() throws XMLStreamException; /** * Resolves a QName literal in the namespace context defined by this element and produces a * corresponding {@link QName} object. The implementation uses the algorithm defined by the XML * Schema specification. In particular, the namespace for an unprefixed QName is the default * namespace (not the null namespace), i.e. QNames are resolved in the same way as element * names. * * @param qname * the QName literal to resolve * @return the {@link QName} object, or null if the QName can't be resolved, i.e. * if the prefix is not bound in the namespace context of this element */ QName resolveQName(String qname); /** * Clones this element. Since both elements are build compleletely, you will lose the differed * building capability. * * @return Returns OMElement. */ OMElement cloneOMElement(); void setLineNumber(int lineNumber); int getLineNumber(); /** * Serializes the node with caching. * * @param output * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serialize(OutputStream output) throws XMLStreamException; /** * Serializes the node with caching. * * @param writer * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serialize(Writer writer) throws XMLStreamException; /** * Serializes the node with caching. * * @param output * @param format * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node with caching. * * @param writer * @param format * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node without caching. * * @param output * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serializeAndConsume(OutputStream output) throws XMLStreamException; /** * Serializes the node without caching. * * @param writer * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serializeAndConsume(Writer writer) throws XMLStreamException; /** * Serializes the node without caching. * * @param output * @param format * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node without caching. * * @param writer * @param format * @throws XMLStreamException */ // Note: This method is inherited from both OMNode and OMContainer, but it is deprecated in // OMNode. We redeclare it here to make sure that people don't get a deprecation // warning when using the method on an OMElement. void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException; } ./src/org/apache/axiom/om/OMDocType.java0000664000175000017500000000221511767656530017202 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Interface OMDocType */ public interface OMDocType extends OMNode { /** * Returns the value of this DocType. * * @return Returns String. */ String getValue(); /** * Sets the content of this DocType to the specified string. * * @param text */ void setValue(String text); } ./src/org/apache/axiom/om/OMNode.java0000664000175000017500000002051311767656530016521 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import java.io.OutputStream; import java.io.Writer; /** * Defines the base interface used by most of the XML object model within Axis. *

        *

        * This tree model for XML captures the idea of deferring the construction of child nodes until they * are needed. The isComplete function identifies whether or not a particular node has * been fully parsed. A node may not be fully parsed, for example, if all of the children of an * element have not yet been parsed.

        *

        *

        * In comparison to DOM, in this model, you will not find document fragments, or entities. In * addition, while {@link OMDocument} and {@link OMAttribute} exist, neither is an extension of * OMNode.

        */ public interface OMNode extends OMSerializable { /** * The node is an Element. * * @see #getType() */ static final short ELEMENT_NODE = 1; /** * The node is a Text node. * * @see #getType() */ static final short TEXT_NODE = XMLStreamConstants.CHARACTERS; /** * The node is a CDATASection. * * @see #getType() */ static final short CDATA_SECTION_NODE = XMLStreamConstants.CDATA; /** * The node is a Comment. * * @see #getType() */ static final short COMMENT_NODE = XMLStreamConstants.COMMENT; /** * This node is a DTD. * * @see #getType() */ static final short DTD_NODE = XMLStreamConstants.DTD; /** * This node is a ProcessingInstruction. * * @see #getType() */ static final short PI_NODE = XMLStreamConstants.PROCESSING_INSTRUCTION; /** * This node is an Entity Reference. * * @see #getType() */ static final short ENTITY_REFERENCE_NODE = XMLStreamConstants.ENTITY_REFERENCE; /** * This node represents white space. * * @see #getType() */ static final short SPACE_NODE = XMLStreamConstants.SPACE; /** * Returns the parent containing node. *

        *

        * Returns the parent container, which may be either an {@link OMDocument} or {@link OMElement}. * * @return The {@link OMContainer} of the node. */ OMContainer getParent(); /** * Returns the next sibling in document order. * * @return Returns the next sibling in document order. */ OMNode getNextOMSibling() throws OMException; /** * Removes a node (and all of its children) from its containing parent. *

        *

        * Removes a node from its parent. Partially complete nodes will be completed before they are * detached from the model. A node cannot be detached until its next sibling has been identified, * so that the next sibling and parent can be updated appropriately. Please note that this will not * handle the namespaces. For example, if there you have used a namespace within the detaching node * and which is defined outside the detaching node, user has to handle it manually.

        * * @return The detached node. This is always the instance on which this method is invoked. * * @throws OMException If a node is not complete, the detach can trigger further parsing, which may * cause an exception. */ // TODO: LLOM's OMNodeImpl triggers an exception if the node doesn't have a parent. This is not specified here. OMNode detach() throws OMException; /** * Discards a node. *

        *

        * Discard goes to the parser level and if the element is not completely built, then it will be * completely skipped at the parser level.

        * * @throws OMException */ void discard() throws OMException; /** * Inserts a new sibling after the current node. The current node must have a parent for this * operation to succeed. If the node to be inserted has a parent, then it will first be * detached. * * @param sibling * The node that will be added after the current node. * @throws OMException * if the current node has no parent */ void insertSiblingAfter(OMNode sibling) throws OMException; /** * Inserts a sibling just before the current node. The current node must have a parent for this * operation to succeed. If the node to be inserted has a parent, then it will first be * detached. * * @param sibling * The node that will be added before the current node. * @throws OMException * if the current node has no parent */ void insertSiblingBefore(OMNode sibling) throws OMException; /** * Returns the type of node. * * @return Returns one of {@link #ELEMENT_NODE}, {@link #TEXT_NODE}, {@link #CDATA_SECTION_NODE}, * {@link #COMMENT_NODE}, {@link #DTD_NODE}, {@link #PI_NODE}, {@link * #ENTITY_REFERENCE_NODE} or {@link #SPACE_NODE}. */ int getType(); /** * Gets the previous sibling. * * @return Returns node. */ OMNode getPreviousOMSibling(); /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serialize(OutputStream output) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serialize(Writer writer) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serializeAndConsume(OutputStream output) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serializeAndConsume(Writer writer) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * @deprecated This method is not meaningful on a node in general, but only on an * {@link OMElement}. */ void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * Builds itself with the OMText binary content. AXIOM supports two levels of deffered building. * First is deffered building of AXIOM using StAX. Second level is the deffered building of * attachments. AXIOM reads in the attachements from the stream only when user asks by calling * getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM * together with attachement data. This becomes handy when user wants to free the input stream. */ void buildWithAttachments(); } ./src/org/apache/axiom/om/OMHierarchyException.java0000664000175000017500000000341311767656530021431 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** * Thrown if an object model operation would lead to a hierarchy that is not allowed in the * given object model implementation. *

        * If this exception is encountered by a builder when creating an OM node from an event received * by the parser and if the corresponding content can be ignored (i.e. is not semantically * relevant), the builder should ignore the exception and skip the event. An example is whitespace * appearing before or after the root element of a document. This would be represented as an * {@link OMText} node below the {@link OMDocument}. If the OM implementation doesn't allow text * nodes as children of a document (as for example in DOM), it should throw this exception so * that the builder can discard the event. */ public class OMHierarchyException extends OMException { private static final long serialVersionUID = 8391435427221729190L; public OMHierarchyException(String message) { super(message); } } ./src/org/apache/axiom/om/xpath/0000775000175000017500000000000011767656530015660 5ustar brianbrian./src/org/apache/axiom/om/xpath/DocumentNavigator.java0000664000175000017500000007066211767656530022167 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.xpath; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMComment; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMProcessingInstruction; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.OMNamespaceImpl; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.StAXUtils; import org.jaxen.BaseXPath; import org.jaxen.DefaultNavigator; import org.jaxen.FunctionCallException; import org.jaxen.JaxenConstants; import org.jaxen.UnsupportedAxisException; import org.jaxen.XPath; import org.jaxen.saxpath.SAXPathException; import org.jaxen.util.SingleObjectIterator; import javax.xml.namespace.QName; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; public class DocumentNavigator extends DefaultNavigator { private static final long serialVersionUID = 7325116153349780805L; /** * Returns a parsed form of the given xpath string, which will be suitable for queries on * documents that use the same navigator as this one. * * @param xpath the XPath expression * @return Returns a new XPath expression object. * @throws SAXPathException if the string is not a syntactically correct XPath expression * @see XPath */ public XPath parseXPath(String xpath) throws SAXPathException { return new BaseXPath(xpath, this); } /** * Retrieves the namespace URI of the given element node. * * @param object the context element node * @return Returns the namespace URI of the element node. */ public String getElementNamespaceUri(Object object) { OMElement attr = (OMElement) object; return attr.getQName().getNamespaceURI(); } /** * Retrieves the name of the given element node. * * @param object the context element node * @return Returns the name of the element node. */ public String getElementName(Object object) { OMElement attr = (OMElement) object; return attr.getQName().getLocalPart(); } /** * Retrieves the QName of the given element node. * * @param object the context element node * @return Returns the QName of the element node. */ public String getElementQName(Object object) { OMElement attr = (OMElement) object; String prefix = null; OMNamespace namespace = attr.getNamespace(); if (namespace != null) { prefix = namespace.getPrefix(); } if (prefix == null || "".equals(prefix)) { return attr.getQName().getLocalPart(); } return prefix + ":" + namespace.getNamespaceURI(); } /** * Retrieves the namespace URI of the given attribute node. * * @param object the context attribute node * @return Returns the namespace URI of the attribute node. */ public String getAttributeNamespaceUri(Object object) { OMAttribute attr = (OMAttribute) object; return attr.getQName().getNamespaceURI(); } /** * Retrieves the name of the given attribute node. * * @param object the context attribute node * @return Returns the name of the attribute node. */ public String getAttributeName(Object object) { OMAttribute attr = (OMAttribute) object; return attr.getQName().getLocalPart(); } /** * Retrieves the QName of the given attribute node. * * @param object the context attribute node * @return Returns the qualified name of the attribute node. */ public String getAttributeQName(Object object) { OMAttribute attr = (OMAttribute) object; String prefix = attr.getNamespace().getPrefix(); if (prefix == null || "".equals(prefix)) { return attr.getQName().getLocalPart(); } return prefix + ":" + attr.getNamespace().getNamespaceURI(); } /** * Returns whether the given object is a document node. A document node is the node that is * selected by the xpath expression /. * * @param object the object to test * @return Returns true if the object is a document node, else false * . */ public boolean isDocument(Object object) { return object instanceof OMDocument; } /** * Returns whether the given object is an element node. * * @param object the object to test * @return Returns true if the object is an element node, else false * . */ public boolean isElement(Object object) { return object instanceof OMElement; } /** * Returns whether the given object is an attribute node. * * @param object the object to test * @return Returns true if the object is an attribute node, else false * . */ public boolean isAttribute(Object object) { return object instanceof OMAttribute; } /** * Returns whether the given object is a namespace node. * * @param object the object to test * @return Returns true if the object is a namespace node, else false * . */ public boolean isNamespace(Object object) { return object instanceof OMNamespace; } /** * Returns whether the given object is a comment node. * * @param object the object to test * @return Returns true if the object is a comment node, else false . */ public boolean isComment(Object object) { return (object instanceof OMComment); } /** * Returns whether the given object is a text node. * * @param object the object to test * @return Returns true if the object is a text node, else false . */ public boolean isText(Object object) { return (object instanceof OMText); } /** * Returns whether the given object is a processing-instruction node. * * @param object the object to test * @return Returns true if the object is a processing-instruction node, else * false . */ public boolean isProcessingInstruction(Object object) { return (object instanceof OMProcessingInstruction); } /** * Retrieves the string-value of a comment node. This may be the empty string if the comment is * empty, but must not be null. * * @param object the comment node * @return Returns the string-value of the node. */ public String getCommentStringValue(Object object) { return ((OMComment) object).getValue(); } /** * Retrieves the string-value of an element node. This may be the empty string if the element is * empty, but must not be null. * * @param object the comment node. * @return Returns the string-value of the node. */ public String getElementStringValue(Object object) { if (isElement(object)) { return getStringValue((OMElement) object, new StringBuffer()) .toString(); } return null; } private StringBuffer getStringValue(OMNode node, StringBuffer buffer) { if (isText(node)) { buffer.append(((OMText) node).getText()); } else if (node instanceof OMElement) { Iterator children = ((OMElement) node).getChildren(); while (children.hasNext()) { getStringValue((OMNode) children.next(), buffer); } } return buffer; } /** * Retrieves the string-value of an attribute node. This should be the XML 1.0 normalized * attribute value. This may be the empty string but must not be null. * * @param object the attribute node * @return Returns the string-value of the node. */ public String getAttributeStringValue(Object object) { return ((OMAttribute) object).getAttributeValue(); } /** * Retrieves the string-value of a namespace node. This is generally the namespace URI. This may * be the empty string but must not be null. * * @param object the namespace node * @return Returns the string-value of the node. */ public String getNamespaceStringValue(Object object) { return ((OMNamespace) object).getNamespaceURI(); } /** * Retrieve the string-value of a text node. This must not be null and should not be the empty * string. The XPath data model does not allow empty text nodes. * * @param object the text node * @return Returns the string-value of the node. */ public String getTextStringValue(Object object) { return ((OMText) object).getText(); } /** * Retrieves the namespace prefix of a namespace node. * * @param object the namespace node * @return Returns the prefix associated with the node. */ public String getNamespacePrefix(Object object) { return ((OMNamespace) object).getPrefix(); } /** * Retrieves an Iterator matching the child XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the child axis are not supported by this * object model */ public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException { if (contextNode instanceof OMContainer) { return ((OMContainer) contextNode).getChildren(); } return JaxenConstants.EMPTY_ITERATOR; } public Iterator getDescendantAxisIterator(Object object) throws UnsupportedAxisException { //TODO: Fix this better? return super.getDescendantAxisIterator(object); } /** * Retrieves an Iterator matching the attribute XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the attribute axis are not supported by * this object model */ public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException { if (isElement(contextNode)) { ArrayList attributes = new ArrayList(); Iterator i = ((OMElement) contextNode).getAllAttributes(); while (i != null && i.hasNext()) { attributes.add(new OMAttributeEx((OMAttribute) i.next(), (OMContainer) contextNode, ((OMElement) contextNode) .getOMFactory())); } return attributes.iterator(); } return JaxenConstants.EMPTY_ITERATOR; } /** * Retrieves an Iterator matching the namespace XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the namespace axis are not supported by * this object model */ public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException { if (!(contextNode instanceof OMContainer && contextNode instanceof OMElement)) { return JaxenConstants.EMPTY_ITERATOR; } List nsList = new ArrayList(); HashSet prefixes = new HashSet(); for (OMContainer context = (OMContainer) contextNode; context != null && !(context instanceof OMDocument); context = ((OMElement) context).getParent()) { OMElement element = (OMElement) context; ArrayList declaredNS = new ArrayList(); Iterator i = element.getAllDeclaredNamespaces(); while (i != null && i.hasNext()) { declaredNS.add(i.next()); } declaredNS.add(element.getNamespace()); for (Iterator iter = element.getAllAttributes(); iter != null && iter.hasNext();) { OMAttribute attr = (OMAttribute) iter.next(); OMNamespace namespace = attr.getNamespace(); if (namespace != null) { declaredNS.add(namespace); } } for (Iterator iter = declaredNS.iterator(); iter != null && iter.hasNext();) { OMNamespace namespace = (OMNamespace) iter.next(); if (namespace != null) { String prefix = namespace.getPrefix(); if (prefix != null && !prefixes.contains(prefix)) { prefixes.add(prefix); nsList.add(new OMNamespaceEx(namespace, context)); } } } } nsList.add( new OMNamespaceEx( new OMNamespaceImpl( "http://www.w3.org/XML/1998/namespace", "xml"), (OMContainer) contextNode)); return nsList.iterator(); } /** * Retrieves an Iterator matching the self xpath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the self axis are not supported by this * object model */ public Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getSelfAxisIterator(contextNode); } /** * Retrieves an Iterator matching the descendant-or-self XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the descendant-or-self axis are not * supported by this object model */ public Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getDescendantOrSelfAxisIterator(contextNode); } /** * Retrieves an Iterator matching the ancestor-or-self XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the ancestor-or-self axis are not * supported by this object model */ public Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getAncestorOrSelfAxisIterator(contextNode); } /** * Retrieves an Iterator matching the parent XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the parent axis are not supported by * this object model */ public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException { if (contextNode instanceof OMNode) { return new SingleObjectIterator(((OMNode) contextNode).getParent()); } else if (contextNode instanceof OMNamespaceEx) { return new SingleObjectIterator( ((OMNamespaceEx) contextNode).getParent()); } else if (contextNode instanceof OMAttributeEx) { return new SingleObjectIterator( ((OMAttributeEx) contextNode).getParent()); } return JaxenConstants.EMPTY_ITERATOR; } /** * Retrieves an Iterator matching the ancestor XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the ancestor axis are not supported by * this object model */ public Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getAncestorAxisIterator(contextNode); } /** * Retrieves an Iterator matching the following-sibling XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the following-sibling axis are not * supported by this object model */ public Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException { ArrayList list = new ArrayList(); if (contextNode != null && contextNode instanceof OMNode) { while (contextNode != null && contextNode instanceof OMNode) { contextNode = ((OMNode) contextNode).getNextOMSibling(); if (contextNode != null) list.add(contextNode); } } return list.iterator(); } /** * Retrieves an Iterator matching the preceding-sibling XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the preceding-sibling axis are not * supported by this object model */ public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException { ArrayList list = new ArrayList(); if (contextNode != null && contextNode instanceof OMNode) { while (contextNode != null && contextNode instanceof OMNode) { contextNode = ((OMNode) contextNode).getPreviousOMSibling(); if (contextNode != null) list.add(contextNode); } } return list.iterator(); } /** * Retrieves an Iterator matching the following XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the following axis are not supported by * this object model */ public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getFollowingAxisIterator(contextNode); } /** * Retrieves an Iterator matching the preceding XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the preceding axis are not supported by * this object model */ public Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException { //TODO: Fix this better? return super.getPrecedingAxisIterator(contextNode); } /** * Loads a document from the given URI. * * @param uri the URI of the document to load * @return Returns the document. * @throws FunctionCallException if the document could not be loaded */ public Object getDocument(String uri) throws FunctionCallException { InputStream in = null; try { if (uri.indexOf(':') == -1) { in = new FileInputStream(uri); } else { URL url = new URL(uri); in = url.openStream(); } return new StAXOMBuilder(StAXUtils.createXMLStreamReader(in)).getDocument(); } catch (Exception e) { if (in != null) { try { in.close(); } catch (IOException ex) { // Ignore } } throw new FunctionCallException(e); } } /** * Returns the element whose ID is given by elementId. If no such element exists, returns null. * Attributes with the name "ID" are not of type ID unless so defined. Implementations that do * not know whether attributes are of type ID or not are expected to return null. * * @param contextNode a node from the document in which to look for the id * @param elementId id to look for * @return Returns element whose ID is given by elementId, or null if no such element exists in * the document or if the implementation does not know about attribute types. */ public Object getElementById(Object contextNode, String elementId) { //TODO: Fix this better? return super.getElementById(contextNode, elementId); } /** * Returns the document node that contains the given context node. * * @param contextNode the context node * @return Returns the document of the context node. * @see #isDocument(Object) */ public Object getDocumentNode(Object contextNode) { if (contextNode instanceof OMDocument) { return contextNode; } OMContainer parent = ((OMNode) contextNode).getParent(); if (parent == null) { // this node doesn't have a parent Document. So return the document element itself return contextNode; } else { return getDocumentNode(parent); } } /** * Translates a namespace prefix to a namespace URI, possibly considering a particular * element node. *

        * Strictly speaking, prefix-to-URI translation should occur irrespective of any element in the * document. This method is provided to allow a non-conforming ease-of-use enhancement.

        * * @param prefix the prefix to translate * @param element the element to consider during translation * @return Returns the namespace URI associated with the prefix. */ public String translateNamespacePrefixToUri(String prefix, Object element) { //TODO: Fix this better? return super.translateNamespacePrefixToUri(prefix, element); } /** * Retrieves the target of a processing-instruction. * * @param object the context processing-instruction node * @return Returns the target of the processing-instruction node. */ public String getProcessingInstructionTarget(Object object) { return ((OMProcessingInstruction) object).getTarget(); } /** * Retrieves the data of a processing-instruction. * * @param object the context processing-instruction node * @return Returns the data of the processing-instruction node. */ public String getProcessingInstructionData(Object object) { return ((OMProcessingInstruction) object).getValue(); } /** * Returns a number that identifies the type of node that the given object represents in this * navigator. See org.jaxen.pattern.Pattern * * @param node ???? * @return Returns short. */ public short getNodeType(Object node) { //TODO: Fix this better? return super.getNodeType(node); } /** * Returns the parent of the given context node. *

        * The parent of any node must either be a document node or an element node. * * @param contextNode the context node * @return Returns the parent of the context node, or null if this is a document node. * @throws UnsupportedAxisException if the parent axis is not supported by the model * @see #isDocument * @see #isElement */ public Object getParentNode(Object contextNode) throws UnsupportedAxisException { if (contextNode == null || contextNode instanceof OMDocument) { return null; } else if (contextNode instanceof OMAttributeEx) { return ((OMAttributeEx) contextNode).getParent(); } else if (contextNode instanceof OMNamespaceEx) { return ((OMNamespaceEx) contextNode).getParent(); } return ((OMNode) contextNode).getParent(); } class OMNamespaceEx implements OMNamespace { final OMNamespace originalNsp; final OMContainer parent; OMNamespaceEx(OMNamespace nsp, OMContainer parent) { originalNsp = nsp; this.parent = parent; } public boolean equals(String uri, String prefix) { return originalNsp.equals(uri, prefix); } public String getPrefix() { return originalNsp.getPrefix(); } public String getName() { return originalNsp.getNamespaceURI(); } public String getNamespaceURI() { return originalNsp.getNamespaceURI(); } public OMContainer getParent() { return parent; } } class OMAttributeEx implements OMAttribute { OMAttribute attribute = null; OMContainer parent = null; OMFactory factory; OMAttributeEx(OMAttribute attribute, OMContainer parent, OMFactory factory) { this.attribute = attribute; this.parent = parent; } public String getLocalName() { return attribute.getLocalName(); } public void setLocalName(String localName) { attribute.setLocalName(localName); } public String getAttributeValue() { return attribute.getAttributeValue(); } public String getAttributeType() { return attribute.getAttributeType(); } public void setAttributeValue(String value) { attribute.setAttributeValue(value); } public void setAttributeType(String type) { attribute.setAttributeType(type); } public void setOMNamespace(OMNamespace omNamespace) { attribute.setOMNamespace(omNamespace); } public OMNamespace getNamespace() { return attribute.getNamespace(); } public QName getQName() { return attribute.getQName(); } public OMContainer getParent() { return parent; } public OMFactory getOMFactory() { return this.factory; } /** * Returns the owner element of this attribute * * @return OMElement If the parent OMContainer is an * instanceof OMElement we return that element else * we return null. To get the OMContainer itself use * the getParent() method. */ public OMElement getOwner() { return (parent instanceof OMElement) ? (OMElement)parent : null; } } } ./src/org/apache/axiom/om/xpath/AXIOMXPath.java0000664000175000017500000001466111767656530020355 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om.xpath; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMContainer; import org.apache.axiom.om.OMDocument; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.jaxen.BaseXPath; import org.jaxen.JaxenException; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; public class AXIOMXPath extends BaseXPath { private static final long serialVersionUID = -5839161412925154639L; private Map namespaces = new HashMap(); /** * Construct an XPath expression from a given string. * * @param xpathExpr the string representation of the XPath expression. * @throws JaxenException if there is a syntax error while parsing the expression */ public AXIOMXPath(String xpathExpr) throws JaxenException { super(xpathExpr, new DocumentNavigator()); } /** * Construct an XPath expression from a given string and initialize its * namespace context based on a given element. * * @param element The element that determines the namespace context of the * XPath expression. See {@link #addNamespaces(OMElement)} * for more details. * @param xpathExpr the string representation of the XPath expression. * @throws JaxenException if there is a syntax error while parsing the expression * or if the namespace context could not be set up */ public AXIOMXPath(OMElement element, String xpathExpr) throws JaxenException { this(xpathExpr); addNamespaces(element); } /** * Construct an XPath expression from a given attribute. * The string representation of the expression is taken from the attribute * value, while the attribute's owner element is used to determine the * namespace context of the expression. * * @param attribute the attribute to construct the expression from * @throws JaxenException if there is a syntax error while parsing the expression * or if the namespace context could not be set up */ public AXIOMXPath(OMAttribute attribute) throws JaxenException { this(attribute.getOwner(), attribute.getAttributeValue()); } /** * This override captures any added namespaces, as the Jaxen BaseXPath class nor * NamespaceContext (or SimpleNamespaceContext) exposes thier internal map of the prefixes to * the namespaces. This method - although is not the ideal solution to the issue, attempts to * provide an override to changing the Jaxen code. * * @param prefix a namespace prefix * @param uri the URI to which the prefix matches * @throws JaxenException if the underlying implementation throws an exception */ public void addNamespace(String prefix, String uri) throws JaxenException { try { super.addNamespace(prefix, uri); } catch (JaxenException e) { // the intention here is to prevent us caching a namespace, if the // underlying implementation does not accept it throw e; } namespaces.put(prefix, uri); } /** * Add the namespace declarations of a given {@link OMElement} to the namespace * context of an XPath expression. Typically this method is used with an XPath * expression appearing in an attribute of the given element. *

        * Note that the default namespace is explicitly excluded and not added to the * namespace context. This makes the behaviour of this method consistent with * the rules followed in XSL stylesheets. Indeed, the XSLT specification defines * the namespace context of an XPath expression as follows: *

        * the set of namespace declarations are those in scope on the element which has the * attribute in which the expression occurs; [...] the default namespace * (as declared by xmlns) is not part of this set *
        * * @param element the element to retrieve the namespace context from * @throws JaxenException if an error occurred when adding the namespace declarations */ public void addNamespaces(OMElement element) throws JaxenException { OMElement current = element; // An element can redeclare a namespace prefix that has already been declared // by one of its ancestors. Since we visit the tree from child to parent, we // need to keep track of the prefixes we have already seen in order to avoid // adding namespace declarations that are overridden by a descendant of an element. Set seenPrefixes = new HashSet(); while (true) { for (Iterator it = current.getAllDeclaredNamespaces(); it.hasNext(); ) { OMNamespace ns = (OMNamespace) it.next(); if (ns != null) { String prefix = ns.getPrefix(); // Exclude the default namespace as explained in the Javadoc above if (prefix.length() != 0 && seenPrefixes.add(prefix)) { addNamespace(ns.getPrefix(), ns.getNamespaceURI()); } } } OMContainer parent = current.getParent(); if (parent == null || parent instanceof OMDocument) { break; } else { current = (OMElement)parent; } } } /** * Expose the prefix to namespace mapping for this expression * * @return a Map of namespace prefixes to the URIs */ public Map getNamespaces() { return namespaces; } } ./src/org/apache/axiom/om/OMAttachmentAccessor.java0000664000175000017500000000243011767656530021405 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.activation.DataHandler; /** * This interface is applied to objects that * can access attachments. */ public interface OMAttachmentAccessor { /** * @param blobcid (without the surrounding angle brackets and "cid:" prefix) * @return The DataHandler of the mime part referred by the Content-Id or *null* if the mime * part referred by the content-id does not exist */ public DataHandler getDataHandler(String blobcid); } ./src/org/apache/axiom/om/OMXMLBuilderFactory.java0000664000175000017500000002342411767656530021137 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import java.io.InputStream; import java.io.Reader; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import org.apache.axiom.om.util.StAXParserConfiguration; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPModelBuilder; import org.xml.sax.InputSource; /** * Provides static factory methods to create various kinds of object model builders from different * types of input sources. The methods defined by this class are the starting point to parse XML * documents into Axiom trees. *

        * WARNING: This API is still under construction (see AXIOM-353) and may slightly change in * subsequent releases! */ public class OMXMLBuilderFactory { private OMXMLBuilderFactory() {} /** * Create an object model builder for plain XML that pulls events from a StAX stream reader. * * @param parser * the stream reader to read the XML data from * @return the builder */ public static OMXMLParserWrapper createStAXOMBuilder(XMLStreamReader parser) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(); return metaFactory.createStAXOMBuilder(metaFactory.getOMFactory(), parser); } /** * Create an object model builder that pulls events from a StAX stream reader using a specified * object model factory. * * @param omFactory * the object model factory to use * @param parser * the stream reader to read the XML data from * @return the builder */ public static OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, XMLStreamReader parser) { return omFactory.getMetaFactory().createStAXOMBuilder(omFactory, parser); } /** * Create an object model builder that reads a plain XML document from the provided input stream * with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}. * * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(InputStream in) { return createOMBuilder(StAXParserConfiguration.DEFAULT, in); } /** * Create an object model builder that reads a plain XML document from the provided input stream * with a given parser configuration. * * @param configuration * the parser configuration to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration, InputStream in) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(); return metaFactory.createOMBuilder(metaFactory.getOMFactory(), configuration, new InputSource(in)); } /** * Create an object model builder that reads an XML document from the provided input stream * using a specified object model factory and with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param omFactory * the object model factory to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, InputStream in) { return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in); } /** * Create an object model builder that reads an XML document from the provided input stream * using a specified object model factory and with a given parser configuration. * * @param omFactory * the object model factory to use * @param configuration * the parser configuration to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, InputStream in) { return omFactory.getMetaFactory().createOMBuilder(omFactory, configuration, new InputSource(in)); } /** * Create an object model builder that reads a plain XML document from the provided character * stream with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(Reader in) { return createOMBuilder(StAXParserConfiguration.DEFAULT, in); } /** * Create an object model builder that reads a plain XML document from the provided character * stream with a given parser configuration. * * @param configuration * the parser configuration to use * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration, Reader in) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(); return metaFactory.createOMBuilder(metaFactory.getOMFactory(), configuration, new InputSource(in)); } /** * Create an object model builder that reads an XML document from the provided character stream * using a specified object model factory and with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param omFactory * the object model factory to use * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Reader in) { return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in); } /** * Create an object model builder that reads an XML document from the provided character stream * using a specified object model factory and with a given parser configuration. * * @param omFactory * the object model factory to use * @param configuration * the parser configuration to use * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, Reader in) { return omFactory.getMetaFactory().createOMBuilder(omFactory, configuration, new InputSource(in)); } /** * Create an object model builder that reads a plain XML document from the provided * {@link Source}. * * @param source * the source of the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(Source source) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(); return metaFactory.createOMBuilder(metaFactory.getOMFactory(), source); } /** * Create an object model builder that reads an XML document from the provided {@link Source} * using a specified object model factory. * * @param omFactory * the object model factory to use * @param source * the source of the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Source source) { return omFactory.getMetaFactory().createOMBuilder(omFactory, source); } /** * Create an object model builder for SOAP that pulls events from a StAX stream reader. * The method will select the appropriate {@link SOAPFactory} * based on the namespace URI of the SOAP envelope. * * @param parser * the stream reader to read the XML data from * @return the builder */ public static SOAPModelBuilder createStAXSOAPModelBuilder(XMLStreamReader parser) { return OMAbstractFactory.getMetaFactory().createStAXSOAPModelBuilder(parser); } /** * Create an object model builder for SOAP that reads a message from the provided input stream, * using a given charset encoding. The method will select the appropriate {@link SOAPFactory} * based on the namespace URI of the SOAP envelope. It will configure the underlying parser as * specified by {@link StAXParserConfiguration#SOAP}. * * @param in * the input stream containing the SOAP message * @param encoding * the charset encoding * @return the builder */ public static SOAPModelBuilder createSOAPModelBuilder(InputStream in, String encoding) { InputSource is = new InputSource(in); is.setEncoding(encoding); return OMAbstractFactory.getMetaFactory().createSOAPModelBuilder(StAXParserConfiguration.SOAP, is); } } ./src/org/apache/axiom/om/OMOutputFormat.java0000664000175000017500000004154311767656530020313 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import java.util.HashMap; import org.apache.axiom.mime.MultipartWriterFactory; import org.apache.axiom.mime.impl.axiom.AxiomMultipartWriterFactory; import org.apache.axiom.om.impl.MTOMConstants; import org.apache.axiom.om.util.StAXWriterConfiguration; import org.apache.axiom.om.util.XMLStreamWriterFilter; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.util.UIDGenerator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Formats options for OM Output. *

        * Setting of all the properties in a OMOutputFormat should be done before calling the * getContentType() method. It is advised to set all the properties at the creation time of the * OMOutputFormat and not to change them later. */ public class OMOutputFormat { private static Log log = LogFactory.getLog(OMOutputFormat.class); private String mimeBoundary; private String rootContentId; private int nextid; private boolean doOptimize; private boolean doingSWA; private boolean isSoap11; private int optimizedThreshold; /** Field DEFAULT_CHAR_SET_ENCODING. Specifies the default character encoding scheme to be used. */ public static final String DEFAULT_CHAR_SET_ENCODING = "utf-8"; private String charSetEncoding; private String xmlVersion; private String contentType; /** * Flag set if {@link #contentType} has been set explicitly through * {@link #setContentType(String)}. If this attribute is false and * {@link #contentType} is non null, then it was calculated by {@link #getContentType()}. */ private boolean contentTypeSet; private boolean ignoreXMLDeclaration; private boolean autoCloseWriter; public static final String ACTION_PROPERTY = "action"; private XMLStreamWriterFilter xmlStreamWriterFilter = null; private StAXWriterConfiguration writerConfiguration; private MultipartWriterFactory multipartWriterFactory; // The value of this property is a Boolean. // A missing value indicates the default action, which is Boolean.FALSE // If Boolean.TRUE, attachments that are "non textual" are written out with // a content-transfer-encoding type of base64. // @See CommonUtils.isTextualPart for the textual part definition. // // Example: // An attachment with a content-type of "image/gif" is a non-textual attachment. // An attachment with a content-type of "application/soap+xml" is an textual attachment // public static final String USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS = "org.apache.axiom.om.OMFormat.use.cteBase64.forNonTextualAttachments"; // The old default behavior for the swa output attachment order was the // natural order of the content ids. // // There are some customers who want the output order to match the // input order for swa attachments. public static final String RESPECT_SWA_ATTACHMENT_ORDER = "org.apache.axiom.om.OMFormat.respectSWAAttachmentOrder"; public static final Boolean RESPECT_SWA_ATTACHMENT_ORDER_DEFAULT = Boolean.TRUE; private HashMap map; // Map of generic properties public OMOutputFormat() { isSoap11 = true; } /** * Constructs a new instance by copying the configuration from an existing instance. Note that * this will only copy configuration data, but not information that is subject to * auto-generation, such as the root content ID or the MIME boundary. * * @param format * the existing instance */ public OMOutputFormat(OMOutputFormat format) { doOptimize = format.doOptimize; doingSWA = format.doingSWA; isSoap11 = format.isSoap11; optimizedThreshold = format.optimizedThreshold; charSetEncoding = format.charSetEncoding; xmlVersion = format.xmlVersion; if (format.contentTypeSet) { contentTypeSet = true; contentType = format.contentType; } ignoreXMLDeclaration = format.ignoreXMLDeclaration; autoCloseWriter = format.autoCloseWriter; xmlStreamWriterFilter = format.xmlStreamWriterFilter; writerConfiguration = format.writerConfiguration; multipartWriterFactory = format.multipartWriterFactory; if (format.map != null) { map = new HashMap(format.map); } } /** * @param key String * @return property or null */ public Object getProperty(String key) { if (map == null) { return null; } return map.get(key); } /** * @param key String * @param value Object * @return old value or null */ public Object setProperty(String key, Object value) { if (map == null) { map = new HashMap(); } return map.put(key, value); } /** * @param key * @return true if known key */ public boolean containsKey(String key) { if (map == null) { return false; } return map.containsKey(key); } /** * Indicates whether the document should be serialized using MTOM. * * @return true if the document should be serialized using MTOM; false * otherwise; the return value is always false if {@link #isDoingSWA()} * returns true */ public boolean isOptimized() { return doOptimize && !doingSWA; // optimize is disabled if SWA } /** * Return the content-type value that should be written with the message. * (i.e. if optimized, then a multipart/related content-type is returned). * @return content-type value */ public String getContentType() { String ct = null; if (log.isDebugEnabled()) { log.debug("Start getContentType: " + toString()); } if (contentType == null) { if (isSoap11) { contentType = SOAP11Constants.SOAP_11_CONTENT_TYPE; } else { contentType = SOAP12Constants.SOAP_12_CONTENT_TYPE; } } // If MTOM or SWA, the returned content-type is an // appropriate multipart/related content type. if (isOptimized()) { ct = this.getContentTypeForMTOM(contentType); } else if (isDoingSWA()) { ct = this.getContentTypeForSwA(contentType); } else { ct = contentType; } if (log.isDebugEnabled()) { log.debug("getContentType= {" + ct + "} " + toString()); } return ct; } /** * Set a raw content-type * (i.e. "text/xml" (SOAP 1.1) or "application/xml" (REST)) * If this method is not invoked, OMOutputFormat will choose * a content-type value consistent with the soap version. * @param c */ public void setContentType(String c) { contentTypeSet = true; contentType = c; } public String getMimeBoundary() { if (mimeBoundary == null) { mimeBoundary = UIDGenerator.generateMimeBoundary(); } return mimeBoundary; } public String getRootContentId() { if (rootContentId == null) { rootContentId = "0." + UIDGenerator.generateContentId(); } return rootContentId; } public String getNextContentId() { nextid++; return nextid + "." + UIDGenerator.generateContentId(); } /** * Returns the character set encoding scheme. * * @return Returns encoding string or null if it has not been set. */ public String getCharSetEncoding() { return this.charSetEncoding; } public void setCharSetEncoding(String charSetEncoding) { this.charSetEncoding = charSetEncoding; } public String getXmlVersion() { return xmlVersion; } public void setXmlVersion(String xmlVersion) { this.xmlVersion = xmlVersion; } public void setSOAP11(boolean b) { isSoap11 = b; } public boolean isSOAP11() { return isSoap11; } public boolean isIgnoreXMLDeclaration() { return ignoreXMLDeclaration; } public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) { this.ignoreXMLDeclaration = ignoreXMLDeclaration; } /** * Specifies that the document should be serialized using MTOM. Note that this setting is * ignored if SwA is enabled using {@link #setDoingSWA(boolean)}. * * @param optimize * true if the document should be serialized using MTOM; * false otherwise */ public void setDoOptimize(boolean optimize) { doOptimize = optimize; } /** * Indicates whether the document should be serialized using SwA. * * @return true if the document should be serialized using SwA; false * otherwise */ public boolean isDoingSWA() { return doingSWA; } /** * Specifies that the document should be serialized using SwA (SOAP with Attachments). When SwA * is enabled, then any configuration done using {@link #setDoOptimize(boolean)} is ignored. * * @param doingSWA * true if the document should be serialized using SwA; * false otherwise */ public void setDoingSWA(boolean doingSWA) { this.doingSWA = doingSWA; } /** * Generates a Content-Type value for MTOM messages. This is a MIME Multipart/Related * Content-Type value as defined by RFC 2387 and the XOP specification. The generated * header will look like the following: * * Content-Type: multipart/related; boundary="[MIME BOUNDARY VALUE]"; * type="application/xop+xml"; * start="[MESSAGE CONTENT ID]"; * start-info="[MESSAGE CONTENT TYPE]"; * * @param SOAPContentType * @return TODO */ public String getContentTypeForMTOM(String SOAPContentType) { // If an action was set, we need to include it within the value // for the start-info attribute. if (containsKey(ACTION_PROPERTY)) { String action = (String) getProperty(ACTION_PROPERTY); if (action != null && action.length() > 0) { SOAPContentType = SOAPContentType + "; action=\\\"" + action + "\\\""; } } StringBuffer sb = new StringBuffer(); sb.append("multipart/related"); sb.append("; "); sb.append("boundary="); // The value of the boundary parameter must be enclosed in double quotation // marks, according to the Basic Profile 2.0 Specification, Rule R1109: // "Parameters on the Content-Type MIME header field-value in a request // MESSAGE MUST be a quoted string." sb.append("\""); sb.append(getMimeBoundary()); sb.append("\""); sb.append("; "); sb.append("type=\"" + MTOMConstants.MTOM_TYPE + "\""); sb.append("; "); sb.append("start=\"<").append(getRootContentId()).append(">\""); sb.append("; "); sb.append("start-info=\"").append(SOAPContentType).append("\""); return sb.toString(); } public String getContentTypeForSwA(String SOAPContentType) { StringBuffer sb = new StringBuffer(); sb.append("multipart/related"); sb.append("; "); sb.append("boundary="); // The value of the boundary parameter must be enclosed in double quotation // marks, according to the Basic Profile 2.0 Specification, Rule R1109: // "Parameters on the Content-Type MIME header field-value in a request // MESSAGE MUST be a quoted string." sb.append("\""); sb.append(getMimeBoundary()); sb.append("\""); sb.append("; "); sb.append("type=\"").append(SOAPContentType).append("\""); sb.append("; "); sb.append("start=\"<").append(getRootContentId()).append(">\""); return sb.toString(); } /** * @deprecated */ public boolean isAutoCloseWriter() { return autoCloseWriter; } /** * @deprecated */ public void setAutoCloseWriter(boolean autoCloseWriter) { this.autoCloseWriter = autoCloseWriter; } public void setMimeBoundary(String mimeBoundary) { this.mimeBoundary = mimeBoundary; } public void setRootContentId(String rootContentId) { this.rootContentId = rootContentId; } /** * Use toString for logging state of the OMOutputFormat */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("OMOutputFormat ["); sb.append(" mimeBoundary ="); sb.append(mimeBoundary); sb.append(" rootContentId="); sb.append(rootContentId); sb.append(" doOptimize="); sb.append(doOptimize); sb.append(" doingSWA="); sb.append(doingSWA); sb.append(" isSOAP11="); sb.append(isSoap11); sb.append(" charSetEncoding="); sb.append(charSetEncoding); sb.append(" xmlVersion="); sb.append(xmlVersion); sb.append(" contentType="); sb.append(contentType); sb.append(" ignoreXmlDeclaration="); sb.append(ignoreXMLDeclaration); sb.append(" autoCloseWriter="); sb.append(autoCloseWriter); // TODO Print all properties sb.append(" actionProperty="); sb.append(getProperty(ACTION_PROPERTY)); sb.append(" optimizedThreshold="); sb.append(optimizedThreshold); sb.append("]"); return sb.toString(); } public void setOptimizedThreshold(int optimizedThreshold) { this.optimizedThreshold = optimizedThreshold; } public int getOptimizedThreshold() { return optimizedThreshold; } /** * @return the xmlStreamWriterFilter */ public XMLStreamWriterFilter getXmlStreamWriterFilter() { return xmlStreamWriterFilter; } /** * @param xmlStreamWriterFilter the xmlStreamWriterFilter to set */ public void setXmlStreamWriterFilter(XMLStreamWriterFilter xmlStreamWriterFilter) { this.xmlStreamWriterFilter = xmlStreamWriterFilter; } /** * Get the currently configured StAX writer configuration. * * @return the current configuration; {@link StAXWriterConfiguration#DEFAULT} if none has been * set explicitly */ public StAXWriterConfiguration getStAXWriterConfiguration() { return writerConfiguration == null ? StAXWriterConfiguration.DEFAULT : writerConfiguration; } /** * Set the StAX writer configuration that will be used when requesting an * {@link javax.xml.stream.XMLStreamWriter} from {@link org.apache.axiom.om.util.StAXUtils}. * * @param writerConfiguration * the configuration */ public void setStAXWriterConfiguration(StAXWriterConfiguration writerConfiguration) { this.writerConfiguration = writerConfiguration; } /** * Get the currently configured multipart writer factory. * * @return the current factory; if none has been set explicitly, an * {@link AxiomMultipartWriterFactory} instance is returned */ public MultipartWriterFactory getMultipartWriterFactory() { return multipartWriterFactory == null ? AxiomMultipartWriterFactory.INSTANCE : multipartWriterFactory; } /** * Set the multipart writer factory. This factory is used to create MIME packages when MTOM or * SwA is enabled. * * @param multipartWriterFactory * the factory */ public void setMultipartWriterFactory(MultipartWriterFactory multipartWriterFactory) { this.multipartWriterFactory = multipartWriterFactory; } } ./src/org/apache/axiom/om/OMText.java0000664000175000017500000000726011767656530016564 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.namespace.QName; /** * Represents character data in an XML document. A node of this type is used to * represent character data that may appear in element content as well as the * prolog and epilog of a document. Note that this node type is used for normal * character data, CDATA sections and ignorable whitespace. The * {@link OMNode#getType()} method may be used to distinguish between these * different types of character data. *

        * By default, Axiom uses StAX parsers configured in coalescing mode. As a * consequence, CDATA sections will not result in nodes of type * {@link OMNode#CDATA_SECTION_NODE} nodes, but of type {@link OMNode#TEXT_NODE} * (See the Javadoc of {@link org.apache.axiom.om.util.StAXUtils} for * information about how to change this behavior). In addition, the object model * instance will never contain two adjacent {@link OMText} siblings. *

        * The same is not necessarily true for Axiom trees that have been built or * updated programmatically or that contain nodes resulting from the expansion * of an {@link OMSourcedElement}. Therefore, code that manipulates character * data MUST NOT assume that text nodes are always coalesced. In particular, * when extracting character data from an element, {@link OMElement#getText()} * should be used instead of {@link OMText#getText()}. *

        * An {@link OMText} node stores the character data as {@link String}, * char[] or a {@link javax.activation.DataHandler}. The latter is * used for base64 encoded binary data. */ public interface OMText extends OMNode { /** * Returns the text value of this node. * * @return Returns String. */ String getText(); char[] getTextCharacters(); boolean isCharacters(); QName getTextAsQName(); /** * Returns the Namespace if this contains a QName Return null otherwise * * @deprecated This API is going away. Please use getTextAsQName() instead. * @return OMNamespace */ OMNamespace getNamespace(); /** * Gets the datahandler. * * @return Returns datahandler. */ Object getDataHandler(); /** @return Returns boolean flag saying whether the node contains an optimized text or not. */ boolean isOptimized(); /** * Sets the optimize flag. * * @param value true to optimize binary content (usually w/MTOM) */ void setOptimize(boolean value); /** @return Returns boolean flag saying whether the node contains binary or not. */ boolean isBinary(); /** * Sets the isBinary flag. * * @param value true if the content is binary */ void setBinary(boolean value); /** * Gets the content id. * * @return Returns String. */ String getContentID(); /** * Set a specific content id * @param cid */ void setContentID(String cid); } ./src/org/apache/axiom/om/OMSourcedElement.java0000664000175000017500000000420511767656530020552 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** * Element whose data is backed by an arbitrary Java object. The backing Java object is accessed * via the {@link OMDataSource} (or {@link OMDataSourceExt}) interface. *

        * An OMSourcedElement can be in one of two states: *

        *
        Not Expanded
        *
        In this state the backing object is used to read and write the XML.
        *
        Expanded
        *
        In this state, the OMSourcedElement is backed by a normal OM tree.
        *
        *

        * Here are the steps to place an arbitrary java object into the OM tree: *

          *
        1. Write an {@link OMDataSourceExt} implementation that provides access to your Java * object.
        2. *
        3. Use {@link OMFactory#createOMElement(OMDataSource, String, OMNamespace)} to create * the OMSourcedElement.
        4. *
        5. Attach the OMSourcedElement to the tree.
        6. *
        */ public interface OMSourcedElement extends OMElement { /** * @return true if tree is expanded or being expanded. */ public boolean isExpanded(); /** * @return OMDataSource */ public OMDataSource getDataSource(); /** * Replace an existing OMDataSource with a new one. * @param dataSource new OMDataSource * @return null or old OMDataSource */ public OMDataSource setDataSource(OMDataSource dataSource); } ./src/org/apache/axiom/om/OMDocument.java0000664000175000017500000000656711767656530017427 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; public interface OMDocument extends OMContainer { /** Field XML_10 XML Version 1.0 */ final static String XML_10 = "1.0"; /** Field XML_11 XML Version 1.1 */ final static String XML_11 = "1.1"; /** * Returns the document element. * * @return Returns OMElement. */ OMElement getOMDocumentElement(); /** * Sets the document element of the XML document. * * @param rootElement */ // TODO: this method and its implementations need review: // - LLOM doesn't add the element as a child (!!!) // - Neither LLOM nor DOOM updates the parent of the element // Note that OMSourcedElementImpl seems to depend on this behavior void setOMDocumentElement(OMElement rootElement); /** * Get the character set encoding scheme. This is the encoding that was used used for this * document at the time of the parsing. This is null when it is not known, such as * when the document was created in memory or from a character stream. * * @return the charset encoding for this document, or null if the encoding is not * known */ String getCharsetEncoding(); /** * Sets the character set encoding scheme to be used. * * @param charsetEncoding */ void setCharsetEncoding(String charsetEncoding); /** * Returns the XML version. * * @return Returns String. */ String getXMLVersion(); /** * Sets the XML version. * * @param version * @see org.apache.axiom.om.impl.llom.OMDocumentImpl#XML_10 XML 1.0 * @see org.apache.axiom.om.impl.llom.OMDocumentImpl#XML_11 XML 1.1 */ void setXMLVersion(String version); /** * Get the charset encoding of this document as specified in the XML declaration. * * @return the charset encoding specified in the XML declaration, or null if the * document didn't have an XML declaration or if the encoding attribute was * not specified in the XML declaration */ String getXMLEncoding(); /** * Set the charset encoding for the XML declaration of this document. * * @param encoding * the value of the encoding attribute of the XML declaration */ void setXMLEncoding(String encoding); /** * XML standalone value. This will be yes, no or null (if not available) * * @return Returns boolean. */ String isStandalone(); void setStandalone(String isStandalone); } ./src/org/apache/axiom/om/OMSerializable.java0000664000175000017500000000672011767656530020246 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** * Information item that can be serialized (written to an XML stream writer) and * deserialized (retrieved from an XML parser) as a unit. * This is the common super-interface for {@link OMDocument} and {@link OMNode}. * Note that {@link OMAttribute} and {@link OMNamespace} are information items that don't * match the definition of this interface because they can only be read from the parser * as part of a larger unit, namely an element. *

        * In accordance with the definition given above, this interface declares two sets of methods: *

          *
        • Methods allowing to control whether the information item has been completely built, * i.e. whether all events corresponding to the information item have been retrieved * from the parser.
        • *
        • Methods to write the StAX events corresponding to the information item to an * {@link XMLStreamWriter}.
        • *
        */ public interface OMSerializable { /** * Returns the OMFactory that created this object */ OMFactory getOMFactory(); /** * Indicates whether parser has parsed this information item completely or not. If some info are * not available in the item, one has to check this attribute to make sure that, this item has been * parsed completely or not. * * @return Returns boolean. */ boolean isComplete(); /** Builds itself. */ void build(); /** * If a builder and parser is associated with the node, it is closed. * @param build if true, the object is built first before closing the builder/parser */ void close(boolean build); /** * Serializes the information item with caching. This method has the same effect as * {@link #serialize(XMLStreamWriter, boolean)} with cache set to * true. * * @param xmlWriter * @throws XMLStreamException */ void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException; /** * Serializes the information item without caching. This method has the same effect as * {@link #serialize(XMLStreamWriter, boolean)} with cache set to * false. * * @param xmlWriter * @throws XMLStreamException */ void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException; /** * Serializes the information item. * * @param xmlWriter * @param cache indicates if caching should be enabled * @throws XMLStreamException */ void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException; } ./src/org/apache/axiom/om/package.html0000664000175000017500000000767611767656530017035 0ustar brianbrian Contains core interfaces of the Axiom API.

        In particular, this package defines interfaces for the information items identified by the XML Information Set W3C Recommendation:

        SectionInformation itemInterface
        2.1 Document information item {@link org.apache.axiom.om.OMDocument}
        2.2 Element information item {@link org.apache.axiom.om.OMElement}
        2.3 Attribute information item {@link org.apache.axiom.om.OMAttribute}
        2.4 Processing instruction information item {@link org.apache.axiom.om.OMProcessingInstruction}
        2.5 Unexpanded entity reference information item Not supported
        2.6 Character information item {@link org.apache.axiom.om.OMText}
        2.7 Comment information item {@link org.apache.axiom.om.OMComment}
        2.8 Document type declaration information item {@link org.apache.axiom.om.OMDocType}
        2.9 Unparsed entity information item Not supported
        2.10 Notation information item Not supported
        2.11 Namespace information item {@link org.apache.axiom.om.OMNamespace}

        The package also contains a set of super-interfaces that define common properties and operations shared by several information items: {@link org.apache.axiom.om.OMSerializable}, {@link org.apache.axiom.om.OMNode} and {@link org.apache.axiom.om.OMContainer}.

        ./src/org/apache/axiom/om/OMSerializer.java0000664000175000017500000000234511767656530017750 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; /** Interface OMSerializer */ public interface OMSerializer { /** * Method serialize * * @param reader * @param writer * @throws XMLStreamException */ void serialize(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException; } ./src/org/apache/axiom/om/OMProcessingInstruction.java0000664000175000017500000000267111767656530022217 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Interface OMProcessingInstruction */ public interface OMProcessingInstruction extends OMNode { /** * Sets the target of this Processing Instruction. * * @param target */ void setTarget(String target); /** * Gets the target of this Processing Instruction. * * @return Returns string. */ String getTarget(); /** * Sets the value of this Processing Instruction. * * @param value */ void setValue(String value); /** * Gets the value of this Processing Instruction. * * @return Returns String. */ String getValue(); } ./src/org/apache/axiom/om/OMContainer.java0000664000175000017500000002766611767656530017576 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.OutputStream; import java.io.Writer; import java.util.Iterator; /** * Captures the operations related to containment shared by both a document and an element. *

        *

        Exposes the ability to add, find, and iterate over the children of a document or element.

        */ public interface OMContainer extends OMSerializable { /** * Returns the builder object. * * @return Returns the builder object used to construct the underlying XML infoset on the fly. */ OMXMLParserWrapper getBuilder(); /** * Adds the given node as the last child. One must preserve the order of children, in this * operation. Tip : appending the new child is preferred. * * @param omNode */ // TODO: specify whether the node is removed from its original location // TODO: specify what happens if the node has been created by a foreign OMFactory void addChild(OMNode omNode); /** * Returns an iterator for child nodes matching the given QName. *

        * * @param elementQName The QName specifying namespace and local name to match. * @return Returns an iterator of {@link OMElement} items that match the given QName */ Iterator getChildrenWithName(QName elementQName); /** * Returns an iterator for child nodes matching the local name. *

        * * @param localName * @return Returns an iterator of {@link OMElement} items that match the given localName */ Iterator getChildrenWithLocalName(String localName); /** * Returns an iterator for child nodes matching the namespace uri. *

        * * @param uri * @return Returns an iterator of {@link OMElement} items that match the given uri */ Iterator getChildrenWithNamespaceURI(String uri); /** * Returns the first child in document order that matches the given QName. The QName filter is * applied in the same way as by the {@link #getChildrenWithName(QName)} method. * * @param qname * The QName to use for matching. * @return The first child element in document order that matches the qname * criteria, or null if none is found. * @throws OMException * If an error occurs during deferred parsing. * @see #getChildrenWithName(QName) */ OMElement getFirstChildWithName(QName qname) throws OMException; /** * Returns an iterator for the children of the container. * * @return Returns a {@link Iterator} of children, all of which implement {@link OMNode}. * @see #getFirstChildWithName * @see #getChildrenWithName */ Iterator getChildren(); /** * Gets the first child. * * @return Returns the first child. May return null if the container has no children. */ OMNode getFirstOMChild(); /** * Serializes the node with caching. * * @param output * @throws XMLStreamException */ void serialize(OutputStream output) throws XMLStreamException; /** * Serializes the node with caching. * * @param writer * @throws XMLStreamException */ void serialize(Writer writer) throws XMLStreamException; /** * Serializes the node with caching. * * @param output * @param format * @throws XMLStreamException */ void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node with caching. * * @param writer * @param format * @throws XMLStreamException */ void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node without caching. * * @param output * @throws XMLStreamException */ void serializeAndConsume(OutputStream output) throws XMLStreamException; /** * Serializes the node without caching. * * @param writer * @throws XMLStreamException */ void serializeAndConsume(Writer writer) throws XMLStreamException; /** * Serializes the node without caching. * * @param output * @param format * @throws XMLStreamException */ void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException; /** * Serializes the node without caching. * * @param writer * @param format * @throws XMLStreamException */ void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException; void buildNext(); /** * Get a pull parser representation of this element with caching enabled. This method has the * same effect as {@link #getXMLStreamReader(boolean)} with cache set to * true. * * @return an {@link XMLStreamReader} representation of this element */ XMLStreamReader getXMLStreamReader(); /** * Get a pull parser representation of this element with caching disabled. This method has the * same effect as {@link #getXMLStreamReader(boolean)} with cache set to * false. * * @return an {@link XMLStreamReader} representation of this element */ XMLStreamReader getXMLStreamReaderWithoutCaching(); /** * Get a pull parser representation of this element. This methods creates an * {@link XMLStreamReader} instance that produces a sequence of StAX events for this element and * its content. The sequence of events is independent of the state of this element and the value * of the cache parameter, but the side effects of calling this method and * consuming the reader are different: *

        * * * * * * * * * * * * * * * * * * * * * * * *
        StatecacheSide effects
        The element is fully built (or was created programmatically).trueNo side effects. The reader will synthesize StAX events from the object * model.
        false
        The element is partially built, i.e. deferred parsing is taking place.trueWhen a StAX event is requested from the reader, it will built the information item (if * necessary) and synthesize the StAX event. If the caller completely consumes the reader, the * element will be completely built. Otherwise it will be partially built.
        falseThe reader will delegate to the underlying parser starting from the event corresponding * to the last information item that has been built. In other words, after synthesizing a number * of events, the reader will switch to delegation mode. An attempt to access the object model * afterwards will result in an error.
        *

        * To free any resources associated with the returned reader, the caller MUST invoke the * {@link XMLStreamReader#close()} method. *

        * The returned reader MAY implement the extension defined by * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} and any binary content will * be reported using this extension. More precisely, if the object model contains an * {@link OMText} instance with {@link OMText#isBinary()} returning true (or * would contain such an instance after it has been fully built), then its data will always be * exposed through this extension. *

        * The caller MUST NOT make any other assumption about the returned reader, in particular about * its runtime type. *

        * Note (non normative): For various reasons, existing code based on Axiom versions * prior to 1.2.9 makes assumptions on the returned reader that should no longer be considered * valid: *

          *
        • Some code assumes that the returned reader is an instance of * {@link org.apache.axiom.om.impl.OMStAXWrapper}. While it is true that Axiom internally uses * this class to synthesize StAX events, it may wrap this instance in another reader * implementation. E.g. depending on the log level, the reader will be wrapped using * {@link org.apache.axiom.om.util.OMXMLStreamReaderValidator}. This was already the case in * Axiom versions prior to 1.2.9. It should also be noted that instances of * {@link OMSourcedElement} (which extends the present interface) may return a reader that is * not implemented using {@link org.apache.axiom.om.impl.OMStAXWrapper}.
        • *
        • Some code uses the {@link OMXMLStreamReader} interface of the returned reader to switch * off MTOM inlining using {@link OMXMLStreamReader#setInlineMTOM(boolean)}. This has now been * deprecated and it is recommended to use * {@link org.apache.axiom.util.stax.xop.XOPEncodingStreamReader} instead.
        • *
        • Some existing code uses the {@link OMAttachmentAccessor} interface of the returned * reader to fetch attachments using {@link OMAttachmentAccessor#getDataHandler(String)}. There * is no reason anymore to do so:
        • *
            *
          • When {@link OMXMLStreamReader#setInlineMTOM(boolean)} is used to disable MTOM inlining, * {@link OMAttachmentAccessor#getDataHandler(String)} must be used to retrieve the binary * content. The fact that this method is deprecated removes the need for this.
          • *
          • In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485). This made it * necessary for the caller to (partially) handle the XOP processing and to use * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content. Starting * with 1.2.9 this is no longer be the case: as specified above, the sequence of events is * independent of the state of the object model and the value of the cache * parameter, and all binary content is reported through the * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} extension.
          • *
          • Finally, it should be noted that {@link OMAttachmentAccessor#getDataHandler(String)} * doesn't give access to the attachments in the SwA case (neither in 1.2.9 nor in previous * versions).
          • *
          *
        *

        * Code making any of these assumptions should be fixed, so that only {@link XMLStreamReader} * and {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} are used (and if * necessary, {@link org.apache.axiom.util.stax.xop.XOPEncodingStreamReader}). * * @param cache * indicates if caching should be enabled * @return an {@link XMLStreamReader} representation of this element */ XMLStreamReader getXMLStreamReader(boolean cache); } ./src/org/apache/axiom/om/OMXMLParserWrapper.java0000664000175000017500000001075311767656530021017 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Interface OMXMLParserWrapper */ public interface OMXMLParserWrapper { /** * Proceed the parser one step and return the event value. * * @return Returns int. * @throws org.apache.axiom.om.OMException * * @throws OMException */ int next() throws OMException; /** * Discards the current element. This will remove the given element and its descendants. * * @param el * @throws OMException * * @throws OMException */ void discard(OMElement el) throws OMException; /** * @param b * @throws org.apache.axiom.om.OMException * * @throws OMException */ void setCache(boolean b) throws OMException; /** * @return true if caching */ boolean isCache(); /** * Allows to access the underlying parser. Since the parser depends on the underlying * implementation, an Object is returned. However the implementations may have restrictions in * letting access to the parser. * * @return Returns Object. */ Object getParser(); /** @return Returns the complete status. */ boolean isCompleted(); /** * Get the document being built by this builder. * * @return the {@link OMDocument} instance */ OMDocument getDocument(); /** * Get the document element, i.e. the root element of the document. Using this method is * equivalent to using {@link OMDocument#getOMDocumentElement()} on the document returned by * {@link #getDocument()}. * * @return the document element */ OMElement getDocumentElement(); /** * Get the document element, optionally discarding the document. The return value of this method * is the same as {@link #getDocumentElement()}. However, if the discardDocument * parameter is set to true, then the document element is removed from the document * and the document itself is discarded. In contrast to using {@link OMElement#detach()} this * will not build the element. The implementation also ensures that the element is not built * when it is added to another OM tree. This makes it possible to add the content of a document * to an existing OM tree while preserving the deferred parsing feature. It is even possible to * create an OM tree where different subtrees are associated with different builder instances. * * @param discardDocument * specifies whether the document should be discarded * @return the document element */ OMElement getDocumentElement(boolean discardDocument); /** * Returns the type of the builder. Can be either {@link OMConstants#PUSH_TYPE_BUILDER} * or {@link OMConstants#PULL_TYPE_BUILDER}. * * @return Returns short. */ short getBuilderType(); /** * Registers an external content handler. Especially useful for push type builders. Throws an * unsupportedOperationException if such handler registration is not supported. * * @param obj */ void registerExternalContentHandler(Object obj); /** * get the registered external content handler * * @return Returns Object. */ Object getRegisteredContentHandler(); /** * Returns the encoding style of the XML data * @return the character encoding, defaults to "UTF-8" */ public String getCharacterEncoding(); /** * Close this builder. This method frees the resources associated with this builder. In * particular, it releases the resources held by the underlying parser. This method does * not close the underlying input source. */ void close(); } ./src/org/apache/axiom/om/OMConstants.java0000664000175000017500000000620111767656530017606 0ustar brianbrian/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to 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.axiom.om; /** Interface OMConstants */ public interface OMConstants { // OMBuilder constants /** Field PUSH_TYPE_BUILDER */ static final short PUSH_TYPE_BUILDER = 0; /** Field PULL_TYPE_BUILDER */ static final short PULL_TYPE_BUILDER = 1; /** Field ARRAY_ITEM_NSURI */ static final String ARRAY_ITEM_NSURI = "http://axis.apache.org/encoding/Arrays"; /** Field ARRAY_ITEM_LOCALNAME */ static final String ARRAY_ITEM_LOCALNAME = "item"; /** Field ARRAY_ITEM_NS_PREFIX */ static final String ARRAY_ITEM_NS_PREFIX = "arrays"; /** Field ARRAY_ITEM_QNAME */ static final String ARRAY_ITEM_QNAME = OMConstants.ARRAY_ITEM_NS_PREFIX + ':' + OMConstants.ARRAY_ITEM_LOCALNAME; /** Field DEFAULT_CHAR_SET_ENCODING specifies the default character encoding scheme to be used */ static final String DEFAULT_CHAR_SET_ENCODING = "utf-8"; static final String DEFAULT_XML_VERSION = "1.0"; static final String XMLNS_URI = "http://www.w3.org/XML/1998/namespace"; static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; final static String XMLNS_NS_PREFIX = "xmlns"; static final String XMLNS_PREFIX = "xml"; /** * @deprecated * * @see org.apache.axiom.util.stax.XMLStreamReaderUtils */ String IS_BINARY = "Axiom.IsBinary"; /** * @deprecated * * @see org.apache.axiom.util.stax.XMLStreamReaderUtils */ String DATA_HANDLER = "Axiom.DataHandler"; /** * @deprecated * * @see org.apache.axiom.util.stax.XMLStreamReaderUtils */ String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing"; /** No its not a mistake. This is the default nsURI of the default namespace of a node */ static final String DEFAULT_DEFAULT_NAMESPACE = "\"\""; static final String XMLATTRTYPE_CDATA = "CDATA"; static final String XMLATTRTYPE_ID = "ID"; static final String XMLATTRTYPE_IDREF = "IDREF"; static final String XMLATTRTYPE_IDREFS = "IDREFS"; static final String XMLATTRTYPE_NMTOKEN = "NMTOKEN"; static final String XMLATTRTYPE_NMTOKENS = "NMTOKENS"; static final String XMLATTRTYPE_ENTITY = "ENTITY"; static final String XMLATTRTYPE_ENTITIES = "ENTITIES"; static final String XMLATTRTYPE_NOTATION = "NOTATION"; } ./src/org/codehaus/0000775000175000017500000000000011767656530013356 5ustar brianbrian./src/org/codehaus/annogen/0000775000175000017500000000000011767656530015003 5ustar brianbrian./src/org/codehaus/annogen/override/0000775000175000017500000000000011767656530016622 5ustar brianbrian./src/org/codehaus/annogen/override/ElementId.java0000664000175000017500000000376111767656530021342 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; /** * Generic identifier for some annotatable java element such as a class or * method. * This abstraction allows annogen to work with an arbitrary set of * java type system APIs, e.g. reflection and javadoc. Note that * various ElementIdPools are provided for creating and pooling Ids using * various APIs. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface ElementId { // ======================================================================== // Constants //would be nice to use enums, but it's not an option since we want to support 1.4 public static final int PACKAGE_TYPE = 0; public static final int CLASS_TYPE = 1; public static final int FIELD_TYPE = 2; public static final int METHOD_TYPE = 3; public static final int CONSTRUCTOR_TYPE = 4; public static final int PARAMETER_TYPE = 5; public static final int ANNOTATION_TYPE = 6; public static final int NO_PARAMETER = -1; // ======================================================================== // Public methods //public ElementId getEnclosingElement(); public int getType(); public String getName(); public String getContainingClass(); //public String getContainingPackage(); public String[] getSignature(); public int getParameterNumber(); } ./src/org/codehaus/annogen/override/AnnoBean.java0000664000175000017500000000421511767656530021150 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; /** *

        Provides a proxied, modifiable view of a JSR175 annotation. * Implementations of this interface are usually code-generated by the * AnnogenTask.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface AnnoBean { // ======================================================================== // Constants /** *

        Name of the member of annotations which have only a single member. * As specified in JSR175, that name is "value", but you should use * this constant to prevent typos.

        */ public static final String SINGLE_MEMBER_NAME = "value"; // ======================================================================== // Public methods public boolean setValue(String name, Object value); /** * Returns an instance of an AnnoBean for the given annotation type * which can be used as an AnnoBean for a nested annotation value. * This does NOT 'add' the nested annotation to this AnnoBean - it is * expected that the caller will later pass it as the value parameter * of a subsequent call to setValue. * * Note that this can also be used for constructing elements of an * array of nested annotation values. */ public AnnoBean createNestableBean(Class beanOrAnnoType); //uncomment these when have time to implement them /** */ //public Object getValue(String name); //public boolean isDefaultValueUsed(String valueName); } ./src/org/codehaus/annogen/override/AnnoOverrider.java0000664000175000017500000000446611767656530022254 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; /** *

        * Modifes the annotations which apply to some annotated java element. * AnnoOverrider is essentially a callback mechanism - it is consulted when * an AnnnoViewer receives requests to view the annotations on a particular * element. This model was chosen in the interests of efficiency, since * the overrider doesn't have to worry about whether it's wasting time * overriding annotations that will never be used anyway. *

        * *

        * However, the callback approach can be ungainly, in the information * you need to override annotations may not be readily available to you * when it comes time to view the annotations. To help with this problem, * see the StoredAnnoOverrider, which lets you determine your annotation * overrides in a single pass and store them for later use in the View phase. *

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface AnnoOverrider { // ======================================================================== // Public methods /** *

        Provides the Populator with a context object to access various services * such as logging. For a given instance, this method is guranteed to be * called exactly once and before any other methods in this interface.

        */ public void init(AnnoContext pc); /** *

        Called to give this Overrider a chance to modify the annotations which * apply to a given element.

        * * @param id Element to which the annotations apply. * @param currentAnnos Currently viewed annotations. */ public void modifyAnnos(ElementId id, AnnoBeanSet currentAnnos); } ./src/org/codehaus/annogen/override/AnnoBeanSet.java0000664000175000017500000000224611767656530021626 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; /** * Encapsualtes a set of AnnoBeans which apply to some element in the java * type system, such as a class, method, or field. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface AnnoBeanSet { public boolean containsBeanFor(Class annoClass); public AnnoBean findOrCreateBeanFor(Class annoClass); public AnnoBean removeBeanFor(Class annoClass); public AnnoBean[] getAll(); public int size(); public void put(AnnoBean ap); } ./src/org/codehaus/annogen/override/StoredAnnoOverrider.java0000664000175000017500000000472311767656530023431 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; import org.codehaus.annogen.override.internal.StoredAnnoOverriderImpl; /** *

        * Convenience implementation of AnnoOverrider to which you simply add * annotations that should apply to given elements. Note that this is * a fairly blunt instrunmennt - the annotations you specify are simply * and unconditionally superimposed onto each element. *

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface StoredAnnoOverrider extends AnnoOverrider { // ======================================================================== // Factory /** * Static factory for StoredAnnoOverriders. */ public static class Factory { public static StoredAnnoOverrider create() { return new StoredAnnoOverriderImpl(); } } // ======================================================================== // Public methods /** *

        * Returns an AnnoBeanSet from this StoredAnnoOverrider which applies to * the given ElementId. This will always create a new AnnoBeanSet unless * findOrCreate... has been called previously for the given id on * this instance of StoredAnnoOverrider. *

        * *

        * Important: The AnnoBeanSet returned by this method will NOT * contain any indigenous annotation information from the given element. * The AnnoBeanSets returned here are ALWAYS EMPTY - it's up to you to * fill them in. *

        * *

        * If you need to be able to dynamically read indigenous values before * making changes, then you must implement AnnoViewer directly yourself - * StoredAnnoViewer is a simple extension and not designed to handle * that sort of thing. *

        */ public AnnoBeanSet findOrCreateStoredAnnoSetFor(ElementId id); } ./src/org/codehaus/annogen/override/AnnoContext.java0000664000175000017500000000443511767656530021733 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override; import org.codehaus.annogen.view.internal.AnnoViewerParamsImpl; import org.codehaus.jam.provider.JamLogger; /** * Provides some context services for overriders. REVIEW does this actually * need to be exposed? * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface AnnoContext { // ======================================================================== // Factory implementation public static class Factory { public static AnnoContext newInstance() { return new AnnoViewerParamsImpl(); } } // ======================================================================== // Public methods /** *

        If the given class is a 175 annotation type, returns the annogen'ed * class which acts as a proxy to it. If the given class already is a * annobean class, simply returns it.

        * * @throws ClassNotFoundException if the bean class could not be loaded */ Class getAnnobeanClassFor(Class declOrAnnoBeanClass) throws ClassNotFoundException; /** *

        Returns the 175 annotation class which corresponds to the given * annobean class.

        * * @throws IllegalArgumentException if the given class is not an annobean class. * @throws IllegalStateException if the current vm is pre-1.5. * @throws ClassNotFoundException if the 175 type could not be loaded */ Class getJsr175ClassForAnnobeanClass(Class annoBeanClass) throws ClassNotFoundException; public JamLogger getLogger(); public ClassLoader getClassLoader(); public AnnoBean createAnnoBeanFor(Class annoBeanClass); } ./src/org/codehaus/annogen/override/internal/0000775000175000017500000000000011767656530020436 5ustar brianbrian./src/org/codehaus/annogen/override/internal/AnnoBeanBase.java0000664000175000017500000001025311767656530023556 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override.internal; import org.codehaus.annogen.generate.Annogen; import org.codehaus.annogen.override.AnnoBean; import org.codehaus.annogen.override.AnnoContext; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** *

        Base implementation of AnnotationBean. This serves as a base for * classes generated by annogen. Its main responsibility is to accept * 'set value' requests from a AnnoOverrider and transform them into * reflective invocations on methods on the extending class.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public /*abstract*/ class AnnoBeanBase implements AnnoBean { // ======================================================================== // Variables private AnnoContext mContext = null; // ======================================================================== // AnnoBean implementation /** * Just try to set the value via reflection. */ public boolean setValue(String valueName, Object value) { assertInited(); String methodName = Annogen.SETTER_PREFIX + valueName; Method[] m = this.getClass().getMethods(); for(int i=0; i 0) { int i=0; while(true) { out.write(sig[i++]); if (i == sig.length) break; out.write(','); } } out.write(')'); if (getType() != PARAMETER_TYPE) return out.toString(); out.write('['); out.write(getParameterNumber()); out.write(']'); return out.toString(); } default: throw new IllegalStateException(); } } } ./src/org/codehaus/annogen/override/internal/StoredAnnoOverriderImpl.java0000664000175000017500000000543711767656530026072 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.override.internal; import org.codehaus.annogen.override.AnnoBean; import org.codehaus.annogen.override.AnnoBeanSet; import org.codehaus.annogen.override.AnnoContext; import org.codehaus.annogen.override.ElementId; import org.codehaus.annogen.override.StoredAnnoOverrider; import java.util.HashMap; import java.util.Map; /** * Utility class which lets you create annotations that will be * used on specific elements. * * Note that this is a fairly blunt instrument - an annotation * added here will completely override that annotation in * the original code, if it appears there. * * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class StoredAnnoOverriderImpl implements StoredAnnoOverrider { // ======================================================================== // Variables private Map mId2APS = new HashMap(); private AnnoContext mContext; // ======================================================================== // Constructors public StoredAnnoOverriderImpl(AnnoContext ctx) { if (ctx == null) throw new IllegalArgumentException("null ctx"); mContext = ctx; } public StoredAnnoOverriderImpl() { mContext = AnnoContext.Factory.newInstance(); } // ======================================================================== // StoredAnnoOverrider implementation public AnnoBeanSet findOrCreateStoredAnnoSetFor(ElementId id) { AnnoBeanSet out = (AnnoBeanSet)mId2APS.get(id); if (out == null) { out = new AnnoBeanSetImpl(mContext); mId2APS.put(id,out); } return out; } // ======================================================================== // AnnoOverrider implementation public void init(AnnoContext ctx) { mContext = ctx; } public void modifyAnnos(ElementId id, AnnoBeanSet currentAnnos) { AnnoBeanSet stored = (AnnoBeanSet)mId2APS.get(id); if (stored == null) return; AnnoBean[] proxies = stored.getAll(); if (proxies == null || proxies.length == 0) return; for(int i=0; i

        Supports the Override Phase in which AnnoBeans can be added, modified or removed.

        ./src/org/codehaus/annogen/generate/0000775000175000017500000000000011767656530016575 5ustar brianbrian./src/org/codehaus/annogen/generate/AnnoBeanMapping.java0000664000175000017500000001307511767656530022443 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate; /** * Encapsulates the delcaration of a one-to-one mapping of some set of * 175 annotation types to their corresponding annotation beans. The mapping * is declared as a pair of strings, e.g. * * typePattern = com.foo.MyAnnotation * beanPattern = com.foo.annobeans.MyAnnotationBean * * This implementation also supports a simple wildcard substituion using '*', * e.g. * * * typePattern = com.foo.*Annotation * beanPattern = com.foo.annobeans.*AnnotationBean * * The rule for matching is that a type matches if the type name startsWith * the part of the pattern before the *, and endsWith everything after the * *. Everything inbetween is substituted for the '*' in the beanPattern. * It is an error for only one fo the type and beanPatterns to contain * a *, or for either to contain more than one *. * * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class AnnoBeanMapping { // ======================================================================== // Constants private static final char WILD = '*'; private static final boolean VERBOSE = false; // ======================================================================== // Variables private String mTypePattern; private String mBeanPattern; private String mTypeBeforeStar = null; private String mTypeAfterStar = null; private String mBeanBeforeStar = null; private String mBeanAfterStar = null; // ======================================================================== // Constructor public AnnoBeanMapping() {} public AnnoBeanMapping(String typePattern, String beanPattern) { setType(typePattern); setBean(beanPattern); } // ======================================================================== // Public methods /** * If the annnotation type represented by the named class matches this * mapping's typePattern, returns the name of the annobean which it should * be mapped to. If the type doesn't match, null is returned. */ public String getAnnoBeanFor(String classname) { if (classname == null) throw new IllegalArgumentException("null classname"); classname = classname.trim(); if (VERBOSE) { verbose("============="); verbose("checking "+classname); verbose("against "+mTypePattern); } if (mBeanBeforeStar == null && mTypeBeforeStar == null) { if (mTypePattern.equals(classname)) { if (VERBOSE) verbose("No star, match!"); return mBeanPattern; } else { if (VERBOSE) verbose("No star, no match"); return null; } } if (mBeanBeforeStar == null) { throw new IllegalStateException(WILD+" must be specified in both bean and type"); } if (mTypeBeforeStar == null) { throw new IllegalStateException(WILD+" must be specified in both bean and type"); } if (VERBOSE) verbose("typeBefore="+mTypeBeforeStar); if (VERBOSE) verbose("typeAfter="+mTypeAfterStar); if (classname.startsWith(mTypeBeforeStar) && (mTypeAfterStar == null || classname.endsWith(mTypeAfterStar))) { if (VERBOSE) verbose("...matched the front "+classname.startsWith(mTypeBeforeStar)); String sub = classname.substring(mTypeBeforeStar.length(), classname.length() - (mTypeAfterStar == null ? 0 : mTypeAfterStar.length())); String out = mBeanBeforeStar + sub + (mBeanAfterStar == null ? "" : mBeanAfterStar); if (VERBOSE) verbose("result is "+out); return out; } return null; } // ======================================================================== // Properties public String getType() { return mTypePattern; } public void setType(String type) { if (type == null) throw new IllegalArgumentException("null type"); if (type.length() == 0) throw new IllegalArgumentException("empty type"); mTypePattern = type.trim(); int wild; if ((wild = type.indexOf(WILD)) != -1) { mTypeBeforeStar = mTypePattern.substring(0,wild); if (wild == mTypePattern.length() -1) { //if it's the last char mTypeAfterStar = null; } else { mTypeAfterStar = mTypePattern.substring(wild+1); } } } public String getBean() { return mBeanPattern; } public void setBean(String bean) { if (bean == null) throw new IllegalArgumentException("null bean"); if (bean.length() == 0) throw new IllegalArgumentException("empty bean"); mBeanPattern = bean; int wild; if ((wild = bean.indexOf(WILD)) != -1) { mBeanBeforeStar= mBeanPattern.substring(0,wild); if (wild == mBeanPattern.length()) { mBeanBeforeStar= null; } else { mBeanAfterStar = mBeanPattern.substring(wild+1); } } } // ======================================================================== // Private methods private static final void verbose(String msg) { System.out.println("[AnnoBeanMapping] "+ msg); } }./src/org/codehaus/annogen/generate/internal/0000775000175000017500000000000011767656530020411 5ustar brianbrian./src/org/codehaus/annogen/generate/internal/PropfileUtils.java0000664000175000017500000001117511767656530024062 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal; import org.codehaus.jam.JClass; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * Singleton utility class which encapsulates details of reading and writing * the annobean classname associated with each JSR175 type compiled by * annogen. We stuff the name of the annobean type away in one magic * properties file per-175 type. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class PropfileUtils { // ======================================================================== // Constants private static final String PROPFILE_SUFFIX = ".annogen.properties"; private static final String ANNOBEAN_PROP = "annobean"; // ======================================================================== // Singleton private static final PropfileUtils INSTANCE = new PropfileUtils(); public static PropfileUtils getInstance() { return INSTANCE; } private PropfileUtils() {} // ======================================================================== // Public utility methods /** * Writes out a properties file to disk to map the given 175 type to * the named annobean type. The rootDir should be the root of the * classpath element where the annobeanType will be written. */ public void writeAnnobeanTypeFor(JClass jsr175type, String annobeanType, File rootDir) throws IOException { if (jsr175type == null) throw new IllegalArgumentException("null 175 type"); if (annobeanType == null) throw new IllegalArgumentException("null annobeanType"); if (rootDir == null) throw new IllegalArgumentException("null rootDir"); Properties props = new Properties(); props.setProperty(ANNOBEAN_PROP,annobeanType); writeProperties(jsr175type,props,rootDir); } /** * Returns the name of the annobean type to which the given jsr175type maps. * The properties file containing the mapping must be loadable in the given * classloader (should be the same classloader that the annobean class will * be loaded from). */ public Class getAnnobeanTypeFor(Class jsr175type, ClassLoader cl) throws IOException, ClassNotFoundException { Properties typeProps = getPropfileForAnnotype(jsr175type, cl); String name = typeProps.getProperty(ANNOBEAN_PROP); if (name == null) throw new IllegalStateException("no "+ANNOBEAN_PROP+ " in "+typeProps); return cl.loadClass(name); } // ======================================================================== // Private methods private void writeProperties(JClass jsr175type, Properties props, File rootDir) throws IOException { String propFile = jsr175type.getQualifiedName().replace('.',File.separatorChar); File file = new File(rootDir, propFile+PROPFILE_SUFFIX); if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { throw new IOException("failed to create "+file.getParentFile()); } FileOutputStream fos = null; try { fos = new FileOutputStream(file); props.store(fos,null); } catch(RuntimeException e) { throw e; } catch(IOException e) { throw e; } finally { if (fos != null) fos.close(); } } public Properties getPropfileForAnnotype(Class jsr175type, ClassLoader cl) throws IOException { String propFile = jsr175type.getName().replace('.',File.separatorChar)+ PROPFILE_SUFFIX; InputStream in = cl.getResourceAsStream(propFile); if (in == null) throw new IOException("Could not load "+propFile); Properties out = new Properties(); try { out.load(in); } catch(IOException e) { throw e; } catch(RuntimeException re) { throw re; } finally { in.close(); } return out; } } ./src/org/codehaus/annogen/generate/internal/joust/0000775000175000017500000000000011767656530021555 5ustar brianbrian./src/org/codehaus/annogen/generate/internal/joust/CompilingJavaOutputStream.java0000664000175000017500000001447111767656530027547 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * This a SourceJavaOutputStream which can compile it's results when * close() is called. It always writes source files to disk. * * @author Patrick Calaham */ public class CompilingJavaOutputStream extends SourceJavaOutputStream implements WriterFactory { // ======================================================================== // Constants private static final String PREFIX = "[CompilingJavaOutputStream] "; // ======================================================================== // Variables private FileWriterFactory mWriterFactoryDelegate; private List mSourceFiles; private File mCompileDir = null; private File[] mJavacClasspath = null; private boolean mKeepGenerated; private String mJavacPath = null; private boolean mDoCompile = true; private String mEncoding = null; private File mSourceDir = null; // ======================================================================== // Constructors /** * Construct a new CompilingJavaOutputStream which generates java sources * in the given directory. * * @param srcDir Directory in which sources get generated. */ public CompilingJavaOutputStream(File srcDir) { this(); setSourceDir(srcDir); } /** * Constructs a new CompilingJavaOutputStream. Note that if you use * this default constructor, you *must* call setSourceDir at some point * before the stream is used; failure to do so will produce an * IllegalStateException. */ public CompilingJavaOutputStream() { super(); setWriterFactory(this); mSourceFiles = new ArrayList(); } // ======================================================================== // Public methods //REVIEW the naming this directory 'source' seems a little confusing /** * Sets the source directory to which files will be written. This can * safely be changed mistream if desired. */ public void setSourceDir(File srcDir) { if (srcDir == null) throw new IllegalArgumentException("null srcDir"); mWriterFactoryDelegate = null; mSourceDir = srcDir; } /** * Sets the encoding to use for writing java sources. */ public void setEncoding(String enc) { mWriterFactoryDelegate = null; mEncoding = enc; } /** * Enables compilation of the generated source files into the given * directory. If this method is never called, no compilation will occur. */ public void setCompilationDir(File destDir) { mCompileDir = destDir; } /** * Sets the location of javac to be invoked. Default compiler is used * if this is not set. Ignored if compilationDir is never set. */ public void setJavac(String javacPath) { mJavacPath = javacPath; } /** * Sets the classpath to use for compilation. System classpath is used * by default. This is ignored if compilationDir is never set. */ public void setJavacClasspath(File[] classpath) { mJavacClasspath = classpath; } /** * Sets whether generated sources should be kept after compilation. * Default is true. This is ignored if compilationDir is never set. */ public void setKeepGenerated(boolean b) { mKeepGenerated = b; } /** * Sets whether javac should be run on the generated sources. Default * is true. */ public void setDoCompile(boolean b) { mDoCompile = b; } // ======================================================================== // WriterFactory implementation /** * Delegate to FileWriterFactory, but ask it for Files instead of Writers * so that we can keep track of what we need to compile later. */ public Writer createWriter(String packageName, String className) throws IOException { if (mWriterFactoryDelegate == null) { if (mSourceDir == null) { throw new IllegalStateException("setSourceDir must be called"); } mWriterFactoryDelegate = (mEncoding != null) ? new FileWriterFactory(mSourceDir, mEncoding) : new FileWriterFactory(mSourceDir); } File out = mWriterFactoryDelegate.createFile(packageName,className); mSourceFiles.add(out); return new FileWriter(out); } // ======================================================================== // JavaOutputStream implementation public void close() throws IOException { super.close(); verbose("closing"); if (mDoCompile && mCompileDir != null) { verbose("compileDir = "+mCompileDir); Iterator i = mSourceFiles.iterator(); while(i.hasNext()) { verbose(i.next().toString()); } boolean verbose = mLogger.isVerbose(this); boolean result = mSourceFiles.size() > 0 ? CodeGenUtil. externalCompile(mSourceFiles,mCompileDir,mJavacClasspath, verbose,mJavacPath,null,null,!verbose,verbose) : true; verbose("compilation result: "+result); if (!result) { throw new IOException("Compilation of sources failed, " + "check log for details."); } if (!mKeepGenerated) { for(Iterator j = mSourceFiles.iterator(); j.hasNext(); ) { File f = (File)j.next(); verbose("deleting "+f); f.delete(); } } } } private void verbose(String msg) { if (mLogger.isVerbose(this)) { mLogger.verbose(PREFIX+" "+msg); } } }./src/org/codehaus/annogen/generate/internal/joust/Annotation.java0000664000175000017500000000267111767656530024540 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; /** * Interface for building up metadata declarations in the generated source. * Typically, an instance of this class will be written out as javadoc tags * or JSR175 annotations. However, not that this interface is indifferent * about that question - JavaOutputStream implementation decides how to * actually write out an Annotation. * * @author Patrick Calahan */ public interface Annotation { public void setValue(String name, Annotation ann); public void setValue(String name, boolean value); public void setValue(String name, String value); public void setValue(String name, int value); public void setValue(String name, long value); public void setValue(String name, char value); } ./src/org/codehaus/annogen/generate/internal/joust/Expression.java0000664000175000017500000000304211767656530024556 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; /** * Provides a handle to a java expression in the generated code. * * @author Patrick Calahan */ public interface Expression { /** * This value is provided by and used only by implementations of * JavaOutputStream. The memento is simply a place for the implementation * to hang a reference to some domain object that the Expression actually * represents. */ public Object getMemento(); //REVIEW maybe we don't need to expose memento at all - just let them //implement it however they want and cast down to get the info. Often //as not, they may just want to implement toString(). /** * Provides a textual representation of the expression. This should * only be used for logging or debugging purposes. */ // public String getLabel(); //not clear to me this is worthwhile } ./src/org/codehaus/annogen/generate/internal/joust/CodeGenUtil.java0000664000175000017500000003260211767656530024565 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.BufferedReader; import java.io.File; import java.io.FileFilter; import java.io.FileWriter; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; public class CodeGenUtil { public static final String DEFAULT_MEM_START = "8m"; public static final String DEFAULT_MEM_MAX = "256m"; public static final String DEFAULT_COMPILER = "javac"; public static final String DEFAULT_JAR = "jar"; //workaround for Sun bug # 4723726 public static URI resolve(URI base, URI child) { URI ruri = base.resolve(child); //fix up normalization bug if ("file".equals(ruri.getScheme()) && ! child.equals(ruri)) { if (base.getPath().startsWith("//") && !ruri.getPath().startsWith("//")) { String path = "///".concat(ruri.getPath()); try { ruri = new URI("file", null, path, ruri.getQuery(), ruri.getFragment()); } catch(URISyntaxException uris) {} } } return ruri; } static void addAllJavaFiles(List srcFiles, List args) { for (Iterator i = srcFiles.iterator(); i.hasNext(); ) { File f = (File)i.next(); if (!f.isDirectory()) { args.add(quoteAndEscapeFilename(f.getAbsolutePath())); } else { List inside = (Arrays.asList(f.listFiles( new FileFilter() { public boolean accept(File file) { return (file.isFile() && file.getName().endsWith(".java")) || file.isDirectory(); } } ))); addAllJavaFiles(inside, args); } } } static private String quoteAndEscapeFilename(String filename) { // don't quote if there's no space if (filename.indexOf(" ") < 0) return filename; // bizarre. javac expects backslash escaping if we quote the classpath // bizarre also. replaceAll expects replacement backslashes to be double escaped. return "\"" + filename.replaceAll("\\\\", "\\\\\\\\") + "\""; } static private String quoteNoEscapeFilename(String filename) { // don't quote if there's no space, and don't quote on linux if (filename.indexOf(" ") < 0 || File.separatorChar == '/') return filename; return "\"" + filename + "\""; } /** * Invokes javac on the generated source files in order to turn them * into binary files in the output directory. This will return a list of * GenFiles for all of the classes produced or null if an * error occurred. * * @deprecated */ static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug) { return externalCompile(srcFiles, outdir, cp, debug, DEFAULT_COMPILER, DEFAULT_MEM_START, DEFAULT_MEM_MAX, false, false); } /** * Invokes javac on the generated source files in order to turn them * into binary files in the output directory. This will return a list of * GenFiles for all of the classes produced or null if an * error occurred. */ static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug, String javacPath, String memStart, String memMax, boolean quiet, boolean verbose) { List args = new ArrayList(); File javac = findJavaTool(javacPath == null ? DEFAULT_COMPILER : javacPath); assert (javac.exists()) : "compiler not found " + javac; args.add(javac.getAbsolutePath()); if (outdir == null) { outdir = new File("."); } else { args.add("-d"); args.add(quoteAndEscapeFilename(outdir.getAbsolutePath())); } if (cp == null) { cp = systemClasspath(); } if (cp.length > 0) { StringBuffer classPath = new StringBuffer(); // Add the output directory to the classpath. We do this so that // javac will be able to find classes that were compiled // previously but are not in the list of sources this time. classPath.append(outdir.getAbsolutePath()); // Add everything on our classpath. for (int i = 0; i < cp.length; i++) { classPath.append(File.pathSeparator); classPath.append(cp[i].getAbsolutePath()); } args.add("-classpath"); // bizarre. javac expects backslash escaping if we quote the classpath args.add(quoteAndEscapeFilename(classPath.toString())); } args.add("-source"); args.add("1.4"); args.add(debug ? "-g" : "-g:none"); if (verbose) args.add("-verbose"); addAllJavaFiles(srcFiles, args); File clFile = null; try { clFile = File.createTempFile("javac", ""); FileWriter fw = new FileWriter(clFile); Iterator i = args.iterator(); for (i.next(); i.hasNext();) { String arg = (String)i.next(); fw.write(arg); fw.write('\n'); } fw.close(); List newargs = new ArrayList(); newargs.add(args.get(0)); if (memStart != null && memStart.length() != 0) newargs.add("-J-Xms" + memStart); if (memMax != null && memMax.length() != 0) newargs.add("-J-Xmx" + memMax); newargs.add("@" + clFile.getAbsolutePath()); args = newargs; } catch (Exception e) { System.err.println("Could not create command-line file for javac"); } try { String[] strArgs = (String[]) args.toArray(new String[args.size()]); if (verbose) { System.out.print("compile command:"); for (int i = 0; i < strArgs.length; i++) System.out.print(" " + strArgs[i]); System.out.println(); } final Process proc = Runtime.getRuntime().exec(strArgs); StringBuffer errorBuffer = new StringBuffer(); StringBuffer outputBuffer = new StringBuffer(); ThreadedReader out = new ThreadedReader(proc.getInputStream(), outputBuffer); ThreadedReader err = new ThreadedReader(proc.getErrorStream(), errorBuffer); proc.waitFor(); if (verbose || proc.exitValue() != 0) { if (outputBuffer.length() > 0) { System.out.println(outputBuffer.toString()); System.out.flush(); } if (errorBuffer.length() > 0) { System.err.println(errorBuffer.toString()); System.err.flush(); } if (proc.exitValue() != 0) return false; } } catch (Throwable e) { System.err.println(e.toString()); System.err.println(e.getCause()); e.printStackTrace(System.err); return false; } if (clFile != null) clFile.delete(); return true; } public static File[] systemClasspath() { List cp = new ArrayList(); String[] systemcp = System.getProperty("java.class.path").split(File.pathSeparator); for (int i = 0; i < systemcp.length; i++) { cp.add(new File(systemcp[i])); } return (File[])cp.toArray(new File[cp.size()]); } //Note - I have added a new class, JarHelper, in impl.common which provides //more jarring functionality and does not require invoking jar.exe. You //may want to consider migrating your code to use this as it will be //considerably faster. codehaus 12/10/2003 /** * @deprecated Use org.apache.xmlbeans.impl.common.JarHelper instead. */ static public boolean externalJar(File srcdir, File outfile) { return externalJar(srcdir, outfile, DEFAULT_JAR, false, false); } /** * @deprecated Use org.apache.xmlbeans.impl.common.JarHelper instead. */ static public boolean externalJar(File srcdir, File outfile, String jarPath, boolean quiet, boolean verbose) { List args = new ArrayList(); File jar = findJavaTool(jarPath == null ? DEFAULT_JAR : jarPath); assert (jar.exists()) : "jar not found " + jar; args.add(jar.getAbsolutePath()); args.add("cf" + (verbose ? "v" : "")); args.add(quoteNoEscapeFilename(outfile.getAbsolutePath())); args.add("-C"); args.add(quoteNoEscapeFilename(srcdir.getAbsolutePath())); args.add("."); try { String[] strArgs = (String[]) args.toArray(new String[args.size()]); if (verbose) { System.out.print("jar command:"); for (int i = 0; i < strArgs.length; i++) System.out.print(" " + strArgs[i]); System.out.println(); } final Process proc = Runtime.getRuntime().exec(strArgs); StringBuffer errorBuffer = new StringBuffer(); StringBuffer outputBuffer = new StringBuffer(); ThreadedReader out = new ThreadedReader(proc.getInputStream(), outputBuffer); ThreadedReader err = new ThreadedReader(proc.getErrorStream(), errorBuffer); proc.waitFor(); if (verbose || proc.exitValue() != 0) { if (outputBuffer.length() > 0) { System.out.println(outputBuffer.toString()); System.out.flush(); } if (errorBuffer.length() > 0) { System.err.println(errorBuffer.toString()); System.err.flush(); } if (proc.exitValue() != 0) return false; } } catch (Throwable e) { e.printStackTrace(System.err); return false; } return true; } /** * Look for tool in current directory and ${JAVA_HOME}/../bin and * try with .exe file extension. */ private static File findJavaTool(String tool) { File toolFile = new File(tool); if (toolFile.isFile()) { return toolFile; } File result = new File(tool + ".exe"); if (result.isFile()) { return result; } String home = System.getProperty("java.home"); String sep = File.separator; result = new File(home + sep + ".." + sep + "bin", tool); if (result.isFile()) { return result; } result = new File(result.getPath() + ".exe"); if (result.isFile()) { return result; } result = new File(home + sep + "bin", tool); if (result.isFile()) { return result; } result = new File(result.getPath() + ".exe"); if (result.isFile()) { return result; } // just return the original toolFile and hope that it is on the PATH. return toolFile; } /** * Reads the given input stream into the given buffer until there is * nothing left to view. */ static private class ThreadedReader { public ThreadedReader(InputStream stream, final StringBuffer output) { final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); Thread readerThread = new Thread(new Runnable() { public void run() { String s; try { while ((s = reader.readLine()) != null) output.append(s + "\n"); } catch (Exception e) {} } }); readerThread.start(); } } } ./src/org/codehaus/annogen/generate/internal/joust/SourceJavaOutputStream.java0000664000175000017500000005241511767656530027066 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import org.codehaus.jam.internal.JamLoggerImpl; import org.codehaus.jam.provider.JamLogger; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Modifier; import java.util.Iterator; import java.util.StringTokenizer; /** *

        Implementation of JavaOutputStream which outputs Java source code.

        * *

        Note that this class has no direct knowledge of where that source code * goes; that functionality is factored out into the WriterFactory interface, * which returns a new PrintWriter for a given package and class name on * demand. Typically, the implementation will be FileWriterFactory, which * simply creates files under a source root directory, but this factoring * allows for other arrangements to be supported.

        * * @author Patrick Calahan */ public class SourceJavaOutputStream implements JavaOutputStream, ExpressionFactory { // ======================================================================== // Constants private static final String COMMENT_LINE_DELIMITERS = "\n\r\f"; private static final String INDENT_STRING = " "; private static final char[] hexLow = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', }; private static final char[] hexHigh = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', }; // ======================================================================== // Variables protected JamLogger mLogger = new JamLoggerImpl(); private PrintWriter mOut = null; private int mIndentLevel = 0; private String mPackageName = null; private String mClassOrInterfaceName = null; private WriterFactory mWriterFactory; private StringWriter mCommentBuffer = null; private StringWriter mImportBuffer = null; private PrintWriter mCommentPrinter = null; private PrintWriter mImportPrinter = null; private boolean mVerbose = false; // ======================================================================== // Constructors public SourceJavaOutputStream(WriterFactory factory) { setWriterFactory(factory); } protected SourceJavaOutputStream() {} protected void setWriterFactory(WriterFactory factory) { if (factory == null) throw new IllegalArgumentException(); mWriterFactory = factory; } // ======================================================================== // Public methods /** * Sets the logging to log messages to. */ public void setLogger(JamLogger bl) { if (bl == null) throw new IllegalArgumentException("null logging"); mLogger = bl; mVerbose = bl.isVerbose(this); } // ======================================================================== // JavaOutputStream implementation public void startFile(String packageName, String classOrInterfaceName) throws IOException { if (packageName == null) { throw new IllegalArgumentException("null package"); } if (classOrInterfaceName == null) { throw new IllegalArgumentException("null classname"); } if (mOut != null) { throw new IllegalStateException("Start new file without calling "+ "endFile on existing file"); } if (mIndentLevel != 0) throw new IllegalStateException(); //sanity check mOut = new PrintWriter(mWriterFactory.createWriter(packageName, classOrInterfaceName)); mPackageName = makeI18nSafe(packageName); mClassOrInterfaceName = makeI18nSafe(classOrInterfaceName); } public void startStaticInitializer() throws IOException { checkStateForWrite(); printIndents(); mOut.println("static {"); increaseIndent(); } public void startClass(int modifiers, String extendsClassName, String[] interfaceNames) throws IOException { checkStateForWrite(); printCommentsIfNeeded(); if (mVerbose) { mLogger.verbose("startClass "+mPackageName+"."+mClassOrInterfaceName); } extendsClassName = makeI18nSafe(extendsClassName); mOut.println("package " + mPackageName + ";"); mOut.println(); // We need to write up the actual class declaration and save it until // after the imports have been written //FIXME we should format this code more nicely printImportsIfNeeded(); mOut.print(Modifier.toString(modifiers)); mOut.print(" class "); mOut.print(mClassOrInterfaceName); if (extendsClassName != null) { mOut.print(" extends "); mOut.print(extendsClassName); } if (interfaceNames != null && interfaceNames.length > 0) { mOut.print(" implements "); for (int i = 0; i < interfaceNames.length; i++) { mOut.print(makeI18nSafe(interfaceNames[i])); if (i < interfaceNames.length - 1) mOut.print(", "); } } mOut.println(" {"); mOut.println(); increaseIndent(); } public void startInterface(String[] extendsInterfaceNames) throws IOException { if (mVerbose) { mLogger.verbose("startInterface "+mPackageName+"."+mClassOrInterfaceName); } checkStateForWrite(); printCommentsIfNeeded(); mPackageName = makeI18nSafe(mPackageName); mOut.println("package " + mPackageName + ";"); // We need to write up the actual class declaration and save it until // after the imports have been written //FIXME we should format this code more nicely printImportsIfNeeded(); mOut.print("public interface "); mOut.print(mClassOrInterfaceName); if (extendsInterfaceNames != null && extendsInterfaceNames.length > 0) { mOut.print(" extends "); for (int i = 0; i < extendsInterfaceNames.length; i++) { mOut.print(makeI18nSafe(extendsInterfaceNames[i])); if (i < extendsInterfaceNames.length - 1) mOut.print(", "); } } mOut.println("{"); mOut.println(); increaseIndent(); } public Variable writeField(int modifiers, String typeName, String fieldName, Expression defaultValue) throws IOException { if (mVerbose) { mLogger.verbose("writeField "+typeName+" "+fieldName); } checkStateForWrite(); printCommentsIfNeeded(); printIndents(); typeName = makeI18nSafe(typeName); fieldName = makeI18nSafe(fieldName); mOut.print(Modifier.toString(modifiers)); mOut.print(" "); mOut.print(typeName); mOut.print(" "); mOut.print(fieldName); if (defaultValue != null) { mOut.print(" = "); mOut.print(((String) defaultValue.getMemento())); } mOut.println(';'); mOut.println(); return newVar("this." + fieldName); } public Variable[] startConstructor(int modifiers, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException { return startMethod(modifiers, null, mClassOrInterfaceName, paramTypeNames, paramNames, exceptionClassNames); } public Variable[] startMethod(int modifiers, String returnTypeName, String methodName, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException { if (mVerbose) mLogger.verbose("startMethod "+methodName); checkStateForWrite(); printCommentsIfNeeded(); methodName = makeI18nSafe(methodName); returnTypeName = makeI18nSafe(returnTypeName); printIndents(); mOut.print(Modifier.toString(modifiers)); mOut.print(" "); if (returnTypeName != null) { mOut.print(returnTypeName); mOut.print(" "); } mOut.print(methodName); // print the parameter list Variable[] ret; if (paramTypeNames == null || paramTypeNames.length == 0) { mOut.print("()"); ret = new Variable[0]; } else { ret = new Variable[paramTypeNames.length]; for (int i = 0; i < ret.length; i++) { mOut.print((i == 0) ? "(" : ", "); ret[i] = newVar(paramNames[i]); mOut.print(makeI18nSafe(paramTypeNames[i])); mOut.print(' '); mOut.print(makeI18nSafe(paramNames[i])); } mOut.print(")"); } // print the throws clause if (exceptionClassNames != null && exceptionClassNames.length > 0) { for (int i = 0; i < exceptionClassNames.length; i++) { mOut.print((i == 0) ? " throws " : ", "); mOut.print(makeI18nSafe(exceptionClassNames[i])); } } mOut.println(" {"); increaseIndent(); return ret; } public void writeComment(String comment) throws IOException { if (mVerbose) mLogger.verbose("comment"); getCommentPrinter().println(comment); } public void writeImportStatement(String className) throws IOException { getImportPrinter().println("import " + makeI18nSafe(className) + ";"); } public void writeEmptyLine() throws IOException { checkStateForWrite(); mOut.println(); } public void writeAnnotation(Annotation ann) throws IOException { //FIXME haven't really thought much about how to write annotations //as javadoc - this is more just proof-of-concept at this point. //FIXME Eventually, will also need a switch for writing out jsr175 PrintWriter out = getCommentPrinter(); Iterator i = ((AnnotationImpl)ann).getPropertyNames(); while(i.hasNext()) { String n = i.next().toString(); out.print('@'); out.print(((AnnotationImpl)ann).getType()); out.print('.'); out.print(n); out.print(" = "); out.print(((AnnotationImpl)ann).getValueDeclaration(n)); out.println(); } } public void writeStatement(String statement) throws IOException { checkStateForWrite(); printCommentsIfNeeded(); printIndents(); mOut.print(statement); mOut.println(";"); } public void writeReturnStatement(Expression expression) throws IOException { if (mVerbose) mLogger.verbose("return"); checkStateForWrite(); printCommentsIfNeeded(); printIndents(); mOut.print("return "); mOut.print(((String) expression.getMemento())); mOut.println(";"); } public void writeAssignmentStatement(Variable left, Expression right) throws IOException { if (mVerbose) mLogger.verbose("assignment"); checkStateForWrite(); printCommentsIfNeeded(); printIndents(); mOut.print(((String) left.getMemento())); mOut.print(" = "); mOut.print(((String) right.getMemento())); mOut.println(";"); } public void endMethodOrConstructor() throws IOException { if (mVerbose) mLogger.verbose("endMethodOrConstructor"); checkStateForWrite(); printCommentsIfNeeded(); reduceIndent(); printIndents(); mOut.println('}'); mOut.println(); } public void endClassOrInterface() throws IOException { if (mVerbose) mLogger.verbose("endClassOrInterface"); checkStateForWrite(); printCommentsIfNeeded(); reduceIndent(); printIndents(); mOut.println('}'); } public void endFile() throws IOException { checkStateForWrite(); printCommentsIfNeeded(); if (mVerbose) mLogger.verbose("endFile"); closeOut(); } public ExpressionFactory getExpressionFactory() { return this; } public Annotation createAnnotation(String type) { return new AnnotationImpl(type); } public void close() throws IOException { if (mVerbose) mLogger.verbose("close"); closeOut();//just to be safe } // ======================================================================== // ExpressionFactory implementation private static final Expression TRUE = newExp("true"); private static final Expression FALSE = newExp("false"); private static final Expression NULL = newExp("null"); public Expression createBoolean(boolean value) { return value ? TRUE : FALSE; } public Expression createString(String value) { return newExp("\"" + makeI18nSafe(value) + "\""); } public Expression createInt(int value) { return newExp(String.valueOf(value)); } public Expression createNull() { return NULL; } public Expression createVerbatim(String value) { return newExp(makeI18nSafe(value)); } // ======================================================================== // Private methods private PrintWriter getCommentPrinter() { if (mCommentPrinter == null) { mCommentBuffer = new StringWriter(); mCommentPrinter = new PrintWriter(mCommentBuffer); } return mCommentPrinter; } private void printCommentsIfNeeded() { if (mCommentBuffer == null) return; checkStateForWrite(); String comment = mCommentBuffer.toString(); printIndents(); mOut.println("/**"); StringTokenizer st = new StringTokenizer(makeI18nSafe(comment), COMMENT_LINE_DELIMITERS); while (st.hasMoreTokens()) { printIndents(); mOut.print(" * "); mOut.println(st.nextToken()); } printIndents(); mOut.println(" */"); mCommentBuffer = null; mCommentPrinter = null; } private PrintWriter getImportPrinter() { if (mImportPrinter == null) { mImportBuffer = new StringWriter(); mImportPrinter = new PrintWriter(mImportBuffer); } return mImportPrinter; } private void printImportsIfNeeded() { if (mImportBuffer == null) return; checkStateForWrite(); String imports = mImportBuffer.toString(); mOut.println(imports); mImportBuffer = null; mImportPrinter = null; } private void checkStateForWrite() { if (mOut == null) { throw new IllegalStateException("Attempt to generate code when no "+ "file open. This is indicates that "+ "there is some broken logic in the " + "calling class"); } } private void printIndents() { for (int i = 0; i < mIndentLevel; i++) mOut.print(INDENT_STRING); } private void increaseIndent() { mIndentLevel++; } private void reduceIndent() { mIndentLevel--; if (mIndentLevel < 0) { throw new IllegalStateException("Indent level reduced below zero. "+ "This is indicates that "+ "there is some broken logic in the " + "calling class"); } } private void closeOut() { if (mOut != null) { mOut.flush(); mOut.close(); mOut = null; } } private static Expression newExp(final String s) { final String memento = makeI18nSafe(s); return new Expression() { public Object getMemento() { return memento; } }; } private static Variable newVar(String s) { final String memento = makeI18nSafe(s); return new Variable() { public Object getMemento() { return memento; } }; } private static String makeI18nSafe(String s) { if (s == null) return null; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) > 127) return buildI18nSafe(s); } return s; } private static String buildI18nSafe(String s) { StringBuffer mI18nSafeBuffer = new StringBuffer(); int i = 0; int j = 0; for (; ;) { for (; i < s.length(); i++) { if (s.charAt(i) > 127) break; } if (j < i) mI18nSafeBuffer.append(s.substring(j, i)); for (; i < s.length(); i++) { int ch = s.charAt(i); if (ch <= 127) break; int highByte = ch >>> 8; int lowByte = ch & 0xFF; mI18nSafeBuffer.append("\\u"); mI18nSafeBuffer.append(hexHigh[highByte]); mI18nSafeBuffer.append(hexLow[highByte]); mI18nSafeBuffer.append(hexHigh[lowByte]); mI18nSafeBuffer.append(hexLow[lowByte]); } j = i; } } // ======================================================================== // main() - quick test public static void main(String[] args) throws IOException { SourceJavaOutputStream sjos = new SourceJavaOutputStream (new WriterFactory() { private PrintWriter OUT = new PrintWriter(System.out); public Writer createWriter(String x, String y) { return OUT; } }); JavaOutputStream joust = new ValidatingJavaOutputStream(sjos); ExpressionFactory exp = joust.getExpressionFactory(); joust.startFile("foo.bar.baz","MyClass"); Annotation author = joust.createAnnotation("author"); author.setValue("name","Patrick Calahan"); joust.writeComment("Test class"); joust.writeAnnotation(author); joust.startClass(Modifier.PUBLIC | Modifier.FINAL,"MyBaseClass", null); String[] paramTypes = {"int", "List"}; String[] paramNames = {"count", "fooList"}; String[] exceptions = {"IOException"}; Annotation deprecated = joust.createAnnotation("deprecated"); deprecated.setValue("value",true); Variable counter = joust.writeField(Modifier.PRIVATE, "int", "counter", exp.createInt(99)); joust.writeComment("This is the constructor comment"); joust.writeComment("And here is another.\n\n ok?"); joust.writeAnnotation(deprecated); Variable[] params = joust.startConstructor (Modifier.PUBLIC, paramTypes, paramNames, exceptions); joust.writeAssignmentStatement(counter, params[0]); joust.endMethodOrConstructor(); joust.endClassOrInterface(); joust.endFile(); joust.close(); } }./src/org/codehaus/annogen/generate/internal/joust/AnnotationImpl.java0000664000175000017500000000612711767656530025362 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * * * @author Patrick Calahan */ public class AnnotationImpl implements Annotation { // ======================================================================== // Variables private Map mNameToValue = new HashMap(); private String mType; //we want to remember the order they were added in private List mKeyList = new ArrayList(); // ======================================================================== // Constructors /*package*/ AnnotationImpl(String type) { if (type == null) throw new IllegalArgumentException("null type"); mType = type; } // ======================================================================== // Package methods /*package*/ String getType() { return mType; } /*package*/ Iterator getPropertyNames() { return mKeyList.iterator(); } /*package*/ Object getValue(String name) { return mNameToValue.get(name); } /*package*/ String getValueDeclaration(String name) { Object o = getValue(name); if (o == null) return null; if (o instanceof String) return "\""+o+"\""; if (o instanceof Character) return "'"+o+"'"; return o.toString(); } // ======================================================================== // Annotation implementation public void setValue(String name, Annotation ann) { add(name,ann); } public void setValue(String name, boolean value) { add(name,Boolean.valueOf(value)); } public void setValue(String name, String value) { add(name,value); } public void setValue(String name, byte value) { add(name,new Byte(value)); } public void setValue(String name, int value) { add(name,new Integer(value)); } public void setValue(String name, long value) { add(name,new Long(value)); } public void setValue(String name, char value) { add(name,new Character(value)); } // ======================================================================== // Private methods private void add(String name, Object value) { if (name == null) throw new IllegalArgumentException("null name"); if (value == null) throw new IllegalArgumentException("null value"); mKeyList.add(name); mNameToValue.put(name,value); } }./src/org/codehaus/annogen/generate/internal/joust/WriterFactory.java0000664000175000017500000000201111767656530025216 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.IOException; import java.io.Writer; /** * SourceJavaOutputStream delegates to an instance of this interface when * it needs to get a Writer to write source code to. */ public interface WriterFactory { public Writer createWriter(String packageName, String className) throws IOException; }./src/org/codehaus/annogen/generate/internal/joust/ExpressionFactory.java0000664000175000017500000000327611767656530026117 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; /** * Creates instances of Expression to be used in conjunction with a * JavaOutputStream. Instances of ExpressionFactory are retrieved via * JavaOutputStream.getExpressionFactory(). * * We'll probably have to add more methods here to accommodate more * primitives, arrays and so forth. * * @author Patrick Calahan */ public interface ExpressionFactory { /** * Returns an expression representing a constant boolean value. */ public Expression createBoolean(boolean value); /** * Returns an expression representing a literal string. */ public Expression createString(String value); /** * Returns an expression representing a constant int. */ public Expression createInt(int value); /** * Returns an expression representing the 'null' token. */ public Expression createNull(); /** * Returns an expresion whose text representation is the given string. */ public Expression createVerbatim(String value); }./src/org/codehaus/annogen/generate/internal/joust/ValidatingJavaOutputStream.java0000664000175000017500000001340511767656530027704 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.IOException; /** *

        Performs some boilerplate input validation and state checking on stream * operations and then delegates to another JavaOutputStream. This class * simply allows validation logic to be reused by multiple implementations of * JavaOutputStream.

        * * * State diagram: * *
         *   +<-----endClass<-----+ +<-------------------------------+
         *   |                    | |                                |
         * BEGIN-->startClass--->CLASS---->writeImportStatement----->+
         *                         |                                 |
         *                         +------->writeMemberVariable----->+
         *                         |                                 |
         *                         +--->startMethod--->METHOD--->endMethod
         *                          (or ctor or static)   | ^   (or ctor or static)
         *                                              V |
         *                                       write...Statement
         * 
        * * @author Patrick Calahan */ public class ValidatingJavaOutputStream implements JavaOutputStream { // FIXME This class isn't implemented yet - it's just a proxy that isn't // FIXME doing any validation // ======================================================================== // Constants // ======================================================================== // Variables private JavaOutputStream mDest; // ======================================================================== // Constructors public ValidatingJavaOutputStream(JavaOutputStream destination) { if (destination == null) throw new IllegalArgumentException(); mDest = destination; } // ======================================================================== // JavaOutputStream implementation public void startFile(String packageName, String interfaceOrClassName) throws IOException { mDest.startFile(packageName,interfaceOrClassName); } public void startClass(int modifiers, String extendsClassName, String[] implementsInterfaceNames) throws IOException { mDest.startClass(modifiers, extendsClassName, implementsInterfaceNames); } public void startInterface(String[] extendsInterfaceNames) throws IOException { mDest.startInterface(extendsInterfaceNames); } public Variable writeField(int modifiers, String typeName, String fieldName, Expression defaultValue) throws IOException { return mDest.writeField(modifiers, typeName, fieldName, defaultValue); } public void startStaticInitializer() throws IOException { mDest.startStaticInitializer(); } public Variable[] startConstructor(int modifiers, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException { return mDest.startConstructor(modifiers, paramTypeNames, paramNames, exceptionClassNames); } public Variable[] startMethod(int modifiers, String methodName, String returnTypeName, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException { return mDest.startMethod(modifiers, methodName, returnTypeName, paramTypeNames, paramNames, exceptionClassNames); } public void writeEmptyLine() throws IOException { mDest.writeEmptyLine(); } public void writeComment(String comment) throws IOException { mDest.writeComment(comment); } public void writeAnnotation(Annotation ann) throws IOException { mDest.writeAnnotation(ann); } public Annotation createAnnotation(String type) { return mDest.createAnnotation(type); } public void writeImportStatement(String className) throws IOException { mDest.writeImportStatement(className); } public void writeStatement(String statement) throws IOException { mDest.writeStatement(statement); } public void writeReturnStatement(Expression expression) throws IOException { mDest.writeReturnStatement(expression); } public void writeAssignmentStatement(Variable left, Expression right) throws IOException { mDest.writeAssignmentStatement(left, right); } public void endMethodOrConstructor() throws IOException { mDest.endMethodOrConstructor(); } public void endClassOrInterface() throws IOException { mDest.endClassOrInterface(); } public void endFile() throws IOException { mDest.endFile(); } public ExpressionFactory getExpressionFactory() { return mDest.getExpressionFactory(); } public void close() throws IOException { mDest.close(); } }./src/org/codehaus/annogen/generate/internal/joust/JavaOutputStream.java0000664000175000017500000003663311767656530025711 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.IOException; /** *

        A JavaOutputStream is a service which provides sequential, view-only * java code-generation service. This is not a general-purpose java code * output, but rather is tailored to produce java constructs required * for XMLbeans.

        * *

        By using this interface, the schema-to-java binding logic is isolated from * the details of java code generation. This in turn allows for pluggability * of the generation logic - for example, one code output might generate * java source files, while another might directly generate byte codes in * memory.

        * * A note about 'Type Names' * *

        A number of method signatures in this interface contain a String parameter * which is described as a 'Type Name.' This is expected to be any * type declaration as you would normally see in java source code, e.g. * int, String[][], java.util.List, * or MyImportedClass. More specifically, it must be a valid * TypeName as described in * * section 6.5.5 of the Java Language Specification.

        * * @author Patrick Calahan * */ public interface JavaOutputStream { /** * Instructs the stream to begin writing a new interface. * * @param packageName Fully-qualified name of the package which should * contain the new interface. * @param interfaceOrClassName Unqualified name of the new class or * interface that will be written in this file. * * @throws IllegalStateException if startFile has already been called * without a call to endFile. * @throws IllegalArgumentException if classname is null or if any classname * parameters is malformed. */ public void startFile(String packageName, String interfaceOrClassName) throws IOException; /** * Instructs the stream to begin writing a class with the given attributes. * * @param modifiers A java.lang.reflect.Modifier value describing the * modifiers which apply to the new class. * @param extendsClassName Name the class which the new class extends, or * null if it should not extend anything. The class name must be * fully-qualified. * @param implementsInterfaceNames Array of interface names, one * for each interface implemented by the new class, or null if * the class does not implement anything. Each class name must be * fully-qualified. * * @throws IllegalStateException if the current stream state does not allow * beginning a new class. * @throws IllegalArgumentException if modifers is not valid for a class, * if packagename or classname is null or malformed, or if * any class name parameter is malformed. */ public void startClass(int modifiers, String extendsClassName, String[] implementsInterfaceNames) throws IOException; /** * Instructs the stream to begin writing a static initialization block. * @throws IllegalStateException if the current position is not valid for * starting a static initialization block. */ public void startStaticInitializer() throws IOException; /** * Instructs the stream to begin writing a new interface. * * @param extendsInterfaceNames Array of interface names, one * for each interface extendded by the new interface, or null if * the interface does not extend anything. Each class name must be * fully-qualified. * * @throws IllegalStateException if the current stream state does not allow * beginning a new interface. * @throws IllegalArgumentException if classname is null or if any classname * parameters is malformed. */ public void startInterface(String[] extendsInterfaceNames) throws IOException; /** * Instructs the stream to write out a field (member variable) declaration * for the current class. * * @param modifiers A java.lang.reflect.Modifier value describing the * modifiers which apply to the new field. * @param typeName The Type Name (see above) for the new field. * @param fieldName The name of the new field. * @param defaultValue An Expression describing the default value for the * new field, or null if none should be declared. * * @throws IllegalStateException if the current stream state does not allow * a field declaration (e.g. if startClass has not been called). * @throws IllegalArgumentException if any type name is null or malformed or * fieldName is null or not a valid java identifier, or if modifiers * cannot be applied to a field. * * @return A handle to the field that is created. */ public Variable writeField(int modifiers, String typeName, String fieldName, Expression defaultValue) throws IOException; /** * Instructs the stream to write out a constructor for the current class. * * @param modifiers A java.lang.reflect.Modifier value describing the * modifiers which apply to the new constructor. * @param paramTypeNames An array of Type Names (see above) for each of the * constructor's parameters, or null if this is to be the default * constructor. * @param paramNames An array of parameter names for each of the * constructor's parameters, or null if this is to be the default * constructor. * @param exceptionClassNames An array of class names, one * for each exception type to be thrown by the new constructor, or * null if the constructor does not throw anything. Each name need * not be qualified. * * @throws IllegalStateException if the current stream state does not allow * a constructor declaration. * @throws IllegalArgumentException if paramTypeNames and paramNames are * not of the same length (or both null), if any type name or * exception class name is null or malformed, if the modifiers * cannot be applied to a constructor. * * @return An array of Variables which provide handles to the parameters * of the generated constructor. Returns an empty array if the * constructor does not take any parameters. */ public Variable[] startConstructor(int modifiers, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException; /** * Instructs the stream to write out a new method for the current class. * * @param modifiers A java.lang.reflect.Modifier value describing the * modifiers which apply to the new method. * @param methodName A name for the new method. * @param returnTypeName A Type Name (see above) for the method's return * value, or "void" if the method is void. * @param paramTypeNames An array of Type Names (see above) for each of the * method's parameters, or null if the method takes no parameters. * @param paramNames An array of parameter names for each of the * method's parameters, or null if the method takes no parameters. * @param exceptionClassNames An array of class names, one * for each exception type to be thrown by the method, or * null if the methoddoes not throw anything. Each class name must * be fully-qualified. * * @throws IllegalStateException if the current stream state does not allow * a new method declaration. * @throws IllegalArgumentException if paramTypeNames and paramNames are * not of the same length (or both null), if any type name or * exception class name is null or malformed, if the modifiers * cannot be applied to a method, or if methodName is null or * malformed. * * @return An array of Variables which provide handles to the parameters * of the generated method. Returns an empty array if the method * does not take any parameters. */ public Variable[] startMethod(int modifiers, String returnTypeName, String methodName, String[] paramTypeNames, String[] paramNames, String[] exceptionClassNames) throws IOException; /** *

        Writes out a source-code comment in the current class. The comment * will usually be interpreted as applying to whatever is written next * in the stream, i.e. to write comments about a given class, you should * first call writeComment and then call writeClass.

        * *

        Line breaks in the comment will be respected, but it should NOT * include any formatting tokens such as '/*' or '//' - the implementation * will properly format the comments based on context. Also note that * you should not use writeComment to add javadoc tags; code metadata * should be added with writeAnnotation.

        * * @param comment The text of the comment. * * @throws IllegalStateException if the current stream state does not allow * writing a comment (e.g. if startFile has not been called). * writeComment should be a valid operation at all other times. */ public void writeComment(String comment) throws IOException; /** *

        Writes out an annotation in the current class. The annotation will * apply to whatever is written next in the stream, i.e. to an annotation * for a method, call wrteAnnotation just before writing the method with * writeMethod. The way in which the annotations are * implementation-dependent, but this typically will result in either * javadoc tags or JSR175 annotations being produced.

        * *

        Note that the caller is free to re-use the Annotation parameter object * after making a call to this method.

        * * @param ann the annotation to write to the stream. * * @throws IllegalStateException if the current stream state does not allow * writing an annotation (e.g. if startFile has not been called). * writeComment should be a valid operation at most other times. */ public void writeAnnotation(Annotation ann) throws IOException; /** * Returns an Annotation object of the given type that can be populated * with some values (setValue) and then passed to the writeAnnotation * method. * * @return An ExpressionFactory. Must never return null. */ public Annotation createAnnotation(String type); /** * Writes out an empty line, used for code formatting. */ public void writeEmptyLine() throws IOException; /** * Writes out a Java statement represented by the given string. * * @param statement The string representation of the given statement * * @throws IllegalArgumentException if the statement string is null. */ public void writeStatement(String statement) throws IOException; /** * Writes out an import statement of the given class. * * @param className The name of the class to be imported. Can contain '*' * for package imports. * * @throws IllegalArgumentException if className is null. * @throws IllegalStateException if the current stream state does not allow * an import statement, ie the class definition has already started. */ public void writeImportStatement(String className) throws IOException; /** * Writes out a return statement for the current method that returns * the given expression. * * @param expression A handle to the expression to be returned. * * @throws IllegalArgumentException if expression is null. * @throws IllegalStateException if the current stream state does not allow * a return declaration (e.g. if startMethod has not been called or * the current method is void). */ public void writeReturnStatement(Expression expression) throws IOException; /** * Writes out a return statement for the current method that returns * the given expression. * * @param left A handle to the variable that goes on the left side * of the equals sign. * @param right A handle to the expression which goes on the right side * of the equals sign. * * @throws IllegalArgumentException if either parameter is null. * @throws IllegalStateException if the current stream state does not allow * an assignment declaration (e.g. if startMethod or * startConstructor has not been called). */ public void writeAssignmentStatement(Variable left, Expression right) throws IOException; /** * Instructs the stream to finish writing the current method or constructor. * Every call to startMethod or startConstructor must be balanced by a call * to endClassOrConstructor. * * @throws IllegalStateException if the current stream state does not allow * the end of a class or interface. */ public void endMethodOrConstructor() throws IOException; /** * Instructs the stream to finish writing the current class or interface. * Every call to startClass or startInterface must be balanced by a call to * endClassOrInterface. * * @throws IllegalStateException if the current stream state does not allow * the end of a class or interface. */ public void endClassOrInterface() throws IOException; /** * Instructs the stream to finish writing the current file. * Every call to startFile must be balanced by a call to endFile(). * * @throws IllegalStateException if no file has been started. */ public void endFile() throws IOException; /** * Closes the JavaOutputStream. This should be called exactly once and * only when you are completely finished with the stream. Note that in * the case where java sources are being generated, calling this method may * cause the sources to be javac'ed. */ public void close() throws IOException; /** * Returns the ExpressionFactory that should be to create instances of * Expression to be used in conjunction with this JavaOutputStream. * * @return An ExpressionFactory. Must never return null. */ public ExpressionFactory getExpressionFactory(); }./src/org/codehaus/annogen/generate/internal/joust/FileWriterFactory.java0000664000175000017500000000607311767656530026032 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.io.FileOutputStream; import java.io.OutputStreamWriter; /** * Implementation of WriterFactory which creates files for new classes under * a specified source root. */ public class FileWriterFactory implements WriterFactory { // ======================================================================== // Constants // might need to make this settable someday private static final String EXTENSION = ".java"; private static final char PACKAGE_SEPARATOR = '.'; // ======================================================================== // Variables private File mSourceRoot; private String mEncoding = null; // ======================================================================== // Constructors public FileWriterFactory(File sourceRoot) { if (sourceRoot == null) throw new IllegalArgumentException(); mSourceRoot = sourceRoot; } public FileWriterFactory(File sourceRoot, String encoding) { if (sourceRoot == null) throw new IllegalArgumentException(); if (encoding == null) throw new IllegalArgumentException(); mSourceRoot = sourceRoot; mEncoding = encoding; } // ======================================================================== // WriterFactory implementation public Writer createWriter(String packageName, String className) throws IOException { if (mEncoding == null) { return new FileWriter(createFile(packageName,className)); } else { FileOutputStream fos = new FileOutputStream(createFile(packageName,className)); return new OutputStreamWriter(fos, mEncoding); } } // ======================================================================== // Public methods /** * Returns the raw file instead, in case the caller is clever and knows we * are a FileWriterFactory. */ public File createFile(String packageName, String className) throws IOException { File dir = new File(mSourceRoot, packageName.replace (PACKAGE_SEPARATOR, File.separatorChar)); if (!dir.exists()) { if (!dir.mkdirs()) { throw new IOException("Failed to create directory " + dir); } } return new File(dir, className + EXTENSION); } }./src/org/codehaus/annogen/generate/internal/joust/Variable.java0000664000175000017500000000220411767656530024143 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate.internal.joust; /** * An Expression which has the property of assignability. This interface * simply ensures some basic correctness in the code output. Several * methods on JavaOutputStream (e.g. createMemberVariable) return instances of * Variable, and several other methods (e.g. writeAssignmentStatement) may * require a Variable as a parameter. * * @author Patrick Calahan */ public interface Variable extends Expression { } ./src/org/codehaus/annogen/generate/package.html0000664000175000017500000000017111767656530021055 0ustar brianbrian

        Supports the Generate Phase in which AnnoBeans are generated from JSR175 types.

        ./src/org/codehaus/annogen/generate/AnnogenTask.java0000664000175000017500000001316711767656530021660 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.generate; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; import org.codehaus.jam.JClass; import org.codehaus.jam.JamService; import org.codehaus.jam.JamServiceFactory; import org.codehaus.jam.JamServiceParams; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * Ant task which generates AnnoBeans. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class AnnogenTask extends Task { // ======================================================================== // Variables private Annogen mAnnogen = new Annogen(); private Path mSrcDir = null; private Path mToolpath = null; private Path mClasspath = null; private String mIncludes = "**/*.java"; private List mMappings = null; private String mInputEncoding = null; // ======================================================================== // Constructors public AnnogenTask() {} // ======================================================================== // Public methods /** * Sets the directory into which source files should be generated. * @param f */ public void setDestDir(File f) { mAnnogen.setOutputDir(f); } /** * Set the source directories to find the source Java files. */ public void setSrcdir(Path srcDir) { if (mSrcDir == null) { mSrcDir = srcDir; } else { mSrcDir.append(srcDir); } } /** * Includes source files matching the given patten. Pattern is relative * to srcDir. */ public void setIncludes(String includes) { if (includes == null) throw new IllegalArgumentException("null includes"); mIncludes = includes; } public void setImplementAnnotationTypes(boolean b) { mAnnogen.setImplementAnnotationTypes(b); } public void setToolpath(Path path) { if (mToolpath == null) { mToolpath = path; } else { mToolpath.append(path); } } public void setToolpathRef(Reference r) { createToolpath().setRefid(r); } public Path createToolpath() { if (mToolpath == null) { mToolpath = new Path(getProject()); } return mToolpath.createPath(); } public void setClasspath(Path path) { if (mClasspath == null) { mClasspath = path; } else { mClasspath.append(path); } } public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } public Path createClasspath() { if (mClasspath == null) { mClasspath = new Path(getProject()); } return mClasspath.createPath(); } public void addMapping(AnnoBeanMapping m) { if (mMappings == null) mMappings = new ArrayList(); mMappings.add(m); } public void setKeepGenerated(boolean b) { mAnnogen.setKeepGenerated(b); } public void setInputEncoding(String encoding) { mInputEncoding = encoding; } public void setOutputEncoding(String encoding) { mAnnogen.setOutputEncoding(encoding); } // ======================================================================== // Task implementation public void execute() throws BuildException { if (mSrcDir == null) { throw new BuildException("'srcDir' must be specified"); } JamServiceFactory jsf = JamServiceFactory.getInstance(); JamServiceParams p = jsf.createServiceParams(); if (mInputEncoding != null) p.setCharacterEncoding(mInputEncoding); if (mToolpath != null) { File[] tcp = path2files(mToolpath); for(int i=0; i 0) { JClass clazz = (JClass)mClassesLeftTodo.get(0); mClassesLeftTodo.remove(0); mClassesDone.add(clazz); doCodegen(clazz); } mJoust.close(); } public void setImplementAnnotationTypes(boolean b) { mImplementAnnotationTypes = b; } /** * Sets the character encoding to use for generating anno beans. * If not set, the vm default is used. */ public void setOutputEncoding(String enc) { mJoust.setEncoding(enc); } // ======================================================================== // Private methods /*package*/ File getOutputDir() { return mOutputDir; } private void doCodegen(JClass jsr175type) throws IOException { if (jsr175type == null) throw new IllegalArgumentException(); // figure out the name of the class to codegen and get started String annoBeanClassname = getAnnobeanClassnameFor(jsr175type); { if (annoBeanClassname == null) throw new IllegalStateException(); int lastDot = annoBeanClassname.lastIndexOf('.'); String simpleImplName = (lastDot == -1) ? annoBeanClassname : annoBeanClassname.substring(lastDot+1); String packageName = (lastDot == -1) ? null : annoBeanClassname.substring(0,lastDot); mJoust.startFile(packageName,simpleImplName); } JMethod[] methods = jsr175type.getDeclaredMethods(); String[] implementInterface = (!mImplementAnnotationTypes ? null : new String[] {jsr175type.getQualifiedName()}); mJoust.writeComment("THIS IS GENERATED CODE! DO NOT EDIT!\n\n\n"+ "Generated by "+getClass().getName()+ "\n on "+new Date()+"\n"+ "\n"); mJoust.startClass(Modifier.PUBLIC, BASE_CLASS, implementInterface); // write the 'PROXY_FOR_FIELD' field which we use at runtime to map back // to the annotation class that we are proxying for. In the case // where we implement that interface (i.e. m14Compatible == false) // this is redundant (since we could just look at what the annobean type // implements). But we err on the side of most concrete and direct by // just always doing it this way. mJoust.writeField(Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL, "java.lang.String", ANNOBEAN_FOR_FIELD, mJoust.getExpressionFactory(). createString(jsr175type.getQualifiedName())); for(int i=0; iEnables verbose debugging output from all instances of the given * class.

        */ public void setVerbose(Class c); } ./src/org/codehaus/annogen/view/internal/0000775000175000017500000000000011767656530017571 5ustar brianbrian./src/org/codehaus/annogen/view/internal/NullIAE.java0000664000175000017500000000221411767656530021664 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.view.internal; import org.codehaus.annogen.override.AnnoBeanSet; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class NullIAE implements IndigenousAnnoExtractor { public static final IndigenousAnnoExtractor getInstance(){ return INSTANCE; } private static final IndigenousAnnoExtractor INSTANCE = new NullIAE(); private NullIAE() {} public boolean extractIndigenousAnnotations(AnnoBeanSet out) { return false; } } ./src/org/codehaus/annogen/view/internal/AnnoViewerBase.java0000664000175000017500000000726511767656530023316 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.annogen.view.internal; import org.codehaus.annogen.override.AnnoBean; import org.codehaus.annogen.override.AnnoBeanSet; import org.codehaus.annogen.override.AnnoContext; import org.codehaus.annogen.override.AnnoOverrider; import org.codehaus.annogen.override.ElementId; import org.codehaus.annogen.override.internal.AnnoBeanSetImpl; import org.codehaus.annogen.override.internal.CompositeAnnoOverrider; import org.codehaus.annogen.override.internal.ElementIdImpl; import org.codehaus.jam.provider.JamLogger; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class AnnoViewerBase { // ======================================================================== // Variables private AnnoContext mContext; private AnnoOverrider mOverrider; protected JamLogger mLogger; // ======================================================================== // Constructors public AnnoViewerBase(AnnoViewerParamsImpl asp) { if (asp == null) throw new IllegalArgumentException("null asp"); AnnoOverrider[] pps = asp.getOverriders(); if (pps == null || pps.length == 0) { mOverrider = null; } else if (pps.length == 1) { mOverrider = pps[0]; } else { mOverrider = new CompositeAnnoOverrider(pps); } if (mOverrider != null) mOverrider.init(asp); mLogger = asp.getLogger(); mContext = (AnnoContext)asp; } // ======================================================================== // Public methods //FIXME add some caching here, please /** * This method is public only because it makes writing tests a little easier. */ public AnnoBean[] getAnnotations(ElementId id) { if (id == null) throw new IllegalArgumentException("null id"); AnnoBeanSet apsi = new AnnoBeanSetImpl(mContext); getIndigenousAnnotations(id,apsi); if (mOverrider != null) mOverrider.modifyAnnos(id,apsi); return apsi.getAll(); } /** * This method really should be proected, but we leave it public because * it makes writing tests a lot easier. */ /*protected*/ public AnnoBean getAnnotation(Class what, ElementId where) { Class beanClass; try { beanClass = mContext.getAnnobeanClassFor(what); } catch(ClassNotFoundException cnfe) { mLogger.verbose(cnfe,this); return null; } AnnoBean[] annos = getAnnotations(where); for(int i=0; i

        Supports the View Phase in which AnnoBeans are retrieved for use by annotation-processing framework code.

        ./src/org/codehaus/jam/0000775000175000017500000000000011767656530014125 5ustar brianbrian./src/org/codehaus/jam/JamUtils.java0000664000175000017500000001362311767656530016525 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Comparator; /** *

        Singleton collection of utility methods which can be very useful in * some samples, but not often enough to warrant inclusion in the main * APIs.

        * *

        Most of these are here to help you jump from the JClass * hierarchy to the java.lang.reflect hierarchy. This is primarily * useful when you find yourself, for example, wanting to actually invoke * a method represented by a JMethod.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamUtils { // ======================================================================== // Singleton public static final JamUtils getInstance() { return INSTANCE; } private JamUtils() {} private static final JamUtils INSTANCE = new JamUtils(); // ======================================================================== // Public methods /** *

        Returns the java.lang.Method on a given * java.lang.Class which is represented by a given JMethod.

        * * @param containedin Class to be searched for the method. * @return * @throws ClassNotFoundException if one of the paramType classes specified * for this MethodName cannot be loaded from the given class' classloader. * @throws NoSuchMethodException If the named method does not exist on * this class. * @throws IllegalArgumentException if any argument is null */ public Method getMethodOn(JMethod method, Class containedin) throws NoSuchMethodException, ClassNotFoundException { if (containedin == null) throw new IllegalArgumentException("null class"); if (method == null) throw new IllegalArgumentException("null method"); Class[] types = null; JParameter[] params = method.getParameters(); if (params != null && params.length > 0) { types = new Class[params.length]; for (int i = 0; i < types.length; i++) { types[i] = loadClass(params[i].getType(),containedin.getClassLoader()); } } return containedin.getMethod(method.getSimpleName(), types); } /** *

        Returns the java.lang.Method on a given * java.lang.Class which is represented by a given JMethod.

        * * @param containedin Class to be searched for the ctor. * @return * @throws ClassNotFoundException if one of the paramType classes specified * for this MethodName cannot be loaded from the given class' classloader. * @throws NoSuchMethodException If the named ctor does not exist on * this class. * @throws IllegalArgumentException if any argument is null */ public Constructor getConstructorOn(JConstructor ctor, Class containedin) throws NoSuchMethodException, ClassNotFoundException { if (containedin == null) throw new IllegalArgumentException("null class"); if (ctor == null) throw new IllegalArgumentException("null ctor"); Class[] types = null; JParameter[] params = ctor.getParameters(); if (params != null && params.length > 0) { types = new Class[params.length]; for (int i = 0; i < types.length; i++) { types[i] = loadClass(params[i].getType(),containedin.getClassLoader()); } } return containedin.getConstructor(types); } /** *

        Returns the java.lang.Method on a given * java.lang.Class which is represented by a given JMethod.

        * * @param containedin Class to be searched for the method. * @return * @throws NoSuchFieldException if the field does not exist on the class. * @throws IllegalArgumentException if any argument is null */ public Field getFieldOn(JField field, Class containedin) throws NoSuchFieldException { if (containedin == null) throw new IllegalArgumentException("null class"); if (field == null) throw new IllegalArgumentException("null field"); return containedin.getField(field.getSimpleName()); } /** *

        Loads the java.lang.Class represented by a given JClass out of a given * classloader.

        * @return * @throws ClassNotFoundException If the class is not found in the classloader */ public Class loadClass(JClass clazz, ClassLoader inThisClassloader) throws ClassNotFoundException { return inThisClassloader.loadClass(clazz.getQualifiedName()); } /** * Sorts the given array in place so that the elements are ordered by * their sourcePosition's line numbers. */ public void placeInSourceOrder(JElement[] elements) { if (elements == null) throw new IllegalArgumentException("null elements"); Arrays.sort(elements,SOURCE_POSITION_COMPARATOR); } // ======================================================================== // Private private static Comparator SOURCE_POSITION_COMPARATOR = new Comparator() { public int compare(Object o, Object o1) { JSourcePosition p1 = ((JElement)o).getSourcePosition(); JSourcePosition p2 = ((JElement)o1).getSourcePosition(); if (p1 == null) return (p2 == null) ? 0 : -1; if (p2 == null) return 1; return (p1.getLine() < p2.getLine()) ? -1 : (p1.getLine() > p2.getLine()) ? 1 : 0; } }; }./src/org/codehaus/jam/JamServiceFactory.java0000664000175000017500000001017011767656530020347 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import org.codehaus.jam.internal.JamPrinter; import org.codehaus.jam.provider.JamServiceFactoryImpl; import java.io.File; import java.io.IOException; import java.io.PrintWriter; /** * Start here! This is the normal entry point into the JAM subsystem. * JamServiceFactory is a singleton factory which can create a new * JamServiceParams and JServices. Here is a code sample that demonstrates * how to use JamServiceFactory. * *
         * // Get the factory singleton
         * JamServiceFactory factory = JamServiceFactory.getInstance();
         *
         * // Use the factory to create an object that we can use to specify what
         * // java types we want to view
         * JamServiceParams params = factory.createServiceParams();
         *
         * // Include the classes under mypackage
         * params.includeSources(new File("c:/myproject/src","mypackage/*.java"));
         *
         * // Create a JamService, which will contain JClasses for the classes found in mypackage
         * JamService service = factory.createServiceRoot(params);
         * 
        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class JamServiceFactory { // ======================================================================== // Constants private static final JamServiceFactory DEFAULT = new JamServiceFactoryImpl(); // ======================================================================== // Singleton /** * Return the default factory singleton for this VM. */ public static JamServiceFactory getInstance() { return DEFAULT; } // ======================================================================== // Constructors protected JamServiceFactory() {} // ======================================================================== // Public methods /** * Create a new JamServiceParams instance. The params can be populated * and then given to the createServiceRoot method to create a new JamService. */ public abstract JamServiceParams createServiceParams(); /** * Create a new JamService from the given parameters. * * @throws IOException if an IO error occurred while creating the service * @throws IllegalArgumentException if the params is null or not * an instance returned by createServiceParams(). */ public abstract JamService createService(JamServiceParams params) throws IOException; /** *

        Returns a new JamClassLoader which simply wraps the system * classloader.

        */ public abstract JamClassLoader createSystemJamClassLoader(); /** *

        Returns a new JamClassLoader which simply wraps the given * classloader.

        */ public abstract JamClassLoader createJamClassLoader(ClassLoader cl); // ======================================================================== // main() method public static void main(String[] args) { try { JamServiceParams sp = getInstance().createServiceParams(); for(int i=0; iEncapsulates the a set of java classes which were which met a set of * criteria described in a JamServiceParams object. A JamService exposes both a * particular set of JClasses, as well as a JamClassLoader which can be used * to load related classes.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamService { /** * Returns a JamClassLoader which can be used to load JClasses from class- * and source-file locations specified in the JamServiceParams with which * this service was instantiated. Note that it is possible to use this * mechanism to load JClasses that are not returned by getClasses(). */ public JamClassLoader getClassLoader(); /** * Returns the names of the classes that were described in the * JamServiceParams object used to create this service. Note that this * list will never change for a given service; though it is possible * to use the service's JamClassLoader to load other types, this method will * always return the initial set of classes. */ public String[] getClassNames(); /** * Returns an iterator of the JClasses named in the array returned by * getClassNames(). */ public JamClassIterator getClasses(); /** * Returns all of the JClasses returned by getClasses() in a single * array. Use of this method (as opposed to getClasses()) is not advised * if you expect to be dealing with a very large set of classes, as it makes * it less likely that JClasses will be garbage collected when no longer * needed. */ public JClass[] getAllClasses(); //public void invalidate(JClass clazz); //public void invalidateAll(); } ./src/org/codehaus/jam/JElement.java0000664000175000017500000000577611767656530016512 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import org.codehaus.jam.visitor.JVisitor; /** *

        The root of the java type object model.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract interface JElement { /** *

        Returns the parent of this abstraction, or null if this * annotation represents a root abstraction (i.e. a JPackage). The * JElement hierarchy looks like this:

        * *
           *     JPackage
           *       JClass
           *         JConstructor
           *         JField
           *         JMethod
           *           JParameter
           *         JProperty
           *         JClass (inner class)...
           * 
        * *

        Additionally, any of the abstractions above may in turn have * child JAnnotations, which may themselves have child * JAnnotations.

        */ public JElement getParent(); /** *

        Returns a simple name of this abstraction. The exact format * of the name depends on the particular abstraction (see javadoc). * Please refer to the JAM package documentation for more details on * naming conventions.

        */ public String getSimpleName(); /** *

        Returns a qualified name for this abstraction. The exact format of * this name depends on the particular abstraction. Please refer to the * documentation for each JElement subclass for a detailed description * of the qualified name formats.

        */ public String getQualifiedName(); /** * Returns an object describing the source file position of this * elements, or null if the position is unknown on not applicable. */ public JSourcePosition getSourcePosition(); /** *

        Accepts the given visitor.

        */ public void accept(JVisitor visitor); /** *

        This is not something you want to mess with. It's here only for the * benefit of some JAM implementations which need a handle back to the * actual implementation-specific object which is being proxied by this * JElement.

        * @return */ public Object getArtifact(); /** * Returns true if this JElement was parsed from a source file. If false, * you can not rely on the availablilty of documentation and line numbers * for the element. */ public boolean isSourceAvailable(); /** *

        Returns the same String as getQualifiedName().

        */ public String toString(); } ./src/org/codehaus/jam/JField.java0000664000175000017500000000426211767656530016131 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents an exposed field on a Java class.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JField extends JMember { /** * Returns the type of this field. */ public JClass getType(); /** * Return true if this field is final. */ public boolean isFinal(); /** * Return true if this field is static. */ public boolean isStatic(); /** * Return true if this field is volatile. */ public boolean isVolatile(); /** * Return true if this field is transient. */ public boolean isTransient(); /** *

        Returns a qualied name for this method as specified by * java.lang.reflect.Field.toString():

        * *

        Returns a string describing this Field. The format is the access * modifiers for the field, if any, followed by the field type, followed * by a space, followed by the fully-qualified name of the class declaring * the field, followed by a period, followed by the name of the field. * For example:

        * *

        public static final int java.lang.Thread.MIN_PRIORITY

        *

        private int java.io.FileDescriptor.fd

        * *

        The modifiers are placed in canonical order as specified by "The * Java Language Specification". This is public, protected or private * first, and then other modifiers in the following order: static, final, * transient, volatile.

        */ public String getQualifiedName(); } ./src/org/codehaus/jam/JConstructor.java0000664000175000017500000000320411767656530017426 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents a constructor of a java class.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JConstructor extends JInvokable { /** *

        Returns a qualied name for this method as specified by * java.lang.reflect.Constructor.toString():

        * *

        Returns a string describing this Constructor. The string is formatted * as the constructor access modifiers, if any, followed by the * fully-qualified name of the declaring class, followed by a parenthesized, * comma-separated list of the constructor's formal parameter types. * For example:

        * *

        public java.util.Hashtable(int,float)

        * *

        The only possible modifiers for constructors are the access modifiers * public, protected or private. Only one of these may appear, or none if * the constructor has default (package) access.

        */ public String getQualifiedName(); } ./src/org/codehaus/jam/JClass.java0000664000175000017500000004054211767656530016154 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents a Java class that may or may not be loaded in the VM. * JClass is typically implemented in one of two ways: by wrapping a * java.lang.Class or by parsing a source file directly with a tool * such as javadoc or javelin.

        * *

        If a JClass represents an inner class, its getParent() method * returns the outer class. Otherwise, it returns the containing * package.

        * *

        Important Note: Because JAM's classloading machinery may swap * instances of JClass out of memory at any time, you should never rely on * instance equality (i.e., '==') when comparing two JClasses. To illustrate: * it is possible (though rather unlikely) that that the following expression * will evaluate to false

        * * * JMethod myJMethod = ... * myJMethod.getReturnType() == myJMethod.getReturnType() * * *

        Instead, you should always use equals()

        * * myJMethod.getReturnType().equals(myJMethod.getReturnType()) * * *

        REVIEW a bunch of these methods (getMethods, getConstructors...) * could throw SecurityException if the JClass is backed by * java.lang.Class (see javadocs for Class). We're currently ignoring * this, because it seems unlikely and it seems heavyweight. Seems * ok?

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JClass extends JMember { /** *

        Returns a JPackage which represents the package which contains * this JClass.

        */ public JPackage getContainingPackage(); /** *

        Returns the Class representing the superclass of the entity * (class, interface, primitive type or void) represented by this * Class. If this Class represents either the Object class, an * interface, a primitive type, or void, then null is returned. If * this object represents an array class then the Class object * representing the Object class is returned. */ public JClass getSuperclass(); /** * Returns an unordered array containing all of the interfaces directly * implemented by this class. Returns an empty array if no interfaces are * implemented. * REVIEW we probably want getInterfaces and getDeclaredInterfaces. */ public JClass[] getInterfaces(); /** *

        REVIEW should we consider renaming this to getAllFields()? I * think this makes it more clear but is not consistent with * java.lang.Class.

        * *

        Returns an unordered array containing Field objects reflecting all the * accessible public fields of the class or interface represented by * this Class object. The elements2 in the array returned are not * sorted and are not in any particular order. This method returns * an array of length 0 if the class or interface has no accessible * public fields, or if it represents an array class, a primitive * type, or void.

        * *

        Specifically, if this JClass object represents a class, this * method returns the public fields of this class and of all its * superclasses. If this JClass object represents an interface, this * method returns the fields of this interface and of all its * superinterfaces.

        * *

        The implicit length field for array class is not reflected by * this method. User code should use the methods of class Array to * manipulate arrays.

        * *

        Note that no guarantees are made about the ordering of fields in * this array.

        * *

        See The Java Language Specification, sections 8.2 and * 8.3.

        */ public JField[] getFields(); /** *

        Returns an unordered array of Field objects reflecting all the fields * declared by the class or interface represented by this Class * object. This includes public, protected, default (package) * access, and private fields, but excludes inherited fields. The * elements2 in the array returned are not sorted and are not in any * particular order. This method returns an array of length 0 if the * class or interface declares no fields, or if this Class object * represents a primitive type, an array class, or void.

        * *

        See The Java Language Specification, sections 8.2 and 8.3.

        */ public JField[] getDeclaredFields(); /** *

        REVIEW should we consider renaming this to getAllMethods()? I * think this makes it more clear but is not consistent with * java.lang.Class.

        * *

        Returns an array containing Method objects reflecting all the * public member methods of the class or interface represented by * this Class object, including those declared by the class or * interface and and those inherited from superclasses and * superinterfaces. The elements2 in the array returned are not * sorted and are not in any particular order. This method returns * an array of length 0 if this Class object represents a class or * interface that has no public member methods, or if this Class * object represents an array class, primitive type, or void.

        * *

        The class initialization method is not included in * the returned array. If the class declares multiple public member * methods with the same parameter types, they are all included in * the returned array.

        */ public JMethod[] getMethods(); /** *

        Returns an unordered array of Method objects reflecting all the * methods declared by the class or interface represented by this Class * object. This includes public, protected, default (package) * access, and private methods, but excludes inherited methods. The * elements2 in the array returned are not sorted and are not in any * particular order. This method returns an array of length 0 if the * class or interface declares no methods, or if this Class object * represents a primitive type, an array class, or void. The class * initialization method is not included in the returned * array. If the class declares multiple public member methods with * the same parameter types, they are all included in the returned * array.

        * *

        See The Java Language Specification, section 8.2.

        */ public JMethod[] getDeclaredMethods(); /** *

        Returns an unordered array containing Constructor objects reflecting * all the public constructors of the class represented by this Class * object. An array of length 0 is returned if the class has no * public constructors, or if the class is an array class, or if the * class reflects a primitive type or void.

        */ public JConstructor[] getConstructors(); // This is on java.lang.Class, but is it really useful? // // public JConstructor[] getDeclaredConstructors(); /** * Returns a representation of a java bean property as detailed in section * 8.3 of the Java Beans specification, 'Design Patterns for Properties.' * A JProperty can be thought of as a union of a getter method and * corresponding setter method, although only one of these is required * (view-only and write-only properties are returned). Note that * public fields are never considered properties, as deetailed in * the specification. */ public JProperty[] getProperties(); /** *

        Like getProperties(), but only considers methods explicitly declared * on this class in identifying the properties.

        */ public JProperty[] getDeclaredProperties(); /** *

        Returns true if this JClass represents an interface.

        */ public boolean isInterface(); /** *

        Returns true if this JClass represents a JSR175 annotation type.

        */ public boolean isAnnotationType(); /** * Return true if this JClass represents primitive type (int, long, * double, and so forth). Remember that primitive wrapper classes * such as java.lang.Integer are NOT considered primitives. */ public boolean isPrimitiveType(); /** * Returns true if this class is a builtin type. This is true if any * of the following returns true: isPrimitive(), isArray(), * isVoid(), or
        isUnresolved.. * @return */ public boolean isBuiltinType(); /** *

        If this JClass represents a primitive (isPrimitiveType() returns true), * this method returns the java.lang.Class representing the class of * the primitive. For example, JClass representing an integer returns * the equivalent of 'int.class' or 'java.lang.Integer.type.' * * @return The primitive class, or null if this is JClass is not primitive. */ public Class getPrimitiveClass(); /** * Return true if this class is final. */ public boolean isFinal(); /** * Return true if this class is static. Note that top-level classes * are never static. */ public boolean isStatic(); /** * Return true if this class is abstract. */ public boolean isAbstract(); /** *

        Returns true if this JClass represents the void type.

        */ public boolean isVoidType(); /** *

        Returns true if this JClass represents java.lang.Object.

        */ public boolean isObjectType(); /** *

        Returns true if this JClass represents an array type.

        */ public boolean isArrayType(); /** *

        Returns the Class representing the component type of an array. * If this JClass does not represent an array class this method * returns null.

        * *

        Note that this method differs substantially from * java.lang.Class.getComponentType() in the way it * treats multidimensional arrays. Specifically, let * fooArrayClass be the class of an n dimensional array * of class foo for n > 2. For the java.lang.Class * representation of fooArrayClass, * getComponentType() will return a java.lang.Class for * an (n-1)-dimensional array of foos. By contrast, * the JClass representation of fooArrayClass will * always simply return a JClass representing foo for * any value of n > 1.

        * *

        In other words, this method always returns the 'core' type of * the array, effectively hiding away all of the intermediary array * types. Given that JClass provides the additional * getArrayDimensions facility, it is felt that this is * a much easier convention for tool authors to work with.

        */ public JClass getArrayComponentType(); /** *

        If this JClass represents an array type (isArray() == true), * returns the number of dimensions in the array. Otherwise returns * zero.

        */ public int getArrayDimensions(); /** *

        Determines if the class or interface represented by this Class * object is either the same as, or is a superclass or * superinterface of, the class or interface represented by the * specified Class parameter. It returns true if so; otherwise it * returns false. If this Class object represents a primitive type, * this method returns true if the specified Class parameter is * exactly this Class object; otherwise it returns false.

        * *

        Specifically, this method tests whether the type represented * by the specified Class parameter can be converted to the type * represented by this Class object via an identity conversion or * via a widening reference conversion. See The Java Language * Specification, sections 5.1.1 and 5.1.4 , for details.

        */ public boolean isAssignableFrom(JClass clazz); /** * Two JClasses are always considered equal as long as their * qualified names are the same. */ public boolean equals(Object o); /** *

        Returns an unordered array containing the inner classes for this class. * The array contains JClass objects representing all the public classes and * interfaces that are members of the class represented by this JClass. This * includes public class and interface members inherited from * superclasses and public class and interface members declared by * the class. This method returns an array of length 0 if this Class * object has no public member classes or interfaces. This method * also returns an array of length 0 if this JClass object * represents a primitive type, an array class, or void.

        * *

        Note that no guarantees are made about the ordering of classes * in this array.

        */ public JClass[] getClasses(); /** *

        If this JClass is an inner class, returns the outer class. If * the class or interface represented by this JClass object is a * member of another class, returns the JClass object representing * the class in which it was declared. This method returns null if * this class or interface is not a member of any other class. If * this JClass object represents an array class, a primitive type, * or void, then this method returns null.

        */ public JClass getContainingClass(); /** *

        Returns the name of this member in the format described in * section 4.3.2 of the VM spec, 'Field Descriptors.' This is the * same nasty format returned by java.lang.Class.getName(), and is * the format you need to use in calls to Class.forName(). For * example, the ClassfileName of the class of a two-dimensional * array of strings is [[Ljava.lang.String;. For * details, see * http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html

        */ public String getFieldDescriptor(); /** *

        Returns true if this class is an enumerated type.

        */ public boolean isEnumType(); /** * * @return */ //public boolean isGenericType(); /** *

        Returns the JamClassLoader which loaded this class.

        */ public JamClassLoader getClassLoader(); /** * Shorthand for myClass.getClassLoader().loadClass(name) */ public JClass forName(String name); /** *

        Returns an unordered array of classes that were explicitly imported by * this class using an import statement. It does not include any classes * that might be imported via package imports (i.e. with the '*' wildcard), * nor does it include any classes that are simply used via fully-qualified * name in the body of this class.

        * *

        Note that this is an optional operation; if the source for the class * is not available (i.e. this JClass is backed by a java.lang.Class), then * this method will return an array of length 0.

        */ public JClass[] getImportedClasses(); /** *

        Returns an unordered set of JPackages which are imported by this class * using a package import statement (i.e. with the '*' wildcard), as well as * the containing packages of all of the JClasses returned by * getImportedClasses().

        * *

        Note that this is an optional operation; if the source for the * class is not available (i.e. this JClass is backed by a * java.lang.Class), then this method will return an array of length * 0.

        */ public JPackage[] getImportedPackages(); /** *

        Returns true if a backing entity for this class could not be * resolved. This will be true, for example, of the JClass which * you get when requesting a method's return type when no class for * that type can be found. In this case, the JClass will be have * only a name - all other properties will be null/empty.

        */ public boolean isUnresolvedType(); /** *

        Returns true if this JClass was populated from Java source. This * lets you know whether comments will be viewiable, for example.

        */ public boolean isSourceAvailable(); }./src/org/codehaus/jam/JInvokable.java0000664000175000017500000000650711767656530017024 0ustar brianbrian/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache * XMLBeans", nor may "Apache" appear in their name, without prior * written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 2003 BEA Systems * Inc., . For more information on the Apache Software * Foundation, please see . */ package org.codehaus.jam; /** *

        Base abstraction for something which can be invoked, i.e. a * JConstructor or JMethod.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract interface JInvokable extends JMember { /** *

        Returns representations of the parameters taken by this * method. Returns an array of length 0 if the method takes no * parameters.

        */ public JParameter[] getParameters(); /** *

        Returns representations of the type of each of the exceptions * which can be thrown by this method. Returns an array of length 0 * if the method throws no exceptions.

        */ public JClass[] getExceptionTypes(); } ./src/org/codehaus/jam/JMember.java0000664000175000017500000000616411767656530016320 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents an abstraction which can be member of a class. Such * abstractions include: constructors, methods, fields, and classes * (in the case of inner classes). JMember's share the following * attributes in common: they have some level of access protection * (public/protected/private) and are (usually) contained within a * class.

        * *

        Because classes themselves can be members of other classes, * JClass extends JMember. In the case where a JClass represents a * top-level class (i.e. not an inner class), * JMember.getContainingClass() will always return null.

        * *

        Note that the various access protection levels are all mutually * exclusive. For a given abstraction, only one of isPrivate(), * isPackagePrivate(), isProtected(), or isPublic() will return true. * Note that this information is also exposed via getModifiers(), * which returns a bit-field that is identical to that described in * java.lang.reflect.Modifier.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract interface JMember extends JAnnotatedElement { // ======================================================================== // Public methods /** *

        Returns a representation of the class which contains this * member. Note that if this member is an inner class, this method * returns the class in which this class is declared (i.e. 'outer'). * If this member is a top-level class, this method will always * return null.

        */ public JClass getContainingClass(); /** *

        Returns the modifiers specifier. This is a bit field exactly * like those returned by java.lang.Class.getModifiers() and can be * manipulated using java.lang.reflect.Modifier in the same way.

        */ public int getModifiers(); /** * Return true if this member is package private (i.e. the default * access protection level). */ public boolean isPackagePrivate(); /** * Return true if this member is private. Equivalent to calling * Modifier.isPrivate(member.getModifiers()). */ public boolean isPrivate(); /** * Return true if this member is protected. Equivalent to calling * Modifier.isProtected(member.getModifiers()). */ public boolean isProtected(); /** * Return true if this member is public. Equivalent to calling * Modifier.isProtected(member.getModifiers()). */ public boolean isPublic(); } ./src/org/codehaus/jam/provider/0000775000175000017500000000000011767656530015757 5ustar brianbrian./src/org/codehaus/jam/provider/JamLogger.java0000664000175000017500000000435411767656530020477 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamLogger { /** *

        Outputs a debug message if appropriate for the given object.

        */ public void verbose(String msg, Object ifThisIsVerbose); /** *

        Outputs a debug message if appropriate for the given object.

        */ public void verbose(Throwable t, Object ifThisIsVerbose); /** *

        Outputs a debug message no matter what.

        */ public void verbose(String msg); /** *

        Outputs a debug message no matter what.

        */ public void verbose(Throwable t); /** *

        Outputs a debug message as appropriate.

        */ public void warning(Throwable t); /** *

        Outputs a debug message as appropriate.

        */ public void warning(String w); /** *

        Outputs an error as appropriate.

        */ public void error(Throwable t); /** *

        Outputs an error as appropriate.

        */ public void error(String msg); /** * Enables verbose output in all JAM classes which are equal to or a * subclass of the given classs. */ public void setVerbose(Class c); /** * Returns true if debugging is enabled for the given object. */ public boolean isVerbose(Object o); /** * Returns true if debugging is enabled for the given class. */ public boolean isVerbose(Class c); /** * Returns true if display of warnings is enabled. */ public void setShowWarnings(boolean b); /** * @deprecated */ public boolean isVerbose(); } ./src/org/codehaus/jam/provider/ResourcePath.java0000664000175000017500000000622611767656530021234 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; /** * Represent a file search path, such as a classpath or sourcepath. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class ResourcePath { // ======================================================================== // Factory public static ResourcePath forFiles(File[] files) { return new ResourcePath(files); } // ======================================================================== // Constants //public static final ResourcePath EMPTY_JPATH = new ResourcePath(new File[]{}); // ======================================================================== // Variables private File[] mFiles; // ======================================================================== // Constructors private ResourcePath(File[] files) { if (files == null) throw new IllegalArgumentException("null files"); mFiles = files; } // ======================================================================== // Public methods public URI[] toUriPath() { URI[] out = new URI[mFiles.length]; for(int i=0; i. For more information on the Apache Software * Foundation, please see . */ package org.codehaus.jam.provider; import org.codehaus.jam.annotation.JavadocTagParser; import org.codehaus.jam.visitor.MVisitor; import java.io.File; import java.io.IOException; /** *

        Structure containing information given to a BaseJProvider subclass in * order to instantiate a new JStore. This interface is the flip-side * of JamServiceParams - it provides a view into the params the user specified. * In reality, JamServiceContext and JamServiceParams are implemented by the * same object, JamServiceContextImpl, but it is cleaner to separate * the users' view of that data (which is write-only) from the provider's * view (which is view-only).

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamServiceContext { // ======================================================================== // Public methods /** * @return The classpath to be searched when trying to initialize an MClass * for a java class which was not in the inputSources or inputClasses, * or null. */ public ResourcePath getInputClasspath(); /** * @return The sourcepath to be searched when trying to initialize an MClass * for a java class which was not in the inputSources or inputClasses, or * null. */ public ResourcePath getInputSourcepath(); /** * @return The classpath to be used in loading external classes on which * the service implementation depends, or null. This is not generally * needed. */ public ResourcePath getToolClasspath(); /** * @return an implementation-specific property, as specified by * JamServiceParams.setProperty(). */ public String getProperty(String name); public MVisitor getInitializer(); public ClassLoader[] getReflectionClassLoaders(); public File[] getSourceFiles() throws IOException; public String[] getAllClassnames() throws IOException; public JamLogger getLogger(); public JamClassBuilder getBaseBuilder(); /** *

        Returns the JavadocTagParser to be used in processing javadoc tags. * This never returns null - if no parser was specified by the user, * the default one is used. This method should be used only by * JavadocClassBuilder.

        */ public JavadocTagParser getTagParser(); /** *

        Returns the character encoding to be used in reading java * source files, or null if the default encoding should be used.

        */ public String getCharacterEncoding(); //public PrintWriter getOut(); public boolean is14WarningsEnabled(); }./src/org/codehaus/jam/provider/JamClassBuilder.java0000664000175000017500000001346211767656530021634 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; import org.codehaus.jam.internal.elements.ClassImpl; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.mutable.MClass; /** *

        Implemented by providers to build and initialize classes on demand. * The main responsibility a JAM provider has is writing an extension of this * class. *

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class JamClassBuilder { // ======================================================================== // Variables private ElementContext mContext = null; // ======================================================================== // Public methods /** * This method is called by JAM to initialize this class builder. Extending * classes can override this to perform additional initialization work * (just remember to call super.init()!). * * @param ctx */ public void init(ElementContext ctx) { if (mContext != null) { throw new IllegalStateException("init called more than once"); } if (ctx == null) throw new IllegalArgumentException("null ctx"); mContext = ctx; } // ======================================================================== // Abstract methods /** *

        This is called by JAM when it attempts to load a class. If the * builder has access to an artifact (typically a java source or classfile) * that represents the given type, it should call createClassToBuild() to get * a new instance of MClass and then return it. No caching should be * performed - if an MClass is going to be returned, it should be a new * instance returned by createClassToBuild()

        * *

        If no artififact is available, the builder should just return null, * signalling that other JamClassBuilders should attempt to build the * class.

        * * @param packageName * @param className * @return */ public abstract MClass build(String packageName, String className); // ======================================================================== // Protected methods /** *

        When a JamClassBuilder decides that it is going to be able * to respond to a build() request, it must call this method to get an * initial instance of MClass to return.

        * * @param packageName qualified name of the package that contains the * class to create * @param className simple name of the class to create. * @param importSpecs array of import specs to be used in the class, * or null if not known or relevant. Import specs are only strictly * required if the builder is planning on setting any unqualified type * references on the class. The importspec values will be used in * determining what is retuned by JClass.getImportedPackages() and * getImportedClasses(). Note that an importSpec does not include the * word 'import' - e.g. it should only be 'java.util.List' or 'java.util.*' */ protected MClass createClassToBuild(String packageName, String className, String[] importSpecs, JamClassPopulator pop) { if (mContext == null) throw new IllegalStateException("init not called"); if (packageName == null) throw new IllegalArgumentException("null pkg"); if (className == null) throw new IllegalArgumentException("null class"); if (pop == null) throw new IllegalArgumentException("null pop"); assertInitialized(); className = className.replace('.','$'); ClassImpl out = new ClassImpl(packageName,className,mContext,importSpecs,pop); return out; } /** *

        When a JamClassBuilder decides that it is going to be able * to respond to a build() request, it must call this method to get an * initial instance of MClass to return.

        * * @param packageName qualified name of the package that contains the * class to create * @param className simple name of the class to create. * @param importSpecs array of import specs to be used in the class, * or null if not known or relevant. Import specs are only needed if * the builder is planning on setting any unqualified type references * on the class. */ protected MClass createClassToBuild(String packageName, String className, String[] importSpecs) { if (mContext == null) throw new IllegalStateException("init not called"); if (packageName == null) throw new IllegalArgumentException("null pkg"); if (className == null) throw new IllegalArgumentException("null class"); assertInitialized(); className = className.replace('.','$'); ClassImpl out = new ClassImpl(packageName,className,mContext,importSpecs); return out; } protected JamLogger getLogger() { return mContext.getLogger(); } /** * Asserts that init() has been called on this class builder. */ protected final void assertInitialized() { if (mContext == null) { throw new IllegalStateException(this+" not yet initialized."); } } }./src/org/codehaus/jam/provider/JamServiceFactoryImpl.java0000664000175000017500000002226311767656530023031 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; import org.codehaus.jam.JClass; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.JamService; import org.codehaus.jam.JamServiceFactory; import org.codehaus.jam.JamServiceParams; import org.codehaus.jam.internal.JamClassLoaderImpl; import org.codehaus.jam.internal.JamServiceContextImpl; import org.codehaus.jam.internal.JamServiceImpl; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.internal.javadoc.JavadocClassBuilder; import org.codehaus.jam.internal.parser.ParserClassBuilder; import org.codehaus.jam.internal.reflect.ReflectClassBuilder; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; /** *

        Default implementation of the JamServiceFactory singleton. Custom * JAM providers need to extend this class and override whatever methods * they need to.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamServiceFactoryImpl extends JamServiceFactory { // ======================================================================== // Constants /** *

        Service context property which turns on the javadoc killer. * This will be removed when javadoc has been phased out.

        */ public static final String USE_NEW_PARSER = "JamServiceFactoryImpl.use-new-parser"; private static final String PREFIX = "[JamServiceFactoryImpl]"; // ======================================================================== // Constructors public JamServiceFactoryImpl() {} // ======================================================================== // JamServiceFactory implementation public JamServiceParams createServiceParams() { return new JamServiceContextImpl(); } public JamService createService(JamServiceParams jsps) throws IOException { //assert that they aren't implementing JamServiceParams themselves or //getting them from somewhere else if (!(jsps instanceof JamServiceContextImpl)) { throw new IllegalArgumentException ("JamServiceParams must be instantiated by this JamServiceFactory."); } //create and return the service JamClassLoader clToUse = createClassLoader((JamServiceContextImpl)jsps); //this is a nasty way to shoehorn it in there, should do better ((JamServiceContextImpl)jsps).setClassLoader(clToUse); return new JamServiceImpl((ElementContext)jsps, getSpecifiedClasses((JamServiceContextImpl)jsps)); } public JamClassLoader createSystemJamClassLoader() { JamServiceParams params = createServiceParams(); params.setUseSystemClasspath(true); try { JamService service = createService(params); return service.getClassLoader(); } catch(IOException reallyUnexpected) { reallyUnexpected.printStackTrace(); throw new IllegalStateException(reallyUnexpected.getMessage()); } } public JamClassLoader createJamClassLoader(ClassLoader cl) { JamServiceParams params = createServiceParams(); params.setUseSystemClasspath(false); //? params.setPropertyInitializer(null); params.addClassLoader(cl); try { JamService service = createService(params); return service.getClassLoader(); } catch(IOException reallyUnexpected) { reallyUnexpected.printStackTrace(); throw new IllegalStateException(reallyUnexpected.getMessage()); } } // ======================================================================== // Protected methods - override these at your own risk /** *

        Returns the set of classes to be included in a JamService to be * created by the given params. You should not override this * unless you really know what you're doing.

        */ protected String[] getSpecifiedClasses(JamServiceContext params) throws IOException { return params.getAllClassnames(); } /** *

        Creates the main classloader to be used given the input ctx. * This is usually a composite of the source classloader and a * classfile classloader. Subclasses may override to change the behavior. *

        */ protected JamClassLoader createClassLoader(JamServiceContext ctx) throws IOException { JamClassBuilder builder = createBuilder(ctx); return new JamClassLoaderImpl((ElementContext)ctx,//eww builder,ctx.getInitializer()); } /** *
        */ protected JamClassBuilder createSourceBuilder(JamServiceContext ctx) throws IOException { File[] sources = ctx.getSourceFiles(); if (sources == null || sources.length == 0) { if (ctx.getLogger().isVerbose(this)) { ctx.getLogger().verbose(PREFIX+ "no source files present, "+ "skipping source ClassBuilder"); } return null; } if(ctx.getProperty(USE_NEW_PARSER) == null) { return new JavadocClassBuilder(); } else { return new ParserClassBuilder(ctx); } } /** *

        Creates the class-based classbuilder for the given context. * If no class files or classloaders are specified in the params, * just returns null.

        */ protected JamClassBuilder createClassfileBuilder(JamServiceContext jp) throws IOException { //FIXME someday should make the name of the service class to use here //settable via a system property ResourcePath cp = jp.getInputClasspath(); if (cp == null) { return null; } else { URL[] urls = cp.toUrlPath(); ClassLoader cl = new URLClassLoader(urls); return new ReflectClassBuilder(cl); } } /** *

        Creates a source class loader that is based on javadoc. This * is currently the default, but someday that will change.

        protected JamClassBuilder createJavadocSourceBuilder(JamServiceContext ctx) throws IOException { //FIXME someday should make the name of the service class to use here //settable via a system property File[] files = ctx.getSourceFiles(); if (files == null || files.length == 0) return null; String sourcePath = (ctx.getInputSourcepath() == null) ? null : ctx.getInputSourcepath().toString(); String classPath = (ctx.getInputClasspath() == null) ? null : ctx.getInputClasspath().toString(); return JavadocRunner.getInstance(). create(files, parent, ctx.getOut(), sourcePath, classPath, null);//FIXME get javadoc args from param props } */ } ./src/org/codehaus/jam/provider/CompositeJamClassBuilder.java0000664000175000017500000000362611767656530023520 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.mutable.MClass; /** *

        Composite implementation of JamClassBuilder. When building, * the first one in the list to not return null wins.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class CompositeJamClassBuilder extends JamClassBuilder { // ======================================================================== // Variables private JamClassBuilder[] mBuilders; // ======================================================================== // Constructors public CompositeJamClassBuilder(JamClassBuilder[] builders) { if (builders == null) throw new IllegalArgumentException("null builders"); mBuilders = builders; } // ======================================================================== // JamClassBuilder implementation public void init(ElementContext ctx) { for(int i=0; i

        Classes to be used or implemented by custom JAM providers.

        ./src/org/codehaus/jam/provider/JamClassPopulator.java0000664000175000017500000000230411767656530022224 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.provider; import org.codehaus.jam.mutable.MClass; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamClassPopulator { /** *

        Called by JAM to 'fill out' an instance of a given MClass with * things like methods and fields. The implementing builder is responsible * for inspecting the source artifact (typically a source or class file) * to call the appropriate createX methods on the given MClass.

        * * @param c */ public abstract void populate(MClass c); } ./src/org/codehaus/jam/JamServiceParams.java0000664000175000017500000002563311767656530020175 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import org.codehaus.jam.annotation.JavadocTagParser; import org.codehaus.jam.provider.JamClassBuilder; import org.codehaus.jam.provider.JamLogger; import org.codehaus.jam.visitor.MVisitor; import java.io.File; import java.io.PrintWriter; /** *

        Used to specify the parameters with which a JamService will be * created.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamServiceParams { // ======================================================================== // Public methods /** *

        Include a single java source file to be viewed. Note that if your * code is able to understand the file/package structure in which the * source exists, you may get better performance by using the various * include... methods which take a sourcepath parameter.

        */ public void includeSourceFile(File file); /** * Specifies a set of java source files to be included in the JamService. * *

        Note that calling this method implicitly includes the 'root' in * the sourcepath (exactly as if addSourcepath(root) had been called).

        * * @param sourcepath Root directory/ies containing source files. * @param pattern A relative file pattern (as described above under * 'Include and Exclude Patterns'). * @throws IllegalArgumentException if either argument is null. */ public void includeSourcePattern(File[] sourcepath, String pattern); /** * Specifies a set of java source files to be excluded in the JamService. * Note that calling this method implicitly includes the 'sourcepath' in * the sourcepath (as in a call to addSourcepath(sourcepath)). * * @param sourcepath Root directory of the source files. * @param pattern A relative file pattern (as described above under * 'Include and Exclude Patterns'). * @throws IllegalArgumentException if either argument is null. */ public void excludeSourcePattern(File[] sourcepath, String pattern); /** * Specifies a set of java class files to be excluded in the JamService. * Note that calling this method implicitly includes the 'classpath' in * the classpath (as in a call to addClasspath(classpath)). * * @param classpath Root directory of the source files. * @param pattern A relative file pattern (as described above under * 'Include and Exclude Patterns'). * @throws IllegalArgumentException if either argument is null. */ public void includeClassPattern(File[] classpath, String pattern); /** * Specifies a set of java class files to be excluded from the JamService. * Note that calling this method implicitly includes the 'classpath' in * the classpath (as in a call to addClasspath(classpath)). * * @param classpath Root directory of the source files. * @param pattern A relative file pattern (as described above under * 'Include and Exclude Patterns'). * @throws IllegalArgumentException if either argument is null. */ public void excludeClassPattern(File[] classpath, String pattern); /** *

        Includes a single source File in the JamService. The sourcepath parameter * should identify the source sourcepath of the java source file; the sourceFile * parameter must be under the sourcepath subtree.

        * *

        For example, if a class "foo.bar.MyClass" is stored in a file * "c:/myproject/src/foo/bar/MyClass.java", that class could be included in * the service by calling

        * *
           *  includeSourceFile(new File("c:/myproject/src"),
           *                    new File("c:/myproject/src/foo/bar/MyClass.java"));
           * 
        * *

        Note that this equivalent to calling

        * *
           *  includeSourceFiles(new File("c:/myproject/src"),"foo/bar/MyClass.java");
           * 
        * *

        If you are calling this method and have more than one sourcepath directory, * and do not readily know which is the correct sourcepath for a given source * File, you can use the getRootForFile() utility method to determine the * correct sourcepath to use.

        * *

        Note that calling this method implicitly includes the 'sourcepath' in * the sourcepath (exactly as if addSourcepath(sourcepath) had been called).

        * * @param sourcepath source sourcepath for the java source file * @param sourceFile the java source file * @throws IllegalArgumentException if either argument is null or if * sourcepath is not an ancestor of sourceFile in the file system. */ public void includeSourceFile(File[] sourcepath, File sourceFile); /** *

        Excludes a single source File in the JamService in exactly the same * way theat includeSourceFile() includes a source file. */ public void excludeSourceFile(File[] sourcepath, File sourceFile); /** *

        Includes a single class File in the JamService in exactly the same * way theat includeSourceFile() includes a source file. */ public void includeClassFile(File[] sourcepath, File sourceFile); /** *

        Excludes a single class File in the JamService in exactly the same * way theat includeSourceFile() includes a source file. */ public void excludeClassFile(File[] sourcepath, File sourceFile); /** * Names a specific class to be included in the JamService. Note that * this will return an 'unresolved' JClass unless a source or class file * for the named class is available in the classpath or sourcepath. * * @param qualifiedClassname a full-qualified classname * @throws IllegalArgumentException if the argument is null or not * a valid classname. */ public void includeClass(String qualifiedClassname); /** * Names a specific class to be excluded in the JamService. Note that * this will have no affect if the named class cannot be found in the * sourcepath or classpath. * * @param qualifiedClassname a full-qualified classname * @throws IllegalArgumentException if the argument is null or not * a valid classname. */ public void excludeClass(String qualifiedClassname); /** * Adds an elements to the JamService sourcepath. The service's JamClassLoader * will search this path to find a .java file on which to base a JClass * when requested to load a class that was not included in the service. */ public void addSourcepath(File sourcepathElement); /** * Adds an elements to the JamService classpath. The service's JamClassLoader * will search this path to find a .class file on which to base a JClass * when requested to load a class that was not included in the service * and for which no source could be found in the sourcepath. * * @param classpathElement elements of the classpath * @throws IllegalArgumentException if the argument is null */ public void addClasspath(File classpathElement); /** * Sets a PrintWriter to which the JamService implementation should log * errors and debugging information. If this is never set, all such output * will be suppressed. * * @param out a PrintWriter to write to * @throws IllegalArgumentException if the argument is null */ public void setLoggerWriter(PrintWriter out); /** * Sets the JamLogger which will receive error and warning messages from * JAM. */ public void setJamLogger(JamLogger logger); /** *

        Enables verbose debugging output from all instances of the given * class.

        */ public void setVerbose(Class c); /** *

        Enables or suppresses the logging of warning messages. By default * this is true.

        */ public void setShowWarnings(boolean b); /** * Sets the parent JamClassLoader of the service JamClassLoader. * * @param loader the parent loaer * @throws IllegalArgumentException if the argument is null */ public void setParentClassLoader(JamClassLoader loader); /** *

        Adds an elements to the tool classpath. This is the classpath that * will be used by the JamService implementation to find any libraries * on which it depends. This classpath is distinct from the service * classpath set by addClasspath() in that it has no affect on the input * class set - it's only used for finding classes on which JAM * itself depends.

        * * @param classpathElement elements of the classpath * @throws IllegalArgumentException if the argument is null */ public void addToolClasspath(File classpathElement); //DOCME public void setPropertyInitializer(MVisitor initializer); //DOCME public void addInitializer(MVisitor initializer); /** *

        Specifies whether the JAM Service should load classes from the system * classpath. The default for this is true, and you shouldn't set it to * false unless you really know what you are doing.

        */ public void setUseSystemClasspath(boolean use); /** *

        Adds a custom JamClassBuilder which will be consulted by the * JamClassLoader when constructing representation of java types. The given * class builder will have priority over priority over JAM's default * source- and reflection-based ClassBuilders. If this method id * called more than once, the extra class builders will be prioritized * in the order in which they were added.

        */ public void addClassBuilder(JamClassBuilder cb); /** * DOCME */ public void addClassLoader(ClassLoader cl); /** *

        Sets an implementation-specific property.

        */ public void setProperty(String name, String value); /** *

        Sets whether warnings should be displayed when running under * JDK 1.4. The default is true.

        */ public void set14WarningsEnabled(boolean b); /** * Sets the encoding to use when reading java source files (e.g. "UTF-8"). * If this is not set, the vm's default encoding will be used. */ public void setCharacterEncoding(String enc); /** * @deprecated use setVerbose(Class). This is the same as * setVerbose(Object.class). */ public void setVerbose(boolean v); /** * @deprecated The javadoc tag mapping mechanism in JAM has been deprecated. * Instead, please use Annogen to do tag-to-175 mappings. */ public void setJavadocTagParser(JavadocTagParser tp); }./src/org/codehaus/jam/annotation/0000775000175000017500000000000011767656530016277 5ustar brianbrian./src/org/codehaus/jam/annotation/DefaultAnnotationProxy.java0000664000175000017500000001072611767656530023631 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.annotation; import org.codehaus.jam.JAnnotationValue; import org.codehaus.jam.JClass; import org.codehaus.jam.internal.elements.AnnotationValueImpl; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.provider.JamLogger; import org.codehaus.jam.provider.JamServiceContext; import java.util.ArrayList; import java.util.List; /** *

        Implementation of AnnotationProxy which is used when no user-defined * type has been registered for a given annotation.. All it does is stuff * values into a ValueMap. Note that it inherits all of the default tag and * annotation processing behaviors from AnnotationProxy.

        * * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ /** * @deprecated do not use, moving into internal */ public class DefaultAnnotationProxy { // ======================================================================== // Constants /** *

        Name of the member of annotations which have only a single member. * As specified in JSR175, that name is "value", but you should use * this constant to prevent typos.

        */ public static final String SINGLE_MEMBER_NAME = "value"; // ======================================================================== // Variables protected JamServiceContext mContext; // ======================================================================== // Initialization methods - called by JAM, don't implement /** *

        Called by JAM to initialize the proxy. Do not try to call this * yourself.

        */ public void init(JamServiceContext ctx) { if (ctx == null) throw new IllegalArgumentException("null logger"); mContext = ctx; } //docme public JAnnotationValue getValue(String named) { if (named == null) throw new IllegalArgumentException("null name"); //FIXME this impl is very gross named = named.trim(); JAnnotationValue[] values = getValues(); for(int i=0; iOverrides this behavior to simply stuff the value into our * annotation map. The super class' implementation would try to * find a bunch of setters that we don't have.

        */ public void setValue(String name, Object value, JClass type) { if (name == null) throw new IllegalArgumentException("null name"); if (type == null) throw new IllegalArgumentException("null type"); if (value == null) throw new IllegalArgumentException("null value"); name = name.trim(); mValues.add(new AnnotationValueImpl((ElementContext)mContext,//yikes, nasty. FIXME name,value,type)); } // ======================================================================== // Private methods /** *

        Returns an instance of JamLogger that this AnnotationProxy should use * for logging debug and error messages.

        */ private JamLogger getLogger() { return mContext.getLogger(); } } ./src/org/codehaus/jam/annotation/JavadocTagParser.java0000664000175000017500000001161011767656530022321 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.annotation; import com.sun.javadoc.SourcePosition; import com.sun.javadoc.Tag; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.mutable.MAnnotatedElement; import org.codehaus.jam.mutable.MAnnotation; import org.codehaus.jam.mutable.MSourcePosition; import org.codehaus.jam.provider.JamLogger; import org.codehaus.jam.provider.JamServiceContext; /** * @deprecated * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class JavadocTagParser { // ======================================================================== // Variables private JamServiceContext mContext = null; private boolean mAddSingleValueMembers = false; // ======================================================================== // Public methods /** *

        If true, all annotations will be given a single-member value whose * value is the full raw contents of the javadoc tag. The name of this * member is JAnnotation.SINGLE_MEMBER_VALUE, or 'value'. Note that this * member will be overrdden in the event that the tag contains an * explicit value named 'value'.

        * *

        The default for this setting is false.

        * * @param b */ public void setAddSingleValueMembers(boolean b) { mAddSingleValueMembers = b; } /** *

        Called by JAM to initialize the parser. Do not try to call this * yourself.

        */ public void init(JamServiceContext ctx) { if (ctx == null) throw new IllegalArgumentException("null logger"); if (mContext != null) throw new IllegalStateException ("JavadocTagParser.init() called twice"); mContext = ctx; } // ======================================================================== // Abstract methods public abstract void parse(MAnnotatedElement target, Tag tag); // ======================================================================== // Protected methods protected MAnnotation[] createAnnotations(MAnnotatedElement target, Tag tag) { String tagName = tag.name().trim().substring(1); //MAnnotation out = target.addAnnotation(tagName); MAnnotation current = target.getMutableAnnotation(tagName); if (current == null) { current = target.findOrCreateAnnotation(tagName); setPosition(current,tag); } MAnnotation literal = target.addLiteralAnnotation(tagName); setPosition(literal,tag); MAnnotation[] out = new MAnnotation[] {literal,current}; if (mAddSingleValueMembers) setSingleValueText(out,tag); return out; } // subclasses might want to override this to change the way tag values // are mapped into typed values protected void setValue(MAnnotation[] anns, String memberName, String value) { value = value.trim(); memberName = memberName.trim(); for(int i=0; iAttempts to parse tag contents as a series of line-delimited name-value * pairs.

        * * @deprecated The tag mapping mechanism in JAM has been deprecated. * Instead, please use Annogen to do tag-to-175 mappings. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class LineDelimitedTagParser extends JavadocTagParser { // ======================================================================== // Constants private static final String VALUE_QUOTE = "\""; private static final String LINE_DELIMS = "\n\f\r"; // ======================================================================== // JavadocTagParser implementation public void parse(MAnnotatedElement target, Tag tag) { if (target == null) throw new IllegalArgumentException("null tagText"); if (tag == null) throw new IllegalArgumentException("null tagName"); MAnnotation[] anns = createAnnotations(target,tag); String tagText = tag.text(); StringTokenizer st = new StringTokenizer(tagText, LINE_DELIMS); while (st.hasMoreTokens()) { String pair = st.nextToken(); int eq = pair.indexOf('='); if (eq <= 0) continue; // if absent or is first character String name = pair.substring(0, eq).trim(); if (eq < pair.length() - 1) { String value = pair.substring(eq + 1).trim(); if (value.startsWith(VALUE_QUOTE)) { value = parseQuotedValue(value.substring(1),st); } setValue(anns,name,value); } } } // ======================================================================== // Private methods private String parseQuotedValue(String line, StringTokenizer st) { StringWriter out = new StringWriter(); while(true) { int endQuote = line.indexOf(VALUE_QUOTE); if (endQuote == -1) { out.write(line); if (!st.hasMoreTokens()) return out.toString(); out.write('\n'); line = st.nextToken().trim(); continue; } else { out.write(line.substring(0,endQuote).trim()); return out.toString(); } } } } ./src/org/codehaus/jam/annotation/WhitespaceDelimitedTagParser.java0000664000175000017500000001460011767656530024671 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.annotation; import com.sun.javadoc.Tag; import org.codehaus.jam.mutable.MAnnotatedElement; import org.codehaus.jam.mutable.MAnnotation; import java.util.Enumeration; import java.util.Properties; /** * This provides ejbgen-style tag parsing: tag contents * are treated as whitespace-separated name=value pairs, where values * can be double-quoted. * * @deprecated The tag mapping mechanism in JAM has been deprecated. * Instead, please use Annogen to do tag-to-175 mappings. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class WhitespaceDelimitedTagParser extends JavadocTagParser { public void parse(MAnnotatedElement target, Tag tag) { MAnnotation[] anns = createAnnotations(target,tag); String tagText = tag.text(); if (tagText == null) return; tagText = tagText.trim(); if (tagText.length() == 0) return; Properties props = new Properties(); parseAssignments(props,tagText); //FIXME no need to create Properties here if (props.size() > 0) { Enumeration names = props.propertyNames(); while(names.hasMoreElements()) { String name = (String)names.nextElement(); setValue(anns,name,props.getProperty(name)); } } else { //add the single member text if and only if there are no name-value //pairs. this is how ejbgen likes it but i'm not sure it's the right //thing - might be nicer to have the info always available setSingleValueText(anns,tag); } } // ======================================================================== // Private methods //REVIEW the comment parsing logic here should be factored and made pluggable /** * Parse a line that contains assignments, taking into account * - newlines (ignore them) * - double quotes (the value is everything in-between) * - // (everything after is ignored) * - multiple assignments on the same line * * @param out This variable will contain a list of properties * representing the line once parsed. * @param line The line to be parsed * * This method contributed by Cedric Beust */ public void parseAssignments(Properties out, String line) { getLogger().verbose("PARSING LINE " + line,this); String originalLine = line; line = removeComments(line); while (null != line && -1 != line.indexOf("=")) { int keyStart = -1; int keyEnd = -1; int ind = 0; // Skip stuff before the key char c = line.charAt(ind); while (isBlank(c)) { ind++; c = line.charAt(ind); } keyStart = ind; while (isLegal(line.charAt(ind))) ind++; keyEnd = ind; String key = line.substring(keyStart, keyEnd); ind = line.indexOf("="); if (ind == -1) { return; //FIXME let's be a little conservative, just for now //throw new IllegalStateException("'=' expected: "+line); } ind++; // Skip stuff after the equal sign try { c = line.charAt(ind); } catch(StringIndexOutOfBoundsException ex){ ex.printStackTrace(); } while (isBlank(c)) { ind++; c = line.charAt(ind); } String value; int valueStart = -1; int valueEnd = -1; if (c == '"') { valueStart = ++ind; while ('"' != line.charAt(ind)) { ind++; if (ind >= line.length()) { getLogger().verbose("missing double quotes on line "+line,this); } } valueEnd = ind; } else { valueStart = ind++; while (ind < line.length() && isLegal(line.charAt(ind))) ind++; valueEnd = ind; } value = line.substring(valueStart, valueEnd); if (ind < line.length()) { line = line.substring(ind + 1); } else { line = null; } getLogger().verbose("SETTING KEY:"+key+" VALUE:"+value,this); out.setProperty(key, value); } } /** * Remove all the texts between "//" and '\n' * * This method contributed by Cedric Beust */ private String removeComments(String value) { String result = ""; int size = value.length(); String current = value; int currentIndex = 0; int beginning = current.indexOf("//"); // // Ignore // if it's between double quotes // int doubleQuotesIndex = current.indexOf("\""); if (-1 != doubleQuotesIndex && doubleQuotesIndex < beginning) { // do nothing result = value; } else { while (currentIndex < size && beginning != -1) { beginning = value.indexOf("//", currentIndex); if (-1 != beginning) { if (beginning > 0 && value.charAt(beginning-1) == ':') { //this is a quick fix for problem of unquoted url values. for //now, just say it's not a comment if preceded by ':'. should //review this later currentIndex = beginning+2; continue; } int end = value.indexOf('\n', beginning); if (-1 == end) end = size; // We have identified a portion to remove, copy the one we want to // keep result = result + value.substring(currentIndex, beginning).trim() + "\n"; current = value.substring(end); currentIndex = end; } } result += current; } return result.trim(); } private boolean isBlank(char c) { return c == ' ' || c == '\t' || c == '\n'; } private boolean isLegal(char c) { return (! isBlank(c)) && c != '='; // return Character.isJavaIdentifierStart(c) || c == '-' || Character.isDigit(c) || c == '.'; } } ./src/org/codehaus/jam/annotation/package.html0000664000175000017500000000013211767656530020554 0ustar brianbrian

        Provides extension machinery for exposing metadata.

        ./src/org/codehaus/jam/JMethod.java0000664000175000017500000000612311767656530016324 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** * Represents a method of a java class. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JMethod extends JInvokable { /** *

        Returns a JClass object representing the type of this methods * return value. Note that void methods will return a JClass * for which isVoidType() returns true.

        */ public JClass getReturnType(); /** * Return true if this method is declared final. */ public boolean isFinal(); /** * Return true if this method is static. */ public boolean isStatic(); /** * Return true if this member is abstract. */ public boolean isAbstract(); /** * Returns true if this method is declared native. */ public boolean isNative(); /** * Returns true if this method is declared synchronized. */ public boolean isSynchronized(); /** *

        Returns a qualied name for this method as specified by * java.lang.reflect.Method.toString():

        * *

        * Returns a string describing this Method. The string is formatted as * the method access modifiers, if any, followed by the method return * type, followed by a space, followed by the class declaring the method, * followed by a period, followed by the method name, followed by a * parenthesized, comma-separated list of the method's formal parameter * types. If the method throws checked exceptions, the parameter list is * followed by a space, followed by the word throws followed by a * comma-separated list of the thrown exception types. For example:

        * *

        public boolean java.lang.Object.equals(java.lang.Object)

        * *

        The access modifiers are placed in canonical order as specified by * "The Java Language Specification". This is public, protected or private * first, and then other modifiers in the following order: abstract, * static, final, synchronized native.

        */ public String getQualifiedName(); /** * Returns the name of this class in the format described in section * 4.3.3 of the VM spec, 'Class File Format: Method Descriptors.' * This is the nasty format of the name returned by * java.lang.reflect.Method.getName(). For details, see * http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html */ // public String getMethodDescriptor(); dunno if this is useful } ./src/org/codehaus/jam/mutable/0000775000175000017500000000000011767656530015556 5ustar brianbrian./src/org/codehaus/jam/mutable/MClass.java0000664000175000017500000001316511767656530017611 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JClass; import org.codehaus.jam.JMethod; import org.codehaus.jam.JProperty; /** *

        Mutable version of JClass.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MClass extends MMember, JClass { public void setIsInterface(boolean b); public void setIsAnnotationType(boolean b); public void setIsEnumType(boolean b); /** * Sets the class which this class extends. The class name must be fully- * qualified. Pass null to make the class extend nothing. * * @throws IllegalArgumentException if the name is not a valid class name. */ public void setSuperclass(String qualifiedClassName); /** * Sets the name of this class that this class extends. The name * may or may nor be fully-qualified. Pass null to make the class * extend nothing. * * @throws IllegalArgumentException if the name is not a valid class name. */ public void setSuperclassUnqualified(String unqualifiedClassName); /** * Sets the class which this class extends. Pass null to make the class * extend nothing. * * @throws IllegalArgumentException if the given class cannot be extended * (i.e. final classes, interfaces, void, primitives, arrays). */ public void setSuperclass(JClass clazz); /** * Adds to the list of interfaces implemented by this class. * * @throws IllegalArgumentException if the parameter is null or is not * a valid class name. */ public void addInterface(String className); /** * Adds to the list of interfaces implemented by this class. The class name * may or may not be qualified. * * @throws IllegalArgumentException if the parameter is null or is not * a valid class name. */ public void addInterfaceUnqualified(String unqualifiedClassName); /** * Adds to the list of interfaces implemented by this class. * * @throws IllegalArgumentException if the given class cannot be implemented * (i.e. is not an interface). */ public void addInterface(JClass interf); /** * Removes a named interface from the list of interfaces implemented by * this class. Does nothing if the class does not implement the named * interface. * * @throws IllegalArgumentException if the parameter is null or is not * a valid class name. */ public void removeInterface(String className); /** * Removes an interface from the list of interfaces implemented by * this class. Does nothing if the class does not implement the named * interface. * * @throws IllegalArgumentException if the parameter is null or is not * an interface. */ public void removeInterface(JClass interf); /** * Creates a new constructor, adds it to this class, and returns it. */ public MConstructor addNewConstructor(); /** * Removes a constructor from this class. Does nothing if the given * constructor is not on this class. */ public void removeConstructor(MConstructor constr); /** * Returns the constructors declared on this class. This does not include * constructors from any base class or interface. This is simply a more * strongly-typed version of getDeclaredConstructors(). */ public MConstructor[] getMutableConstructors(); /** * Creates a new field, adds it to this class, and returns it. * The type of the field must be qualified */ public MField addNewField(); /** * Removes the given field from this class. Does nothing if this class * does not contain the field. */ public void removeField(MField field); /** * Returns the fields declared on this class. This does not include * fields from any base class or interface. This is simply a more * strongly-typed version of getDeclaredFields(). */ public MField[] getMutableFields(); /** * Creates a new method, adds it to this class, and returns it. */ public MMethod addNewMethod(); /** * Removes the given method from this class. Does nothing if this class * does not contain the method. */ public void removeMethod(MMethod method); /** * Returns the EditableMethods declared on this class. This does not * include methods inherited from any base class or interface. This is * simply a more strongly-typed version of getDeclaredMethods(). */ public MMethod[] getMutableMethods(); public JProperty addNewProperty(String name, JMethod getter, JMethod setter); public void removeProperty(JProperty prop); public JProperty addNewDeclaredProperty(String name, JMethod getter, JMethod setter); public void removeDeclaredProperty(JProperty prop); public MClass addNewInnerClass(String name); public void removeInnerClass(MClass clazz); /** *

        Sets whether this JClass was populated from Java source. The default * is false.

        */ public void setSourceAvailable(boolean b); }./src/org/codehaus/jam/mutable/MSourcePosition.java0000664000175000017500000000251511767656530021526 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JSourcePosition; import java.net.URI; /** *

        Mutable version of JSourcePosition.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MSourcePosition extends JSourcePosition { /** * Sets the text column number for this source position. Set to -1 if * it is not known. */ public void setColumn(int col); /** * Sets the text line number for this source position. Set to -1 if * it is not known. */ public void setLine(int line); /** * Sets the URI of the source file. Set to null if it is not known. */ public void setSourceURI(URI uri); }./src/org/codehaus/jam/mutable/MAnnotatedElement.java0000664000175000017500000000167311767656530021774 0ustar brianbrianpackage org.codehaus.jam.mutable; import org.codehaus.jam.JAnnotatedElement; /** *

        Mutable version of JAnnotatedElement.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MAnnotatedElement extends MElement, JAnnotatedElement { /** * Returns the annotation having the given name, creating it if it doesn't * exist. */ public MAnnotation findOrCreateAnnotation(String annotationName); public MAnnotation[] getMutableAnnotations(); //DOCME public MAnnotation getMutableAnnotation(String named); //DOCME public MAnnotation addLiteralAnnotation(String annotationName); // public MAnnotation[] getLiteralMutableAnnotations(); // public MAnnotation[] getLiteralMutableAnnotations(String named); //DOCME public MComment getMutableComment(); //DOCME public MComment createComment(); //DOCME public void removeComment(); } ./src/org/codehaus/jam/mutable/MTag.java0000664000175000017500000000171611767656530017256 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JTag; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MTag extends MElement, JTag { /** * Same as simple name. */ public void setName(String name); /** * Raw text of the javadoc tag. */ public void setValue(String val); } ./src/org/codehaus/jam/mutable/MElement.java0000664000175000017500000000251411767656530020131 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JElement; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.visitor.MVisitor; /** *

        Mutable version of JElement.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MElement extends JElement { public JamClassLoader getClassLoader(); //DOCME public void setSimpleName(String name); //DOCME public MSourcePosition createSourcePosition(); //DOCME public void removeSourcePosition(); //DOCME public MSourcePosition getMutableSourcePosition(); //DOCME public void accept(MVisitor visitor); //DOCME public void setArtifact(Object o); }./src/org/codehaus/jam/mutable/MConstructor.java0000664000175000017500000000162411767656530021066 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JConstructor; /** *

        Mutable version of JConstructor.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MConstructor extends JConstructor, MInvokable { } ./src/org/codehaus/jam/mutable/MPackage.java0000664000175000017500000000166211767656530020076 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JPackage; /** *

        Mutable version of JPackage.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MPackage extends JPackage, MAnnotatedElement { public MClass[] getMutableClasses(); } ./src/org/codehaus/jam/mutable/MMember.java0000664000175000017500000000166311767656530017753 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JMember; /** *

        Mutable version of JMember.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MMember extends MAnnotatedElement, JMember { public void setModifiers(int modifiers); } ./src/org/codehaus/jam/mutable/MAnnotation.java0000664000175000017500000000266511767656530020661 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; /** *

        Mutable version of JAnnotation.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MAnnotation extends JAnnotation, MElement { // ======================================================================== // MAnnotation implementation public void setAnnotationInstance(Object o); public void setSimpleValue(String name, Object value, JClass declaredType); public MAnnotation createNestedValue(String name, String annTypeName); public MAnnotation[] createNestedValueArray(String name, String componentTypeName, int dimensions); } ./src/org/codehaus/jam/mutable/MParameter.java0000664000175000017500000000205611767656530020461 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JClass; import org.codehaus.jam.JParameter; /** *

        Mutable version of JParameter.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MParameter extends JParameter, MMember { public void setType(String typeName); public void setType(JClass type); public void setUnqualifiedType(String ucname); } ./src/org/codehaus/jam/mutable/package.html0000664000175000017500000000223111767656530020035 0ustar brianbrian

        Provides a modifiable view of the JElement tree. This package contains interfaces which parallel and extend the JElement tree, adding and editing functionality to that the view of the java type system can be modified.

        Typically, this is only used in conjunction with an 'initializer' ElementVisitor which is run on a JClass when it is first loaded. The initializer might use these editable 'M*' abstractions to, for example, do some pre-processing on the comments or annotations, or to determine which methods on a class should be exposed as JProperties. The M* classes are also used by JAM providers in implementing the JamClassBuilder interface, which populates an EClass with methods, fields, and so on.

        It is also possible to use this package to synthesize a view of a java class which does not actually exist in any class or source file. This could be useful, for example, to drive a code-generation mechanism (Note that JAM does not provide a model for the contents of method bodies, so this may not be a useful approach).

        ./src/org/codehaus/jam/mutable/MField.java0000664000175000017500000000204211767656530017557 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JClass; import org.codehaus.jam.JField; /** *

        Mutable version of JField.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MField extends JField, MMember { public void setType(String typeName); public void setUnqualifiedType(String typeName); public void setType(JClass type); } ./src/org/codehaus/jam/mutable/MComment.java0000664000175000017500000000173211767656530020143 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JComment; /** *

        Mutable version of JComment.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MComment extends MElement, JComment { /** * Sets the text of this comment. */ public void setText(String text); } ./src/org/codehaus/jam/mutable/MMethod.java0000664000175000017500000000303011767656530017752 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.mutable; import org.codehaus.jam.JClass; import org.codehaus.jam.JMethod; /** *

        Mutable version of JMethod.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MMethod extends JMethod, MInvokable { /** *

        Sets the type of this method's return value. Null can be passed if * a 'void' return type is desired.

        * * @throws IllegalArgumentException if the parameter is not a valid * java class name. */ public void setReturnType(String qualifiedTypeName); public void setUnqualifiedReturnType(String unqualifiedTypeName); /** *

        Sets the type of this method's return value. Null may be passed if * a 'void' return type is desired. This method is exactly equivalent to * calling setReturnType(jclass.getQualifiedName()).

        */ public void setReturnType(JClass c); }./src/org/codehaus/jam/mutable/MInvokable.java0000664000175000017500000001120311767656530020445 0ustar brianbrian/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache * XMLBeans", nor may "Apache" appear in their name, without prior * written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 2003 BEA Systems * Inc., . For more information on the Apache Software * Foundation, please see . */ package org.codehaus.jam.mutable; import org.codehaus.jam.JClass; import org.codehaus.jam.JInvokable; /** *

        Mutable version of JInvokable.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface MInvokable extends JInvokable, MMember { /** *

        Adds a declaration of a checked exception of the given type.

        * * @throws java.lang.IllegalArgumentException if the parameter is null or is not * a valid class name. */ public void addException(String qualifiedClassName); /** *

        Adds a declaration of a checked exception of the given type.

        * * @throws java.lang.IllegalArgumentException if the parameter is null or represents * a class which does not extend throwable. */ public void addException(JClass exceptionClass); /** * Removes a declaration of a checked exception of the named class. Does * nothing if no such declaration exists. * * @throws java.lang.IllegalArgumentException if the parameter is null or is not * a valid class name. */ public void removeException(String qualifiedClassName); /** * Removes a declaration of a checked exception of the given class. Does * nothing if no such declaration exists. * * @throws java.lang.IllegalArgumentException if the parameter is null. */ public void removeException(JClass exceptionClass); /** * Creates a new parameter on this method of type java.lang.Object and * with a default name. */ public MParameter addNewParameter(); /** * Removes the given parameter. Does nothing if the parameter is not * present on this method. * * @throws java.lang.IllegalArgumentException if either parameter is null. */ public void removeParameter(MParameter parameter); /** * Returns all of the parameters on this method, or an empty array if there * are none. This is simply a more strongly-typed version of * getParameters(). */ public MParameter[] getMutableParameters(); } ./src/org/codehaus/jam/JAnnotatedElement.java0000664000175000017500000000576411767656530020345 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Base abstraction for JElements which can carry annotations and comments. * The only JElements which cannot do this are JAnnotation and JComment.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract interface JAnnotatedElement extends JElement { // ======================================================================== // Public methods /** *

        Returns the metadata JAnnotations that are associated with * this abstraction. Returns an empty array if there are no * annotations.

        */ public JAnnotation[] getAnnotations(); /** *

        Returns the JAnnotation representing the annotation on this element of * the given JSR 175 annotation type, or null if no such annotation exists. *

        * * @throws IllegalArgumentException if the jsr175type parameter is null * or not a 175 type. */ public JAnnotation getAnnotation(Class jsr175type); /** *

        Finds an annotation on this element according to the following * rules: * *

          *
        • If the element as a JSR175 annotation of type 'named', * returns a JAnnotation for it.
        • *
        • If a javadoc tag exists named 'named' returns a JAnnotation for * it. If more than such javadoc tags exists, one is chosen (no * guarantees are made as to which. For handling multiple javadoc * tags, please use getAllJavadocTags(). *
        */ public JAnnotation getAnnotation(String named); // REVIEW we should consider breaking this up and deprecating this method. // Could have getJavadocTag(named) and get175Annotation(named). /** * Shortcut method which returns a given annotation value. The 'valueId' * should be a string of the format 'annotation-name@value-name'. The * value-name may be ommitted; if it is, it defaults to * JAnntoation.SINGLE_MEMBER_VALUE. * * @param valueId * @return */ public JAnnotationValue getAnnotationValue(String valueId); /** *

        Returns the comment associated with this abstraction. * Returns null if it has no comment.

        */ public JComment getComment(); /** * Returns JAnnotations representing all of the javadoc tags on this * element (including multiple tags with the same name). */ public JAnnotation[] getAllJavadocTags(); } ./src/org/codehaus/jam/xml/0000775000175000017500000000000011767656530014725 5ustar brianbrian./src/org/codehaus/jam/xml/TunnelledException.java0000664000175000017500000000204211767656530021377 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.xml; import javax.xml.stream.XMLStreamException; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class TunnelledException extends RuntimeException { private XMLStreamException mXSE = null; public TunnelledException(XMLStreamException xse) { mXSE = xse; } public XMLStreamException getXMLStreamException() { return mXSE; } } ./src/org/codehaus/jam/xml/JamXmlUtils.java0000664000175000017500000000615711767656530020012 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.xml; import org.codehaus.jam.JClass; import org.codehaus.jam.JamService; import org.codehaus.jam.JamServiceFactory; import org.codehaus.jam.JamServiceParams; import org.codehaus.jam.internal.CachedClassBuilder; import org.codehaus.jam.internal.JamServiceImpl; import org.codehaus.jam.internal.elements.ElementContext; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.InputStream; import java.io.Writer; import java.util.Arrays; import java.util.List; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamXmlUtils { // ======================================================================== // Singleton public static final JamXmlUtils getInstance() { return INSTANCE; } private static final JamXmlUtils INSTANCE = new JamXmlUtils(); private JamXmlUtils() {} // ======================================================================== // Public methods public JamService createService(InputStream in) throws IOException, XMLStreamException { if (in == null) throw new IllegalArgumentException("null stream"); JamServiceFactory jsf = JamServiceFactory.getInstance(); JamServiceParams params = jsf.createServiceParams(); CachedClassBuilder cache = new CachedClassBuilder(); // finish initalizing the params and create the service params.addClassBuilder(cache); JamService out = jsf.createService(params); // now go view the xml. we have to do this afterwards so that the // classloader has been created and is available for linking. JamXmlReader reader = new JamXmlReader(cache,in,(ElementContext)params); reader.read(); { // slightly gross hack to get the class names into the service List classNames = Arrays.asList(cache.getClassNames()); classNames.addAll(Arrays.asList(out.getClassNames())); String[] nameArray = new String[classNames.size()]; classNames.toArray(nameArray); ((JamServiceImpl)out).setClassNames(nameArray); } return out; } public void toXml(JClass[] clazzes, Writer writer) throws IOException, XMLStreamException { if (clazzes == null) throw new IllegalArgumentException("null classes"); if (writer == null) throw new IllegalArgumentException("null writer"); JamXmlWriter out = new JamXmlWriter(writer); out.begin(); for(int i=0; i 0) { mOut.writeStartElement(COMMENT); mOut.writeCData(jc.getText()); mOut.writeEndElement(); } } } JSourcePosition pos = ae.getSourcePosition(); if (pos != null) { mOut.writeStartElement(SOURCEPOSITION); if (pos.getLine() != -1) { writeValueElement(LINE,pos.getLine()); } if (pos.getColumn() != -1) { writeValueElement(COLUMN,pos.getColumn()); } if (mWriteSourceURI && pos.getSourceURI() != null) writeValueElement(SOURCEURI,pos.getSourceURI().toString()); mOut.writeEndElement(); } } private void writeAnnotation(JAnnotation ann) throws XMLStreamException { mOut.writeStartElement(ANNOTATION); writeValueElement(NAME,ann.getQualifiedName()); JAnnotationValue[] values = ann.getValues(); for(int i=0; i, "); } } private void assertEnd(String named) throws XMLStreamException { if (!mIn.isEndElement() || !named.equals(getElementName())) { error("expected to get a , "); } } private String checkCurrentString(String named) throws XMLStreamException { if (named.equals(getElementName())) { String val = mIn.getElementText(); assertEnd(named); nextElement(); return val; } return null; } private String assertCurrentString(String named) throws XMLStreamException { assertStart(named); String val = mIn.getElementText(); assertEnd(named); nextElement(); return val; } private int assertCurrentInt(String named) throws XMLStreamException { assertStart(named); String val = mIn.getElementText(); assertEnd(named); nextElement(); return Integer.valueOf(val).intValue(); } private boolean assertCurrentBoolean(String named) throws XMLStreamException { assertStart(named); String val = mIn.getElementText(); assertEnd(named); nextElement(); return Boolean.valueOf(val).booleanValue(); } private void error(String message) throws XMLStreamException { StringWriter out = new StringWriter(); out.write("<"); out.write(mIn.getLocalName()); out.write("> line:"); out.write(""+mIn.getLocation().getLineNumber()); out.write(" col:"); out.write(""+mIn.getLocation().getColumnNumber()); out.write("]"); throw new XMLStreamException(message+":\n "+out.toString()); } private void nextElement() throws XMLStreamException { do { if (mIn.next() == -1) { throw new XMLStreamException("Unexpected end of file"); } } while(!mIn.isEndElement() && !mIn.isStartElement()); } private String getElementName() { return mIn.getLocalName(); } } ./src/org/codehaus/jam/xml/JamXmlElements.java0000664000175000017500000000404311767656530020456 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.xml; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamXmlElements { public static final String JAMSERVICE = "jam-service"; public static final String PACKAGE = "package"; public static final String CLASS = "class"; public static final String NAME = "name"; public static final String CLASS_NAME = "name"; public static final String PACKAGE_NAME = "package"; public static final String ISINTERFACE = "is-interface"; public static final String INTERFACE = "interface"; public static final String SUPERCLASS = "superclass"; public static final String MODIFIERS = "modifiers"; public static final String PARAMETER = "parameter"; public static final String TYPE = "type"; public static final String CONSTRUCTOR = "constructor"; public static final String METHOD = "method"; public static final String FIELD = "field"; public static final String RETURNTYPE = "return-type"; public static final String COMMENT = "comment"; public static final String SOURCEPOSITION = "source-position"; public static final String LINE = "line"; public static final String COLUMN = "column"; public static final String SOURCEURI = "source-uri"; public static final String VALUE = "value"; public static final String ANNOTATION = "annotation"; public static final String ANNOTATIONVALUE = "annotation-value"; } ./src/org/codehaus/jam/visitor/0000775000175000017500000000000011767656530015624 5ustar brianbrian./src/org/codehaus/jam/visitor/JVisitor.java0000664000175000017500000000324011767656530020237 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.visitor; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JComment; import org.codehaus.jam.JConstructor; import org.codehaus.jam.JField; import org.codehaus.jam.JMethod; import org.codehaus.jam.JPackage; import org.codehaus.jam.JParameter; import org.codehaus.jam.JProperty; import org.codehaus.jam.JTag; //REVIEW I think this should be an interface /** *

        To be implemented by classes which wish to traverse a JElement tree.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class JVisitor { public void visit(JPackage pkg) {} public void visit(JClass clazz) {} public void visit(JConstructor ctor) {} public void visit(JField field) {} public void visit(JMethod method) {} public void visit(JParameter param) {} public void visit(JAnnotation ann) {} public void visit(JComment comment) {} public void visit(JProperty property) {} public void visit(JTag tag) {} } ./src/org/codehaus/jam/visitor/TraversingJVisitor.java0000664000175000017500000001115211767656530022305 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.visitor; import org.codehaus.jam.JAnnotatedElement; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JComment; import org.codehaus.jam.JConstructor; import org.codehaus.jam.JField; import org.codehaus.jam.JInvokable; import org.codehaus.jam.JMethod; import org.codehaus.jam.JPackage; import org.codehaus.jam.JParameter; /** *

        An adaptor which helps another MVisitor visit a JElement and its * children, recursively. Note that inherited class or annotations members * are never visited, nor are referenced classes (e.g. referenced via member * types). The following table lists each element and the child types * which are traversed.

        * * * * * * * * * * * *
        ElementSub-elements traversal
        Package Classes, Annotations, Comments
        Class Fields, Constructors, Methods, Annotations, Comments
        Field Annotations, Comments
        Constructor Parameters, Annotations, Comments
        Method Parameters, Annotations, Comments
        Parameter Annotations, Comments
        Annotation [none]
        Comment [none]
        * *

        * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class TraversingJVisitor extends JVisitor { // ======================================================================== // Variables private JVisitor mDelegate; // ======================================================================== // Constructors public TraversingJVisitor(JVisitor jv) { if (jv == null) throw new IllegalArgumentException("null jv"); mDelegate = jv; } // ======================================================================== // JVisitor implementation public void visit(JPackage pkg) { pkg.accept(mDelegate); JClass[] c = pkg.getClasses(); for(int i=0; i 3 || name.startsWith("is") && name.length() > 2) { JClass typ = methods[i].getReturnType(); //FIXME we just want the name - this forces the whole thing to be resolved // need to either getReturnTypeRef() or change ClassImpl so that it lazily builds itself if (typ == null) continue; // must have a typ and have if (methods[i].getParameters().length > 0) continue; //no params if (name.startsWith("get")) { name = name.substring(3); } else { name = name.substring(2); } JProperty prop = (JProperty)name2prop.get(name); if (prop == null) { prop = declared ? clazz.addNewDeclaredProperty(name,methods[i],null) : clazz.addNewProperty(name,methods[i],null); name2prop.put(name,prop); } else { if (typ.equals(prop.getType())) { ((PropertyImpl)prop).setGetter(methods[i]); // cheater } } } // // process setters // if (name.startsWith("set") && name.length() > 3) { if (methods[i].getParameters().length != 1) continue; //1 param reqd JClass type = methods[i].getParameters()[0].getType(); name = name.substring(3); JProperty prop = (JProperty)name2prop.get(name); if (prop == null) { prop = declared ? clazz.addNewDeclaredProperty(name,null,methods[i]) : clazz.addNewProperty(name,null,methods[i]); name2prop.put(name,prop); } else { if (type.equals(prop.getType())) { // if it's the same type, cool - just add the getter ((PropertyImpl)prop).setSetter(methods[i]); // with a sneaky cast } } } } } } ./src/org/codehaus/jam/visitor/TraversingMVisitor.java0000664000175000017500000001134511767656530022314 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.visitor; import org.codehaus.jam.mutable.MAnnotatedElement; import org.codehaus.jam.mutable.MAnnotation; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MComment; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MInvokable; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.mutable.MPackage; import org.codehaus.jam.mutable.MParameter; /** *

        An adaptor which helps another MVisitor visit a JElement and its * children, recursively. Note that inherited class or annotations members * are never visited, nor are referenced classes (e.g. referenced via member * types). The following table lists each element and the child types * which are traversed.

        * * * * * * * * * * * *
        ElementSub-elements traversal
        Package Classes, Annotations, Comments
        Class Fields, Constructors, Methods, Annotations, Comments
        Field Annotations, Comments
        Constructor Parameters, Annotations, Comments
        Method Parameters, Annotations, Comments
        Parameter Annotations, Comments
        Annotation [none]
        Comment [none]
        * *

        * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class TraversingMVisitor extends MVisitor { // ======================================================================== // Variables private MVisitor mDelegate; // ======================================================================== // Constructors public TraversingMVisitor(MVisitor jv) { if (jv == null) throw new IllegalArgumentException("null jv"); mDelegate = jv; } // ======================================================================== // JVisitor implementation public void visit(MPackage pkg) { pkg.accept(mDelegate); MClass[] c = pkg.getMutableClasses(); for(int i=0; iComposite implementation of MVisitor.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class CompositeMVisitor extends MVisitor { // ======================================================================== // Variables private MVisitor[] mVisitors; // ======================================================================== // Constructors public CompositeMVisitor(MVisitor[] visitors) { if (visitors == null) throw new IllegalArgumentException("null visitors"); mVisitors = visitors; } // ======================================================================== // MVisitor implementation public void visit(MPackage pkg) { for(int i=0; iComposite implementation of JVisitor.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class CompositeJVisitor extends JVisitor { // ======================================================================== // Variables private JVisitor[] mVisitors; // ======================================================================== // Constructors public CompositeJVisitor(JVisitor[] visitors) { if (visitors == null) throw new IllegalArgumentException("null visitors"); mVisitors = visitors; } // ======================================================================== // JVisitor implementation public void visit(JPackage pkg) { for(int i=0; i

        Provides a framework for traversing a JElement tree and possibly modifying its contents. Also includes ElementVisitor implementations which encapsulate standard JClass initialization behaviors, such as comment parsing and JProperty identification.

        Customized ElementVistors can be written to modify or extend such behaviors. See JamServiceParams for details on how to plug in such extensions.

        ./src/org/codehaus/jam/visitor/MVisitor.java0000664000175000017500000000314611767656530020247 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.visitor; import org.codehaus.jam.mutable.MAnnotation; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MComment; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.mutable.MPackage; import org.codehaus.jam.mutable.MParameter; import org.codehaus.jam.mutable.MTag; /** *

        To be extended by classes which wish to traverse an MElement tree.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class MVisitor { public void visit(MPackage pkg) {} public void visit(MClass clazz) {} public void visit(MConstructor ctor) {} public void visit(MField field) {} public void visit(MMethod method) {} public void visit(MParameter param) {} public void visit(MAnnotation ann) {} public void visit(MComment comment) {} public void visit(MTag tag) {} } ./src/org/codehaus/jam/internal/0000775000175000017500000000000011767656530015741 5ustar brianbrian./src/org/codehaus/jam/internal/classrefs/0000775000175000017500000000000011767656530017726 5ustar brianbrian./src/org/codehaus/jam/internal/classrefs/JClassRefContext.java0000664000175000017500000000222211767656530023750 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.classrefs; import org.codehaus.jam.JamClassLoader; /** *

        Provides a JClassRef implementation with contextual information it * needs to perform lazy type resolution. This information is typically * provided by the JClass implementation.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JClassRefContext { public String getPackageName(); public String[] getImportSpecs(); public JamClassLoader getClassLoader(); } ./src/org/codehaus/jam/internal/classrefs/DirectJClassRef.java0000664000175000017500000000346311767656530023546 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.classrefs; import org.codehaus.jam.JClass; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class DirectJClassRef implements JClassRef { // ======================================================================== // Factory public static JClassRef create(JClass clazz) { // we normally can expect that most JClass impls will simply implement // JClassRef directly if (clazz instanceof JClassRef) return (JClassRef)clazz; return new DirectJClassRef(clazz); } // ======================================================================== // Variables private JClass mClass; // ======================================================================== // Constructors private DirectJClassRef(JClass clazz) { if (clazz == null) throw new IllegalArgumentException("null clazz"); mClass = clazz; } // ======================================================================== // JClassRef implementation public JClass getRefClass() { return mClass; } public String getQualifiedName() { return mClass.getQualifiedName(); } } ./src/org/codehaus/jam/internal/classrefs/UnqualifiedJClassRef.java0000664000175000017500000001552711767656530024606 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.classrefs; import org.codehaus.jam.JClass; import java.io.StringWriter; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class UnqualifiedJClassRef implements JClassRef { // ======================================================================== // Constants private static final boolean VERBOSE = false; private static final String PREFIX = "[UnqualifiedJClassRef]"; // ======================================================================== // Variables private String mUnqualifiedClassname; private String mQualifiedClassname = null; private JClassRefContext mContext; // ======================================================================== // Factory /** * Creates a new JClassRef for a qualified class or type name. */ public static JClassRef create(String qualifiedClassname, JClassRefContext ctx) { throw new IllegalStateException("Unqualified names currently disabled."); //return new UnqualifiedJClassRef(qualifiedClassname,ctx); } // ======================================================================== // Constructors private UnqualifiedJClassRef(String ucname, JClassRefContext ctx) { if (ctx == null) throw new IllegalArgumentException("null ctx"); if (ucname == null) throw new IllegalArgumentException("null ucname"); mContext = ctx; mUnqualifiedClassname = ucname; if (VERBOSE) System.out.println("[UnqualifiedJClassRef] created for '"+ ucname+"'"); } // ======================================================================== // JClassRef implementation public JClass getRefClass() { //FIXME this needs optimization, keep it simple and lazy for now return mContext.getClassLoader().loadClass(getQualifiedName()); } public String getQualifiedName() { if (mQualifiedClassname != null) return mQualifiedClassname; // ok, check to see if it's an array type. if so, we want to strip // away all the brackets and so we can try to load just the component // type. String candidateName; int arrayDimensions = 0; int bracket = mUnqualifiedClassname.indexOf('['); if (bracket != -1) { candidateName = mUnqualifiedClassname.substring(0,bracket); do { arrayDimensions++; bracket = mUnqualifiedClassname.indexOf('[',bracket+1); } while(bracket != -1); } else { candidateName = mUnqualifiedClassname; } // ok, try to get the class that they are talking about String name = qualifyName(candidateName); if (name == null) { throw new IllegalStateException("unable to handle unqualified java type "+ "reference '"+candidateName+" ["+ mUnqualifiedClassname+"]'. "+ "This is still partially NYI."); } // now if it was an array, we need to convert it into a corresponding // field descriptor if (arrayDimensions > 0) { StringWriter out = new StringWriter(); for(int i=0; i

        Internal use only. These classes may change or be removed at any time without warning.

        Contains classes for maintaining and resolving references between JClasses.

        ./src/org/codehaus/jam/internal/classrefs/JClassRef.java0000664000175000017500000000236711767656530022415 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.classrefs; import org.codehaus.jam.JClass; /** *

        Object which holds a reference to a JClass. Using this interface * (as opposed to referring to the JClass directly) allows us to do lazy * type resolution.

        * *

        Note that ClassImpl implements this interface directly (as a reference * to itself) as an optimization for the case where we don't need or want * lazy type resolution

        . * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JClassRef { public JClass getRefClass(); public String getQualifiedName(); } ./src/org/codehaus/jam/internal/classrefs/QualifiedJClassRef.java0000664000175000017500000000641711767656530024241 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.classrefs; import org.codehaus.jam.JClass; import org.codehaus.jam.JamClassLoader; /** *

        Reference to a JClass by qualified name which is resolved lazily. Note * that resolved references are not cached, which makes it more likely that * a JClasses will become available for garbage collection. The performance * hit here is probably not significant, but someday we might want to provide * switch to enable caching of references.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class QualifiedJClassRef implements JClassRef { // ======================================================================== // Variables private String mQualifiedClassname; private JamClassLoader mClassLoader; // ======================================================================== // Factory /** * Creates a new JClassRef for a qualified class or type name. */ public static JClassRef create(JClass clazz) { if (clazz == null) throw new IllegalArgumentException("null clazz"); return new QualifiedJClassRef(clazz.getFieldDescriptor(), clazz.getClassLoader()); } /** * Creates a new JClassRef for a qualified class or type name. */ public static JClassRef create(String qcname, JClassRefContext ctx) { if (qcname == null) throw new IllegalArgumentException("null qcname"); if (ctx == null) throw new IllegalArgumentException("null ctx"); return create(qcname,ctx.getClassLoader()); } /** * Creates a new JClassRef for a qualified class or type name. */ public static JClassRef create(String qcname, JamClassLoader cl) { if (qcname == null) throw new IllegalArgumentException("null qcname"); if (cl == null) throw new IllegalArgumentException("null classloader"); return new QualifiedJClassRef(qcname,cl); } // ======================================================================== // Constructors private QualifiedJClassRef(String qcname, JamClassLoader cl) { mClassLoader = cl; mQualifiedClassname = qcname; } // ======================================================================== // JClassRef implementation public JClass getRefClass() { return mClassLoader.loadClass(mQualifiedClassname); } public String getQualifiedName() { return mQualifiedClassname; } // ======================================================================== // Object implementation public String toString() { return "(QualifiedJClassRef '"+mQualifiedClassname+"')"; } }./src/org/codehaus/jam/internal/JamPrinter.java0000664000175000017500000001056011767656530020661 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JConstructor; import org.codehaus.jam.JElement; import org.codehaus.jam.JMethod; import org.codehaus.jam.JamClassIterator; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; /** * Utility class for printing out a JAM. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamPrinter { // ======================================================================== // Factory public static JamPrinter newInstance() { return new JamPrinter(); } private JamPrinter() { } private static final String INDENT = " "; // ======================================================================== // Public methods public void print(JElement root, PrintWriter out) { print(root, 0, out); } public void print(JamClassIterator iter, PrintWriter out) { while(iter.hasNext()) { JClass clazz = iter.nextClass(); out.println("------------------------------"); out.println(clazz.getQualifiedName()); out.println("------------------------------"); print(clazz,out); out.println(); } } // ======================================================================== // Private methods private void print(JElement a, int indent, PrintWriter out) { indent(indent, out); out.print("["); out.print(getTypeKey(a)); out.print("] "); if (a instanceof JMethod) { out.print(((JMethod) a).getReturnType().getFieldDescriptor()); out.print(" "); out.println(a.getSimpleName()); } else { out.println(a.getSimpleName()); } indent++; // print out the annotations /*JAnnotation[] atts = a.getAnnotations(); if (atts != null) print(atts, indent, out); // now recursively print out the children JElement[] children = getChildrenFor(a); if (children != null) { for (int i = 0; i < children.length; i++) { if (children[i] != null) print(children[i], indent, out); } } */ } private void print(JAnnotation[] atts, int indent, PrintWriter out) { for (int i = 0; i < atts.length; i++) { indent(indent, out); out.print("<"); out.print(getTypeKey(atts[i])); out.print("> "); out.print(atts[i].getSimpleName()); } } private void indent(int indent, PrintWriter out) { for (int i = 0; i < indent; i++) out.print(INDENT); } private String getTypeKey(Object o) { if (o == null) return "[?UNKNOWN!]"; String type = o.getClass().getName(); int lastDot = type.lastIndexOf("."); if (lastDot != -1 && lastDot + 1 < type.length()) { type = type.substring(lastDot + 1); } return type; } // this is quite gross, but we don't want to expose getChildren() to // the public any more private static JElement[] getChildrenFor(JElement parent) { Collection list = new ArrayList(); if (parent instanceof JClass) { list.addAll(Arrays.asList(((JClass) parent).getDeclaredFields())); list.addAll(Arrays.asList(((JClass) parent).getDeclaredMethods())); list.addAll(Arrays.asList(((JClass) parent).getConstructors())); list.addAll(Arrays.asList(((JClass) parent).getClasses())); } else if (parent instanceof JConstructor) { list.addAll(Arrays.asList(((JConstructor) parent).getParameters())); } else if (parent instanceof JMethod) { list.addAll(Arrays.asList(((JMethod) parent).getParameters())); } JElement[] out = new JElement[list.size()]; list.toArray(out); return out; } } ./src/org/codehaus/jam/internal/JamLoggerImpl.java0000664000175000017500000000773611767656530021312 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.provider.JamLogger; import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamLoggerImpl implements JamLogger { // ======================================================================== // Variables private boolean mShowWarnings = true; private Set mVerboseClasses = null; private PrintWriter mOut = new PrintWriter(System.out,true); // ======================================================================== // JamLogger implementation public boolean isVerbose(Object o) { if (mVerboseClasses == null) return false; Iterator i = mVerboseClasses.iterator(); while(i.hasNext()) { Class c = (Class)i.next(); if (c.isAssignableFrom(o.getClass())) return true; } return false; } public boolean isVerbose(Class aClass) { if (mVerboseClasses == null) return false; Iterator i = mVerboseClasses.iterator(); while(i.hasNext()) { Class c = (Class)i.next(); if (c.isAssignableFrom(aClass)) return true; } return false; } public void setVerbose(Class c) { if (c == null) throw new IllegalArgumentException(); if (mVerboseClasses == null) mVerboseClasses = new HashSet(); mVerboseClasses.add(c); } public void setShowWarnings(boolean b) { mShowWarnings = b; } public void verbose(String msg, Object o) { if (isVerbose(o)) verbose(msg); } public void verbose(Throwable t, Object o) { if (isVerbose(o)) verbose(t); } public void verbose(String msg) { printVerbosePrefix(); mOut.println(msg); } public void verbose(Throwable t) { printVerbosePrefix(); mOut.println(); t.printStackTrace(mOut); } public void warning(Throwable t) { if (mShowWarnings) { mOut.println("[JAM] Warning: unexpected exception thrown: "); t.printStackTrace(); } } public void warning(String w) { if (mShowWarnings) { mOut.print("[JAM] Warning: "); mOut.println(w); } } public void error(Throwable t) { mOut.println("[JAM] Error: unexpected exception thrown: "); t.printStackTrace(mOut); } public void error(String msg) { mOut.print("[JAM] Error: "); mOut.println(msg); } // ======================================================================== // Deprecated methods public boolean isVerbose() { return mVerboseClasses != null; } // ======================================================================== // Private methods public void setOut(PrintWriter out) { mOut= out; } protected void printVerbosePrefix() { StackTraceElement[] st = new Exception().getStackTrace(); mOut.println("[JAM] Verbose: "); mOut.print('('); mOut.print(shortName(st[2].getClassName())); mOut.print('.'); mOut.print(st[2].getMethodName()); mOut.print(':'); mOut.print(st[2].getLineNumber()); mOut.print(") "); } private static String shortName(String className) { int index = className.lastIndexOf('.'); if (index != -1 ) { className = className.substring(index+1, className.length()); } return className; } } ./src/org/codehaus/jam/internal/reflect/0000775000175000017500000000000011767656530017365 5ustar brianbrian./src/org/codehaus/jam/internal/reflect/ReflectTigerDelegate.java0000664000175000017500000000707511767656530024253 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.reflect; import org.codehaus.jam.internal.TigerDelegateHelper; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MMember; import org.codehaus.jam.mutable.MParameter; import org.codehaus.jam.provider.JamLogger; import org.codehaus.jam.JamClassLoader; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class ReflectTigerDelegate { // ======================================================================== // Constants private static final String IMPL_NAME = "org.codehaus.jam.internal.reflect.ReflectTigerDelegateImpl_150"; // ======================================================================== // Static methods /** */ public static ReflectTigerDelegate create(ElementContext ctx) { if (!TigerDelegateHelper.isTigerReflectionAvailable(ctx.getLogger())) return null; // ok, if we could load that, let's new up the extractor delegate try { ReflectTigerDelegate out = (ReflectTigerDelegate) Class.forName(IMPL_NAME).newInstance(); out.init(ctx); return out; } catch (ClassNotFoundException e) { TigerDelegateHelper.issue14BuildWarning(e,ctx.getLogger()); } catch (IllegalAccessException e) { ctx.getLogger().error(e); } catch (InstantiationException e) { ctx.getLogger().error(e); } return null; } // ======================================================================== // Constructors protected ReflectTigerDelegate() {} // ======================================================================== // Protected methods protected abstract void init(ElementContext ctx); // ======================================================================== // Public methods public abstract void populateAnnotationTypeIfNecessary(Class cd, MClass clazz, ReflectClassBuilder builder); public abstract boolean isEnum(Class clazz); public abstract Constructor getEnclosingConstructor(Class clazz); public abstract Method getEnclosingMethod(Class clazz); public abstract void extractAnnotations(MMember dest, Method src); public abstract void extractAnnotations(MConstructor dest, Constructor src); public abstract void extractAnnotations(MField dest, Field src); public abstract void extractAnnotations(MClass dest, Class src); public abstract void extractAnnotations(MParameter dest, Method src, int paramNum); public abstract void extractAnnotations(MParameter dest, Constructor src, int paramNum); } ./src/org/codehaus/jam/internal/reflect/ReflectClassBuilder.java0000664000175000017500000001657011767656530024122 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.reflect; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MInvokable; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.mutable.MParameter; import org.codehaus.jam.provider.JamClassBuilder; import org.codehaus.jam.provider.JamClassPopulator; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class ReflectClassBuilder extends JamClassBuilder implements JamClassPopulator { // ======================================================================== // Constants public static final String PARAM_NAME = "param"; // ======================================================================== // Variables private ClassLoader mLoader; private ReflectTigerDelegate mTigerDelegate = null; // ======================================================================== // Constructors public ReflectClassBuilder(ClassLoader rcl) { if (rcl == null) throw new IllegalArgumentException("null rcl"); mLoader = rcl; } // ======================================================================== // JamClassBuilder implementation public void init(ElementContext ctx) { super.init(ctx); initDelegate(ctx); } public MClass build(String packageName, String className) { assertInitialized(); if (getLogger().isVerbose(this)) { getLogger().verbose("trying to build '"+packageName+"' '"+className+"'"); } Class rclass; try { String loadme = (packageName.trim().length() > 0) ? (packageName + '.' + className) : className; rclass = mLoader.loadClass(loadme); } catch(ClassNotFoundException cnfe) { getLogger().verbose(cnfe,this); return null; } MClass out = createClassToBuild(packageName, className, null, this); out.setArtifact(rclass); return out; } // ======================================================================== // JamClassPopulator implementation public void populate(MClass dest) { assertInitialized(); Class src = (Class)dest.getArtifact(); dest.setModifiers(src.getModifiers()); dest.setIsInterface(src.isInterface()); if (mTigerDelegate != null) dest.setIsEnumType(mTigerDelegate.isEnum(src)); // set the superclass Class s = src.getSuperclass(); if (s != null) dest.setSuperclass(s.getName()); // set the interfaces Class[] ints = src.getInterfaces(); for(int i=0; i * Base for classes which expose 1.5 (aka 'tiger')-specific functionality. *

        * * This class should be moved into a common directory between annogen * and jam. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class TigerDelegateHelper { // ======================================================================== // Constants private static final String SOME_TIGER_SPECIFIC_JAVADOC_CLASS = "com.sun.javadoc.AnnotationDesc"; private static final String SOME_TIGER_SPECIFIC_REFLECT_CLASS = "java.lang.annotation.Annotation"; // ======================================================================== // Variables private static boolean m14RuntimeWarningDone = false; private static boolean m14BuildWarningDone = false; // ======================================================================== // Public methods /** * Displays a warning indicating that the current build of JAM was * done under 1.4 (or earlier), which precludes the use of 1.5-specific * features. */ public static void issue14BuildWarning(Throwable t, JamLogger log) { if (!m14BuildWarningDone) { log.warning("This build of JAM was not made with JDK 1.5." + "Even though you are now running under JDK 1.5, "+ "JSR175-style annotations will not be available"); if (log.isVerbose(TigerDelegateHelper.class)) log.verbose(t); m14BuildWarningDone = true; } } /** * Displays a warning indicating that JAM is running under 1.4 (or earlier), * which precludes the use of 1.5-specific features. */ public static void issue14RuntimeWarning(Throwable t, JamLogger log) { if (!m14RuntimeWarningDone) { log.warning("You are running under a pre-1.5 JDK. JSR175-style "+ "source annotations will not be available"); if (log.isVerbose(TigerDelegateHelper.class)) log.verbose(t); m14RuntimeWarningDone = true; } } public static boolean isTigerJavadocAvailable(JamLogger logger) { try { // class for name this because it's 1.5 specific. if it fails, we // don't want to use the extractor Class.forName(SOME_TIGER_SPECIFIC_JAVADOC_CLASS); return true; } catch (ClassNotFoundException e) { issue14RuntimeWarning(e,logger); return false; } } public static boolean isTigerReflectionAvailable(JamLogger logger) { try { // class for name this because it's 1.5 specific. if it fails, we // don't want to use the extractor Class.forName(SOME_TIGER_SPECIFIC_REFLECT_CLASS); return true; } catch (ClassNotFoundException e) { issue14RuntimeWarning(e,logger); return false; } } }./src/org/codehaus/jam/internal/JamServiceContextImpl.java0000664000175000017500000005121211767656530023024 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.JamServiceParams; import org.codehaus.jam.annotation.DefaultAnnotationProxy; import org.codehaus.jam.annotation.JavadocTagParser; import org.codehaus.jam.annotation.WhitespaceDelimitedTagParser; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.provider.CompositeJamClassBuilder; import org.codehaus.jam.provider.JamClassBuilder; import org.codehaus.jam.provider.JamLogger; import org.codehaus.jam.provider.JamServiceContext; import org.codehaus.jam.provider.ResourcePath; import org.codehaus.jam.visitor.CompositeMVisitor; import org.codehaus.jam.visitor.MVisitor; import org.codehaus.jam.visitor.PropertyInitializer; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; /** *

        Takes settings from the user (through JamServiceParams) and exposes * them to the implementation (through JamServiceContext).

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamServiceContextImpl implements JamServiceContext, JamServiceParams, ElementContext { // ======================================================================== // Constants private static final char INNER_CLASS_SEPARATOR = '$'; // ======================================================================== // Variables private JamLogger mLogger = new JamLoggerImpl(); private boolean m14WarningsEnabled = false; private Properties mProperties = null; private Map mSourceRoot2Scanner = null; private Map mClassRoot2Scanner = null; private List mClasspath = null; private List mSourcepath = null; private List mToolClasspath = null; private List mIncludeClasses = null; private List mExcludeClasses = null; private boolean mUseSystemClasspath = true; private JavadocTagParser mTagParser = null; private MVisitor mCommentInitializer = null; private MVisitor mPropertyInitializer = new PropertyInitializer(); private List mOtherInitializers = null; private List mUnstructuredSourceFiles = null; private List mClassLoaders = null; private List mBaseBuilders = null; private JamClassLoader mLoader = null; private String mEncoding = null; // ======================================================================== // REVIEW public void setClassLoader(JamClassLoader loader) { mLoader = loader; } public JamClassBuilder getBaseBuilder() { if (mBaseBuilders == null || mBaseBuilders.size() == 0) { return null; } if (mBaseBuilders.size() == 1) { return (JamClassBuilder)mBaseBuilders.get(0); } JamClassBuilder[] comp = new JamClassBuilder[mBaseBuilders.size()]; mBaseBuilders.toArray(comp); return new CompositeJamClassBuilder(comp); } public JavadocTagParser getTagParser() { if (mTagParser == null) { mTagParser = new WhitespaceDelimitedTagParser(); mTagParser.init(this); } return mTagParser; } // ======================================================================== // Constructors public JamServiceContextImpl() {} // ======================================================================== // Public methods - used by BaseJProvider /** * Returns an array containing the qualified names of the classes which * are in the Service class set. */ public String[] getAllClassnames() throws IOException { Set all = new HashSet(); if (mIncludeClasses != null) all.addAll(mIncludeClasses); for(Iterator i = getAllDirectoryScanners(); i.hasNext(); ) { DirectoryScanner ds = (DirectoryScanner)i.next(); String[] files = ds.getIncludedFiles(); for(int j=0; jUtility class which the parser uses to store a list of method * or constructor parameters during lookahead. The structures * get reused for efficiency.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class ParamStructPool { // ======================================================================== // Constants private static final boolean VERBOSE = true; // ======================================================================== // Variables private List mList = new ArrayList(); private int mLength = 0; // ======================================================================== // Public methods public void setParametersOn(MInvokable e) { for(int i=0; i= mList.size()) { mList.add(new ParamStruct(type,name)); } else { ((ParamStruct)mList.get(mLength)).init(type,name); } } public void clear() { mLength = 0; } } ./src/org/codehaus/jam/internal/parser/ParserClassBuilder.java0000664000175000017500000001645211767656530023641 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.parser; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.internal.JamPrinter; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.provider.JamClassBuilder; import org.codehaus.jam.provider.JamClassPopulator; import org.codehaus.jam.provider.JamServiceContext; import org.codehaus.jam.provider.ResourcePath; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.ArrayList; import java.util.List; //FIXME uncomment when we get around to working on the parser again //import org.codehaus.jam.internal.parser.generated.JavaLexer; //import org.codehaus.jam.internal.parser.generated.JavaParser; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class ParserClassBuilder extends JamClassBuilder implements JamClassPopulator { // ======================================================================== // Constants private static final boolean VERBOSE = false; // ======================================================================== // Variables private ResourcePath mSourcePath; private boolean mVerbose = VERBOSE; private PrintWriter mOut = new PrintWriter(System.out); // ======================================================================== // Constructors private ParserClassBuilder() {} public ParserClassBuilder(JamServiceContext jsp) { mSourcePath = jsp.getInputSourcepath(); //mOut = jsp.getOut(); } // ======================================================================== // BaseJClassLoader implementation public MClass build(String pkg, String name) { if (pkg == null) throw new IllegalArgumentException("null pkg"); if (name == null) throw new IllegalArgumentException("null name"); String filespec = pkg.replace('.',File.separatorChar)+ File.separatorChar+name+".java"; if (name.indexOf(".") != -1) { throw new IllegalArgumentException("inner classes are NYI at the moment"); } InputStream in = mSourcePath.findInPath(filespec); if (in == null) { if (mVerbose) { mOut.println("[ParserClassBuilder] could not find "+filespec); } return null; } else { if (mVerbose) { mOut.println("[ParserClassBuilder] loading class "+pkg+" "+name); mOut.println("[ParserClassBuilder] from file "+filespec); } } Reader rin = new InputStreamReader(in); try { /* MClass[] clazz = null;//FIXME parse(rin,loader); if (clazz.length > 1) { System.out.println("WARNING: multiple classes per package are not "+ "handled correctly at the moment. FIXME"); } return clazz[0]; //FIXME deal properly with multiple classes */ } catch(Throwable t) { t.printStackTrace(); } finally { try { rin.close(); } catch(IOException ohwell) { ohwell.printStackTrace(); } } return null; } // ======================================================================== // JamClassPopulator implementation public void populate(MClass m) { throw new IllegalStateException("NYI"); } // ======================================================================== // Private methods private static MClass[] parse(Reader in, JamClassLoader loader) throws Exception { if (in == null) throw new IllegalArgumentException("null in"); if (loader == null) throw new IllegalArgumentException("null loader"); //FIXME uncomment when we get around to working on the parser again throw new IllegalStateException("temporarily NI"); /* JavaLexer lexer = new JavaLexer(in); JavaParser parser = new JavaParser(lexer); parser.setClassLoader(loader); parser.start(); return parser.getResults(); */ } // ======================================================================== // main method public static void main(String[] files) { new ParserClassBuilder.MainTool().process(files); } static class MainTool { private List mFailures = new ArrayList(); private int mCount = 0; private PrintWriter mOut = new PrintWriter(System.out); private long mStartTime = System.currentTimeMillis(); public void process(String[] files) { try { for(int i=0; i

        This is a work-in-progress. Actually, it's a really a work-no-longer-in-process.

        Internal use only. These classes may change or be removed at any time without warning.

        Contains classes for the java source parser that is currently being written to allow us to remove javadoc from the equation.

        ./src/org/codehaus/jam/internal/javadoc/0000775000175000017500000000000011767656530017350 5ustar brianbrian./src/org/codehaus/jam/internal/javadoc/JavadocRunner.java0000664000175000017500000001435211767656530022761 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.javadoc; import com.sun.javadoc.Doclet; import com.sun.javadoc.RootDoc; import org.codehaus.jam.provider.JamLogger; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** *

        This class does its best to encapsulate and make threadsafe the * nastiness that is the javadoc 'invocation' API.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JavadocRunner extends Doclet { // ======================================================================== // Constants private static final String JAVADOC_RUNNER_150 = "org.codehaus.jam.internal.javadoc.JavadocRunner_150"; // ======================================================================== // Factory methods public static JavadocRunner newInstance() { try { // See if we can load a 1.5-specific class. If we can't, don't use // the default. FIXME please rationalize handling of this throughout // the code. Class.forName("com.sun.javadoc.AnnotationDesc"); } catch (ClassNotFoundException e) { return new JavadocRunner(); } //REVIEW we should probably normalize the handling of 1.5-specific class //instantation and error handling try { Class onefive = Class.forName(JAVADOC_RUNNER_150); return (JavadocRunner)onefive.newInstance(); } catch(ClassNotFoundException cnfe) { } catch (IllegalAccessException e) { } catch (InstantiationException e) { } return new JavadocRunner(); } // ======================================================================== // Constructor public JavadocRunner() {} // ======================================================================== // Public methods /** * Runs javadoc on the given source directory and returns a JDRoot * which wraps the javadoc view of the source files there. */ /*package*/ synchronized RootDoc run(File[] files, PrintWriter out, String sourcePath, String classPath, String encoding, String[] javadocArgs, JamLogger logger) throws IOException, FileNotFoundException { if (files == null || files.length == 0) { throw new FileNotFoundException("No input files found."); } List argList = new ArrayList(); if (javadocArgs != null) { argList.addAll(Arrays.asList(javadocArgs)); } argList.add("-private"); if (sourcePath != null) { argList.add("-sourcepath"); argList.add(sourcePath); } if (classPath != null) { argList.add("-classpath"); argList.add(classPath); argList.add("-docletpath"); argList.add(classPath); } if (encoding != null) { argList.add("-encoding"); argList.add(encoding); } for(int i=0; i 0) ? (packageName + '.' + className) : className; ClassDoc cd = mRootDoc.classNamed(loadme); if (cd == null) { if (getLogger().isVerbose(this)) { getLogger().verbose("no ClassDoc for "+loadme); } return null; } List importSpecs = null; { ClassDoc[] imported = cd.importedClasses(); if (imported != null) { importSpecs = new ArrayList(); for(int i=0; i= 2 && (params[0].name().equals(params[1].name()))) { //this is the workaround for ANNOGEN-16 for(int i=0; iUsed by JavadocRunner to ensure that we always stash the results * of a javadoc run in a place where we can get them. This is particularly * painful because one implements a javdoc doclet by providing a static * callback method. In the case of multiple classloaders, extra care must be * taken to ensure that we can stash away the RootDoc result received in * the callback and retrieve it later.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JavadocResults { // ======================================================================== // Singleton private static final JavadocResults INSTANCE = new JavadocResults(); // ======================================================================== // Variables private ThreadLocal mRootsPerThread = new ThreadLocal(); // ======================================================================== // Public methods public static void prepare() { Thread.currentThread(). setContextClassLoader(JavadocResults.class.getClassLoader()); } public static void setRoot(RootDoc root) { try { Object holder = getHolder(); Method setter = holder.getClass().getMethod("_setRoot", new Class[] { RootDoc.class }); setter.invoke(holder,new Object[] {root}); } catch(Exception e) { e.printStackTrace(); throw new IllegalStateException();//FIXME?? } } public static RootDoc getRoot() { try { Object holder = getHolder(); Method getter = holder.getClass().getMethod("_getRoot",new Class[0]); return (RootDoc)getter.invoke(holder,(Object[])null); } catch(Exception e) { e.printStackTrace(); throw new IllegalStateException();//FIXME?? } } // ======================================================================== // DO NOT CALL THESE METHODS public void _setRoot(RootDoc root) { mRootsPerThread.set(root); } public RootDoc _getRoot() { return (RootDoc)mRootsPerThread.get(); } public static JavadocResults getInstance() { return INSTANCE; } private static Object getHolder() throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Class clazz = classLoader.loadClass(JavadocResults.class.getName()); Method method = clazz.getMethod("getInstance",new Class[0]); return method.invoke(null,new Object[0]); } } ./src/org/codehaus/jam/internal/javadoc/package.html0000664000175000017500000000034111767656530021627 0ustar brianbrian

        Internal use only. These classes may change or be removed at any time without warning.

        This package contains utility classes for wrapping invocations of javadoc.

        ./src/org/codehaus/jam/internal/CachedClassBuilder.java0000664000175000017500000000556411767656530022262 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.provider.JamClassBuilder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** *

        A ClassBuilder that doesn't do any lazy building - it is just a cache * of classes that are used when asked to build one. This is used by * JamXmlReader, which does all of it's reading and building in a single * pass.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class CachedClassBuilder extends JamClassBuilder { // ======================================================================== // Variables private Map mQcname2jclass = null; private List mClassNames = new ArrayList(); // ======================================================================== // Constructors public CachedClassBuilder() {} // ======================================================================== // JamClassBuilder implementation public MClass build(String packageName, String className) { if (mQcname2jclass == null) return null; if (packageName.trim().length() > 0) { className = packageName+'.'+className; } return (MClass)mQcname2jclass.get(className); } // ======================================================================== // Public methods public MClass createClassToBuild(String packageName, String className, String[] importSpecs) { String qualifiedName; if (packageName.trim().length() > 0) { qualifiedName = packageName+'.'+className; } else { qualifiedName = className; } MClass out; if (mQcname2jclass != null) { out = (MClass)mQcname2jclass.get(qualifiedName); if (out != null) return out; } else { mQcname2jclass = new HashMap(); } out = super.createClassToBuild(packageName,className, importSpecs); mQcname2jclass.put(qualifiedName,out); mClassNames.add(qualifiedName); return out; } public String[] getClassNames() { String[] out = new String[mClassNames.size()]; mClassNames.toArray(out); return out; } } ./src/org/codehaus/jam/internal/elements/0000775000175000017500000000000011767656530017555 5ustar brianbrian./src/org/codehaus/jam/internal/elements/AnnotatedElementImpl.java0000664000175000017500000001476311767656530024504 0ustar brianbrianpackage org.codehaus.jam.internal.elements; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JAnnotationValue; import org.codehaus.jam.JComment; import org.codehaus.jam.annotation.DefaultAnnotationProxy; import org.codehaus.jam.mutable.MAnnotatedElement; import org.codehaus.jam.mutable.MAnnotation; import org.codehaus.jam.mutable.MComment; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class AnnotatedElementImpl extends ElementImpl implements MAnnotatedElement { // ======================================================================== // Variables private Map mName2Annotation = null; private MComment mComment = null; private List mAllAnnotations = null; // ======================================================================== // Constructors protected AnnotatedElementImpl(ElementContext ctx) { super(ctx); } protected AnnotatedElementImpl(ElementImpl parent) { super(parent); } // ======================================================================== // JAnnotatedElement implementation public JAnnotation[] getAnnotations() { return getMutableAnnotations(); } public JAnnotation getAnnotation(Class jsr175type) { return getMutableAnnotation(jsr175type.getName()); } public JAnnotation getAnnotation(String named) { return getMutableAnnotation(named); } public JAnnotationValue getAnnotationValue(String valueId) { if (mName2Annotation == null) return null; valueId = valueId.trim(); int delim = valueId.indexOf('@'); if (delim == -1 || delim == valueId.length()-1) { JAnnotation ann = getAnnotation(valueId); if (ann == null) return null; return ann.getValue(JAnnotation.SINGLE_VALUE_NAME); } else { JAnnotation ann = getAnnotation(valueId.substring(0,delim)); if (ann == null) return null; return ann.getValue(valueId.substring(delim+1)); } } public JComment getComment() { return getMutableComment(); } /** * @deprecated */ public JAnnotation[] getAllJavadocTags() { if (mAllAnnotations == null) return NO_ANNOTATION; JAnnotation[] out = new JAnnotation[mAllAnnotations.size()]; mAllAnnotations.toArray(out); return out; } /* public JAnnotation[] getAllJavadocTags(String named) { //FIXME this impl is quite gross if (mAllAnnotations == null) return NO_ANNOTATION; List list = new ArrayList(); for(int i=0; i= line.length()) { logger.verbose("missing double quotes on line "+line,this); } } valueEnd = ind; } else { valueStart = ind++; while (ind < line.length() && isLegal(line.charAt(ind))) ind++; valueEnd = ind; } value = line.substring(valueStart, valueEnd); if (ind < line.length()) { line = line.substring(ind + 1); } else { line = null; } logger.verbose("SETTING KEY:"+key+" VALUE:"+value,this); out.setProperty(key, value); } } /** * Remove all the texts between "//" and '\n' * * This method contributed by Cedric Beust */ private String removeComments(String value) { String result = ""; int size = value.length(); String current = value; int currentIndex = 0; int beginning = current.indexOf("//"); // // Ignore // if it's between double quotes // int doubleQuotesIndex = current.indexOf("\""); if (-1 != doubleQuotesIndex && doubleQuotesIndex < beginning) { // do nothing result = value; } else { while (currentIndex < size && beginning != -1) { beginning = value.indexOf("//", currentIndex); if (-1 != beginning) { if (beginning > 0 && value.charAt(beginning-1) == ':') { //this is a quick fix for problem of unquoted url values. for //now, just say it's not a comment if preceded by ':'. should //review this later currentIndex = beginning+2; continue; } int end = value.indexOf('\n', beginning); if (-1 == end) end = size; // We have identified a portion to remove, copy the one we want to // keep result = result + value.substring(currentIndex, beginning).trim() + "\n"; current = value.substring(end); currentIndex = end; } } result += current; } return result.trim(); } private boolean isBlank(char c) { return c == ' ' || c == '\t' || c == '\n'; } private boolean isLegal(char c) { return (! isBlank(c)) && c != '='; // return Character.isJavaIdentifierStart(c) || c == '-' || Character.isDigit(c) || c == '.'; } }./src/org/codehaus/jam/internal/elements/MemberImpl.java0000664000175000017500000000453411767656530022457 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; import org.codehaus.jam.JElement; import org.codehaus.jam.JMember; import org.codehaus.jam.mutable.MMember; import java.lang.reflect.Modifier; /** *

        Implementation of JMember and EMenber.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class MemberImpl extends AnnotatedElementImpl implements MMember { // ======================================================================== // Variables private int mModifiers = 0; // ======================================================================== // Constructors protected MemberImpl(ElementImpl parent) { super(parent); } protected MemberImpl(ElementContext ctx) { super(ctx); } // ======================================================================== // JMember implementation public JClass getContainingClass() { JElement p = getParent(); //FIXME very gross if (p instanceof JClass) return (JClass)p; if (p instanceof JMember) return ((JMember)p).getContainingClass(); return null; } public int getModifiers() { return mModifiers; } public boolean isPackagePrivate() { return !isPrivate() && !isPublic() && !isProtected(); } public boolean isPrivate() { return Modifier.isPrivate(getModifiers()); } public boolean isProtected() { return Modifier.isProtected(getModifiers()); } public boolean isPublic() { return Modifier.isPublic(getModifiers()); } // ======================================================================== // MMember implementation public void setModifiers(int modifiers) { mModifiers = modifiers; } }./src/org/codehaus/jam/internal/elements/PropertyImpl.java0000664000175000017500000001656711767656530023105 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JClass; import org.codehaus.jam.JComment; import org.codehaus.jam.JMethod; import org.codehaus.jam.JProperty; import org.codehaus.jam.JSourcePosition; import org.codehaus.jam.internal.classrefs.JClassRef; import org.codehaus.jam.internal.classrefs.QualifiedJClassRef; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; /** *

        Implementation of JProperty.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class PropertyImpl extends AnnotatedElementImpl implements JProperty { // ======================================================================== // Variables private String mName; private JMethod mGetter, mSetter; private JClassRef mTypeRef; // ======================================================================== // Constructor /** *

        You'll usually want to use the getProperties() factory method * instead of constructing JProperties yourself. This constructor * is exposed just in case the default rules in the factory method * for identifying properties are insufficient for some use * case.

        * */ public PropertyImpl(String name, JMethod getter, JMethod setter, String qualifiedTypeName) { super((ElementImpl) ((getter != null) ? getter.getParent() : setter.getParent())); //FIXME should do more validation on the arguments mName = name; mGetter = getter; mSetter = setter; ClassImpl cont = (ClassImpl)((getter != null) ? getter.getContainingClass() : setter.getContainingClass()); mTypeRef = QualifiedJClassRef.create(qualifiedTypeName,cont); initAnnotations(); } // ======================================================================== // Public methods /** * Returns a JClass which represents the type of this property. */ public JClass getType() { return mTypeRef.getRefClass(); } /** * Returns the simple name of this property. For example, for a * property manifest by getFoo() and setFoo(), this will return * 'foo'. */ public String getSimpleName() { return mName; } /** * Returns the simple name of this property. For example, for a * property manifest by getFoo() and setFoo(), this will return * 'foo'. */ public String getQualifiedName() { return getParent().getQualifiedName()+"."+getSimpleName(); //REVIEW } /** * Returns a JMethod which represents the setter for this property. * Returns null if this property is view-only. */ public JMethod getSetter() { return mSetter; } /** * Returns a JMethod which represents the getter for this property. * Returns null if this property is write-only. */ public JMethod getGetter() { return mGetter; } // ======================================================================== // JElement implementation /** * Returns all of the annotations on the getter and/or the setter * methods. */ public JAnnotation[] getAnnotations() { return combine((mGetter == null) ? ElementImpl.NO_ANNOTATION : mGetter.getAnnotations(), (mSetter == null) ? ElementImpl.NO_ANNOTATION : mSetter.getAnnotations()); } /** * Returns annotations with the given name that are found on this * property's getter and/or setter. public JAnnotation[] getAnnotations(String named) { return combine((mGetter == null) ? BaseJElement.NO_ANNOTATION : mGetter.getAnnotations(named), (mSetter == null) ? BaseJElement.NO_ANNOTATION : mSetter.getAnnotations(named)); } */ //internal use only public void setSetter(JMethod method) { mSetter = method; } //internal use only public void setGetter(JMethod method) { mGetter = method; } /** * Returns the first annotation with the given name that is found on * this property's getter and/or setters. */ public JAnnotation getAnnotation(String named) { JAnnotation out = (mGetter != null) ? mGetter.getAnnotation(named) : null; if (out != null) return out; return (mSetter != null) ? mSetter.getAnnotation(named) : null; } public JComment getComment() { //REVIEW do we want to somehow merge the comments? if (mGetter != null) return mGetter.getComment(); if (mSetter != null) return mSetter.getComment(); return null; } public JSourcePosition getSourcePosition() { return mGetter != null ? mGetter.getSourcePosition() : mSetter.getSourcePosition(); } public void accept(JVisitor visitor) { if (mGetter != null) visitor.visit(mGetter); if (mSetter != null) visitor.visit(mSetter); } // ======================================================================== // Object implementation public String toString() { return getQualifiedName(); } // ======================================================================== // Private methods private void initAnnotations() { if (mSetter != null) { JAnnotation[] anns = mSetter.getAnnotations(); for(int i=0; iImplementation of JElement and MElement.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class ElementImpl implements Comparable, MElement { // ======================================================================== // Constants // help reduce waste public static final ElementImpl[] NO_NODE = new ElementImpl[0]; public static final ClassImpl[] NO_CLASS = new ClassImpl[0]; public static final FieldImpl[] NO_FIELD = new FieldImpl[0]; public static final ConstructorImpl[] NO_CONSTRUCTOR = new ConstructorImpl[0]; public static final MethodImpl[] NO_METHOD = new MethodImpl[0]; public static final ParameterImpl[] NO_PARAMETER = new ParameterImpl[0]; public static final JPackage[] NO_PACKAGE = new JPackage[0];//FIXME public static final AnnotationImpl[] NO_ANNOTATION = new AnnotationImpl[0]; public static final TagImpl[] NO_TAG = new TagImpl[0]; public static final CommentImpl[] NO_COMMENT = new CommentImpl[0]; public static final JProperty[] NO_PROPERTY = new JProperty[0];//FIXME // ======================================================================== // Variables private ElementContext mContext; protected String mSimpleName; private MSourcePosition mPosition = null; private Object mArtifact = null; private ElementImpl mParent; // ======================================================================== // Constructors protected ElementImpl(ElementImpl parent) { if (parent == null) throw new IllegalArgumentException("null ctx"); if (parent == this) { throw new IllegalArgumentException("An element cannot be its own parent"); } JElement check = parent.getParent(); while(check != null) { if (check == this) throw new IllegalArgumentException("cycle detected"); check = check.getParent(); }; mContext = parent.getContext(); mParent = parent; } protected ElementImpl(ElementContext ctx) { if (ctx == null) throw new IllegalArgumentException("null ctx"); mContext = ctx; } // ======================================================================== // JElement implementation public final JElement getParent() { return mParent; } public String getSimpleName() { return mSimpleName; } public JSourcePosition getSourcePosition() { return mPosition; } public Object getArtifact() { return mArtifact; } public boolean isSourceAvailable() { return mArtifact != null && mArtifact instanceof com.sun.javadoc.Doc; } // ======================================================================== // MElement implementation public void setSimpleName(String name) { if (name == null) throw new IllegalArgumentException("null name"); mSimpleName = name.trim(); } public MSourcePosition createSourcePosition() { return mPosition = new SourcePositionImpl(); } public void removeSourcePosition() { mPosition = null; } public MSourcePosition getMutableSourcePosition() { return mPosition; } public void setArtifact(Object artifact) { if (artifact == null) { //throw new IllegalArgumentException("null artifact"); //fixme there are some extensions that are passing null //getLogger().warning(new IllegalArgumentException("null artifact")); } if (mArtifact != null) { throw new IllegalStateException("artifact already set"); } mArtifact = artifact; } // ======================================================================== // Public methods & JClass elements public JamClassLoader getClassLoader() { return mContext.getClassLoader(); } public static String defaultName(int count) { return "unnamed_"+count; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ElementImpl)) return false; final ElementImpl eElement = (ElementImpl) o; String qn = getQualifiedName(); if (qn == null) return false; String oqn = eElement.getQualifiedName(); if (oqn == null) return false; return qn.equals(oqn); } public int hashCode() { String qn = getQualifiedName(); return (qn == null) ? 0 : qn.hashCode(); } // ======================================================================== // Other public methods public ElementContext getContext() { return mContext; } // ======================================================================== // Object implementation public String toString() { return getQualifiedName(); } // ======================================================================== // Protected methods protected JamLogger getLogger() { return ((JamServiceContextImpl)mContext).getLogger(); } // ======================================================================== // Comparable implementation public int compareTo(Object o) { if (!(o instanceof JElement)) { return -1; } return getQualifiedName().compareTo(((JElement)o).getQualifiedName()); } }./src/org/codehaus/jam/internal/elements/TagImpl.java0000664000175000017500000000462611767656530021765 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.mutable.MTag; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; import java.util.Properties; /** * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class TagImpl extends ElementImpl implements MTag { // ======================================================================== // Variables private String mText; // ======================================================================== // Constructor public TagImpl(ElementImpl parent) { super(parent); } // ======================================================================== // JTag implementation public String getName() { return super.getSimpleName(); } public String getText() { return mText; } public Properties getProperties_lineDelimited() { Properties out = new Properties(); LinebreakTagPropertyParser.getInstance().parse(out,mText); return out; } public Properties getProperties_whitespaceDelimited() { Properties out = new Properties(); WhitespaceTagPropertyParser.getInstance().parse(out,mText,getLogger()); return out; } // ======================================================================== // MTag implementation public void setName(String name) { super.setSimpleName(name); } public void setValue(String val) { mText = val; } // ======================================================================== // MElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } // ======================================================================== // JElement implementation public String getQualifiedName() { return getSimpleName(); } public void accept(JVisitor visitor) { visitor.visit(this); } } ./src/org/codehaus/jam/internal/elements/VoidClassImpl.java0000664000175000017500000000326411767656530023136 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; /** *

        Class implementation to represent the 'void' type.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class VoidClassImpl extends BuiltinClassImpl { // ======================================================================== // Constants private static final String SIMPLE_NAME = "void"; // ======================================================================== // Public static utilities public static boolean isVoid(String fd) { return fd.equals(SIMPLE_NAME); } // ======================================================================== // Singleton public VoidClassImpl(ElementContext ctx) { super(ctx); super.reallySetSimpleName(SIMPLE_NAME); } // ======================================================================== // JClass implementation public boolean isVoidType() { return true; } public boolean isAssignableFrom(JClass c) { return false; } } ./src/org/codehaus/jam/internal/elements/InvokableImpl.java0000664000175000017500000001301411767656530023153 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; import org.codehaus.jam.JParameter; import org.codehaus.jam.internal.classrefs.DirectJClassRef; import org.codehaus.jam.internal.classrefs.JClassRef; import org.codehaus.jam.internal.classrefs.QualifiedJClassRef; import org.codehaus.jam.internal.classrefs.UnqualifiedJClassRef; import org.codehaus.jam.mutable.MInvokable; import org.codehaus.jam.mutable.MParameter; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class InvokableImpl extends MemberImpl implements MInvokable { // ======================================================================== // Variables private List mExceptionClassRefs = null; private List mParameters = null; // ======================================================================== // Constructors protected InvokableImpl(ClassImpl containingClass) { super(containingClass); } // ======================================================================== // MConstructor implementation public void addException(JClass exceptionClass) { if (exceptionClass == null) { throw new IllegalArgumentException("null exception class"); } if (mExceptionClassRefs == null) mExceptionClassRefs = new ArrayList(); mExceptionClassRefs.add(DirectJClassRef.create(exceptionClass)); } public void addException(String qcname) { if (qcname == null) throw new IllegalArgumentException("null qcname"); if (mExceptionClassRefs == null) mExceptionClassRefs = new ArrayList(); mExceptionClassRefs.add(QualifiedJClassRef. create(qcname,(ClassImpl)getContainingClass())); } public void addUnqualifiedException(String ucname) { if (ucname == null) throw new IllegalArgumentException("null qcname"); if (mExceptionClassRefs == null) mExceptionClassRefs = new ArrayList(); mExceptionClassRefs.add(UnqualifiedJClassRef. create(ucname,(ClassImpl)getContainingClass())); } public void removeException(String exceptionClassName) { if (exceptionClassName == null) { throw new IllegalArgumentException("null classname"); } if (mExceptionClassRefs != null) { mExceptionClassRefs.remove(exceptionClassName); } } public void removeException(JClass exceptionClass) { removeException(exceptionClass.getQualifiedName()); } public MParameter addNewParameter() { if (mParameters == null) mParameters = new ArrayList(); MParameter param = new ParameterImpl(defaultName(mParameters.size()), this,"java.lang.Object"); mParameters.add(param); return param; } public void removeParameter(MParameter parameter) { if (mParameters != null) mParameters.remove(parameter); } public MParameter[] getMutableParameters() { if (mParameters == null || mParameters.size() == 0) { return new MParameter[0]; } else { MParameter[] out = new MParameter[mParameters.size()]; mParameters.toArray(out); return out; } } // ======================================================================== // JInvokable implementation public JParameter[] getParameters() { return getMutableParameters(); } public JClass[] getExceptionTypes() { if (mExceptionClassRefs == null || mExceptionClassRefs.size() == 0) { return new JClass[0]; } JClass[] out = new JClass[mExceptionClassRefs.size()]; for(int i=0; iStandard implementation of MMethod. It's probably bad inheritance to * extend ConstructorImpl, but it's convenient and no one should ever care * since this is a private class; there is no inheritance between method and * constructor in the public API.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class MethodImpl extends InvokableImpl implements MMethod { // ======================================================================== // Variables private JClassRef mReturnTypeRef = null; // ======================================================================== // Constructors /*package*/ MethodImpl(String simpleName, ClassImpl containingClass) { super(containingClass); setSimpleName(simpleName); } // ======================================================================== // MMethod implementation public void setReturnType(String className) { mReturnTypeRef = QualifiedJClassRef.create (className,(ClassImpl)getContainingClass()); } public void setUnqualifiedReturnType(String unqualifiedTypeName) { mReturnTypeRef = UnqualifiedJClassRef.create (unqualifiedTypeName,(ClassImpl)getContainingClass()); } public void setReturnType(JClass c) { mReturnTypeRef = DirectJClassRef.create(c); } // ======================================================================== // JMethod implementation public JClass getReturnType() { if (mReturnTypeRef == null) { return getClassLoader().loadClass("void"); } else { return mReturnTypeRef.getRefClass(); } } public boolean isFinal() { return Modifier.isFinal(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isAbstract() { return Modifier.isAbstract(getModifiers()); } public boolean isNative() { return Modifier.isNative(getModifiers()); } public boolean isSynchronized() { return Modifier.isSynchronized(getModifiers()); } // ======================================================================== // Element implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } public String getQualifiedName() { StringWriter sbuf = new StringWriter(); sbuf.write(Modifier.toString(getModifiers())); sbuf.write(' '); JClass returnJClass = getReturnType(); if (returnJClass == null){ sbuf.write("void "); // should not happen } else { sbuf.write(returnJClass.getQualifiedName()); sbuf.write(' '); } sbuf.write(getSimpleName()); sbuf.write('('); { JParameter[] params = getParameters(); if (params != null && params.length > 0) { for(int i=0; i 0) { sbuf.write(" throws "); for(int i=0; iImplementation of JAnnotationValue

        * * @author Patrick Calahan */ public class AnnotationValueImpl implements JAnnotationValue { // ======================================================================== // Variables private Object mValue = null; private JClassRef mType = null; private String mName; private ElementContext mContext; // ======================================================================== // Constructors public AnnotationValueImpl(ElementContext ctx, String name, Object value, JClass type) { if (ctx == null) throw new IllegalArgumentException("null ctx"); if (name == null) throw new IllegalArgumentException("null name"); if (value == null) throw new IllegalArgumentException("null value"); if (type == null) throw new IllegalArgumentException("null type"); if (value.getClass().isArray()) { mValue = ensureArrayWrapped(value); } else { mValue = value; } mContext = ctx; mName = name; mType = QualifiedJClassRef.create(type); } // ======================================================================== // JAnnotationValue implementation public boolean isDefaultValueUsed() { throw new IllegalStateException("NYI"); //return mIsDefaultUsed; } public String getName() { return mName; } public JClass getType() { return mType.getRefClass(); } public JAnnotation asAnnotation() { if (mValue instanceof JAnnotation) { return (JAnnotation)mValue; } else { return null; //REVIEW or throw? } } public JClass asClass() { if (mValue instanceof JClass) { return (JClass)mValue; } else { return null; //REVIEW or throw? } } public String asString() { if (mValue == null) return null; return mValue.toString(); } public int asInt() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).intValue(); try { return Integer.parseInt(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public boolean asBoolean() throws IllegalArgumentException { if (mValue == null) return false; return Boolean.valueOf(mValue.toString().trim()).booleanValue(); } public long asLong() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).longValue(); try { return Long.parseLong(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public short asShort() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).shortValue(); try { return Short.parseShort(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public double asDouble() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).doubleValue(); try { return Double.parseDouble(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public float asFloat() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).floatValue(); try { return Float.parseFloat(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public byte asByte() throws NumberFormatException { if (mValue == null) return 0; if (mValue instanceof Number) return ((Number)mValue).byteValue(); try { return Byte.parseByte(mValue.toString().trim()); } catch (NumberFormatException nfe) { return 0; } } public char asChar() throws IllegalArgumentException { //FIXME this is not right if (mValue == null) return 0; if (mValue instanceof Character) return ((Character)mValue).charValue(); mValue = mValue.toString(); return (((String)mValue).length() == 0) ? 0 : ((String)mValue).charAt(0); } public JClass[] asClassArray() { if (mValue instanceof JClass[]) { return (JClass[])mValue; } else { return null; } } public JAnnotation[] asAnnotationArray() { if (mValue instanceof JAnnotation[]) { return (JAnnotation[])mValue; } else { return null; } } public String[] asStringArray() { if (!mValue.getClass().isArray()) return null; String[] out = new String[((Object[])mValue).length]; for(int i=0; iImplementation of JSourcePosition and MSourcePosition.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class SourcePositionImpl implements MSourcePosition { // ======================================================================== // Variables private int mColumn = -1; private int mLine = -1; private URI mURI = null; // ======================================================================== // Constructors /*package*/ SourcePositionImpl() {} // ======================================================================== // MSourcePosition implementation public void setColumn(int col) { mColumn = col; } public void setLine(int line) { mLine = line; } public void setSourceURI(URI uri) { mURI = uri; } // ======================================================================== // JSourcePosition implementation public int getColumn() { return mColumn; } public int getLine() { return mLine; } public URI getSourceURI() { return mURI; } }./src/org/codehaus/jam/internal/elements/CommentImpl.java0000664000175000017500000000354411767656530022652 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.mutable.MComment; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; /** *

        Implementation * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class CommentImpl extends ElementImpl implements MComment { // ======================================================================== // Variables private String mText = null; // ======================================================================== // Constructors /*package*/ CommentImpl(ElementImpl parent) { super(parent); } // ======================================================================== // MComment implementation public void setText(String text) { mText = text; } public String getText() { return (mText == null) ? "" : mText; } // ======================================================================== // JElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } public String getQualifiedName() { return getParent().getQualifiedName()+".{comment}"; //REVIEW } } ./src/org/codehaus/jam/internal/elements/UnresolvedClassImpl.java0000664000175000017500000000402211767656530024354 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; import org.codehaus.jam.JPackage; /** *

        This is the JClass that is returned when a java type cannot be * resolved. It has only a name.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class UnresolvedClassImpl extends BuiltinClassImpl { // ======================================================================== // Variables private String mPackageName; // ======================================================================== // Constructor public UnresolvedClassImpl(String packageName, String simpleName, ElementContext ctx) { super(ctx); if (packageName == null) throw new IllegalArgumentException("null pkg"); mPackageName = packageName; reallySetSimpleName(simpleName); } // ======================================================================== // JClass elements public String getQualifiedName() { return ((mPackageName.length() > 0) ? (mPackageName + '.') : "") + mSimpleName; } public String getFieldDescriptor() { return getQualifiedName(); } public JPackage getContainingPackage() { return null; } public boolean isAssignableFrom(JClass c) { return false; } public boolean isUnresolvedType() { return true; } } ./src/org/codehaus/jam/internal/elements/AnnotationImpl.java0000664000175000017500000001142511767656530023357 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JAnnotationValue; import org.codehaus.jam.JClass; import org.codehaus.jam.annotation.DefaultAnnotationProxy; import org.codehaus.jam.mutable.MAnnotation; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; /** *

        Standard implementation of AnnotationImpl.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class AnnotationImpl extends ElementImpl implements MAnnotation { // ======================================================================== // Variables private DefaultAnnotationProxy mProxy; private Object mAnnotationInstance = null; private String mQualifiedName = null; // ======================================================================== // Constructors /*package*/ AnnotationImpl(ElementContext ctx, DefaultAnnotationProxy proxy, String qualifiedName) { super(ctx); if (proxy == null) throw new IllegalArgumentException("null proxy"); if (qualifiedName == null) throw new IllegalArgumentException("null qn"); mProxy = proxy; // review maybe this should just be the behavior in the default impl // of getSimpleName(). setSimpleName(qualifiedName.substring(qualifiedName.lastIndexOf('.')+1)); mQualifiedName = qualifiedName; } // ======================================================================== // JAnnotation implementation public JAnnotationValue[] getValues() { return mProxy.getValues(); } public JAnnotationValue getValue(String name) { return mProxy.getValue(name); } public String getJavadocTagText() { JAnnotationValue val = getValue(JAnnotation.SINGLE_VALUE_NAME); return (val == null) ? null : val.asString(); } public Object getAnnotationInstance() { return mAnnotationInstance; } // ======================================================================== // MAnnotation implementation public void setAnnotationInstance(Object o) { mAnnotationInstance = o; } public void setSimpleValue(String name, Object value, JClass type) { if (name == null) throw new IllegalArgumentException("null name"); if (type == null) throw new IllegalArgumentException("null type"); if (value == null) throw new IllegalArgumentException("null value"); mProxy.setValue(name,value,type); } public MAnnotation createNestedValue(String name, String annTypeName) { if (name == null) throw new IllegalArgumentException("null name"); if (annTypeName == null) throw new IllegalArgumentException("null typename"); DefaultAnnotationProxy p = getContext().createAnnotationProxy(annTypeName); AnnotationImpl out = new AnnotationImpl(getContext(),p,annTypeName); JClass type = getContext().getClassLoader().loadClass(annTypeName); mProxy.setValue(name,out,type); return out; } public MAnnotation[] createNestedValueArray(String name, String annComponentTypeName, int dimensions) { if (name == null) throw new IllegalArgumentException("null name"); if (annComponentTypeName == null) throw new IllegalArgumentException("null typename"); if (dimensions < 0) throw new IllegalArgumentException("dimensions = "+dimensions); MAnnotation[] out = new MAnnotation[dimensions]; for(int i=0; iContext object required by every ElementImpl.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface ElementContext { public JamLogger getLogger(); /** *

        Returns the classloader the elements should use for type resolution. *

        */ public JamClassLoader getClassLoader(); /** *

        Creates an empty appropriate proxy for the given 175 annotation * instance.

        */ public DefaultAnnotationProxy createAnnotationProxy(String jsr175typename); } ./src/org/codehaus/jam/internal/elements/BuiltinClassImpl.java0000664000175000017500000001662111767656530023644 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; import org.codehaus.jam.JConstructor; import org.codehaus.jam.JField; import org.codehaus.jam.JMethod; import org.codehaus.jam.JPackage; import org.codehaus.jam.JProperty; import org.codehaus.jam.JSourcePosition; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; /** *

        Base class for types that are 'built in' to the VM. This includes * void, primitives (but not their wrappers like Integer), and array types. * Note that java.lang.Object is not considered a Builtin.

        * *

        Note that while builtin classes cannot be modified, they can * be annotated and commented.

        * * I think this is going to include generics as well. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public abstract class BuiltinClassImpl extends AnnotatedElementImpl implements MClass { // ======================================================================== // Constructors protected BuiltinClassImpl(ElementContext ctx) { super(ctx); } // ======================================================================== // JElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } public String getQualifiedName() { return mSimpleName; } public String getFieldDescriptor() { return mSimpleName; } // ======================================================================== // JMember implementation public int getModifiers() { return Object.class.getModifiers(); } public boolean isPublic() { return true; } public boolean isPackagePrivate() { return false; } public boolean isProtected() { return false; } public boolean isPrivate() { return false; } public JSourcePosition getSourcePosition() { return null; } public JClass getContainingClass() { return null; } // ======================================================================== // JClass implementation public JClass forName(String fd) { return getClassLoader().loadClass(fd); } public JClass getArrayComponentType() { return null; } public int getArrayDimensions() { return 0; } public JClass getSuperclass() { return null; } public JClass[] getInterfaces() { return NO_CLASS; } public JField[] getFields() { return NO_FIELD; } public JField[] getDeclaredFields() { return NO_FIELD; } public JConstructor[] getConstructors() { return NO_CONSTRUCTOR;} public JMethod[] getMethods() { return NO_METHOD; } public JMethod[] getDeclaredMethods() { return NO_METHOD; } public JPackage getContainingPackage() { return null; } public boolean isInterface() { return false; } public boolean isArrayType() { return false; } public boolean isAnnotationType() { return false; } public boolean isPrimitiveType() { return false; } public boolean isBuiltinType() { return true; } public boolean isUnresolvedType() { return false; } public boolean isObjectType() { return false; } public boolean isVoidType() { return false; } public boolean isEnumType() { return false; } public Class getPrimitiveClass() { return null; } public boolean isAbstract() { return false; } public boolean isFinal() { return false; } public boolean isStatic() { return false; } public JClass[] getClasses() { return NO_CLASS; } public JProperty[] getProperties() { return NO_PROPERTY; } public JProperty[] getDeclaredProperties() { return NO_PROPERTY; } public JPackage[] getImportedPackages() { return NO_PACKAGE; } public JClass[] getImportedClasses() { return NO_CLASS; } // ======================================================================== // MClass implementation public MField[] getMutableFields() { return NO_FIELD; } public MConstructor[] getMutableConstructors() { return NO_CONSTRUCTOR; } public MMethod[] getMutableMethods() { return NO_METHOD; } // can't do any of this stuff public void setSimpleName(String s) { nocando(); } public void setIsAnnotationType(boolean b) { nocando(); } public void setIsInterface(boolean b) { nocando(); } public void setIsUnresolvedType(boolean b) { nocando(); } public void setIsEnumType(boolean b) { nocando(); } public void setSuperclass(String qualifiedClassName) { nocando(); } public void setSuperclassUnqualified(String unqualifiedClassName) { nocando(); } public void setSuperclass(JClass clazz) { nocando(); } public void addInterface(String className) { nocando(); } public void addInterfaceUnqualified(String unqualifiedClassName) { nocando(); } public void addInterface(JClass interf) { nocando(); } public void removeInterface(String className) { nocando(); } public void removeInterface(JClass interf) { nocando(); } public MConstructor addNewConstructor() { nocando(); return null; } public void removeConstructor(MConstructor constr) { nocando(); } public MField addNewField() { nocando(); return null; } public void removeField(MField field) { nocando(); } public MMethod addNewMethod() { nocando(); return null; } public void removeMethod(MMethod method) { nocando(); } public void setModifiers(int modifiers) { nocando(); } public MClass addNewInnerClass(String named) { nocando(); return null; } public void removeInnerClass(MClass inner) { nocando(); } public JProperty addNewProperty(String name, JMethod m, JMethod x) { nocando(); return null; } public void removeProperty(JProperty prop) { nocando(); } public JProperty addNewDeclaredProperty(String name, JMethod m, JMethod x) { nocando(); return null; } public void removeDeclaredProperty(JProperty prop) { nocando(); } public void setSourceAvailable(boolean b) { nocando(); } public boolean isSourceAvailable() { return false; } // ======================================================================== // Object implementation public boolean equals(Object o) { if (o instanceof JClass) { return ((JClass)o).getFieldDescriptor().equals(getFieldDescriptor()); } else { return false; } } public int hashCode() { return getFieldDescriptor().hashCode(); } // ======================================================================== // Protected methods protected void reallySetSimpleName(String name) { super.setSimpleName(name); } // ======================================================================== // Private methods private void nocando() { throw new UnsupportedOperationException("Cannot alter builtin types"); } } ./src/org/codehaus/jam/internal/elements/package.html0000664000175000017500000000032311767656530022034 0ustar brianbrian

        Internal use only. These classes may change or be removed at any time without warning.

        Contains the implementations of the JElement/EElement trees.

        ./src/org/codehaus/jam/internal/elements/ParameterImpl.java0000664000175000017500000000615711767656530023173 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JClass; import org.codehaus.jam.internal.classrefs.DirectJClassRef; import org.codehaus.jam.internal.classrefs.JClassRef; import org.codehaus.jam.internal.classrefs.QualifiedJClassRef; import org.codehaus.jam.internal.classrefs.UnqualifiedJClassRef; import org.codehaus.jam.mutable.MParameter; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; /** *

        Implementation of JParameter and MParameter.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class ParameterImpl extends MemberImpl implements MParameter { // ======================================================================== // Variables private JClassRef mTypeClassRef; // ======================================================================== // Constructors /*package*/ ParameterImpl(String simpleName, InvokableImpl containingMember, String typeName) { super(containingMember); setSimpleName(simpleName); setType(typeName); } // ======================================================================== // JElement implementation public String getQualifiedName() { return getSimpleName();//FIXME } // ======================================================================== // MParameter implementation public void setType(String qcname) { if (qcname == null) throw new IllegalArgumentException("null typename"); mTypeClassRef = QualifiedJClassRef.create (qcname,(ClassImpl)getContainingClass()); } public void setType(JClass qcname) { if (qcname == null) throw new IllegalArgumentException("null qcname"); mTypeClassRef = DirectJClassRef.create(qcname); } public void setUnqualifiedType(String ucname) { if (ucname == null) throw new IllegalArgumentException("null ucname"); mTypeClassRef = UnqualifiedJClassRef.create (ucname,(ClassImpl)getContainingClass()); } // ======================================================================== // JParameter implementation public JClass getType() { return mTypeClassRef.getRefClass(); } // ======================================================================== // JElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } } ./src/org/codehaus/jam/internal/elements/ClassImpl.java0000664000175000017500000005214511767656530022316 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JAnnotation; import org.codehaus.jam.JAnnotationValue; import org.codehaus.jam.JClass; import org.codehaus.jam.JComment; import org.codehaus.jam.JConstructor; import org.codehaus.jam.JField; import org.codehaus.jam.JMethod; import org.codehaus.jam.JPackage; import org.codehaus.jam.JProperty; import org.codehaus.jam.JSourcePosition; import org.codehaus.jam.internal.JamClassLoaderImpl; import org.codehaus.jam.internal.classrefs.JClassRef; import org.codehaus.jam.internal.classrefs.JClassRefContext; import org.codehaus.jam.internal.classrefs.QualifiedJClassRef; import org.codehaus.jam.internal.classrefs.UnqualifiedJClassRef; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.mutable.MField; import org.codehaus.jam.mutable.MMethod; import org.codehaus.jam.provider.JamClassPopulator; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.TreeSet; /** *

        Implementation of JClass and MClass.

        * * @author Patrick Calahan */ public class ClassImpl extends MemberImpl implements MClass, JClassRef, JClassRefContext { // ======================================================================== // Constants public static final int NEW = 1; public static final int UNPOPULATED = 2; public static final int POPULATING = 3; public static final int UNINITIALIZED = 4; public static final int INITIALIZING = 5; public static final int LOADED = 6; // ======================================================================== // Variables private int mState = NEW; private boolean mIsAnnotationType = false; private boolean mIsInterface = false; private boolean mIsEnum = false; private String mPackageName = null; private JClassRef mSuperClassRef = null; // classrefs to the class we extend private ArrayList mInterfaceRefs = null; // refs to interfaces we elements. private ArrayList mFields = null; private ArrayList mMethods = null; private ArrayList mConstructors = null; private ArrayList mProperties = null; private ArrayList mDeclaredProperties = null; private ArrayList mInnerClasses = null; private String[] mImports = null; private JamClassPopulator mPopulator; private boolean mIsSourceAvailable = false; // FIXME implement this - we should only create one UnqualifiedJClassRef // for each unqualified name so as to avoid resolving them over and over. //private Map mName2Uqref = null; // ======================================================================== // Constructors public ClassImpl(String packageName, String simpleName, ElementContext ctx, String[] importSpecs, JamClassPopulator populator) { super(ctx); super.setSimpleName(simpleName); mPackageName = packageName.trim(); mImports = importSpecs; mPopulator = populator; setState(UNPOPULATED); } public ClassImpl(String packageName, String simpleName, ElementContext ctx, String[] importSpecs) { super(ctx); super.setSimpleName(simpleName); mPackageName = packageName.trim(); mImports = importSpecs; mPopulator = null; setState(UNINITIALIZED); } private ClassImpl(String packageName, String simpleName, String[] importSpecs, ClassImpl parent) { super(parent); super.setSimpleName(simpleName); mPackageName = packageName.trim(); mImports = importSpecs; mPopulator = null; setState(UNINITIALIZED); } // ======================================================================== // JClass implementation public JPackage getContainingPackage() { return getClassLoader().getPackage(mPackageName); } public JClass getSuperclass() { ensureLoaded(); if (mSuperClassRef == null) { return null; } else { return mSuperClassRef.getRefClass(); } } public JClass[] getInterfaces() { ensureLoaded(); if (mInterfaceRefs == null || mInterfaceRefs.size() == 0) { return new JClass[0]; } else { JClass[] out = new JClass[mInterfaceRefs.size()]; for(int i=0; i 0) ? (mPackageName + '.') : "") + mSimpleName; } // ======================================================================== // JClassRef implementation (to accommodate direct references) public JClass getRefClass() { return this; } // ======================================================================== // JClassRefContext implementation public String getPackageName() { return mPackageName; } public String[] getImportSpecs() { ensureLoaded(); if (mImports == null) return new String[0]; return mImports; } // ======================================================================== // Public methods for internal use only public void setState(int state) { mState = state; } // ======================================================================== // Public static utility methods /** * Throws an IllegalArgument exception if the given string is not a valid * class name. Useful for parameter checking in several places. */ public static void validateClassName(String className) throws IllegalArgumentException { if (className == null) { throw new IllegalArgumentException("null class name specified"); } if (!Character.isJavaIdentifierStart(className.charAt(0))) { throw new IllegalArgumentException ("Invalid first character in class name: "+className); } for(int i=1; iImplementation of JField and MField.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class FieldImpl extends MemberImpl implements MField { // ======================================================================== // Variables private JClassRef mTypeClassRef; // ======================================================================== // Constructors /*package*/ FieldImpl(String simpleName, ClassImpl containingClass, String qualifiedTypeClassName) { super(containingClass); super.setSimpleName(simpleName); mTypeClassRef = QualifiedJClassRef.create (qualifiedTypeClassName,containingClass); } // ======================================================================== // MField implementation public void setType(JClass type) { if (type == null) throw new IllegalArgumentException("null type"); mTypeClassRef = DirectJClassRef.create(type); } public void setType(String qcname) { if (qcname == null) throw new IllegalArgumentException("null qcname"); mTypeClassRef = QualifiedJClassRef.create (qcname,(ClassImpl)getContainingClass()); } public void setUnqualifiedType(String ucname) { if (ucname == null) throw new IllegalArgumentException("null ucname"); mTypeClassRef = UnqualifiedJClassRef.create (ucname,(ClassImpl)getContainingClass()); } // ======================================================================== // JField implementation public JClass getType() { if (mTypeClassRef == null) throw new IllegalStateException(); return mTypeClassRef.getRefClass(); } public boolean isFinal() { return Modifier.isFinal(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isVolatile() { return Modifier.isVolatile(getModifiers()); } public boolean isTransient() { return Modifier.isTransient(getModifiers()); } // ======================================================================== // M/JElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } public String getQualifiedName() { StringWriter sbuf = new StringWriter(); sbuf.write(Modifier.toString(getModifiers())); sbuf.write(' '); sbuf.write(getType().getQualifiedName()); sbuf.write(' '); sbuf.write(getContainingClass().getQualifiedName()); sbuf.write('.'); sbuf.write(getSimpleName()); return sbuf.toString(); } }./src/org/codehaus/jam/internal/elements/ConstructorImpl.java0000664000175000017500000000505711767656530023576 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal.elements; import org.codehaus.jam.JParameter; import org.codehaus.jam.mutable.MConstructor; import org.codehaus.jam.visitor.JVisitor; import org.codehaus.jam.visitor.MVisitor; import java.io.StringWriter; import java.lang.reflect.Modifier; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class ConstructorImpl extends InvokableImpl implements MConstructor { // ======================================================================== // Constructors /*package*/ ConstructorImpl(ClassImpl containingClass) { super(containingClass); setSimpleName(containingClass.getSimpleName()); } // ======================================================================== // JElement implementation public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } public String getQualifiedName() { StringWriter sbuf = new StringWriter(); sbuf.write(Modifier.toString(getModifiers())); sbuf.write(' '); sbuf.write(getSimpleName()); sbuf.write('('); { JParameter[] params = getParameters(); if (params != null && params.length > 0) { for(int i=0; i 0) { sbuf.write(" throws "); for(int i=0; iJClass implementation for primitive types.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public final class PrimitiveClassImpl extends BuiltinClassImpl { // ======================================================================== // Constants private static final Object[][] PRIMITIVES = { // Name FD Class {"int", "I", int.class}, {"long", "J", long.class}, {"boolean", "Z", boolean.class}, {"short", "S", short.class}, {"byte", "B", byte.class}, {"char", "C", char.class}, {"float", "F", float.class}, {"double", "D", double.class}, }; private static final Map NAME_TO_FD, NAME_TO_CLASS; static { NAME_TO_FD = new HashMap(); NAME_TO_CLASS = new HashMap(); for (int i = 0; i < PRIMITIVES.length; i++) { NAME_TO_FD.put(PRIMITIVES[i][0],PRIMITIVES[i][1]); NAME_TO_CLASS.put(PRIMITIVES[i][0],PRIMITIVES[i][2]); } }; // ======================================================================== // Factory methods public static void mapNameToPrimitive(ElementContext ctx, Map out) { for(int i=0; iGeneric implementation of JPackage/InternalJPackage that is good * enough for all samples, right now. This might change if we ever wrap * a model which natively supports package-level annotation.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class PackageImpl extends AnnotatedElementImpl implements MPackage { // ======================================================================== // Variables private List mRootClasses = new ArrayList(); private String mName; // ======================================================================== // Constructors public PackageImpl(ElementContext ctx, String name) { super(ctx); mName = name; int lastDot = mName.lastIndexOf('.'); setSimpleName((lastDot == -1) ? mName : mName.substring(lastDot + 1)); } // ======================================================================== // JElement implementation public String getQualifiedName() { return mName; } public void accept(MVisitor visitor) { visitor.visit(this); } public void accept(JVisitor visitor) { visitor.visit(this); } // ======================================================================== // JPackage implementation public JClass[] getClasses() { JClass[] out = new JClass[mRootClasses.size()]; mRootClasses.toArray(out); return out; } // ======================================================================== // MPackage implementation public MClass[] getMutableClasses() { MClass[] out = new MClass[mRootClasses.size()]; mRootClasses.toArray(out); return out; } } ./src/org/codehaus/jam/internal/package.html0000664000175000017500000000033511767656530020223 0ustar brianbrian

        Internal use only. These classes may change or be removed at any time without warning.

        This package contains various classes used in the JAM imlementation.

        ./src/org/codehaus/jam/internal/JamServiceImpl.java0000664000175000017500000000476211767656530021467 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.JClass; import org.codehaus.jam.JamClassIterator; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.JamService; import org.codehaus.jam.internal.elements.ElementContext; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamServiceImpl implements JamService { // ======================================================================== // Variables private ElementContext mContext; private String[] mClassNames; // ======================================================================== // Constructors public JamServiceImpl(ElementContext ctx, String[] classes) { if (ctx == null) throw new IllegalArgumentException("null jcl"); if (classes == null) throw new IllegalArgumentException("null classes"); mContext = ctx; mClassNames = classes; } // ======================================================================== // JamService implementation public JamClassLoader getClassLoader() { return mContext.getClassLoader(); } public String[] getClassNames() { return mClassNames; } public JamClassIterator getClasses() { return new JamClassIterator(getClassLoader(),getClassNames()); } public JClass[] getAllClasses() { JClass[] out = new JClass[mClassNames.length]; for(int i=0; iFile.separatorChar, so the separator used * need not match File.separatorChar. *

        * When a pattern ends with a '/' or '\', "**" is appended. * * @param includes A list of include patterns. * May be null, indicating that all files * should be included. If a non-null * list is given, all elements2 must be * non-null. */ private void setIncludes(String[] includes) { if (includes == null) { this.mIncludes = null; } else { this.mIncludes = new String[includes.length]; for (int i = 0; i < includes.length; i++) { String pattern; pattern = includes[i].replace('/', File.separatorChar). replace('\\', File.separatorChar); if (pattern.endsWith(File.separator)) { pattern += "**"; } this.mIncludes[i] = pattern; } } } /** * Sets the list of exclude patterns to use. All '/' and '\' characters * are replaced by File.separatorChar, so the separator used * need not match File.separatorChar. *

        * When a pattern ends with a '/' or '\', "**" is appended. * * @param excludes A list of exclude patterns. * May be null, indicating that no files * should be excluded. If a non-null list is * given, all elements2 must be non-null. */ private void setExcludes(String[] excludes) { if (excludes == null) { this.mExcludes = null; } else { this.mExcludes = new String[excludes.length]; for (int i = 0; i < excludes.length; i++) { String pattern; pattern = excludes[i].replace('/', File.separatorChar). replace('\\', File.separatorChar); if (pattern.endsWith(File.separator)) { pattern += "**"; } this.mExcludes[i] = pattern; } } } /** * Scans the base directory for files which match at least one * include pattern and don't match any exclude patterns. If there * are selectors then the files must pass muster there, as well. * * @exception IllegalStateException if the base directory was set * incorrectly (i.e. if it is null, doesn't exist, * or isn't a directory). */ private void scan() throws IllegalStateException, IOException { if (mIncludes == null) { // No mIncludes supplied, so set it to 'matches all' mIncludes = new String[1]; mIncludes[0] = "**"; } if (mExcludes == null) { mExcludes = new String[0]; } mFilesIncluded = new Vector(); mDirsIncluded = new Vector(); if (isIncluded("")) { if (!isExcluded("")) { mDirsIncluded.addElement(""); } } scandir(mRoot, "", true); } /** * Scans the given directory for files and directories. Found files and * directories are placed in their respective collections, based on the * matching of mIncludes, mExcludes, and the selectors. When a directory * is found, it is scanned recursively. * * @param dir The directory to scan. Must not be null. * @param vpath The path relative to the base directory (needed to * prevent problems with an absolute path when using * dir). Must not be null. * @param fast Whether or not this call is part of a fast scan. * * @see #mFilesIncluded * @see #mDirsIncluded */ private void scandir(File dir, String vpath, boolean fast) throws IOException { if (mLogger.isVerbose(this)) { mLogger.verbose("[DirectoryScanner] scanning dir "+dir+" for '"+vpath+"'"); } String[] newfiles = dir.list(); if (newfiles == null) { /* * two reasons are mentioned in the API docs for File.list * (1) dir is not a directory. This is impossible as * we wouldn't get here in this case. * (2) an IO error occurred (why doesn't it throw an exception * then???) */ throw new IOException("IO error scanning directory " + dir.getAbsolutePath()); } /* if (!followSymlinks) { Vector noLinks = new Vector(); for (int i = 0; i < newfiles.length; i++) { try { if (fileUtils.isSymbolicLink(dir, newfiles[i])) { String name = vpath + newfiles[i]; File file = new File(dir, newfiles[i]); if (file.isDirectory()) { dirsExcluded.addElement(name); } else { filesExcluded.addElement(name); } } else { noLinks.addElement(newfiles[i]); } } catch (IOException ioe) { String msg = "IOException caught while checking " + "for links, couldn't get cannonical path!"; // will be caught and redirected to Ant's logging system System.err.println(msg); noLinks.addElement(newfiles[i]); } } newfiles = new String[noLinks.size()]; noLinks.copyInto(newfiles); }*/ for (int i = 0; i < newfiles.length; i++) { String name = vpath + newfiles[i]; File file = new File(dir, newfiles[i]); if (file.isDirectory()) { if (isIncluded(name) && !isExcluded(name)) { mDirsIncluded.addElement(name); if (mLogger.isVerbose(this)) mLogger.verbose("...including dir "+name); scandir(file, name + File.separator, fast); } else { if (couldHoldIncluded(name)) { scandir(file, name + File.separator, fast); } } } else if (file.isFile()) { if (isIncluded(name)) { if (!isExcluded(name)) { mFilesIncluded.addElement(name); if (mLogger.isVerbose(this)) { mLogger.verbose("...including "+name+" under '"+dir); } } else { if (mLogger.isVerbose(this)) { mLogger.verbose("...EXCLUDING "+name+" under '"+dir); } } } } } } /** * Tests whether or not a name matches against at least one include * pattern. * * @param name The name to match. Must not be null. * @return true when the name matches against at least one * include pattern, or false otherwise. */ private boolean isIncluded(String name) { for (int i = 0; i < mIncludes.length; i++) { if (matchPath(mIncludes[i], name, mCaseSensitive)) { return true; } } return false; } /** * Tests whether or not a name matches the start of at least one include * pattern. * * @param name The name to match. Must not be null. * @return true when the name matches against the start of at * least one include pattern, or false otherwise. */ private boolean couldHoldIncluded(String name) { for (int i = 0; i < mIncludes.length; i++) { if (matchPatternStart(mIncludes[i], name, mCaseSensitive)) { return true; } } return false; } /** * Tests whether or not a name matches against at least one exclude * pattern. * * @param name The name to match. Must not be null. * @return true when the name matches against at least one * exclude pattern, or false otherwise. */ private boolean isExcluded(String name) { for (int i = 0; i < mExcludes.length; i++) { if (matchPath(mExcludes[i], name, mCaseSensitive)) { return true; } } return false; } /** * Returns the names of the directories which matched at least one * of the include patterns and none of the exclude patterns. The * names are relative to the base directory. * * @return the names of the directories which matched at least one of the * include patterns and none of the exclude patterns. private String[] getIncludedDirectories() { String[] directories = new String[mDirsIncluded.size()]; mDirsIncluded.copyInto(directories); return directories; } */ // ======================================================================== // SelectorUtils stuff /** * Tests whether or not a given path matches the start of a given * pattern up to the first "**". *

        * This is not a general purpose test and should only be used if you * can live with false positives. For example, pattern=**\a * and str=b will yield true. * * @param pattern The pattern to match against. Must not be * null. * @param str The path to match, as a String. Must not be * null. * * @return whether or not a given path matches the start of a given * pattern up to the first "**". private static boolean matchPatternStart(String pattern, String str) { return matchPatternStart(pattern, str, true); } */ /** * Tests whether or not a given path matches the start of a given * pattern up to the first "**". *

        * This is not a general purpose test and should only be used if you * can live with false positives. For example, pattern=**\a * and str=b will yield true. * * @param pattern The pattern to match against. Must not be * null. * @param str The path to match, as a String. Must not be * null. * @param mCaseSensitive Whether or not matching should be performed * case sensitively. * * @return whether or not a given path matches the start of a given * pattern up to the first "**". */ private static boolean matchPatternStart(String pattern, String str, boolean mCaseSensitive) { // When str starts with a File.separator, pattern has to start with a // File.separator. // When pattern starts with a File.separator, str has to start with a // File.separator. if (str.startsWith(File.separator) != pattern.startsWith(File.separator)) { return false; } Vector patDirs = tokenizePath(pattern); Vector strDirs = tokenizePath(str); int patIdxStart = 0; int patIdxEnd = patDirs.size() - 1; int strIdxStart = 0; int strIdxEnd = strDirs.size() - 1; // up to first '**' while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) { String patDir = (String) patDirs.elementAt(patIdxStart); if (patDir.equals("**")) { break; } if (!match(patDir, (String) strDirs.elementAt(strIdxStart), mCaseSensitive)) { return false; } patIdxStart++; strIdxStart++; } if (strIdxStart > strIdxEnd) { // String is exhausted return true; } else if (patIdxStart > patIdxEnd) { // String not exhausted, but pattern is. Failure. return false; } else { // pattern now holds ** while string is not exhausted // this will generate false positives but we can live with that. return true; } } /** * Tests whether or not a given path matches a given pattern. * * @param pattern The pattern to match against. Must not be * null. * @param str The path to match, as a String. Must not be * null. * * @return true if the pattern matches against the string, * or false otherwise. private static boolean matchPath(String pattern, String str) { return matchPath(pattern, str, true); } */ /** * Tests whether or not a given path matches a given pattern. * * @param pattern The pattern to match against. Must not be * null. * @param str The path to match, as a String. Must not be * null. * @param mCaseSensitive Whether or not matching should be performed * case sensitively. * * @return true if the pattern matches against the string, * or false otherwise. */ private static boolean matchPath(String pattern, String str, boolean mCaseSensitive) { // When str starts with a File.separator, pattern has to start with a // File.separator. // When pattern starts with a File.separator, str has to start with a // File.separator. if (str.startsWith(File.separator) != pattern.startsWith(File.separator)) { return false; } Vector patDirs = tokenizePath(pattern); Vector strDirs = tokenizePath(str); int patIdxStart = 0; int patIdxEnd = patDirs.size() - 1; int strIdxStart = 0; int strIdxEnd = strDirs.size() - 1; // up to first '**' while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) { String patDir = (String) patDirs.elementAt(patIdxStart); if (patDir.equals("**")) { break; } if (!match(patDir, (String) strDirs.elementAt(strIdxStart), mCaseSensitive)) { return false; } patIdxStart++; strIdxStart++; } if (strIdxStart > strIdxEnd) { // String is exhausted for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { return false; } } return true; } else { if (patIdxStart > patIdxEnd) { // String not exhausted, but pattern is. Failure. return false; } } // up to last '**' while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) { String patDir = (String) patDirs.elementAt(patIdxEnd); if (patDir.equals("**")) { break; } if (!match(patDir, (String) strDirs.elementAt(strIdxEnd), mCaseSensitive)) { return false; } patIdxEnd--; strIdxEnd--; } if (strIdxStart > strIdxEnd) { // String is exhausted for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { return false; } } return true; } while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) { int patIdxTmp = -1; for (int i = patIdxStart + 1; i <= patIdxEnd; i++) { if (patDirs.elementAt(i).equals("**")) { patIdxTmp = i; break; } } if (patIdxTmp == patIdxStart + 1) { // '**/**' situation, so skip one patIdxStart++; continue; } // Find the pattern between padIdxStart & padIdxTmp in str between // strIdxStart & strIdxEnd int patLength = (patIdxTmp - patIdxStart - 1); int strLength = (strIdxEnd - strIdxStart + 1); int foundIdx = -1; strLoop: for (int i = 0; i <= strLength - patLength; i++) { for (int j = 0; j < patLength; j++) { String subPat = (String) patDirs.elementAt(patIdxStart + j + 1); String subStr = (String) strDirs.elementAt(strIdxStart + i + j); if (!match(subPat, subStr, mCaseSensitive)) { continue strLoop; } } foundIdx = strIdxStart + i; break; } if (foundIdx == -1) { return false; } patIdxStart = patIdxTmp; strIdxStart = foundIdx + patLength; } for (int i = patIdxStart; i <= patIdxEnd; i++) { if (!patDirs.elementAt(i).equals("**")) { return false; } } return true; } /** * Tests whether or not a string matches against a pattern. The * pattern may contain two special characters:
        '*' means zero or * more characters
        '?' means one and only one character * * @param pattern The pattern to match against. * Must not be null. * @param str The string which must be matched against the pattern. * Must not be null. * @param mCaseSensitive Whether or not matching should be performed * case sensitively. * * * @return true if the string matches against the pattern, * or false otherwise. */ private static boolean match(String pattern, String str, boolean mCaseSensitive) { char[] patArr = pattern.toCharArray(); char[] strArr = str.toCharArray(); int patIdxStart = 0; int patIdxEnd = patArr.length - 1; int strIdxStart = 0; int strIdxEnd = strArr.length - 1; char ch; boolean containsStar = false; for (int i = 0; i < patArr.length; i++) { if (patArr[i] == '*') { containsStar = true; break; } } if (!containsStar) { // No '*'s, so we make a shortcut if (patIdxEnd != strIdxEnd) { return false; // Pattern and string do not have the same size } for (int i = 0; i <= patIdxEnd; i++) { ch = patArr[i]; if (ch != '?') { if (mCaseSensitive && ch != strArr[i]) { return false;// Character mismatch } if (!mCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[i])) { return false; // Character mismatch } } } return true; // String matches against pattern } if (patIdxEnd == 0) { return true; // Pattern contains only '*', which matches anything } // Process characters before first star while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) { if (ch != '?') { if (mCaseSensitive && ch != strArr[strIdxStart]) { return false;// Character mismatch } if (!mCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart])) { return false;// Character mismatch } } patIdxStart++; strIdxStart++; } if (strIdxStart > strIdxEnd) { // All characters in the string are used. Check if only '*'s are // left in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } // Process characters after last star while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) { if (ch != '?') { if (mCaseSensitive && ch != strArr[strIdxEnd]) { return false;// Character mismatch } if (!mCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd])) { return false;// Character mismatch } } patIdxEnd--; strIdxEnd--; } if (strIdxStart > strIdxEnd) { // All characters in the string are used. Check if only '*'s are // left in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } // process pattern between stars. padIdxStart and patIdxEnd point // always to a '*'. while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) { int patIdxTmp = -1; for (int i = patIdxStart + 1; i <= patIdxEnd; i++) { if (patArr[i] == '*') { patIdxTmp = i; break; } } if (patIdxTmp == patIdxStart + 1) { // Two stars next to each other, skip the first one. patIdxStart++; continue; } // Find the pattern between padIdxStart & padIdxTmp in str between // strIdxStart & strIdxEnd int patLength = (patIdxTmp - patIdxStart - 1); int strLength = (strIdxEnd - strIdxStart + 1); int foundIdx = -1; strLoop: for (int i = 0; i <= strLength - patLength; i++) { for (int j = 0; j < patLength; j++) { ch = patArr[patIdxStart + j + 1]; if (ch != '?') { if (mCaseSensitive && ch != strArr[strIdxStart + i + j]) { continue strLoop; } if (!mCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart + i + j])) { continue strLoop; } } } foundIdx = strIdxStart + i; break; } if (foundIdx == -1) { return false; } patIdxStart = patIdxTmp; strIdxStart = foundIdx + patLength; } // All characters in the string are used. Check if only '*'s are left // in the pattern. If so, we succeeded. Otherwise failure. for (int i = patIdxStart; i <= patIdxEnd; i++) { if (patArr[i] != '*') { return false; } } return true; } /** * Breaks a path up into a Vector of path elements2, tokenizing on * File.separator. * * @param path Path to tokenize. Must not be null. * * @return a Vector of path elements2 from the tokenized path */ private static Vector tokenizePath(String path) { Vector ret = new Vector(); StringTokenizer st = new StringTokenizer(path, File.separator); while (st.hasMoreTokens()) { ret.addElement(st.nextToken()); } return ret; } }./src/org/codehaus/jam/internal/JamClassLoaderImpl.java0000664000175000017500000002133011767656530022251 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam.internal; import org.codehaus.jam.JClass; import org.codehaus.jam.JPackage; import org.codehaus.jam.JamClassLoader; import org.codehaus.jam.internal.elements.ArrayClassImpl; import org.codehaus.jam.internal.elements.ClassImpl; import org.codehaus.jam.internal.elements.ElementContext; import org.codehaus.jam.internal.elements.PackageImpl; import org.codehaus.jam.internal.elements.PrimitiveClassImpl; import org.codehaus.jam.internal.elements.UnresolvedClassImpl; import org.codehaus.jam.internal.elements.VoidClassImpl; import org.codehaus.jam.mutable.MClass; import org.codehaus.jam.provider.JamClassBuilder; import org.codehaus.jam.visitor.MVisitor; import org.codehaus.jam.visitor.TraversingMVisitor; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Stack; /** * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamClassLoaderImpl implements JamClassLoader { // ======================================================================== // Variables private Map mName2Package = new HashMap(); private Map mFd2ClassCache = new HashMap(); private JamClassBuilder mBuilder; private MVisitor mInitializer = null; private ElementContext mContext; private Stack mInitializeStack = new Stack(); //fixme - decide how to store them private boolean mAlreadyInitializing = false; // ======================================================================== // Constructor public JamClassLoaderImpl(ElementContext context, JamClassBuilder builder, MVisitor initializerOrNull) { if (builder == null) throw new IllegalArgumentException("null builder"); if (context == null) throw new IllegalArgumentException("null builder"); mBuilder = builder; mInitializer = (initializerOrNull == null) ? null : // null is ok, else new TraversingMVisitor(initializerOrNull); // wrap it in a walker mContext = context; initCache(); } // ======================================================================== // JamClassLoader implementation public final JClass loadClass(String fd) { fd = fd.trim(); JClass out = cacheGet(fd); if (out != null) return out; if (fd.indexOf('[') != -1) { // must be some kind of array name String normalFd = ArrayClassImpl.normalizeArrayName(fd); out = cacheGet(normalFd); // an array by any other name? if (out == null) { out = ArrayClassImpl.createClassForFD(normalFd,this); cachePut(out,normalFd); } cachePut(out,fd); // so we know it by the requested name as well return out; } { // check for loading inner class by name. if it's not in the cache // yet, that means we need to go get the outer class. when that's // done, the inner class will in the cache (or not). int dollar = fd.indexOf('$'); if (dollar != -1) { String outerName = fd.substring(0,dollar); ((ClassImpl)loadClass(outerName)).ensureLoaded(); out = cacheGet(fd); // parse out the package and class names - this is kinda broken int dot = fd.lastIndexOf('.'); if (out == null) { String pkg; String name; if (dot == -1) { pkg = ""; name = fd; } else { pkg = fd.substring(0,dot); name = fd.substring(dot+1); } out = new UnresolvedClassImpl(pkg,name,mContext); mContext.getLogger().warning("failed to resolve class "+fd); cachePut(out); } return out; } } // parse out the package and class names - this is kinda broken int dot = fd.lastIndexOf('.'); String pkg; String name; if (dot == -1) { pkg = ""; name = fd; } else { pkg = fd.substring(0,dot); name = fd.substring(dot+1); } out = mBuilder.build(pkg,name); if (out == null) { //FIXME currently, the unqualified ref stuff will keep calling this, //newing up new UnresolvedClassImpls for each import until it finds //something. We need to break out a separate checkClass() method //or something for them which returns null rather than UnresolvedClass. out = new UnresolvedClassImpl(pkg,name,mContext); mContext.getLogger().warning("failed to resolve class "+fd); cachePut(out); return out; } cachePut(out); return out; } public JPackage getPackage(String named) { JPackage out = (JPackage)mName2Package.get(named); if (out == null) { out = new PackageImpl(mContext,named); mName2Package.put(named,out); } return out; } // ======================================================================== // Private methods /** *

        Stuff the primitives and void into the cache.

        */ private void initCache() { PrimitiveClassImpl.mapNameToPrimitive(mContext,mFd2ClassCache); mFd2ClassCache.put("void",new VoidClassImpl(mContext)); } private void cachePut(JClass clazz) { mFd2ClassCache.put(clazz.getFieldDescriptor().trim(), new WeakReference(clazz)); } private void cachePut(JClass clazz, String cachedName) { mFd2ClassCache.put(cachedName, new WeakReference(clazz)); } private JClass cacheGet(String fd) { Object out = mFd2ClassCache.get(fd.trim()); if (out == null) return null; if (out instanceof JClass) return (JClass)out; if (out instanceof WeakReference) { out = ((WeakReference)out).get(); if (out == null) { mFd2ClassCache.remove(fd.trim()); return null; } else { return (JClass)out; } } throw new IllegalStateException(); } // ======================================================================== // Public methods? //should only be called by ClassImpl public void initialize(ClassImpl out) { if (mInitializer != null) { // see comments below about this. we need to document this more openly, // since it affects people writing initializers. if (mAlreadyInitializing) { // we already are running initializers, so we have to do this one later mInitializeStack.push(out); } else { out.accept(mInitializer); while(!mInitializeStack.isEmpty()) { ClassImpl initme = (ClassImpl)mInitializeStack.pop(); initme.accept(mInitializer); } mAlreadyInitializing = false; } } } /** * Returns an unmodifiable collection containing the JClasses which * have been resolved by this JamClassLoader. */ public Collection getResolvedClasses() { return Collections.unmodifiableCollection(mFd2ClassCache.values()); } public void addToCache(JClass c) { //FIXME hack for mutable classes for now. also for inner classes. cachePut((MClass)c); } //ok, the best thinking here is that when you are in an initializer //and you walk to another type, you will get a JClass that has a name //but is otherwise empty - it's not initialized. It's like unresolved //except that it still has a chance to be resolved. // // Internally, the classloader will maintain a stack of classes to be // initialized. When a class is first loaded, the initialization stack // is checked. If it is empty, the class is placed on the stack and // initialization is performed on the item on the top of the stack until // the stack is empty. // If loadClass is called again further down in the stack frame, // at least one class will be on the initialization stack. In this // case, the class is placed on the stack but initialization is not // performed immediately - the caller original caller higher in the stack // frame will do the initialization. // This scheme is necessary to prevent problems with cyclical initialization. // // public boolean isInitialized(); }./src/org/codehaus/jam/JTag.java0000664000175000017500000000516111767656530015620 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import java.util.Properties; /** * Represents a javadoc tag. Includes helper methods for parsing tags * containing complex name-value data. Different folks have different * styles of encoding the pairs, so we provide different helper methods. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JTag extends JElement { /** * Returns the name of the tag. The value will be the same as * getSimpleName(); */ public String getName(); /** * Returns the raw contents of the tag, as return by javadoc's * Tag.text() method. */ public String getText(); /** *

        Convenience method which parses the tag's contents as a series of * line-delimited name=value pairs and returns them as a properties * object. A line break is the only delimter between pairs, and * the first '=' is taken as the delimeter between name and value.

        * * For example, a javadoc tag 'my tag' with the following * value: * * (at)mytag foo = this * bar = "and" that * baz = the other thing = true * *

        would be returned as a Properties object containing three properties * named foo, bar, and baz with values of "this", ""and"" that, and "the * other thing = true", respectively.

        */ public Properties getProperties_lineDelimited(); /** *

        Convenience method which parses the tag's contents as a series of * whitespace-delimited name=value pairs and returns them as a properties * object. Values containing whitespace must be quoted. Keys may not * contain whitespace

        * * For example, a javadoc tag 'my tag' with the following contents: * * (at)mytag foo = this bar = that this text is * ignored baz = "but not this" * *

        would be returned as a Properties object containing three properties * named foo, bar, and baz with values of "this", "that", and * "but not this". */ public Properties getProperties_whitespaceDelimited(); }./src/org/codehaus/jam/JAnnotation.java0000664000175000017500000000651611767656530017224 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents a metadata that is associated with a particular * JElement. Note that JAnnoations are JElements, which means * that they themselves can have annotations, and can be treated as * nodes in a JAM hierarchy.

        * *

        Annotations can be simple or complex. Values of simple * annotations can be retrieved via the various get...Value() methods. * Complex attributes can be navigated via the getAnnotations() method * which exposes nested attributes (which may in turn be either simple * or complex.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JAnnotation extends JElement { // ======================================================================== // Constants public String getSimpleName(); public static final String SINGLE_VALUE_NAME = "value"; // ======================================================================== // Public methods /** *

        Returns an array of this annotation's member values.

        */ public JAnnotationValue[] getValues(); /** *

        Returns a structure which provides untyped, "by-name" access to * the value of the named annotation member. */ public JAnnotationValue getValue(String named); /** *

        If this JAnnotation represents a javadoc tag, returns the raw, * untrimmed contents of the tag. Otherwise, returns null. You * shouldn't use this method without a really good reason - you normally * should call one of the getMember() methods to get at the tag contents. * You can call getMember(SINGLE_MEMBER_NAME) to get a JAnnotationValue * representing the contents of a simple javadoc tag (e.g. @mytag myvalue). *

        */ public String getJavadocTagText(); /** *

        If this JAnnotation corresponds to metadata that is stored in * a JSR175 annotation (i.e. an instance of java.lang.annotation.Annotation), * returns that annotation object. Returns null if the annotation does * not exist or is otherwise unavailable.

        * *

        Note that this is done only on a best-effort basis - the annotation * object not be availble under pre-1.5 JREs and will generally only be * available if the underlying annotation was view from a class file. Note * that the retention policy of the annotation type usually must also be * RUNTIME.

        * *

        If this method does return something other than null, it is guaranteed * to be an instance of java.lang.annotation.Annotation. It * is typed here as Object simply to preserve API compatibility * with Java 1.4.

        . */ public Object getAnnotationInstance(); } ./src/org/codehaus/jam/JAnnotationValue.java0000664000175000017500000002534711767656530020224 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Represents a member value of a JAnnotation.

        * *

        A note regarding enums

        * *

        The presence of metadata of 'enum' types poses a bit of a challenge * in the untyped view of metadata that is presented by JAnnotationValue. * Because JAM cannot assume that the enum definitions have been compiled, * it is not possible for JAM to return an instance of an enumuerated type. * In other words, it is not possible for JAnnotationValue to provide an * asEnum() method.

        * *

        If JAM encounters an annotation value of an enumerated type, it will * represent it with a JAnnotationValue such that calling * myAnnotationValue.getType().isEnumType() will return true. * Moreover, calling myAnnotationValue.asString() will return * the name of the enumeration field, exactly as it appears in the * type declaration. *

        * * @author Patrick Calahan */ public interface JAnnotationValue { //docme public String getName(); //docme public JClass getType(); /** *

        If this member is complex (i.e. an instance of another annotation * type), this method returns a representation of the annotation instance. * Returns null in all other samples. This method always returns null if the * annotation is a javdoc tag, as such tags only support one level of * nesting.

        */ public JAnnotation asAnnotation(); /** *

        Returns the value of this member as a JClass. Returns null if the * value cannot be understood as a class name or if the type of the member * is known to be something other than java.lang.Class.

        */ public JClass asClass(); /** *

        Returns the String value of the annotation. If the value is * known to be a simple, non-array type other than String, it will be * converted in a resonable manner (with an appropriate toString() or * String.valueOf() method). If the value is known to be complex or is an * array, this method will return null.

        * *

        If no type information is available for the annotation member (i.e. * it's a javadoc tag), then the raw textual value of the member is * returned.

        */ public String asString(); /** *

        Returns the member's value as an int. If the value is not known to be * an int, (because it's a javadoc tag or because it's a 175 annotation * member of a type other than int) asString() is called. If the result is * null, NumberFormatException is thrown. Otherwise, the String is * converted to an int with Integer.valueOf(), which again may throw * NumberFormatException.

        */ public int asInt() throws NumberFormatException; /** *

        Returns the member's value as a boolean. If necessary, type * conversion is performed in a similar manner as described for * asInt(), except that IllegalArgumentException is * thrown instead of NumberFormatException.

        */ public boolean asBoolean() throws IllegalArgumentException; /** *

        Returns the member's value as a long. If necessary, type * conversion is performed in a similar manner as described for * asInt().

        */ public long asLong() throws NumberFormatException; /** *

        Returns the member's value as a short. If necessary, type * conversion is performed in a similar manner as described for * asInt().

        */ public short asShort() throws NumberFormatException; /** *

        Returns the member's value as a double. If necessary, type * conversion is performed in a similar manner as described for * asInt().

        */ public double asDouble() throws NumberFormatException; /** *

        Returns the member's value as a float. If necessary, type * conversion is performed in a similar manner as described for * asInt().

        */ public float asFloat() throws NumberFormatException; /** *

        Returns the member's value as a byte. If necessary, type * conversion is performed in a similar manner as described for * asInt().

        */ public byte asByte() throws NumberFormatException; /** *

        Returns the member's value as a char. If necessary, type * conversion is performed by calling getStringValue(). If the result * is null or is a String that is not exactly of length 1, * IllegalArgumentException is thrown.

        */ public char asChar() throws IllegalArgumentException; /** *

        If this member is known to be of an array type, returns the value * as an array of Objects. If the array component type is primitive, * the array objects will be instances of an appropriate java.lang * wrapper (e.g., Integer). Returns null if the member type is * not an array.

        * *

        This method always returns null for javadoc tags.

        */ //public Object[] asArray(); /** *

        If this member is known to be an array of classes, returns an * array of JClass representations of those classes. If the memeber * is known to be an array of a simple non-array type, this method * will call asStringArray() and attempt to return a JClass * by treating each string in the returned array as a qualified classname. * Returns null otherwise. *

        * *

        This method always returns null for javadoc tags.

        */ public JClass[] asClassArray(); /** *

        If this member is known to be an array of annotations (i.e. * complex, nested types), this method returns an array containing * each complex value as a JAnnotation. Returns null in all other samples. *

        * *

        This method always returns null for javadoc tags.

        */ public JAnnotation[] asAnnotationArray(); /** *

        Returns this member's value as an array of Strings. If this member is * not of an array type, or is an array of arrays or complex annotations, * this method returns null. If it is an array of a simple, non-array type * other than String, conversion on each component will be attempted as * described under getStringValue().

        * *

        This method always returns null for javadoc tags.

        */ public String[] asStringArray(); /** *

        Returns this member's value as an array of ints. If this member is * not of an array type, or is an array of arrays or complex annotations, * this method returns null. If it is an array of a simple, non-array type * other than int, conversion on each component will be attempted as * described under getIntValue().

        * *

        This method always returns null for javadoc tags.

        */ public int[] asIntArray() throws NumberFormatException; /** *

        Returns this member's value as an array of booleans. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(), except that IllegalArgumentException may be * thrown instead of NumberFormatException.

        * *

        This method always returns null for javadoc tags.

        */ public boolean[] asBooleanArray() throws IllegalArgumentException; /** *

        Returns this member's value as an array of shorts. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(). * *

        This method always returns null for javadoc tags.

        */ public short[] asShortArray() throws NumberFormatException; /** *

        Returns this member's value as an array of longs. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(). * *

        This method always returns null for javadoc tags.

        */ public long[] asLongArray() throws NumberFormatException; /** *

        Returns this member's value as an array of doubles. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(). * *

        This method always returns null for javadoc tags.

        */ public double[] asDoubleArray() throws NumberFormatException; /** *

        Returns this member's value as an array of floats. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(). * *

        This method always returns null for javadoc tags.

        */ public float[] asFloatArray() throws NumberFormatException; /** *

        Returns this member's value as an array of bytes. If necessary, * type conversion is performed in a similar manner as described for * asIntArray(). * *

        This method always returns null for javadoc tags.

        */ public byte[] asByteArray() throws NumberFormatException; /** *

        Returns this member's value as an array of bytes. If necessary, * type conversion is performed in a similar manner as described for * asIntArray() and asChar().. * *

        This method always returns null for javadoc tags.

        */ public char[] asCharArray() throws IllegalArgumentException; /** *

        Returns true if the member's value was not explicitly set in the * annotation instance but was instead taken from the member definition's * default.

        * *

        Note that not all JAM implementations may be able to distinguish * the case where the value is explicitly declared to be the same value * as the member's default from the case where the value is not declared * and the value is implicitly default. In this event, this method * will return true if and only if the effective value of the annotation * is the same as the default value (regardless of how that value was * declared).

        */ public boolean isDefaultValueUsed(); //return the 175 type accessor method? //public JMethod getAccessor(); /** * @deprecated DO NOT CALL THIS METHOD. IT WILL BE REMOVED SOON. This * method is a bad thing because it forces/allows the caller to make * assumptions about how the annotation value is actually represented * in the underlying implementation. Please use a combination * of getType() and the various as...() methods instead. */ public Object getValue(); } ./src/org/codehaus/jam/package.html0000664000175000017500000001213211767656530016405 0ustar brianbrian

        JAM's core API. This package includes JAM's factory mechanism (the Jam* classes) as well as object model (J* classes) which are used to model a set of Java types.

        ./src/org/codehaus/jam/JamClassLoader.java0000664000175000017500000000525111767656530017617 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** * Object which can load representations of a java.lang.Class. * Analagous to a java.lang.ClassLoader. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JamClassLoader { /** *

        Returns a representation of the named class. If the class is * not under the same root as this JElement root, a representation * of it will be synthesized via reflection (see note in class * comments). The 'named' parameter must be a fully-qualified class * name in the classfile 'Field Descriptor' format, a simple * primitive name (e.g. 'long' or 'int'), or 'void'.

        * *

        A note regarding fully-qualified class names: if you're * looking up a non-array type by name, you can just pass the * regular, fully-qualified name. If you're looking up an array * type, you need to use the 'Field Descriptor' format as described * in secion 4.3.2 of the VM spec. This is the same name format * that is returned by JClass.getFieldDescriptor.

        * *

        Inner classes cannot be loaded with this method. To load an inner * class, you must load the outer class first and then call getClasses(). *

        * *

        Note that this method always returns some JClass - it never * returns null or throws ClassNotFoundException. If neither a * sourcefile not a classfile could be located for the named class, * a stubbed-out JClass will be returned with the isUnresolved() * flag set to true. This JClass will have a name (as determined by * the given descriptor), but no other information about it will be * available.

        * * @throws IllegalArgumentException if the parameter is null or not * a valid class name. */ public JClass loadClass(String fieldDescriptor); /** * Returns a representation of a package having the given name. * @throws IllegalArgumentException if the parameter is null or not * a valid package name. */ public JPackage getPackage(String qualifiedPackageName); }./src/org/codehaus/jam/JComment.java0000664000175000017500000000234311767656530016506 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        Encapsulates comment associated with a package, class, * method, and so on. Although they are often declared in the same * place (code comments) JComment is a distinct entity from * JAnnotation.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JComment extends JElement { /** * Returns the text of this comment. */ public String getText(); /** * Returns the location of this comment in the source, or null if it * is unknown. */ public JSourcePosition getSourcePosition(); } ./src/org/codehaus/jam/JPackage.java0000664000175000017500000000267611767656530016450 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** * Represents a java package. Provides access to information about the * package, the package's comment and tags, and the classes in the * package. * *

        FIXME how are we handling the default package? i think it * should be a package with an empty string for a name, but we need to * make sure this works and document it.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JPackage extends JAnnotatedElement { /** * Returns the classes in this package which were specified as part * of the JRoot construction. Note that this does not necessarily * include all of the classes that are actually in the package (it * may not contain any specified classes at all). */ public JClass[] getClasses(); } ./src/org/codehaus/jam/JamClassIterator.java0000664000175000017500000000631011767656530020177 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import java.util.Iterator; /** * A typed Iterator on a set of JClasses. * * The use of JamClassIterator (as opposed to arrays or Collections of JClass) * is encouraged as it can significantly reduce memory consumption when * using JAM to process large numbers of java classes. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public class JamClassIterator implements Iterator { // ======================================================================== // Variables private JamClassLoader mLoader; private String[] mClassNames; private int mIndex = 0; // ======================================================================== // Constructor /** * Constructs a new JamClassIterator * * @param loader JamClassLoader from which to load the classes * @param classes Array of full-qualified classnames to iterate on. * * @throws IllegalArgumentException if either argument is null. */ public JamClassIterator(JamClassLoader loader, String[] classes) { if (loader == null) throw new IllegalArgumentException("null loader"); if (classes == null) throw new IllegalArgumentException("null classes"); mLoader = loader; mClassNames = classes; } // ======================================================================== // Public methods /** * Returns the next class. Exactly equivalent to (JClass)next(). * * @throws IndexOutOfBoundsException if there are no classes left to * iterate on. */ public JClass nextClass() { if (!hasNext()) throw new IndexOutOfBoundsException(); mIndex++; return mLoader.loadClass(mClassNames[mIndex-1]); } // ======================================================================== // Iterator implementation /** * Returns true if classes remain to be iterated upon. */ public boolean hasNext() { return mIndex < mClassNames.length; } /** * Returns the next class. * * @throws IndexOutOfBoundsException if there are no classes left to * iterate on. */ public Object next() { return nextClass(); } // ======================================================================== // Public methods public int getSize() { return mClassNames.length; } // ======================================================================== // Unsupported methods /** * Not supported. * * @throws UnsupportedOperationException */ public void remove() { throw new UnsupportedOperationException(); } } ./src/org/codehaus/jam/JParameter.java0000664000175000017500000000365411767656530017032 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** * Represents a single parameter of a Java method or constructor. * This type and name information as well as associated metadata. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JParameter extends JAnnotatedElement { /** * Returns the type of this parameter. */ public JClass getType(); /** * Returns the position of this parameter in its enclosing method's * or constructor's list of parameters. * * This is commented out because as a general rule, it's probably bad * to expose this information; it violates the notion that a contained * object shouldn't know anything about how it is contained. I waver * on it a little because there are a some samples where (esp. in annogen) * where it is useful to know this, primarily due to the fact that * the reflection API does not treat parameters as first-class citizens. * * @return */ //public int getNumber(); // REVIEW: This would be nice, but there is currently no way to find // this out via either javadoc or reflection. I guess it's not // clear that this is going to be very useful anyway. /** * Return true if this parameter is final. */ // public boolean isFinal(); } ./src/org/codehaus/jam/JSourcePosition.java0000664000175000017500000000234411767656530020072 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; import java.net.URI; /** * Describes a specific point in a source file. * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JSourcePosition { /** * Returns the text column number for this source position, or -1 if * it is not known. */ public int getColumn(); /** * Returns the text line number for this source position, or -1 if * it is not known. */ public int getLine(); /** * Returns the URI of the source file, or null if it is not known. */ public URI getSourceURI(); } ./src/org/codehaus/jam/JProperty.java0000664000175000017500000000340411767656530016727 0ustar brianbrian/* Copyright 2004 The Apache Software Foundation * * Licensed 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.codehaus.jam; /** *

        This is a helper class which provides java.beans-like * functionality in the JAM framework. extension to the JAM framework that encapsulates the notion of a * javabean properties. This class can be used to get similar * functionality in JAM that is provided by the java.beans.* * packge.

        * *

        An array of JProperties for a given JClass can be retrieved * using the getProperties factory method.

        * * @author Patrick Calahan <email: pcal-at-bea-dot-com> */ public interface JProperty extends JAnnotatedElement { // ======================================================================== // Public methods /** * Returns a JClass which represents the type of this property. */ public JClass getType(); /** * Returns a JMethod which represents the setter for this property. * Returns null if this property is view-only. */ public JMethod getSetter(); /** * Returns a JMethod which represents the getter for this property. * Returns null if this property is write-only. */ public JMethod getGetter(); } ./LICENSE0000664000175000017500000000042211767656530011210 0ustar brianbrianThis project contains code under two separate licenses. 1) For code under src/javax, the CDDL applies See http://www.opensource.org/licenses/cddl1.php 2) For all other code, the Apache Software License, version 2.0 applies. See http://www.apache.org/licenses/LICENSE-2.0 ./build.sh0000775000175000017500000000052511767656530011645 0ustar brianbrian#!/bin/sh export CLASSPATH=$( build-classpath httpcomponents/httpcore \ backport-util-concurrent commons-logging \ wsdl4j javamail geronimo-jta jaxen servlet \ commons-fileupload commons-httpclient commons-cli \ geronimo-jms httpcomponents/httpcore-nio ) ant

        Creates the JamClassBuilder for the given context. This will be * a composite that may include custom source and class-based classbuilders. * It usually includes the system classbuilders and always contains the * builtin classbuilder. */ protected JamClassBuilder createBuilder(JamServiceContext ctx) throws IOException { JamLogger log = ctx.getLogger(); List builders = new ArrayList(); // make a list of the builders we want // add the base builder if there is one JamClassBuilder b = ctx.getBaseBuilder(); if (b != null) builders.add(b); // look for source file builder b = createSourceBuilder(ctx); if (log.isVerbose(this)) { log.verbose("added classbuilder for sources"); } if (b != null) builders.add(b); // prefer first source b = createClassfileBuilder(ctx); // then custom classpath if (log.isVerbose(this)) { log.verbose("added classbuilder for custom classpath"); } if (b != null) builders.add(b); ClassLoader[] cls = ctx.getReflectionClassLoaders(); for(int i=0; iCreates the source-based classbuilder for the given context. * If no source files or paths are specified in the context, * just returns null.

See {@link RFC 5234} * for a description of the syntax used above and the expansions of * {@code WSP}, {@code ALPHA} and {@code DIGIT}. In the above {@code name} * is the template parameter name and the optional {@code regex} specifies * the contents of the capturing group for the parameter. If {@code regex} * is not supplied then a default value of {@code [^/]+} which terminates at * a path segment boundary, is used. Matching of request URIs to URI * templates is performed against encoded path values and implementations * will not escape literal characters in regex automatically, therefore any * literals in {@code regex} should be escaped by the author according to * the rules of * {@link RFC 3986 section 3.3}. * Caution is recommended in the use of {@code regex}, incorrect use can * lead to a template parameter matching unexpected URI paths. See * {@link Pattern} * for further information on the syntax of regular expressions. * Values of template parameters may be extracted using {@link PathParam}. * *

̓hy@+C5ZZhga0Gwk lcYD{p'uvoED93TK;mCNF[wlwe渲KLn2GF!i< )Ƃ-&Jvd+rRUoM[TjP.}"6 [g2ipBM n@ӌ#~"CH Hq>|W{rCKdT;ޡ ,x"./c[KV`͕ܖmik%/i- OO0*we\*rip[m\k276uNi۠2p E^tX]`[u;żmN@&x+ gj$gMTMCv l)JK&"T&ZMøkPaQʶ:ƶco:|vc{ohU؅,!CUf.z@4;efӳuYۄ/AmJRZ[3eqm,Al[=+7cB&eJ>eMX[!%E%  &,5>K-(On(՚NL>QƤ"N|+:b}ϱ?6%&UH)UZQ)jV4R>-lÂ߀*{n4 .`Rí- /{*g1-Z Iu8^jƁ1<haEHԊV5}X{+Lrz.gK.5JE츲~x~Wzu|EB5HL~edցiTEج`P#xy)NW;T[I.* Iy=?48(htWT6I&p6R/C*YzuhN!セ7䐇$oACo!oF#rFgk-K<ȕ{!~hMc?OR\*浥11ZJt4-3lxXP؂g74q6LVƴ<;-*sW2a ܎?u[d<~ᝯ0`qav2Mf%( \Na`ݚhxiaWtSHc*e&?R#I!UД-X$LSMT2NUqbF2UQm4Ȑ'5d5xQCb,Xx86%Xl:*!㷓d6(aHS8NOWNa.UaMG'/1nN@o %HAy*̡7{X{[1<Ҝ(_})T񥭼.7R0d`2DS  ?uWNVTtzIS-7fxvP ~ %&ԤaDHV-#; /G:F [@ÝzP+r;d/NUͱ/^<*l/0.nC2T÷Fm0\/=۠ RnMv<8\B|OCiFS9~bg\;|$]'wmW\U6t:?AÛUq%Oj)AJ.LJ烹)pt^=`8'9%Rps1z'j{w'Qu%Oqu.Y6wWi/[mJo3]'QɭS?6±ŴOum)K-`+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